@ornery/ui-grid-vanilla 5.0.0 → 5.0.1

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.
@@ -1,4 +1,4 @@
1
- // ../ui-grid-core/src/lib/grid.utils.ts
1
+ // ../ui-grid-core/dist/index.mjs
2
2
  var uid = 0;
3
3
  var PROTECTED_PATH_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
4
4
  function nextUid(prefix = "grid") {
@@ -78,8 +78,6 @@ function toCsvValue(value, separator = ",") {
78
78
  }
79
79
  return value;
80
80
  }
81
-
82
- // ../ui-grid-core/src/lib/grid.core.display.ts
83
81
  function buildGridCellContext(row, column) {
84
82
  const value = getCellValue(row.entity, column);
85
83
  return {
@@ -96,8 +94,6 @@ function formatGridCellDisplayValue(context) {
96
94
  }
97
95
  return context.column.formatter ? context.column.formatter(context.value, context.row) : stringifyCellValue(context.value);
98
96
  }
99
-
100
- // ../ui-grid-core/src/lib/grid.core.edit.ts
101
97
  function beginGridEditSession(rowId, columnName, editingValue) {
102
98
  const position = { rowId, columnName };
103
99
  return {
@@ -176,8 +172,6 @@ function parseGridEditedValue(column, value, oldValue) {
176
172
  return value;
177
173
  }
178
174
  }
179
-
180
- // ../ui-grid-core/src/lib/grid.core.export.ts
181
175
  function headerLabel(column) {
182
176
  return column.displayName ?? titleize(column.name);
183
177
  }
@@ -441,8 +435,6 @@ function resolveGridExporterOptions(options) {
441
435
  showHeader: options.exporterShowHeader
442
436
  };
443
437
  }
444
-
445
- // ../ui-grid-core/src/lib/grid.core.exporter-menu.ts
446
438
  function buildGridExporterMenuItems(options, labels, actions, hasSelection = () => false) {
447
439
  const baseOrder = options.exporterMenuItemOrder ?? 200;
448
440
  const menuCsv = options.exporterMenuCsv !== false;
@@ -517,8 +509,6 @@ function buildGridExporterMenuItems(options, labels, actions, hasSelection = ()
517
509
  }
518
510
  return items;
519
511
  }
520
-
521
- // ../ui-grid-core/src/lib/grid.core.importer.ts
522
512
  function resolveGridImporterOptions(options) {
523
513
  return {
524
514
  enable: options.enableImporter,
@@ -678,8 +668,6 @@ function buildGridImporterObjectsFromJson(parsed, options) {
678
668
  }
679
669
  return result;
680
670
  }
681
-
682
- // ../ui-grid-core/src/lib/grid.core.importer-menu.ts
683
671
  function buildGridImporterMenuItems(options, labels, actions) {
684
672
  if (options.enableImporter !== true) return [];
685
673
  if (options.importerShowMenu === false) return [];
@@ -693,8 +681,6 @@ function buildGridImporterMenuItems(options, labels, actions) {
693
681
  }
694
682
  ];
695
683
  }
696
-
697
- // ../ui-grid-core/src/lib/grid.core.row-edit-menu.ts
698
684
  function buildGridRowEditMenuItems(options, labels, actions, predicates) {
699
685
  const baseOrder = options.rowEditMenuItemOrder ?? 300;
700
686
  const menuFlush = options.rowEditMenuFlushDirtyRows !== false;
@@ -722,8 +708,6 @@ function buildGridRowEditMenuItems(options, labels, actions, predicates) {
722
708
  }
723
709
  return items;
724
710
  }
725
-
726
- // ../ui-grid-core/src/lib/grid.core.validate.ts
727
711
  var GridValidatorRegistry = class {
728
712
  entries = /* @__PURE__ */ new Map();
729
713
  setValidator(name, validatorFactory, messageFunction) {
@@ -863,8 +847,6 @@ async function validateAllGridRows(rowEntities, columnDefs, registry) {
863
847
  }
864
848
  return [...invalidRows];
865
849
  }
866
-
867
- // ../ui-grid-core/src/lib/i18n/en-US.json
868
850
  var en_US_default = {
869
851
  sortDefault: "Sort",
870
852
  sortAsc: "Sort ascending",
@@ -918,8 +900,6 @@ var en_US_default = {
918
900
  rowEditFlushAll: "Save changes",
919
901
  rowEditRetryErrors: "Retry errored rows"
920
902
  };
921
-
922
- // ../ui-grid-core/src/lib/grid.models.ts
923
903
  var DEFAULT_GRID_LABELS = en_US_default;
924
904
  var GridRow = class {
925
905
  constructor(id, entity, index, height = 44) {
@@ -977,8 +957,6 @@ var GridRow = class {
977
957
  this.visible = this.invisibleReasons.size === 0;
978
958
  }
979
959
  };
980
-
981
- // ../ui-grid-core/src/lib/i18n/es.json
982
960
  var es_default = {
983
961
  sortDefault: "Ordenar",
984
962
  sortAsc: "Ordenar ascendente",
@@ -1032,8 +1010,6 @@ var es_default = {
1032
1010
  rowEditFlushAll: "Guardar cambios",
1033
1011
  rowEditRetryErrors: "Reintentar filas con error"
1034
1012
  };
1035
-
1036
- // ../ui-grid-core/src/lib/i18n/fr.json
1037
1013
  var fr_default = {
1038
1014
  sortDefault: "Trier",
1039
1015
  sortAsc: "Tri croissant",
@@ -1087,8 +1063,6 @@ var fr_default = {
1087
1063
  rowEditFlushAll: "Enregistrer les modifications",
1088
1064
  rowEditRetryErrors: "R\xE9essayer les lignes en erreur"
1089
1065
  };
1090
-
1091
- // ../ui-grid-core/src/lib/i18n/de.json
1092
1066
  var de_default = {
1093
1067
  sortDefault: "Sortieren",
1094
1068
  sortAsc: "Aufsteigend sortieren",
@@ -1142,8 +1116,6 @@ var de_default = {
1142
1116
  rowEditFlushAll: "\xC4nderungen speichern",
1143
1117
  rowEditRetryErrors: "Fehlerhafte Zeilen erneut versuchen"
1144
1118
  };
1145
-
1146
- // ../ui-grid-core/src/lib/i18n/ja.json
1147
1119
  var ja_default = {
1148
1120
  sortDefault: "\u4E26\u3079\u66FF\u3048",
1149
1121
  sortAsc: "\u6607\u9806\u3067\u4E26\u3079\u66FF\u3048",
@@ -1197,8 +1169,6 @@ var ja_default = {
1197
1169
  rowEditFlushAll: "\u5909\u66F4\u3092\u4FDD\u5B58",
1198
1170
  rowEditRetryErrors: "\u30A8\u30E9\u30FC\u884C\u3092\u518D\u8A66\u884C"
1199
1171
  };
1200
-
1201
- // ../ui-grid-core/src/lib/i18n/zh-CN.json
1202
1172
  var zh_CN_default = {
1203
1173
  sortDefault: "\u6392\u5E8F",
1204
1174
  sortAsc: "\u5347\u5E8F\u6392\u5E8F",
@@ -1252,8 +1222,6 @@ var zh_CN_default = {
1252
1222
  rowEditFlushAll: "\u4FDD\u5B58\u66F4\u6539",
1253
1223
  rowEditRetryErrors: "\u91CD\u8BD5\u9519\u8BEF\u884C"
1254
1224
  };
1255
-
1256
- // ../ui-grid-core/src/lib/grid.core.i18n.ts
1257
1225
  var GridI18nService = class {
1258
1226
  locales = /* @__PURE__ */ new Map();
1259
1227
  currentLang = "en-US";
@@ -1312,8 +1280,6 @@ var GridI18nService = class {
1312
1280
  }
1313
1281
  };
1314
1282
  var gridI18n = new GridI18nService();
1315
-
1316
- // ../ui-grid-core/src/lib/grid.constants.ts
1317
1283
  var SORT_DIRECTIONS = {
1318
1284
  asc: "asc",
1319
1285
  desc: "desc",
@@ -1330,8 +1296,6 @@ var FILTER_CONDITIONS = {
1330
1296
  lessThan: "lessThan",
1331
1297
  lessThanOrEqual: "lessThanOrEqual"
1332
1298
  };
1333
-
1334
- // ../ui-grid-core/src/lib/row-searcher.ts
1335
1299
  function escapeRegExp(value) {
1336
1300
  return value.replace(/[|\\{}()[\]^$+?*.]/g, "\\$&").replace(/-/g, "\\x2d");
1337
1301
  }
@@ -1461,8 +1425,6 @@ function runColumnFilter(row, column, filter) {
1461
1425
  return true;
1462
1426
  }
1463
1427
  }
1464
-
1465
- // ../ui-grid-core/src/lib/grid.core.filtering.ts
1466
1428
  function isFilteringEnabled(options) {
1467
1429
  return options.enableFiltering !== false;
1468
1430
  }
@@ -1526,8 +1488,6 @@ function matchesGridRowFilters(row, columns, options, activeFilters) {
1526
1488
  }
1527
1489
  return matchesGridRowPreparedFilters(row, prepared);
1528
1490
  }
1529
-
1530
- // ../ui-grid-core/src/lib/grid.core.grouping.ts
1531
1491
  function isGroupingEnabled(options) {
1532
1492
  return options.enableGrouping === true && options.enableTreeView !== true;
1533
1493
  }
@@ -1585,8 +1545,6 @@ function buildGridDisplayItems(rows, columns, options, groupBy, collapsedGroups)
1585
1545
  }
1586
1546
  return buildGroupedItems(rows, columns, options, groupBy, collapsedGroups, 0, "");
1587
1547
  }
1588
-
1589
- // ../ui-grid-core/src/lib/grid.core.identity.ts
1590
1548
  function resolveGridRowId(options, row) {
1591
1549
  if (typeof row === "string") {
1592
1550
  return row;
@@ -1607,8 +1565,6 @@ function buildGridSortState(columnName, direction) {
1607
1565
  direction: direction ?? SORT_DIRECTIONS.asc
1608
1566
  };
1609
1567
  }
1610
-
1611
- // ../ui-grid-core/src/lib/grid.core.infinite-scroll.ts
1612
1568
  function maybeRequestInfiniteScrollData(context) {
1613
1569
  if (context.state.dataLoading) {
1614
1570
  return { request: null, nextState: context.state };
@@ -1664,8 +1620,6 @@ function setInfiniteScrollDirectionsState(state, scrollUp, scrollDown) {
1664
1620
  scrollDown
1665
1621
  };
1666
1622
  }
1667
-
1668
- // ../ui-grid-core/src/lib/grid.core.pagination.ts
1669
1623
  function isPaginationEnabled(options) {
1670
1624
  return options.enablePagination === true || (options.paginationPageSize ?? 0) > 0;
1671
1625
  }
@@ -1729,8 +1683,6 @@ function seekGridPage(page, totalPages) {
1729
1683
  function resolveGridPageSize(pageSize) {
1730
1684
  return Number.isFinite(pageSize) && pageSize > 0 ? pageSize : null;
1731
1685
  }
1732
-
1733
- // ../ui-grid-core/src/lib/grid.core.pinning.ts
1734
1686
  function isPinningEnabled(options) {
1735
1687
  return options.enablePinning === true;
1736
1688
  }
@@ -1796,15 +1748,11 @@ function computePinnedOffset(visibleColumns, pinnedColumns, column) {
1796
1748
  }
1797
1749
  return null;
1798
1750
  }
1799
-
1800
- // ../ui-grid-core/src/lib/grid.features.ts
1801
1751
  var FEATURE_SORTING = true;
1802
1752
  var FEATURE_FILTERING = true;
1803
1753
  var FEATURE_GROUPING = true;
1804
1754
  var FEATURE_PAGINATION = true;
1805
1755
  var FEATURE_TREE_VIEW = true;
1806
-
1807
- // ../ui-grid-core/src/lib/row-sorter.ts
1808
1756
  function handleNulls(left, right) {
1809
1757
  if (left === void 0 || left === null || right === void 0 || right === null) {
1810
1758
  if ((left === void 0 || left === null) && (right === void 0 || right === null)) {
@@ -1902,8 +1850,6 @@ function getSortFn(column, rows) {
1902
1850
  const sampleValues = rows.map((row) => getCellValue(row, column));
1903
1851
  return guessSortFn(sampleValues);
1904
1852
  }
1905
-
1906
- // ../ui-grid-core/src/lib/grid.core.sorting.ts
1907
1853
  function isSortingEnabled(options) {
1908
1854
  return options.enableSorting !== false;
1909
1855
  }
@@ -1923,8 +1869,6 @@ function sortGridRows(rows, columns, options, sortState) {
1923
1869
  return sortFn(leftValue, rightValue) * directionMultiplier;
1924
1870
  });
1925
1871
  }
1926
-
1927
- // ../ui-grid-core/src/lib/grid.core.tree.ts
1928
1872
  function isTreeEnabled(options) {
1929
1873
  return options.enableTreeView === true;
1930
1874
  }
@@ -2026,8 +1970,6 @@ function filterAndFlattenGridTreeRows(rows, columns, options, activeFilters, exp
2026
1970
  flatten(null);
2027
1971
  return flattened;
2028
1972
  }
2029
-
2030
- // ../ui-grid-core/src/lib/grid.core.pipeline.ts
2031
1973
  var rowsCache = null;
2032
1974
  function buildGridRowsCached(context) {
2033
1975
  const dataRef = context.options.data;
@@ -2099,8 +2041,6 @@ function buildGridPipeline(context) {
2099
2041
  totalItems
2100
2042
  };
2101
2043
  }
2102
-
2103
- // ../ui-grid-core/src/lib/grid.core.row-edit.ts
2104
2044
  function createGridRowEditState() {
2105
2045
  return {
2106
2046
  dirtyRowIds: /* @__PURE__ */ new Set(),
@@ -2145,8 +2085,6 @@ function isGridRowEditTimerEnabled(waitInterval) {
2145
2085
  function resolveGridRowEditWaitInterval(waitInterval) {
2146
2086
  return waitInterval && waitInterval > 0 ? waitInterval : 2e3;
2147
2087
  }
2148
-
2149
- // ../ui-grid-core/src/lib/grid.core.row-state.ts
2150
2088
  function toggleGridRowExpanded(expandedRows, rowId) {
2151
2089
  const expanded = !expandedRows[rowId];
2152
2090
  return {
@@ -2186,8 +2124,6 @@ function expandAllGridTreeRows(rows) {
2186
2124
  }
2187
2125
  return nextExpandedTreeRows;
2188
2126
  }
2189
-
2190
- // ../ui-grid-core/src/lib/grid.core.selection.ts
2191
2127
  function createGridSelectionState() {
2192
2128
  return {
2193
2129
  selectedRowIds: /* @__PURE__ */ new Set(),
@@ -2365,13 +2301,9 @@ function mapSelectedRowsToEntities(rows) {
2365
2301
  }
2366
2302
  return out;
2367
2303
  }
2368
-
2369
- // ../ui-grid-core/src/lib/grid.core.state.ts
2370
2304
  function sanitizeDownloadFilename(value) {
2371
2305
  return value.replace(/[^a-zA-Z0-9._-]+/g, "_").replace(/^_+|_+$/g, "") || "ui-grid";
2372
2306
  }
2373
-
2374
- // ../ui-grid-core/src/lib/grid.core.viewmodel.ts
2375
2307
  function resolveGridLabels(overrides) {
2376
2308
  const localeLabels = gridI18n.getCurrentLabels();
2377
2309
  if (!overrides) return localeLabels;
@@ -2476,8 +2408,6 @@ function gridTreeToggleLabelForRow(expandedTreeRows, row, labels) {
2476
2408
  function gridExpandToggleLabelForRow(row, labels) {
2477
2409
  return gridExpandToggleLabel(row.expanded, labels);
2478
2410
  }
2479
-
2480
- // ../ui-grid-core/src/lib/ui-grid.wasm-path.ts
2481
2411
  var uiGridWasmWebModuleRelativePath = "dist/ui-grid-wasm-web/ui_grid_wasm.js";
2482
2412
  var uiGridWasmWebBinaryRelativePath = "dist/ui-grid-wasm-web/ui_grid_wasm_bg.wasm";
2483
2413
  var configuredUiGridWasmAssetBase = null;
@@ -2511,8 +2441,6 @@ function getUiGridWasmModulePath() {
2511
2441
  function getUiGridWasmBinaryPath() {
2512
2442
  return resolveUiGridWasmAssetUrl(uiGridWasmWebBinaryRelativePath);
2513
2443
  }
2514
-
2515
- // ../ui-grid-core/src/lib/grid.core.wasm-bridge.ts
2516
2444
  var defaultWasmSerializationAuditOptions = {
2517
2445
  enabled: true,
2518
2446
  maxDepth: 4,
@@ -2666,7 +2594,9 @@ function emitWasmSerializationAudit(methodName, result, extra = {}) {
2666
2594
  const signature = JSON.stringify({
2667
2595
  methodName,
2668
2596
  estimatedBytesBucket: Math.floor(result.estimatedBytes / 1024),
2669
- issues: result.issues.map((issue) => `${issue.path}:${issue.kind}:${issue.constructorName ?? ""}`)
2597
+ issues: result.issues.map(
2598
+ (issue) => `${issue.path}:${issue.kind}:${issue.constructorName ?? ""}`
2599
+ )
2670
2600
  });
2671
2601
  if (wasmSerializationAuditOptions.warnOnce && warnedWasmAuditKeys.has(signature)) {
2672
2602
  return;
@@ -2726,7 +2656,9 @@ function hasUnsupportedFilterCondition(column) {
2726
2656
  return condition instanceof RegExp || typeof condition === "function";
2727
2657
  }
2728
2658
  function shouldFallbackFiltering(columns) {
2729
- return columns.some((column) => hasColumnCallbacks(column) || hasUnsupportedFilterCondition(column));
2659
+ return columns.some(
2660
+ (column) => hasColumnCallbacks(column) || hasUnsupportedFilterCondition(column)
2661
+ );
2730
2662
  }
2731
2663
  function normalizeColumnForWasm(column) {
2732
2664
  return {
@@ -2756,9 +2688,6 @@ function normalizeOptionsForWasm(options) {
2756
2688
  function shouldFallbackTree(options, columns) {
2757
2689
  return shouldFallbackFiltering(columns);
2758
2690
  }
2759
- function shouldFallbackResolveRowId(options, row) {
2760
- return typeof options.rowIdentity === "function" && typeof row === "object" && row !== null && !("entity" in row);
2761
- }
2762
2691
  var buildGridCellContext2 = (...args) => buildGridCellContext(...args);
2763
2692
  var formatGridCellDisplayValue2 = (...args) => formatGridCellDisplayValue(...args);
2764
2693
  var buildGridHeaderContext2 = (...args) => buildGridHeaderContext(...args);
@@ -2872,26 +2801,12 @@ var sanitizeDownloadFilename2 = (value) => withWasm(
2872
2801
  (wasm) => wasm.sanitize_download_filename_js(value),
2873
2802
  () => sanitizeDownloadFilename(value)
2874
2803
  );
2875
- var findGridRowById2 = (rows, rowId) => withWasm(
2876
- (wasm) => wasm.find_grid_row_by_id_js({ rows, rowId }),
2877
- () => findGridRowById(rows, rowId)
2878
- );
2804
+ var findGridRowById2 = findGridRowById;
2879
2805
  var buildGridSortState2 = (columnName, direction) => withWasm(
2880
2806
  (wasm) => wasm.build_grid_sort_state_js({ columnName, direction: direction ?? null }),
2881
2807
  () => buildGridSortState(columnName, direction)
2882
2808
  );
2883
- var resolveGridRowId2 = (options, row) => withWasm(
2884
- (wasm) => {
2885
- if (shouldFallbackResolveRowId(options, row)) {
2886
- return resolveGridRowId(options, row);
2887
- }
2888
- return wasm.resolve_grid_row_id_js({
2889
- options: normalizeOptionsForWasm(options),
2890
- row
2891
- });
2892
- },
2893
- () => resolveGridRowId(options, row)
2894
- );
2809
+ var resolveGridRowId2 = resolveGridRowId;
2895
2810
  var maybeRequestInfiniteScrollData2 = (context) => withWasm(
2896
2811
  (wasm) => wasm.maybe_request_infinite_scroll_data_js(context),
2897
2812
  () => maybeRequestInfiniteScrollData(context)
@@ -2972,8 +2887,6 @@ var markGridRowSaving2 = markGridRowSaving;
2972
2887
  var markGridRowError2 = markGridRowError;
2973
2888
  var isGridRowEditTimerEnabled2 = isGridRowEditTimerEnabled;
2974
2889
  var resolveGridRowEditWaitInterval2 = resolveGridRowEditWaitInterval;
2975
-
2976
- // ../ui-grid-core/src/lib/grid.api.ts
2977
2890
  var GridEvent = class {
2978
2891
  listeners = /* @__PURE__ */ new Set();
2979
2892
  subscribe(listener) {
@@ -3355,8 +3268,6 @@ function createGridApi(bindings) {
3355
3268
  };
3356
3269
  return api;
3357
3270
  }
3358
-
3359
- // ../ui-grid-core/src/lib/grid.core.template-interpolate.ts
3360
3271
  function interpolateGridTemplate(templateMarkup, context, escape) {
3361
3272
  return templateMarkup.replace(/{{\s*([^}]+?)\s*}}/g, (_match, expression) => {
3362
3273
  const value = resolveGridTemplateValue(context, String(expression).trim());
@@ -3378,8 +3289,6 @@ function resolveGridTemplateValue(context, expression) {
3378
3289
  }
3379
3290
  return current ?? "";
3380
3291
  }
3381
-
3382
- // ../ui-grid-core/src/lib/ui-grid.events.ts
3383
3292
  function raiseGridSortChanged(gridApi, sortState) {
3384
3293
  gridApi.core.raise.sortChanged(sortState.columnName, sortState.direction);
3385
3294
  }
@@ -3417,8 +3326,6 @@ function raiseGridCancelCellEdit(gridApi, rowEntity, column) {
3417
3326
  function raiseGridColumnPinned(gridApi, columnName, direction) {
3418
3327
  gridApi.pinning.raise.columnPinned(columnName, direction);
3419
3328
  }
3420
-
3421
- // ../ui-grid-core/src/lib/ui-grid.state.ts
3422
3329
  function moveArrayItem(items, fromIndex, toIndex) {
3423
3330
  const next = [...items];
3424
3331
  const [item] = next.splice(fromIndex, 1);
@@ -3451,8 +3358,6 @@ function moveGridVisibleColumnOrderState(currentOrder, visibleColumnNames, colum
3451
3358
  }
3452
3359
  return nextOrder;
3453
3360
  }
3454
-
3455
- // ../ui-grid-core/src/lib/ui-grid.commands.ts
3456
3361
  function applyGridSortStateCommand(gridApi, setSortState, sortState) {
3457
3362
  setSortState(sortState);
3458
3363
  raiseGridSortChanged(gridApi, sortState);
@@ -3605,8 +3510,6 @@ function cancelGridCellEditCommand(gridApi, access) {
3605
3510
  raiseGridCancelCellEdit(gridApi, row.entity, column);
3606
3511
  return { focusTarget: editingCell };
3607
3512
  }
3608
-
3609
- // ../ui-grid-core/src/lib/ui-grid.engine.ts
3610
3513
  var registeredRustWasmBindings = null;
3611
3514
  function activeGridEngineBackend() {
3612
3515
  return registeredRustWasmBindings ? "rust-wasm" : "typescript";
@@ -3620,16 +3523,12 @@ var RustBackedGridEngine = class {
3620
3523
  }
3621
3524
  };
3622
3525
  var defaultGridEngine = new RustBackedGridEngine();
3623
-
3624
- // ../ui-grid-core/src/lib/ui-grid.engine.wasm.ts
3625
3526
  async function enableUiGridWasmEngine() {
3626
3527
  const ready = await initWasmCore();
3627
3528
  if (!ready) {
3628
3529
  throw new Error("Failed to initialize UI Grid WASM module");
3629
3530
  }
3630
3531
  }
3631
-
3632
- // ../ui-grid-core/src/lib/ui-grid.host.ts
3633
3532
  function downloadGridCsvFile(csv, filename) {
3634
3533
  if (typeof Blob === "undefined" || typeof URL === "undefined" || typeof document === "undefined") {
3635
3534
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornery/ui-grid-vanilla",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Vanilla DOM wrapper for the Rust/WASM-backed @ornery/ui-grid-core custom element",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -26,9 +26,10 @@
26
26
  "./browser/ui-grid-element.js": "./dist/browser/ui-grid-element.js"
27
27
  },
28
28
  "dependencies": {
29
- "@ornery/ui-grid-core": "5.0.0"
29
+ "@ornery/ui-grid-core": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
32
+ "@ornery/ui-grid-core": "file:../ui-grid-core",
32
33
  "happy-dom": "^20.10.6",
33
34
  "jsdom": "^29.1.1",
34
35
  "sass": "^1.101.0",
@@ -1,6 +1,6 @@
1
1
  import { afterEach, beforeEach, describe, expect, it } from 'vitest';
2
2
 
3
- import { clearRustWasmGridEngine } from '@ornery/ui-grid-core';
3
+ import { clearRustWasmGridEngine, initWasmCore } from '@ornery/ui-grid-core';
4
4
 
5
5
  import {
6
6
  mountVanillaUiGrid,
@@ -89,7 +89,7 @@ async function mountGrid(options: GridOptions): Promise<{
89
89
  const target = document.getElementById('app')!;
90
90
  const grid = await mountVanillaUiGrid(target, options, undefined, TAG);
91
91
  const shadow = await waitFor(() => grid.shadowRoot);
92
- await waitFor(() => shadow.querySelector('.body-cell[data-row="r1"][data-column="name"]'));
92
+ await waitFor(() => shadow.querySelector('.body-cell[data-column="name"]'));
93
93
  return { grid, shadow };
94
94
  }
95
95
 
@@ -214,11 +214,7 @@ describe('cell selection state retention', () => {
214
214
  // the cell entirely.
215
215
  const projected = document.createElement('span');
216
216
  projected.className = 'projected-cell';
217
- const path: EventTarget[] = [
218
- projected,
219
- targetCell,
220
- shadow,
221
- ];
217
+ const path: EventTarget[] = [projected, targetCell, shadow];
222
218
  const event = new MouseEvent('click', {
223
219
  bubbles: true,
224
220
  cancelable: true,
@@ -260,8 +256,7 @@ describe('row selection + expand patch correctness', () => {
260
256
  return baseOptions({
261
257
  enableRowSelection: true,
262
258
  enableExpandable: true,
263
- expandableRowTemplate:
264
- template as unknown as GridOptions['expandableRowTemplate'],
259
+ expandableRowTemplate: template as unknown as GridOptions['expandableRowTemplate'],
265
260
  });
266
261
  }
267
262
 
@@ -387,9 +382,7 @@ describe('row selection + expand patch correctness', () => {
387
382
  const options = selectionExpandOptions();
388
383
  options.enableCellEdit = true;
389
384
  options.columnDefs = options.columnDefs.map((c) =>
390
- c.name === 'name'
391
- ? { ...c, enableCellEdit: true, validators: { required: true } }
392
- : c,
385
+ c.name === 'name' ? { ...c, enableCellEdit: true, validators: { required: true } } : c,
393
386
  );
394
387
 
395
388
  const { shadow } = await mountGrid(options);
@@ -405,15 +398,38 @@ describe('row selection + expand patch correctness', () => {
405
398
  await waitFor(() =>
406
399
  shadow.querySelector('.body-cell[data-row="r1"][data-column="name"].ui-grid-cell-invalid'),
407
400
  );
408
- expect(
409
- cellIn(shadow, 'r1', 'name').classList.contains('ui-grid-cell-invalid'),
410
- ).toBe(true);
401
+ expect(cellIn(shadow, 'r1', 'name').classList.contains('ui-grid-cell-invalid')).toBe(true);
411
402
  // Other rows / columns must NOT be flagged.
412
- expect(
413
- cellIn(shadow, 'r1', 'status').classList.contains('ui-grid-cell-invalid'),
414
- ).toBe(false);
415
- expect(
416
- cellIn(shadow, 'r2', 'name').classList.contains('ui-grid-cell-invalid'),
417
- ).toBe(false);
403
+ expect(cellIn(shadow, 'r1', 'status').classList.contains('ui-grid-cell-invalid')).toBe(false);
404
+ expect(cellIn(shadow, 'r2', 'name').classList.contains('ui-grid-cell-invalid')).toBe(false);
405
+ });
406
+
407
+ it('keeps selection and expansion clicks independent with WASM active', async () => {
408
+ await initWasmCore();
409
+ const options = selectionExpandOptions();
410
+ options.rowIdentity = undefined;
411
+ const { shadow } = await mountGrid(options);
412
+ const api = getApi(options);
413
+ const rowId = `${options.id}-0`;
414
+ const expandToggle = (): HTMLElement => {
415
+ const toggle = cellIn(shadow, rowId, 'name').querySelector<HTMLElement>('.row-toggle-expand');
416
+ if (!toggle) throw new Error('Expand toggle was not rendered in the primary data column');
417
+ return toggle;
418
+ };
419
+
420
+ dispatchClick(cellIn(shadow, rowId, 'selectionRowHeaderCol'));
421
+ await waitFor(() => (api.selection.getSelectedCount() === 1 ? {} : null));
422
+ expect(api.selection.getSelectedRows()[0]?.['id']).toBe('r1');
423
+
424
+ dispatchClick(cellIn(shadow, rowId, 'selectionRowHeaderCol'));
425
+ await waitFor(() => (api.selection.getSelectedCount() === 0 ? {} : null));
426
+
427
+ dispatchClick(expandToggle());
428
+ await waitFor(() => shadow.querySelector('.expandable-row'));
429
+ expect(api.selection.getSelectedCount()).toBe(0);
430
+
431
+ dispatchClick(expandToggle());
432
+ await waitFor(() => (shadow.querySelector('.expandable-row') === null ? {} : null));
433
+ expect(api.selection.getSelectedCount()).toBe(0);
418
434
  });
419
435
  });
package/tsup.config.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import path from 'node:path';
1
2
  import { defineConfig } from 'tsup';
2
3
  import { scssInlineEsbuild } from './scss-plugin';
3
4
 
@@ -20,6 +21,12 @@ export default defineConfig([
20
21
  outExtension: () => ({ js: '.js' }),
21
22
  tsconfig: './tsconfig.json',
22
23
  noExternal: ['@ornery/ui-grid-core'],
24
+ esbuildOptions(options) {
25
+ options.alias = {
26
+ ...options.alias,
27
+ '@ornery/ui-grid-core': path.resolve(__dirname, '../ui-grid-core/dist/index.mjs'),
28
+ };
29
+ },
23
30
  esbuildPlugins: [scssInlineEsbuild()],
24
31
  },
25
32
  ]);