apex-grid 1.1.0 → 2.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/LICENSE +76 -5
- package/README.md +520 -10
- package/components/cell.d.ts +39 -0
- package/components/cell.js +334 -5
- package/components/cell.js.map +1 -1
- package/components/filter-row.d.ts +7 -5
- package/components/filter-row.js +151 -68
- package/components/filter-row.js.map +1 -1
- package/components/grid.d.ts +948 -1
- package/components/grid.js +403 -13
- package/components/grid.js.map +1 -1
- package/components/header-row.d.ts +21 -1
- package/components/header-row.js +140 -7
- package/components/header-row.js.map +1 -1
- package/components/header.d.ts +7 -0
- package/components/header.js +151 -25
- package/components/header.js.map +1 -1
- package/components/paginator.d.ts +56 -0
- package/components/paginator.js +148 -0
- package/components/paginator.js.map +1 -0
- package/components/row.d.ts +21 -2
- package/components/row.js +185 -10
- package/components/row.js.map +1 -1
- package/components/toolbar.d.ts +60 -0
- package/components/toolbar.js +275 -0
- package/components/toolbar.js.map +1 -0
- package/components/virtualizer.js +1 -1
- package/components/virtualizer.js.map +1 -1
- package/controllers/data-operation.d.ts +14 -0
- package/controllers/data-operation.js +19 -2
- package/controllers/data-operation.js.map +1 -1
- package/controllers/dom.d.ts +37 -1
- package/controllers/dom.js +176 -9
- package/controllers/dom.js.map +1 -1
- package/controllers/editing.d.ts +130 -0
- package/controllers/editing.js +197 -0
- package/controllers/editing.js.map +1 -0
- package/controllers/expansion.d.ts +68 -0
- package/controllers/expansion.js +126 -0
- package/controllers/expansion.js.map +1 -0
- package/controllers/navigation.d.ts +17 -6
- package/controllers/navigation.js +24 -8
- package/controllers/navigation.js.map +1 -1
- package/controllers/pagination.d.ts +102 -0
- package/controllers/pagination.js +106 -0
- package/controllers/pagination.js.map +1 -0
- package/controllers/reorder.d.ts +78 -0
- package/controllers/reorder.js +124 -0
- package/controllers/reorder.js.map +1 -0
- package/controllers/selection.d.ts +109 -0
- package/controllers/selection.js +168 -0
- package/controllers/selection.js.map +1 -0
- package/controllers/sort.js +28 -0
- package/controllers/sort.js.map +1 -1
- package/controllers/state.d.ts +32 -0
- package/controllers/state.js +37 -0
- package/controllers/state.js.map +1 -1
- package/controllers/tree.d.ts +87 -0
- package/controllers/tree.js +0 -0
- package/controllers/tree.js.map +1 -0
- package/custom-elements.json +6142 -992
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +70 -14
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ApexGrid.html +316 -19
- package/docs/functions/setup.html +22 -0
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +503 -9
- package/docs/interfaces/ApexCellValueChangedEvent.html +11 -0
- package/docs/interfaces/ApexCellValueChangingEvent.html +13 -0
- package/docs/interfaces/ApexColumnMovedEvent.html +8 -0
- package/docs/interfaces/ApexColumnMovingEvent.html +11 -0
- package/docs/interfaces/ApexColumnPinnedEvent.html +6 -0
- package/docs/interfaces/ApexColumnPinningEvent.html +8 -0
- package/docs/interfaces/ApexDetailContext.html +8 -0
- package/docs/interfaces/ApexFilteredEvent.html +1 -1
- package/docs/interfaces/ApexFilteringEvent.html +3 -3
- package/docs/interfaces/ApexGridEventMap.html +58 -7
- package/docs/interfaces/ApexHeaderContext.html +1 -1
- package/docs/interfaces/ApexPageChangedEvent.html +10 -0
- package/docs/interfaces/ApexPageChangingEvent.html +10 -0
- package/docs/interfaces/ApexQuickFilterChangedEvent.html +4 -0
- package/docs/interfaces/ApexQuickFilterChangingEvent.html +6 -0
- package/docs/interfaces/ApexRowEditEndedEvent.html +6 -0
- package/docs/interfaces/ApexRowEditStartedEvent.html +4 -0
- package/docs/interfaces/ApexRowExpandedEvent.html +8 -0
- package/docs/interfaces/ApexRowExpandingEvent.html +11 -0
- package/docs/interfaces/ApexRowSelectedEvent.html +8 -0
- package/docs/interfaces/ApexRowSelectingEvent.html +11 -0
- package/docs/interfaces/ApexTreeRowExpandedEvent.html +8 -0
- package/docs/interfaces/ApexTreeRowExpandingEvent.html +10 -0
- package/docs/interfaces/BaseApexCellContext.html +9 -3
- package/docs/interfaces/BaseApexEditorContext.html +19 -0
- package/docs/interfaces/BaseColumnConfiguration.html +65 -10
- package/docs/interfaces/BaseColumnSortConfiguration.html +1 -1
- package/docs/interfaces/BaseFilterExpression.html +1 -1
- package/docs/interfaces/BaseSortExpression.html +1 -1
- package/docs/interfaces/CSVExportOptions.html +22 -0
- package/docs/interfaces/ColumnFilterConfiguration.html +1 -1
- package/docs/interfaces/DataPipelineConfiguration.html +13 -4
- package/docs/interfaces/ExportOptions.html +15 -0
- package/docs/interfaces/GridEditingConfiguration.html +10 -0
- package/docs/interfaces/GridExpansionConfiguration.html +15 -0
- package/docs/interfaces/GridSelectionConfiguration.html +11 -0
- package/docs/interfaces/GridSortConfiguration.html +1 -1
- package/docs/interfaces/GridTreeConfiguration.html +33 -0
- package/docs/interfaces/PaginationConfiguration.html +18 -0
- package/docs/interfaces/PaginationState.html +10 -0
- package/docs/interfaces/XLSXExportOptions.html +17 -0
- package/docs/media/package.json +83 -0
- package/docs/media/publish.yml +111 -0
- package/docs/modules.html +1 -1
- package/docs/types/ApexCellContext.html +1 -1
- package/docs/types/ApexEditorContext.html +2 -0
- 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 +2 -0
- package/docs/types/ColumnSortConfiguration.html +1 -1
- package/docs/types/DataPipelineHook.html +1 -1
- package/docs/types/DataPipelineParams.html +3 -3
- package/docs/types/DataType.html +30 -2
- package/docs/types/EditMode.html +6 -0
- package/docs/types/EditTrigger.html +4 -0
- package/docs/types/ExportCellValue.html +5 -0
- package/docs/types/ExportSource.html +8 -0
- package/docs/types/FilterCriteria.html +1 -1
- package/docs/types/FilterExpression.html +1 -1
- package/docs/types/Keys.html +1 -1
- package/docs/types/PaginationMode.html +6 -0
- package/docs/types/PinPosition.html +5 -0
- package/docs/types/PropertyType.html +1 -1
- package/docs/types/SelectionMode.html +7 -0
- package/docs/types/SortComparer.html +1 -1
- package/docs/types/SortExpression.html +1 -1
- package/docs/types/SortState.html +1 -1
- package/docs/types/SortingDirection.html +1 -1
- package/index.d.ts +5 -2
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/column-types.d.ts +94 -0
- package/internal/column-types.js +268 -0
- package/internal/column-types.js.map +1 -0
- package/internal/export.d.ts +106 -0
- package/internal/export.js +122 -0
- package/internal/export.js.map +1 -0
- package/internal/flip.d.ts +80 -0
- package/internal/flip.js +52 -0
- package/internal/flip.js.map +1 -0
- package/internal/icons.d.ts +24 -0
- package/internal/icons.js +134 -0
- package/internal/icons.js.map +1 -0
- package/internal/tags.d.ts +2 -0
- package/internal/tags.js +2 -0
- package/internal/tags.js.map +1 -1
- package/internal/theming.js +1 -1
- package/internal/theming.js.map +1 -1
- package/internal/types.d.ts +424 -3
- package/internal/types.js.map +1 -1
- package/internal/utils.d.ts +24 -1
- package/internal/utils.js +48 -7
- package/internal/utils.js.map +1 -1
- package/internal/xlsx.d.ts +22 -0
- package/internal/xlsx.js +228 -0
- package/internal/xlsx.js.map +1 -0
- package/operations/pagination.d.ts +19 -0
- package/operations/pagination.js +12 -0
- package/operations/pagination.js.map +1 -0
- package/operations/quick-filter.d.ts +21 -0
- package/operations/quick-filter.js +26 -0
- package/operations/quick-filter.js.map +1 -0
- package/package.json +6 -5
- package/setup.d.ts +58 -0
- package/setup.js +29 -0
- package/setup.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-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/themes/light/grid.bootstrap.css.js +1 -1
- package/styles/grid/themes/light/grid.bootstrap.css.js.map +1 -1
- package/styles/grid/themes/light/grid.fluent.css.js +1 -1
- package/styles/grid/themes/light/grid.fluent.css.js.map +1 -1
- package/styles/grid/themes/light/grid.indigo.css.js +1 -1
- package/styles/grid/themes/light/grid.indigo.css.js.map +1 -1
- package/styles/grid/themes/light/grid.material.css.js +1 -1
- package/styles/grid/themes/light/grid.material.css.js.map +1 -1
- 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.d.ts +1 -0
- package/styles/paginator/paginator.css.js +3 -0
- package/styles/paginator/paginator.css.js.map +1 -0
- package/styles/toolbar/toolbar.css.d.ts +1 -0
- package/styles/toolbar/toolbar.css.js +3 -0
- package/styles/toolbar/toolbar.css.js.map +1 -0
- package/styles.css +17 -0
- package/internal/icon-registry.d.ts +0 -1
- package/internal/icon-registry.js +0 -29
- package/internal/icon-registry.js.map +0 -1
package/internal/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAIzE,MAAM,UAAU,iBAAiB,CAC/B,OAAsC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAIzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;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GACR,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;YAC3F,OAAO,EAAE,GAAG,EAAE,IAAI,EAA4B,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,KAAc;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAmB,MAA8B;IAEnF,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,eAAe,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,cAAc,CAAC;QACxB;YACE,OAAO,cAAc,CAAC;IAC1B,CAAC;AACH,CAAC","sourcesContent":["import type { StyleInfo } from 'lit/directives/style-map.js';\nimport { BooleanOperands } from '../operations/filter/operands/boolean.js';\nimport { NumberOperands } from '../operations/filter/operands/number.js';\nimport { StringOperands } from '../operations/filter/operands/string.js';\nimport type { ColumnConfiguration, DataType, GridHost } from './types.js';\n\n/** Width of the auto-rendered selection (checkbox) column in CSS pixels. */\nexport const SELECTION_COLUMN_WIDTH = 44;\n/** Width of the auto-rendered expansion (chevron) column in CSS pixels. */\nexport const EXPANSION_COLUMN_WIDTH = 40;\n\nexport function applyColumnWidths<T extends object>(\n columns: Array<ColumnConfiguration<T>>,\n options: { showSelectionColumn?: boolean; showExpansionColumn?: boolean } = {}\n): StyleInfo {\n const tracks = columns\n .filter((each) => !each.hidden)\n .map(({ width }) => width ?? 'minmax(136px, 1fr)');\n if (options.showExpansionColumn) {\n tracks.unshift(`${EXPANSION_COLUMN_WIDTH}px`);\n }\n if (options.showSelectionColumn) {\n tracks.unshift(`${SELECTION_COLUMN_WIDTH}px`);\n }\n return { 'grid-template-columns': tracks.join(' ') };\n}\n\n/**\n * Returns the visual render order of the columns: start-pinned columns first,\n * then unpinned columns, then end-pinned columns. Within each group the\n * original `columns` array order is preserved.\n *\n * @remarks\n * The grid uses this order for rendering, navigation, and CSS grid track widths.\n * The user-supplied `columns` array is never mutated; this returns a new array.\n */\nexport function getDisplayColumns<T extends object>(\n columns: Array<ColumnConfiguration<T>>\n): Array<ColumnConfiguration<T>> {\n const start: Array<ColumnConfiguration<T>> = [];\n const middle: Array<ColumnConfiguration<T>> = [];\n const end: Array<ColumnConfiguration<T>> = [];\n for (const column of columns) {\n if (column.pinned === 'start') start.push(column);\n else if (column.pinned === 'end') end.push(column);\n else middle.push(column);\n }\n return [...start, ...middle, ...end];\n}\n\n/**\n * Returns `'start'` for the last visible start-pinned column, `'end'` for the\n * first visible end-pinned column, or `null` otherwise. The edge column gets a\n * subtle shadow / border to separate the pinned region from the scrolling one.\n */\nexport function getPinEdge<T extends object>(\n displayColumns: Array<ColumnConfiguration<T>>,\n index: number\n): 'start' | 'end' | null {\n const column = displayColumns[index];\n if (!column?.pinned) return null;\n\n if (column.pinned === 'start') {\n for (let i = index + 1; i < displayColumns.length; i++) {\n const next = displayColumns[i];\n if (next.hidden) continue;\n return next.pinned === 'start' ? null : 'start';\n }\n return 'start';\n }\n\n for (let i = index - 1; i >= 0; i--) {\n const prev = displayColumns[i];\n if (prev.hidden) continue;\n return prev.pinned === 'end' ? null : 'end';\n }\n return 'end';\n}\n\nexport function autoGenerateColumns<T extends object>(grid: GridHost<T>) {\n if (grid.autoGenerate && grid.columns.length < 1) {\n const record = grid.data[0] ?? {};\n\n grid.columns = Object.entries(record).map(([key, value]) => {\n const type: DataType =\n typeof value === 'boolean' ? 'boolean' : typeof value === 'number' ? 'number' : 'string';\n return { key, type } as ColumnConfiguration<T>;\n });\n }\n}\n\nexport function asArray<T>(value: T | T[]) {\n return Array.isArray(value) ? value : [value];\n}\n\nexport function getFilterOperandsFor<T extends object>(column: ColumnConfiguration<T>) {\n // Check for custom class in the filter config\n switch (column.type) {\n case 'boolean':\n return BooleanOperands;\n case 'number':\n return NumberOperands;\n default:\n return StringOperands;\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ExportCellValue } from './export.js';
|
|
2
|
+
/** Excel column letter for zero-based column index (0 → A, 26 → AA). */
|
|
3
|
+
export declare function columnLetter(index: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* Converts a `Date` to the Excel serial date number (days since the 1899-12-30
|
|
6
|
+
* epoch, with the day rolling over at the user's local midnight). Time of day
|
|
7
|
+
* is preserved as the fractional part.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toExcelSerial(date: Date): number;
|
|
10
|
+
/** A worksheet representation passed to {@link buildXLSX}. */
|
|
11
|
+
export interface XLSXSheetData {
|
|
12
|
+
/** Worksheet tab name. */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** Header row labels (rendered with bold styling). */
|
|
15
|
+
headers: string[];
|
|
16
|
+
/** Data rows. Each row is an array of cell values, aligned to `headers`. */
|
|
17
|
+
rows: ExportCellValue[][];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds the complete `.xlsx` bytes for a single-sheet workbook.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildXLSX(sheet: XLSXSheetData): Uint8Array;
|
package/internal/xlsx.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
const encoder = new TextEncoder();
|
|
2
|
+
let _crcTable = null;
|
|
3
|
+
function getCrcTable() {
|
|
4
|
+
if (_crcTable)
|
|
5
|
+
return _crcTable;
|
|
6
|
+
const table = new Uint32Array(256);
|
|
7
|
+
for (let i = 0; i < 256; i++) {
|
|
8
|
+
let c = i;
|
|
9
|
+
for (let k = 0; k < 8; k++) {
|
|
10
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
11
|
+
}
|
|
12
|
+
table[i] = c >>> 0;
|
|
13
|
+
}
|
|
14
|
+
_crcTable = table;
|
|
15
|
+
return table;
|
|
16
|
+
}
|
|
17
|
+
function crc32(data) {
|
|
18
|
+
const table = getCrcTable();
|
|
19
|
+
let c = 0xffffffff;
|
|
20
|
+
for (let i = 0; i < data.length; i++) {
|
|
21
|
+
c = (c >>> 8) ^ table[(c ^ data[i]) & 0xff];
|
|
22
|
+
}
|
|
23
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
24
|
+
}
|
|
25
|
+
function buildZip(files) {
|
|
26
|
+
const parts = [];
|
|
27
|
+
const entries = [];
|
|
28
|
+
let offset = 0;
|
|
29
|
+
for (const file of files) {
|
|
30
|
+
const nameBytes = encoder.encode(file.name);
|
|
31
|
+
const crc = crc32(file.data);
|
|
32
|
+
const header = new Uint8Array(30 + nameBytes.length);
|
|
33
|
+
const view = new DataView(header.buffer);
|
|
34
|
+
view.setUint32(0, 0x04034b50, true);
|
|
35
|
+
view.setUint16(4, 20, true);
|
|
36
|
+
view.setUint16(6, 0x0800, true);
|
|
37
|
+
view.setUint16(8, 0, true);
|
|
38
|
+
view.setUint16(10, 0, true);
|
|
39
|
+
view.setUint16(12, 0x0021, true);
|
|
40
|
+
view.setUint32(14, crc, true);
|
|
41
|
+
view.setUint32(18, file.data.length, true);
|
|
42
|
+
view.setUint32(22, file.data.length, true);
|
|
43
|
+
view.setUint16(26, nameBytes.length, true);
|
|
44
|
+
view.setUint16(28, 0, true);
|
|
45
|
+
header.set(nameBytes, 30);
|
|
46
|
+
parts.push(header, file.data);
|
|
47
|
+
entries.push({ ...file, crc, offset, nameBytes });
|
|
48
|
+
offset += header.length + file.data.length;
|
|
49
|
+
}
|
|
50
|
+
const centralStart = offset;
|
|
51
|
+
for (const entry of entries) {
|
|
52
|
+
const cd = new Uint8Array(46 + entry.nameBytes.length);
|
|
53
|
+
const view = new DataView(cd.buffer);
|
|
54
|
+
view.setUint32(0, 0x02014b50, true);
|
|
55
|
+
view.setUint16(4, 0x031e, true);
|
|
56
|
+
view.setUint16(6, 20, true);
|
|
57
|
+
view.setUint16(8, 0x0800, true);
|
|
58
|
+
view.setUint16(10, 0, true);
|
|
59
|
+
view.setUint16(12, 0, true);
|
|
60
|
+
view.setUint16(14, 0x0021, true);
|
|
61
|
+
view.setUint32(16, entry.crc, true);
|
|
62
|
+
view.setUint32(20, entry.data.length, true);
|
|
63
|
+
view.setUint32(24, entry.data.length, true);
|
|
64
|
+
view.setUint16(28, entry.nameBytes.length, true);
|
|
65
|
+
view.setUint16(30, 0, true);
|
|
66
|
+
view.setUint16(32, 0, true);
|
|
67
|
+
view.setUint16(34, 0, true);
|
|
68
|
+
view.setUint16(36, 0, true);
|
|
69
|
+
view.setUint32(38, 0, true);
|
|
70
|
+
view.setUint32(42, entry.offset, true);
|
|
71
|
+
cd.set(entry.nameBytes, 46);
|
|
72
|
+
parts.push(cd);
|
|
73
|
+
offset += cd.length;
|
|
74
|
+
}
|
|
75
|
+
const centralSize = offset - centralStart;
|
|
76
|
+
const eocd = new Uint8Array(22);
|
|
77
|
+
const eocdView = new DataView(eocd.buffer);
|
|
78
|
+
eocdView.setUint32(0, 0x06054b50, true);
|
|
79
|
+
eocdView.setUint16(8, entries.length, true);
|
|
80
|
+
eocdView.setUint16(10, entries.length, true);
|
|
81
|
+
eocdView.setUint32(12, centralSize, true);
|
|
82
|
+
eocdView.setUint32(16, centralStart, true);
|
|
83
|
+
parts.push(eocd);
|
|
84
|
+
let total = 0;
|
|
85
|
+
for (const part of parts)
|
|
86
|
+
total += part.length;
|
|
87
|
+
const result = new Uint8Array(total);
|
|
88
|
+
let pos = 0;
|
|
89
|
+
for (const part of parts) {
|
|
90
|
+
result.set(part, pos);
|
|
91
|
+
pos += part.length;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
const XML_ESCAPES = {
|
|
96
|
+
'<': '<',
|
|
97
|
+
'>': '>',
|
|
98
|
+
'&': '&',
|
|
99
|
+
'"': '"',
|
|
100
|
+
"'": ''',
|
|
101
|
+
};
|
|
102
|
+
function escapeXml(value) {
|
|
103
|
+
let out = '';
|
|
104
|
+
for (let i = 0; i < value.length; i++) {
|
|
105
|
+
const code = value.charCodeAt(i);
|
|
106
|
+
if (code < 0x20 && code !== 0x09 && code !== 0x0a && code !== 0x0d)
|
|
107
|
+
continue;
|
|
108
|
+
const ch = value[i];
|
|
109
|
+
out += XML_ESCAPES[ch] ?? ch;
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
export function columnLetter(index) {
|
|
114
|
+
let result = '';
|
|
115
|
+
let n = index;
|
|
116
|
+
while (n >= 0) {
|
|
117
|
+
result = String.fromCharCode(65 + (n % 26)) + result;
|
|
118
|
+
n = Math.floor(n / 26) - 1;
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
export function toExcelSerial(date) {
|
|
123
|
+
const localMs = date.getTime() - date.getTimezoneOffset() * 60_000 - Date.UTC(1899, 11, 30);
|
|
124
|
+
return localMs / 86_400_000;
|
|
125
|
+
}
|
|
126
|
+
const STYLE_DEFAULT = 0;
|
|
127
|
+
const STYLE_HEADER = 1;
|
|
128
|
+
const STYLE_DATE = 2;
|
|
129
|
+
function renderCell(ref, value, styleIndex) {
|
|
130
|
+
const s = styleIndex && styleIndex !== STYLE_DEFAULT ? ` s="${styleIndex}"` : '';
|
|
131
|
+
if (value === null || value === undefined || value === '') {
|
|
132
|
+
return styleIndex ? `<c r="${ref}"${s}/>` : '';
|
|
133
|
+
}
|
|
134
|
+
if (typeof value === 'boolean') {
|
|
135
|
+
return `<c r="${ref}"${s} t="b"><v>${value ? 1 : 0}</v></c>`;
|
|
136
|
+
}
|
|
137
|
+
if (value instanceof Date) {
|
|
138
|
+
return `<c r="${ref}" s="${STYLE_DATE}"><v>${toExcelSerial(value)}</v></c>`;
|
|
139
|
+
}
|
|
140
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
141
|
+
return `<c r="${ref}"${s}><v>${value}</v></c>`;
|
|
142
|
+
}
|
|
143
|
+
return `<c r="${ref}"${s} t="inlineStr"><is><t xml:space="preserve">${escapeXml(String(value))}</t></is></c>`;
|
|
144
|
+
}
|
|
145
|
+
const SHEET_NAME_DISALLOWED = /[\\/?*[\]:]/g;
|
|
146
|
+
function sanitizeSheetName(raw) {
|
|
147
|
+
return raw.replace(SHEET_NAME_DISALLOWED, '_').slice(0, 31) || 'Sheet1';
|
|
148
|
+
}
|
|
149
|
+
export function buildXLSX(sheet) {
|
|
150
|
+
const sheetName = sanitizeSheetName(sheet.name ?? 'Sheet1');
|
|
151
|
+
const headerCount = sheet.headers.length;
|
|
152
|
+
const maxRowWidth = sheet.rows.reduce((acc, row) => Math.max(acc, row.length), 0);
|
|
153
|
+
const totalCols = Math.max(headerCount, maxRowWidth);
|
|
154
|
+
const totalRows = sheet.rows.length + (headerCount ? 1 : 0);
|
|
155
|
+
const sheetRows = [];
|
|
156
|
+
let rowNum = 1;
|
|
157
|
+
if (headerCount) {
|
|
158
|
+
const cells = [];
|
|
159
|
+
for (let c = 0; c < headerCount; c++) {
|
|
160
|
+
cells.push(renderCell(`${columnLetter(c)}${rowNum}`, sheet.headers[c], STYLE_HEADER));
|
|
161
|
+
}
|
|
162
|
+
sheetRows.push(`<row r="${rowNum}">${cells.join('')}</row>`);
|
|
163
|
+
rowNum++;
|
|
164
|
+
}
|
|
165
|
+
for (const row of sheet.rows) {
|
|
166
|
+
const cells = [];
|
|
167
|
+
for (let c = 0; c < row.length; c++) {
|
|
168
|
+
const cell = renderCell(`${columnLetter(c)}${rowNum}`, row[c]);
|
|
169
|
+
if (cell)
|
|
170
|
+
cells.push(cell);
|
|
171
|
+
}
|
|
172
|
+
sheetRows.push(`<row r="${rowNum}">${cells.join('')}</row>`);
|
|
173
|
+
rowNum++;
|
|
174
|
+
}
|
|
175
|
+
const dimension = totalRows > 0 && totalCols > 0 ? `A1:${columnLetter(totalCols - 1)}${totalRows}` : 'A1';
|
|
176
|
+
const sheetXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` +
|
|
177
|
+
`<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">` +
|
|
178
|
+
`<dimension ref="${dimension}"/>` +
|
|
179
|
+
`<sheetData>${sheetRows.join('')}</sheetData>` +
|
|
180
|
+
'</worksheet>';
|
|
181
|
+
const styles = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` +
|
|
182
|
+
`<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">` +
|
|
183
|
+
`<numFmts count="1"><numFmt numFmtId="164" formatCode="yyyy-mm-dd"/></numFmts>` +
|
|
184
|
+
`<fonts count="2">` +
|
|
185
|
+
`<font><sz val="11"/><name val="Calibri"/></font>` +
|
|
186
|
+
`<font><b/><sz val="11"/><name val="Calibri"/></font>` +
|
|
187
|
+
'</fonts>' +
|
|
188
|
+
`<fills count="1"><fill><patternFill patternType="none"/></fill></fills>` +
|
|
189
|
+
`<borders count="1"><border/></borders>` +
|
|
190
|
+
`<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>` +
|
|
191
|
+
`<cellXfs count="3">` +
|
|
192
|
+
`<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>` +
|
|
193
|
+
`<xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="1"/>` +
|
|
194
|
+
`<xf numFmtId="164" fontId="0" fillId="0" borderId="0" applyNumberFormat="1"/>` +
|
|
195
|
+
'</cellXfs>' +
|
|
196
|
+
'</styleSheet>';
|
|
197
|
+
const workbook = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` +
|
|
198
|
+
`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" ` +
|
|
199
|
+
`xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">` +
|
|
200
|
+
`<sheets><sheet name="${escapeXml(sheetName)}" sheetId="1" r:id="rId1"/></sheets>` +
|
|
201
|
+
'</workbook>';
|
|
202
|
+
const contentTypes = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` +
|
|
203
|
+
`<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">` +
|
|
204
|
+
`<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>` +
|
|
205
|
+
`<Default Extension="xml" ContentType="application/xml"/>` +
|
|
206
|
+
`<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>` +
|
|
207
|
+
`<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>` +
|
|
208
|
+
`<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>` +
|
|
209
|
+
'</Types>';
|
|
210
|
+
const rootRels = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` +
|
|
211
|
+
`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">` +
|
|
212
|
+
`<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>` +
|
|
213
|
+
'</Relationships>';
|
|
214
|
+
const workbookRels = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>` +
|
|
215
|
+
`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">` +
|
|
216
|
+
`<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>` +
|
|
217
|
+
`<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>` +
|
|
218
|
+
'</Relationships>';
|
|
219
|
+
return buildZip([
|
|
220
|
+
{ name: '[Content_Types].xml', data: encoder.encode(contentTypes) },
|
|
221
|
+
{ name: '_rels/.rels', data: encoder.encode(rootRels) },
|
|
222
|
+
{ name: 'xl/workbook.xml', data: encoder.encode(workbook) },
|
|
223
|
+
{ name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(workbookRels) },
|
|
224
|
+
{ name: 'xl/styles.xml', data: encoder.encode(styles) },
|
|
225
|
+
{ name: 'xl/worksheets/sheet1.xml', data: encoder.encode(sheetXml) },
|
|
226
|
+
]);
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=xlsx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xlsx.js","sourceRoot":"","sources":["../../src/internal/xlsx.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAIlC,IAAI,SAAS,GAAuB,IAAI,CAAC;AACzC,SAAS,WAAW;IAClB,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,KAAK,CAAC,IAAgB;IAC7B,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,IAAI,CAAC,GAAG,UAAU,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,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,UAAU,CAAC;IAEb,MAAM,QAAQ,GACZ,yDAAyD;QACzD,sFAAsF;QACtF,8IAA8I;QAC9I,kBAAkB,CAAC;IAErB,MAAM,YAAY,GAChB,yDAAyD;QACzD,sFAAsF;QACtF,+IAA+I;QAC/I,iIAAiI;QACjI,kBAAkB,CAAC;IAErB,OAAO,QAAQ,CAAC;QACd,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QACnE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QACvD,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC3D,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC1E,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACvD,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;KACrE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { ExportCellValue } from './export.js';\n\n// Minimal write-only OOXML (XLSX) implementation. Produces a single-sheet\n// workbook with bold headers and a date cell format, packaged in a store-only\n// (no-compression) ZIP container. No external dependencies — the goal is to\n// keep the bundle footprint of the export feature near zero.\n\nconst encoder = new TextEncoder();\n\n// --- CRC-32 (IEEE 802.3) for ZIP entries -----------------------------------\n\nlet _crcTable: Uint32Array | null = null;\nfunction getCrcTable(): Uint32Array {\n if (_crcTable) return _crcTable;\n const table = new Uint32Array(256);\n for (let i = 0; i < 256; i++) {\n let c = i;\n for (let k = 0; k < 8; k++) {\n c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;\n }\n table[i] = c >>> 0;\n }\n _crcTable = table;\n return table;\n}\n\nfunction crc32(data: Uint8Array): number {\n const table = getCrcTable();\n let c = 0xffffffff;\n for (let i = 0; i < data.length; i++) {\n c = (c >>> 8) ^ table[(c ^ data[i]) & 0xff];\n }\n return (c ^ 0xffffffff) >>> 0;\n}\n\n// --- Store-only ZIP writer -------------------------------------------------\n\ninterface ZipFile {\n name: string;\n data: Uint8Array;\n}\n\ninterface ZipEntry extends ZipFile {\n crc: number;\n offset: number;\n nameBytes: Uint8Array;\n}\n\n/**\n * Builds a store-only (no compression) ZIP archive containing the given\n * files. The XLSX format permits stored entries, which keeps this writer\n * ~100 lines without pulling in a deflate implementation.\n */\nfunction buildZip(files: ReadonlyArray<ZipFile>): Uint8Array {\n const parts: Uint8Array[] = [];\n const entries: ZipEntry[] = [];\n let offset = 0;\n\n for (const file of files) {\n const nameBytes = encoder.encode(file.name);\n const crc = crc32(file.data);\n const header = new Uint8Array(30 + nameBytes.length);\n const view = new DataView(header.buffer);\n view.setUint32(0, 0x04034b50, true);\n view.setUint16(4, 20, true); // version needed to extract\n view.setUint16(6, 0x0800, true); // flag bit 11: UTF-8 filename\n view.setUint16(8, 0, true); // compression: stored\n view.setUint16(10, 0, true); // mod time\n view.setUint16(12, 0x0021, true); // mod date: 1980-01-01\n view.setUint32(14, crc, true);\n view.setUint32(18, file.data.length, true);\n view.setUint32(22, file.data.length, true);\n view.setUint16(26, nameBytes.length, true);\n view.setUint16(28, 0, true);\n header.set(nameBytes, 30);\n parts.push(header, file.data);\n entries.push({ ...file, crc, offset, nameBytes });\n offset += header.length + file.data.length;\n }\n\n const centralStart = offset;\n for (const entry of entries) {\n const cd = new Uint8Array(46 + entry.nameBytes.length);\n const view = new DataView(cd.buffer);\n view.setUint32(0, 0x02014b50, true);\n view.setUint16(4, 0x031e, true); // version made by (unix, v3.0)\n view.setUint16(6, 20, true);\n view.setUint16(8, 0x0800, true);\n view.setUint16(10, 0, true);\n view.setUint16(12, 0, true);\n view.setUint16(14, 0x0021, true);\n view.setUint32(16, entry.crc, true);\n view.setUint32(20, entry.data.length, true);\n view.setUint32(24, entry.data.length, true);\n view.setUint16(28, entry.nameBytes.length, true);\n view.setUint16(30, 0, true);\n view.setUint16(32, 0, true);\n view.setUint16(34, 0, true);\n view.setUint16(36, 0, true);\n view.setUint32(38, 0, true);\n view.setUint32(42, entry.offset, true);\n cd.set(entry.nameBytes, 46);\n parts.push(cd);\n offset += cd.length;\n }\n\n const centralSize = offset - centralStart;\n const eocd = new Uint8Array(22);\n const eocdView = new DataView(eocd.buffer);\n eocdView.setUint32(0, 0x06054b50, true);\n eocdView.setUint16(8, entries.length, true);\n eocdView.setUint16(10, entries.length, true);\n eocdView.setUint32(12, centralSize, true);\n eocdView.setUint32(16, centralStart, true);\n parts.push(eocd);\n\n let total = 0;\n for (const part of parts) total += part.length;\n const result = new Uint8Array(total);\n let pos = 0;\n for (const part of parts) {\n result.set(part, pos);\n pos += part.length;\n }\n return result;\n}\n\n// --- XML helpers -----------------------------------------------------------\n\nconst XML_ESCAPES: Record<string, string> = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": ''',\n};\n\nfunction escapeXml(value: string): string {\n // XLSX is intolerant of control chars below 0x20 (except tab, LF, CR).\n // Strip them rather than letting Excel report a \"corrupt file\" warning.\n let out = '';\n for (let i = 0; i < value.length; i++) {\n const code = value.charCodeAt(i);\n if (code < 0x20 && code !== 0x09 && code !== 0x0a && code !== 0x0d) continue;\n const ch = value[i];\n out += XML_ESCAPES[ch] ?? ch;\n }\n return out;\n}\n\n/** Excel column letter for zero-based column index (0 → A, 26 → AA). */\nexport function columnLetter(index: number): string {\n let result = '';\n let n = index;\n while (n >= 0) {\n result = String.fromCharCode(65 + (n % 26)) + result;\n n = Math.floor(n / 26) - 1;\n }\n return result;\n}\n\n/**\n * Converts a `Date` to the Excel serial date number (days since the 1899-12-30\n * epoch, with the day rolling over at the user's local midnight). Time of day\n * is preserved as the fractional part.\n */\nexport function toExcelSerial(date: Date): number {\n const localMs = date.getTime() - date.getTimezoneOffset() * 60_000 - Date.UTC(1899, 11, 30);\n return localMs / 86_400_000;\n}\n\n// --- Sheet rendering -------------------------------------------------------\n\nconst STYLE_DEFAULT = 0;\nconst STYLE_HEADER = 1;\nconst STYLE_DATE = 2;\n\nfunction renderCell(ref: string, value: ExportCellValue, styleIndex?: number): string {\n const s = styleIndex && styleIndex !== STYLE_DEFAULT ? ` s=\"${styleIndex}\"` : '';\n if (value === null || value === undefined || value === '') {\n return styleIndex ? `<c r=\"${ref}\"${s}/>` : '';\n }\n if (typeof value === 'boolean') {\n return `<c r=\"${ref}\"${s} t=\"b\"><v>${value ? 1 : 0}</v></c>`;\n }\n if (value instanceof Date) {\n return `<c r=\"${ref}\" s=\"${STYLE_DATE}\"><v>${toExcelSerial(value)}</v></c>`;\n }\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${ref}\"${s}><v>${value}</v></c>`;\n }\n return `<c r=\"${ref}\"${s} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(\n String(value)\n )}</t></is></c>`;\n}\n\n/** A worksheet representation passed to {@link buildXLSX}. */\nexport interface XLSXSheetData {\n /** Worksheet tab name. */\n name?: string;\n /** Header row labels (rendered with bold styling). */\n headers: string[];\n /** Data rows. Each row is an array of cell values, aligned to `headers`. */\n rows: ExportCellValue[][];\n}\n\n/** Filename-illegal characters per the OOXML spec for sheet names. */\nconst SHEET_NAME_DISALLOWED = /[\\\\/?*[\\]:]/g;\n\nfunction sanitizeSheetName(raw: string): string {\n return raw.replace(SHEET_NAME_DISALLOWED, '_').slice(0, 31) || 'Sheet1';\n}\n\n/**\n * Builds the complete `.xlsx` bytes for a single-sheet workbook.\n */\nexport function buildXLSX(sheet: XLSXSheetData): Uint8Array {\n const sheetName = sanitizeSheetName(sheet.name ?? 'Sheet1');\n const headerCount = sheet.headers.length;\n const maxRowWidth = sheet.rows.reduce((acc, row) => Math.max(acc, row.length), 0);\n const totalCols = Math.max(headerCount, maxRowWidth);\n const totalRows = sheet.rows.length + (headerCount ? 1 : 0);\n\n const sheetRows: string[] = [];\n let rowNum = 1;\n if (headerCount) {\n const cells: string[] = [];\n for (let c = 0; c < headerCount; c++) {\n cells.push(renderCell(`${columnLetter(c)}${rowNum}`, sheet.headers[c], STYLE_HEADER));\n }\n sheetRows.push(`<row r=\"${rowNum}\">${cells.join('')}</row>`);\n rowNum++;\n }\n for (const row of sheet.rows) {\n const cells: string[] = [];\n for (let c = 0; c < row.length; c++) {\n const cell = renderCell(`${columnLetter(c)}${rowNum}`, row[c]);\n if (cell) cells.push(cell);\n }\n sheetRows.push(`<row r=\"${rowNum}\">${cells.join('')}</row>`);\n rowNum++;\n }\n\n const dimension =\n totalRows > 0 && totalCols > 0 ? `A1:${columnLetter(totalCols - 1)}${totalRows}` : 'A1';\n\n const sheetXml =\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` +\n `<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">` +\n `<dimension ref=\"${dimension}\"/>` +\n `<sheetData>${sheetRows.join('')}</sheetData>` +\n '</worksheet>';\n\n const styles =\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` +\n `<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">` +\n `<numFmts count=\"1\"><numFmt numFmtId=\"164\" formatCode=\"yyyy-mm-dd\"/></numFmts>` +\n `<fonts count=\"2\">` +\n `<font><sz val=\"11\"/><name val=\"Calibri\"/></font>` +\n `<font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font>` +\n '</fonts>' +\n `<fills count=\"1\"><fill><patternFill patternType=\"none\"/></fill></fills>` +\n `<borders count=\"1\"><border/></borders>` +\n `<cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>` +\n `<cellXfs count=\"3\">` +\n `<xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/>` +\n `<xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" applyFont=\"1\"/>` +\n `<xf numFmtId=\"164\" fontId=\"0\" fillId=\"0\" borderId=\"0\" applyNumberFormat=\"1\"/>` +\n '</cellXfs>' +\n '</styleSheet>';\n\n const workbook =\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` +\n `<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" ` +\n `xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">` +\n `<sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets>` +\n '</workbook>';\n\n const contentTypes =\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` +\n `<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">` +\n `<Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>` +\n `<Default Extension=\"xml\" ContentType=\"application/xml\"/>` +\n `<Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/>` +\n `<Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/>` +\n `<Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/>` +\n '</Types>';\n\n const rootRels =\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` +\n `<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">` +\n `<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/>` +\n '</Relationships>';\n\n const workbookRels =\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>` +\n `<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">` +\n `<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/>` +\n `<Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/>` +\n '</Relationships>';\n\n return buildZip([\n { name: '[Content_Types].xml', data: encoder.encode(contentTypes) },\n { name: '_rels/.rels', data: encoder.encode(rootRels) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbook) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(workbookRels) },\n { name: 'xl/styles.xml', data: encoder.encode(styles) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(sheetXml) },\n ]);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PaginationState } from '../internal/types.js';
|
|
2
|
+
import DataOperation from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in pagination data operation.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Slices the post-filter, post-sort dataset by `page` and `pageSize`.
|
|
8
|
+
* Used by the grid when `pagination.mode === 'local'`. Remote pagination
|
|
9
|
+
* is delegated to {@link DataPipelineConfiguration.pagination}.
|
|
10
|
+
*/
|
|
11
|
+
export default class PaginationDataOperation<T extends object> extends DataOperation<T> {
|
|
12
|
+
/**
|
|
13
|
+
* Returns the slice of `data` corresponding to the given pagination `state`.
|
|
14
|
+
*
|
|
15
|
+
* @param data - The post-filter, post-sort dataset.
|
|
16
|
+
* @param state - The resolved pagination state.
|
|
17
|
+
*/
|
|
18
|
+
apply(data: T[], state: PaginationState): T[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import DataOperation from './base.js';
|
|
2
|
+
export default class PaginationDataOperation extends DataOperation {
|
|
3
|
+
apply(data, state) {
|
|
4
|
+
const { page, pageSize } = state;
|
|
5
|
+
if (!pageSize || pageSize < 1) {
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
const start = page * pageSize;
|
|
9
|
+
return data.slice(start, start + pageSize);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/operations/pagination.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,WAAW,CAAC;AAUtC,MAAM,CAAC,OAAO,OAAO,uBAA0C,SAAQ,aAAgB;IAO9E,KAAK,CAAC,IAAS,EAAE,KAAsB;QAC5C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,QAAQ,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import type { PaginationState } from '../internal/types.js';\nimport DataOperation from './base.js';\n\n/**\n * Built-in pagination data operation.\n *\n * @remarks\n * Slices the post-filter, post-sort dataset by `page` and `pageSize`.\n * Used by the grid when `pagination.mode === 'local'`. Remote pagination\n * is delegated to {@link DataPipelineConfiguration.pagination}.\n */\nexport default class PaginationDataOperation<T extends object> extends DataOperation<T> {\n /**\n * Returns the slice of `data` corresponding to the given pagination `state`.\n *\n * @param data - The post-filter, post-sort dataset.\n * @param state - The resolved pagination state.\n */\n public apply(data: T[], state: PaginationState): T[] {\n const { page, pageSize } = state;\n if (!pageSize || pageSize < 1) {\n return data;\n }\n const start = page * pageSize;\n return data.slice(start, start + pageSize);\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ColumnConfiguration } from '../internal/types.js';
|
|
2
|
+
import DataOperation from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in quick-filter (global search) data operation.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Performs a case-insensitive substring match of the search term across every visible
|
|
8
|
+
* column's stringified value. Returns the original dataset unchanged when the search
|
|
9
|
+
* term is empty / whitespace-only. Used by the grid when `quickFilter` is set; the
|
|
10
|
+
* search can be customised through {@link DataPipelineConfiguration.quickFilter}.
|
|
11
|
+
*/
|
|
12
|
+
export default class QuickFilterDataOperation<T extends object> extends DataOperation<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Returns the records whose visible column values contain `searchTerm` (case-insensitive).
|
|
15
|
+
*
|
|
16
|
+
* @param data - The dataset to filter.
|
|
17
|
+
* @param searchTerm - The trimmed search term (already normalised to lower-case is fine).
|
|
18
|
+
* @param columns - The current column configuration; hidden columns are skipped.
|
|
19
|
+
*/
|
|
20
|
+
apply(data: T[], searchTerm: string, columns: Array<ColumnConfiguration<T>>): T[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DataOperation from './base.js';
|
|
2
|
+
export default class QuickFilterDataOperation extends DataOperation {
|
|
3
|
+
apply(data, searchTerm, columns) {
|
|
4
|
+
const term = searchTerm.trim().toLowerCase();
|
|
5
|
+
if (!term) {
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
const keys = columns.filter((column) => !column.hidden).map((column) => column.key);
|
|
9
|
+
if (keys.length === 0) {
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
return data.filter((record) => {
|
|
13
|
+
for (const key of keys) {
|
|
14
|
+
const value = record[key];
|
|
15
|
+
if (value === null || value === undefined) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (String(value).toLowerCase().includes(term)) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=quick-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quick-filter.js","sourceRoot":"","sources":["../../src/operations/quick-filter.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,WAAW,CAAC;AAWtC,MAAM,CAAC,OAAO,OAAO,wBAA2C,SAAQ,aAAgB;IAQ/E,KAAK,CAAC,IAAS,EAAE,UAAkB,EAAE,OAAsC;QAChF,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAc,CAAC,CAAC;QAE/F,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;YAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC1B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBAC1C,SAAS;gBACX,CAAC;gBACD,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC/C,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { ColumnConfiguration, Keys } from '../internal/types.js';\nimport DataOperation from './base.js';\n\n/**\n * Built-in quick-filter (global search) data operation.\n *\n * @remarks\n * Performs a case-insensitive substring match of the search term across every visible\n * column's stringified value. Returns the original dataset unchanged when the search\n * term is empty / whitespace-only. Used by the grid when `quickFilter` is set; the\n * search can be customised through {@link DataPipelineConfiguration.quickFilter}.\n */\nexport default class QuickFilterDataOperation<T extends object> extends DataOperation<T> {\n /**\n * Returns the records whose visible column values contain `searchTerm` (case-insensitive).\n *\n * @param data - The dataset to filter.\n * @param searchTerm - The trimmed search term (already normalised to lower-case is fine).\n * @param columns - The current column configuration; hidden columns are skipped.\n */\n public apply(data: T[], searchTerm: string, columns: Array<ColumnConfiguration<T>>): T[] {\n const term = searchTerm.trim().toLowerCase();\n if (!term) {\n return data;\n }\n\n const keys = columns.filter((column) => !column.hidden).map((column) => column.key as Keys<T>);\n\n if (keys.length === 0) {\n return data;\n }\n\n return data.filter((record) => {\n for (const key of keys) {\n const value = record[key];\n if (value === null || value === undefined) {\n continue;\n }\n if (String(value).toLowerCase().includes(term)) {\n return true;\n }\n }\n return false;\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apex-grid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Web component data grid following open-wc recommendations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
7
7
|
"web-component",
|
|
8
8
|
"lit-element"
|
|
9
9
|
],
|
|
10
|
-
"license": "SEE LICENSE IN LICENSE.
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
11
11
|
"author": "apex-grid",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
"./define": {
|
|
18
18
|
"types": "./define.d.ts",
|
|
19
19
|
"default": "./define.js"
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"./styles.css": "./styles.css"
|
|
21
22
|
},
|
|
22
23
|
"type": "module",
|
|
23
24
|
"sideEffects": false,
|
|
24
25
|
"repository": {
|
|
25
26
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/apexcharts/
|
|
27
|
+
"url": "git+https://github.com/apexcharts/apex-grid.git"
|
|
27
28
|
},
|
|
28
29
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/apexcharts/
|
|
30
|
+
"url": "https://github.com/apexcharts/apex-grid/issues"
|
|
30
31
|
},
|
|
31
32
|
"engines": {
|
|
32
33
|
"node": ">=20"
|
package/setup.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
type ApexGridTheme = 'bootstrap' | 'material' | 'fluent' | 'indigo';
|
|
2
|
+
export interface ApexGridSetupOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Ignite UI theme to activate. The matching theme CSS file
|
|
5
|
+
* (`igniteui-webcomponents/themes/<variant>/<theme>.css`) must still be
|
|
6
|
+
* imported by the consumer — there is no portable way to dynamically
|
|
7
|
+
* import a CSS file across bundlers.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue 'bootstrap'
|
|
10
|
+
*/
|
|
11
|
+
theme?: ApexGridTheme;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to adopt a default host stylesheet that sets `height: 100%`
|
|
14
|
+
* with a `min-height: 240px` fallback. Set to `false` if you want to
|
|
15
|
+
* provide your own host sizing.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue true
|
|
18
|
+
*/
|
|
19
|
+
hostStyles?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One-call convenience: registers `<apex-grid>`, configures the Ignite UI
|
|
23
|
+
* theme, and adopts a default host stylesheet so the virtualizer has a
|
|
24
|
+
* bounded height.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* This is an **additive** alternative to the manual three-import setup
|
|
28
|
+
* (`apex-grid/define` + `configureTheme()` + host CSS). It does NOT
|
|
29
|
+
* import the Ignite theme CSS file for you — that import is consumer
|
|
30
|
+
* responsibility because dynamic CSS imports are not portable across
|
|
31
|
+
* bundlers. So the full setup with `setup()` is:
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { setup } from 'apex-grid';
|
|
35
|
+
* import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
36
|
+
*
|
|
37
|
+
* setup({ theme: 'bootstrap' });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Idempotent — safe to call more than once. Host styles are adopted
|
|
41
|
+
* only on the first call. For full manual control use
|
|
42
|
+
* `import 'apex-grid/define'` and configure the theme yourself; this
|
|
43
|
+
* helper is a shortcut, not a replacement.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { setup } from 'apex-grid';
|
|
48
|
+
* import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
49
|
+
* setup({ theme: 'bootstrap' });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example Opt out of injected host styles:
|
|
53
|
+
* ```ts
|
|
54
|
+
* setup({ theme: 'material', hostStyles: false });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function setup(options?: ApexGridSetupOptions): void;
|
|
58
|
+
export {};
|
package/setup.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { configureTheme } from 'igniteui-webcomponents';
|
|
2
|
+
import { ApexGrid } from './components/grid.js';
|
|
3
|
+
const HOST_CSS = 'apex-grid { height: 100%; min-height: 240px; }';
|
|
4
|
+
let hostStylesInjected = false;
|
|
5
|
+
function adoptHostStyles() {
|
|
6
|
+
if (hostStylesInjected || typeof document === 'undefined')
|
|
7
|
+
return;
|
|
8
|
+
if ('adoptedStyleSheets' in Document.prototype && 'replaceSync' in CSSStyleSheet.prototype) {
|
|
9
|
+
const sheet = new CSSStyleSheet();
|
|
10
|
+
sheet.replaceSync(HOST_CSS);
|
|
11
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const style = document.createElement('style');
|
|
15
|
+
style.setAttribute('data-apex-grid', 'host-styles');
|
|
16
|
+
style.textContent = HOST_CSS;
|
|
17
|
+
document.head.appendChild(style);
|
|
18
|
+
}
|
|
19
|
+
hostStylesInjected = true;
|
|
20
|
+
}
|
|
21
|
+
export function setup(options = {}) {
|
|
22
|
+
const { theme = 'bootstrap', hostStyles = true } = options;
|
|
23
|
+
ApexGrid.register();
|
|
24
|
+
configureTheme(theme);
|
|
25
|
+
if (hostStyles) {
|
|
26
|
+
adoptHostStyles();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=setup.js.map
|
package/setup.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAyBhD,MAAM,QAAQ,GAAG,gDAAgD,CAAC;AAClE,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B,SAAS,eAAe;IACtB,IAAI,kBAAkB,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAElE,IAAI,oBAAoB,IAAI,QAAQ,CAAC,SAAS,IAAI,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAC3F,MAAM,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,QAAQ,CAAC,kBAAkB,GAAG,CAAC,GAAG,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9C,KAAK,CAAC,YAAY,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;QACpD,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,kBAAkB,GAAG,IAAI,CAAC;AAC5B,CAAC;AAsCD,MAAM,UAAU,KAAK,CAAC,UAAgC,EAAE;IACtD,MAAM,EAAE,KAAK,GAAG,WAAW,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE3D,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACpB,cAAc,CAAC,KAAK,CAAC,CAAC;IAEtB,IAAI,UAAU,EAAE,CAAC;QACf,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["import { configureTheme } from 'igniteui-webcomponents';\nimport { ApexGrid } from './components/grid.js';\n\ntype ApexGridTheme = 'bootstrap' | 'material' | 'fluent' | 'indigo';\n\nexport interface ApexGridSetupOptions {\n /**\n * Ignite UI theme to activate. The matching theme CSS file\n * (`igniteui-webcomponents/themes/<variant>/<theme>.css`) must still be\n * imported by the consumer — there is no portable way to dynamically\n * import a CSS file across bundlers.\n *\n * @defaultValue 'bootstrap'\n */\n theme?: ApexGridTheme;\n\n /**\n * Whether to adopt a default host stylesheet that sets `height: 100%`\n * with a `min-height: 240px` fallback. Set to `false` if you want to\n * provide your own host sizing.\n *\n * @defaultValue true\n */\n hostStyles?: boolean;\n}\n\nconst HOST_CSS = 'apex-grid { height: 100%; min-height: 240px; }';\nlet hostStylesInjected = false;\n\nfunction adoptHostStyles(): void {\n if (hostStylesInjected || typeof document === 'undefined') return;\n\n if ('adoptedStyleSheets' in Document.prototype && 'replaceSync' in CSSStyleSheet.prototype) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(HOST_CSS);\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];\n } else {\n const style = document.createElement('style');\n style.setAttribute('data-apex-grid', 'host-styles');\n style.textContent = HOST_CSS;\n document.head.appendChild(style);\n }\n\n hostStylesInjected = true;\n}\n\n/**\n * One-call convenience: registers `<apex-grid>`, configures the Ignite UI\n * theme, and adopts a default host stylesheet so the virtualizer has a\n * bounded height.\n *\n * @remarks\n * This is an **additive** alternative to the manual three-import setup\n * (`apex-grid/define` + `configureTheme()` + host CSS). It does NOT\n * import the Ignite theme CSS file for you — that import is consumer\n * responsibility because dynamic CSS imports are not portable across\n * bundlers. So the full setup with `setup()` is:\n *\n * ```ts\n * import { setup } from 'apex-grid';\n * import 'igniteui-webcomponents/themes/light/bootstrap.css';\n *\n * setup({ theme: 'bootstrap' });\n * ```\n *\n * Idempotent — safe to call more than once. Host styles are adopted\n * only on the first call. For full manual control use\n * `import 'apex-grid/define'` and configure the theme yourself; this\n * helper is a shortcut, not a replacement.\n *\n * @example\n * ```ts\n * import { setup } from 'apex-grid';\n * import 'igniteui-webcomponents/themes/light/bootstrap.css';\n * setup({ theme: 'bootstrap' });\n * ```\n *\n * @example Opt out of injected host styles:\n * ```ts\n * setup({ theme: 'material', hostStyles: false });\n * ```\n */\nexport function setup(options: ApexGridSetupOptions = {}): void {\n const { theme = 'bootstrap', hostStyles = true } = options;\n\n ApexGrid.register();\n configureTheme(theme);\n\n if (hostStyles) {\n adoptHostStyles();\n }\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const styles = css `:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);--component-size: 3}:host{position:relative;display:inline-flex;flex:1 0 0;align-items:center;padding:0 max(var(--is-large, 1)*max(1.5rem, -1 * 1.5rem),var(--is-medium, 1)*max(1rem, -1 * 1rem),var(--is-small, 1)*max(0.5rem, -1 * 0.5rem));color:inherit;border-right:var(--igx-row-border-width, var(--row-border-width)) solid rgba(0,0,0,0);font-size:0.8125rem;overflow-wrap:anywhere}:host:last-of-type{border-right:0}:host([active]){outline:none;box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color))}:host(:last-child){border-inline-end:none}
|
|
2
|
+
export const styles = css `:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);--component-size: 3}:host{position:relative;display:inline-flex;flex:1 0 0;align-items:center;padding:0 max(var(--is-large, 1)*max(1.5rem, -1 * 1.5rem),var(--is-medium, 1)*max(1rem, -1 * 1rem),var(--is-small, 1)*max(0.5rem, -1 * 0.5rem));color:inherit;border-right:var(--igx-row-border-width, var(--row-border-width)) solid rgba(0,0,0,0);font-size:0.8125rem;overflow-wrap:anywhere;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host:last-of-type{border-right:0}:host([active]){outline:none;box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color))}:host([editing]){background:var(--igx-cell-editor-background, var(--ig-surface-500, white));z-index:calc(var(--z-index-base) + 2);overflow:hidden;cursor:text}:host([editing][data-pinned=start]),:host([editing][data-pinned=end]){background:var(--igx-cell-editor-background, var(--ig-surface-500, white))}:host([editing][data-cell-type=select]){overflow:visible}:host(:last-child){border-inline-end:none}:host([data-pinned=start]),:host([data-pinned=end]){position:sticky;z-index:calc(var(--z-index-base) + 1);background:inherit}:host([data-pinned=start]){inset-inline-start:var(--apex-pin-offset, 0)}:host([data-pinned=end]){inset-inline-end:var(--apex-pin-offset, 0)}:host([data-pin-edge=start]){box-shadow:.125rem 0 .25rem rgba(0,0,0,.06)}:host([data-pin-edge=end]){box-shadow:-0.125rem 0 .25rem rgba(0,0,0,.06)}:host([active][data-pin-edge=start]){box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color)),.125rem 0 .25rem rgba(0,0,0,.06)}:host([active][data-pin-edge=end]){box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color)),-0.125rem 0 .25rem rgba(0,0,0,.06)}input[data-apex-editor]{box-sizing:border-box;position:absolute;inset:0;width:auto;height:auto;padding:0 max(var(--is-large, 1)*max(1.5rem, -1 * 1.5rem),var(--is-medium, 1)*max(1rem, -1 * 1rem),var(--is-small, 1)*max(0.5rem, -1 * 0.5rem));margin:0;border:0;background:rgba(0,0,0,0);color:inherit;font:inherit;font-size:0.8125rem;outline:none;caret-color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));-webkit-user-select:text;-moz-user-select:text;user-select:text}input[type=number][data-apex-editor]{text-align:end;font-variant-numeric:tabular-nums}input[type=checkbox][data-apex-editor]{position:relative;inset:auto;inline-size:1rem;block-size:1rem;margin:0;border:0;border-radius:0;background:none;box-shadow:none;outline:revert;accent-color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)))}[part~=rating]{display:inline-flex;align-items:center;gap:0.0625rem;color:var(--igx-rating-color, var(--ig-warn-500, #f5a623))}[part~=rating-star]{display:inline-flex;align-items:center;justify-content:center;color:currentcolor;opacity:.25;line-height:0}[part~=rating-star] svg{inline-size:0.875rem;block-size:0.875rem}[part~=rating-star][part~=filled]{opacity:1}[part=rating-editor]{display:inline-flex;align-items:center;gap:0.125rem;padding:0 0.125rem;color:var(--igx-rating-color, var(--ig-warn-500, #f5a623));z-index:calc(var(--z-index-base) + 2)}[part=rating-editor] button[part~=rating-star]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:rgba(0,0,0,0);border:0;margin:0;padding:0.125rem;cursor:pointer;color:currentcolor;opacity:.35;border-radius:0.1875rem}[part=rating-editor] button[part~=rating-star]:hover{opacity:.75}[part=rating-editor] button[part~=rating-star][part~=filled]{opacity:1}[part=rating-editor] button[part~=rating-star]:focus-visible{outline:0.125rem solid var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));outline-offset:-0.0625rem}input[part~=boolean-mark]{inline-size:1rem;block-size:1rem;margin:0;cursor:pointer;accent-color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)))}input[part~=boolean-mark][aria-readonly=true]{cursor:default;pointer-events:none}[part~=select-label]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;inline-size:100%}[part~=select-popover]{position:absolute;inset-block-start:100%;inset-inline-start:0;margin:0.125rem 0 0;padding:0.25rem 0;min-inline-size:100%;background:var(--igx-cell-editor-background, var(--ig-surface-500, white));border:0.0625rem solid hsl(from currentcolor h s l/22%);border-radius:0.25rem;box-shadow:0 0.125rem 0.25rem rgba(0,0,0,.06),0 0.375rem 1rem rgba(0,0,0,.12);max-block-size:15rem;overflow-y:auto;outline:none;z-index:calc(var(--z-index-base) + 10);color:inherit;font:inherit}[part~=select-option]{display:block;padding:0.375rem 0.75rem;cursor:pointer;color:inherit;outline:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[part~=select-option]:hover{background:hsl(from var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500))) h s l/8%)}[part~=select-option][part~=selected]{background:hsl(from var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500))) h s l/14%);color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));font-weight:500}[part~=select-option]:focus-visible{background:hsl(from var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500))) h s l/14%);outline:0.125rem solid var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));outline-offset:-0.125rem}[part~=image]{block-size:calc(100% - 0.5rem);max-block-size:2.5rem;inline-size:auto;aspect-ratio:1/1;-o-object-fit:cover;object-fit:cover;border-radius:0.1875rem;display:block;flex-shrink:0}[part~=image][part~=circle]{border-radius:50%}[part=tree-indent]{flex-shrink:0;display:inline-block}[part=tree-toggle]{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;inline-size:1.5rem;block-size:1.5rem;margin-inline-end:0.25rem;padding:0;border:0;border-radius:50%;background:rgba(0,0,0,0);color:inherit;cursor:pointer;transition:background-color 120ms ease}[part=tree-toggle]:hover{background:hsl(from currentcolor h s l/8%)}[part=tree-toggle]:focus-visible{outline:0.125rem solid var(--igx-cell-active-border-color, var(--cell-active-border-color, var(--ig-primary-500)));outline-offset:0.0625rem}[part=tree-chevron]{transition:transform 160ms ease}:host([data-tree-expanded]) [part=tree-chevron]{transform:rotate(90deg)}[part=tree-spacer]{display:inline-block;flex-shrink:0;inline-size:1.5rem;block-size:1.5rem;margin-inline-end:0.25rem}[part=tree-cell-content]{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`;
|
|
3
3
|
//# sourceMappingURL=body-cell.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-cell.css.js","sourceRoot":"","sources":["../../../src/styles/body-cell/body-cell.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"body-cell.css.js","sourceRoot":"","sources":["../../../src/styles/body-cell/body-cell.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,02NAA02N,CAAC","sourcesContent":["import { css } from 'lit';\nexport const styles = css`:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);--component-size: 3}:host{position:relative;display:inline-flex;flex:1 0 0;align-items:center;padding:0 max(var(--is-large, 1)*max(1.5rem, -1 * 1.5rem),var(--is-medium, 1)*max(1rem, -1 * 1rem),var(--is-small, 1)*max(0.5rem, -1 * 0.5rem));color:inherit;border-right:var(--igx-row-border-width, var(--row-border-width)) solid rgba(0,0,0,0);font-size:0.8125rem;overflow-wrap:anywhere;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host:last-of-type{border-right:0}:host([active]){outline:none;box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color))}:host([editing]){background:var(--igx-cell-editor-background, var(--ig-surface-500, white));z-index:calc(var(--z-index-base) + 2);overflow:hidden;cursor:text}:host([editing][data-pinned=start]),:host([editing][data-pinned=end]){background:var(--igx-cell-editor-background, var(--ig-surface-500, white))}:host([editing][data-cell-type=select]){overflow:visible}:host(:last-child){border-inline-end:none}:host([data-pinned=start]),:host([data-pinned=end]){position:sticky;z-index:calc(var(--z-index-base) + 1);background:inherit}:host([data-pinned=start]){inset-inline-start:var(--apex-pin-offset, 0)}:host([data-pinned=end]){inset-inline-end:var(--apex-pin-offset, 0)}:host([data-pin-edge=start]){box-shadow:.125rem 0 .25rem rgba(0,0,0,.06)}:host([data-pin-edge=end]){box-shadow:-0.125rem 0 .25rem rgba(0,0,0,.06)}:host([active][data-pin-edge=start]){box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color)),.125rem 0 .25rem rgba(0,0,0,.06)}:host([active][data-pin-edge=end]){box-shadow:inset 0 0 0 0.0625rem var(--igx-cell-active-border-color, var(--cell-active-border-color)),-0.125rem 0 .25rem rgba(0,0,0,.06)}input[data-apex-editor]{box-sizing:border-box;position:absolute;inset:0;width:auto;height:auto;padding:0 max(var(--is-large, 1)*max(1.5rem, -1 * 1.5rem),var(--is-medium, 1)*max(1rem, -1 * 1rem),var(--is-small, 1)*max(0.5rem, -1 * 0.5rem));margin:0;border:0;background:rgba(0,0,0,0);color:inherit;font:inherit;font-size:0.8125rem;outline:none;caret-color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));-webkit-user-select:text;-moz-user-select:text;user-select:text}input[type=number][data-apex-editor]{text-align:end;font-variant-numeric:tabular-nums}input[type=checkbox][data-apex-editor]{position:relative;inset:auto;inline-size:1rem;block-size:1rem;margin:0;border:0;border-radius:0;background:none;box-shadow:none;outline:revert;accent-color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)))}[part~=rating]{display:inline-flex;align-items:center;gap:0.0625rem;color:var(--igx-rating-color, var(--ig-warn-500, #f5a623))}[part~=rating-star]{display:inline-flex;align-items:center;justify-content:center;color:currentcolor;opacity:.25;line-height:0}[part~=rating-star] svg{inline-size:0.875rem;block-size:0.875rem}[part~=rating-star][part~=filled]{opacity:1}[part=rating-editor]{display:inline-flex;align-items:center;gap:0.125rem;padding:0 0.125rem;color:var(--igx-rating-color, var(--ig-warn-500, #f5a623));z-index:calc(var(--z-index-base) + 2)}[part=rating-editor] button[part~=rating-star]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:rgba(0,0,0,0);border:0;margin:0;padding:0.125rem;cursor:pointer;color:currentcolor;opacity:.35;border-radius:0.1875rem}[part=rating-editor] button[part~=rating-star]:hover{opacity:.75}[part=rating-editor] button[part~=rating-star][part~=filled]{opacity:1}[part=rating-editor] button[part~=rating-star]:focus-visible{outline:0.125rem solid var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));outline-offset:-0.0625rem}input[part~=boolean-mark]{inline-size:1rem;block-size:1rem;margin:0;cursor:pointer;accent-color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)))}input[part~=boolean-mark][aria-readonly=true]{cursor:default;pointer-events:none}[part~=select-label]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;inline-size:100%}[part~=select-popover]{position:absolute;inset-block-start:100%;inset-inline-start:0;margin:0.125rem 0 0;padding:0.25rem 0;min-inline-size:100%;background:var(--igx-cell-editor-background, var(--ig-surface-500, white));border:0.0625rem solid hsl(from currentcolor h s l/22%);border-radius:0.25rem;box-shadow:0 0.125rem 0.25rem rgba(0,0,0,.06),0 0.375rem 1rem rgba(0,0,0,.12);max-block-size:15rem;overflow-y:auto;outline:none;z-index:calc(var(--z-index-base) + 10);color:inherit;font:inherit}[part~=select-option]{display:block;padding:0.375rem 0.75rem;cursor:pointer;color:inherit;outline:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[part~=select-option]:hover{background:hsl(from var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500))) h s l/8%)}[part~=select-option][part~=selected]{background:hsl(from var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500))) h s l/14%);color:var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));font-weight:500}[part~=select-option]:focus-visible{background:hsl(from var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500))) h s l/14%);outline:0.125rem solid var(--igx-cell-editor-accent-color, var(--cell-active-border-color, var(--ig-primary-500)));outline-offset:-0.125rem}[part~=image]{block-size:calc(100% - 0.5rem);max-block-size:2.5rem;inline-size:auto;aspect-ratio:1/1;-o-object-fit:cover;object-fit:cover;border-radius:0.1875rem;display:block;flex-shrink:0}[part~=image][part~=circle]{border-radius:50%}[part=tree-indent]{flex-shrink:0;display:inline-block}[part=tree-toggle]{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;inline-size:1.5rem;block-size:1.5rem;margin-inline-end:0.25rem;padding:0;border:0;border-radius:50%;background:rgba(0,0,0,0);color:inherit;cursor:pointer;transition:background-color 120ms ease}[part=tree-toggle]:hover{background:hsl(from currentcolor h s l/8%)}[part=tree-toggle]:focus-visible{outline:0.125rem solid var(--igx-cell-active-border-color, var(--cell-active-border-color, var(--ig-primary-500)));outline-offset:0.0625rem}[part=tree-chevron]{transition:transform 160ms ease}:host([data-tree-expanded]) [part=tree-chevron]{transform:rotate(90deg)}[part=tree-spacer]{display:inline-block;flex-shrink:0;inline-size:1.5rem;block-size:1.5rem;margin-inline-end:0.25rem}[part=tree-cell-content]{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`;"]}
|