@gears-frontx/ui-kit 0.4.6 → 0.4.7

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 (118) hide show
  1. package/dist/chunks/{data-grid.-6P4UQGJ.css → data-grid.DSkYrsay.css} +1 -1
  2. package/dist/chunks/drag-drop.BASVe3_O.css +1 -0
  3. package/dist/chunks/hooked.js +23 -31
  4. package/dist/chunks/hooked.js.map +1 -1
  5. package/dist/chunks/is-record.js +7 -0
  6. package/dist/chunks/is-record.js.map +1 -0
  7. package/dist/chunks/messages.js +12 -1
  8. package/dist/chunks/messages.js.map +1 -1
  9. package/dist/chunks/pagination.DJ7HJSFX.css +1 -0
  10. package/dist/chunks/resolve-body-cell-props.BA5IRWq0.css +1 -0
  11. package/dist/chunks/resolve-body-cell-props.js +80 -96
  12. package/dist/chunks/resolve-body-cell-props.js.map +1 -1
  13. package/dist/chunks/row-click-utils.js +12 -0
  14. package/dist/chunks/row-click-utils.js.map +1 -0
  15. package/dist/chunks/row-number.BxFT_3yP.css +1 -0
  16. package/dist/chunks/segment.js +16 -9
  17. package/dist/chunks/segment.js.map +1 -1
  18. package/dist/chunks/storage-helpers.js +40 -0
  19. package/dist/chunks/storage-helpers.js.map +1 -0
  20. package/dist/chunks/table-helpers.js +20 -0
  21. package/dist/chunks/table-helpers.js.map +1 -0
  22. package/dist/chunks/table-tree.DMtpMddS.css +1 -0
  23. package/dist/chunks/table.biUlW2U6.css +1 -0
  24. package/dist/chunks/use-latest.js +11 -0
  25. package/dist/chunks/use-latest.js.map +1 -0
  26. package/dist/components/data-grid/data-grid-types.d.ts +9 -0
  27. package/dist/components/data-grid/data-grid-types.d.ts.map +1 -1
  28. package/dist/components/data-grid/data-grid.d.ts +1 -1
  29. package/dist/components/data-grid/data-grid.d.ts.map +1 -1
  30. package/dist/components/data-grid/messages.d.ts +9 -0
  31. package/dist/components/data-grid/messages.d.ts.map +1 -1
  32. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/data-grid-export-menu-item.d.ts +6 -0
  33. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/data-grid-export-menu-item.d.ts.map +1 -0
  34. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-cells.d.ts +18 -0
  35. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-cells.d.ts.map +1 -0
  36. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-menu-items.d.ts +9 -0
  37. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-menu-items.d.ts.map +1 -0
  38. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.d.ts +5 -0
  39. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.d.ts.map +1 -0
  40. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-types.d.ts +77 -0
  41. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-types.d.ts.map +1 -0
  42. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/csv-formatter.d.ts +3 -0
  43. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/csv-formatter.d.ts.map +1 -0
  44. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/excel-formatter.d.ts +4 -0
  45. package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/excel-formatter.d.ts.map +1 -0
  46. package/dist/components/data-grid/plugins/actions-menu/public.d.ts +2 -0
  47. package/dist/components/data-grid/plugins/actions-menu/public.d.ts.map +1 -1
  48. package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-body-cell.d.ts +3 -0
  49. package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-body-cell.d.ts.map +1 -0
  50. package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-content.d.ts +7 -0
  51. package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-content.d.ts.map +1 -0
  52. package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-row.d.ts +8 -0
  53. package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-row.d.ts.map +1 -0
  54. package/dist/components/data-grid/plugins/drag-drop/drag-data.d.ts +4 -0
  55. package/dist/components/data-grid/plugins/drag-drop/drag-data.d.ts.map +1 -0
  56. package/dist/components/data-grid/plugins/drag-drop/drag-drop-plugin.d.ts +18 -0
  57. package/dist/components/data-grid/plugins/drag-drop/drag-drop-plugin.d.ts.map +1 -0
  58. package/dist/components/data-grid/plugins/drag-drop/drag-drop-types.d.ts +60 -0
  59. package/dist/components/data-grid/plugins/drag-drop/drag-drop-types.d.ts.map +1 -0
  60. package/dist/components/data-grid/plugins/drag-drop/drag-preview.d.ts +2 -0
  61. package/dist/components/data-grid/plugins/drag-drop/drag-preview.d.ts.map +1 -0
  62. package/dist/components/data-grid/plugins/drag-drop/public.d.ts +3 -0
  63. package/dist/components/data-grid/plugins/drag-drop/public.d.ts.map +1 -0
  64. package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts.map +1 -1
  65. package/dist/components/data-grid/plugins/pagination/components/pager.d.ts +6 -0
  66. package/dist/components/data-grid/plugins/pagination/components/pager.d.ts.map +1 -1
  67. package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-body-cell-content.d.ts +9 -0
  68. package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-body-cell-content.d.ts.map +1 -0
  69. package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-expand.d.ts +3 -0
  70. package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-expand.d.ts.map +1 -0
  71. package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-row.d.ts +8 -0
  72. package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-row.d.ts.map +1 -0
  73. package/dist/components/data-grid/plugins/table-tree/public.d.ts +3 -0
  74. package/dist/components/data-grid/plugins/table-tree/public.d.ts.map +1 -0
  75. package/dist/components/data-grid/plugins/table-tree/table-tree-helpers.d.ts +4 -0
  76. package/dist/components/data-grid/plugins/table-tree/table-tree-helpers.d.ts.map +1 -0
  77. package/dist/components/data-grid/plugins/table-tree/table-tree-plugin.d.ts +5 -0
  78. package/dist/components/data-grid/plugins/table-tree/table-tree-plugin.d.ts.map +1 -0
  79. package/dist/components/data-grid/plugins/table-tree/table-tree-types.d.ts +33 -0
  80. package/dist/components/data-grid/plugins/table-tree/table-tree-types.d.ts.map +1 -0
  81. package/dist/components/data-grid/services/core/data-grid-label-context.d.ts +7 -0
  82. package/dist/components/data-grid/services/core/data-grid-label-context.d.ts.map +1 -0
  83. package/dist/components/data-grid/services/table/components/data-grid-table.d.ts.map +1 -1
  84. package/dist/components/pagination/pagination.d.ts +7 -4
  85. package/dist/components/pagination/pagination.d.ts.map +1 -1
  86. package/dist/data-grid/actions-menu.js +349 -33
  87. package/dist/data-grid/actions-menu.js.map +1 -1
  88. package/dist/data-grid/drag-drop.d.ts +1 -0
  89. package/dist/data-grid/drag-drop.js +261 -0
  90. package/dist/data-grid/drag-drop.js.map +1 -0
  91. package/dist/data-grid/filters.js +22 -21
  92. package/dist/data-grid/filters.js.map +1 -1
  93. package/dist/data-grid/pagination.js +152 -143
  94. package/dist/data-grid/pagination.js.map +1 -1
  95. package/dist/data-grid/row-click.js +35 -42
  96. package/dist/data-grid/row-click.js.map +1 -1
  97. package/dist/data-grid/row-number.js +6 -6
  98. package/dist/data-grid/table-tree.d.ts +1 -0
  99. package/dist/data-grid/table-tree.js +233 -0
  100. package/dist/data-grid/table-tree.js.map +1 -0
  101. package/dist/data-grid.js +508 -536
  102. package/dist/data-grid.js.map +1 -1
  103. package/dist/docs/data-grid.md +280 -7
  104. package/dist/docs/pagination.md +14 -0
  105. package/dist/docs/table.md +10 -1
  106. package/dist/index.d.ts +2 -0
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +375 -370
  109. package/dist/index.js.map +1 -1
  110. package/dist/pagination.js +23 -23
  111. package/dist/pagination.js.map +1 -1
  112. package/dist/table.js +88 -88
  113. package/llms.txt +6 -3
  114. package/package.json +10 -1
  115. package/dist/chunks/pagination.CKDEuWt6.css +0 -1
  116. package/dist/chunks/resolve-body-cell-props.DGczzk1U.css +0 -1
  117. package/dist/chunks/row-number.C7fNu9Bw.css +0 -1
  118. package/dist/chunks/table.Dmz7LEk7.css +0 -1
