es-grid-template 1.4.0 → 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 +469 -113
- package/es/grid-component/TableGrid.js +46 -48
- 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 +5 -2
- package/es/grid-component/hooks/utils.d.ts +17 -2
- package/es/grid-component/hooks/utils.js +24 -5
- 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 +190 -140
- 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 +469 -102
- package/lib/grid-component/TableGrid.js +45 -47
- 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 +4 -1
- package/lib/grid-component/hooks/utils.d.ts +17 -2
- package/lib/grid-component/hooks/utils.js +26 -6
- 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 +189 -139
- 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 +5 -5
|
@@ -9,6 +9,7 @@ type Props<T> = GridTableProps<T> & {
|
|
|
9
9
|
triggerGroupColumns?: (groupedColumns: string[]) => void;
|
|
10
10
|
triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[]) => void;
|
|
11
11
|
triggerFilter?: (queries: any) => void;
|
|
12
|
+
setTooltipContent?: any;
|
|
12
13
|
};
|
|
13
14
|
declare const Group: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
14
15
|
export default Group;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Key, ReactElement, ReactNode } from "react";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { IOperator } from "./hooks";
|
|
4
|
-
import type { TypeFilter, TableProps as RcTableProps, TableColumnType as RcColumnType, EditType } from "rc-master-ui";
|
|
4
|
+
import type { TypeFilter, TableProps as RcTableProps, TableColumnType as RcColumnType, EditType, TablePaginationConfig } from "rc-master-ui";
|
|
5
5
|
import type { FilterOperator, TableRowSelection } from "rc-master-ui/es/table/interface";
|
|
6
6
|
import type { ToolbarItem as RcToolbarItem } from "rc-master-ui/es/toolbar";
|
|
7
7
|
import type { ItemType } from "rc-master-ui/es/menu/interface";
|
|
@@ -135,12 +135,13 @@ export type ColumnTemplate<RecordType> = {
|
|
|
135
135
|
field: string;
|
|
136
136
|
};
|
|
137
137
|
export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
|
|
138
|
-
export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
138
|
+
export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary' | 'pagination'> {
|
|
139
139
|
editAble?: boolean;
|
|
140
140
|
groupAble?: boolean;
|
|
141
141
|
groupColumns?: string[];
|
|
142
142
|
groupSetting?: IGroupSetting;
|
|
143
143
|
onChooseColumns?: (props: IOnChooseColumns) => void;
|
|
144
|
+
pagination?: false | PaginationConfig;
|
|
144
145
|
showCustomTooltip?: boolean;
|
|
145
146
|
sortMultiple?: boolean;
|
|
146
147
|
dataSource: RecordType[];
|
|
@@ -193,7 +194,11 @@ export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<Re
|
|
|
193
194
|
onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
|
|
194
195
|
onCellClick?: (args: ICellClick, callback?: any) => void;
|
|
195
196
|
rowEditable?: (rowData: RecordType) => boolean;
|
|
197
|
+
validate?: any;
|
|
196
198
|
}
|
|
199
|
+
export type PaginationConfig = TablePaginationConfig & {
|
|
200
|
+
currentPage?: number;
|
|
201
|
+
};
|
|
197
202
|
export type ICellClick = {
|
|
198
203
|
index: number;
|
|
199
204
|
indexCol?: number;
|
|
@@ -54,6 +54,7 @@ const EditableCell = props => {
|
|
|
54
54
|
indexRow,
|
|
55
55
|
indexCol,
|
|
56
56
|
cellEditing,
|
|
57
|
+
// errors,
|
|
57
58
|
...restProps
|
|
58
59
|
} = props;
|
|
59
60
|
const {
|
|
@@ -61,7 +62,8 @@ const EditableCell = props => {
|
|
|
61
62
|
control,
|
|
62
63
|
getValues,
|
|
63
64
|
handleCellChange,
|
|
64
|
-
getRowKey
|
|
65
|
+
getRowKey,
|
|
66
|
+
errors
|
|
65
67
|
} = (0, _react.useContext)(_useContext.TableContext);
|
|
66
68
|
const datePickerRef = _react.default.useRef(null);
|
|
67
69
|
const dateTimePickerRef = _react.default.useRef(null);
|
|
@@ -88,7 +90,10 @@ const EditableCell = props => {
|
|
|
88
90
|
validateOption,
|
|
89
91
|
options: propsOptions
|
|
90
92
|
} = column.editSelectSettings || {};
|
|
91
|
-
const isInvalid = false;
|
|
93
|
+
const isInvalid = column.field ? errors[column.field] : false;
|
|
94
|
+
|
|
95
|
+
// const message = errors && column.field && errors[column.field] ? errors[column.field].message : ''
|
|
96
|
+
const message = isInvalid?.message;
|
|
92
97
|
const keySelect = (0, _hooks.checkFieldKey)(column?.editSelectSettings?.fieldKey);
|
|
93
98
|
const selectOptions = typeof propsOptions === 'function' ? propsOptions(record, column.dataIndex) : propsOptions;
|
|
94
99
|
const options = validateOption ? validateOption(record, column.dataIndex) : selectOptions ?? [];
|
|
@@ -153,7 +158,10 @@ const EditableCell = props => {
|
|
|
153
158
|
datePickerRef.current?.focus();
|
|
154
159
|
}, 0);
|
|
155
160
|
},
|
|
156
|
-
popupClassName: 'be-popup-container'
|
|
161
|
+
popupClassName: 'be-popup-container',
|
|
162
|
+
status: isInvalid ? 'error' : undefined,
|
|
163
|
+
"data-tooltip-content": message,
|
|
164
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
157
165
|
});
|
|
158
166
|
case 'datetime':
|
|
159
167
|
return /*#__PURE__*/_react.default.createElement(_antd.DatePicker
|
|
@@ -206,7 +214,10 @@ const EditableCell = props => {
|
|
|
206
214
|
});
|
|
207
215
|
}
|
|
208
216
|
},
|
|
209
|
-
popupClassName: 'be-popup-container'
|
|
217
|
+
popupClassName: 'be-popup-container',
|
|
218
|
+
status: isInvalid ? 'error' : undefined,
|
|
219
|
+
"data-tooltip-content": message,
|
|
220
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
210
221
|
});
|
|
211
222
|
case 'month':
|
|
212
223
|
case 'quarter':
|
|
@@ -229,7 +240,10 @@ const EditableCell = props => {
|
|
|
229
240
|
disabled: (0, _hooks.isDisable)(column, record) ?? false,
|
|
230
241
|
maxDate: maxDateValue1,
|
|
231
242
|
minDate: minDateValue1,
|
|
232
|
-
popupClassName: 'be-popup-container'
|
|
243
|
+
popupClassName: 'be-popup-container',
|
|
244
|
+
status: isInvalid ? 'error' : undefined,
|
|
245
|
+
"data-tooltip-content": message,
|
|
246
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
233
247
|
});
|
|
234
248
|
case 'week':
|
|
235
249
|
const weekFormat = (0, _hooks.getDatepickerFormat)(editType, cellFormat);
|
|
@@ -246,7 +260,10 @@ const EditableCell = props => {
|
|
|
246
260
|
disabled: (0, _hooks.isDisable)(column, record) ?? false,
|
|
247
261
|
maxDate: maxWeekValue,
|
|
248
262
|
minDate: minWeekValue,
|
|
249
|
-
popupClassName: 'be-popup-container'
|
|
263
|
+
popupClassName: 'be-popup-container',
|
|
264
|
+
status: isInvalid ? 'error' : undefined,
|
|
265
|
+
"data-tooltip-content": message,
|
|
266
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
250
267
|
});
|
|
251
268
|
case 'time':
|
|
252
269
|
const timeFormat = (0, _hooks.getDatepickerFormat)(editType, cellFormat);
|
|
@@ -270,7 +287,10 @@ const EditableCell = props => {
|
|
|
270
287
|
width: '100%',
|
|
271
288
|
height: '100%'
|
|
272
289
|
},
|
|
273
|
-
popupClassName: 'be-popup-container'
|
|
290
|
+
popupClassName: 'be-popup-container',
|
|
291
|
+
status: isInvalid ? 'error' : undefined,
|
|
292
|
+
"data-tooltip-content": message,
|
|
293
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
274
294
|
});
|
|
275
295
|
case 'selectTable':
|
|
276
296
|
const rr = selectColumns ?? [];
|
|
@@ -375,7 +395,9 @@ const EditableCell = props => {
|
|
|
375
395
|
fieldNames: fieldNames ? fieldNames : {
|
|
376
396
|
value: keySelect,
|
|
377
397
|
label: inputKey ?? 'label'
|
|
378
|
-
}
|
|
398
|
+
},
|
|
399
|
+
"data-tooltip-content": message,
|
|
400
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
379
401
|
});
|
|
380
402
|
case 'select':
|
|
381
403
|
let valueSelect = value;
|
|
@@ -431,7 +453,9 @@ const EditableCell = props => {
|
|
|
431
453
|
fieldNames: fieldNames ? fieldNames : {
|
|
432
454
|
value: keySelect,
|
|
433
455
|
label: inputKey ?? 'label'
|
|
434
|
-
}
|
|
456
|
+
},
|
|
457
|
+
"data-tooltip-content": message,
|
|
458
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
435
459
|
});
|
|
436
460
|
case 'asyncSelect':
|
|
437
461
|
let valueAsyncSelect = value;
|
|
@@ -526,7 +550,9 @@ const EditableCell = props => {
|
|
|
526
550
|
fieldNames: fieldNames ? fieldNames : {
|
|
527
551
|
value: keySelect,
|
|
528
552
|
label: inputKey ?? 'label'
|
|
529
|
-
}
|
|
553
|
+
},
|
|
554
|
+
"data-tooltip-content": message,
|
|
555
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
530
556
|
});
|
|
531
557
|
case 'treeSelect':
|
|
532
558
|
// let valueTreeSelect
|
|
@@ -597,7 +623,9 @@ const EditableCell = props => {
|
|
|
597
623
|
});
|
|
598
624
|
},
|
|
599
625
|
popupClassName: 'be-popup-container',
|
|
600
|
-
status: isInvalid ? 'error' : undefined
|
|
626
|
+
status: isInvalid ? 'error' : undefined,
|
|
627
|
+
"data-tooltip-content": message,
|
|
628
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
601
629
|
});
|
|
602
630
|
case 'checkbox':
|
|
603
631
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -818,7 +846,9 @@ const EditableCell = props => {
|
|
|
818
846
|
type: 'blur'
|
|
819
847
|
});
|
|
820
848
|
}
|
|
821
|
-
}
|
|
849
|
+
},
|
|
850
|
+
"data-tooltip-content": message,
|
|
851
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
822
852
|
}));
|
|
823
853
|
default:
|
|
824
854
|
return /*#__PURE__*/_react.default.createElement(_antd.Input, {
|
|
@@ -878,9 +908,10 @@ const EditableCell = props => {
|
|
|
878
908
|
});
|
|
879
909
|
// }
|
|
880
910
|
},
|
|
881
|
-
onChange: onChange
|
|
882
|
-
|
|
883
|
-
|
|
911
|
+
onChange: onChange,
|
|
912
|
+
status: isInvalid ? 'error' : undefined,
|
|
913
|
+
"data-tooltip-content": message,
|
|
914
|
+
"data-tooltip-id": "tooltip-form-error"
|
|
884
915
|
});
|
|
885
916
|
}
|
|
886
917
|
};
|
|
@@ -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;
|