@mono-lit/helper 0.0.9 → 0.1.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.
Files changed (164) hide show
  1. package/dist/accordion-core-DaNyPWRr.js +277 -0
  2. package/dist/alert-core-DWtHbX_-.js +134 -0
  3. package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
  4. package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
  5. package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
  6. package/dist/button-utils-D5-66M02.js +63 -0
  7. package/dist/card-utils-l80qAmrN.js +312 -0
  8. package/dist/chart-core-DV7hD3ZY.js +801 -0
  9. package/dist/checkbox-utils-DKdrhAzF.js +337 -0
  10. package/dist/chip-utils-DpRrd7Zj.js +403 -0
  11. package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
  12. package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
  13. package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
  14. package/dist/date-core-CyuSyvvG.js +734 -0
  15. package/dist/drawer-core-DbFWvNln.js +759 -0
  16. package/dist/dropdown-core-BCH1pK14.js +511 -0
  17. package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
  18. package/dist/export.js +1 -1
  19. package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
  20. package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
  21. package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
  22. package/dist/file-upload-core-Cz_dBQMx.js +624 -0
  23. package/dist/filter-builder-core-DyWjbBP7.js +381 -0
  24. package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
  25. package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
  26. package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
  27. package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
  28. package/dist/index.js +11 -11
  29. package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
  30. package/dist/index.node.js +11 -11
  31. package/dist/input-utils-BglY-k0H.js +1145 -0
  32. package/dist/menu-core-DkAYuCZ2.js +831 -0
  33. package/dist/modal-core-CSBSPN_m.js +844 -0
  34. package/dist/mono-button-DVvZ03P-.js +280 -0
  35. package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
  36. package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
  37. package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
  38. package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
  39. package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
  40. package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
  41. package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
  42. package/dist/nav-core-B5qU2dzn.js +225 -0
  43. package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
  44. package/dist/nuxt.js +1 -1
  45. package/dist/otp-core-DXg3vFLh.js +758 -0
  46. package/dist/radio-utils-Dk9Tl1jz.js +319 -0
  47. package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
  48. package/dist/select-utils-BgArYHk8.js +2140 -0
  49. package/dist/sidebar-core-CD6txDo3.js +583 -0
  50. package/dist/slider-core-vcWr321-.js +1014 -0
  51. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
  52. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
  53. package/dist/src/components/dropdown-table/index.d.ts +1 -1
  54. package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
  55. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
  56. package/dist/src/components/form/form-types.d.ts +9 -3
  57. package/dist/src/components/input/input-core.d.ts +1 -1
  58. package/dist/src/components/input/input-types.d.ts +1 -1
  59. package/dist/src/components/otp/otp-core.d.ts +1 -1
  60. package/dist/src/components/select/select-core.d.ts +1 -1
  61. package/dist/src/components/select/select-types.d.ts +1 -1
  62. package/dist/src/components/slider/slider-core.d.ts +1 -1
  63. package/dist/src/components/slider/slider-types.d.ts +1 -1
  64. package/dist/src/components/table/filter-suggestion.d.ts +171 -0
  65. package/dist/src/components/table/index.d.ts +5 -4
  66. package/dist/src/components/table/index.shadow.d.ts +5 -4
  67. package/dist/src/components/table/mono-data-grid.d.ts +22 -3
  68. package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
  69. package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
  70. package/dist/src/components/table/table-types.d.ts +74 -4
  71. package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
  72. package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
  73. package/dist/src/components/textarea/textarea-core.d.ts +1 -1
  74. package/dist/src/composables/mono-event.d.ts +7 -1
  75. package/dist/src/entries/index.d.ts +8 -6
  76. package/dist/src/entries/index.node.d.ts +8 -6
  77. package/dist/src/search/index.d.ts +1 -1
  78. package/dist/src/utils/group-count.d.ts +36 -0
  79. package/dist/switch-utils-CTZ4id2V.js +338 -0
  80. package/dist/tabs-core-r5-B8k_N.js +317 -0
  81. package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
  82. package/dist/textarea-utils-VU1KeXm8.js +821 -0
  83. package/dist/ui/accordion.js +2 -274
  84. package/dist/ui/alert.js +2 -131
  85. package/dist/ui/breadcrumb.js +4 -745
  86. package/dist/ui/button-dropdown.js +4 -652
  87. package/dist/ui/button.js +2 -63
  88. package/dist/ui/card.js +2 -310
  89. package/dist/ui/chart.js +4 -800
  90. package/dist/ui/checkbox.js +4 -335
  91. package/dist/ui/chip.js +4 -402
  92. package/dist/ui/date.js +3 -732
  93. package/dist/ui/drawer.js +3 -757
  94. package/dist/ui/dropdown-table.js +5 -1341
  95. package/dist/ui/dropdown.js +4 -509
  96. package/dist/ui/file-upload.js +3 -622
  97. package/dist/ui/filter.js +5 -380
  98. package/dist/ui/form.js +1 -1
  99. package/dist/ui/index.css +118 -1
  100. package/dist/ui/input.js +3 -1141
  101. package/dist/ui/menu.js +4 -828
  102. package/dist/ui/modal.js +4 -843
  103. package/dist/ui/nav.js +4 -223
  104. package/dist/ui/otp.js +4 -756
  105. package/dist/ui/radio.js +4 -317
  106. package/dist/ui/rich-text-editor.js +4 -1278
  107. package/dist/ui/select.js +5 -2138
  108. package/dist/ui/shadow/accordion.js +4 -273
  109. package/dist/ui/shadow/alert.js +4 -130
  110. package/dist/ui/shadow/breadcrumb.js +5 -744
  111. package/dist/ui/shadow/button-dropdown.js +6 -652
  112. package/dist/ui/shadow/button.js +3 -63
  113. package/dist/ui/shadow/card.js +4 -309
  114. package/dist/ui/shadow/chart.js +6 -1576
  115. package/dist/ui/shadow/checkbox.js +4 -334
  116. package/dist/ui/shadow/chip.js +4 -396
  117. package/dist/ui/shadow/date.js +7 -731
  118. package/dist/ui/shadow/drawer.js +4 -756
  119. package/dist/ui/shadow/dropdown-table.js +8 -1762
  120. package/dist/ui/shadow/dropdown.js +4 -508
  121. package/dist/ui/shadow/file-upload.js +4 -620
  122. package/dist/ui/shadow/filter.js +7 -379
  123. package/dist/ui/shadow/input.js +6 -1140
  124. package/dist/ui/shadow/menu.js +5 -828
  125. package/dist/ui/shadow/modal.js +6 -1063
  126. package/dist/ui/shadow/nav.js +5 -223
  127. package/dist/ui/shadow/otp.js +6 -754
  128. package/dist/ui/shadow/radio.js +4 -316
  129. package/dist/ui/shadow/rich-text-editor.js +4 -1276
  130. package/dist/ui/shadow/select.js +6 -2136
  131. package/dist/ui/shadow/sidebar.js +5 -581
  132. package/dist/ui/shadow/slider.js +5 -1010
  133. package/dist/ui/shadow/switch.js +4 -335
  134. package/dist/ui/shadow/table.js +10 -4501
  135. package/dist/ui/shadow/tabs.js +6 -315
  136. package/dist/ui/shadow/tag-input.js +7 -3057
  137. package/dist/ui/shadow/textarea.js +6 -817
  138. package/dist/ui/sidebar.js +3 -581
  139. package/dist/ui/slider.js +4 -1012
  140. package/dist/ui/switch.js +4 -336
  141. package/dist/ui/table.js +9 -4502
  142. package/dist/ui/tabs.js +4 -315
  143. package/dist/ui/tag-input.js +5 -3058
  144. package/dist/ui/textarea.js +4 -819
  145. package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
  146. package/dist/vite.js +1 -1
  147. package/dist/vue.d.ts +3 -2
  148. package/package.json +10 -11
  149. package/dist/chip-strip-bNfLn52Z.js +0 -215
  150. package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
  151. package/dist/data-source-options-BM4r4PRw.js +0 -558
  152. package/dist/data-source-read-HyBCRg1t.js +0 -242
  153. package/dist/excel-BXzr3uI1.js +0 -784
  154. package/dist/export-ixRdCS2y.js +0 -2388
  155. package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
  156. package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
  157. package/dist/filter-builder-C0T3pMx2.js +0 -208
  158. package/dist/form-control-core-BbiACMtL.js +0 -226
  159. package/dist/icon-ClxnYhBG.js +0 -19
  160. package/dist/import-Dc4eXC02.js +0 -612
  161. package/dist/light-slots-_no0r2Z-.js +0 -246
  162. package/dist/markdown-uGlE_OfJ.js +0 -20191
  163. package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
  164. package/dist/normalize-error-BmLbgANw.js +0 -1048