@@ -0,0 +1,9 @@
1
+ import { DataGridItem } from '../../../data-grid-types';
2
+ import { DataGridTableColumn } from '../../../services/table/table-types';
3
+ interface DataGridTableTreeBodyCellContentProps<TItem extends DataGridItem> {
4
+ column: DataGridTableColumn<TItem>;
5
+ item: TItem;
6
+ }
7
+ export declare function DataGridTableTreeBodyCellContent<TItem extends DataGridItem>({ column, item, }: DataGridTableTreeBodyCellContentProps<TItem>): import("react").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=data-grid-table-tree-body-cell-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-grid-table-tree-body-cell-content.d.ts","sourceRoot":"","sources":["../../../../../../src/components/data-grid/plugins/table-tree/components/data-grid-table-tree-body-cell-content.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAK/E,UAAU,qCAAqC,CAAC,KAAK,SAAS,YAAY;IACxE,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,EAAE,KAAK,CAAC;CACb;AAED,wBAAgB,gCAAgC,CAAC,KAAK,SAAS,YAAY,EAAE,EAC3E,MAAM,EACN,IAAI,GACL,EAAE,qCAAqC,CAAC,KAAK,CAAC,+BA4B9C"}
@@ -0,0 +1,3 @@
1
+ import { DataGridItem } from '../../../data-grid-types';
2
+ export declare function DataGridTableTreeExpand<TItem extends DataGridItem>(): import("react").JSX.Element;
3
+ //# sourceMappingURL=data-grid-table-tree-expand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-grid-table-tree-expand.d.ts","sourceRoot":"","sources":["../../../../../../src/components/data-grid/plugins/table-tree/components/data-grid-table-tree-expand.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAO7D,wBAAgB,uBAAuB,CAAC,KAAK,SAAS,YAAY,iCAqBjE"}
@@ -0,0 +1,8 @@
1
+ import { DataGridItem } from '../../../data-grid-types';
2
+ import { DataGridRecord } from '../../../services/storage/storage-types';
3
+ interface DataGridTableTreeRowProps<TItem extends DataGridItem> {
4
+ record: DataGridRecord<TItem>;
5
+ }
6
+ export declare function DataGridTableTreeRow<TItem extends DataGridItem>({ record, }: DataGridTableTreeRowProps<TItem>): import("react").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=data-grid-table-tree-row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-grid-table-tree-row.d.ts","sourceRoot":"","sources":["../../../../../../src/components/data-grid/plugins/table-tree/components/data-grid-table-tree-row.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAY9E,UAAU,yBAAyB,CAAC,KAAK,SAAS,YAAY;IAC5D,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,YAAY,EAAE,EAC/D,MAAM,GACP,EAAE,yBAAyB,CAAC,KAAK,CAAC,+BA8DlC"}
@@ -0,0 +1,3 @@
1
+ export { DataGridTableTreePlugin } from './table-tree-plugin.js';
2
+ export type { DataGridTableTreePluginApi, DataGridTableTreePluginConfig, } from './table-tree-types.js';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/plugins/table-tree/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,YAAY,EACV,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DataGridItem } from '../../data-grid-types';
2
+ import { DataGridDataKey, DataGridParentId } from '../../services/storage/storage-types';
3
+ export declare function createTreeDataFromFlattenedArray<TItem extends DataGridItem = DataGridItem>(items: TItem[], parentKey: DataGridDataKey<TItem>): Map<DataGridParentId, TItem[]>;
4
+ //# sourceMappingURL=table-tree-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-tree-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/plugins/table-tree/table-tree-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE9F,wBAAgB,gCAAgC,CAAC,KAAK,SAAS,YAAY,GAAG,YAAY,EACxF,KAAK,EAAE,KAAK,EAAE,EACd,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,GAChC,GAAG,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAchC"}
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+ import { DataGridItem } from '../../data-grid-types.js';
3
+ import { DataGridTableTreePluginConfig } from './table-tree-types.js';
4
+ export declare const DataGridTableTreePlugin: <TItem extends DataGridItem = DataGridItem>(props: DataGridTableTreePluginConfig<TItem>) => ReactNode;
5
+ //# sourceMappingURL=table-tree-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-tree-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/plugins/table-tree/table-tree-plugin.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAW7D,OAAO,KAAK,EAEV,6BAA6B,EAI9B,MAAM,uBAAuB,CAAC;AAuS/B,eAAO,MAAM,uBAAuB,qDAG3B,8BAA8B,KAAK,CAAC,KACxC,SAAS,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { DataGridItem } from '../../data-grid-types.js';
2
+ import { DataGridPluginApi } from '../../services/plugins/plugins-helpers.js';
3
+ import { DataGridDataKey, DataGridItemId, DataGridRecord, DataGridSection } from '../../services/storage/storage-types.js';
4
+ export interface DataGridTableTreePluginConfig<TItem extends DataGridItem = DataGridItem> extends Record<string, unknown> {
5
+ /**
6
+ * If passed then items split by this key. Load won't invoke for expanding items.
7
+ */
8
+ parentKey?: DataGridDataKey<TItem>;
9
+ /**
10
+ * Whether row can be expanded.
11
+ */
12
+ expandable?: (item: TItem) => boolean;
13
+ }
14
+ export interface DataGridTableTreePluginApi<TItem extends DataGridItem = DataGridItem> extends DataGridPluginApi<DataGridTableTreePluginConfig<TItem>> {
15
+ useIsExpandable: (record: DataGridRecord<TItem>) => boolean;
16
+ useIsExpanded: (itemId: DataGridItemId) => boolean;
17
+ useLevel: (section: DataGridSection<TItem>) => number;
18
+ toggle: (itemId: DataGridItemId) => void;
19
+ /** Non-hook version of useIsExpandable, safe to call outside React render context. */
20
+ isExpandable: (record: DataGridRecord<TItem>) => boolean;
21
+ }
22
+ export interface TableTreeStore {
23
+ expandedIds: Set<DataGridItemId>;
24
+ }
25
+ export interface TableTreeConfigStore<TItem extends DataGridItem = DataGridItem> {
26
+ parentKey: DataGridDataKey<TItem> | undefined;
27
+ expandable: ((item: TItem) => boolean) | undefined;
28
+ }
29
+ /** Expand state as it is stored between mounts. */
30
+ export interface TableTreePersistentState {
31
+ expanded: DataGridItemId[];
32
+ }
33
+ //# sourceMappingURL=table-tree-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-tree-types.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/plugins/table-tree/table-tree-types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,yCAAyC,CAAC;AAEjD,MAAM,WAAW,6BAA6B,CAC5C,KAAK,SAAS,YAAY,GAAG,YAAY,CACzC,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,0BAA0B,CACzC,KAAK,SAAS,YAAY,GAAG,YAAY,CACzC,SAAQ,iBAAiB,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAC/D,eAAe,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;IAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;IACnD,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC;IACtD,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,sFAAsF;IACtF,YAAY,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;CAC1D;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB,CAAC,KAAK,SAAS,YAAY,GAAG,YAAY;IAC7E,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACpD;AAED,mDAAmD;AACnD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const DataGridLabelProvider: import('react').Provider<string | undefined>;
3
+ /**
4
+ * The grid's `label` prop, or `undefined` when the grid has none or the prop is blank.
5
+ */
6
+ export declare function useDataGridLabel(): string | undefined;
7
+ //# sourceMappingURL=data-grid-label-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-grid-label-context.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/services/core/data-grid-label-context.ts"],"names":[],"mappings":";AAkBA,eAAO,MAAM,qBAAqB,8CAAgC,CAAC;AAEnE;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAErD"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-table.d.ts","sourceRoot":"","sources":["../../../../../../src/components/data-grid/services/table/components/data-grid-table.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAa7D,wBAAgB,aAAa,CAAC,KAAK,SAAS,YAAY,iCA0BvD"}
1
+ {"version":3,"file":"data-grid-table.d.ts","sourceRoot":"","sources":["../../../../../../src/components/data-grid/services/table/components/data-grid-table.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAc7D,wBAAgB,aAAa,CAAC,KAAK,SAAS,YAAY,iCA4BvD"}
@@ -20,9 +20,11 @@ export interface PaginationLinkProps extends Omit<ComponentProps<'a'>, 'classNam
20
20
  }
