es-grid-template 1.9.71 → 1.9.72
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/ali-table/Grid.d.ts +2 -1
- package/es/ali-table/Grid.js +12 -5
- package/es/ali-table/InternalTable.js +45 -94
- package/es/ali-table/base-table/cell/HeaderEditCell.js +4 -1
- package/es/ali-table/base-table/renderFilter.js +13 -5
- package/es/ali-table/base-table/styles.d.ts +6 -0
- package/es/ali-table/base-table/styles.js +5 -2
- package/es/ali-table/pipeline/features/columnCustom.d.ts +1 -0
- package/es/ali-table/pipeline/features/columnCustom.js +38 -25
- package/es/ali-table/pipeline/features/hiddenColumns.d.ts +1 -0
- package/es/ali-table/pipeline/features/hiddenColumns.js +9 -3
- package/es/ali-table/pipeline/features/treeSelect.js +3 -3
- package/es/ali-table/utils/constants.d.ts +3 -1
- package/es/ali-table/utils/constants.js +5 -2
- package/es/ali-table/utils/utility.d.ts +1 -0
- package/es/ali-table/utils/utility.js +5 -1
- package/es/group-component/hook/utils.d.ts +3 -3
- package/lib/ali-table/Grid.d.ts +2 -1
- package/lib/ali-table/Grid.js +12 -4
- package/lib/ali-table/InternalTable.js +45 -94
- package/lib/ali-table/base-table/cell/HeaderEditCell.js +4 -1
- package/lib/ali-table/base-table/renderFilter.js +13 -5
- package/lib/ali-table/base-table/styles.d.ts +6 -0
- package/lib/ali-table/base-table/styles.js +5 -2
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +1 -0
- package/lib/ali-table/pipeline/features/columnCustom.js +38 -25
- package/lib/ali-table/pipeline/features/hiddenColumns.d.ts +1 -0
- package/lib/ali-table/pipeline/features/hiddenColumns.js +9 -3
- package/lib/ali-table/pipeline/features/treeSelect.js +3 -3
- package/lib/ali-table/utils/constants.d.ts +3 -1
- package/lib/ali-table/utils/constants.js +6 -3
- package/lib/ali-table/utils/utility.d.ts +1 -0
- package/lib/ali-table/utils/utility.js +7 -2
- package/package.json +1 -1
|
@@ -202,8 +202,14 @@ function columnCustom(opts) {
|
|
|
202
202
|
if (info.source === 'trigger') {
|
|
203
203
|
if (newVisible) {
|
|
204
204
|
const defaultFilterOption = defaultFilter?.find(it => it.field === column.field);
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
|
|
206
|
+
// Tìm trong filterState
|
|
207
|
+
|
|
208
|
+
const abc = filterState.find(it => it.field === column.field);
|
|
209
|
+
|
|
210
|
+
// const filterValue = filterColumnState.filteredKeys === null ? [] : (filterColumnState.filteredKeys ?? (defaultFilterOption?.filteredKeys ?? [])) as string[]
|
|
211
|
+
const filterValue = abc && abc.filteredKeys === null ? [] : abc?.filteredKeys ?? defaultFilterOption?.filteredKeys ?? [];
|
|
212
|
+
const operator = abc?.operator;
|
|
207
213
|
const operatorValue = operator ?? defaultFilterOption?.operator ?? (0, _utils2.getDefaultOperator)(column);
|
|
208
214
|
pipeline.setStateAtKey(_constants.stateKeyColumnFilter, {
|
|
209
215
|
operator: operatorValue,
|
|
@@ -223,7 +229,7 @@ function columnCustom(opts) {
|
|
|
223
229
|
if (inputFilter) {
|
|
224
230
|
inputFilter.focus();
|
|
225
231
|
}
|
|
226
|
-
},
|
|
232
|
+
}, 20);
|
|
227
233
|
} else {}
|
|
228
234
|
triggerVisible(newVisible, column.field);
|
|
229
235
|
}
|
|
@@ -284,9 +290,11 @@ function columnCustom(opts) {
|
|
|
284
290
|
operator: filterColumnState.operator ?? undefined
|
|
285
291
|
};
|
|
286
292
|
const rs = (0, _hooks.updateArrayByKey)(filterState, currentFilter, 'field');
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
293
|
+
|
|
294
|
+
// pipeline.setStateAtKey(stateKeyColumnFilter, {
|
|
295
|
+
// ...currentFilter
|
|
296
|
+
// })
|
|
297
|
+
|
|
290
298
|
pipeline.setStateAtKey(_constants.stateKeyFilter, rs);
|
|
291
299
|
if (onFilter) {
|
|
292
300
|
onFilter((0, _utils2.convertFilters)([...newFilterState]));
|
|
@@ -1267,7 +1275,7 @@ function columnCustom(opts) {
|
|
|
1267
1275
|
const prevGetCellProps = col?.getCellProps;
|
|
1268
1276
|
const headerCustomTooltip = col?.headerTooltip ?? (t ? t(col?.headerText) : col?.headerText);
|
|
1269
1277
|
const htmlTooltip = headerCustomTooltip;
|
|
1270
|
-
const headerEditType = col.headerEditType;
|
|
1278
|
+
const headerEditType = col.headerEditType ?? col.editType;
|
|
1271
1279
|
const headerRowIndex = params.path.findIndex(it => it.field === col.field);
|
|
1272
1280
|
const headerRowId = `header-field-${headerRowIndex}`;
|
|
1273
1281
|
|
|
@@ -1277,6 +1285,7 @@ function columnCustom(opts) {
|
|
|
1277
1285
|
[col.field]: headerData?.[col.field] ?? ''
|
|
1278
1286
|
};
|
|
1279
1287
|
const headerValue = headerData?.[col.field] ?? '';
|
|
1288
|
+
const headerContent = (0, _useColumns.renderValueCell)(col, headerValue, {}, -1, startIndex, format, false);
|
|
1280
1289
|
const cellHeaderEditing = isEditing.editing && headerRowId === focusedCell.rowId && col.field === focusedCell.colId;
|
|
1281
1290
|
const isCellSelect = headerRowId === focusedCell.rowId && startCell?.colId === col.field;
|
|
1282
1291
|
const aa = (0, _utils3.getColumnsAtLevel)(originCols, headerRowIndex);
|
|
@@ -1288,23 +1297,7 @@ function columnCustom(opts) {
|
|
|
1288
1297
|
...col,
|
|
1289
1298
|
lock: !!col.fixed,
|
|
1290
1299
|
width: sizes[startIndex],
|
|
1291
|
-
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
1292
|
-
className: "ui-rc-grid-filter-column d-flex",
|
|
1293
|
-
style: {
|
|
1294
|
-
justifyContent: 'space-between',
|
|
1295
|
-
alignItems: 'center'
|
|
1296
|
-
}
|
|
1297
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
1298
|
-
className: "ui-rc-table-column-title",
|
|
1299
|
-
style: {}
|
|
1300
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1301
|
-
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
1302
|
-
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
|
|
1303
|
-
[`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header'),
|
|
1304
|
-
[`${prefix}-grid-cell-text-center`]: (col?.headerTextAlign ?? col?.textAlign) === 'center',
|
|
1305
|
-
[`${prefix}-grid-cell-text-right`]: (col?.headerTextAlign ?? col.textAlign) === 'right'
|
|
1306
|
-
})
|
|
1307
|
-
}, headerEditAble && col.headerEditEnable && cellHeaderEditing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_HeaderEditCell.default, {
|
|
1300
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, headerEditAble && col.headerEditEnable && cellHeaderEditing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_HeaderEditCell.default, {
|
|
1308
1301
|
column: col,
|
|
1309
1302
|
editType: headerEditType ?? 'text',
|
|
1310
1303
|
record: headerRecord,
|
|
@@ -1328,7 +1321,23 @@ function columnCustom(opts) {
|
|
|
1328
1321
|
startCell: startCell,
|
|
1329
1322
|
handleSubmit: handleSubmit,
|
|
1330
1323
|
onSubmit: onSubmit
|
|
1331
|
-
})) :
|
|
1324
|
+
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
1325
|
+
className: "ui-rc-grid-filter-column d-flex",
|
|
1326
|
+
style: {
|
|
1327
|
+
justifyContent: 'space-between',
|
|
1328
|
+
alignItems: 'center'
|
|
1329
|
+
}
|
|
1330
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
1331
|
+
className: "ui-rc-table-column-title",
|
|
1332
|
+
style: {}
|
|
1333
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1334
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
1335
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
|
|
1336
|
+
[`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header'),
|
|
1337
|
+
[`${prefix}-grid-cell-text-center`]: (col?.headerTextAlign ?? col?.textAlign) === 'center',
|
|
1338
|
+
[`${prefix}-grid-cell-text-right`]: (col?.headerTextAlign ?? col.textAlign) === 'right'
|
|
1339
|
+
})
|
|
1340
|
+
}, headerEditAble && col.headerEditEnable ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, headerContent) : col.headerTemplate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof col.headerTemplate === 'function' ? col.headerTemplate(col) : col.headerTemplate) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, prevTitle))), (!_hooks.nonActionColumn.includes(col.field) && !col?.children || col?.children && col?.children.length < 1) && /*#__PURE__*/_react.default.createElement("span", {
|
|
1332
1341
|
className: "ui-rc-header-trigger d-flex gap-50"
|
|
1333
1342
|
}, canSort && /*#__PURE__*/_react.default.createElement("div", {
|
|
1334
1343
|
style: {
|
|
@@ -1398,6 +1407,7 @@ function columnCustom(opts) {
|
|
|
1398
1407
|
className: (0, _classnames.default)('', {
|
|
1399
1408
|
[`header-cell-editable`]: col.headerEditEnable,
|
|
1400
1409
|
[`${prefix}-grid-cell-selected`]: !cellHeaderEditing && isCellSelect,
|
|
1410
|
+
'cell-editing': cellHeaderEditing,
|
|
1401
1411
|
'cell-border-top': !cellHeaderEditing && isCellSelect,
|
|
1402
1412
|
'cell-border-bottom': !cellHeaderEditing && isCellSelect,
|
|
1403
1413
|
'cell-border-right': !cellHeaderEditing && isCellSelect,
|
|
@@ -1501,6 +1511,9 @@ function columnCustom(opts) {
|
|
|
1501
1511
|
}),
|
|
1502
1512
|
getCellProps(value, record, rowIndex) {
|
|
1503
1513
|
const prevCellProps = prevGetCellProps?.(value, record, rowIndex);
|
|
1514
|
+
|
|
1515
|
+
// console.log('record', record)
|
|
1516
|
+
|
|
1504
1517
|
const fomatedValue = ['color', 'checkbox', 'field'].includes(col.type ?? '') ? '' : (0, _useColumns.renderValueCell)(col, value, record, rowIndex, 0, format, false);
|
|
1505
1518
|
const tooltipContent = isOpenTooltip === false ? '' : col?.tooltipDescription ? typeof col.tooltipDescription === 'function' ? col.tooltipDescription({
|
|
1506
1519
|
value,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TablePipeline } from '../pipeline';
|
|
2
2
|
export interface HiddenColumnsOptions {
|
|
3
3
|
columns: any[];
|
|
4
|
+
groupColumns?: any[];
|
|
4
5
|
visibleKeys?: any[];
|
|
5
6
|
}
|
|
6
7
|
export declare function hiddenColumns(opts: HiddenColumnsOptions): (pipeline: TablePipeline) => TablePipeline;
|
|
@@ -4,19 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.hiddenColumns = hiddenColumns;
|
|
7
|
+
var _constants = require("../../utils/constants");
|
|
7
8
|
var _convertColumnsChoose = require("../../utils/convertColumnsChoose");
|
|
9
|
+
var _utility = require("../../utils/utility");
|
|
8
10
|
// const stateKey = 'pagination'
|
|
9
11
|
|
|
10
12
|
function hiddenColumns(opts) {
|
|
11
13
|
return function visibleClumns(pipeline) {
|
|
12
14
|
const {
|
|
13
15
|
columns,
|
|
14
|
-
visibleKeys
|
|
16
|
+
visibleKeys,
|
|
17
|
+
groupColumns
|
|
15
18
|
} = opts;
|
|
16
|
-
pipeline.
|
|
19
|
+
const abc = pipeline.getStateAtKey(_constants.stateKeyVisibleKeys) ?? visibleKeys ?? [];
|
|
20
|
+
const group = pipeline.getStateAtKey(_constants.stateKeyGroupKeys) ?? groupColumns ?? [];
|
|
21
|
+
const rs = (0, _utility.getOnlyInA)(abc, group);
|
|
22
|
+
pipeline.columns(processDataSource(columns, rs));
|
|
17
23
|
return pipeline;
|
|
18
24
|
function processDataSource(cols, keys) {
|
|
19
|
-
if (!keys) {
|
|
25
|
+
if (!keys || keys && keys.length === 0) {
|
|
20
26
|
return cols;
|
|
21
27
|
}
|
|
22
28
|
return (0, _convertColumnsChoose.filterColumnsByField)(cols, keys ?? []);
|
|
@@ -226,7 +226,7 @@ function treeSelect(opts) {
|
|
|
226
226
|
return {
|
|
227
227
|
style: {
|
|
228
228
|
// cursor: 'not-allowed',
|
|
229
|
-
|
|
229
|
+
paddingBlock: 0
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
}
|
|
@@ -237,14 +237,14 @@ function treeSelect(opts) {
|
|
|
237
237
|
return {
|
|
238
238
|
style: {
|
|
239
239
|
cursor: 'not-allowed',
|
|
240
|
-
|
|
240
|
+
paddingBlock: 0
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
return (0, _utils2.mergeCellProps)(prevCellProps, {
|
|
245
245
|
style: {
|
|
246
246
|
cursor: 'pointer',
|
|
247
|
-
|
|
247
|
+
paddingBlock: 0
|
|
248
248
|
},
|
|
249
249
|
onClick(e) {
|
|
250
250
|
if (opts.stopClickEventPropagation) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const stateKeyResize = "columnResize";
|
|
2
2
|
export declare const stateKeyFilter = "columnsFilter";
|
|
3
|
+
export declare const stateKeyColumnFilter = "columnFilter";
|
|
3
4
|
export declare const stateKeySorter = "columnsSorter";
|
|
4
5
|
export declare const stateKeyVisible = "visible";
|
|
5
6
|
export declare const stateKeyTooltip = "tooltip";
|
|
6
7
|
export declare const stateKeyPagination = "pagination";
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const stateKeyVisibleKeys = "columnVisibleKeys";
|
|
9
|
+
export declare const stateKeyGroupKeys = "columnGroupKeys";
|
|
8
10
|
export declare const stateKeyFocusedCell = "focusedCell";
|
|
9
11
|
export declare const stateKeyIsEditing = "isEditing";
|
|
10
12
|
export declare const stateKeyStartPasteCell = "startPasteCell";
|
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.stateKeyVisible = exports.stateKeyTypePaste = exports.stateKeyTooltip = exports.stateKeyStartPasteCell = exports.stateKeyStartCell = exports.stateKeySorter = exports.stateKeyResize = exports.stateKeyPagination = exports.stateKeyIsSelecting = exports.stateKeyIsPasting = exports.stateKeyIsEditing = exports.stateKeyFocusedCell = exports.stateKeyFilter = exports.stateKeyEndPasteCell = exports.stateKeyEndCell = exports.stateKeyEditCellSettings = exports.stateKeyColumnFilter = void 0;
|
|
6
|
+
exports.stateKeyVisibleKeys = exports.stateKeyVisible = exports.stateKeyTypePaste = exports.stateKeyTooltip = exports.stateKeyStartPasteCell = exports.stateKeyStartCell = exports.stateKeySorter = exports.stateKeyResize = exports.stateKeyPagination = exports.stateKeyIsSelecting = exports.stateKeyIsPasting = exports.stateKeyIsEditing = exports.stateKeyGroupKeys = exports.stateKeyFocusedCell = exports.stateKeyFilter = exports.stateKeyEndPasteCell = exports.stateKeyEndCell = exports.stateKeyEditCellSettings = exports.stateKeyColumnFilter = void 0;
|
|
7
7
|
const stateKeyResize = exports.stateKeyResize = 'columnResize';
|
|
8
|
-
const stateKeyFilter = exports.stateKeyFilter = 'columnsFilter';
|
|
8
|
+
const stateKeyFilter = exports.stateKeyFilter = 'columnsFilter'; // array all state
|
|
9
|
+
const stateKeyColumnFilter = exports.stateKeyColumnFilter = 'columnFilter'; // current column filter state
|
|
10
|
+
|
|
9
11
|
const stateKeySorter = exports.stateKeySorter = 'columnsSorter';
|
|
10
12
|
const stateKeyVisible = exports.stateKeyVisible = 'visible';
|
|
11
13
|
const stateKeyTooltip = exports.stateKeyTooltip = 'tooltip';
|
|
12
14
|
const stateKeyPagination = exports.stateKeyPagination = 'pagination';
|
|
13
|
-
const
|
|
15
|
+
const stateKeyVisibleKeys = exports.stateKeyVisibleKeys = 'columnVisibleKeys';
|
|
16
|
+
const stateKeyGroupKeys = exports.stateKeyGroupKeys = 'columnGroupKeys';
|
|
14
17
|
|
|
15
18
|
// Key for Edit
|
|
16
19
|
|
|
@@ -24,4 +24,5 @@ export declare function updateOrInsert<T extends Row>(dataArray: T[], dataFilter
|
|
|
24
24
|
export declare function filterVisibleColumns<T extends ColumnTable>(columns: T[]): T[];
|
|
25
25
|
export declare const sortByType: (arr: ColumnTable[], rowDnd?: RowDnd) => ColumnTable[];
|
|
26
26
|
export declare function getVisibleColumnFields<T extends ColumnTable>(columns: T[]): string[];
|
|
27
|
+
export declare const getOnlyInA: (a: string[], b: string[]) => string[];
|
|
27
28
|
export {};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addRowIdArray = void 0;
|
|
7
7
|
exports.filterDataByColumns1 = filterDataByColumns1;
|
|
8
8
|
exports.filterVisibleColumns = filterVisibleColumns;
|
|
9
|
-
exports.getMaxDepth = exports.flattenArray = void 0;
|
|
9
|
+
exports.getOnlyInA = exports.getMaxDepth = exports.flattenArray = void 0;
|
|
10
10
|
exports.getVisibleColumnFields = getVisibleColumnFields;
|
|
11
11
|
exports.sortByType = exports.shouldIncludeOptimized = void 0;
|
|
12
12
|
exports.sortData = sortData;
|
|
@@ -715,4 +715,9 @@ function getVisibleColumnFields(columns) {
|
|
|
715
715
|
};
|
|
716
716
|
traverse(columns);
|
|
717
717
|
return result;
|
|
718
|
-
}
|
|
718
|
+
}
|
|
719
|
+
const getOnlyInA = (a, b) => {
|
|
720
|
+
const setB = new Set(b);
|
|
721
|
+
return a.filter(item => !setB.has(item));
|
|
722
|
+
};
|
|
723
|
+
exports.getOnlyInA = getOnlyInA;
|