@toolbox-web/grid 1.23.4 → 1.24.0
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/README.md +35 -6
- package/all.d.ts +2 -2
- package/all.d.ts.map +1 -1
- package/all.js +2 -2
- package/all.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +21 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/feature-hook.d.ts +8 -0
- package/lib/core/internal/feature-hook.d.ts.map +1 -0
- package/lib/core/plugin/base-plugin.d.ts +8 -2
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +1 -1
- package/lib/core/types.d.ts +59 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/features/clipboard.d.ts +8 -0
- package/lib/features/clipboard.d.ts.map +1 -0
- package/lib/features/clipboard.js +2 -0
- package/lib/features/clipboard.js.map +1 -0
- package/lib/features/column-virtualization.d.ts +8 -0
- package/lib/features/column-virtualization.d.ts.map +1 -0
- package/lib/features/column-virtualization.js +2 -0
- package/lib/features/column-virtualization.js.map +1 -0
- package/lib/features/context-menu.d.ts +8 -0
- package/lib/features/context-menu.d.ts.map +1 -0
- package/lib/features/context-menu.js +2 -0
- package/lib/features/context-menu.js.map +1 -0
- package/lib/features/editing.d.ts +8 -0
- package/lib/features/editing.d.ts.map +1 -0
- package/lib/features/editing.js +2 -0
- package/lib/features/editing.js.map +1 -0
- package/lib/features/export.d.ts +8 -0
- package/lib/features/export.d.ts.map +1 -0
- package/lib/features/export.js +2 -0
- package/lib/features/export.js.map +1 -0
- package/lib/features/filtering.d.ts +8 -0
- package/lib/features/filtering.d.ts.map +1 -0
- package/lib/features/filtering.js +2 -0
- package/lib/features/filtering.js.map +1 -0
- package/lib/features/grouping-columns.d.ts +8 -0
- package/lib/features/grouping-columns.d.ts.map +1 -0
- package/lib/features/grouping-columns.js +2 -0
- package/lib/features/grouping-columns.js.map +1 -0
- package/lib/features/grouping-rows.d.ts +8 -0
- package/lib/features/grouping-rows.d.ts.map +1 -0
- package/lib/features/grouping-rows.js +2 -0
- package/lib/features/grouping-rows.js.map +1 -0
- package/lib/features/magic-string.es-CkyDP9Ir.mjs.map +1 -0
- package/lib/features/master-detail.d.ts +8 -0
- package/lib/features/master-detail.d.ts.map +1 -0
- package/lib/features/master-detail.js +2 -0
- package/lib/features/master-detail.js.map +1 -0
- package/lib/features/multi-sort.d.ts +10 -0
- package/lib/features/multi-sort.d.ts.map +1 -0
- package/lib/features/multi-sort.js +2 -0
- package/lib/features/multi-sort.js.map +1 -0
- package/lib/features/pinned-columns.d.ts +18 -0
- package/lib/features/pinned-columns.d.ts.map +1 -0
- package/lib/features/pinned-columns.js +2 -0
- package/lib/features/pinned-columns.js.map +1 -0
- package/lib/features/pinned-rows.d.ts +8 -0
- package/lib/features/pinned-rows.d.ts.map +1 -0
- package/lib/features/pinned-rows.js +2 -0
- package/lib/features/pinned-rows.js.map +1 -0
- package/lib/features/pivot.d.ts +8 -0
- package/lib/features/pivot.d.ts.map +1 -0
- package/lib/features/pivot.js +2 -0
- package/lib/features/pivot.js.map +1 -0
- package/lib/features/print.d.ts +8 -0
- package/lib/features/print.d.ts.map +1 -0
- package/lib/features/print.js +2 -0
- package/lib/features/print.js.map +1 -0
- package/lib/features/registry.d.ts +50 -0
- package/lib/features/registry.d.ts.map +1 -0
- package/lib/features/registry.js +2 -0
- package/lib/features/registry.js.map +1 -0
- package/lib/features/registry.spec.js +5 -0
- package/lib/features/registry.spec.js.map +1 -0
- package/lib/features/reorder-columns.d.ts +10 -0
- package/lib/features/reorder-columns.d.ts.map +1 -0
- package/lib/features/reorder-columns.js +2 -0
- package/lib/features/reorder-columns.js.map +1 -0
- package/lib/features/reorder-rows.d.ts +10 -0
- package/lib/features/reorder-rows.d.ts.map +1 -0
- package/lib/features/reorder-rows.js +2 -0
- package/lib/features/reorder-rows.js.map +1 -0
- package/lib/features/responsive.d.ts +8 -0
- package/lib/features/responsive.d.ts.map +1 -0
- package/lib/features/responsive.js +2 -0
- package/lib/features/responsive.js.map +1 -0
- package/lib/features/selection.d.ts +8 -0
- package/lib/features/selection.d.ts.map +1 -0
- package/lib/features/selection.js +2 -0
- package/lib/features/selection.js.map +1 -0
- package/lib/features/server-side.d.ts +8 -0
- package/lib/features/server-side.d.ts.map +1 -0
- package/lib/features/server-side.js +2 -0
- package/lib/features/server-side.js.map +1 -0
- package/lib/features/tree.d.ts +8 -0
- package/lib/features/tree.d.ts.map +1 -0
- package/lib/features/tree.js +2 -0
- package/lib/features/tree.js.map +1 -0
- package/lib/features/undo-redo.d.ts +8 -0
- package/lib/features/undo-redo.d.ts.map +1 -0
- package/lib/features/undo-redo.js +2 -0
- package/lib/features/undo-redo.js.map +1 -0
- package/lib/features/visibility.d.ts +8 -0
- package/lib/features/visibility.d.ts.map +1 -0
- package/lib/features/visibility.js +2 -0
- package/lib/features/visibility.js.map +1 -0
- package/lib/plugins/clipboard/index.js +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/filtering/types.d.ts +428 -27
- package/lib/plugins/filtering/types.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.d.ts +1 -1
- package/lib/plugins/grouping-columns/index.js +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.d.ts +2 -2
- package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +2 -2
- package/lib/plugins/master-detail/index.js +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/types.d.ts +3 -3
- package/lib/plugins/pinned-rows/index.js +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/{reorder → reorder-columns}/ReorderPlugin.d.ts +5 -3
- package/lib/plugins/reorder-columns/ReorderPlugin.d.ts.map +1 -0
- package/lib/plugins/reorder-columns/column-drag.d.ts.map +1 -0
- package/lib/plugins/{reorder → reorder-columns}/index.d.ts +2 -2
- package/lib/plugins/reorder-columns/index.d.ts.map +1 -0
- package/lib/plugins/reorder-columns/index.js +2 -0
- package/lib/plugins/reorder-columns/index.js.map +1 -0
- package/lib/plugins/{reorder → reorder-columns}/types.d.ts +5 -0
- package/lib/plugins/reorder-columns/types.d.ts.map +1 -0
- package/lib/plugins/{row-reorder → reorder-rows}/RowReorderPlugin.d.ts +5 -3
- package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts.map +1 -0
- package/lib/plugins/{row-reorder → reorder-rows}/index.d.ts +2 -2
- package/lib/plugins/reorder-rows/index.d.ts.map +1 -0
- package/lib/plugins/reorder-rows/index.js +2 -0
- package/lib/plugins/reorder-rows/index.js.map +1 -0
- package/lib/plugins/{row-reorder → reorder-rows}/types.d.ts +5 -0
- package/lib/plugins/reorder-rows/types.d.ts.map +1 -0
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +2 -2
- package/lib/plugins/responsive/index.js +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +1 -1
- package/lib/plugins/visibility/index.js +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +17 -2
- package/public.d.ts +9 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +1 -1
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/reorder-columns.umd.js +2 -0
- package/umd/plugins/reorder-columns.umd.js.map +1 -0
- package/umd/plugins/reorder-rows.umd.js +2 -0
- package/umd/plugins/reorder-rows.umd.js.map +1 -0
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +0 -1
- package/lib/plugins/reorder/column-drag.d.ts.map +0 -1
- package/lib/plugins/reorder/index.d.ts.map +0 -1
- package/lib/plugins/reorder/index.js +0 -2
- package/lib/plugins/reorder/index.js.map +0 -1
- package/lib/plugins/reorder/types.d.ts.map +0 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +0 -1
- package/lib/plugins/row-reorder/index.d.ts.map +0 -1
- package/lib/plugins/row-reorder/index.js +0 -2
- package/lib/plugins/row-reorder/index.js.map +0 -1
- package/lib/plugins/row-reorder/types.d.ts.map +0 -1
- package/umd/plugins/reorder.umd.js +0 -2
- package/umd/plugins/reorder.umd.js.map +0 -1
- package/umd/plugins/row-reorder.umd.js +0 -2
- package/umd/plugins/row-reorder.umd.js.map +0 -1
- /package/lib/plugins/{reorder → reorder-columns}/column-drag.d.ts +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReorderConfig } from '../plugins/reorder-columns';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig {
|
|
4
|
+
/** Enable column drag-to-reorder. */
|
|
5
|
+
reorderColumns?: boolean | ReorderConfig;
|
|
6
|
+
/** @deprecated Use `reorderColumns` instead. */
|
|
7
|
+
reorder?: boolean | ReorderConfig;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=reorder-columns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder-columns.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/reorder-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,qCAAqC;QACrC,cAAc,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;QACzC,gDAAgD;QAChD,OAAO,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;KACnC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder-columns.js","sources":["../../../../../libs/grid/src/lib/features/reorder-columns.ts"],"sourcesContent":["/**\n * Column Reorder feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/reorder-columns';\n *\n * grid.gridConfig = { features: { reorderColumns: true } };\n * ```\n */\n\nimport { ReorderPlugin, type ReorderConfig } from '../plugins/reorder-columns';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable column drag-to-reorder. */\n reorderColumns?: boolean | ReorderConfig;\n /** @deprecated Use `reorderColumns` instead. */\n reorder?: boolean | ReorderConfig;\n }\n}\n\nconst factory = (config: unknown) => {\n const options = typeof config === 'boolean' ? {} : ((config as ReorderConfig) ?? {});\n return new ReorderPlugin(options);\n};\n\nregisterFeature('reorderColumns', factory);\nregisterFeature('reorder', factory);\n"],"names":["factory","config","ReorderPlugin","registerFeature"],"mappings":"gJAuBA,MAAMA,EAAWC,GAER,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAA4B,CAAA,GAInFE,EAAgB,iBAAkBH,GAClCG,EAAgB,UAAWH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RowReorderConfig } from '../plugins/reorder-rows';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig {
|
|
4
|
+
/** Enable row drag-to-reorder. */
|
|
5
|
+
reorderRows?: boolean | RowReorderConfig;
|
|
6
|
+
/** @deprecated Use `reorderRows` instead. */
|
|
7
|
+
rowReorder?: boolean | RowReorderConfig;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=reorder-rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder-rows.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/reorder-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,kCAAkC;QAClC,WAAW,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;QACzC,6CAA6C;QAC7C,UAAU,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;KACzC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reorder-rows.js","sources":["../../../../../libs/grid/src/lib/features/reorder-rows.ts"],"sourcesContent":["/**\n * Row Reorder feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/reorder-rows';\n *\n * grid.gridConfig = { features: { reorderRows: true } };\n * ```\n */\n\nimport { RowReorderPlugin, type RowReorderConfig } from '../plugins/reorder-rows';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable row drag-to-reorder. */\n reorderRows?: boolean | RowReorderConfig;\n /** @deprecated Use `reorderRows` instead. */\n rowReorder?: boolean | RowReorderConfig;\n }\n}\n\nconst factory = (config: unknown) => {\n if (config === true) {\n return new RowReorderPlugin();\n }\n return new RowReorderPlugin((config as RowReorderConfig) ?? undefined);\n};\n\nregisterFeature('reorderRows', factory);\nregisterFeature('rowReorder', factory);\n"],"names":["factory","config","RowReorderPlugin","registerFeature"],"mappings":"gJAuBA,MAAMA,EAAWC,IACA,IAAXA,EACK,IAAIC,EAEN,IAAIA,EAAkBD,QAA+B,GAG9DE,EAAgB,cAAeH,GAC/BG,EAAgB,aAAcH"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResponsivePluginConfig } from '../plugins/responsive';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig {
|
|
4
|
+
/** Enable responsive column hiding based on breakpoints. */
|
|
5
|
+
responsive?: boolean | ResponsivePluginConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=responsive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/responsive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGtF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,4DAA4D;QAC5D,UAAU,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;KAC/C;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.js","sources":["../../../../../libs/grid/src/lib/features/responsive.ts"],"sourcesContent":["/**\n * Responsive feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/responsive';\n *\n * grid.gridConfig = { features: { responsive: true } };\n * ```\n */\n\nimport { ResponsivePlugin, type ResponsivePluginConfig } from '../plugins/responsive';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable responsive column hiding based on breakpoints. */\n responsive?: boolean | ResponsivePluginConfig;\n }\n}\n\nregisterFeature('responsive', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as ResponsivePluginConfig) ?? {});\n return new ResponsivePlugin(options);\n});\n"],"names":["registerFeature","config","ResponsivePlugin"],"mappings":"8IAqBAA,EAAgB,aAAeC,GAEtB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAAqC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SelectionConfig } from '../plugins/selection';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig<TRow> {
|
|
4
|
+
/** Enable cell/row/range selection. */
|
|
5
|
+
selection?: 'cell' | 'row' | 'range' | SelectionConfig<TRow>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa,CAAC,IAAI;QAC1B,uCAAuC;QACvC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;KAC9D;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sources":["../../../../../libs/grid/src/lib/features/selection.ts"],"sourcesContent":["/**\n * Selection feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/selection';\n *\n * grid.gridConfig = { features: { selection: 'range' } };\n * ```\n */\n\nimport { SelectionPlugin, type SelectionConfig } from '../plugins/selection';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig<TRow> {\n /** Enable cell/row/range selection. */\n selection?: 'cell' | 'row' | 'range' | SelectionConfig<TRow>;\n }\n}\n\nregisterFeature('selection', (config) => {\n if (config === 'cell' || config === 'row' || config === 'range') {\n return new SelectionPlugin({ mode: config });\n }\n return new SelectionPlugin(config ?? undefined);\n});\n"],"names":["registerFeature","config","SelectionPlugin","mode"],"mappings":"4IAqBAA,EAAgB,YAAcC,GAEnB,IAAIC,EADE,SAAXD,GAAgC,QAAXA,GAA+B,UAAXA,EAChB,CAAEE,KAAMF,GAEVA,QAAU"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ServerSideConfig } from '../plugins/server-side';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig {
|
|
4
|
+
/** Enable server-side data fetching, sorting, filtering, etc. */
|
|
5
|
+
serverSide?: ServerSideConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=server-side.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-side.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/server-side.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAGjF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,iEAAiE;QACjE,UAAU,CAAC,EAAE,gBAAgB,CAAC;KAC/B;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-side.js","sources":["../../../../../libs/grid/src/lib/features/server-side.ts"],"sourcesContent":["/**\n * Server-Side feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/server-side';\n *\n * grid.gridConfig = { features: { serverSide: { fetchRows: async (params) => ... } } };\n * ```\n */\n\nimport { ServerSidePlugin, type ServerSideConfig } from '../plugins/server-side';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable server-side data fetching, sorting, filtering, etc. */\n serverSide?: ServerSideConfig;\n }\n}\n\nregisterFeature('serverSide', (config) => {\n return new ServerSidePlugin((config as ServerSideConfig) ?? undefined);\n});\n"],"names":["registerFeature","config","ServerSidePlugin"],"mappings":"+IAqBAA,EAAgB,aAAeC,GACtB,IAAIC,EAAkBD,QAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,oEAAoE;QACpE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;KAC7B;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sources":["../../../../../libs/grid/src/lib/features/tree.ts"],"sourcesContent":["/**\n * Tree feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/tree';\n *\n * grid.gridConfig = { features: { tree: true } };\n * ```\n */\n\nimport { TreePlugin, type TreeConfig } from '../plugins/tree';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable tree (hierarchical) data display with expand/collapse. */\n tree?: boolean | TreeConfig;\n }\n}\n\nregisterFeature('tree', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as TreeConfig) ?? {});\n return new TreePlugin(options);\n});\n"],"names":["registerFeature","config","TreePlugin"],"mappings":"kIAqBAA,EAAgB,OAASC,GAEhB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAAyB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UndoRedoConfig } from '../plugins/undo-redo';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig {
|
|
4
|
+
/** Enable undo/redo for cell edits. Requires `editing`. */
|
|
5
|
+
undoRedo?: boolean | UndoRedoConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=undo-redo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo-redo.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/undo-redo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,2DAA2D;QAC3D,QAAQ,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;KACrC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo-redo.js","sources":["../../../../../libs/grid/src/lib/features/undo-redo.ts"],"sourcesContent":["/**\n * Undo/Redo feature for @toolbox-web/grid\n *\n * Requires the `editing` feature to be enabled.\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/undo-redo';\n *\n * grid.gridConfig = { features: { editing: true, undoRedo: true } };\n * ```\n */\n\nimport { UndoRedoPlugin, type UndoRedoConfig } from '../plugins/undo-redo';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable undo/redo for cell edits. Requires `editing`. */\n undoRedo?: boolean | UndoRedoConfig;\n }\n}\n\nregisterFeature('undoRedo', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as UndoRedoConfig) ?? {});\n return new UndoRedoPlugin(options);\n});\n"],"names":["registerFeature","config","UndoRedoPlugin"],"mappings":"2IAuBAA,EAAgB,WAAaC,GAEpB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAA6B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../../../libs/grid/src/lib/features/visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,QAAQ,eAAe,CAAC;IAC7B,UAAU,aAAa;QACrB,yCAAyC;QACzC,UAAU,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;KACzC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.js","sources":["../../../../../libs/grid/src/lib/features/visibility.ts"],"sourcesContent":["/**\n * Column Visibility feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/visibility';\n *\n * grid.gridConfig = { features: { visibility: true } };\n * ```\n */\n\nimport { VisibilityPlugin, type VisibilityConfig } from '../plugins/visibility';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable column visibility toggling. */\n visibility?: boolean | VisibilityConfig;\n }\n}\n\nregisterFeature('visibility', (config) => {\n const options = typeof config === 'boolean' ? {} : ((config as VisibilityConfig) ?? {});\n return new VisibilityPlugin(options);\n});\n"],"names":["registerFeature","config","VisibilityPlugin"],"mappings":"8IAqBAA,EAAgB,aAAeC,GAEtB,IAAIC,EADuB,kBAAXD,EAAuB,CAAA,EAAOA,GAA+B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',t={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:e,filterActive:e,print:"🖨️"};class n{static dependencies;static manifest;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(n),n.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...t,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),n=parseInt(t,10);if(!isNaN(n))return n}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}function i(e,t,n=!0){let i=e;if(n&&(i=i.filter(e=>!e.hidden&&!e.field.startsWith("__")&&!0!==e.meta?.utility)),t?.length){const e=new Set(t);i=i.filter(t=>e.has(t.field))}return i}function r(e){return null==e?"":e instanceof Date?e.toISOString():"object"==typeof e?JSON.stringify(e):String(e)}function o(e,t){const n=t.delimiter??"\t",i=t.newline??"\n",r=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),o=[];let s=[],l="",a=!1;for(let c=0;c<r.length;c++){const e=r[c];'"'!==e||a?'"'===e&&a?'"'===r[c+1]?(l+='"',c++):a=!1:e!==n||a?e!==i||a?l+=e:(s.push(l),l="",(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),s=[]):(s.push(l),l=""):a=!0}return s.push(l),(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),o}function s(e,t){const{rows:n,target:i,fields:r}=e;if(!i)return;const o=t.rows,s=t.effectiveConfig.columns??[],l=s.map(e=>e.field),a=/* @__PURE__ */new Map;s.forEach(e=>{a.set(e.field,!0===e.editable)});const c=[...o],d=i.bounds?i.bounds.endRow:1/0;n.forEach((e,t)=>{const n=i.row+t;if(!(n>d)){if(i.bounds){if(n>=c.length)return}else for(;n>=c.length;){const e={};l.forEach(t=>e[t]=""),c.push(e)}c[n]={...c[n]},e.forEach((e,t)=>{const i=r[t];i&&a.get(i)&&(c[n][i]=e)})}}),t.rows=c}class l extends n{static dependencies=[{name:"selection",required:!1,reason:"Enables copy/paste of selected cells instead of entire grid"}];name="clipboard";get defaultConfig(){return{includeHeaders:!1,delimiter:"\t",newline:"\n",quoteStrings:!1}}lastCopied=null;attach(e){super.attach(e);e.addEventListener("paste",e=>this.#t(e),{signal:this.disconnectSignal})}detach(){this.lastCopied=null}onKeyDown(e){return!(!e.ctrlKey&&!e.metaKey||"c"!==e.key)&&(e.preventDefault(),this.#n(e.target),!0)}#n(e){const t=this.#i();if(t&&0===t.ranges.length){const t=this.#r(e);if(!t)return;const n=this.columns[t.col];if(!n)return;return void this.copy({rowIndices:[t.row],columns:[n.field]})}this.copy()}#t(e){const t=e.clipboardData?.getData("text/plain");if(!t)return;e.preventDefault();const n=o(t,this.config),i=this.#i(),r=i?.ranges?.[0],s=r?.from.row??0,l=r?.from.col??0,a=r&&("range"===i?.mode||"row"===i?.mode)&&(r.from.row!==r.to.row||r.from.col!==r.to.col)?{endRow:r.to.row,endCol:r.to.col}:null,c=a?.endCol??this.visibleColumns.length-1,d=this.visibleColumns[l],u=d?{row:s,col:l,field:d.field,bounds:a}:null,h=[],g=n[0]?.length??0;for(let o=0;o<g&&l+o<=c;o++){const e=this.visibleColumns[l+o];e&&h.push(e.field)}const f={rows:n,text:t,target:u,fields:h};this.emit("paste",f),this.#o(f)}#o(e){if(!this.grid)return;const{pasteHandler:t}=this.config;if(null===t)return;(t??s)(e,this.grid)}#i(){const e=this.grid?.query("getSelection");return e?.[0]}#s(e){const t=this.#i();let n,r;if(e?.columns)n=i(this.columns,e.columns);else if(t?.ranges.length&&"row"!==t.mode){const e=t.ranges[t.ranges.length-1],r=Math.min(e.from.col,e.to.col),o=Math.max(e.from.col,e.to.col);n=i(this.visibleColumns.slice(r,o+1))}else n=i(this.columns);if(e?.rowIndices)r=function(e,t){return t?.length?[...t].sort((e,t)=>e-t).map(t=>e[t]).filter(e=>null!=e):e}(this.rows,e.rowIndices);else if(t?.ranges.length){const e=t.ranges[t.ranges.length-1],n=Math.min(e.from.row,e.to.row),i=Math.max(e.from.row,e.to.row);r=[];for(let t=n;t<=i;t++){const e=this.rows[t];e&&r.push(e)}}else r=this.rows;return{columns:n,rows:r}}#l(e,t,n){const i=n?.delimiter??this.config.delimiter??"\t",o=n?.newline??this.config.newline??"\n",s=n?.includeHeaders??this.config.includeHeaders??!1,l=n?.processCell??this.config.processCell,a=[];s&&a.push(e.map(e=>e.header||e.field).join(i));for(const c of t){const t=e.map(e=>{const t=c[e.field];return l?l(t,e.field,c):r(t)});a.push(t.join(i))}return a.join(o)}#r(e){const t=e.closest("[data-field-cache]");if(!t)return null;const n=t.dataset.fieldCache,i=t.dataset.row;if(!n||!i)return null;const r=parseInt(i,10);if(isNaN(r))return null;const o=this.columns.findIndex(e=>e.field===n);return-1===o?null:{row:r,col:o}}getSelectionAsText(e){const{columns:t,rows:n}=this.#s(e);return 0===t.length||0===n.length?"":this.#l(t,n,e)}async copy(e){const{columns:t,rows:n}=this.#s(e);if(0===t.length||0===n.length)return"";const i=this.#l(t,n,e);return await async function(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("[copyToClipboard] Clipboard API failed:",t);const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select();const i=document.execCommand("copy");return document.body.removeChild(n),i}}(i),this.lastCopied={text:i,timestamp:Date.now()},this.emit("copy",{text:i,rowCount:n.length,columnCount:t.length}),i}async copyRows(e,t){return 0===e.length?"":this.copy({...t,rowIndices:e})}async paste(){const e=await async function(){try{return await navigator.clipboard.readText()}catch{return""}}();return e?o(e,this.config):null}getLastCopied(){return this.lastCopied}}export{l as ClipboardPlugin,s as defaultPasteHandler};
|
|
1
|
+
const e='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',t={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:e,filterActive:e,print:"🖨️"};class n{static dependencies;static manifest;aliases;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(n),n.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...t,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),n=parseInt(t,10);if(!isNaN(n))return n}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}function i(e,t,n=!0){let i=e;if(n&&(i=i.filter(e=>!e.hidden&&!e.field.startsWith("__")&&!0!==e.meta?.utility)),t?.length){const e=new Set(t);i=i.filter(t=>e.has(t.field))}return i}function r(e){return null==e?"":e instanceof Date?e.toISOString():"object"==typeof e?JSON.stringify(e):String(e)}function o(e,t){const n=t.delimiter??"\t",i=t.newline??"\n",r=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),o=[];let s=[],l="",a=!1;for(let c=0;c<r.length;c++){const e=r[c];'"'!==e||a?'"'===e&&a?'"'===r[c+1]?(l+='"',c++):a=!1:e!==n||a?e!==i||a?l+=e:(s.push(l),l="",(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),s=[]):(s.push(l),l=""):a=!0}return s.push(l),(s.length>1||s.some(e=>""!==e.trim()))&&o.push(s),o}function s(e,t){const{rows:n,target:i,fields:r}=e;if(!i)return;const o=t.rows,s=t.effectiveConfig.columns??[],l=s.map(e=>e.field),a=/* @__PURE__ */new Map;s.forEach(e=>{a.set(e.field,!0===e.editable)});const c=[...o],d=i.bounds?i.bounds.endRow:1/0;n.forEach((e,t)=>{const n=i.row+t;if(!(n>d)){if(i.bounds){if(n>=c.length)return}else for(;n>=c.length;){const e={};l.forEach(t=>e[t]=""),c.push(e)}c[n]={...c[n]},e.forEach((e,t)=>{const i=r[t];i&&a.get(i)&&(c[n][i]=e)})}}),t.rows=c}class l extends n{static dependencies=[{name:"selection",required:!1,reason:"Enables copy/paste of selected cells instead of entire grid"}];name="clipboard";get defaultConfig(){return{includeHeaders:!1,delimiter:"\t",newline:"\n",quoteStrings:!1}}lastCopied=null;attach(e){super.attach(e);e.addEventListener("paste",e=>this.#t(e),{signal:this.disconnectSignal})}detach(){this.lastCopied=null}onKeyDown(e){return!(!e.ctrlKey&&!e.metaKey||"c"!==e.key)&&(e.preventDefault(),this.#n(e.target),!0)}#n(e){const t=this.#i();if(t&&0===t.ranges.length){const t=this.#r(e);if(!t)return;const n=this.columns[t.col];if(!n)return;return void this.copy({rowIndices:[t.row],columns:[n.field]})}this.copy()}#t(e){const t=e.clipboardData?.getData("text/plain");if(!t)return;e.preventDefault();const n=o(t,this.config),i=this.#i(),r=i?.ranges?.[0],s=r?.from.row??0,l=r?.from.col??0,a=r&&("range"===i?.mode||"row"===i?.mode)&&(r.from.row!==r.to.row||r.from.col!==r.to.col)?{endRow:r.to.row,endCol:r.to.col}:null,c=a?.endCol??this.visibleColumns.length-1,d=this.visibleColumns[l],u=d?{row:s,col:l,field:d.field,bounds:a}:null,h=[],g=n[0]?.length??0;for(let o=0;o<g&&l+o<=c;o++){const e=this.visibleColumns[l+o];e&&h.push(e.field)}const f={rows:n,text:t,target:u,fields:h};this.emit("paste",f),this.#o(f)}#o(e){if(!this.grid)return;const{pasteHandler:t}=this.config;if(null===t)return;(t??s)(e,this.grid)}#i(){const e=this.grid?.query("getSelection");return e?.[0]}#s(e){const t=this.#i();let n,r;if(e?.columns)n=i(this.columns,e.columns);else if(t?.ranges.length&&"row"!==t.mode){const e=t.ranges[t.ranges.length-1],r=Math.min(e.from.col,e.to.col),o=Math.max(e.from.col,e.to.col);n=i(this.visibleColumns.slice(r,o+1))}else n=i(this.columns);if(e?.rowIndices)r=function(e,t){return t?.length?[...t].sort((e,t)=>e-t).map(t=>e[t]).filter(e=>null!=e):e}(this.rows,e.rowIndices);else if(t?.ranges.length){const e=t.ranges[t.ranges.length-1],n=Math.min(e.from.row,e.to.row),i=Math.max(e.from.row,e.to.row);r=[];for(let t=n;t<=i;t++){const e=this.rows[t];e&&r.push(e)}}else r=this.rows;return{columns:n,rows:r}}#l(e,t,n){const i=n?.delimiter??this.config.delimiter??"\t",o=n?.newline??this.config.newline??"\n",s=n?.includeHeaders??this.config.includeHeaders??!1,l=n?.processCell??this.config.processCell,a=[];s&&a.push(e.map(e=>e.header||e.field).join(i));for(const c of t){const t=e.map(e=>{const t=c[e.field];return l?l(t,e.field,c):r(t)});a.push(t.join(i))}return a.join(o)}#r(e){const t=e.closest("[data-field-cache]");if(!t)return null;const n=t.dataset.fieldCache,i=t.dataset.row;if(!n||!i)return null;const r=parseInt(i,10);if(isNaN(r))return null;const o=this.columns.findIndex(e=>e.field===n);return-1===o?null:{row:r,col:o}}getSelectionAsText(e){const{columns:t,rows:n}=this.#s(e);return 0===t.length||0===n.length?"":this.#l(t,n,e)}async copy(e){const{columns:t,rows:n}=this.#s(e);if(0===t.length||0===n.length)return"";const i=this.#l(t,n,e);return await async function(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){console.warn("[copyToClipboard] Clipboard API failed:",t);const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select();const i=document.execCommand("copy");return document.body.removeChild(n),i}}(i),this.lastCopied={text:i,timestamp:Date.now()},this.emit("copy",{text:i,rowCount:n.length,columnCount:t.length}),i}async copyRows(e,t){return 0===e.length?"":this.copy({...t,rowIndices:e})}async paste(){const e=await async function(){try{return await navigator.clipboard.readText()}catch{return""}}();return e?o(e,this.config):null}getLastCopied(){return this.lastCopied}}export{l as ClipboardPlugin,s as defaultPasteHandler};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|