21
21
  export declare function PaginationLink({ className, isActive, square, ...props }: PaginationLinkProps): import("react").JSX.Element;
22
22
  export interface PaginationPreviousProps extends Omit<PaginationLinkProps, 'square'> {
23
- /** Label text, hidden below the `sm` breakpoint (640px) — matching
24
- * upstream's `hidden sm:block`. Also the accessible name when given, since
25
- * the label is hidden at that width. @default 'Previous' */
23
+ /** Label text, hidden while the `Pagination` root it sits in is narrower
24
+ * than 640px (a container query, so a narrow pane on a wide screen
25
+ * collapses it too); without the root, below a 640px viewport. Also the
26
+ * accessible name when given, since the label is hidden at that width.
27
+ * @default 'Previous' */
26
28
  text?: string;
27
29
  }
28
30
  export declare function PaginationPrevious({ className, text, ...props }: PaginationPreviousProps): import("react").JSX.Element;
@@ -51,7 +53,8 @@ export interface PaginationButtonProps extends Omit<ComponentProps<'button'>, 'c
51
53
  }
52
54
  export declare function PaginationButton({ className, isActive, square, type, ...props }: PaginationButtonProps): import("react").JSX.Element;
53
55
  export interface PaginationPreviousButtonProps extends Omit<PaginationButtonProps, 'square' | 'isActive'> {
54
- /** Label text, hidden below the `sm` breakpoint (640px). Also the
56
+ /** Label text, hidden while the `Pagination` root it sits in is narrower
57
+ * than 640px; without the root, below a 640px viewport. Also the
55
58
  * accessible name when given. @default 'Previous' */
56
59
  text?: string;
57
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/pagination.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmD5C,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEpD,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,+BASlE;AAED,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAE1D,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,+BAEhF;AAED,MAAM,MAAM,mBAA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Q,GAAG,UAAU,CAAC;IACvG;;yDAEqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,wBAAwB,CAAC,EACvC,IAAiB,EACjB,GAAG,KAAK,EACT,EAAE,6BAA6B,+BAM/B;AAED,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,qBAAqB,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnG,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,oBAAoB,CAAC,EAAE,IAAa,EAAE,GAAG,KAAK,EAAE,EAAE,yBAAyB,+BAM1F;AAED,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAE7D,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,+BAOlF"}
@@ -1,57 +1,373 @@
1
1
  "use client";
2
- import { create as l } from "zustand";
3
- import { u as I, c as f } from "../chunks/plugins-helpers.js";
4
- import { jsxs as h, jsx as r } from "react/jsx-runtime";
5
- import { EllipsisIcon as D } from "lucide-react";
6
- import { m as S } from "../chunks/messages.js";
7
- import { DropdownMenu as w, DropdownMenuTrigger as G, DropdownMenuContent as P } from "../dropdown-menu.js";
8
- import { Button as x } from "../button.js";
9
- function b() {
10
- const c = I().getPlugin("actionsMenu").useMenuItems();
11
- return /* @__PURE__ */ h(w, { children: [
12
- /* @__PURE__ */ r(
13
- G,
2
+ import { create as T } from "zustand";
3
+ import { u as L, c as j, a as A } from "../chunks/plugins-helpers.js";
4
+ import { jsxs as M, jsx as w } from "react/jsx-runtime";
5
+ import { EllipsisIcon as B, ArrowDownToLineIcon as N } from "lucide-react";
6
+ import { m as y } from "../chunks/messages.js";
7
+ import { DropdownMenu as $, DropdownMenuTrigger as F, DropdownMenuContent as J, DropdownMenuItem as O } from "../dropdown-menu.js";
8
+ import { Button as W } from "../button.js";
9
+ import { useState as G } from "react";
10
+ import { a as H } from "../chunks/table-helpers.js";
11
+ import { u as U } from "../chunks/table-context.js";
12
+ import { i as Q } from "../chunks/is-record.js";
13
+ function z() {
14
+ const i = L().getPlugin("actionsMenu").useMenuItems();
15
+ return /* @__PURE__ */ M($, { children: [
16
+ /* @__PURE__ */ w(
17
+ F,
14
18
  {
15
- render: /* @__PURE__ */ r(
16
- x,
19
+ render: /* @__PURE__ */ w(
20
+ W,
17
21
  {
18
22
  variant: "ghost",
19
23
  size: "sm",
20
- icon: /* @__PURE__ */ r(D, {}),
21
- "aria-label": S.actionsMenu.actions
24
+ icon: /* @__PURE__ */ w(B, {}),
25
+ "aria-label": y.actionsMenu.actions
22
26
  }
23
27
  )
24
28
  }
25
29
  ),
26
- /* @__PURE__ */ r(P, { side: "bottom", align: "end", children: c.map((s) => /* @__PURE__ */ r(s.component, { params: s.params }, s.id)) })
30
+ /* @__PURE__ */ w(J, { side: "bottom", align: "end", children: i.map((a) => /* @__PURE__ */ w(a.component, { params: a.params }, a.id)) })
27
31
  ] });
28
32
  }
29
- const T = f("actionsMenu", (u) => {
30
- const n = l(() => ({
33
+ const me = j("actionsMenu", (e) => {
34
+ const o = T(() => ({
31
35
  menuItems: []
32
36
  }));
33
- return u.registerSlot("top-end", {
37
+ return e.registerSlot("top-end", {
34
38
  id: "actionsMenu",
35
- component: b,
39
+ component: z,
36
40
  order: 100
37
41
  }), {
38
42
  registerMenuItem: d,
39
- useMenuItems: () => n((e) => e.menuItems),
40
- onPropsChange: p
43
+ useMenuItems: () => o((p) => p.menuItems),
44
+ onPropsChange: f
41
45
  };
42
- function d(e) {
43
- const i = Math.random().toString(), t = n.getState().menuItems, o = e.order ?? (t.length + 1) * 10, a = { id: i, ...e, order: o }, m = [...t, a].sort((g, M) => g.order - M.order);
44
- n.setState({ menuItems: m });
45
- }
46
- function p(e) {
47
- const i = e.menuItems.map((t, o) => {
48
- const a = Math.random().toString(), m = t.order ?? (o + 1) * 10;
49
- return { id: a, ...t, order: m };
46
+ function d(p) {
47
+ const g = Math.random().toString(), t = o.getState().menuItems, n = p.order ?? (t.length + 1) * 10, s = { id: g, ...p, order: n }, c = [...t, s].sort((l, r) => l.order - r.order);
48
+ o.setState({ menuItems: c });
49
+ }
50
+ function f(p) {
51
+ const g = p.menuItems.map((t, n) => {
52
+ const s = Math.random().toString(), c = t.order ?? (n + 1) * 10;
53
+ return { id: s, ...t, order: c };
50
54
  });
51
- i.sort((t, o) => t.order - o.order), n.setState({ menuItems: i });
55
+ g.sort((t, n) => t.order - n.order), o.setState({ menuItems: g });
52
56
  }
53
57
  });
58
+ function R(e, o) {
59
+ const i = o.key ? e[o.key] : e[o.id];
60
+ let a;
61
+ return o.formatter ? a = o.formatter(i) : a = String(i ?? ""), { raw: i, formatted: a };
62
+ }
63
+ function C({
64
+ item: e,
65
+ column: o,
66
+ cellValue: i,
67
+ transformCellText: a,
68
+ gridContext: d
69
+ }) {
70
+ const f = a == null ? void 0 : a[o.id];
71
+ return f ? f(
72
+ {
73
+ value: i.raw,
74
+ formattedValue: i.formatted,
75
+ row: e
76
+ },
77
+ d
78
+ ) : i.formatted;
79
+ }
80
+ const Z = (e) => {
81
+ const { data: o, columns: i, options: a, gridContext: d } = e, f = a.delimiter || ",", p = a.includeHeaders ?? !0, g = [];
82
+ if (p) {
83
+ const t = i.map((n) => v(n.label, f)).join(f);
84
+ g.push(t);
85
+ }
86
+ for (const t of o) {
87
+ const n = [];
88
+ for (const s of i) {
89
+ const c = R(t, s), l = C({
90
+ item: t,
91
+ column: s,
92
+ cellValue: c,
93
+ transformCellText: a.transformCellText,
94
+ gridContext: d
95
+ });
96
+ n.push(v(l, f));
97
+ }
98
+ g.push(n.join(f));
99
+ }
100
+ return Promise.resolve(g.join(`
101
+ `));
102
+ }, S = /^[=+\-@\t\r]/;
103
+ function v(e, o) {
104
+ const i = String(e ?? "");
105
+ if (i.includes(o) || i.includes(`
106
+ `) || i.includes('"') || S.test(i)) {
107
+ const d = i.replace(/"/g, '""');
108
+ return `"${S.test(i) ? " " : ""}${d}"`;
109
+ }
110
+ return i;
111
+ }
112
+ const q = async (e) => {
113
+ const { data: o, columns: i, options: a, gridContext: d } = e;
114
+ if (!a.loadExcelJs)
115
+ throw new Error(
116
+ "Exporting to Excel needs `loadExcelJs`, a function that loads the exceljs package: the grid does not import it itself."
117
+ );
118
+ const f = X(await a.loadExcelJs()), p = new f.Workbook(), g = p.addWorksheet(a.sheetName), t = a.includeHeaders ?? !0;
119
+ let n = 1;
120
+ if (t) {
121
+ const c = g.getRow(n);
122
+ i.forEach((l, r) => {
123
+ const u = c.getCell(r + 1);
124
+ u.value = l.label;
125
+ }), n++;
126
+ }
127
+ for (const c of o) {
128
+ const l = g.getRow(n);
129
+ for (const [r, u] of i.entries()) {
130
+ const m = R(c, u), x = C({
131
+ item: c,
132
+ column: u,
133
+ cellValue: m,
134
+ transformCellText: a.transformCellText,
135
+ gridContext: d
136
+ }), h = l.getCell(r + 1);
137
+ h.value = Y(m.raw, x);
138
+ }
139
+ n++;
140
+ }
141
+ const s = await p.xlsx.writeBuffer();
142
+ return new Blob([s], {
143
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
144
+ });
145
+ };
146
+ function K(e) {
147
+ return "default" in e && !!e.default;
148
+ }
149
+ function X(e) {
150
+ const o = K(e) ? e.default : e;
151
+ if (typeof o.Workbook != "function")
152
+ throw new Error("`loadExcelJs` has to resolve to the exceljs package, which exports `Workbook`.");
153
+ return o;
154
+ }
155
+ function Y(e, o) {
156
+ if (o !== String(e ?? ""))
157
+ return o;
158
+ if (e == null)
159
+ return "";
160
+ if (typeof e == "number" || typeof e == "boolean" || e instanceof Date)
161
+ return e;
162
+ if (typeof e == "string") {
163
+ if (/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(e)) {
164
+ const d = new Date(e);
165
+ if (!isNaN(d.getTime()))
166
+ return d;
167
+ }
168
+ const a = e.trim();
169
+ if (a !== "" && !isNaN(Number(a)) && !/[eE]/.test(a) && !(a.length > 1 && a.startsWith("0") && a[1] !== "."))
170
+ return Number(a);
171
+ }
172
+ return String(e);
173
+ }
174
+ function _() {
175
+ return {
176
+ exportToCSV: e,
177
+ exportToExcel: o,
178
+ downloadFile: i,
179
+ getAllData: a
180
+ };
181
+ async function e(t, n, s, c) {
182
+ const l = { ...s, format: "csv" };
183
+ try {
184
+ const r = await Z({
185
+ data: t,
186
+ columns: n,
187
+ options: l,
188
+ gridContext: c
189
+ }), u = E(s.filename, "csv");
190
+ i(r, u, "text/csv");
191
+ } catch (r) {
192
+ if (s.onError)
193
+ s.onError(I(r));
194
+ else
195
+ throw r;
196
+ }
197
+ }
198
+ async function o(t, n, s, c) {
199
+ const l = { ...s, format: "xlsx" };
200
+ try {
201
+ const r = await q({
202
+ data: t,
203
+ columns: n,
204
+ options: l,
205
+ gridContext: c
206
+ }), u = E(s.filename, "xlsx");
207
+ i(
208
+ r,
209
+ u,
210
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
211
+ );
212
+ } catch (r) {
213
+ if (s.onError)
214
+ s.onError(I(r));
215
+ else
216
+ throw r;
217
+ }
218
+ }
219
+ function i(t, n, s) {
220
+ const c = t instanceof Blob ? t : new Blob([t], { type: s }), l = URL.createObjectURL(c), r = document.createElement("a");
221
+ r.href = l, r.download = n, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(l);
222
+ }
223
+ async function a(t) {
224
+ const n = t.getPlugin("pagination"), s = t.getPlugin("tableTree");
225
+ return s && n ? await f(t, s, n) : s ? await d(t, s) : n ? await g(t, n) : t.useStore.getState().visibleRecords.map((l) => l.item);
226
+ }
227
+ async function d(t, n) {
228
+ const s = [], c = /* @__PURE__ */ new Set(), l = t.useStore.getState().visibleRecords;
229
+ return await p(t, l, s, c, n), s;
230
+ }
231
+ async function f(t, n, s) {
232
+ const c = { page: s.getPage(), limit: s.getLimit() }, l = [], r = /* @__PURE__ */ new Set();
233
+ let u = 1, m = !0;
234
+ for (; m; ) {
235
+ const x = t.triggerLoad({
236
+ loadContext: {
237
+ pagination: { ...c, page: u },
238
+ tree: { parentId: null }
239
+ },
240
+ store: !1
241
+ });
242
+ if (await x.promise, x.processResult) {
243
+ const h = x.processResult.results;
244
+ if (h.length === 0)
245
+ m = !1;
246
+ else {
247
+ const k = h.map((b, P) => ({
248
+ id: t.getItemId(b),
249
+ item: b,
250
+ index: P,
251
+ section: V()
252
+ }));
253
+ await p(
254
+ t,
255
+ k,
256
+ l,
257
+ r,
258
+ n
259
+ ), u++, h.length < c.limit && (m = !1);
260
+ }
261
+ } else
262
+ m = !1;
263
+ }
264
+ return l;
265
+ }
266
+ async function p(t, n, s, c, l) {
267
+ for (const r of n) {
268
+ if (c.has(r.id))
269
+ continue;
270
+ if (c.add(r.id), s.push(r.item), l.isExpandable(r)) {
271
+ t.getSectionsByParentId(r.id).length || await t.triggerLoad({
272
+ loadContext: { tree: { parentId: r.id } }
273
+ }).promise;
274
+ const x = t.getRecordsByParentId(r.id);
275
+ x.length > 0 && await p(
276
+ t,
277
+ x,
278
+ s,
279
+ c,
280
+ l
281
+ );
282
+ }
283
+ }
284
+ }
285
+ async function g(t, n) {
286
+ const s = { page: n.getPage(), limit: n.getLimit() }, c = [];
287
+ let l = 1, r = !0;
288
+ for (; r; ) {
289
+ const u = t.triggerLoad({
290
+ loadContext: {
291
+ pagination: { ...s, page: l }
292
+ },
293
+ store: !1
294
+ });
295
+ if (await u.promise, u.processResult) {
296
+ const m = u.processResult.results;
297
+ m.length === 0 ? r = !1 : (c.push(...m), l++, m.length < s.limit && (r = !1), u.processResult.total && c.length >= u.processResult.total && (r = !1));
298
+ } else
299
+ r = !1;
300
+ }
301
+ return c;
302
+ }
303
+ }
304
+ function V() {
305
+ return { id: "", visible: !0, loadContext: {}, parentId: null, records: [] };
306
+ }
307
+ function I(e) {
308
+ return e instanceof Error ? e : new Error(String(e));
309
+ }
310
+ function E(e, o) {
311
+ return typeof e == "function" ? e() : typeof e == "string" ? e.endsWith(`.${o}`) ? e : `${e}.${o}` : `${(/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/:/g, "-")}.${o}`;
312
+ }
313
+ function ee(e) {
314
+ return e === "csv" || e === "xlsx";
315
+ }
316
+ function te(e) {
317
+ return Q(e);
318
+ }
319
+ function oe(e) {
320
+ if (!(!e || !ee(e.type)))
321
+ return {
322
+ type: e.type,
323
+ exportConfig: te(e.exportConfig) ? e.exportConfig : void 0
324
+ };
325
+ }
326
+ function D({ params: e }) {
327
+ const o = oe(e), i = A(), a = U(), [d, f] = G(!1), p = a.useVisibleColumns(), g = (o == null ? void 0 : o.type) === "csv" ? "CSV" : "Excel";
328
+ async function t() {
329
+ if (!(d || !o)) {
330
+ f(!0);
331
+ try {
332
+ const n = _(), s = await n.getAllData(i), c = p.map((m) => {
333
+ const x = H(m.label);
334
+ return {
335
+ id: m.id,
336
+ label: x,
337
+ key: m.key,
338
+ formatter: m.formatter
339
+ };
340
+ }), r = {
341
+ ...{
342
+ format: o.type,
343
+ filename: y.exportMenuItem.defaultFilename,
344
+ includeHeaders: !0,
345
+ ...o.type === "xlsx" ? { sheetName: y.exportMenuItem.defaultSheetName } : {}
346
+ },
347
+ ...o.exportConfig
348
+ };
349
+ await (o.type === "csv" ? n.exportToCSV : n.exportToExcel)(s, c, r, i);
350
+ } catch (n) {
351
+ console.error("Export failed:", n);
352
+ } finally {
353
+ f(!1);
354
+ }
355
+ }
356
+ }
357
+ return /* @__PURE__ */ M(O, { disabled: d, onClick: t, children: [
358
+ /* @__PURE__ */ w(N, {}),
359
+ y.exportMenuItem.exportAs(g)
360
+ ] });
361
+ }
362
+ function ge(e) {
363
+ const o = {
364
+ component: D,
365
+ params: { type: "csv", exportConfig: e }
366
+ };
367
+ return e != null && e.loadExcelJs ? [{ component: D, params: { type: "xlsx", exportConfig: e } }, o] : [o];
368
+ }
54
369
  export {
55
- T as DataGridActionsMenuPlugin
370
+ me as DataGridActionsMenuPlugin,
371
+ ge as exportMenuItems
56
372
  };
57
373
  //# sourceMappingURL=actions-menu.js.map