apex-grid 2.0.0 → 3.0.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 +26 -23
- package/components/grid.d.ts +26 -22
- package/components/grid.js +34 -52
- package/components/grid.js.map +1 -1
- package/components/header.js +7 -13
- package/components/header.js.map +1 -1
- package/components/toolbar.js +13 -29
- package/components/toolbar.js.map +1 -1
- package/controllers/state.d.ts +15 -1
- package/controllers/state.js +11 -1
- package/controllers/state.js.map +1 -1
- package/custom-elements.json +228 -242
- package/define.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +9 -2
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +3 -3
- package/docs/classes/ApexGrid.html +86 -87
- package/docs/functions/setup.html +11 -17
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +87 -47
- package/docs/interfaces/ApexCellValueChangedEvent.html +5 -5
- package/docs/interfaces/ApexCellValueChangingEvent.html +6 -6
- package/docs/interfaces/ApexColumnMovedEvent.html +4 -4
- package/docs/interfaces/ApexColumnMovingEvent.html +5 -5
- package/docs/interfaces/ApexColumnPinnedEvent.html +3 -3
- package/docs/interfaces/ApexColumnPinningEvent.html +4 -4
- package/docs/interfaces/ApexDetailContext.html +4 -4
- package/docs/interfaces/ApexFilteredEvent.html +3 -3
- package/docs/interfaces/ApexFilteringEvent.html +3 -3
- package/docs/interfaces/ApexGridEventMap.html +13 -13
- package/docs/interfaces/ApexHeaderContext.html +3 -3
- package/docs/interfaces/ApexPageChangedEvent.html +5 -5
- package/docs/interfaces/ApexPageChangingEvent.html +5 -5
- package/docs/interfaces/ApexQuickFilterChangedEvent.html +2 -2
- package/docs/interfaces/ApexQuickFilterChangingEvent.html +3 -3
- package/docs/interfaces/ApexRowEditEndedEvent.html +3 -3
- package/docs/interfaces/ApexRowEditStartedEvent.html +2 -2
- package/docs/interfaces/ApexRowExpandedEvent.html +4 -4
- package/docs/interfaces/ApexRowExpandingEvent.html +5 -5
- package/docs/interfaces/ApexRowSelectedEvent.html +4 -4
- package/docs/interfaces/ApexRowSelectingEvent.html +5 -5
- package/docs/interfaces/ApexTreeRowExpandedEvent.html +4 -4
- package/docs/interfaces/ApexTreeRowExpandingEvent.html +5 -5
- package/docs/interfaces/BaseApexCellContext.html +6 -6
- package/docs/interfaces/BaseApexEditorContext.html +8 -8
- package/docs/interfaces/BaseColumnConfiguration.html +34 -15
- package/docs/interfaces/BaseColumnSortConfiguration.html +3 -3
- package/docs/interfaces/BaseFilterExpression.html +4 -4
- package/docs/interfaces/BaseSortExpression.html +3 -3
- package/docs/interfaces/CSVExportOptions.html +9 -9
- package/docs/interfaces/ColumnFilterConfiguration.html +2 -2
- package/docs/interfaces/DataPipelineConfiguration.html +3 -3
- package/docs/interfaces/ExportFormat.html +10 -0
- package/docs/interfaces/ExportOptions.html +6 -6
- package/docs/interfaces/GridEditingConfiguration.html +4 -4
- package/docs/interfaces/GridExpansionConfiguration.html +5 -5
- package/docs/interfaces/GridSelectionConfiguration.html +4 -4
- package/docs/interfaces/GridSortConfiguration.html +3 -3
- package/docs/interfaces/GridTreeConfiguration.html +5 -5
- package/docs/interfaces/PaginationConfiguration.html +6 -6
- package/docs/interfaces/PaginationState.html +5 -5
- package/docs/media/LICENSE +80 -0
- package/docs/media/_tokens.scss +106 -0
- package/docs/media/package.json +14 -12
- package/docs/modules.html +1 -1
- package/docs/types/ApexCellContext.html +1 -1
- package/docs/types/ApexEditorContext.html +1 -1
- package/docs/types/BasePropertyType.html +1 -1
- package/docs/types/BaseSortComparer.html +1 -1
- package/docs/types/ColumnConfiguration.html +1 -1
- package/docs/types/ColumnDropPosition.html +1 -1
- package/docs/types/ColumnSortConfiguration.html +1 -1
- package/docs/types/DataPipelineHook.html +1 -1
- package/docs/types/DataPipelineParams.html +4 -4
- package/docs/types/DataType.html +18 -1
- package/docs/types/ExportSource.html +1 -1
- package/docs/types/FilterCriteria.html +1 -1
- package/docs/types/FilterExpression.html +1 -1
- package/docs/types/Keys.html +1 -1
- package/docs/types/PropertyType.html +1 -1
- package/docs/types/SortComparer.html +1 -1
- package/docs/types/SortExpression.html +1 -1
- package/docs/types/SortState.html +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/internal/column-types.js +161 -1
- package/internal/column-types.js.map +1 -1
- package/internal/export.d.ts +12 -4
- package/internal/export.js.map +1 -1
- package/internal/feature-module.d.ts +27 -0
- package/internal/feature-module.js +2 -0
- package/internal/feature-module.js.map +1 -0
- package/internal/icons.d.ts +7 -0
- package/internal/icons.js +11 -0
- package/internal/icons.js.map +1 -1
- package/internal/index.d.ts +20 -0
- package/internal/index.js +6 -0
- package/internal/index.js.map +1 -0
- package/internal/types.d.ts +54 -5
- package/internal/types.js.map +1 -1
- package/operations/filter/tree.d.ts +1 -1
- package/operations/filter/types.js.map +1 -1
- package/operations/sort/types.js.map +1 -1
- package/package.json +5 -1
- package/setup.d.ts +19 -26
- package/setup.js +4 -2
- package/setup.js.map +1 -1
- package/styles/_checkbox.css.js +3 -0
- package/styles/_checkbox.css.js.map +1 -0
- package/styles/_tokens.css.js +3 -0
- package/styles/_tokens.css.js.map +1 -0
- package/styles/body-cell/body-cell.css.js +1 -1
- package/styles/body-cell/body-cell.css.js.map +1 -1
- package/styles/body-cell/cell-renderers.css.js +3 -0
- package/styles/body-cell/cell-renderers.css.js.map +1 -0
- package/styles/body-row/body-row.css.js +1 -1
- package/styles/body-row/body-row.css.js.map +1 -1
- package/styles/filter-row/filter-row.css.js +1 -1
- package/styles/filter-row/filter-row.css.js.map +1 -1
- package/styles/grid/_grid.base.css.js +1 -1
- package/styles/grid/_grid.base.css.js.map +1 -1
- package/styles/grid/grid.css.js +3 -0
- package/styles/grid/grid.css.js.map +1 -0
- package/styles/header-cell/header-cell.css.js +1 -1
- package/styles/header-cell/header-cell.css.js.map +1 -1
- package/styles/header-row/header-row.base.css.js +1 -1
- package/styles/header-row/header-row.base.css.js.map +1 -1
- package/styles/paginator/paginator.css.js +1 -1
- package/styles/paginator/paginator.css.js.map +1 -1
- package/styles/toolbar/toolbar.css.js +1 -1
- package/styles/toolbar/toolbar.css.js.map +1 -1
- package/docs/interfaces/XLSXExportOptions.html +0 -17
- package/docs/media/publish.yml +0 -111
- package/internal/theming.d.ts +0 -34
- package/internal/theming.js +0 -123
- package/internal/theming.js.map +0 -1
- package/internal/xlsx.d.ts +0 -22
- package/internal/xlsx.js +0 -228
- package/internal/xlsx.js.map +0 -1
- package/styles/grid/themes/light/grid.bootstrap.css.js +0 -3
- package/styles/grid/themes/light/grid.bootstrap.css.js.map +0 -1
- package/styles/grid/themes/light/grid.fluent.css.js +0 -3
- package/styles/grid/themes/light/grid.fluent.css.js.map +0 -1
- package/styles/grid/themes/light/grid.indigo.css.js +0 -3
- package/styles/grid/themes/light/grid.indigo.css.js.map +0 -1
- package/styles/grid/themes/light/grid.material.css.js +0 -3
- package/styles/grid/themes/light/grid.material.css.js.map +0 -1
- /package/styles/{grid/themes/light/grid.bootstrap.css.d.ts → _checkbox.css.d.ts} +0 -0
- /package/styles/{grid/themes/light/grid.fluent.css.d.ts → _tokens.css.d.ts} +0 -0
- /package/styles/{grid/themes/light/grid.indigo.css.d.ts → body-cell/cell-renderers.css.d.ts} +0 -0
- /package/styles/grid/{themes/light/grid.material.css.d.ts → grid.css.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -19,10 +19,10 @@ A Lit-based, framework-agnostic web component data grid. Ships as a single custo
|
|
|
19
19
|
- **Row selection** — single or multiple, optional checkbox column, full programmatic API.
|
|
20
20
|
- **Row expansion (master-detail)** — opt-in chevron column with a `detailTemplate`.
|
|
21
21
|
- **Tree data (nested rows)** — AG Grid–style `getDataPath` pattern over a flat array.
|
|
22
|
-
- **CSV
|
|
22
|
+
- **CSV export** — programmatic method plus an optional toolbar dropdown. (Excel/XLSX export is in `apex-grid-enterprise`.)
|
|
23
23
|
- **Toolbar** — opt-in `<apex-grid-toolbar>` with debounced quick filter and export menu.
|
|
24
24
|
- **Templating** — slot-based templates for cells, headers, editors, and detail panels.
|
|
25
|
-
- **Theming** —
|
|
25
|
+
- **Theming** — styled out-of-the-box; fully customizable through `--ag-*` CSS custom properties (no theme import or build step). Auto-matches an `igniteui-webcomponents` host app when one is present.
|
|
26
26
|
- **Accessibility** — WCAG 2.2 AA semantics (`role="grid"` / `role="treegrid"`, `aria-rowcount`, `aria-colcount`, focus + keyboard navigation).
|
|
27
27
|
- **Provenance-signed npm releases** with OIDC trusted publishing.
|
|
28
28
|
|
|
@@ -34,12 +34,11 @@ A Lit-based, framework-agnostic web component data grid. Ships as a single custo
|
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
36
|
import { setup } from 'apex-grid';
|
|
37
|
-
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
38
37
|
|
|
39
|
-
setup(
|
|
38
|
+
setup();
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
That single call registers `<apex-grid
|
|
41
|
+
That single call registers `<apex-grid>` and adopts a default host stylesheet (`height: 100%; min-height: 240px`). The grid is styled out-of-the-box — no theme CSS import is required.
|
|
43
42
|
|
|
44
43
|
### Render the grid
|
|
45
44
|
|
|
@@ -105,18 +104,22 @@ ApexGrid.register();
|
|
|
105
104
|
|
|
106
105
|
Without this, `<apex-grid>` is an inert unknown element.
|
|
107
106
|
|
|
108
|
-
### 3.
|
|
107
|
+
### 3. (Optional) Customize the look
|
|
109
108
|
|
|
110
|
-
The grid
|
|
109
|
+
The grid is styled out-of-the-box — there is no theme to import. Customize it by overriding the `--ag-*` CSS custom properties on `apex-grid` (or any ancestor); a one-line brand override cascades to every tint:
|
|
111
110
|
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
```css
|
|
112
|
+
apex-grid {
|
|
113
|
+
--ag-brand: #7c3aed; /* selection, focus, accents */
|
|
114
|
+
--ag-brand-strong: #6d28d9; /* hover / pressed */
|
|
115
|
+
--ag-radius: 12px; /* outer card radius */
|
|
116
|
+
--ag-row-h: 40px; /* row height */
|
|
117
|
+
}
|
|
117
118
|
```
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
See [`src/styles/_tokens.scss`](src/styles/_tokens.scss) for the full token list (brand, surfaces, text, semantic state colors, typography, spacing, motion).
|
|
121
|
+
|
|
122
|
+
If you embed the grid alongside `igniteui-webcomponents`, the brand tokens automatically re-tint from the igniteui palette (`--ig-primary-500`) — no configuration needed.
|
|
120
123
|
|
|
121
124
|
### 4. Size the host
|
|
122
125
|
|
|
@@ -136,7 +139,7 @@ apex-grid {
|
|
|
136
139
|
|
|
137
140
|
### What success looks like
|
|
138
141
|
|
|
139
|
-
|
|
142
|
+
With the element registered and the host sized, you should see:
|
|
140
143
|
|
|
141
144
|
- **Visible borders** between rows and columns.
|
|
142
145
|
- **Sort arrows** (↕) next to each header when `sort: true`.
|
|
@@ -148,7 +151,7 @@ When all four steps are in place you should see:
|
|
|
148
151
|
|
|
149
152
|
| What you see | Likely cause |
|
|
150
153
|
|---|---|
|
|
151
|
-
|
|
|
154
|
+
| Want a different look / brand color | Step 3 — override the `--ag-*` CSS variables |
|
|
152
155
|
| Only ~3 rows visible regardless of data size | Step 4 — no bounded height, **or** consumer CSS sets `display` on `<apex-grid>` (check console for the warning) |
|
|
153
156
|
| `<apex-grid>` blank tag in DOM | Step 2 — element not registered |
|
|
154
157
|
| Columns shown as literal `[object Object]` | `columns=` used as an attribute — must be a **property** (`.columns=${...}` in Lit, `[columns]=` in Angular, `:columns.prop=` in Vue, `el.columns = ...` in vanilla JS) |
|
|
@@ -329,7 +332,7 @@ await grid.expandAllTreeRows();
|
|
|
329
332
|
|
|
330
333
|
Methods: `toggleTreeRow`, `expandTreeRow`, `collapseTreeRow`, `expandAllTreeRows`, `collapseAllTreeRows`, `isTreeRowExpanded`. Events: `treeRowExpanding` (cancellable), `treeRowExpanded`. When tree mode is active, the host element advertises `role="treegrid"`.
|
|
331
334
|
|
|
332
|
-
### CSV
|
|
335
|
+
### CSV export
|
|
333
336
|
|
|
334
337
|
Programmatic:
|
|
335
338
|
|
|
@@ -337,11 +340,11 @@ Programmatic:
|
|
|
337
340
|
grid.exportToCSV(); // downloads data.csv
|
|
338
341
|
grid.exportToCSV({ filename: 'users', source: 'selected' });
|
|
339
342
|
const text = grid.exportToCSV({ filename: '' }); // no download, returns the string
|
|
340
|
-
|
|
341
|
-
grid.exportToXLSX({ filename: 'users', sheetName: 'Users' });
|
|
342
343
|
```
|
|
343
344
|
|
|
344
|
-
`source` can be `'view'` (default — post-filter/post-sort), `'page'`, `'selected'`, or `'all'`. Per-column opt-out: `{ key: 'secret', exportable: false }`.
|
|
345
|
+
`source` can be `'view'` (default — post-filter/post-sort), `'page'`, `'selected'`, or `'all'`. Per-column opt-out: `{ key: 'secret', exportable: false }`.
|
|
346
|
+
|
|
347
|
+
> **XLSX (Excel) export** moved to [`apex-grid-enterprise`](https://www.npmjs.com/package/apex-grid-enterprise) in v3. `<apex-grid-enterprise>` adds `grid.exportToXLSX(...)` and an "Export XLSX" entry to this same toolbar menu. CSV stays free.
|
|
345
348
|
|
|
346
349
|
Toolbar dropdown:
|
|
347
350
|
|
|
@@ -349,7 +352,7 @@ Toolbar dropdown:
|
|
|
349
352
|
<apex-grid show-export></apex-grid>
|
|
350
353
|
```
|
|
351
354
|
|
|
352
|
-
Renders a download icon in the toolbar's trailing actions area; the menu has "Export CSV"
|
|
355
|
+
Renders a download icon in the toolbar's trailing actions area; the menu has an "Export CSV" entry (the enterprise grid adds "Export XLSX"). Toolbar `exportFilename` overrides the default `data` filename. Attribute: `show-export`.
|
|
353
356
|
|
|
354
357
|
### Toolbar
|
|
355
358
|
|
|
@@ -370,7 +373,7 @@ Search input has a `debounce` attribute (default `200`ms).
|
|
|
370
373
|
|
|
371
374
|
### Theming
|
|
372
375
|
|
|
373
|
-
|
|
376
|
+
The grid styles itself through `--ag-*` CSS custom properties — override them on `apex-grid` (or any ancestor) to rebrand; see [`src/styles/_tokens.scss`](src/styles/_tokens.scss) for the full list. When `igniteui-webcomponents` is present, the brand tokens auto-tint from its palette.
|
|
374
377
|
|
|
375
378
|
Style with CSS parts on the grid, paginator, and toolbar:
|
|
376
379
|
|
|
@@ -446,7 +449,7 @@ toggleTreeRow(row); expandTreeRow(row); collapseTreeRow(row)
|
|
|
446
449
|
expandAllTreeRows(); collapseAllTreeRows(); isTreeRowExpanded(row)
|
|
447
450
|
|
|
448
451
|
exportToCSV(options?): string
|
|
449
|
-
|
|
452
|
+
exportAs(formatId, options?): void // toolbar dispatch; 'csv' (community), 'xlsx' (enterprise)
|
|
450
453
|
```
|
|
451
454
|
|
|
452
455
|
### Events
|
|
@@ -523,4 +526,4 @@ Any push whose head commit does not start with `release:` is a no-op for the wor
|
|
|
523
526
|
|
|
524
527
|
## License
|
|
525
528
|
|
|
526
|
-
See [LICENSE
|
|
529
|
+
See [LICENSE](LICENSE).
|
package/components/grid.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { nothing } from 'lit';
|
|
|
3
3
|
import { DataOperationsController } from '../controllers/data-operation.js';
|
|
4
4
|
import { GridDOMController } from '../controllers/dom.js';
|
|
5
5
|
import { StateController } from '../controllers/state.js';
|
|
6
|
-
import { type CSVExportOptions, type
|
|
6
|
+
import { type CSVExportOptions, type ExportFormat, type ExportOptions } from '../internal/export.js';
|
|
7
7
|
import { EventEmitterBase } from '../internal/mixins/event-emitter.js';
|
|
8
8
|
import type { ColumnConfiguration, DataPipelineConfiguration, GridEditingConfiguration, GridExpansionConfiguration, GridSelectionConfiguration, GridSortConfiguration, GridTreeConfiguration, Keys, PaginationConfiguration, PaginationState, PinPosition } from '../internal/types.js';
|
|
9
9
|
import type { FilterExpression } from '../operations/filter/types.js';
|
|
@@ -558,7 +558,7 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
558
558
|
*
|
|
559
559
|
*/
|
|
560
560
|
export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {
|
|
561
|
-
static get tagName():
|
|
561
|
+
static get tagName(): string;
|
|
562
562
|
static styles: import("lit").CSSResult;
|
|
563
563
|
/**
|
|
564
564
|
* Registers `<apex-grid>` and its internal dependencies with the custom-element
|
|
@@ -574,6 +574,14 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
574
574
|
protected stateController: StateController<T>;
|
|
575
575
|
protected DOM: GridDOMController<T>;
|
|
576
576
|
protected dataController: DataOperationsController<T>;
|
|
577
|
+
/**
|
|
578
|
+
* Builds the grid's {@link StateController}. This is the single construction
|
|
579
|
+
* site for `stateController` — overriding it (rather than re-declaring the
|
|
580
|
+
* field) is the supported seam for derived grids to inject optional
|
|
581
|
+
* {@link GridFeatureModule}s while preserving field-initializer ordering.
|
|
582
|
+
* The community grid registers no extra modules.
|
|
583
|
+
*/
|
|
584
|
+
protected createStateController(): StateController<T>;
|
|
577
585
|
protected stateProvider: ContextProvider<{
|
|
578
586
|
__context__: StateController<any>;
|
|
579
587
|
}, this>;
|
|
@@ -664,9 +672,9 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
664
672
|
*
|
|
665
673
|
* @remarks
|
|
666
674
|
* When `true`, the toolbar shows a download button on the trailing side;
|
|
667
|
-
* clicking it opens a menu with
|
|
668
|
-
*
|
|
669
|
-
*
|
|
675
|
+
* clicking it opens a menu with one entry per {@link ApexGrid.exportFormats}
|
|
676
|
+
* (CSV in the community grid) that calls {@link ApexGrid.exportAs}.
|
|
677
|
+
* {@link ApexGrid.exportToCSV} remains callable programmatically regardless
|
|
670
678
|
* of this flag.
|
|
671
679
|
*
|
|
672
680
|
* @attr show-export
|
|
@@ -921,7 +929,6 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
921
929
|
protected pipeline(): Promise<void>;
|
|
922
930
|
protected paginationChanged(): void;
|
|
923
931
|
protected quickFilterChanged(): void;
|
|
924
|
-
constructor();
|
|
925
932
|
protected updated(): void;
|
|
926
933
|
protected firstUpdated(): void;
|
|
927
934
|
/**
|
|
@@ -1102,24 +1109,22 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
1102
1109
|
*/
|
|
1103
1110
|
exportToCSV(options?: CSVExportOptions<T>): string;
|
|
1104
1111
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
* context) triggers a download.
|
|
1112
|
+
* The export formats offered in the toolbar's export menu, in order.
|
|
1107
1113
|
*
|
|
1108
1114
|
* @remarks
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
* @
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
* ```
|
|
1115
|
+
* The community grid offers CSV only. This is the seam derived grids use to
|
|
1116
|
+
* contribute more formats: `@apexcharts/grid-enterprise` overrides it to add
|
|
1117
|
+
* `'xlsx'`. The toolbar renders one menu item per entry and dispatches the
|
|
1118
|
+
* chosen id to {@link ApexGrid.exportAs}.
|
|
1119
|
+
*/
|
|
1120
|
+
get exportFormats(): ReadonlyArray<ExportFormat>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Exports the grid in the given format (one of {@link ApexGrid.exportFormats}).
|
|
1123
|
+
* Called by the toolbar's export menu. The community grid handles `'csv'`;
|
|
1124
|
+
* derived grids override to handle additional formats, delegating to `super`
|
|
1125
|
+
* for the ones they don't add.
|
|
1121
1126
|
*/
|
|
1122
|
-
|
|
1127
|
+
exportAs(formatId: string, options?: ExportOptions<T>): void;
|
|
1123
1128
|
/**
|
|
1124
1129
|
* Moves a column relative to another column.
|
|
1125
1130
|
*
|
|
@@ -1168,6 +1173,5 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
1168
1173
|
}
|
|
1169
1174
|
declare global {
|
|
1170
1175
|
interface HTMLElementTagNameMap {
|
|
1171
|
-
[ApexGrid.tagName]: ApexGrid<object>;
|
|
1172
1176
|
}
|
|
1173
1177
|
}
|
package/components/grid.js
CHANGED
|
@@ -12,18 +12,13 @@ import { DataOperationsController } from '../controllers/data-operation.js';
|
|
|
12
12
|
import { GridDOMController } from '../controllers/dom.js';
|
|
13
13
|
import { gridStateContext, StateController } from '../controllers/state.js';
|
|
14
14
|
import { DEFAULT_COLUMN_CONFIG, PIPELINE } from '../internal/constants.js';
|
|
15
|
-
import { buildCSV, downloadBlob,
|
|
15
|
+
import { buildCSV, downloadBlob, } from '../internal/export.js';
|
|
16
16
|
import { EventEmitterBase } from '../internal/mixins/event-emitter.js';
|
|
17
17
|
import { registerComponent } from '../internal/register.js';
|
|
18
18
|
import { GRID_TAG } from '../internal/tags.js';
|
|
19
|
-
import { addThemingController } from '../internal/theming.js';
|
|
20
19
|
import { asArray, autoGenerateColumns, getDisplayColumns, getFilterOperandsFor, } from '../internal/utils.js';
|
|
21
20
|
import { watch } from '../internal/watch.js';
|
|
22
|
-
import {
|
|
23
|
-
import { styles as bootstrap } from '../styles/grid/themes/light/grid.bootstrap.css.js';
|
|
24
|
-
import { styles as fluent } from '../styles/grid/themes/light/grid.fluent.css.js';
|
|
25
|
-
import { styles as indigo } from '../styles/grid/themes/light/grid.indigo.css.js';
|
|
26
|
-
import { styles as material } from '../styles/grid/themes/light/grid.material.css.js';
|
|
21
|
+
import { styles as gridStyles } from '../styles/grid/grid.css.js';
|
|
27
22
|
import ApexGridCell from './cell.js';
|
|
28
23
|
import ApexFilterRow from './filter-row.js';
|
|
29
24
|
import ApexGridHeaderRow from './header-row.js';
|
|
@@ -32,13 +27,38 @@ import ApexGridRow from './row.js';
|
|
|
32
27
|
import ApexGridToolbar from './toolbar.js';
|
|
33
28
|
import ApexVirtualizer from './virtualizer.js';
|
|
34
29
|
export class ApexGrid extends EventEmitterBase {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.stateController = this.createStateController();
|
|
33
|
+
this.DOM = new GridDOMController(this, this.stateController);
|
|
34
|
+
this.dataController = new DataOperationsController(this);
|
|
35
|
+
this.stateProvider = new ContextProvider(this, {
|
|
36
|
+
context: gridStateContext,
|
|
37
|
+
initialValue: this.stateController,
|
|
38
|
+
});
|
|
39
|
+
this.dataState = [];
|
|
40
|
+
this.columns = [];
|
|
41
|
+
this.data = [];
|
|
42
|
+
this.autoGenerate = false;
|
|
43
|
+
this.sortConfiguration = {
|
|
44
|
+
multiple: true,
|
|
45
|
+
triState: true,
|
|
46
|
+
};
|
|
47
|
+
this.quickFilter = '';
|
|
48
|
+
this.showQuickFilter = false;
|
|
49
|
+
this.showExport = false;
|
|
50
|
+
this.columnReordering = false;
|
|
51
|
+
}
|
|
35
52
|
static get tagName() {
|
|
36
53
|
return GRID_TAG;
|
|
37
54
|
}
|
|
38
|
-
static { this.styles =
|
|
55
|
+
static { this.styles = gridStyles; }
|
|
39
56
|
static register() {
|
|
40
57
|
registerComponent(ApexGrid, ApexVirtualizer, ApexGridRow, ApexGridHeaderRow, ApexFilterRow, ApexGridPaginator, ApexGridToolbar);
|
|
41
58
|
}
|
|
59
|
+
createStateController() {
|
|
60
|
+
return new StateController(this);
|
|
61
|
+
}
|
|
42
62
|
get selectedRows() {
|
|
43
63
|
return this.stateController.selection.selectedRows();
|
|
44
64
|
}
|
|
@@ -205,32 +225,6 @@ export class ApexGrid extends EventEmitterBase {
|
|
|
205
225
|
this.pipeline();
|
|
206
226
|
}
|
|
207
227
|
}
|
|
208
|
-
constructor() {
|
|
209
|
-
super();
|
|
210
|
-
this.stateController = new StateController(this);
|
|
211
|
-
this.DOM = new GridDOMController(this, this.stateController);
|
|
212
|
-
this.dataController = new DataOperationsController(this);
|
|
213
|
-
this.stateProvider = new ContextProvider(this, {
|
|
214
|
-
context: gridStateContext,
|
|
215
|
-
initialValue: this.stateController,
|
|
216
|
-
});
|
|
217
|
-
this.dataState = [];
|
|
218
|
-
this.columns = [];
|
|
219
|
-
this.data = [];
|
|
220
|
-
this.autoGenerate = false;
|
|
221
|
-
this.sortConfiguration = {
|
|
222
|
-
multiple: true,
|
|
223
|
-
triState: true,
|
|
224
|
-
};
|
|
225
|
-
this.quickFilter = '';
|
|
226
|
-
this.showQuickFilter = false;
|
|
227
|
-
this.showExport = false;
|
|
228
|
-
this.columnReordering = false;
|
|
229
|
-
addThemingController(this, {
|
|
230
|
-
light: { bootstrap, material, fluent, indigo },
|
|
231
|
-
dark: { bootstrap, material, fluent, indigo },
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
228
|
updated() {
|
|
235
229
|
this.setAttribute('role', this.stateController.tree.enabled ? 'treegrid' : 'grid');
|
|
236
230
|
const hasFilter = this.columns.some((column) => column.filter);
|
|
@@ -384,25 +378,13 @@ export class ApexGrid extends EventEmitterBase {
|
|
|
384
378
|
}
|
|
385
379
|
return csv;
|
|
386
380
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
headers: includeHeader ? columns.map((column) => getColumnLabel(column)) : [],
|
|
394
|
-
rows: rows.map((row) => columns.map((column) => resolveExportValue(column, row, options))),
|
|
395
|
-
};
|
|
396
|
-
const bytes = buildXLSX(sheet);
|
|
397
|
-
const filename = options.filename;
|
|
398
|
-
const mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
|
399
|
-
if (filename) {
|
|
400
|
-
downloadBlob(`${filename}.xlsx`, bytes, mime);
|
|
401
|
-
}
|
|
402
|
-
else if (filename === undefined) {
|
|
403
|
-
downloadBlob('data.xlsx', bytes, mime);
|
|
381
|
+
get exportFormats() {
|
|
382
|
+
return [{ id: 'csv', label: 'Export CSV' }];
|
|
383
|
+
}
|
|
384
|
+
exportAs(formatId, options = {}) {
|
|
385
|
+
if (formatId === 'csv') {
|
|
386
|
+
this.exportToCSV(options);
|
|
404
387
|
}
|
|
405
|
-
return bytes;
|
|
406
388
|
}
|
|
407
389
|
async moveColumn(fromKey, toKey, position = 'before') {
|
|
408
390
|
if (fromKey === toKey)
|