es-grid-template 1.9.61 → 1.9.63

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.
Files changed (34) hide show
  1. package/es/ali-table/Grid.js +1 -1
  2. package/es/ali-table/InternalTable.d.ts +2 -1
  3. package/es/ali-table/InternalTable.js +24 -43
  4. package/es/ali-table/base-table/styles.js +1 -1
  5. package/es/ali-table/base-table/table.d.ts +2 -2
  6. package/es/ali-table/base-table/utils.d.ts +2 -0
  7. package/es/ali-table/base-table/utils.js +12 -1
  8. package/es/ali-table/interfaces.d.ts +4 -0
  9. package/es/ali-table/internals.d.ts +2 -1
  10. package/es/ali-table/pipeline/features/columnCustom.d.ts +2 -0
  11. package/es/ali-table/pipeline/features/columnCustom.js +310 -24
  12. package/es/ali-table/utils/utility.d.ts +1 -0
  13. package/es/ali-table/utils/utility.js +43 -1
  14. package/es/grid-component/type.d.ts +2 -1
  15. package/es/group-component/hook/utils.d.ts +3 -3
  16. package/es/table-component/components/async-select/index.js +1 -1
  17. package/es/table-component/hook/utils.d.ts +1 -3
  18. package/lib/ali-table/Grid.js +1 -1
  19. package/lib/ali-table/InternalTable.d.ts +2 -1
  20. package/lib/ali-table/InternalTable.js +24 -43
  21. package/lib/ali-table/base-table/styles.js +1 -1
  22. package/lib/ali-table/base-table/table.d.ts +2 -2
  23. package/lib/ali-table/base-table/utils.d.ts +2 -0
  24. package/lib/ali-table/base-table/utils.js +13 -0
  25. package/lib/ali-table/interfaces.d.ts +4 -0
  26. package/lib/ali-table/internals.d.ts +2 -1
  27. package/lib/ali-table/pipeline/features/columnCustom.d.ts +2 -0
  28. package/lib/ali-table/pipeline/features/columnCustom.js +310 -24
  29. package/lib/ali-table/utils/utility.d.ts +1 -0
  30. package/lib/ali-table/utils/utility.js +45 -1
  31. package/lib/grid-component/type.d.ts +2 -1
  32. package/lib/table-component/components/async-select/index.js +1 -1
  33. package/lib/table-component/hook/utils.d.ts +1 -3
  34. package/package.json +1 -1
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.addRowIdArray = void 0;
6
7
  exports.filterDataByColumns1 = filterDataByColumns1;
7
8
  exports.shouldIncludeOptimized = exports.getMaxDepth = void 0;
8
9
  exports.sortData = sortData;
@@ -263,4 +264,47 @@ const getMaxDepth = data => {
263
264
  }
264
265
  return maxDepth;
265
266
  };
266
- exports.getMaxDepth = getMaxDepth;
267
+ exports.getMaxDepth = getMaxDepth;
268
+ const addRowIdArray = inputArray => {
269
+ if (!inputArray || inputArray.length === 0) return [];
270
+ const result = new Array(inputArray.length);
271
+ const pending = [];
272
+ for (let index = inputArray.length - 1; index >= 0; index -= 1) {
273
+ pending.push({
274
+ source: inputArray[index],
275
+ target: result,
276
+ index
277
+ });
278
+ }
279
+ while (pending.length > 0) {
280
+ const {
281
+ source,
282
+ target,
283
+ index,
284
+ parentId
285
+ } = pending.pop();
286
+ const rowId = source.id ?? source.rowId ?? (0, _utils.newGuid)();
287
+ const node = {
288
+ ...source,
289
+ rowId,
290
+ ...(parentId !== undefined && source.parentId == null ? {
291
+ parentId
292
+ } : {})
293
+ };
294
+ target[index] = node;
295
+ if (Array.isArray(source.children) && source.children.length > 0) {
296
+ const children = new Array(source.children.length);
297
+ node.children = children;
298
+ for (let childIndex = source.children.length - 1; childIndex >= 0; childIndex -= 1) {
299
+ pending.push({
300
+ source: source.children[childIndex],
301
+ target: children,
302
+ index: childIndex,
303
+ parentId: rowId
304
+ });
305
+ }
306
+ }
307
+ }
308
+ return result;
309
+ };
310
+ exports.addRowIdArray = addRowIdArray;
@@ -478,6 +478,7 @@ export type TableProps<RecordType = AnyObject> = {
478
478
  showEmptyText?: boolean;
479
479
  /** Cấu hình command column */
480
480
  commandSettings?: CommandSettings;
481
+ headerData?: object;
481
482
  /**
482
483
  * Func khi click command
483
484
  * Ví dụ: Edit, Delete, Copy...
@@ -525,7 +526,7 @@ export type TableProps<RecordType = AnyObject> = {
525
526
  * handleCallback dùng để cập nhật giá trị sau khi xử lý custom
526
527
  */
527
528
  onCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
528
- onHeaderCellChange?: (args: CellChangeArgs<RecordType>, handleCallback: (rowData: any, index: any, value?: any) => void) => void;
529
+ onHeaderCellChange?: (data: object) => void;
529
530
  /** Callback click cell */
530
531
  onCellClick?: (args: ICellClick, callback?: any) => void;
531
532
  /** Xác định row có được edit hay không */
@@ -34,7 +34,7 @@ function AsyncSelect({
34
34
  }
35
35
  };
36
36
  return (0, _debounce.default)(fetchOptions, debounceTimeout);
37
- }, [loadOptions, debounceTimeout]);
37
+ }, [debounceTimeout, loadOptions, defaultOptions, rowData]);
38
38
  (0, _react.useEffect)(() => {
39
39
  setOptions(defaultOptions ?? []);
40
40
  }, [defaultOptions]);
@@ -199,7 +199,5 @@ export declare const getIds: <T extends {
199
199
  }>(data: T[]) => string[];
200
200
  export declare const getKeys: <T extends Record<string, any>, K extends keyof T>(data: T[], key: K) => T[K][];
201
201
  export declare const getRowIndexMap: (flatRows: any[]) => Map<string, number>;
202
- export declare function getRowIdsBetween3(flatRows: {
203
- rowId: string;
204
- }[], rowIndexMap: Map<string, number>, a: string, b: string): string[];
202
+ export declare function getRowIdsBetween3(flatRows: any[], rowIndexMap: Map<string, number>, a: string, b: string): string[];
205
203
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.9.61",
3
+ "version": "1.9.63",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",