@@ -1,9 +1,9 @@
1
- import { n as isPath, t as getFieldValue } from "./field-path-BabiMrrA.js";
2
- import { r as readAllRows } from "./data-source-read-BL266IW0.js";
3
- import { n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-ChDSaAUH.js";
4
- import { n as describeError, o as isCanceled } from "./normalize-error-D93O4q8g.js";
5
- import { a as resolveDataSourceOptions, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, n as extraLoadOptions, o as toList, p as loadApply, r as mergeDataSourceOptions, u as summaryFilterOf } from "./data-source-options-fxT5QIX4.js";
6
- import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
1
+ import { n as isPath, t as getFieldValue } from "./field-path-DK2VBWHl.js";
2
+ import { r as readAllRows } from "./data-source-read-uKJpRAzx.js";
3
+ import { n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-CqeBnMYh.js";
4
+ import { n as describeError, o as isCanceled } from "./normalize-error-BEcd1tmS.js";
5
+ import { _ as monoArraySource, a as resolveDataSourceOptions, d as createApplyGate, f as isRolledUp, i as normalizeSortList, n as extraLoadOptions, o as toList, p as loadApply, r as mergeDataSourceOptions, u as summaryFilterOf } from "./data-source-options-DJUNU26C.js";
6
+ import { t as arrayToODataString } from "./filter-odata-GsczYKNC.js";
7
7
  import { t as createNotifier } from "./notifier-BIrqUzRh.js";
8
8
 
9
9
  //#region src/components/chart/chart-odata.ts
@@ -1,4 +1,4 @@
1
- import { t as monoDataGrid } from "./mono-data-grid-llJCX9MC.js";
1
+ import { t as monoDataGrid } from "./mono-data-grid-DJkp96N-.js";
2
2
  import { t as createNotifier } from "./notifier-BIrqUzRh.js";
3
3
 
4
4
  //#region src/components/dropdown-table/mono-data-dropdown.ts
@@ -1,12 +1,12 @@
1
- import { a as parseFieldPath, c as toODataClause, l as toODataSelector, n as isPath, o as projectFields, r as mergePatch, s as setFieldValue, t as getFieldValue } from "./field-path-BabiMrrA.js";
2
- import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-BL266IW0.js";
3
- import { i as joinFilters, n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-ChDSaAUH.js";
4
- import { A as resolveSearchEntries, C as customRemoteClause, E as hasWildcardSearch, S as customPredicate, T as hasCustomSearch, h as mergeSearchFields, j as searchEntryFor, k as plainSearchColumns, n as describeError, o as isCanceled, u as DEFAULT_SEARCH_FIELDS } from "./normalize-error-D93O4q8g.js";
5
- import { a as resolveDataSourceOptions, c as composeSummaryApply, d as createApplyGate, f as isRolledUp, h as monoArraySource, i as normalizeSortList, l as summaryAliases, m as storeRows, n as extraLoadOptions, o as toList, p as loadApply, s as buildSummaryApply, t as dataSourceOptionsKey, u as summaryFilterOf } from "./data-source-options-fxT5QIX4.js";
1
+ import { a as parseFieldPath, c as toODataClause, l as toODataSelector, n as isPath, o as projectFields, r as mergePatch, s as setFieldValue, t as getFieldValue } from "./field-path-DK2VBWHl.js";
2
+ import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-uKJpRAzx.js";
3
+ import { i as joinFilters, n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-CqeBnMYh.js";
4
+ import { A as resolveSearchEntries, C as customRemoteClause, E as hasWildcardSearch, S as customPredicate, T as hasCustomSearch, h as mergeSearchFields, j as searchEntryFor, k as plainSearchColumns, n as describeError, o as isCanceled, u as DEFAULT_SEARCH_FIELDS } from "./normalize-error-BEcd1tmS.js";
5
+ import { _ as monoArraySource, a as resolveDataSourceOptions, c as composeSummaryApply, d as createApplyGate, f as isRolledUp, g as storeRows, i as normalizeSortList, l as summaryAliases, n as extraLoadOptions, o as toList, p as loadApply, s as buildSummaryApply, t as dataSourceOptionsKey, u as summaryFilterOf } from "./data-source-options-DJUNU26C.js";
6
6
  import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
7
- import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
7
+ import { t as arrayToODataString } from "./filter-odata-GsczYKNC.js";
8
8
  import { t as createNotifier } from "./notifier-BIrqUzRh.js";
9
- import { t as monoFilterBuilder } from "./filter-builder-C0T3pMx2.js";
9
+ import { t as monoFilterBuilder } from "./filter-builder-vbqIuPhX.js";
10
10
 
11
11
  //#region src/components/table/store-group-source.ts
12
12
  /**
@@ -377,6 +377,114 @@ function inRange(d, r) {
377
377
  return t >= r.from.getTime() && t < r.to.getTime();
378
378
  }
379
379
 
380
+ //#endregion
381
+ //#region src/utils/group-count.ts
382
+ /**
383
+ * Per-value row counts for ONE field, as `{ value, count }` rows.
384
+ *
385
+ * Two consumers share this: the grid's header filter (`distinctValues`) and the
386
+ * table search's filter suggestion (`components/table/filter-suggestion.ts`),
387
+ * which asks "how many rows match this search under each OTHER value of Dept".
388
+ *
389
+ * Remote: one `$apply=filter(…)/groupby((field),aggregate($count as count))`
390
+ * through the store (see `data-source-apply.ts` for why it rides `urlOverride`).
391
+ * Array: a plain tally over the rows.
392
+ */
393
+ /**
394
+ * Group-count `field` through `store` with ONE `$apply`, or `null` when that path
395
+ * is not available — the gate is off, a wildcard path (nothing to group by), a
396
+ * store that cannot carry an `$apply` (a CustomStore), a failed request (reported
397
+ * to the gate), or a response that is not rolled up (a server that ignored the
398
+ * clause). An EMPTY grouped result is a real answer and comes back as `[]`.
399
+ *
400
+ * The rows are returned in server order — the caller sorts.
401
+ */
402
+ async function groupCountViaApply(store, field, filter, gate, options = {}) {
403
+ const rows = await groupCountsViaApply(store, [field], filter, gate, options);
404
+ return rows ? rows.map((r) => ({
405
+ value: r.values[field],
406
+ count: r.count
407
+ })) : null;
408
+ }
409
+ /**
410
+ * {@link groupCountViaApply} over SEVERAL fields at once — one
411
+ * `groupby((A,B),aggregate($count as count))` request, one row per combination
412
+ * that exists. Same `null` contract.
413
+ */
414
+ async function groupCountsViaApply(store, fields, filter, gate, options = {}) {
415
+ if (gate.skip || !fields.length) return null;
416
+ const selectors = [];
417
+ for (const field of fields) {
418
+ if (parseFieldPath(field).hasWildcard) return null;
419
+ const selector = isPath(field) ? toODataSelector(field) : field;
420
+ if (!selector) return null;
421
+ selectors.push(selector);
422
+ }
423
+ const apply = `groupby((${selectors.join(",")}),aggregate($count as count))`;
424
+ const odataFilter = filter != null ? arrayToODataString(filter) : "";
425
+ const clause = odataFilter ? `filter(${odataFilter})/${apply}` : apply;
426
+ const top = typeof options.top === "number" && options.top >= 0 ? options.top : void 0;
427
+ let rows;
428
+ try {
429
+ rows = await loadApply(store, clause, { top });
430
+ } catch (err) {
431
+ gate.reject(err);
432
+ return null;
433
+ }
434
+ if (!rows) return null;
435
+ if (!rows.length) return [];
436
+ const first = rows[0];
437
+ if (!first || typeof first !== "object" || !isCount(first.count)) return null;
438
+ if (!isRolledUp(rows, [...fields, "count"])) return null;
439
+ return rows.map((r) => ({
440
+ values: pickValues(r, fields),
441
+ count: Number(r.count) || 0
442
+ }));
443
+ }
444
+ /** Each field's value off a row, path-aware. */
445
+ function pickValues(row, fields) {
446
+ const out = {};
447
+ for (const f of fields) out[f] = isPath(f) ? getFieldValue(row, f) : row?.[f];
448
+ return out;
449
+ }
450
+ /** {@link countValues} over several fields: one tuple per combination, with its row count. */
451
+ function countTuples(rows, fields) {
452
+ const by = /* @__PURE__ */ new Map();
453
+ for (const r of rows) {
454
+ const values = pickValues(r, fields);
455
+ const key = JSON.stringify(fields.map((f) => values[f] ?? null));
456
+ const hit = by.get(key);
457
+ if (hit) hit.count++;
458
+ else by.set(key, {
459
+ values,
460
+ count: 1
461
+ });
462
+ }
463
+ return [...by.values()];
464
+ }
465
+ /** A number, or a string that is one (`"12"`). */
466
+ function isCount(v) {
467
+ if (typeof v === "number") return Number.isFinite(v);
468
+ return typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v));
469
+ }
470
+ /** Count occurrences of `field` across `rows` (path-aware; a wildcard path flattens). */
471
+ function countValues(rows, field) {
472
+ const counts = /* @__PURE__ */ new Map();
473
+ const bump = (v) => {
474
+ counts.set(v, (counts.get(v) ?? 0) + 1);
475
+ };
476
+ const path = isPath(field);
477
+ for (const r of rows) if (path) {
478
+ const v = getFieldValue(r, field);
479
+ if (Array.isArray(v)) v.forEach(bump);
480
+ else bump(v);
481
+ } else bump(r?.[field]);
482
+ return [...counts.entries()].map(([value, count]) => ({
483
+ value,
484
+ count
485
+ }));
486
+ }
487
+
380
488
  //#endregion
381
489
  //#region src/components/table/mono-data-grid.ts
382
490
  function monoDataGrid(ds = null, opts = {}) {
@@ -507,6 +615,9 @@ function monoDataGrid(ds = null, opts = {}) {
507
615
  pageSizeAll: false,
508
616
  pageCount: 0,
509
617
  searchTerms: [],
618
+ filterSuggestion: null,
619
+ filterSuggestions: [],
620
+ setFilterSuggestion,
510
621
  sorts: [],
511
622
  sortField: null,
512
623
  sortOrder: null,
@@ -3349,8 +3460,30 @@ function monoDataGrid(ds = null, opts = {}) {
3349
3460
  }
3350
3461
  await setSearchTerms(ctrl.searchTerms);
3351
3462
  }
3463
+ /** What identifies an offer for the change check — a re-published identical list is a no-op. */
3464
+ const offerKey = (list) => {
3465
+ try {
3466
+ return JSON.stringify(list.map((s) => [
3467
+ s.key,
3468
+ s.count,
3469
+ s.values
3470
+ ]));
3471
+ } catch {
3472
+ return String(Math.random());
3473
+ }
3474
+ };
3475
+ /** Equality-guarded so a re-published identical list costs no notify (no re-render loop). */
3476
+ function setFilterSuggestion(next) {
3477
+ const list = next == null ? [] : Array.isArray(next) ? next.filter(Boolean) : [next];
3478
+ if (offerKey(list) === offerKey(ctrl.filterSuggestions)) return;
3479
+ ctrl.filterSuggestions = list;
3480
+ ctrl.filterSuggestion = list[0] ?? null;
3481
+ notify();
3482
+ }
3352
3483
  async function setSearchTerms(terms) {
3353
3484
  ctrl.searchTerms = (terms ?? []).filter((t) => t && String(t.value ?? "") !== "");
3485
+ ctrl.filterSuggestion = null;
3486
+ ctrl.filterSuggestions = [];
3354
3487
  groupPageIndex = 0;
3355
3488
  bumpSummary("search");
3356
3489
  if (serverMode()) {
@@ -3790,48 +3923,13 @@ function monoDataGrid(ds = null, opts = {}) {
3790
3923
  * exactly as every other request does.
3791
3924
  */
3792
3925
  async function distinctViaApply(store, field, options) {
3793
- if (applyGate.skip) return null;
3794
- if (parseFieldPath(field).hasWildcard) return null;
3795
- const selector = isPath(field) ? toODataSelector(field) : field;
3796
- if (!selector) return null;
3797
- const apply = `groupby((${selector}),aggregate($count as count))`;
3798
- const odataFilter = options?.filter != null ? arrayToODataString(options.filter) : "";
3799
- const clause = odataFilter ? `filter(${odataFilter})/${apply}` : apply;
3800
3926
  const top = typeof options?.take === "number" && options.take >= 0 ? options.take : void 0;
3801
- let rows;
3802
- try {
3803
- rows = await loadApply(store, clause, { top });
3804
- } catch (err) {
3805
- applyGate.reject(err);
3806
- return null;
3807
- }
3808
- if (!rows) return null;
3809
- if (!rows.length) return [];
3810
- const first = rows[0];
3811
- if (!first || typeof first !== "object" || typeof first.count !== "number") return null;
3812
- if (!isRolledUp(rows, [field, "count"])) return null;
3813
- const path = isPath(field);
3814
- return sortColumnValues(rows.map((r) => ({
3815
- value: path ? getFieldValue(r, field) : r[field],
3816
- count: Number(r.count) || 0
3817
- })));
3927
+ const rows = await groupCountViaApply(store, field, options?.filter ?? null, applyGate, { top });
3928
+ return rows ? sortColumnValues(rows) : null;
3818
3929
  }
3819
3930
  /** Count occurrences of `field` across `rows` into a sorted `{value,count}[]`. */
3820
3931
  function distinctFromRows(rows, field) {
3821
- const counts = /* @__PURE__ */ new Map();
3822
- const bump = (v) => {
3823
- counts.set(v, (counts.get(v) ?? 0) + 1);
3824
- };
3825
- const path = isPath(field);
3826
- for (const r of rows) if (path) {
3827
- const v = getFieldValue(r, field);
3828
- if (Array.isArray(v)) v.forEach(bump);
3829
- else bump(v);
3830
- } else bump(r?.[field]);
3831
- return sortColumnValues([...counts.entries()].map(([value, count]) => ({
3832
- value,
3833
- count
3834
- })));
3932
+ return sortColumnValues(countValues(rows, field));
3835
3933
  }
3836
3934
  async function distinctValues(field, options) {
3837
3935
  if (!field) return [];
@@ -4238,4 +4336,4 @@ function monoDataGrid(ds = null, opts = {}) {
4238
4336
  }
4239
4337
 
4240
4338
  //#endregion
4241
- export { seedFromRanges as a, minimize as i, buildDateTree as n, setAllChecked as o, checkState as r, setChecked as s, monoDataGrid as t };
4339
+ export { checkState as a, setAllChecked as c, buildDateTree as i, setChecked as l, countTuples as n, minimize as o, groupCountsViaApply as r, seedFromRanges as s, monoDataGrid as t };
@@ -99,31 +99,36 @@ function decorateEvent(event, detail) {
99
99
  * dispatchMonoEvent(this, 'loading-change', detail) // loading-change + loadingChange + mno-loading-change + mnoLoadingChange
100
100
  */
101
101
  function dispatchMonoEvent(target, name, detail, options = {}) {
102
+ const cancelable = !!options.cancelable;
102
103
  const init = {
103
104
  detail,
104
105
  bubbles: true,
105
- composed: true
106
+ composed: true,
107
+ cancelable
106
108
  };
109
+ let allowed = true;
107
110
  const camel = toCamelEventName(`mno-${name}`);
108
- target.dispatchEvent(new CustomEvent(`mno-${name}`, init));
109
- target.dispatchEvent(new CustomEvent(camel, init));
111
+ allowed = target.dispatchEvent(new CustomEvent(`mno-${name}`, init)) && allowed;
112
+ allowed = target.dispatchEvent(new CustomEvent(camel, init)) && allowed;
110
113
  const alias = options.alias === false ? null : options.alias ?? name;
111
- if (!alias) return;
114
+ if (!alias) return allowed;
112
115
  const fromDetail = detail?.sourceEvent;
113
116
  const source = options.sourceEvent !== void 0 ? options.sourceEvent : fromDetail instanceof Event ? fromDetail : null;
114
117
  if (source && source.type === alias && reachesHost(source, target)) {
115
118
  decorateEvent(source, detail);
116
- return;
119
+ return allowed;
117
120
  }
118
- if (MONO_DEVICE_EVENTS.has(alias)) return;
121
+ if (MONO_DEVICE_EVENTS.has(alias)) return allowed;
119
122
  const plainInit = {
120
123
  detail,
121
124
  bubbles: !MONO_NON_BUBBLING_ALIASES.has(alias),
122
- composed: true
125
+ composed: true,
126
+ cancelable
123
127
  };
124
- target.dispatchEvent(new CustomEvent(alias, plainInit));
128
+ allowed = target.dispatchEvent(new CustomEvent(alias, plainInit)) && allowed;
125
129
  const plainCamel = toCamelEventName(alias);
126
- if (plainCamel !== alias) target.dispatchEvent(new CustomEvent(plainCamel, plainInit));
130
+ if (plainCamel !== alias) allowed = target.dispatchEvent(new CustomEvent(plainCamel, plainInit)) && allowed;
131
+ return allowed;
127
132
  }
128
133
 
129
134
  //#endregion
@@ -430,7 +430,8 @@ function monoForm(options) {
430
430
  _register,
431
431
  _report,
432
432
  _reportList,
433
- _propsFor: propsFor
433
+ _propsFor: propsFor,
434
+ _elements: (key) => [...elements[key] ?? []]
434
435
  };
435
436
  }
436
437