@mono-lit/helper 0.0.5 → 0.0.7
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/dist/{control-tooltip-C3rA_nSH.js → control-tooltip-CoPD37_h.js} +20 -11
- package/dist/{data-source-options-Cz9fVLK8.js → data-source-options-CS0w0wlO.js} +26 -9
- package/dist/{data-source-options-QjuI73g8.js → data-source-options-lDR-g9Eb.js} +26 -9
- package/dist/{data-source-read-FxqzQkk2.js → data-source-read-Cp_h7NIf.js} +5 -2
- package/dist/{data-source-read-i6CYSUEl.js → data-source-read-DTJ_Mnez.js} +5 -2
- package/dist/{excel-BPdDt06G.js → excel-DtRpxmxs.js} +1 -1
- package/dist/{export-DgomqI_3.js → export-D27RJa1w.js} +1 -1
- package/dist/export.js +3 -3
- package/dist/{field-tooltip-FyMi9vNM.js → field-tooltip-Csk4s2ve.js} +2 -3
- package/dist/field-tooltip-addon-B32dizW_.js +22 -0
- package/dist/{control-tooltip-7vegYmq3.js → field-tooltip-addon-CWCp19mJ.js} +36 -12
- package/dist/{field-tooltip.css_raw-DEctHXKm.js → field-tooltip.css_raw-U5UeTa2d.js} +3 -4
- package/dist/{field-validation-CHHQi1zl.js → field-validation-CFmUmuDx.js} +1 -1
- package/dist/field-validation.css_raw-Cx6SGrfP.js +178 -0
- package/dist/{form-control-core-CIdMLXMo.js → form-control-core-BbiACMtL.js} +1 -1
- package/dist/{hydration-flush-DHrl4_KK.js → hydration-flush-BaE9gN3C.js} +450 -3
- package/dist/index.js +11 -11
- package/dist/{index.node-DzCuvHLg.js → index.node-Mg0Snp0t.js} +5 -5
- package/dist/index.node.js +11 -11
- package/dist/input.css_raw-Br-T8RWv.js +5 -0
- package/dist/{light-slots-DdDdZ6zs.js → light-slots-B5Ck0t_E.js} +1 -1
- package/dist/{light-slots-4ZCjOcBg.js → light-slots-_no0r2Z-.js} +1 -1
- package/dist/mono-button-CLkHg3WW.js +871 -0
- package/dist/{mono-button.shadow-D9NdMsmH.js → mono-button.shadow-DqZMpcqY.js} +1 -2
- package/dist/{mono-data-chart-ChkelNT7.js → mono-data-chart-BAH9Zb3p.js} +2 -2
- package/dist/{mono-data-dropdown-DxpUUk2y.js → mono-data-dropdown-BsY5IuIo.js} +72 -6
- package/dist/{mono-data-grid-KDpu4d4_.js → mono-data-grid-CZFjpnOD.js} +125 -18
- package/dist/{mono-data-grid-8jmeIXUU.js → mono-data-grid-kV4jYu2g.js} +124 -17
- package/dist/{mono-element-C7vCschg.js → mono-element-CKcT0rwv.js} +1 -1
- package/dist/{mono-form-controller-BkMR8g14.js → mono-form-controller-BrA10erm.js} +12 -1
- package/dist/mono-ui-kvLVIf1V.js +786 -0
- package/dist/{popup-portal-C8ttHDRX.js → popup-portal-CINuVjNY.js} +53 -6
- package/dist/src/components/accordion/mono-accordion.d.ts +0 -1
- package/dist/src/components/alert/mono-alert.d.ts +0 -1
- package/dist/src/components/breadcrumb/mono-breadcrumb-list.d.ts +0 -1
- package/dist/src/components/breadcrumb/mono-breadcrumb.d.ts +0 -1
- package/dist/src/components/button/mono-button-dropdown.d.ts +0 -1
- package/dist/src/components/button/mono-button.d.ts +0 -1
- package/dist/src/components/card/mono-card.d.ts +0 -1
- package/dist/src/components/chart/mono-chart-presets.d.ts +0 -4
- package/dist/src/components/chart/mono-chart.d.ts +0 -1
- package/dist/src/components/checkbox/mono-checkbox.d.ts +0 -1
- package/dist/src/components/chip/mono-chip.d.ts +0 -1
- package/dist/src/components/date/mono-date.d.ts +0 -1
- package/dist/src/components/drawer/mono-drawer.d.ts +0 -1
- package/dist/src/components/dropdown/mono-dropdown.d.ts +0 -1
- package/dist/src/components/dropdown-table/mono-dropdown-table.d.ts +0 -1
- package/dist/src/components/file-upload/mono-file-upload.d.ts +0 -1
- package/dist/src/components/filter/mono-filter-builder.d.ts +0 -1
- package/dist/src/components/input/mono-input.d.ts +0 -1
- package/dist/src/components/menu/mono-menu.d.ts +0 -1
- package/dist/src/components/modal/mono-modal.d.ts +0 -1
- package/dist/src/components/nav/mono-nav.d.ts +0 -1
- package/dist/src/components/otp/mono-otp.d.ts +0 -1
- package/dist/src/components/radio/mono-radio.d.ts +0 -1
- package/dist/src/components/rich-text-editor/mono-rich-text-editor.d.ts +0 -1
- package/dist/src/components/select/mono-select.d.ts +0 -1
- package/dist/src/components/sidebar/mono-sidebar.d.ts +0 -1
- package/dist/src/components/slider/mono-slider.d.ts +0 -1
- package/dist/src/components/switch/mono-switch.d.ts +0 -1
- package/dist/src/components/table/column-autosize.d.ts +96 -0
- package/dist/src/components/table/mono-data-grid.d.ts +16 -0
- package/dist/src/components/table/mono-table-checkbox.d.ts +0 -1
- package/dist/src/components/table/mono-table-detail.d.ts +0 -1
- package/dist/src/components/table/mono-table-empty.d.ts +0 -1
- package/dist/src/components/table/mono-table-error.d.ts +0 -1
- package/dist/src/components/table/mono-table-info.d.ts +0 -1
- package/dist/src/components/table/mono-table-loading.d.ts +0 -1
- package/dist/src/components/table/mono-table-page-size.d.ts +0 -1
- package/dist/src/components/table/mono-table-paging-group.d.ts +0 -1
- package/dist/src/components/table/mono-table-paging.d.ts +0 -1
- package/dist/src/components/table/mono-table-search.d.ts +0 -1
- package/dist/src/components/table/mono-table-sort.d.ts +0 -1
- package/dist/src/components/table/mono-table-summary.d.ts +0 -1
- package/dist/src/components/table/mono-table-th-core.d.ts +3 -0
- package/dist/src/components/table/mono-table-th.d.ts +0 -1
- package/dist/src/components/table/table-controller-core.d.ts +2 -0
- package/dist/src/components/table/table-types.d.ts +8 -1
- package/dist/src/components/tabs/mono-tabs.d.ts +0 -1
- package/dist/src/components/tag-input/mono-tag-input.d.ts +12 -1
- package/dist/src/components/tag-input/mono-tag-input.shadow.d.ts +9 -1
- package/dist/src/components/tag-input/tag-input-core.d.ts +9 -1
- package/dist/src/components/tag-input/tag-input-types.d.ts +2 -0
- package/dist/src/components/textarea/mono-textarea.d.ts +0 -1
- package/dist/src/components/tooltip/field-tooltip-addon.d.ts +5 -0
- package/dist/src/composables/mono-size-attrs.d.ts +10 -0
- package/dist/src/composables/popup-portal.d.ts +24 -1
- package/dist/src/entries/index.d.ts +2 -1
- package/dist/src/entries/index.node.d.ts +2 -1
- package/dist/{styles-BODNpZV1.js → styles-D-ergrfR.js} +1 -1
- package/dist/{tooltip-Drekihf5.js → tooltip-Cu5IrDS9.js} +1 -2
- package/dist/tooltip.js +2 -3
- package/dist/ui/accordion.js +4 -11
- package/dist/ui/alert.js +3 -10
- package/dist/ui/breadcrumb.js +4 -14
- package/dist/ui/button-dropdown.js +22 -15
- package/dist/ui/button.js +1 -1
- package/dist/ui/card.js +4 -11
- package/dist/ui/chart.js +4 -24
- package/dist/ui/checkbox.js +4 -11
- package/dist/ui/chip.js +6 -9
- package/dist/ui/date.js +5 -12
- package/dist/ui/drawer.js +5 -12
- package/dist/ui/dropdown-table.js +89 -38
- package/dist/ui/dropdown.js +34 -21
- package/dist/ui/file-upload.js +4 -11
- package/dist/ui/filter.js +3 -10
- package/dist/ui/form.js +1 -1
- package/dist/ui/index.css +5414 -8564
- package/dist/ui/input.js +6 -14
- package/dist/ui/menu.js +4 -11
- package/dist/ui/modal.js +6 -13
- package/dist/ui/nav.js +4 -11
- package/dist/ui/otp.js +6 -14
- package/dist/ui/radio.js +4 -11
- package/dist/ui/rich-text-editor.js +4 -12
- package/dist/ui/select.js +12 -15
- package/dist/ui/shadow/accordion.js +1 -1
- package/dist/ui/shadow/alert.js +1 -1
- package/dist/ui/shadow/breadcrumb.js +1 -1
- package/dist/ui/shadow/button-dropdown.js +21 -7
- package/dist/ui/shadow/button.js +1 -1
- package/dist/ui/shadow/card.js +1 -2
- package/dist/ui/shadow/chart.js +3 -4
- package/dist/ui/shadow/checkbox.js +2 -2
- package/dist/ui/shadow/chip.js +1 -1
- package/dist/ui/shadow/date.js +4 -5
- package/dist/ui/shadow/drawer.js +2 -2
- package/dist/ui/shadow/dropdown-table.js +159 -35
- package/dist/ui/shadow/dropdown.js +31 -11
- package/dist/ui/shadow/file-upload.js +2 -2
- package/dist/ui/shadow/filter.js +1 -2
- package/dist/ui/shadow/input.js +5 -6
- package/dist/ui/shadow/menu.js +1 -1
- package/dist/ui/shadow/modal.js +3 -3
- package/dist/ui/shadow/nav.js +1 -1
- package/dist/ui/shadow/otp.js +5 -6
- package/dist/ui/shadow/radio.js +2 -2
- package/dist/ui/shadow/rich-text-editor.js +2 -3
- package/dist/ui/shadow/select.js +11 -7
- package/dist/ui/shadow/sidebar.js +2 -2
- package/dist/ui/shadow/slider.js +4 -5
- package/dist/ui/shadow/switch.js +2 -2
- package/dist/ui/shadow/table.js +113 -20
- package/dist/ui/shadow/tabs.js +1 -1
- package/dist/ui/shadow/tag-input.js +203 -27
- package/dist/ui/shadow/textarea.js +4 -5
- package/dist/ui/sidebar.js +4 -11
- package/dist/ui/slider.js +5 -13
- package/dist/ui/switch.js +4 -11
- package/dist/ui/table.js +114 -64
- package/dist/ui/tabs.js +4 -11
- package/dist/ui/tag-input.js +215 -30
- package/dist/ui/textarea.js +6 -14
- package/dist/ui/theme/luma.css +495 -495
- package/dist/ui/theme/lyra.css +495 -495
- package/dist/ui/theme/maia.css +495 -495
- package/dist/ui/theme/mira.css +495 -495
- package/dist/ui/theme/nova.css +495 -495
- package/dist/ui/theme/one.css +742 -742
- package/dist/ui/theme/rhea.css +495 -495
- package/dist/ui/theme/sera.css +495 -495
- package/dist/ui/theme/vega.css +495 -495
- package/package.json +2 -2
- package/dist/css-size-DWAPgQdT.js +0 -38
- package/dist/field-validation.css_raw-B3Iu33rS.js +0 -178
- package/dist/input.css_raw-CQu2fAsU.js +0 -5
- package/dist/mono-button-CeDB9khW.js +0 -878
- package/dist/mono-ui-BwUc0L6B.js +0 -360
- package/dist/tooltip-loader-3U9FTOXj.js +0 -20
- package/dist/tooltip-loader-Dcp9AUZn.js +0 -23
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { a as __decorate, f as customElement, i as withShadowUtilityStyles, l as defineHybridPropAliases, r as toShadowCss, s as booleanStringConverter, t as flushSsrHydration } from "./hydration-flush-
|
|
1
|
+
import { _ as buildSizeStyle, a as __decorate, f as customElement, i as withShadowUtilityStyles, l as defineHybridPropAliases, r as toShadowCss, s as booleanStringConverter, t as flushSsrHydration } from "./hydration-flush-BaE9gN3C.js";
|
|
2
2
|
import { t as dispatchMonoEvent } from "./mono-event-BPku9HpS.js";
|
|
3
|
-
import { t as buildSizeStyle } from "./css-size-DWAPgQdT.js";
|
|
4
3
|
import { a as rateLimitHasChanged, i as rateLimitConverter, n as normalizeDebounce, r as normalizeThrottle, t as createRateLimiter } from "./rate-limit-e9Jlpl5l.js";
|
|
5
4
|
import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
|
|
6
5
|
import { property, query, state } from "lit/decorators.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as isPath, t as getFieldValue } from "./field-path-BabiMrrA.js";
|
|
2
|
-
import { r as readAllRows } from "./data-source-read-
|
|
2
|
+
import { r as readAllRows } from "./data-source-read-Cp_h7NIf.js";
|
|
3
3
|
import { n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-ChDSaAUH.js";
|
|
4
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-
|
|
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-lDR-g9Eb.js";
|
|
6
6
|
import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
|
|
7
7
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as monoDataGrid } from "./mono-data-grid-
|
|
1
|
+
import { t as monoDataGrid } from "./mono-data-grid-kV4jYu2g.js";
|
|
2
2
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
3
3
|
|
|
4
4
|
//#region src/components/dropdown-table/mono-data-dropdown.ts
|
|
@@ -251,8 +251,22 @@ function monoDataDropdown(source = null, opts = {}) {
|
|
|
251
251
|
function setOpen(next) {
|
|
252
252
|
if (ctrl.open === next) return;
|
|
253
253
|
ctrl.open = next;
|
|
254
|
+
if (!next) pruneCache();
|
|
254
255
|
notify();
|
|
255
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Drop cached rows no current key needs, once the cache has outgrown the selection.
|
|
259
|
+
*
|
|
260
|
+
* The cache exists to label chips whose row is not on the loaded page; it only ever grew —
|
|
261
|
+
* every key ever selected, and after a select-all every drained row — and was cleared only on
|
|
262
|
+
* `bind()`. Pruned on close, with slack, so toggling a few rows never thrashes it.
|
|
263
|
+
*/
|
|
264
|
+
function pruneCache() {
|
|
265
|
+
const keys = currentKeys();
|
|
266
|
+
if (cache.size <= keys.length * 2 + 200) return;
|
|
267
|
+
const keep = new Set(keys.map((k) => keyStr(normKey(k))));
|
|
268
|
+
for (const k of cache.keys()) if (!keep.has(k)) cache.delete(k);
|
|
269
|
+
}
|
|
256
270
|
function hasStore() {
|
|
257
271
|
const s = grid.dataSource;
|
|
258
272
|
return typeof s?.store === "function" && !!s.store();
|
|
@@ -265,6 +279,26 @@ function monoDataDropdown(source = null, opts = {}) {
|
|
|
265
279
|
for (let i = 0; i < arr.length; i += size) out.push(arr.slice(i, i + size));
|
|
266
280
|
return out;
|
|
267
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* `run` over every part, at most `limit` requests in flight — the result order kept.
|
|
284
|
+
*
|
|
285
|
+
* A thousand preset keys are twenty `in` chunks (or ~67 OR-chain chunks in the fallback), and
|
|
286
|
+
* `Promise.all` over them fired every request at once: a burst a backend may throttle or reject,
|
|
287
|
+
* and that queues behind the browser's per-host connection cap anyway.
|
|
288
|
+
*/
|
|
289
|
+
async function mapLimited(parts, limit, run) {
|
|
290
|
+
const out = new Array(parts.length);
|
|
291
|
+
let next = 0;
|
|
292
|
+
const worker = async () => {
|
|
293
|
+
while (next < parts.length) {
|
|
294
|
+
const i = next++;
|
|
295
|
+
out[i] = await run(parts[i]);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
await Promise.all(Array.from({ length: Math.min(limit, parts.length) }, worker));
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
const RESOLVE_CONCURRENCY = 4;
|
|
268
302
|
const selectFields = () => typeof displayExpr === "string" && displayExpr ? [keyExpr, displayExpr] : void 0;
|
|
269
303
|
async function resolveSelected() {
|
|
270
304
|
const missing = currentKeys().filter((k) => !cache.has(keyStr(normKey(k))));
|
|
@@ -274,14 +308,14 @@ function monoDataDropdown(source = null, opts = {}) {
|
|
|
274
308
|
const store = s.store();
|
|
275
309
|
let rows = [];
|
|
276
310
|
try {
|
|
277
|
-
rows = (await
|
|
311
|
+
rows = (await mapLimited(chunk(missing, 50), RESOLVE_CONCURRENCY, (part) => store.load({
|
|
278
312
|
filter: [
|
|
279
313
|
keyExpr,
|
|
280
314
|
"in",
|
|
281
315
|
part
|
|
282
316
|
],
|
|
283
317
|
select: selectFields()
|
|
284
|
-
})))
|
|
318
|
+
}))).flatMap(storeRows);
|
|
285
319
|
} catch {
|
|
286
320
|
const orFilter = (arr) => arr.map((v) => [
|
|
287
321
|
keyExpr,
|
|
@@ -292,10 +326,10 @@ function monoDataDropdown(source = null, opts = {}) {
|
|
|
292
326
|
"or",
|
|
293
327
|
b
|
|
294
328
|
] : b, null);
|
|
295
|
-
rows = (await
|
|
329
|
+
rows = (await mapLimited(chunk(missing, 15), RESOLVE_CONCURRENCY, (part) => store.load({
|
|
296
330
|
filter: orFilter(part),
|
|
297
331
|
select: selectFields()
|
|
298
|
-
})))
|
|
332
|
+
}))).flatMap(storeRows);
|
|
299
333
|
}
|
|
300
334
|
for (const row of rows) cacheRow(row?.[keyExpr], row);
|
|
301
335
|
} else if (typeof s?.data === "function") {
|
|
@@ -308,7 +342,39 @@ function monoDataDropdown(source = null, opts = {}) {
|
|
|
308
342
|
}
|
|
309
343
|
notify();
|
|
310
344
|
}
|
|
311
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Forward a grid notify only when something THIS controller's readers use has moved.
|
|
347
|
+
*
|
|
348
|
+
* Forwarding every one re-rendered the whole `<mono-dropdown-table>` (chips, `selectedItems()`),
|
|
349
|
+
* repositioned its open panel (a forced layout) and re-reflected the selection onto every row —
|
|
350
|
+
* for notifies that change none of it, chiefly each virtual-scroll window shift. What the field
|
|
351
|
+
* reads from the grid: the selection (`check().version` / `pending`), the load state
|
|
352
|
+
* (`loading` / `hasLoaded` / `error` — the skeleton release), and the rows for chip labels and
|
|
353
|
+
* key typing — the page array itself, or under virtual scroll (whose `items` is only the window)
|
|
354
|
+
* the loaded count. Rows a window shift brings in are re-reflected by the panel's own
|
|
355
|
+
* MutationObserver, not by this notify.
|
|
356
|
+
*/
|
|
357
|
+
let forwarded = [];
|
|
358
|
+
const gridSignature = () => {
|
|
359
|
+
const c = grid.check();
|
|
360
|
+
return [
|
|
361
|
+
c.version,
|
|
362
|
+
c.pending,
|
|
363
|
+
grid.loading,
|
|
364
|
+
grid.hasLoaded,
|
|
365
|
+
grid.error,
|
|
366
|
+
grid.scrollMode === "virtual" ? grid.loadedCount : grid.items,
|
|
367
|
+
grid.totalCount,
|
|
368
|
+
grid.hasMore,
|
|
369
|
+
grid.pageIndex
|
|
370
|
+
];
|
|
371
|
+
};
|
|
372
|
+
const offGrid = grid.subscribe(() => {
|
|
373
|
+
const sig = gridSignature();
|
|
374
|
+
if (sig.length === forwarded.length && sig.every((v, i) => Object.is(v, forwarded[i]))) return;
|
|
375
|
+
forwarded = sig;
|
|
376
|
+
notify();
|
|
377
|
+
});
|
|
312
378
|
const ctrl = {
|
|
313
379
|
grid,
|
|
314
380
|
/** Alias of {@link grid} — the inner `controlMonoTable`. Preferred in new
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
2
2
|
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";
|
|
3
3
|
import { C as resolveSearchEntries, D as compileFilterPredicate, E as andPredicates, O as joinFilters, S as plainSearchColumns, T as andFilters, f as mergeSearchFields, g as customRemoteClause, h as customPredicate, n as describeError, o as isCanceled, u as DEFAULT_SEARCH_FIELDS, v as hasCustomSearch, w as searchEntryFor, y as hasWildcardSearch } from "./normalize-error-BmLbgANw.js";
|
|
4
|
-
import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-
|
|
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-
|
|
4
|
+
import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-DTJ_Mnez.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-CS0w0wlO.js";
|
|
6
6
|
import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
|
|
7
7
|
import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
|
|
8
8
|
import { t as monoFilterBuilder } from "./filter-builder-B6Y2mmbM.js";
|
|
@@ -1004,6 +1004,16 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1004
1004
|
const checkedRows = /* @__PURE__ */ new Map();
|
|
1005
1005
|
let checkConfig = {};
|
|
1006
1006
|
let checkPending = false;
|
|
1007
|
+
/**
|
|
1008
|
+
* Bumped on every selection notify (a rejected toggle included — its subscribers repaint the
|
|
1009
|
+
* revert), so a listener can tell a selection change from the grid's other notifies without
|
|
1010
|
+
* diffing the store. See `MonoCheckHandle.version`.
|
|
1011
|
+
*/
|
|
1012
|
+
let checkVersion = 0;
|
|
1013
|
+
function checkChanged() {
|
|
1014
|
+
checkVersion += 1;
|
|
1015
|
+
notify();
|
|
1016
|
+
}
|
|
1007
1017
|
/** `keyValue` as a list (empty = project nothing, i.e. keep the whole row). */
|
|
1008
1018
|
function checkKeys() {
|
|
1009
1019
|
const k = checkConfig.keyValue;
|
|
@@ -1126,26 +1136,26 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1126
1136
|
if (next) checkedRows.set(key, item);
|
|
1127
1137
|
else checkedRows.delete(key);
|
|
1128
1138
|
}
|
|
1129
|
-
|
|
1139
|
+
checkChanged();
|
|
1130
1140
|
},
|
|
1131
1141
|
selectPage() {
|
|
1132
1142
|
addChecked(ctrl.items);
|
|
1133
|
-
|
|
1143
|
+
checkChanged();
|
|
1134
1144
|
},
|
|
1135
1145
|
replace(rows) {
|
|
1136
1146
|
checkedRows.clear();
|
|
1137
1147
|
addChecked(rows, false);
|
|
1138
|
-
|
|
1148
|
+
checkChanged();
|
|
1139
1149
|
},
|
|
1140
1150
|
async selectAll() {
|
|
1141
1151
|
if (checkPending) return;
|
|
1142
1152
|
if (drainIsReusable()) {
|
|
1143
1153
|
addChecked(drainedRows);
|
|
1144
|
-
|
|
1154
|
+
checkChanged();
|
|
1145
1155
|
return;
|
|
1146
1156
|
}
|
|
1147
1157
|
checkPending = true;
|
|
1148
|
-
|
|
1158
|
+
checkChanged();
|
|
1149
1159
|
try {
|
|
1150
1160
|
const select = checkSelect();
|
|
1151
1161
|
const rows = await readAllRows(bound, {
|
|
@@ -1161,7 +1171,7 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1161
1171
|
throw err;
|
|
1162
1172
|
} finally {
|
|
1163
1173
|
checkPending = false;
|
|
1164
|
-
|
|
1174
|
+
checkChanged();
|
|
1165
1175
|
}
|
|
1166
1176
|
},
|
|
1167
1177
|
clear() {
|
|
@@ -1169,14 +1179,14 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1169
1179
|
const min = checkLimits().min ?? 0;
|
|
1170
1180
|
if (min > 0) {
|
|
1171
1181
|
if (checkedRows.size <= min) {
|
|
1172
|
-
|
|
1182
|
+
checkChanged();
|
|
1173
1183
|
return;
|
|
1174
1184
|
}
|
|
1175
1185
|
const keep = [...checkedRows.entries()].slice(0, min);
|
|
1176
1186
|
checkedRows.clear();
|
|
1177
1187
|
for (const [key, row] of keep) checkedRows.set(key, row);
|
|
1178
1188
|
} else checkedRows.clear();
|
|
1179
|
-
|
|
1189
|
+
checkChanged();
|
|
1180
1190
|
},
|
|
1181
1191
|
limits: checkLimits,
|
|
1182
1192
|
get atMax() {
|
|
@@ -1187,6 +1197,9 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1187
1197
|
const min = checkLimits().min;
|
|
1188
1198
|
return min !== void 0 && checkedRows.size <= min;
|
|
1189
1199
|
},
|
|
1200
|
+
get version() {
|
|
1201
|
+
return checkVersion;
|
|
1202
|
+
},
|
|
1190
1203
|
get pending() {
|
|
1191
1204
|
return checkPending;
|
|
1192
1205
|
},
|
|
@@ -1278,8 +1291,53 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1278
1291
|
function columns() {
|
|
1279
1292
|
return columnsHandle;
|
|
1280
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Row → index and row key → index over `ctrl.items`, built lazily per items ARRAY.
|
|
1296
|
+
*
|
|
1297
|
+
* `rowKey()` / `indexOfRowKey()` were linear scans, and they are per-row calls: every
|
|
1298
|
+
* `<mono-table-checkbox>` asks `check.isChecked(row)` on every notify, so a tick on a grid
|
|
1299
|
+
* holding N rows (infinity scroll and page-size "all" hold the whole set) cost O(N²).
|
|
1300
|
+
*
|
|
1301
|
+
* A HIT is always verified against the live array, and a MISS falls back to the scan
|
|
1302
|
+
* (rebuilding when the scan finds the row) — so an in-place mutation of `ctrl.items`, or a
|
|
1303
|
+
* key that moved, costs one rebuild and is never answered wrong.
|
|
1304
|
+
*/
|
|
1305
|
+
let indexFor = null;
|
|
1306
|
+
let indexByRow = /* @__PURE__ */ new Map();
|
|
1307
|
+
let keyIndexFor = null;
|
|
1308
|
+
let indexByKey = /* @__PURE__ */ new Map();
|
|
1309
|
+
function rebuildRowIndex(items) {
|
|
1310
|
+
indexFor = items;
|
|
1311
|
+
indexByRow = /* @__PURE__ */ new Map();
|
|
1312
|
+
items.forEach((row, i) => {
|
|
1313
|
+
if (!indexByRow.has(row)) indexByRow.set(row, i);
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
function indexOfRow(raw) {
|
|
1317
|
+
const items = ctrl.items;
|
|
1318
|
+
if (indexFor !== items) rebuildRowIndex(items);
|
|
1319
|
+
const hit = indexByRow.get(raw);
|
|
1320
|
+
if (hit !== void 0 && items[hit] === raw) return hit;
|
|
1321
|
+
const i = items.indexOf(raw);
|
|
1322
|
+
if (i >= 0) rebuildRowIndex(items);
|
|
1323
|
+
return i;
|
|
1324
|
+
}
|
|
1325
|
+
function rebuildKeyIndex(items) {
|
|
1326
|
+
keyIndexFor = items;
|
|
1327
|
+
indexByKey = /* @__PURE__ */ new Map();
|
|
1328
|
+
items.forEach((row, i) => {
|
|
1329
|
+
const k = rowKeyOf(row, i);
|
|
1330
|
+
if (!indexByKey.has(k)) indexByKey.set(k, i);
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1281
1333
|
function indexOfRowKey(rowKey) {
|
|
1282
|
-
|
|
1334
|
+
const items = ctrl.items;
|
|
1335
|
+
if (keyIndexFor !== items) rebuildKeyIndex(items);
|
|
1336
|
+
const hit = indexByKey.get(rowKey);
|
|
1337
|
+
if (hit !== void 0 && hit < items.length && rowKeyOf(items[hit], hit) === rowKey) return hit;
|
|
1338
|
+
const i = items.findIndex((row, j) => rowKeyOf(row, j) === rowKey);
|
|
1339
|
+
if (i >= 0) rebuildKeyIndex(items);
|
|
1340
|
+
return i;
|
|
1283
1341
|
}
|
|
1284
1342
|
function rowByKey(rowKey) {
|
|
1285
1343
|
const i = indexOfRowKey(rowKey);
|
|
@@ -1394,7 +1452,12 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1394
1452
|
return !!row && row._Type === EDITABLE_MARK;
|
|
1395
1453
|
}
|
|
1396
1454
|
function isEditingCell(rowKeyStr, field) {
|
|
1397
|
-
|
|
1455
|
+
let editableCol = false;
|
|
1456
|
+
for (const el of columnEls) if (el.field === field && el.editable) {
|
|
1457
|
+
editableCol = true;
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
if (!editableCol) return false;
|
|
1398
1461
|
return ctrl.editingKey === rowKeyStr || isEditableRow(rowByKey(rowKeyStr));
|
|
1399
1462
|
}
|
|
1400
1463
|
function commitCell(rowKey, field, value) {
|
|
@@ -2166,7 +2229,7 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2166
2229
|
*/
|
|
2167
2230
|
function rowKey(row) {
|
|
2168
2231
|
const raw = unwrapReactive(row);
|
|
2169
|
-
const i =
|
|
2232
|
+
const i = indexOfRow(raw);
|
|
2170
2233
|
if (i >= 0) return rowKeyOf(raw, i);
|
|
2171
2234
|
const direct = rowKeyOf(raw, NaN);
|
|
2172
2235
|
if (direct !== "NaN") return direct;
|
|
@@ -2213,26 +2276,50 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2213
2276
|
if (cols.length && out && typeof out === "object") for (const c of cols) out[c.field] = c.map(row?.[c.field], row, index);
|
|
2214
2277
|
return out;
|
|
2215
2278
|
}
|
|
2216
|
-
/**
|
|
2279
|
+
/** What `ctrl.mapped` was last built from — see `syncMapped`. */
|
|
2280
|
+
let mappedFrom = [];
|
|
2281
|
+
/**
|
|
2282
|
+
* Recompute `ctrl.mapped` from `ctrl.items`. Cheap no-op without a map.
|
|
2283
|
+
*
|
|
2284
|
+
* Skipped when nothing it reads has moved: the same `items` array (same length), the same
|
|
2285
|
+
* row set (`rowSetVersion`) and the same map config. It runs on EVERY notifier flush, so a
|
|
2286
|
+
* checkbox tick or a loading flip re-mapped every row — every accumulated row under infinity
|
|
2287
|
+
* scroll or page-size "all" — and handed out new `mapped` identities each time.
|
|
2288
|
+
*
|
|
2289
|
+
* Never skipped while a row can be edited IN PLACE (an inline edit, a `showForm` row, form
|
|
2290
|
+
* ops): those write straight into the row objects, which no identity check can see.
|
|
2291
|
+
*/
|
|
2217
2292
|
function syncMapped() {
|
|
2218
2293
|
if (!hasMap()) {
|
|
2219
2294
|
ctrl.mapped = ctrl.items;
|
|
2295
|
+
mappedFrom = [];
|
|
2220
2296
|
return;
|
|
2221
2297
|
}
|
|
2298
|
+
const from = [
|
|
2299
|
+
ctrl.items,
|
|
2300
|
+
ctrl.items.length,
|
|
2301
|
+
rowSetVersion,
|
|
2302
|
+
elementProps.th,
|
|
2303
|
+
opts.map
|
|
2304
|
+
];
|
|
2305
|
+
if (!(formHandle != null || formOps.length > 0 || ctrl.editingKey != null) && from.length === mappedFrom.length && from.every((v, i) => Object.is(v, mappedFrom[i]))) return;
|
|
2222
2306
|
const cols = mapColumns();
|
|
2223
2307
|
ctrl.mapped = ctrl.items.map((row, i) => mapRow(row, i, cols));
|
|
2308
|
+
mappedFrom = from;
|
|
2224
2309
|
}
|
|
2225
2310
|
/** Flatten `ctrl.items` into the ready-to-render, keyed `displayRows` list. */
|
|
2226
2311
|
function buildDisplayRows() {
|
|
2227
2312
|
const out = [];
|
|
2228
2313
|
const cols = mapColumns();
|
|
2229
2314
|
if (!isGrouped()) {
|
|
2315
|
+
syncMapped();
|
|
2316
|
+
const mapped = ctrl.mapped;
|
|
2230
2317
|
ctrl.items.forEach((row, i) => out.push({
|
|
2231
2318
|
key: `r:${rowKeyOf(row, i)}`,
|
|
2232
2319
|
kind: "row",
|
|
2233
2320
|
level: 0,
|
|
2234
2321
|
row,
|
|
2235
|
-
mapped:
|
|
2322
|
+
mapped: mapped[i]
|
|
2236
2323
|
}));
|
|
2237
2324
|
return out;
|
|
2238
2325
|
}
|
|
@@ -2275,9 +2362,29 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2275
2362
|
}
|
|
2276
2363
|
/** Build the full group tree from every matched row the source holds. */
|
|
2277
2364
|
function fullGroups() {
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2365
|
+
const src = bound ? bound.items?.() ?? [] : [];
|
|
2366
|
+
const from = [
|
|
2367
|
+
src,
|
|
2368
|
+
src.length,
|
|
2369
|
+
groupFields.join("\0"),
|
|
2370
|
+
rowSetVersion
|
|
2371
|
+
];
|
|
2372
|
+
if (!(!(formHandle != null || formOps.length > 0 || ctrl.editingKey != null) && from.length === groupTreeFrom.length && from.every((v, i) => Object.is(v, groupTreeFrom[i])))) {
|
|
2373
|
+
groupTree = buildGroups(flattenLeaves([...src]), groupFields, collapsed);
|
|
2374
|
+
groupTreeFrom = from;
|
|
2375
|
+
return groupTree;
|
|
2376
|
+
}
|
|
2377
|
+
const stamp = (nodes) => {
|
|
2378
|
+
for (const node of nodes) {
|
|
2379
|
+
node.collapsed = collapsed.has(node.path);
|
|
2380
|
+
if (node.items.length && isGroupNode(node.items[0])) stamp(node.items);
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
stamp(groupTree);
|
|
2384
|
+
return groupTree;
|
|
2280
2385
|
}
|
|
2386
|
+
let groupTreeFrom = [];
|
|
2387
|
+
let groupTree = [];
|
|
2281
2388
|
/** Index every group node by path (full, unsliced) for `groupPageInfo`. */
|
|
2282
2389
|
function indexPaths(nodes) {
|
|
2283
2390
|
for (const node of nodes) {
|
|
@@ -3908,7 +4015,7 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
3908
4015
|
});
|
|
3909
4016
|
}
|
|
3910
4017
|
async function exportReport(options) {
|
|
3911
|
-
const { exportTable } = await import("./export-
|
|
4018
|
+
const { exportTable } = await import("./export-D27RJa1w.js");
|
|
3912
4019
|
return exportTable(options);
|
|
3913
4020
|
}
|
|
3914
4021
|
function subscribe(cb) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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-
|
|
2
|
+
import { a as buildGroups, c as isGroupNode, i as searchFilterOf, o as collectGroupPaths, r as readAllRows, s as flattenLeaves } from "./data-source-read-Cp_h7NIf.js";
|
|
3
3
|
import { i as joinFilters, n as andPredicates, r as compileFilterPredicate, t as andFilters } from "./filter-eval-ChDSaAUH.js";
|
|
4
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-
|
|
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-lDR-g9Eb.js";
|
|
6
6
|
import { n as unwrapReactive } from "./reactive-Dtd-esHO.js";
|
|
7
7
|
import { t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
|
|
8
8
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
@@ -1005,6 +1005,16 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1005
1005
|
const checkedRows = /* @__PURE__ */ new Map();
|
|
1006
1006
|
let checkConfig = {};
|
|
1007
1007
|
let checkPending = false;
|
|
1008
|
+
/**
|
|
1009
|
+
* Bumped on every selection notify (a rejected toggle included — its subscribers repaint the
|
|
1010
|
+
* revert), so a listener can tell a selection change from the grid's other notifies without
|
|
1011
|
+
* diffing the store. See `MonoCheckHandle.version`.
|
|
1012
|
+
*/
|
|
1013
|
+
let checkVersion = 0;
|
|
1014
|
+
function checkChanged() {
|
|
1015
|
+
checkVersion += 1;
|
|
1016
|
+
notify();
|
|
1017
|
+
}
|
|
1008
1018
|
/** `keyValue` as a list (empty = project nothing, i.e. keep the whole row). */
|
|
1009
1019
|
function checkKeys() {
|
|
1010
1020
|
const k = checkConfig.keyValue;
|
|
@@ -1127,26 +1137,26 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1127
1137
|
if (next) checkedRows.set(key, item);
|
|
1128
1138
|
else checkedRows.delete(key);
|
|
1129
1139
|
}
|
|
1130
|
-
|
|
1140
|
+
checkChanged();
|
|
1131
1141
|
},
|
|
1132
1142
|
selectPage() {
|
|
1133
1143
|
addChecked(ctrl.items);
|
|
1134
|
-
|
|
1144
|
+
checkChanged();
|
|
1135
1145
|
},
|
|
1136
1146
|
replace(rows) {
|
|
1137
1147
|
checkedRows.clear();
|
|
1138
1148
|
addChecked(rows, false);
|
|
1139
|
-
|
|
1149
|
+
checkChanged();
|
|
1140
1150
|
},
|
|
1141
1151
|
async selectAll() {
|
|
1142
1152
|
if (checkPending) return;
|
|
1143
1153
|
if (drainIsReusable()) {
|
|
1144
1154
|
addChecked(drainedRows);
|
|
1145
|
-
|
|
1155
|
+
checkChanged();
|
|
1146
1156
|
return;
|
|
1147
1157
|
}
|
|
1148
1158
|
checkPending = true;
|
|
1149
|
-
|
|
1159
|
+
checkChanged();
|
|
1150
1160
|
try {
|
|
1151
1161
|
const select = checkSelect();
|
|
1152
1162
|
const rows = await readAllRows(bound, {
|
|
@@ -1162,7 +1172,7 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1162
1172
|
throw err;
|
|
1163
1173
|
} finally {
|
|
1164
1174
|
checkPending = false;
|
|
1165
|
-
|
|
1175
|
+
checkChanged();
|
|
1166
1176
|
}
|
|
1167
1177
|
},
|
|
1168
1178
|
clear() {
|
|
@@ -1170,14 +1180,14 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1170
1180
|
const min = checkLimits().min ?? 0;
|
|
1171
1181
|
if (min > 0) {
|
|
1172
1182
|
if (checkedRows.size <= min) {
|
|
1173
|
-
|
|
1183
|
+
checkChanged();
|
|
1174
1184
|
return;
|
|
1175
1185
|
}
|
|
1176
1186
|
const keep = [...checkedRows.entries()].slice(0, min);
|
|
1177
1187
|
checkedRows.clear();
|
|
1178
1188
|
for (const [key, row] of keep) checkedRows.set(key, row);
|
|
1179
1189
|
} else checkedRows.clear();
|
|
1180
|
-
|
|
1190
|
+
checkChanged();
|
|
1181
1191
|
},
|
|
1182
1192
|
limits: checkLimits,
|
|
1183
1193
|
get atMax() {
|
|
@@ -1188,6 +1198,9 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1188
1198
|
const min = checkLimits().min;
|
|
1189
1199
|
return min !== void 0 && checkedRows.size <= min;
|
|
1190
1200
|
},
|
|
1201
|
+
get version() {
|
|
1202
|
+
return checkVersion;
|
|
1203
|
+
},
|
|
1191
1204
|
get pending() {
|
|
1192
1205
|
return checkPending;
|
|
1193
1206
|
},
|
|
@@ -1279,8 +1292,53 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1279
1292
|
function columns() {
|
|
1280
1293
|
return columnsHandle;
|
|
1281
1294
|
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Row → index and row key → index over `ctrl.items`, built lazily per items ARRAY.
|
|
1297
|
+
*
|
|
1298
|
+
* `rowKey()` / `indexOfRowKey()` were linear scans, and they are per-row calls: every
|
|
1299
|
+
* `<mono-table-checkbox>` asks `check.isChecked(row)` on every notify, so a tick on a grid
|
|
1300
|
+
* holding N rows (infinity scroll and page-size "all" hold the whole set) cost O(N²).
|
|
1301
|
+
*
|
|
1302
|
+
* A HIT is always verified against the live array, and a MISS falls back to the scan
|
|
1303
|
+
* (rebuilding when the scan finds the row) — so an in-place mutation of `ctrl.items`, or a
|
|
1304
|
+
* key that moved, costs one rebuild and is never answered wrong.
|
|
1305
|
+
*/
|
|
1306
|
+
let indexFor = null;
|
|
1307
|
+
let indexByRow = /* @__PURE__ */ new Map();
|
|
1308
|
+
let keyIndexFor = null;
|
|
1309
|
+
let indexByKey = /* @__PURE__ */ new Map();
|
|
1310
|
+
function rebuildRowIndex(items) {
|
|
1311
|
+
indexFor = items;
|
|
1312
|
+
indexByRow = /* @__PURE__ */ new Map();
|
|
1313
|
+
items.forEach((row, i) => {
|
|
1314
|
+
if (!indexByRow.has(row)) indexByRow.set(row, i);
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
function indexOfRow(raw) {
|
|
1318
|
+
const items = ctrl.items;
|
|
1319
|
+
if (indexFor !== items) rebuildRowIndex(items);
|
|
1320
|
+
const hit = indexByRow.get(raw);
|
|
1321
|
+
if (hit !== void 0 && items[hit] === raw) return hit;
|
|
1322
|
+
const i = items.indexOf(raw);
|
|
1323
|
+
if (i >= 0) rebuildRowIndex(items);
|
|
1324
|
+
return i;
|
|
1325
|
+
}
|
|
1326
|
+
function rebuildKeyIndex(items) {
|
|
1327
|
+
keyIndexFor = items;
|
|
1328
|
+
indexByKey = /* @__PURE__ */ new Map();
|
|
1329
|
+
items.forEach((row, i) => {
|
|
1330
|
+
const k = rowKeyOf(row, i);
|
|
1331
|
+
if (!indexByKey.has(k)) indexByKey.set(k, i);
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1282
1334
|
function indexOfRowKey(rowKey) {
|
|
1283
|
-
|
|
1335
|
+
const items = ctrl.items;
|
|
1336
|
+
if (keyIndexFor !== items) rebuildKeyIndex(items);
|
|
1337
|
+
const hit = indexByKey.get(rowKey);
|
|
1338
|
+
if (hit !== void 0 && hit < items.length && rowKeyOf(items[hit], hit) === rowKey) return hit;
|
|
1339
|
+
const i = items.findIndex((row, j) => rowKeyOf(row, j) === rowKey);
|
|
1340
|
+
if (i >= 0) rebuildKeyIndex(items);
|
|
1341
|
+
return i;
|
|
1284
1342
|
}
|
|
1285
1343
|
function rowByKey(rowKey) {
|
|
1286
1344
|
const i = indexOfRowKey(rowKey);
|
|
@@ -1395,7 +1453,12 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
1395
1453
|
return !!row && row._Type === EDITABLE_MARK;
|
|
1396
1454
|
}
|
|
1397
1455
|
function isEditingCell(rowKeyStr, field) {
|
|
1398
|
-
|
|
1456
|
+
let editableCol = false;
|
|
1457
|
+
for (const el of columnEls) if (el.field === field && el.editable) {
|
|
1458
|
+
editableCol = true;
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
if (!editableCol) return false;
|
|
1399
1462
|
return ctrl.editingKey === rowKeyStr || isEditableRow(rowByKey(rowKeyStr));
|
|
1400
1463
|
}
|
|
1401
1464
|
function commitCell(rowKey, field, value) {
|
|
@@ -2167,7 +2230,7 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2167
2230
|
*/
|
|
2168
2231
|
function rowKey(row) {
|
|
2169
2232
|
const raw = unwrapReactive(row);
|
|
2170
|
-
const i =
|
|
2233
|
+
const i = indexOfRow(raw);
|
|
2171
2234
|
if (i >= 0) return rowKeyOf(raw, i);
|
|
2172
2235
|
const direct = rowKeyOf(raw, NaN);
|
|
2173
2236
|
if (direct !== "NaN") return direct;
|
|
@@ -2214,26 +2277,50 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2214
2277
|
if (cols.length && out && typeof out === "object") for (const c of cols) out[c.field] = c.map(row?.[c.field], row, index);
|
|
2215
2278
|
return out;
|
|
2216
2279
|
}
|
|
2217
|
-
/**
|
|
2280
|
+
/** What `ctrl.mapped` was last built from — see `syncMapped`. */
|
|
2281
|
+
let mappedFrom = [];
|
|
2282
|
+
/**
|
|
2283
|
+
* Recompute `ctrl.mapped` from `ctrl.items`. Cheap no-op without a map.
|
|
2284
|
+
*
|
|
2285
|
+
* Skipped when nothing it reads has moved: the same `items` array (same length), the same
|
|
2286
|
+
* row set (`rowSetVersion`) and the same map config. It runs on EVERY notifier flush, so a
|
|
2287
|
+
* checkbox tick or a loading flip re-mapped every row — every accumulated row under infinity
|
|
2288
|
+
* scroll or page-size "all" — and handed out new `mapped` identities each time.
|
|
2289
|
+
*
|
|
2290
|
+
* Never skipped while a row can be edited IN PLACE (an inline edit, a `showForm` row, form
|
|
2291
|
+
* ops): those write straight into the row objects, which no identity check can see.
|
|
2292
|
+
*/
|
|
2218
2293
|
function syncMapped() {
|
|
2219
2294
|
if (!hasMap()) {
|
|
2220
2295
|
ctrl.mapped = ctrl.items;
|
|
2296
|
+
mappedFrom = [];
|
|
2221
2297
|
return;
|
|
2222
2298
|
}
|
|
2299
|
+
const from = [
|
|
2300
|
+
ctrl.items,
|
|
2301
|
+
ctrl.items.length,
|
|
2302
|
+
rowSetVersion,
|
|
2303
|
+
elementProps.th,
|
|
2304
|
+
opts.map
|
|
2305
|
+
];
|
|
2306
|
+
if (!(formHandle != null || formOps.length > 0 || ctrl.editingKey != null) && from.length === mappedFrom.length && from.every((v, i) => Object.is(v, mappedFrom[i]))) return;
|
|
2223
2307
|
const cols = mapColumns();
|
|
2224
2308
|
ctrl.mapped = ctrl.items.map((row, i) => mapRow(row, i, cols));
|
|
2309
|
+
mappedFrom = from;
|
|
2225
2310
|
}
|
|
2226
2311
|
/** Flatten `ctrl.items` into the ready-to-render, keyed `displayRows` list. */
|
|
2227
2312
|
function buildDisplayRows() {
|
|
2228
2313
|
const out = [];
|
|
2229
2314
|
const cols = mapColumns();
|
|
2230
2315
|
if (!isGrouped()) {
|
|
2316
|
+
syncMapped();
|
|
2317
|
+
const mapped = ctrl.mapped;
|
|
2231
2318
|
ctrl.items.forEach((row, i) => out.push({
|
|
2232
2319
|
key: `r:${rowKeyOf(row, i)}`,
|
|
2233
2320
|
kind: "row",
|
|
2234
2321
|
level: 0,
|
|
2235
2322
|
row,
|
|
2236
|
-
mapped:
|
|
2323
|
+
mapped: mapped[i]
|
|
2237
2324
|
}));
|
|
2238
2325
|
return out;
|
|
2239
2326
|
}
|
|
@@ -2276,9 +2363,29 @@ function monoDataGrid(ds = null, opts = {}) {
|
|
|
2276
2363
|
}
|
|
2277
2364
|
/** Build the full group tree from every matched row the source holds. */
|
|
2278
2365
|
function fullGroups() {
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2366
|
+
const src = bound ? bound.items?.() ?? [] : [];
|
|
2367
|
+
const from = [
|
|
2368
|
+
src,
|
|
2369
|
+
src.length,
|
|
2370
|
+
groupFields.join("\0"),
|
|
2371
|
+
rowSetVersion
|
|
2372
|
+
];
|
|
2373
|
+
if (!(!(formHandle != null || formOps.length > 0 || ctrl.editingKey != null) && from.length === groupTreeFrom.length && from.every((v, i) => Object.is(v, groupTreeFrom[i])))) {
|
|
2374
|
+
groupTree = buildGroups(flattenLeaves([...src]), groupFields, collapsed);
|
|
2375
|
+
groupTreeFrom = from;
|
|
2376
|
+
return groupTree;
|
|
2377
|
+
}
|
|
2378
|
+
const stamp = (nodes) => {
|
|
2379
|
+
for (const node of nodes) {
|
|
2380
|
+
node.collapsed = collapsed.has(node.path);
|
|
2381
|
+
if (node.items.length && isGroupNode(node.items[0])) stamp(node.items);
|
|
2382
|
+
}
|
|
2383
|
+
};
|
|
2384
|
+
stamp(groupTree);
|
|
2385
|
+
return groupTree;
|
|
2281
2386
|
}
|
|
2387
|
+
let groupTreeFrom = [];
|
|
2388
|
+
let groupTree = [];
|
|
2282
2389
|
/** Index every group node by path (full, unsliced) for `groupPageInfo`. */
|
|
2283
2390
|
function indexPaths(nodes) {
|
|
2284
2391
|
for (const node of nodes) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as registerPendingProperty, h as monoApplyPhantomOptions, m as isMonoSsrApp, t as applyMonoUIDefaults, v as monoPendingActive, w as watchSkeletonActivation, x as monoSkeletonInternals } from "./mono-ui-kvLVIf1V.js";
|
|
2
2
|
import { html } from "lit";
|
|
3
3
|
|
|
4
4
|
//#region src/composables/mono-pending.ts
|