(records: { [key: string]: any }[])
| 113 | } |
| 114 | |
| 115 | private checkRecordsValues(records: { [key: string]: any }[]) { |
| 116 | const state = this.wCtx.widgetStore.getState() as any as IReduxState; |
| 117 | const fieldDataMap = Selectors.getFieldMap(state, this.datasheetId)!; |
| 118 | |
| 119 | records.forEach(valuesMap => { |
| 120 | Object.entries(valuesMap).forEach(([fieldId, cellValue]) => { |
| 121 | const fieldData = fieldDataMap[fieldId]; |
| 122 | if (!fieldData) { |
| 123 | throw new Error(`FieldId: ${fieldId} is not exist in datasheet`); |
| 124 | } |
| 125 | |
| 126 | const coreField = CoreField.bindModel(fieldDataMap[fieldId]!, state); |
| 127 | if (!coreField.recordEditable(this.datasheetId)) { |
| 128 | throw new Error(`FieldId: ${fieldId} is not editable`); |
| 129 | } |
| 130 | |
| 131 | if (coreField.validateCellValue(cellValue).error) { |
| 132 | throw new Error(`CellValue: ${cellValue} is not validate for field ${fieldId}(${fieldData.name})`); |
| 133 | } |
| 134 | }); |
| 135 | }); |
| 136 | } |
| 137 | |
| 138 | private transformRecordValues(records: { [key: string]: any }[]): { [key: string]: any }[] { |
| 139 | const state = this.wCtx.widgetStore.getState() as any as IReduxState; |
no test coverage detected