es-grid-template 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid-component/EditableCell.js +46 -15
- package/es/grid-component/InternalTable.d.ts +1 -0
- package/es/grid-component/InternalTable.js +467 -111
- package/es/grid-component/TableGrid.js +2 -7
- package/es/grid-component/hooks/columns/index.d.ts +1 -1
- package/es/grid-component/hooks/columns/index.js +3 -13
- package/es/grid-component/hooks/useColumns.js +2 -0
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/hooks/utils.js +3 -3
- package/es/grid-component/styles.scss +1186 -1170
- package/es/grid-component/table/Grid.d.ts +1 -0
- package/es/grid-component/table/GridEdit.d.ts +1 -0
- package/es/grid-component/table/GridEdit.js +156 -121
- package/es/grid-component/table/Group.d.ts +1 -0
- package/es/grid-component/type.d.ts +7 -2
- package/es/grid-component/useContext.d.ts +1 -0
- package/lib/grid-component/EditableCell.js +46 -15
- package/lib/grid-component/InternalTable.d.ts +1 -0
- package/lib/grid-component/InternalTable.js +467 -100
- package/lib/grid-component/TableGrid.js +2 -7
- package/lib/grid-component/hooks/columns/index.d.ts +1 -1
- package/lib/grid-component/hooks/columns/index.js +5 -15
- package/lib/grid-component/hooks/useColumns.js +2 -0
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/hooks/utils.js +3 -3
- package/lib/grid-component/styles.scss +1186 -1170
- package/lib/grid-component/table/Grid.d.ts +1 -0
- package/lib/grid-component/table/GridEdit.d.ts +1 -0
- package/lib/grid-component/table/GridEdit.js +156 -121
- package/lib/grid-component/table/Group.d.ts +1 -0
- package/lib/grid-component/type.d.ts +7 -2
- package/lib/grid-component/useContext.d.ts +1 -0
- package/package.json +109 -109
|
@@ -52,6 +52,7 @@ const EditableCell = props => {
|
|
|
52
52
|
indexRow,
|
|
53
53
|
indexCol,
|
|
54
54
|
cellEditing,
|
|
55
|
+
// errors,
|
|
55
56
|
...restProps
|
|
56
57
|
} = props;
|
|
57
58
|
const {
|
|
@@ -59,7 +60,8 @@ const EditableCell = props => {
|
|
|
59
60
|
control,
|
|
60
61
|
getValues,
|
|
61
62
|
handleCellChange,
|
|
62
|
-
getRowKey
|
|
63
|
+
getRowKey,
|
|
64
|
+
errors
|
|
63
65
|
} = useContext(TableContext);
|
|
64
66
|
const datePickerRef = React.useRef(null);
|
|
65
67
|
const dateTimePickerRef = React.useRef(null);
|
|
@@ -86,7 +88,10 @@ const EditableCell = props => {
|
|
|
86
88
|
validateOption,
|
|
87
89
|
options: propsOptions
|
|
88
90
|
} = column.editSelectSettings || {};
|
|
89
|
-
const isInvalid = false;
|
|
91
|
+
const isInvalid = column.field ? errors[column.field] : false;
|
|
92
|
+
|
|
93
|
+
// const message = errors && column.field && errors[column.field] ? errors[column.field].message : ''
|
|
94
|
+
const message = isInvalid?.message;
|
|
90
95
|
const keySelect = checkFieldKey(column?.editSelectSettings?.fieldKey);
|
|
91
96
|
const selectOptions = typeof propsOptions === 'function' ? propsOptions(record, column.dataIndex) : propsOptions;
|
|
92
97
|
const options = validateOption ? validateOption(record, column.dataIndex) : selectOptions ?? [];
|
|
@@ -151,7 +156,10 @@ const EditableCell = props => {
|
|
|
151
156
|
datePickerRef.current?.focus();
|
|
152
157
|
}, 0);
|
|
153
158
|
},
|
|
154
|
-
popupClassName: 'be-popup-container'
|
|
159
|
+
popupClassName: 'be-popup-container',
|
|
160
|
+
status: isInvalid ? 'error' : undefined,
|
|
161
|
+
"data-tooltip-content": message,
|
|
162
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
155
163
|
});
|
|
156
164
|
case 'datetime':
|
|
157
165
|
return /*#__PURE__*/React.createElement(DatePicker
|
|
@@ -204,7 +212,10 @@ const EditableCell = props => {
|
|
|
204
212
|
});
|
|
205
213
|
}
|
|
206
214
|
},
|
|
207
|
-
popupClassName: 'be-popup-container'
|
|
215
|
+
popupClassName: 'be-popup-container',
|
|
216
|
+
status: isInvalid ? 'error' : undefined,
|
|
217
|
+
"data-tooltip-content": message,
|
|
218
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
208
219
|
});
|
|
209
220
|
case 'month':
|
|
210
221
|
case 'quarter':
|
|
@@ -227,7 +238,10 @@ const EditableCell = props => {
|
|
|
227
238
|
disabled: isDisable(column, record) ?? false,
|
|
228
239
|
maxDate: maxDateValue1,
|
|
229
240
|
minDate: minDateValue1,
|
|
230
|
-
popupClassName: 'be-popup-container'
|
|
241
|
+
popupClassName: 'be-popup-container',
|
|
242
|
+
status: isInvalid ? 'error' : undefined,
|
|
243
|
+
"data-tooltip-content": message,
|
|
244
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
231
245
|
});
|
|
232
246
|
case 'week':
|
|
233
247
|
const weekFormat = getDatepickerFormat(editType, cellFormat);
|
|
@@ -244,7 +258,10 @@ const EditableCell = props => {
|
|
|
244
258
|
disabled: isDisable(column, record) ?? false,
|
|
245
259
|
maxDate: maxWeekValue,
|
|
246
260
|
minDate: minWeekValue,
|
|
247
|
-
popupClassName: 'be-popup-container'
|
|
261
|
+
popupClassName: 'be-popup-container',
|
|
262
|
+
status: isInvalid ? 'error' : undefined,
|
|
263
|
+
"data-tooltip-content": message,
|
|
264
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
248
265
|
});
|
|
249
266
|
case 'time':
|
|
250
267
|
const timeFormat = getDatepickerFormat(editType, cellFormat);
|
|
@@ -268,7 +285,10 @@ const EditableCell = props => {
|
|
|
268
285
|
width: '100%',
|
|
269
286
|
height: '100%'
|
|
270
287
|
},
|
|
271
|
-
popupClassName: 'be-popup-container'
|
|
288
|
+
popupClassName: 'be-popup-container',
|
|
289
|
+
status: isInvalid ? 'error' : undefined,
|
|
290
|
+
"data-tooltip-content": message,
|
|
291
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
272
292
|
});
|
|
273
293
|
case 'selectTable':
|
|
274
294
|
const rr = selectColumns ?? [];
|
|
@@ -373,7 +393,9 @@ const EditableCell = props => {
|
|
|
373
393
|
fieldNames: fieldNames ? fieldNames : {
|
|
374
394
|
value: keySelect,
|
|
375
395
|
label: inputKey ?? 'label'
|
|
376
|
-
}
|
|
396
|
+
},
|
|
397
|
+
"data-tooltip-content": message,
|
|
398
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
377
399
|
});
|
|
378
400
|
case 'select':
|
|
379
401
|
let valueSelect = value;
|
|
@@ -429,7 +451,9 @@ const EditableCell = props => {
|
|
|
429
451
|
fieldNames: fieldNames ? fieldNames : {
|
|
430
452
|
value: keySelect,
|
|
431
453
|
label: inputKey ?? 'label'
|
|
432
|
-
}
|
|
454
|
+
},
|
|
455
|
+
"data-tooltip-content": message,
|
|
456
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
433
457
|
});
|
|
434
458
|
case 'asyncSelect':
|
|
435
459
|
let valueAsyncSelect = value;
|
|
@@ -524,7 +548,9 @@ const EditableCell = props => {
|
|
|
524
548
|
fieldNames: fieldNames ? fieldNames : {
|
|
525
549
|
value: keySelect,
|
|
526
550
|
label: inputKey ?? 'label'
|
|
527
|
-
}
|
|
551
|
+
},
|
|
552
|
+
"data-tooltip-content": message,
|
|
553
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
528
554
|
});
|
|
529
555
|
case 'treeSelect':
|
|
530
556
|
// let valueTreeSelect
|
|
@@ -595,7 +621,9 @@ const EditableCell = props => {
|
|
|
595
621
|
});
|
|
596
622
|
},
|
|
597
623
|
popupClassName: 'be-popup-container',
|
|
598
|
-
status: isInvalid ? 'error' : undefined
|
|
624
|
+
status: isInvalid ? 'error' : undefined,
|
|
625
|
+
"data-tooltip-content": message,
|
|
626
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
599
627
|
});
|
|
600
628
|
case 'checkbox':
|
|
601
629
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -816,7 +844,9 @@ const EditableCell = props => {
|
|
|
816
844
|
type: 'blur'
|
|
817
845
|
});
|
|
818
846
|
}
|
|
819
|
-
}
|
|
847
|
+
},
|
|
848
|
+
"data-tooltip-content": message,
|
|
849
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
820
850
|
}));
|
|
821
851
|
default:
|
|
822
852
|
return /*#__PURE__*/React.createElement(Input, {
|
|
@@ -876,9 +906,10 @@ const EditableCell = props => {
|
|
|
876
906
|
});
|
|
877
907
|
// }
|
|
878
908
|
},
|
|
879
|
-
onChange: onChange
|
|
880
|
-
|
|
881
|
-
|
|
909
|
+
onChange: onChange,
|
|
910
|
+
status: isInvalid ? 'error' : undefined,
|
|
911
|
+
"data-tooltip-content": message,
|
|
912
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
882
913
|
});
|
|
883
914
|
}
|
|
884
915
|
};
|
|
@@ -4,5 +4,6 @@ import type { GridTableProps } from "./type";
|
|
|
4
4
|
import 'dayjs/locale/es';
|
|
5
5
|
import 'dayjs/locale/vi';
|
|
6
6
|
import './styles.scss';
|
|
7
|
+
export declare const SELECTION_COLUMN: {};
|
|
7
8
|
declare const InternalTable: <RecordType extends object>(props: GridTableProps<RecordType>) => React.JSX.Element;
|
|
8
9
|
export default InternalTable;
|