apex-grid 3.2.0 → 3.4.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/CHANGELOG.md +120 -0
- package/README.md +229 -52
- package/components/cell.d.ts +16 -3
- package/components/cell.js +78 -8
- package/components/cell.js.map +1 -1
- package/components/filter-row.d.ts +3 -6
- package/components/filter-row.js +144 -115
- package/components/filter-row.js.map +1 -1
- package/components/grid.d.ts +421 -77
- package/components/grid.js +432 -13
- package/components/grid.js.map +1 -1
- package/components/group-header-row.d.ts +34 -0
- package/components/group-header-row.js +125 -0
- package/components/group-header-row.js.map +1 -0
- package/components/header-row.d.ts +13 -2
- package/components/header-row.js +33 -18
- package/components/header-row.js.map +1 -1
- package/components/header.d.ts +11 -0
- package/components/header.js +209 -8
- package/components/header.js.map +1 -1
- package/components/paginator.d.ts +6 -1
- package/components/paginator.js +17 -11
- package/components/paginator.js.map +1 -1
- package/components/row.d.ts +28 -0
- package/components/row.js +100 -3
- package/components/row.js.map +1 -1
- package/components/toolbar.d.ts +8 -1
- package/components/toolbar.js +25 -7
- package/components/toolbar.js.map +1 -1
- package/controllers/data-operation.js +1 -0
- package/controllers/data-operation.js.map +1 -1
- package/controllers/dom.d.ts +24 -6
- package/controllers/dom.js +62 -5
- package/controllers/dom.js.map +1 -1
- package/controllers/editing.d.ts +68 -1
- package/controllers/editing.js +129 -44
- package/controllers/editing.js.map +1 -1
- package/controllers/expansion.js +4 -4
- package/controllers/expansion.js.map +1 -1
- package/controllers/filter.d.ts +1 -1
- package/controllers/filter.js +27 -5
- package/controllers/filter.js.map +1 -1
- package/controllers/history.d.ts +86 -0
- package/controllers/history.js +125 -0
- package/controllers/history.js.map +1 -0
- package/controllers/navigation.d.ts +49 -2
- package/controllers/navigation.js +145 -3
- package/controllers/navigation.js.map +1 -1
- package/controllers/pagination.js +1 -1
- package/controllers/pagination.js.map +1 -1
- package/controllers/reorder.js +3 -1
- package/controllers/reorder.js.map +1 -1
- package/controllers/row-pin.d.ts +59 -0
- package/controllers/row-pin.js +75 -0
- package/controllers/row-pin.js.map +1 -0
- package/controllers/row-reorder.d.ts +161 -0
- package/controllers/row-reorder.js +332 -0
- package/controllers/row-reorder.js.map +1 -0
- package/controllers/selection.js +3 -3
- package/controllers/selection.js.map +1 -1
- package/controllers/sort.js +13 -3
- package/controllers/sort.js.map +1 -1
- package/controllers/state.d.ts +33 -0
- package/controllers/state.js +37 -2
- package/controllers/state.js.map +1 -1
- package/controllers/tree.d.ts +8 -0
- package/controllers/tree.js +0 -0
- package/controllers/tree.js.map +1 -1
- package/custom-elements.json +4667 -926
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +28 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/functions/custom.html +3 -0
- package/docs/functions/interpolate.html +4 -0
- package/docs/functions/localize.html +8 -0
- package/docs/functions/max.html +3 -0
- package/docs/functions/min.html +3 -0
- package/docs/functions/pattern.html +3 -0
- package/docs/functions/required.html +3 -0
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +245 -54
- package/docs/interfaces/ApexCellValidationFailedEvent.html +13 -0
- package/docs/interfaces/ApexCellValueChangedEvent.html +1 -1
- package/docs/interfaces/ApexCellValueChangingEvent.html +2 -2
- package/docs/interfaces/ApexColumnGroupContext.html +6 -0
- package/docs/interfaces/ApexColumnMovedEvent.html +2 -2
- package/docs/interfaces/ApexColumnMovingEvent.html +1 -1
- package/docs/interfaces/ApexDetailContext.html +2 -2
- package/docs/interfaces/ApexGridEventMap.html +37 -9
- package/docs/interfaces/ApexHistoryChangedEvent.html +6 -0
- package/docs/interfaces/ApexPageChangedEvent.html +1 -1
- package/docs/interfaces/ApexRowMovingEvent.html +9 -0
- package/docs/interfaces/ApexRowPinningEvent.html +8 -0
- package/docs/interfaces/ApexStateChangedEvent.html +4 -0
- package/docs/interfaces/BaseApexCellContext.html +1 -1
- package/docs/interfaces/BaseApexEditorContext.html +1 -1
- package/docs/interfaces/BaseColumnConfiguration.html +42 -17
- package/docs/interfaces/CSVExportOptions.html +2 -2
- package/docs/interfaces/ColumnGroupConfiguration.html +12 -0
- package/docs/interfaces/ColumnLayoutState.html +2 -0
- package/docs/interfaces/ColumnSchema.html +22 -0
- package/docs/interfaces/DataPipelineConfiguration.html +2 -2
- package/docs/interfaces/EditingHistoryConfiguration.html +10 -0
- package/docs/interfaces/ExportFormat.html +2 -2
- package/docs/interfaces/ExportOptions.html +1 -1
- package/docs/interfaces/FilterStateSnapshot.html +4 -0
- package/docs/interfaces/GetStateOptions.html +4 -0
- package/docs/interfaces/GridCapabilities.html +8 -0
- package/docs/interfaces/GridEditingConfiguration.html +4 -2
- package/docs/interfaces/GridRowPinningConfiguration.html +5 -0
- package/docs/interfaces/GridRowReorderingConfiguration.html +22 -0
- package/docs/interfaces/GridSchema.html +19 -0
- package/docs/interfaces/GridState.html +41 -0
- package/docs/interfaces/GridTreeConfiguration.html +2 -2
- package/docs/interfaces/PaginationConfiguration.html +1 -1
- package/docs/interfaces/PaginationState.html +1 -1
- package/docs/interfaces/SetStateOptions.html +9 -0
- package/docs/interfaces/SetStateResult.html +11 -0
- package/docs/interfaces/SortStateSnapshot.html +2 -0
- package/docs/interfaces/ValidatorContext.html +8 -0
- package/docs/media/_tokens.scss +70 -81
- package/docs/media/package.json +2 -2
- package/docs/media/state-persistence.html +189 -0
- package/docs/modules.html +1 -1
- package/docs/types/DataPipelineParams.html +2 -2
- package/docs/types/EditMode.html +2 -2
- package/docs/types/GridLocaleKey.html +3 -0
- package/docs/types/GridLocaleText.html +5 -0
- package/docs/types/LocaleParams.html +2 -0
- package/docs/types/PaginationMode.html +1 -1
- package/docs/types/RowDropPosition.html +2 -0
- package/docs/types/RowPinPosition.html +2 -0
- package/docs/types/RowRef.html +3 -0
- package/docs/types/Validator.html +4 -0
- package/docs/variables/EN_LOCALE.html +9 -0
- package/docs/variables/esLocale.html +8 -0
- package/i18n/en.d.ts +245 -0
- package/i18n/en.js +219 -0
- package/i18n/en.js.map +1 -0
- package/i18n/es.d.ts +18 -0
- package/i18n/es.js +219 -0
- package/i18n/es.js.map +1 -0
- package/i18n/index.d.ts +3 -0
- package/i18n/index.js +4 -0
- package/i18n/index.js.map +1 -0
- package/i18n/localize.d.ts +23 -0
- package/i18n/localize.js +15 -0
- package/i18n/localize.js.map +1 -0
- package/index.d.ts +8 -2
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/internal/column-types.js +1 -1
- package/internal/column-types.js.map +1 -1
- package/internal/feature-module.d.ts +46 -0
- package/internal/feature-module.js +11 -0
- package/internal/feature-module.js.map +1 -1
- package/internal/flip.js +1 -1
- package/internal/flip.js.map +1 -1
- package/internal/icons.d.ts +9 -7
- package/internal/icons.js +75 -35
- package/internal/icons.js.map +1 -1
- package/internal/index.d.ts +5 -3
- package/internal/index.js +2 -1
- package/internal/index.js.map +1 -1
- package/internal/state-schema.d.ts +85 -0
- package/internal/state-schema.js +27 -0
- package/internal/state-schema.js.map +1 -0
- package/internal/state-snapshot.d.ts +152 -0
- package/internal/state-snapshot.js +115 -0
- package/internal/state-snapshot.js.map +1 -0
- package/internal/tags.d.ts +1 -0
- package/internal/tags.js +1 -0
- package/internal/tags.js.map +1 -1
- package/internal/types.d.ts +162 -2
- package/internal/types.js.map +1 -1
- package/internal/utils.d.ts +12 -0
- package/internal/utils.js +17 -0
- package/internal/utils.js.map +1 -1
- package/internal/validators.d.ts +31 -0
- package/internal/validators.js +44 -0
- package/internal/validators.js.map +1 -0
- package/package.json +1 -1
- package/styles/_tokens.css.js +1 -1
- package/styles/_tokens.css.js.map +1 -1
- package/styles/body-cell/body-cell.css.js +1 -1
- package/styles/body-cell/body-cell.css.js.map +1 -1
- 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 +1 -1
- package/styles/grid/grid.css.js.map +1 -1
- package/styles/group-header-row/group-header-row.css.d.ts +1 -0
- package/styles/group-header-row/group-header-row.css.js +3 -0
- package/styles/group-header-row/group-header-row.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/toolbar/toolbar.css.js +1 -1
- package/styles/toolbar/toolbar.css.js.map +1 -1
- package/docs/classes/ApexGrid.html +0 -399
|
@@ -125,6 +125,23 @@ export interface CellDecorator<T extends object = any> {
|
|
|
125
125
|
}
|
|
126
126
|
/** Runtime type-guard for {@link CellDecorator}. */
|
|
127
127
|
export declare function isCellDecorator<T extends object>(controller: unknown): controller is CellDecorator<T>;
|
|
128
|
+
/**
|
|
129
|
+
* Optional capability a feature module's controller may implement to signal that
|
|
130
|
+
* it provides a **column header menu** (opened from the header's kebab button).
|
|
131
|
+
* The core header shows the kebab whenever a column is sortable or resizable, or
|
|
132
|
+
* when a module reports `true` here, so a feature (e.g. the enterprise context
|
|
133
|
+
* menu) can surface pin / hide / group / chart actions on any column. The module
|
|
134
|
+
* owns the menu content itself (it opens on the `apex-grid-column-menu` event the
|
|
135
|
+
* header dispatches). Inert for the community grid, which registers no modules.
|
|
136
|
+
*
|
|
137
|
+
* @remarks Unstable; part of `apex-grid/internal`.
|
|
138
|
+
*/
|
|
139
|
+
export interface ColumnMenuProvider {
|
|
140
|
+
/** Whether the column-menu (kebab) button should be offered for columns. */
|
|
141
|
+
providesColumnMenu(): boolean;
|
|
142
|
+
}
|
|
143
|
+
/** Runtime type-guard for {@link ColumnMenuProvider}. */
|
|
144
|
+
export declare function isColumnMenuProvider(controller: unknown): controller is ColumnMenuProvider;
|
|
128
145
|
/** The kind of pointer interaction forwarded from a body cell. */
|
|
129
146
|
export type CellInteractionKind = 'down' | 'over' | 'up';
|
|
130
147
|
/** A pointer interaction on a body cell, forwarded to feature modules. */
|
|
@@ -157,3 +174,32 @@ export interface CellInteractionHandler<T extends object = any> {
|
|
|
157
174
|
}
|
|
158
175
|
/** Runtime type-guard for {@link CellInteractionHandler}. */
|
|
159
176
|
export declare function isCellInteractionHandler<T extends object>(controller: unknown): controller is CellInteractionHandler<T>;
|
|
177
|
+
/**
|
|
178
|
+
* Optional capability a feature module's controller may implement so its state
|
|
179
|
+
* participates in grid-state snapshots ({@link StateController.serializeModuleState}
|
|
180
|
+
* / {@link StateController.restoreModuleState}, driven by `ApexGrid.getState` /
|
|
181
|
+
* `ApexGrid.setState`). The grid collects each implementer's
|
|
182
|
+
* {@link serializeState} output under the module's id and dispatches the
|
|
183
|
+
* matching value back via {@link restoreState} on restore.
|
|
184
|
+
*
|
|
185
|
+
* Controllers that don't implement this are skipped, so the community grid
|
|
186
|
+
* (which registers no modules) contributes nothing to a snapshot.
|
|
187
|
+
*
|
|
188
|
+
* @remarks Unstable; part of `apex-grid/internal`.
|
|
189
|
+
*/
|
|
190
|
+
export interface SerializableModule {
|
|
191
|
+
/**
|
|
192
|
+
* Return a JSON-serializable snapshot of this module's restorable state
|
|
193
|
+
* (e.g. grouping's `groupBy` + aggregations). Exclude transient/derived
|
|
194
|
+
* state and anything not JSON-safe (functions, DOM nodes).
|
|
195
|
+
*/
|
|
196
|
+
serializeState(): unknown;
|
|
197
|
+
/**
|
|
198
|
+
* Restore module state from a value previously produced by
|
|
199
|
+
* {@link serializeState}. Implementations should tolerate partial or
|
|
200
|
+
* unexpected shapes (validate before applying) since the blob is opaque.
|
|
201
|
+
*/
|
|
202
|
+
restoreState(data: unknown): void;
|
|
203
|
+
}
|
|
204
|
+
/** Runtime type-guard for {@link SerializableModule}. */
|
|
205
|
+
export declare function isSerializableModule(controller: unknown): controller is SerializableModule;
|
|
@@ -13,9 +13,20 @@ export function isCellDecorator(controller) {
|
|
|
13
13
|
controller !== null &&
|
|
14
14
|
typeof controller.decorateCell === 'function');
|
|
15
15
|
}
|
|
16
|
+
export function isColumnMenuProvider(controller) {
|
|
17
|
+
return (typeof controller === 'object' &&
|
|
18
|
+
controller !== null &&
|
|
19
|
+
typeof controller.providesColumnMenu === 'function');
|
|
20
|
+
}
|
|
16
21
|
export function isCellInteractionHandler(controller) {
|
|
17
22
|
return (typeof controller === 'object' &&
|
|
18
23
|
controller !== null &&
|
|
19
24
|
typeof controller.handleCellInteraction === 'function');
|
|
20
25
|
}
|
|
26
|
+
export function isSerializableModule(controller) {
|
|
27
|
+
return (typeof controller === 'object' &&
|
|
28
|
+
controller !== null &&
|
|
29
|
+
typeof controller.serializeState === 'function' &&
|
|
30
|
+
typeof controller.restoreState === 'function');
|
|
31
|
+
}
|
|
21
32
|
//# sourceMappingURL=feature-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-module.js","sourceRoot":"","sources":["../../src/internal/feature-module.ts"],"names":[],"mappings":"AAwDA,MAAM,UAAU,gBAAgB,CAC9B,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAAgC,CAAC,WAAW,KAAK,UAAU,CACpE,CAAC;AACJ,CAAC;AAqCD,MAAM,UAAU,cAAc,CAC5B,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAA8B,CAAC,UAAU,KAAK,UAAU,CACjE,CAAC;AACJ,CAAC;AA+CD,MAAM,UAAU,eAAe,CAC7B,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAA+B,CAAC,YAAY,KAAK,UAAU,CACpE,CAAC;AACJ,CAAC;AAoCD,MAAM,UAAU,wBAAwB,CACtC,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAAwC,CAAC,qBAAqB,KAAK,UAAU,CACtF,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactiveController, TemplateResult } from 'lit';\n// Type-only import — erased at runtime, so this does not create a runtime\n// import cycle with `controllers/state.ts` (which imports the guards below).\nimport type { StateController } from '../controllers/state.js';\nimport type { ColumnConfiguration, GridHost } from './types.js';\n\n/**\n * Extension point for layering optional features onto the grid without baking\n * them into the community build.\n *\n * A feature module contributes a {@link ReactiveController} that is constructed\n * alongside the grid's built-in controllers (see {@link StateController}). It is\n * the seam used by the first-party `@apexcharts/grid-enterprise` package; it is\n * intentionally minimal and additive so the community `<apex-grid>` element is\n * unaffected (it registers zero modules).\n *\n * @remarks This API lives under the unstable `apex-grid/internal` entry point.\n */\nexport interface GridFeatureModule<T extends object = any> {\n /**\n * Stable identifier, e.g. `'grouping'`. Used to de-duplicate modules and to\n * look the controller up later via {@link StateController.module}.\n */\n readonly id: string;\n\n /**\n * Construct the feature's controller. The controller is expected to register\n * itself with the host (typically `host.addController(this)` in its\n * constructor), exactly like the built-in controllers.\n *\n * @param host The grid host the controller drives.\n * @param state The owning {@link StateController}, passed so a module can\n * coordinate with cross-cutting grid state (e.g. request a cell-decoration\n * refresh via {@link StateController.bumpDecoration} or look up a peer\n * module). Modules that don't need it may ignore the argument.\n */\n create(host: GridHost<T>, state: StateController<T>): ReactiveController;\n}\n\n/**\n * Optional capability a feature module's controller may implement to transform\n * the row set *after* the built-in pipeline (filter → sort → tree) and *before*\n * pagination is sliced at render time. Lets a module inject or reorder rows —\n * e.g. synthesized group-header rows — in the rendered `dataView`.\n *\n * Controllers that don't implement this are skipped, so the community grid\n * (which registers no modules) is unaffected.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface RowTransformer<T extends object = any> {\n /** Return the transformed rows. Must not mutate the input array in place. */\n processRows(rows: ReadonlyArray<T>): T[];\n}\n\n/** Runtime type-guard for {@link RowTransformer}. */\nexport function isRowTransformer<T extends object>(\n controller: unknown\n): controller is RowTransformer<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as RowTransformer<T>).processRows === 'function'\n );\n}\n\n/** Per-row context handed to a {@link RowPresenter}. */\nexport interface RowPresenterContext<T extends object = any> {\n /** The grid's visible columns (post-reorder/visibility). */\n readonly columns: ReadonlyArray<ColumnConfiguration<T>>;\n /** Index of the row within the current page/view. */\n readonly rowIndex: number;\n}\n\n/**\n * A module-rendered, full-width row. Rendered inside a container that spans all\n * columns (`grid-column: 1 / -1`), mirroring the master-detail panel pattern.\n */\nexport interface PresentedRow {\n /** Template rendered inside the full-width container. */\n readonly content: TemplateResult;\n /** Optional 1-based `aria-level` applied to the row element. */\n readonly level?: number;\n /** Optional `aria-expanded` for the row element; omit for non-expandable rows. */\n readonly expanded?: boolean;\n /** Shadow part for the container element; defaults to `group-row`. */\n readonly part?: string;\n}\n\n/**\n * Optional capability a feature module's controller may implement to render\n * specific rows as full-width custom content (e.g. group headers) instead of\n * the normal cell grid. Returns `null` for rows the module does not own.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface RowPresenter<T extends object = any> {\n presentRow(row: T, ctx: RowPresenterContext<T>): PresentedRow | null;\n}\n\n/** Runtime type-guard for {@link RowPresenter}. */\nexport function isRowPresenter<T extends object>(\n controller: unknown\n): controller is RowPresenter<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as RowPresenter<T>).presentRow === 'function'\n );\n}\n\n/** Per-cell context handed to a {@link CellDecorator}. */\nexport interface CellDecoratorContext<T extends object = any> {\n /** The row's backing data (or a synthesized row object). */\n readonly row: T;\n /** Index of the row within the current page/view (matches `host.pageItems`). */\n readonly rowIndex: number;\n /** The cell's column configuration. */\n readonly column: ColumnConfiguration<T>;\n /** The cell's resolved value (`row[column.key]`). */\n readonly value: unknown;\n}\n\n/**\n * A set of host attributes a module asks the cell to reflect on itself. This is\n * the only thing a {@link CellDecorator} returns — styling is expressed by\n * keying CSS off these attributes (the cell ships an inert, variable-driven\n * `:host([data-range])` style; enterprise themes it via inheriting custom\n * properties).\n */\nexport interface CellDecoration {\n /**\n * Attributes to set on the decorated cell host. Use a `data-*` namespace\n * (e.g. `data-range`) so decoration never collides with the cell's built-in\n * reflected attributes (`active`, `editing`, `data-pinned`, …). A `null`/\n * `undefined` value removes the attribute. Attributes set on a previous\n * update that are absent here are removed automatically.\n */\n readonly attributes: Readonly<Record<string, string | null | undefined>>;\n}\n\n/**\n * Optional capability a feature module's controller may implement to decorate\n * individual cells with extra host attributes during the cell's own render\n * lifecycle — e.g. flagging the cells inside a selected range. Consulted per\n * cell via {@link StateController.decorateCell}; controllers that don't\n * implement it are skipped, so the community grid is unaffected.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface CellDecorator<T extends object = any> {\n /** Return decoration for this cell, or `null` to leave it undecorated. */\n decorateCell(ctx: CellDecoratorContext<T>): CellDecoration | null;\n}\n\n/** Runtime type-guard for {@link CellDecorator}. */\nexport function isCellDecorator<T extends object>(\n controller: unknown\n): controller is CellDecorator<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as CellDecorator<T>).decorateCell === 'function'\n );\n}\n\n/** The kind of pointer interaction forwarded from a body cell. */\nexport type CellInteractionKind = 'down' | 'over' | 'up';\n\n/** A pointer interaction on a body cell, forwarded to feature modules. */\nexport interface CellInteraction<T extends object = any> {\n /** `down` on press, `over` while the pointer moves across cells, `up` on release. */\n readonly kind: CellInteractionKind;\n /** The cell's row data. */\n readonly row: T;\n /** Index of the row within the current page/view (matches `host.pageItems`). */\n readonly rowIndex: number;\n /** The cell's column configuration. */\n readonly column: ColumnConfiguration<T>;\n readonly shiftKey: boolean;\n readonly ctrlKey: boolean;\n readonly metaKey: boolean;\n /** The originating pointer event (e.g. to call `preventDefault`). */\n readonly originalEvent: PointerEvent;\n}\n\n/**\n * Optional capability a feature module's controller may implement to receive\n * pointer interactions on body cells (press / drag-over / release) — the seam a\n * range-selection feature uses to track a drag. The grid forwards interactions\n * only when at least one feature module is registered, so the community grid\n * pays nothing.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface CellInteractionHandler<T extends object = any> {\n handleCellInteraction(interaction: CellInteraction<T>): void;\n}\n\n/** Runtime type-guard for {@link CellInteractionHandler}. */\nexport function isCellInteractionHandler<T extends object>(\n controller: unknown\n): controller is CellInteractionHandler<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as CellInteractionHandler<T>).handleCellInteraction === 'function'\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"feature-module.js","sourceRoot":"","sources":["../../src/internal/feature-module.ts"],"names":[],"mappings":"AAwDA,MAAM,UAAU,gBAAgB,CAC9B,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAAgC,CAAC,WAAW,KAAK,UAAU,CACpE,CAAC;AACJ,CAAC;AAqCD,MAAM,UAAU,cAAc,CAC5B,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAA8B,CAAC,UAAU,KAAK,UAAU,CACjE,CAAC;AACJ,CAAC;AA+CD,MAAM,UAAU,eAAe,CAC7B,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAA+B,CAAC,YAAY,KAAK,UAAU,CACpE,CAAC;AACJ,CAAC;AAmBD,MAAM,UAAU,oBAAoB,CAAC,UAAmB;IACtD,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAAiC,CAAC,kBAAkB,KAAK,UAAU,CAC5E,CAAC;AACJ,CAAC;AAoCD,MAAM,UAAU,wBAAwB,CACtC,UAAmB;IAEnB,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAAwC,CAAC,qBAAqB,KAAK,UAAU,CACtF,CAAC;AACJ,CAAC;AA+BD,MAAM,UAAU,oBAAoB,CAAC,UAAmB;IACtD,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,OAAQ,UAAiC,CAAC,cAAc,KAAK,UAAU;QACvE,OAAQ,UAAiC,CAAC,YAAY,KAAK,UAAU,CACtE,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactiveController, TemplateResult } from 'lit';\n// Type-only import — erased at runtime, so this does not create a runtime\n// import cycle with `controllers/state.ts` (which imports the guards below).\nimport type { StateController } from '../controllers/state.js';\nimport type { ColumnConfiguration, GridHost } from './types.js';\n\n/**\n * Extension point for layering optional features onto the grid without baking\n * them into the community build.\n *\n * A feature module contributes a {@link ReactiveController} that is constructed\n * alongside the grid's built-in controllers (see {@link StateController}). It is\n * the seam used by the first-party `@apexcharts/grid-enterprise` package; it is\n * intentionally minimal and additive so the community `<apex-grid>` element is\n * unaffected (it registers zero modules).\n *\n * @remarks This API lives under the unstable `apex-grid/internal` entry point.\n */\nexport interface GridFeatureModule<T extends object = any> {\n /**\n * Stable identifier, e.g. `'grouping'`. Used to de-duplicate modules and to\n * look the controller up later via {@link StateController.module}.\n */\n readonly id: string;\n\n /**\n * Construct the feature's controller. The controller is expected to register\n * itself with the host (typically `host.addController(this)` in its\n * constructor), exactly like the built-in controllers.\n *\n * @param host The grid host the controller drives.\n * @param state The owning {@link StateController}, passed so a module can\n * coordinate with cross-cutting grid state (e.g. request a cell-decoration\n * refresh via {@link StateController.bumpDecoration} or look up a peer\n * module). Modules that don't need it may ignore the argument.\n */\n create(host: GridHost<T>, state: StateController<T>): ReactiveController;\n}\n\n/**\n * Optional capability a feature module's controller may implement to transform\n * the row set *after* the built-in pipeline (filter → sort → tree) and *before*\n * pagination is sliced at render time. Lets a module inject or reorder rows —\n * e.g. synthesized group-header rows — in the rendered `dataView`.\n *\n * Controllers that don't implement this are skipped, so the community grid\n * (which registers no modules) is unaffected.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface RowTransformer<T extends object = any> {\n /** Return the transformed rows. Must not mutate the input array in place. */\n processRows(rows: ReadonlyArray<T>): T[];\n}\n\n/** Runtime type-guard for {@link RowTransformer}. */\nexport function isRowTransformer<T extends object>(\n controller: unknown\n): controller is RowTransformer<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as RowTransformer<T>).processRows === 'function'\n );\n}\n\n/** Per-row context handed to a {@link RowPresenter}. */\nexport interface RowPresenterContext<T extends object = any> {\n /** The grid's visible columns (post-reorder/visibility). */\n readonly columns: ReadonlyArray<ColumnConfiguration<T>>;\n /** Index of the row within the current page/view. */\n readonly rowIndex: number;\n}\n\n/**\n * A module-rendered, full-width row. Rendered inside a container that spans all\n * columns (`grid-column: 1 / -1`), mirroring the master-detail panel pattern.\n */\nexport interface PresentedRow {\n /** Template rendered inside the full-width container. */\n readonly content: TemplateResult;\n /** Optional 1-based `aria-level` applied to the row element. */\n readonly level?: number;\n /** Optional `aria-expanded` for the row element; omit for non-expandable rows. */\n readonly expanded?: boolean;\n /** Shadow part for the container element; defaults to `group-row`. */\n readonly part?: string;\n}\n\n/**\n * Optional capability a feature module's controller may implement to render\n * specific rows as full-width custom content (e.g. group headers) instead of\n * the normal cell grid. Returns `null` for rows the module does not own.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface RowPresenter<T extends object = any> {\n presentRow(row: T, ctx: RowPresenterContext<T>): PresentedRow | null;\n}\n\n/** Runtime type-guard for {@link RowPresenter}. */\nexport function isRowPresenter<T extends object>(\n controller: unknown\n): controller is RowPresenter<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as RowPresenter<T>).presentRow === 'function'\n );\n}\n\n/** Per-cell context handed to a {@link CellDecorator}. */\nexport interface CellDecoratorContext<T extends object = any> {\n /** The row's backing data (or a synthesized row object). */\n readonly row: T;\n /** Index of the row within the current page/view (matches `host.pageItems`). */\n readonly rowIndex: number;\n /** The cell's column configuration. */\n readonly column: ColumnConfiguration<T>;\n /** The cell's resolved value (`row[column.key]`). */\n readonly value: unknown;\n}\n\n/**\n * A set of host attributes a module asks the cell to reflect on itself. This is\n * the only thing a {@link CellDecorator} returns — styling is expressed by\n * keying CSS off these attributes (the cell ships an inert, variable-driven\n * `:host([data-range])` style; enterprise themes it via inheriting custom\n * properties).\n */\nexport interface CellDecoration {\n /**\n * Attributes to set on the decorated cell host. Use a `data-*` namespace\n * (e.g. `data-range`) so decoration never collides with the cell's built-in\n * reflected attributes (`active`, `editing`, `data-pinned`, …). A `null`/\n * `undefined` value removes the attribute. Attributes set on a previous\n * update that are absent here are removed automatically.\n */\n readonly attributes: Readonly<Record<string, string | null | undefined>>;\n}\n\n/**\n * Optional capability a feature module's controller may implement to decorate\n * individual cells with extra host attributes during the cell's own render\n * lifecycle — e.g. flagging the cells inside a selected range. Consulted per\n * cell via {@link StateController.decorateCell}; controllers that don't\n * implement it are skipped, so the community grid is unaffected.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface CellDecorator<T extends object = any> {\n /** Return decoration for this cell, or `null` to leave it undecorated. */\n decorateCell(ctx: CellDecoratorContext<T>): CellDecoration | null;\n}\n\n/** Runtime type-guard for {@link CellDecorator}. */\nexport function isCellDecorator<T extends object>(\n controller: unknown\n): controller is CellDecorator<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as CellDecorator<T>).decorateCell === 'function'\n );\n}\n\n/**\n * Optional capability a feature module's controller may implement to signal that\n * it provides a **column header menu** (opened from the header's kebab button).\n * The core header shows the kebab whenever a column is sortable or resizable, or\n * when a module reports `true` here, so a feature (e.g. the enterprise context\n * menu) can surface pin / hide / group / chart actions on any column. The module\n * owns the menu content itself (it opens on the `apex-grid-column-menu` event the\n * header dispatches). Inert for the community grid, which registers no modules.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface ColumnMenuProvider {\n /** Whether the column-menu (kebab) button should be offered for columns. */\n providesColumnMenu(): boolean;\n}\n\n/** Runtime type-guard for {@link ColumnMenuProvider}. */\nexport function isColumnMenuProvider(controller: unknown): controller is ColumnMenuProvider {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as ColumnMenuProvider).providesColumnMenu === 'function'\n );\n}\n\n/** The kind of pointer interaction forwarded from a body cell. */\nexport type CellInteractionKind = 'down' | 'over' | 'up';\n\n/** A pointer interaction on a body cell, forwarded to feature modules. */\nexport interface CellInteraction<T extends object = any> {\n /** `down` on press, `over` while the pointer moves across cells, `up` on release. */\n readonly kind: CellInteractionKind;\n /** The cell's row data. */\n readonly row: T;\n /** Index of the row within the current page/view (matches `host.pageItems`). */\n readonly rowIndex: number;\n /** The cell's column configuration. */\n readonly column: ColumnConfiguration<T>;\n readonly shiftKey: boolean;\n readonly ctrlKey: boolean;\n readonly metaKey: boolean;\n /** The originating pointer event (e.g. to call `preventDefault`). */\n readonly originalEvent: PointerEvent;\n}\n\n/**\n * Optional capability a feature module's controller may implement to receive\n * pointer interactions on body cells (press / drag-over / release) — the seam a\n * range-selection feature uses to track a drag. The grid forwards interactions\n * only when at least one feature module is registered, so the community grid\n * pays nothing.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface CellInteractionHandler<T extends object = any> {\n handleCellInteraction(interaction: CellInteraction<T>): void;\n}\n\n/** Runtime type-guard for {@link CellInteractionHandler}. */\nexport function isCellInteractionHandler<T extends object>(\n controller: unknown\n): controller is CellInteractionHandler<T> {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as CellInteractionHandler<T>).handleCellInteraction === 'function'\n );\n}\n\n/**\n * Optional capability a feature module's controller may implement so its state\n * participates in grid-state snapshots ({@link StateController.serializeModuleState}\n * / {@link StateController.restoreModuleState}, driven by `ApexGrid.getState` /\n * `ApexGrid.setState`). The grid collects each implementer's\n * {@link serializeState} output under the module's id and dispatches the\n * matching value back via {@link restoreState} on restore.\n *\n * Controllers that don't implement this are skipped, so the community grid\n * (which registers no modules) contributes nothing to a snapshot.\n *\n * @remarks Unstable; part of `apex-grid/internal`.\n */\nexport interface SerializableModule {\n /**\n * Return a JSON-serializable snapshot of this module's restorable state\n * (e.g. grouping's `groupBy` + aggregations). Exclude transient/derived\n * state and anything not JSON-safe (functions, DOM nodes).\n */\n serializeState(): unknown;\n /**\n * Restore module state from a value previously produced by\n * {@link serializeState}. Implementations should tolerate partial or\n * unexpected shapes (validate before applying) since the blob is opaque.\n */\n restoreState(data: unknown): void;\n}\n\n/** Runtime type-guard for {@link SerializableModule}. */\nexport function isSerializableModule(controller: unknown): controller is SerializableModule {\n return (\n typeof controller === 'object' &&\n controller !== null &&\n typeof (controller as SerializableModule).serializeState === 'function' &&\n typeof (controller as SerializableModule).restoreState === 'function'\n );\n}\n"]}
|
package/internal/flip.js
CHANGED
|
@@ -35,7 +35,7 @@ export function playKeyedFlip(before, resolveElement, axis = 'both') {
|
|
|
35
35
|
return;
|
|
36
36
|
for (const { key, rect: oldRect } of before) {
|
|
37
37
|
const element = resolveElement(key);
|
|
38
|
-
if (!element
|
|
38
|
+
if (!element?.isConnected)
|
|
39
39
|
continue;
|
|
40
40
|
const newRect = element.getBoundingClientRect();
|
|
41
41
|
const dx = axis === 'y' ? 0 : oldRect.left - newRect.left;
|
package/internal/flip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flip.js","sourceRoot":"","sources":["../../src/internal/flip.ts"],"names":[],"mappings":"AAeA,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,WAAW,GAAG,8BAA8B,CAAC;AACnD,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,SAAS,oBAAoB;IAC3B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,UAAU;QAAE,OAAO,KAAK,CAAC;IACtE,OAAO,MAAM,CAAC,UAA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OAAO,EAAE,IAAI,MAAM,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,OAAO,EAAE,WAAW;YAAE,SAAS;QACpC,MAAM,OAAO,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAChD,MAAM,EAAE,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1D,MAAM,EAAE,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACxD,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY;YAAE,SAAS;QAEzE,OAAO,CAAC,OAAO,CACb,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC,EAChF;YACE,QAAQ,EAAE,gBAAgB;YAC1B,MAAM,EAAE,WAAW;YACnB,SAAS,EAAE,KAAK;SACjB,CACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/**\n * Lightweight FLIP (First / Last / Invert / Play) helpers for animating\n * element re-positioning during column reorder + row sort.\n *\n * @remarks\n * Uses the Web Animations API with `composite: 'add'` so the FLIP delta\n * stacks ON TOP of whatever inline `transform` the virtualizer already set\n * on row elements — without `'add'` our keyframe would clobber the\n * virtualizer's `translate(...)` and rows would jump to the origin before\n * settling.\n *\n * Respects `prefers-reduced-motion: reduce` and bails out entirely when the\n * user has opted out of motion.\n */\n\nconst FLIP_DURATION_MS = 220;\nconst FLIP_EASING = 'cubic-bezier(0.2, 0, 0.2, 1)';\nconst MIN_DELTA_PX = 0.5;\n\nfunction prefersReducedMotion(): boolean {\n if (typeof window === 'undefined' || !window.matchMedia) return false;\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\n/**\n * One element to FLIP, captured at its \"first\" (pre-mutation) position.\n */\nexport interface FlipEntry {\n element: HTMLElement;\n rect: DOMRect;\n}\n\n/**\n * Plays the FLIP animation for every captured element by computing the\n * delta against its current (post-mutation) bounding rect and animating it\n * back to identity.\n *\n * @param entries - Elements captured by {@link captureRect}.\n * @param axis - `'x'` for horizontal motion (column reorder), `'y'` for\n * vertical motion (row sort), `'both'` for diagonal motion if either axis\n * could move.\n */\nexport function playFlip(entries: ReadonlyArray<FlipEntry>, axis: 'x' | 'y' | 'both' = 'both') {\n if (prefersReducedMotion() || entries.length === 0) return;\n\n for (const { element, rect: oldRect } of entries) {\n if (!element.isConnected) continue;\n const newRect = element.getBoundingClientRect();\n const dx = axis === 'y' ? 0 : oldRect.left - newRect.left;\n const dy = axis === 'x' ? 0 : oldRect.top - newRect.top;\n if (Math.abs(dx) < MIN_DELTA_PX && Math.abs(dy) < MIN_DELTA_PX) continue;\n\n // `composite: 'add'` stacks our delta on top of any inline transform\n // (e.g. the virtualizer's `translate(0, Ypx)` on row elements).\n element.animate(\n [{ transform: `translate(${dx}px, ${dy}px)` }, { transform: 'translate(0, 0)' }],\n {\n duration: FLIP_DURATION_MS,\n easing: FLIP_EASING,\n composite: 'add',\n }\n );\n }\n}\n\n/**\n * Convenience: capture a rect for an element, returning a {@link FlipEntry}.\n */\nexport function captureRect(element: HTMLElement): FlipEntry {\n return { element, rect: element.getBoundingClientRect() };\n}\n\n/**\n * A subset of `LitElement` needed for {@link awaitChildUpdates}.\n */\ninterface UpdatableElement {\n updateComplete: Promise<unknown>;\n}\n\n/**\n * Awaits a set of child elements' `updateComplete` promises.\n *\n * @remarks\n * The grid's `updateComplete` only resolves the grid's own update — child\n * components (header row, body rows, cells) schedule their updates one\n * microtask later. FLIP needs every relevant child to have its new DOM\n * committed before computing the \"Last\" rect; without this wait the\n * captured-before and measured-after rects match and the animation\n * silently no-ops.\n */\nexport async function awaitChildUpdates(\n elements: ReadonlyArray<UpdatableElement | null | undefined>\n) {\n await Promise.all(\n elements.filter((el): el is UpdatableElement => el != null).map((el) => el.updateComplete)\n );\n}\n\n/**\n * Keyed FLIP entry — pairs an arbitrary identity key with a captured rect.\n *\n * @remarks\n * Used for row sort animation: the virtualizer recycles `<apex-grid-row>`\n * DOM elements so the same element holds different row data before and\n * after a sort. We capture rects keyed by row data identity, then resolve\n * the new DOM element after the sort via the `resolveElement` callback.\n */\nexport interface KeyedFlipEntry<K> {\n key: K;\n rect: DOMRect;\n}\n\n/**\n * Plays a FLIP animation against elements located by key after a DOM\n * mutation has settled. Used for row sort, where DOM elements get recycled\n * across the mutation and can only be found by data identity.\n *\n * @param before - Rects captured before the mutation, keyed by data\n * identity (or any other stable key).\n * @param resolveElement - Function that returns the current DOM element\n * representing `key`, or `null` if the keyed row is no longer in view.\n * @param axis - Same semantics as {@link playFlip}.\n */\nexport function playKeyedFlip<K>(\n before: ReadonlyArray<KeyedFlipEntry<K>>,\n resolveElement: (key: K) => HTMLElement | null,\n axis: 'x' | 'y' | 'both' = 'both'\n) {\n if (prefersReducedMotion() || before.length === 0) return;\n\n for (const { key, rect: oldRect } of before) {\n const element = resolveElement(key);\n if (!element?.isConnected) continue;\n const newRect = element.getBoundingClientRect();\n const dx = axis === 'y' ? 0 : oldRect.left - newRect.left;\n const dy = axis === 'x' ? 0 : oldRect.top - newRect.top;\n if (Math.abs(dx) < MIN_DELTA_PX && Math.abs(dy) < MIN_DELTA_PX) continue;\n\n element.animate(\n [{ transform: `translate(${dx}px, ${dy}px)` }, { transform: 'translate(0, 0)' }],\n {\n duration: FLIP_DURATION_MS,\n easing: FLIP_EASING,\n composite: 'add',\n }\n );\n }\n}\n"]}
|
package/internal/icons.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type SVGTemplateResult, type TemplateResult } from 'lit';
|
|
|
2
2
|
interface IconDef {
|
|
3
3
|
viewBox: string;
|
|
4
4
|
paths: SVGTemplateResult;
|
|
5
|
+
/** When true, renders stroke="currentColor" fill="none" (Lucide style). */
|
|
6
|
+
stroke?: boolean;
|
|
5
7
|
}
|
|
6
8
|
declare const ICONS: Record<string, IconDef>;
|
|
7
9
|
export type GridIconName = keyof typeof ICONS;
|
|
@@ -16,16 +18,16 @@ export interface IconRenderOptions {
|
|
|
16
18
|
sortIndex?: number | string;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
|
-
* Renders one of the grid's built-in icons as an inline `<svg>`.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* Renders one of the grid's built-in icons as an inline `<svg>`. Lucide-based
|
|
22
|
+
* icons (`stroke: true`) render as `stroke="currentColor" fill="none"`;
|
|
23
|
+
* legacy fill icons render as `fill="currentColor"`.
|
|
22
24
|
*/
|
|
23
25
|
export declare function renderIcon(name: string, opts?: IconRenderOptions): TemplateResult;
|
|
24
26
|
/**
|
|
25
|
-
* Renders the stacked up/down sort affordance
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Renders the stacked up/down sort affordance (Lucide ChevronsUpDown split
|
|
28
|
+
* into two independently-styleable parts). The header CSS dims both chevrons
|
|
29
|
+
* at rest, lifts the inactive one on hover, and paints the active direction
|
|
30
|
+
* in the brand color via `data-sort-active` on the parent button.
|
|
29
31
|
*/
|
|
30
32
|
export declare function renderSortArrows(): TemplateResult;
|
|
31
33
|
export {};
|
package/internal/icons.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { html, svg } from 'lit';
|
|
2
2
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
|
-
const
|
|
4
|
-
'arrow-upward': {
|
|
5
|
-
viewBox: '0 0 45 45',
|
|
6
|
-
paths: svg `<path d="M22.5 40V13.7L10.1 26.1 8 24 24 8l16 16-2.1 2.1-12.4-12.4V40Z"/>`,
|
|
7
|
-
},
|
|
8
|
-
'arrow-downward': {
|
|
9
|
-
viewBox: '0 0 45 45',
|
|
10
|
-
paths: svg `<path fill="currentColor" d="M24 40 8 24l2.1-2.1 12.4 12.4V8h3v26.3l12.4-12.4L40 24Z"/>`,
|
|
11
|
-
},
|
|
3
|
+
const OPERAND_ICONS = {
|
|
12
4
|
all: {
|
|
13
5
|
viewBox: '0 0 24 24',
|
|
14
6
|
paths: svg `<path d="M2 14h8v2H2zm0-8h12v2H2zm14 11l-3-3-1.5 1.5L16 20l7-7-1.5-1.5L16 17zM2 10h12v2H2z"/>`,
|
|
@@ -43,7 +35,7 @@ const ICONS = {
|
|
|
43
35
|
},
|
|
44
36
|
false: {
|
|
45
37
|
viewBox: '0 0 24 24',
|
|
46
|
-
paths: svg `<path d="M8 5a7 7 0 107 7 7 7 0 00-
|
|
38
|
+
paths: svg `<path d="M8 5a7 7 0 107 7 7 7 0 00-8-7zm4.31 9.79l-1.52 1.52L8 13.52l-2.79 2.79-1.52-1.52L6.48 12 3.69 9.21l1.52-1.52L8 10.48l2.79-2.79 1.52 1.52L9.52 12zM18 7a5 5 0 00-3 1.06 7.48 7.48 0 01.49 1 3.89 3.89 0 110 5.82 8.08 8.08 0 01-.49 1A5 5 0 1018 7z"/><path d="M17.52 13.85l2.91-2.92-.78-.78-2.13 2.12-1.17-1.15-.38.37-.41.41.42.42L17 13.34l.52.51z"/>`,
|
|
47
39
|
},
|
|
48
40
|
lessThan: {
|
|
49
41
|
viewBox: '0 0 24 24',
|
|
@@ -69,59 +61,102 @@ const ICONS = {
|
|
|
69
61
|
viewBox: '0 0 24 24',
|
|
70
62
|
paths: svg `<path d="M19.44 14.22zm-2.88 0zm0 0L18 12.79l1.44 1.43.78-.78L18.79 12l1.43-1.44-.78-.78L18 11.21l-1.44-1.43-.78.78L17.21 12l-1.43 1.44.78.78z"/><path d="M18 7a5 5 0 00-3 1.06 7.48 7.48 0 01.49 1 3.89 3.89 0 110 5.82 8.08 8.08 0 01-.49 1A5 5 0 1018 7zM8 5a7 7 0 107 7 7 7 0 00-7-7zm-.93 10.18l-3.38-3.37 1.13-1.12 2.25 2.25 4.11-4.12 1.13 1.12z"/>`,
|
|
71
63
|
},
|
|
64
|
+
};
|
|
65
|
+
const CHROME_ICONS = {
|
|
72
66
|
filter: {
|
|
73
|
-
viewBox: '0 0
|
|
74
|
-
|
|
67
|
+
viewBox: '0 0 24 24',
|
|
68
|
+
stroke: true,
|
|
69
|
+
paths: svg `<path d="M3 6h18M7 12h10M11 18h2"/>`,
|
|
70
|
+
},
|
|
71
|
+
'more-vert': {
|
|
72
|
+
viewBox: '0 0 24 24',
|
|
73
|
+
paths: svg `<circle cx="12" cy="5" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="12" cy="19" r="1.5"/>`,
|
|
75
74
|
},
|
|
76
75
|
close: {
|
|
77
|
-
viewBox: '0 0
|
|
78
|
-
|
|
76
|
+
viewBox: '0 0 24 24',
|
|
77
|
+
stroke: true,
|
|
78
|
+
paths: svg `<path d="M18 6 6 18M6 6l12 12"/>`,
|
|
79
79
|
},
|
|
80
80
|
refresh: {
|
|
81
|
-
viewBox: '0 0
|
|
82
|
-
|
|
81
|
+
viewBox: '0 0 24 24',
|
|
82
|
+
stroke: true,
|
|
83
|
+
paths: svg `<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/>`,
|
|
83
84
|
},
|
|
84
|
-
|
|
85
|
+
search: {
|
|
85
86
|
viewBox: '0 0 24 24',
|
|
86
|
-
|
|
87
|
+
stroke: true,
|
|
88
|
+
paths: svg `<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>`,
|
|
87
89
|
},
|
|
88
|
-
'
|
|
90
|
+
'chevron-down': {
|
|
89
91
|
viewBox: '0 0 24 24',
|
|
90
|
-
|
|
92
|
+
stroke: true,
|
|
93
|
+
paths: svg `<path d="m6 9 6 6 6-6"/>`,
|
|
91
94
|
},
|
|
92
|
-
'
|
|
95
|
+
'arrow-upward': {
|
|
93
96
|
viewBox: '0 0 24 24',
|
|
94
|
-
|
|
97
|
+
stroke: true,
|
|
98
|
+
paths: svg `<path d="M12 19V5"/><path d="m5 12 7-7 7 7"/>`,
|
|
95
99
|
},
|
|
96
|
-
'
|
|
100
|
+
'arrow-downward': {
|
|
97
101
|
viewBox: '0 0 24 24',
|
|
98
|
-
|
|
102
|
+
stroke: true,
|
|
103
|
+
paths: svg `<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>`,
|
|
99
104
|
},
|
|
100
|
-
|
|
105
|
+
download: {
|
|
101
106
|
viewBox: '0 0 24 24',
|
|
102
|
-
|
|
107
|
+
stroke: true,
|
|
108
|
+
paths: svg `<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>`,
|
|
103
109
|
},
|
|
104
110
|
star: {
|
|
105
111
|
viewBox: '0 0 24 24',
|
|
106
|
-
|
|
112
|
+
stroke: true,
|
|
113
|
+
paths: svg `<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>`,
|
|
107
114
|
},
|
|
108
|
-
'
|
|
115
|
+
'sort-asc': {
|
|
109
116
|
viewBox: '0 0 24 24',
|
|
110
|
-
|
|
117
|
+
stroke: true,
|
|
118
|
+
paths: svg `<path d="m3 8 4-4 4 4"/><path d="M7 4v16"/><path d="M11 12h4"/><path d="M11 16h7"/><path d="M11 20h10"/>`,
|
|
111
119
|
},
|
|
112
|
-
|
|
120
|
+
'sort-desc': {
|
|
121
|
+
viewBox: '0 0 24 24',
|
|
122
|
+
stroke: true,
|
|
123
|
+
paths: svg `<path d="m3 16 4 4 4-4"/><path d="M7 20V4"/><path d="M11 4h10"/><path d="M11 8h7"/><path d="M11 12h4"/>`,
|
|
124
|
+
},
|
|
125
|
+
'page-first': {
|
|
126
|
+
viewBox: '0 0 24 24',
|
|
127
|
+
stroke: true,
|
|
128
|
+
paths: svg `<path d="m17 18-6-6 6-6"/><path d="M7 6v12"/>`,
|
|
129
|
+
},
|
|
130
|
+
'page-previous': {
|
|
131
|
+
viewBox: '0 0 24 24',
|
|
132
|
+
stroke: true,
|
|
133
|
+
paths: svg `<path d="m15 18-6-6 6-6"/>`,
|
|
134
|
+
},
|
|
135
|
+
'page-next': {
|
|
136
|
+
viewBox: '0 0 24 24',
|
|
137
|
+
stroke: true,
|
|
138
|
+
paths: svg `<path d="m9 18 6-6-6-6"/>`,
|
|
139
|
+
},
|
|
140
|
+
'page-last': {
|
|
113
141
|
viewBox: '0 0 24 24',
|
|
114
|
-
|
|
142
|
+
stroke: true,
|
|
143
|
+
paths: svg `<path d="m7 18 6-6-6-6"/><path d="M17 6v12"/>`,
|
|
115
144
|
},
|
|
116
145
|
};
|
|
146
|
+
const ICONS = { ...OPERAND_ICONS, ...CHROME_ICONS };
|
|
117
147
|
export function renderIcon(name, opts = {}) {
|
|
118
148
|
const icon = ICONS[name];
|
|
119
149
|
if (!icon)
|
|
120
150
|
return html ``;
|
|
151
|
+
const isStroke = Boolean(icon.stroke);
|
|
121
152
|
return html `<svg
|
|
122
153
|
xmlns="http://www.w3.org/2000/svg"
|
|
123
154
|
viewBox=${icon.viewBox}
|
|
124
|
-
fill
|
|
155
|
+
fill=${isStroke ? 'none' : 'currentColor'}
|
|
156
|
+
stroke=${ifDefined(isStroke ? 'currentColor' : undefined)}
|
|
157
|
+
stroke-width=${ifDefined(isStroke ? '2' : undefined)}
|
|
158
|
+
stroke-linecap=${ifDefined(isStroke ? 'round' : undefined)}
|
|
159
|
+
stroke-linejoin=${ifDefined(isStroke ? 'round' : undefined)}
|
|
125
160
|
aria-hidden="true"
|
|
126
161
|
focusable="false"
|
|
127
162
|
data-icon=${name}
|
|
@@ -134,12 +169,17 @@ export function renderIcon(name, opts = {}) {
|
|
|
134
169
|
export function renderSortArrows() {
|
|
135
170
|
return html `<svg
|
|
136
171
|
xmlns="http://www.w3.org/2000/svg"
|
|
137
|
-
viewBox="
|
|
138
|
-
width="
|
|
172
|
+
viewBox="5 3 14 18"
|
|
173
|
+
width="7"
|
|
139
174
|
height="9"
|
|
175
|
+
fill="none"
|
|
176
|
+
stroke="currentColor"
|
|
177
|
+
stroke-width="2.5"
|
|
178
|
+
stroke-linecap="round"
|
|
179
|
+
stroke-linejoin="round"
|
|
140
180
|
aria-hidden="true"
|
|
141
181
|
focusable="false"
|
|
142
182
|
part="sort-arrows"
|
|
143
|
-
>${svg `<path part="sort-up" d="
|
|
183
|
+
>${svg `<path part="sort-up" d="M7 9l5-5 5 5"/><path part="sort-down" d="M7 15l5 5 5-5"/>`}</svg>`;
|
|
144
184
|
}
|
|
145
185
|
//# sourceMappingURL=icons.js.map
|
package/internal/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/internal/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,GAAG,EAAuB,MAAM,KAAK,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOzD,MAAM,KAAK,GAA4B;IACrC,cAAc,EAAE;QACd,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,GAAG,CAAA,2EAA2E;KACtF;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,GAAG,CAAA,yFAAyF;KACpG;IACD,GAAG,EAAE;QACH,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,GAAG,CAAA,+FAA+F;KAC1G;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,GAAG,CAAA,+lBAA+lB;KAC1mB;IACD,cAAc,EAAE;QACd,OAAO,EAAE,WAAW;QACpB,KAAK,EAAE,GAAG,CAAA,8nBAA8nB;KACzoB;IACD,WAAW,EAAE;QACX,OAAO,EAAE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,CAAA,0GAA0G,QAAQ,CAAC;AAC3H,CAAC","sourcesContent":["import { html, type SVGTemplateResult, svg, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\ninterface IconDef {\n viewBox: string;\n paths: SVGTemplateResult;\n}\n\nconst ICONS: Record<string, IconDef> = {\n 'arrow-upward': {\n viewBox: '0 0 45 45',\n paths: svg`<path d=\"M22.5 40V13.7L10.1 26.1 8 24 24 8l16 16-2.1 2.1-12.4-12.4V40Z\"/>`,\n },\n 'arrow-downward': {\n viewBox: '0 0 45 45',\n paths: svg`<path fill=\"currentColor\" d=\"M24 40 8 24l2.1-2.1 12.4 12.4V8h3v26.3l12.4-12.4L40 24Z\"/>`,\n },\n all: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M2 14h8v2H2zm0-8h12v2H2zm14 11l-3-3-1.5 1.5L16 20l7-7-1.5-1.5L16 17zM2 10h12v2H2z\"/>`,\n },\n contains: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M3 3v18h18V3zm16 16H5V5h14z\"/><path d=\"M12 11.3a4.39 4.39 0 00-2.54.63 2.07 2.07 0 00-.9 1.78 2.29 2.29 0 00.66 1.74 2.63 2.63 0 001.89.63 2.39 2.39 0 001.32-.37 3.05 3.05 0 001-.93 3.72 3.72 0 00.08.57c0 .19.1.38.16.58h1.79a4.51 4.51 0 01-.21-.88 5.57 5.57 0 01-.07-.93v-3.5a2.44 2.44 0 00-.84-2 3.34 3.34 0 00-2.22-.7 3.54 3.54 0 00-2.3.72A1.93 1.93 0 009 10.29h1.71a.93.93 0 01.29-.71 1.5 1.5 0 011-.29 1.45 1.45 0 011 .35 1.3 1.3 0 01.37 1v.69zm1.4 1.08v1.17a1.61 1.61 0 01-.71.77 2.27 2.27 0 01-1.21.34 1.18 1.18 0 01-.84-.27.92.92 0 01-.3-.72 1.16 1.16 0 01.44-.9 1.76 1.76 0 011.22-.39z\"/>`,\n },\n doesNotContain: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M21 19.74V3H4.26L2.89 1.63 1.63 2.92 3 4.29V21h16.73l1.37 1.37 1.27-1.26zM5 19V6.28l5.28 5.27a3.19 3.19 0 00-.81.38 2.07 2.07 0 00-.9 1.78 2.29 2.29 0 00.66 1.74 2.63 2.63 0 001.89.63 2.39 2.39 0 001.32-.37 3.05 3.05 0 001-.93 3.72 3.72 0 00.08.57c0 .19.1.38.16.58h1L17.73 19zm5.79-6.23a1.31 1.31 0 01.45-.25l1.37 1.36.28.29a1.57 1.57 0 01-.19.15 2.27 2.27 0 01-1.21.34 1.18 1.18 0 01-.84-.27.92.92 0 01-.3-.72 1.16 1.16 0 01.44-.9zm2.6-1.47h-.83l-1.62-1.62.08-.1a1.5 1.5 0 011-.29 1.45 1.45 0 011 .35 1.3 1.3 0 01.37 1zM19 17.74l-3.85-3.85v-3.27a2.44 2.44 0 00-.84-2 3.34 3.34 0 00-2.22-.7 3.64 3.64 0 00-2.24.67L6.26 5H19z\"/>`,\n },\n greaterThan: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M6 7.11L15.09 12 6 16.89V19l12-6.46v-1.08L6 5v2.11z\"/>`,\n },\n greaterThanOrEqual: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5.99 19h12.02v2H5.99zM18 9.47L6 3v2.11L15.09 10 6 14.9v2.11l12-6.47V9.47z\"/>`,\n },\n empty: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 17h2v2H5zm8 0h2v2h-2zm-8-4h2v2H5zm12 4h2v2h-2zM13 5h2v2h-2zM9 17h2v2H9zm8-8h2v2h-2zm0 4h2v2h-2zm0-8h2v2h-2zM5 9h2v2H5zm0-4h2v2H5zm4 0h2v2H9z\"/>`,\n },\n endsWith: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M3 14.5h2v2H3zm8 0h2v2h-2zm-4 0h2v2H7zm13.8.3v-3A2.1 2.1 0 0020 10a3 3 0 00-2-.6 3 3 0 00-2 .6 1.7 1.7 0 00-.7 1.5h1.5a.8.8 0 01.3-.7 1.3 1.3 0 01.9-.3 1.3 1.3 0 01.9.4 1.1 1.1 0 01.3.8v.6H18a3.8 3.8 0 00-2.2.6 1.8 1.8 0 00-.8 1.5 2 2 0 00.6 1.6 2.3 2.3 0 001.6.6 2.1 2.1 0 001.2-.4 2.8 2.8 0 00.8-.8 4.3 4.3 0 00.1.5l.1.5H21a4.1 4.1 0 01-.2-.7 5.4 5.4 0 010-1zm-1.6-.5a1.5 1.5 0 01-.6.7 2 2 0 01-1 .2 1.1 1.1 0 01-.8-.2.8.8 0 01-.2-.6 1 1 0 01.3-.8 1.5 1.5 0 011.1-.3h1.2z\"/>`,\n },\n equals: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 13.5h14v2H5zm0-5h14v2H5z\"/>`,\n },\n false: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M8 5a7 7 0 107 7 7 7 0 00-7-7zm4.31 9.79l-1.52 1.52L8 13.52l-2.79 2.79-1.52-1.52L6.48 12 3.69 9.21l1.52-1.52L8 10.48l2.79-2.79 1.52 1.52L9.52 12zM18 7a5 5 0 00-3 1.06 7.48 7.48 0 01.49 1 3.89 3.89 0 110 5.82 8.08 8.08 0 01-.49 1A5 5 0 1018 7z\"/><path d=\"M17.52 13.85l2.91-2.92-.78-.78-2.13 2.12-1.17-1.15-.38.37-.41.41.42.42L17 13.34l.52.51z\"/>`,\n },\n lessThan: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M6 12.54L18 19v-2.11L8.91 12 18 7.11V5L6 11.46v1.08z\"/>`,\n },\n lessThanOrEqual: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5.99 19h12.02v2H5.99zM18 14.9L8.91 10 18 5.11V3L6 9.47v1.07l12 6.47V14.9z\"/>`,\n },\n notEmpty: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 9h2v2H5zm4 8h2v2H9zm4 0h2v2h-2zm4-8h2v2h-2zm0-4h2v2h-2zM5 17h2v2H5zm8-12h2v2h-2zm-8 8h2v2H5zm14 2v-2h-2v.47L18.53 15H19zm-8-8V5H9v.46L10.54 7H11zM2.76 1.76L1.5 3.06 20.97 22.5l1.26-1.26-8.89-8.89L2.76 1.76z\"/>`,\n },\n doesNotEqual: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M17.37 4.71l-1.74-1-2.76 4.79H5v2h6.71l-1.73 3H5v2h3.82l-2.19 3.79 1.74 1 2.76-4.79H19v-2h-6.71l1.73-3H19v-2h-3.82l2.19-3.79z\"/>`,\n },\n startsWith: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5.9 7.5l-3.9 9h1.7l.7-1.8h4.1l.7 1.8H11l-3.9-9H5.9zM5 13.2l1.5-4.1L8 13.2H5zm7 1.3h2v2h-2v-2zm8 0h2v2h-2v-2zm-4 0h2v2h-2v-2z\"/>`,\n },\n true: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M19.44 14.22zm-2.88 0zm0 0L18 12.79l1.44 1.43.78-.78L18.79 12l1.43-1.44-.78-.78L18 11.21l-1.44-1.43-.78.78L17.21 12l-1.43 1.44.78.78z\"/><path d=\"M18 7a5 5 0 00-3 1.06 7.48 7.48 0 01.49 1 3.89 3.89 0 110 5.82 8.08 8.08 0 01-.49 1A5 5 0 1018 7zM8 5a7 7 0 107 7 7 7 0 00-7-7zm-.93 10.18l-3.38-3.37 1.13-1.12 2.25 2.25 4.11-4.12 1.13 1.12z\"/>`,\n },\n filter: {\n viewBox: '0 0 45 45',\n paths: svg`<path d=\"M20 36v-3h8v3Zm-8-10.5v-3h24v3ZM6 15v-3h36v3Z\"/>`,\n },\n close: {\n viewBox: '0 0 48 48',\n paths: svg`<path d=\"m12.45 37.65-2.1-2.1L21.9 24 10.35 12.45l2.1-2.1L24 21.9l11.55-11.55 2.1 2.1L26.1 24l11.55 11.55-2.1 2.1L24 26.1Z\"/>`,\n },\n refresh: {\n viewBox: '0 0 48 48',\n paths: svg`<path d=\"M24 40q-6.65 0-11.325-4.675Q8 30.65 8 24q0-6.65 4.675-11.325Q17.35 8 24 8q4.25 0 7.45 1.725T37 14.45V8h3v12.7H27.3v-3h8.4q-1.9-3-4.85-4.85Q27.9 11 24 11q-5.45 0-9.225 3.775Q11 18.55 11 24q0 5.45 3.775 9.225Q18.55 37 24 37q4.15 0 7.6-2.375 3.45-2.375 4.8-6.275h3.1q-1.45 5.25-5.75 8.45Q29.45 40 24 40Z\"/>`,\n },\n 'page-first': {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M6 6h2v12H6zm3.5 6l8.5 6V6z\"/>`,\n },\n 'page-previous': {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/>`,\n },\n 'page-next': {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M8.59 16.59 10 18l6-6-6-6-1.41 1.41L13.17 12z\"/>`,\n },\n 'page-last': {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M6 18l8.5-6L6 6v12zM16 6h2v12h-2z\"/>`,\n },\n search: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M15.5 14h-.79l-.28-.27a6.471 6.471 0 0 0 1.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 0 0-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.471 6.471 0 0 0 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\"/>`,\n },\n star: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z\"/>`,\n },\n 'chevron-down': {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M7.41 8.58 12 13.17l4.59-4.59L18 10l-6 6-6-6z\"/>`,\n },\n download: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z\"/>`,\n },\n};\n\nexport type GridIconName = keyof typeof ICONS;\n\nexport interface IconRenderOptions {\n /** Lit `slot` attribute. Useful when icons sit inside slotted positions of other components. */\n slot?: string;\n /** Lit `part` attribute. */\n part?: string;\n /** Inline `class` attribute. */\n class?: string;\n /** When provided, sets `data-sort-index` (used by the header sort indicator). */\n sortIndex?: number | string;\n}\n\n/**\n * Renders one of the grid's built-in icons as an inline `<svg>`. All icons are\n * decorative (`aria-hidden=\"true\"`) by default — surrounding controls supply\n * the accessible label via `aria-label`.\n */\nexport function renderIcon(name: string, opts: IconRenderOptions = {}): TemplateResult {\n const icon = ICONS[name];\n if (!icon) return html``;\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=${icon.viewBox}\n fill=\"currentColor\"\n aria-hidden=\"true\"\n focusable=\"false\"\n data-icon=${name}\n slot=${ifDefined(opts.slot)}\n part=${ifDefined(opts.part)}\n class=${ifDefined(opts.class)}\n data-sort-index=${ifDefined(opts.sortIndex)}\n >${icon.paths}</svg>`;\n}\n\n/**\n * Renders the stacked up/down sort affordance used by sortable column headers.\n * Both chevrons are dimmed by default; the header CSS lifts the inactive one on\n * hover and paints the active direction in the brand color, driven by the\n * button's `data-sort-active` (`'ascending' | 'descending' | 'none'`) attribute.\n */\nexport function renderSortArrows(): TemplateResult {\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 6 9\"\n width=\"6\"\n height=\"9\"\n aria-hidden=\"true\"\n focusable=\"false\"\n part=\"sort-arrows\"\n >${svg`<path part=\"sort-up\" d=\"M3 0.5 5.5 3.5 0.5 3.5Z\" /><path part=\"sort-down\" d=\"M3 8.5 0.5 5.5 5.5 5.5Z\" />`}</svg>`;\n}\n"]}
|
|
1
|
+
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AChC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;mBAC1C,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;qBACnC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;sBACxC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;;;gBAG/C,IAAI;WACT,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;WACpB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;YACnB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;sBACX,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;KAC1C,IAAI,CAAC,KAAK,QAAQ,CAAC;AACxB,CAAC;AAQD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,CAAA;;;;;;;;;;;;;KAaR,GAAG,CAAA,mFAAmF,QAAQ,CAAC;AACpG,CAAC","sourcesContent":["import { html, type SVGTemplateResult, svg, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\ninterface IconDef {\n viewBox: string;\n paths: SVGTemplateResult;\n /** When true, renders stroke=\"currentColor\" fill=\"none\" (Lucide style). */\n stroke?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Filter-operand icons — fill-based, no Lucide equivalents.\n// ---------------------------------------------------------------------------\nconst OPERAND_ICONS: Record<string, IconDef> = {\n all: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M2 14h8v2H2zm0-8h12v2H2zm14 11l-3-3-1.5 1.5L16 20l7-7-1.5-1.5L16 17zM2 10h12v2H2z\"/>`,\n },\n contains: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M3 3v18h18V3zm16 16H5V5h14z\"/><path d=\"M12 11.3a4.39 4.39 0 00-2.54.63 2.07 2.07 0 00-.9 1.78 2.29 2.29 0 00.66 1.74 2.63 2.63 0 001.89.63 2.39 2.39 0 001.32-.37 3.05 3.05 0 001-.93 3.72 3.72 0 00.08.57c0 .19.1.38.16.58h1.79a4.51 4.51 0 01-.21-.88 5.57 5.57 0 01-.07-.93v-3.5a2.44 2.44 0 00-.84-2 3.34 3.34 0 00-2.22-.7 3.54 3.54 0 00-2.3.72A1.93 1.93 0 009 10.29h1.71a.93.93 0 01.29-.71 1.5 1.5 0 011-.29 1.45 1.45 0 011 .35 1.3 1.3 0 01.37 1v.69zm1.4 1.08v1.17a1.61 1.61 0 01-.71.77 2.27 2.27 0 01-1.21.34 1.18 1.18 0 01-.84-.27.92.92 0 01-.3-.72 1.16 1.16 0 01.44-.9 1.76 1.76 0 011.22-.39z\"/>`,\n },\n doesNotContain: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M21 19.74V3H4.26L2.89 1.63 1.63 2.92 3 4.29V21h16.73l1.37 1.37 1.27-1.26zM5 19V6.28l5.28 5.27a3.19 3.19 0 00-.81.38 2.07 2.07 0 00-.9 1.78 2.29 2.29 0 00.66 1.74 2.63 2.63 0 001.89.63 2.39 2.39 0 001.32-.37 3.05 3.05 0 001-.93 3.72 3.72 0 00.08.57c0 .19.1.38.16.58h1L17.73 19zm5.79-6.23a1.31 1.31 0 01.45-.25l1.37 1.36.28.29a1.57 1.57 0 01-.19.15 2.27 2.27 0 01-1.21.34 1.18 1.18 0 01-.84-.27.92.92 0 01-.3-.72 1.16 1.16 0 01.44-.9zm2.6-1.47h-.83l-1.62-1.62.08-.1a1.5 1.5 0 011-.29 1.45 1.45 0 011 .35 1.3 1.3 0 01.37 1zM19 17.74l-3.85-3.85v-3.27a2.44 2.44 0 00-.84-2 3.34 3.34 0 00-2.22-.7 3.64 3.64 0 00-2.24.67L6.26 5H19z\"/>`,\n },\n greaterThan: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M6 7.11L15.09 12 6 16.89V19l12-6.46v-1.08L6 5v2.11z\"/>`,\n },\n greaterThanOrEqual: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5.99 19h12.02v2H5.99zM18 9.47L6 3v2.11L15.09 10 6 14.9v2.11l12-6.47V9.47z\"/>`,\n },\n empty: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 17h2v2H5zm8 0h2v2h-2zm-8-4h2v2H5zm12 4h2v2h-2zM13 5h2v2h-2zM9 17h2v2H9zm8-8h2v2h-2zm0 4h2v2h-2zm0-8h2v2h-2zM5 9h2v2H5zm0-4h2v2H5zm4 0h2v2H9z\"/>`,\n },\n endsWith: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M3 14.5h2v2H3zm8 0h2v2h-2zm-4 0h2v2H7zm13.8.3v-3A2.1 2.1 0 0020 10a3 3 0 00-2-.6 3 3 0 00-2 .6 1.7 1.7 0 00-.7 1.5h1.5a.8.8 0 01.3-.7 1.3 1.3 0 01.9-.3 1.3 1.3 0 01.9.4 1.1 1.1 0 01.3.8v.6H18a3.8 3.8 0 00-2.2.6 1.8 1.8 0 00-.8 1.5 2 2 0 00.6 1.6 2.3 2.3 0 001.6.6 2.1 2.1 0 001.2-.4 2.8 2.8 0 00.8-.8 4.3 4.3 0 00.1.5l.1.5H21a4.1 4.1 0 01-.2-.7 5.4 5.4 0 010-1zm-1.6-.5a1.5 1.5 0 01-.6.7 2 2 0 01-1 .2 1.1 1.1 0 01-.8-.2.8.8 0 01-.2-.6 1 1 0 01.3-.8 1.5 1.5 0 011.1-.3h1.2z\"/>`,\n },\n equals: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 13.5h14v2H5zm0-5h14v2H5z\"/>`,\n },\n false: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M8 5a7 7 0 107 7 7 7 0 00-8-7zm4.31 9.79l-1.52 1.52L8 13.52l-2.79 2.79-1.52-1.52L6.48 12 3.69 9.21l1.52-1.52L8 10.48l2.79-2.79 1.52 1.52L9.52 12zM18 7a5 5 0 00-3 1.06 7.48 7.48 0 01.49 1 3.89 3.89 0 110 5.82 8.08 8.08 0 01-.49 1A5 5 0 1018 7z\"/><path d=\"M17.52 13.85l2.91-2.92-.78-.78-2.13 2.12-1.17-1.15-.38.37-.41.41.42.42L17 13.34l.52.51z\"/>`,\n },\n lessThan: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M6 12.54L18 19v-2.11L8.91 12 18 7.11V5L6 11.46v1.08z\"/>`,\n },\n lessThanOrEqual: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5.99 19h12.02v2H5.99zM18 14.9L8.91 10 18 5.11V3L6 9.47v1.07l12 6.47V14.9z\"/>`,\n },\n notEmpty: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5 9h2v2H5zm4 8h2v2H9zm4 0h2v2h-2zm4-8h2v2h-2zm0-4h2v2h-2zM5 17h2v2H5zm8-12h2v2h-2zm-8 8h2v2H5zm14 2v-2h-2v.47L18.53 15H19zm-8-8V5H9v.46L10.54 7H11zM2.76 1.76L1.5 3.06 20.97 22.5l1.26-1.26-8.89-8.89L2.76 1.76z\"/>`,\n },\n doesNotEqual: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M17.37 4.71l-1.74-1-2.76 4.79H5v2h6.71l-1.73 3H5v2h3.82l-2.19 3.79 1.74 1 2.76-4.79H19v-2h-6.71l1.73-3H19v-2h-3.82l2.19-3.79z\"/>`,\n },\n startsWith: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M5.9 7.5l-3.9 9h1.7l.7-1.8h4.1l.7 1.8H11l-3.9-9H5.9zM5 13.2l1.5-4.1L8 13.2H5zm7 1.3h2v2h-2v-2zm8 0h2v2h-2v-2zm-4 0h2v2h-2v-2z\"/>`,\n },\n true: {\n viewBox: '0 0 24 24',\n paths: svg`<path d=\"M19.44 14.22zm-2.88 0zm0 0L18 12.79l1.44 1.43.78-.78L18.79 12l1.43-1.44-.78-.78L18 11.21l-1.44-1.43-.78.78L17.21 12l-1.43 1.44.78.78z\"/><path d=\"M18 7a5 5 0 00-3 1.06 7.48 7.48 0 01.49 1 3.89 3.89 0 110 5.82 8.08 8.08 0 01-.49 1A5 5 0 1018 7zM8 5a7 7 0 107 7 7 7 0 00-7-7zm-.93 10.18l-3.38-3.37 1.13-1.12 2.25 2.25 4.11-4.12 1.13 1.12z\"/>`,\n },\n};\n\n// ---------------------------------------------------------------------------\n// Lucide UI-chrome icons — stroke-based, consistent family.\n// ---------------------------------------------------------------------------\nconst CHROME_ICONS: Record<string, IconDef> = {\n // ListFilter: three lines of decreasing width (funnel metaphor)\n filter: {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"M3 6h18M7 12h10M11 18h2\"/>`,\n },\n // Three-dots vertical menu (filled circles — intentionally fill, not stroke)\n 'more-vert': {\n viewBox: '0 0 24 24',\n paths: svg`<circle cx=\"12\" cy=\"5\" r=\"1.5\"/><circle cx=\"12\" cy=\"12\" r=\"1.5\"/><circle cx=\"12\" cy=\"19\" r=\"1.5\"/>`,\n },\n // X close\n close: {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"M18 6 6 18M6 6l12 12\"/>`,\n },\n // RotateCcw reset\n refresh: {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/>`,\n },\n // Search\n search: {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/>`,\n },\n // ChevronDown\n 'chevron-down': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m6 9 6 6 6-6\"/>`,\n },\n // ArrowUp (used by expansion and group row icons)\n 'arrow-upward': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"M12 19V5\"/><path d=\"m5 12 7-7 7 7\"/>`,\n },\n // ArrowDown\n 'arrow-downward': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"M12 5v14\"/><path d=\"m19 12-7 7-7-7\"/>`,\n },\n // Download\n download: {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/>`,\n },\n // Star\n star: {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/>`,\n },\n // Column menu: sort ascending (ArrowUpWideNarrow)\n 'sort-asc': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m3 8 4-4 4 4\"/><path d=\"M7 4v16\"/><path d=\"M11 12h4\"/><path d=\"M11 16h7\"/><path d=\"M11 20h10\"/>`,\n },\n // Column menu: sort descending (ArrowDownWideNarrow)\n 'sort-desc': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m3 16 4 4 4-4\"/><path d=\"M7 20V4\"/><path d=\"M11 4h10\"/><path d=\"M11 8h7\"/><path d=\"M11 12h4\"/>`,\n },\n // Paginator\n 'page-first': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m17 18-6-6 6-6\"/><path d=\"M7 6v12\"/>`,\n },\n 'page-previous': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m15 18-6-6 6-6\"/>`,\n },\n 'page-next': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m9 18 6-6-6-6\"/>`,\n },\n 'page-last': {\n viewBox: '0 0 24 24',\n stroke: true,\n paths: svg`<path d=\"m7 18 6-6-6-6\"/><path d=\"M17 6v12\"/>`,\n },\n};\n\nconst ICONS: Record<string, IconDef> = { ...OPERAND_ICONS, ...CHROME_ICONS };\n\nexport type GridIconName = keyof typeof ICONS;\n\nexport interface IconRenderOptions {\n /** Lit `slot` attribute. Useful when icons sit inside slotted positions of other components. */\n slot?: string;\n /** Lit `part` attribute. */\n part?: string;\n /** Inline `class` attribute. */\n class?: string;\n /** When provided, sets `data-sort-index` (used by the header sort indicator). */\n sortIndex?: number | string;\n}\n\n/**\n * Renders one of the grid's built-in icons as an inline `<svg>`. Lucide-based\n * icons (`stroke: true`) render as `stroke=\"currentColor\" fill=\"none\"`;\n * legacy fill icons render as `fill=\"currentColor\"`.\n */\nexport function renderIcon(name: string, opts: IconRenderOptions = {}): TemplateResult {\n const icon = ICONS[name];\n if (!icon) return html``;\n const isStroke = Boolean(icon.stroke);\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=${icon.viewBox}\n fill=${isStroke ? 'none' : 'currentColor'}\n stroke=${ifDefined(isStroke ? 'currentColor' : undefined)}\n stroke-width=${ifDefined(isStroke ? '2' : undefined)}\n stroke-linecap=${ifDefined(isStroke ? 'round' : undefined)}\n stroke-linejoin=${ifDefined(isStroke ? 'round' : undefined)}\n aria-hidden=\"true\"\n focusable=\"false\"\n data-icon=${name}\n slot=${ifDefined(opts.slot)}\n part=${ifDefined(opts.part)}\n class=${ifDefined(opts.class)}\n data-sort-index=${ifDefined(opts.sortIndex)}\n >${icon.paths}</svg>`;\n}\n\n/**\n * Renders the stacked up/down sort affordance (Lucide ChevronsUpDown split\n * into two independently-styleable parts). The header CSS dims both chevrons\n * at rest, lifts the inactive one on hover, and paints the active direction\n * in the brand color via `data-sort-active` on the parent button.\n */\nexport function renderSortArrows(): TemplateResult {\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"5 3 14 18\"\n width=\"7\"\n height=\"9\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n part=\"sort-arrows\"\n >${svg`<path part=\"sort-up\" d=\"M7 9l5-5 5 5\"/><path part=\"sort-down\" d=\"M7 15l5 5 5-5\"/>`}</svg>`;\n}\n"]}
|
package/internal/index.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ export { gridStateContext, StateController } from '../controllers/state.js';
|
|
|
15
15
|
export { PIPELINE } from './constants.js';
|
|
16
16
|
export type { ExportCellValue, ExportFormat, ExportOptions } from './export.js';
|
|
17
17
|
export { downloadBlob, getColumnLabel, resolveExportColumns, resolveExportRows, resolveExportValue, } from './export.js';
|
|
18
|
-
export type { CellDecoration, CellDecorator, CellDecoratorContext, CellInteraction, CellInteractionHandler, CellInteractionKind, GridFeatureModule, PresentedRow, RowPresenter, RowPresenterContext, RowTransformer, } from './feature-module.js';
|
|
19
|
-
export { isCellDecorator, isCellInteractionHandler, isRowPresenter, isRowTransformer, } from './feature-module.js';
|
|
18
|
+
export type { CellDecoration, CellDecorator, CellDecoratorContext, CellInteraction, CellInteractionHandler, CellInteractionKind, ColumnMenuProvider, GridFeatureModule, PresentedRow, RowPresenter, RowPresenterContext, RowTransformer, SerializableModule, } from './feature-module.js';
|
|
19
|
+
export { isCellDecorator, isCellInteractionHandler, isColumnMenuProvider, isRowPresenter, isRowTransformer, isSerializableModule, } from './feature-module.js';
|
|
20
20
|
export { registerComponent } from './register.js';
|
|
21
|
-
export type {
|
|
21
|
+
export type { ColumnLayoutState, FilterStateSnapshot, GetStateOptions, GridState, RowRef, SetStateOptions, SortStateSnapshot, } from './state-snapshot.js';
|
|
22
|
+
export { applyColumnLayout, deserializeFilter, resolveRowRefs, serializeColumnLayout, serializeFilter, serializeRowRefs, serializeSort, } from './state-snapshot.js';
|
|
23
|
+
export type { ActiveNode, ColumnConfiguration, GridHost, Keys, ToolbarAction } from './types.js';
|
|
22
24
|
export { getDisplayColumns } from './utils.js';
|
package/internal/index.js
CHANGED
|
@@ -2,7 +2,8 @@ export { ApexGrid } from '../components/grid.js';
|
|
|
2
2
|
export { gridStateContext, StateController } from '../controllers/state.js';
|
|
3
3
|
export { PIPELINE } from './constants.js';
|
|
4
4
|
export { downloadBlob, getColumnLabel, resolveExportColumns, resolveExportRows, resolveExportValue, } from './export.js';
|
|
5
|
-
export { isCellDecorator, isCellInteractionHandler, isRowPresenter, isRowTransformer, } from './feature-module.js';
|
|
5
|
+
export { isCellDecorator, isCellInteractionHandler, isColumnMenuProvider, isRowPresenter, isRowTransformer, isSerializableModule, } from './feature-module.js';
|
|
6
6
|
export { registerComponent } from './register.js';
|
|
7
|
+
export { applyColumnLayout, deserializeFilter, resolveRowRefs, serializeColumnLayout, serializeFilter, serializeRowRefs, serializeSort, } from './state-snapshot.js';
|
|
7
8
|
export { getDisplayColumns } from './utils.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/internal/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAgBrB,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["/**\n * Unstable, first-party extension surface for `apex-grid`.\n *\n * This entry point (`apex-grid/internal`) exposes the internals that the\n * first-party `@apexcharts/grid-enterprise` package builds on: the grid class,\n * its state controller, the component registration helper, and the feature\n * module contract. It is intentionally separate from the public `.` barrel.\n *\n * @remarks\n * No semver guarantees are made for these exports. They may change between\n * minor releases. Do not depend on them from third-party code.\n */\nexport { ApexGrid } from '../components/grid.js';\nexport { gridStateContext, StateController } from '../controllers/state.js';\nexport { PIPELINE } from './constants.js';\nexport type { ExportCellValue, ExportFormat, ExportOptions } from './export.js';\nexport {\n downloadBlob,\n getColumnLabel,\n resolveExportColumns,\n resolveExportRows,\n resolveExportValue,\n} from './export.js';\nexport type {\n CellDecoration,\n CellDecorator,\n CellDecoratorContext,\n CellInteraction,\n CellInteractionHandler,\n CellInteractionKind,\n ColumnMenuProvider,\n GridFeatureModule,\n PresentedRow,\n RowPresenter,\n RowPresenterContext,\n RowTransformer,\n SerializableModule,\n} from './feature-module.js';\nexport {\n isCellDecorator,\n isCellInteractionHandler,\n isColumnMenuProvider,\n isRowPresenter,\n isRowTransformer,\n isSerializableModule,\n} from './feature-module.js';\nexport { registerComponent } from './register.js';\nexport type {\n ColumnLayoutState,\n FilterStateSnapshot,\n GetStateOptions,\n GridState,\n RowRef,\n SetStateOptions,\n SortStateSnapshot,\n} from './state-snapshot.js';\nexport {\n applyColumnLayout,\n deserializeFilter,\n resolveRowRefs,\n serializeColumnLayout,\n serializeFilter,\n serializeRowRefs,\n serializeSort,\n} from './state-snapshot.js';\nexport type { ActiveNode, ColumnConfiguration, GridHost, Keys, ToolbarAction } from './types.js';\nexport { getDisplayColumns } from './utils.js';\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { SortingDirection } from '../operations/sort/types.js';
|
|
2
|
+
import type { GridState } from './state-snapshot.js';
|
|
3
|
+
import type { ColumnConfiguration, DataType, SelectionMode } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A machine-readable description of what the grid is and what can be done to it:
|
|
6
|
+
* the columns and their data types, the operations available per column, the
|
|
7
|
+
* grid-level capabilities, and the current {@link GridState}. Produced by
|
|
8
|
+
* `ApexGrid.getSchema`.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This is the contract an AI layer feeds to an LLM (as the basis of a
|
|
12
|
+
* structured-output schema) and validates a returned state patch against, but it
|
|
13
|
+
* is AI-agnostic: it is equally useful for building a view-editor UI or for docs.
|
|
14
|
+
* It is a descriptor, not a JSON-Schema document — everything needed to *build* a
|
|
15
|
+
* strict JSON Schema (or validate a `setState` patch) is here. Enterprise grids
|
|
16
|
+
* populate the optional grouping / pivot / aggregation fields.
|
|
17
|
+
*/
|
|
18
|
+
export interface GridSchema {
|
|
19
|
+
/** Schema version, matching {@link GridState.version}. */
|
|
20
|
+
version: 1;
|
|
21
|
+
/** Per-column description, in display order. */
|
|
22
|
+
columns: ColumnSchema[];
|
|
23
|
+
/** Grid-level operation availability. */
|
|
24
|
+
capabilities: GridCapabilities;
|
|
25
|
+
/** The current restorable state, so capabilities and live values travel together. */
|
|
26
|
+
state: GridState;
|
|
27
|
+
}
|
|
28
|
+
/** Description of a single column for {@link GridSchema}. */
|
|
29
|
+
export interface ColumnSchema {
|
|
30
|
+
key: string;
|
|
31
|
+
/** Human label (`headerText`, falling back to `key`). */
|
|
32
|
+
label: string;
|
|
33
|
+
dataType: DataType;
|
|
34
|
+
/** Whether the column opts into sorting (its header sort affordance). */
|
|
35
|
+
sortable: boolean;
|
|
36
|
+
/** Whether the column opts into filtering. */
|
|
37
|
+
filterable: boolean;
|
|
38
|
+
/** Operand names valid for this column when `filterable` (e.g. `'contains'`); else empty. */
|
|
39
|
+
filterOperands: string[];
|
|
40
|
+
editable: boolean;
|
|
41
|
+
hidden: boolean;
|
|
42
|
+
/** Pin band, omitted when the column scrolls with the body. */
|
|
43
|
+
pinned?: 'start' | 'end';
|
|
44
|
+
/** Enterprise: whether the column can be row-grouped. Set by the enterprise grid. */
|
|
45
|
+
groupable?: boolean;
|
|
46
|
+
/** Enterprise: whether the column can be a pivot dimension. Set by the enterprise grid. */
|
|
47
|
+
pivotable?: boolean;
|
|
48
|
+
/** Enterprise: whether the column can be aggregated. Set by the enterprise grid. */
|
|
49
|
+
aggregatable?: boolean;
|
|
50
|
+
/** Enterprise: aggregation functions valid for this column, when `aggregatable`. */
|
|
51
|
+
aggFuncs?: string[];
|
|
52
|
+
/** Enterprise: whether the column accepts spreadsheet formulas. Set by the enterprise grid. */
|
|
53
|
+
allowFormula?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** Grid-level operation availability for {@link GridSchema}. */
|
|
56
|
+
export interface GridCapabilities {
|
|
57
|
+
sort: {
|
|
58
|
+
directions: SortingDirection[];
|
|
59
|
+
multi: boolean;
|
|
60
|
+
};
|
|
61
|
+
filter: {
|
|
62
|
+
operandsByType: Partial<Record<DataType, string[]>>;
|
|
63
|
+
};
|
|
64
|
+
pagination: boolean;
|
|
65
|
+
selection: SelectionMode | false;
|
|
66
|
+
rowPinning: boolean;
|
|
67
|
+
rowReordering: boolean;
|
|
68
|
+
/** Enterprise: whether row grouping is available. Set by the enterprise grid. */
|
|
69
|
+
grouping?: boolean;
|
|
70
|
+
/** Enterprise: whether pivoting is available. Set by the enterprise grid. */
|
|
71
|
+
pivot?: boolean;
|
|
72
|
+
/** Enterprise: aggregation availability + the supported functions. Set by the enterprise grid. */
|
|
73
|
+
aggregation?: {
|
|
74
|
+
funcs: string[];
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Describe a single column: data type + the operations it opts into. */
|
|
78
|
+
export declare function columnSchema<T extends object>(column: ColumnConfiguration<T>): ColumnSchema;
|
|
79
|
+
/**
|
|
80
|
+
* The filter-operand vocabulary keyed by the data types present among `columns`
|
|
81
|
+
* (the global reference for `capabilities.filter`), resolved from the same
|
|
82
|
+
* source the apply path trusts ({@link getFilterOperandsFor}), so the schema and
|
|
83
|
+
* `setState` can never disagree about valid operands.
|
|
84
|
+
*/
|
|
85
|
+
export declare function operandsByType<T extends object>(columns: ReadonlyArray<ColumnConfiguration<T>>): Partial<Record<DataType, string[]>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getFilterOperandsFor } from './utils.js';
|
|
2
|
+
export function columnSchema(column) {
|
|
3
|
+
const filterable = Boolean(column.filter);
|
|
4
|
+
const schema = {
|
|
5
|
+
key: String(column.key),
|
|
6
|
+
label: String(column.headerText ?? column.key),
|
|
7
|
+
dataType: (column.type ?? 'string'),
|
|
8
|
+
sortable: Boolean(column.sort),
|
|
9
|
+
filterable,
|
|
10
|
+
filterOperands: filterable ? Object.keys(getFilterOperandsFor(column)) : [],
|
|
11
|
+
editable: Boolean(column.editable),
|
|
12
|
+
hidden: Boolean(column.hidden),
|
|
13
|
+
};
|
|
14
|
+
if (column.pinned === 'start' || column.pinned === 'end')
|
|
15
|
+
schema.pinned = column.pinned;
|
|
16
|
+
return schema;
|
|
17
|
+
}
|
|
18
|
+
export function operandsByType(columns) {
|
|
19
|
+
const out = {};
|
|
20
|
+
for (const column of columns) {
|
|
21
|
+
const type = (column.type ?? 'string');
|
|
22
|
+
if (!out[type])
|
|
23
|
+
out[type] = Object.keys(getFilterOperandsFor(column));
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=state-schema.js.map
|