@motifx-community/ui 0.1.0-beta.11 → 0.1.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/dist/components/combobox/ComboBox.d.ts +5 -0
- package/dist/components/combobox/combo-box-props.d.ts +6 -0
- package/dist/components/datagrid/DataGrid.d.ts +4 -1
- package/dist/components/datagrid/grid-lookup.d.ts +8 -0
- package/dist/components/datagrid/model/FilterModel.d.ts +5 -0
- package/dist/components/datagrid/model/LookupTexts.d.ts +2 -0
- package/dist/components/datagrid/model/LookupValues.d.ts +4 -0
- package/dist/components/datagrid/view/ActionWidths.d.ts +13 -3
- package/dist/components/datagrid/view/ColumnStyles.d.ts +3 -1
- package/dist/components/datagrid/view/GridRow.d.ts +1 -1
- package/dist/components/dropdown/DropDown.d.ts +5 -0
- package/dist/components/dropdown/drop-down-props.d.ts +11 -2
- package/dist/components/filterbuilder/filter-builder-lookup.d.ts +3 -0
- package/dist/components/listbox/ListBox.d.ts +5 -0
- package/dist/components/listbox/item-template.d.ts +4 -0
- package/dist/components/listbox/list-box-props.d.ts +6 -0
- package/dist/components/listbox/select-all-state.d.ts +1 -1
- package/dist/components/ribbonmenu/RibbonKeyHints.d.ts +1 -0
- package/dist/components/tabdocs/DocumentTab.d.ts +0 -1
- package/dist/components/tabdocs/PhoneBar.d.ts +0 -1
- package/dist/components/tagbox/TagBox.d.ts +5 -0
- package/dist/components/tagbox/tag-box-props.d.ts +6 -0
- package/dist/components/toolbar/Toolbar.d.ts +8 -0
- package/dist/components/treeview/TreeView.d.ts +8 -4
- package/dist/components/treeview/tree-view-item-template.d.ts +4 -0
- package/dist/core/measure/after-frame.d.ts +7 -0
- package/dist/core/measure/drawn.d.ts +7 -0
- package/dist/core/measure/index.d.ts +1 -1
- package/dist/core/show-icon.d.ts +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +652 -312
- package/dist/index.js.map +1 -1
- package/dist/parts/data/DataItems.d.ts +24 -0
- package/dist/parts/data/KeyedItems.d.ts +31 -5
- package/dist/parts/data/normalize-key.d.ts +7 -0
- package/dist/parts/list/OptionList.d.ts +4 -3
- package/dist/parts/list/option-parts.d.ts +1 -1
- package/dist/styles.css +74 -23
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/appbar.md +1 -1
- package/docs/appmenu-api.md +1 -1
- package/docs/appmenu-programmatic.md +1 -1
- package/docs/appmenu-search.md +1 -1
- package/docs/appmenu.md +1 -1
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bar-gauge-angles.md +1 -1
- package/docs/bar-gauge-data.md +1 -1
- package/docs/bar-gauge-labels.md +1 -1
- package/docs/bar-gauge.md +1 -1
- package/docs/barcode.md +1 -1
- package/docs/bottomnavigation.md +1 -1
- package/docs/bottomsheet.md +1 -1
- package/docs/breadcrumb.md +1 -1
- package/docs/button.md +1 -1
- package/docs/buttongroup.md +1 -1
- package/docs/buttons.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/chart-bars.md +1 -1
- package/docs/chart-candles.md +1 -1
- package/docs/chart-funnel.md +1 -1
- package/docs/chart-heatmap.md +1 -1
- package/docs/chart-lines.md +1 -1
- package/docs/chart-live.md +1 -1
- package/docs/chart-pie.md +1 -1
- package/docs/chart-radar.md +1 -1
- package/docs/chart-ranges.md +1 -1
- package/docs/chart-references.md +1 -1
- package/docs/chart-scatter.md +1 -1
- package/docs/chart-waterfall.md +1 -1
- package/docs/chart-zoom.md +1 -1
- package/docs/chart.md +1 -1
- package/docs/checkbox.md +1 -1
- package/docs/chip.md +1 -1
- package/docs/choice.md +1 -1
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +2 -1
- package/docs/commands.md +1 -1
- package/docs/control.md +1 -1
- package/docs/data.md +1 -1
- package/docs/datagrid-api.md +1 -1
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +1 -1
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +1 -1
- package/docs/datagrid-lookups.md +4 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datebox.md +1 -1
- package/docs/daterangebox.md +1 -1
- package/docs/display.md +1 -1
- package/docs/draggable.md +1 -1
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +4 -3
- package/docs/editors.md +1 -1
- package/docs/feedback.md +1 -1
- package/docs/fileuploader.md +1 -1
- package/docs/filterbuilder.md +1 -1
- package/docs/formlayout.md +1 -1
- package/docs/foundations.md +1 -1
- package/docs/gallery.md +1 -1
- package/docs/gauge-base.md +1 -1
- package/docs/gauge-circular.md +1 -1
- package/docs/gauge-dashboards.md +1 -1
- package/docs/gauge-linear.md +1 -1
- package/docs/gauge-markers.md +1 -1
- package/docs/gauge-marks.md +1 -1
- package/docs/gauge-ranges.md +1 -1
- package/docs/gauge-scales.md +1 -1
- package/docs/gauge.md +1 -1
- package/docs/home.md +1 -1
- package/docs/keyboard.md +1 -1
- package/docs/language.md +1 -1
- package/docs/layout.md +1 -1
- package/docs/listbox.md +4 -3
- package/docs/loadpanel.md +1 -1
- package/docs/lookup.md +1 -1
- package/docs/menus-api.md +1 -1
- package/docs/menus-context.md +1 -1
- package/docs/menus-customization.md +1 -1
- package/docs/menus-merging.md +1 -1
- package/docs/menus-programmatic.md +1 -1
- package/docs/menus.md +1 -1
- package/docs/multiview.md +1 -1
- package/docs/navigation.md +1 -1
- package/docs/numberbox.md +1 -1
- package/docs/otpinput.md +1 -1
- package/docs/pagination.md +1 -1
- package/docs/popover.md +1 -1
- package/docs/progress.md +1 -1
- package/docs/qrcode.md +1 -1
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/resizable.md +1 -1
- package/docs/ribbonmenu-api.md +1 -1
- package/docs/ribbonmenu-commands.md +1 -1
- package/docs/ribbonmenu-customization.md +1 -1
- package/docs/ribbonmenu-display.md +3 -3
- package/docs/ribbonmenu-layouts.md +1 -1
- package/docs/ribbonmenu-programmatic.md +1 -1
- package/docs/ribbonmenu.md +1 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/scrollview.md +1 -1
- package/docs/shortcuteditor.md +1 -1
- package/docs/showcase-home.md +1 -1
- package/docs/showcase.md +1 -1
- package/docs/signature.md +1 -1
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +1 -1
- package/docs/sortable.md +1 -1
- package/docs/sparkline.md +1 -1
- package/docs/speeddial.md +1 -1
- package/docs/splitter.md +1 -1
- package/docs/stepper.md +1 -1
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +1 -1
- package/docs/tagbox.md +4 -3
- package/docs/textarea.md +1 -1
- package/docs/textbox.md +1 -1
- package/docs/tileview.md +1 -1
- package/docs/timeline.md +1 -1
- package/docs/toast.md +1 -1
- package/docs/tokens.md +1 -1
- package/docs/toolbar.md +1 -1
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +3 -3
- package/docs/validationsummary.md +1 -1
- package/docs/window.md +1 -1
- package/docs/wizard.md +1 -1
- package/llms-full.txt +174 -167
- package/llms.txt +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -227,6 +227,42 @@ function forgetReads() {
|
|
|
227
227
|
roundReads.pages.clear();
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
|
+
//#region src/core/measure/after-frame.ts
|
|
231
|
+
/** A window that draws no frames (in the background) still runs it this much later. */
|
|
232
|
+
var LONGEST_WAIT$1 = 200;
|
|
233
|
+
var FRAME_TIME$1 = 16;
|
|
234
|
+
/**
|
|
235
|
+
* Runs `then` in a task after the next frame of `view`: the frame's own work (style, layout, paint) is done by then, so
|
|
236
|
+
* reading or moving focus there lays nothing out. A window that draws no frames runs it on a timer. Returns what takes
|
|
237
|
+
* it back.
|
|
238
|
+
*/
|
|
239
|
+
function afterFrame(view, then) {
|
|
240
|
+
let done = false;
|
|
241
|
+
let frame = 0;
|
|
242
|
+
let after;
|
|
243
|
+
const run = () => {
|
|
244
|
+
if (done) return;
|
|
245
|
+
stop();
|
|
246
|
+
then();
|
|
247
|
+
};
|
|
248
|
+
try {
|
|
249
|
+
if (!view.closed && typeof view.requestAnimationFrame === "function") frame = view.requestAnimationFrame(() => after = setTimeout(run, 0));
|
|
250
|
+
} catch {
|
|
251
|
+
frame = 0;
|
|
252
|
+
}
|
|
253
|
+
const timer = setTimeout(run, frame ? LONGEST_WAIT$1 : FRAME_TIME$1);
|
|
254
|
+
function stop() {
|
|
255
|
+
done = true;
|
|
256
|
+
clearTimeout(timer);
|
|
257
|
+
clearTimeout(after);
|
|
258
|
+
if (!frame) return;
|
|
259
|
+
try {
|
|
260
|
+
view.cancelAnimationFrame(frame);
|
|
261
|
+
} catch {}
|
|
262
|
+
}
|
|
263
|
+
return stop;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
230
266
|
//#region src/core/measure/pending-scrolls.ts
|
|
231
267
|
/** Scrolls written through a component that core has not made yet (it calls the method a microtask later). */
|
|
232
268
|
var pending$2 = /* @__PURE__ */ new WeakMap();
|
|
@@ -265,6 +301,9 @@ function pendingScroll(component) {
|
|
|
265
301
|
//#region src/core/measure/scroll-memory.ts
|
|
266
302
|
var known$1 = /* @__PURE__ */ new WeakMap();
|
|
267
303
|
var heard = /* @__PURE__ */ new WeakSet();
|
|
304
|
+
/** Elements scrolled and not read yet, and the ones of each window that wait for its next frame. */
|
|
305
|
+
var unread = /* @__PURE__ */ new WeakSet();
|
|
306
|
+
var waiting$2 = /* @__PURE__ */ new WeakMap();
|
|
268
307
|
var AT_START = {
|
|
269
308
|
start: 0,
|
|
270
309
|
top: 0
|
|
@@ -275,9 +314,18 @@ function rememberScrolls(view) {
|
|
|
275
314
|
heard.add(view);
|
|
276
315
|
onDocument(view.document, "scroll", (e) => {
|
|
277
316
|
const el = e.target;
|
|
278
|
-
if (isElement(el))
|
|
279
|
-
|
|
280
|
-
|
|
317
|
+
if (!isElement(el)) return;
|
|
318
|
+
unread.add(el);
|
|
319
|
+
let scrolled = waiting$2.get(view);
|
|
320
|
+
if (scrolled) {
|
|
321
|
+
scrolled.add(el);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
scrolled = /* @__PURE__ */ new Set([el]);
|
|
325
|
+
waiting$2.set(view, scrolled);
|
|
326
|
+
afterFrame(view, () => {
|
|
327
|
+
waiting$2.delete(view);
|
|
328
|
+
for (const one of scrolled) if (unread.has(one)) readScroll(one);
|
|
281
329
|
});
|
|
282
330
|
}, {
|
|
283
331
|
capture: true,
|
|
@@ -286,7 +334,9 @@ function rememberScrolls(view) {
|
|
|
286
334
|
}
|
|
287
335
|
/** Notes how far `el` is scrolled, as the layer read it or wrote it. */
|
|
288
336
|
function noteScroll(el, place, by = false) {
|
|
289
|
-
const
|
|
337
|
+
const whole = !by && place.start !== void 0 && place.top !== void 0;
|
|
338
|
+
if (whole) unread.delete(el);
|
|
339
|
+
const was = whole ? AT_START : scrollOf$2(el);
|
|
290
340
|
const start = place.start === void 0 ? was.start : Math.max(0, (by ? was.start : 0) + place.start);
|
|
291
341
|
const top = place.top === void 0 ? was.top : Math.max(0, (by ? was.top : 0) + place.top);
|
|
292
342
|
known$1.set(el, {
|
|
@@ -298,7 +348,7 @@ function noteScroll(el, place, by = false) {
|
|
|
298
348
|
function knownScrollOf(component) {
|
|
299
349
|
const el = elementOf$2(component);
|
|
300
350
|
if (!el) return AT_START;
|
|
301
|
-
const seen =
|
|
351
|
+
const seen = scrollOf$2(el);
|
|
302
352
|
const pending = pendingScroll(component);
|
|
303
353
|
if (!pending) return seen;
|
|
304
354
|
return {
|
|
@@ -306,13 +356,25 @@ function knownScrollOf(component) {
|
|
|
306
356
|
top: Math.max(0, (pending.top ?? seen.top) + pending.byTop)
|
|
307
357
|
};
|
|
308
358
|
}
|
|
359
|
+
/** How far `el` is scrolled as told; one scrolled and not read yet is read now. */
|
|
360
|
+
function scrollOf$2(el) {
|
|
361
|
+
if (unread.has(el)) readScroll(el);
|
|
362
|
+
return known$1.get(el) ?? AT_START;
|
|
363
|
+
}
|
|
364
|
+
function readScroll(el) {
|
|
365
|
+
unread.delete(el);
|
|
366
|
+
if (el.isConnected) known$1.set(el, {
|
|
367
|
+
start: Math.abs(el.scrollLeft),
|
|
368
|
+
top: el.scrollTop
|
|
369
|
+
});
|
|
370
|
+
}
|
|
309
371
|
//#endregion
|
|
310
372
|
//#region src/core/measure/rounds.ts
|
|
311
373
|
var MOST_ROUNDS = 8;
|
|
312
374
|
var MOST_TRIES = 16;
|
|
313
375
|
/** A window that draws no frames (in the background, being closed) still runs its work this much later. */
|
|
314
|
-
var LONGEST_WAIT
|
|
315
|
-
var FRAME_TIME
|
|
376
|
+
var LONGEST_WAIT = 200;
|
|
377
|
+
var FRAME_TIME = 16;
|
|
316
378
|
var SKIPPED = Symbol("skipped");
|
|
317
379
|
var frames = /* @__PURE__ */ new WeakMap();
|
|
318
380
|
/** Jobs not run yet, by owner and read: the same read and write asked for again run once. */
|
|
@@ -469,7 +531,7 @@ function ask(frame) {
|
|
|
469
531
|
} catch {
|
|
470
532
|
id = 0;
|
|
471
533
|
}
|
|
472
|
-
const timer = setTimeout(go, id ? LONGEST_WAIT
|
|
534
|
+
const timer = setTimeout(go, id ? LONGEST_WAIT : FRAME_TIME);
|
|
473
535
|
frame.waiting = () => {
|
|
474
536
|
clearTimeout(timer);
|
|
475
537
|
if (!id) return;
|
|
@@ -769,9 +831,6 @@ function everyFrame(owner, read, write) {
|
|
|
769
831
|
}
|
|
770
832
|
//#endregion
|
|
771
833
|
//#region src/core/measure/drawn.ts
|
|
772
|
-
/** A window that draws no frames (in the background) still runs it this much later. */
|
|
773
|
-
var LONGEST_WAIT = 200;
|
|
774
|
-
var FRAME_TIME = 16;
|
|
775
834
|
/**
|
|
776
835
|
* Runs `then` once the window of `owner` has drawn its next frame: what was written by then is laid out and on the
|
|
777
836
|
* screen, so moving focus or reading costs no layout there. A window that draws no frames runs it on a timer. Nothing
|
|
@@ -780,35 +839,56 @@ var FRAME_TIME = 16;
|
|
|
780
839
|
function afterDrawn(owner, then) {
|
|
781
840
|
const view = viewOf(owner);
|
|
782
841
|
if (!view) return () => {};
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
stop();
|
|
789
|
-
if (owner.isDisposed) return;
|
|
790
|
-
try {
|
|
791
|
-
untracked(then);
|
|
792
|
-
} catch (error) {
|
|
793
|
-
errorHandler.report(error instanceof Error ? error : new Error(String(error)));
|
|
794
|
-
}
|
|
795
|
-
};
|
|
842
|
+
return afterFrame(view, () => {
|
|
843
|
+
if (!owner.isDisposed) runSafely(then);
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
function runSafely(then) {
|
|
796
847
|
try {
|
|
797
|
-
|
|
798
|
-
} catch {
|
|
799
|
-
|
|
848
|
+
untracked(then);
|
|
849
|
+
} catch (error) {
|
|
850
|
+
errorHandler.report(error instanceof Error ? error : new Error(String(error)));
|
|
800
851
|
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
852
|
+
}
|
|
853
|
+
/** What waits for the next frame of each window: every measure asked until then runs in one run there. */
|
|
854
|
+
var waitingIn = /* @__PURE__ */ new WeakMap();
|
|
855
|
+
/**
|
|
856
|
+
* Reads once the window of `owner` has drawn its next frame, in one run with every other measure asked for that frame:
|
|
857
|
+
* the page is laid out by then and the reads come before the writes, so nothing is laid out to read. What `write`
|
|
858
|
+
* writes shows a frame later. For a first measure that can wait a frame (a part that clips what does not fit until
|
|
859
|
+
* then). Returns what takes it back.
|
|
860
|
+
*/
|
|
861
|
+
function measureAfterDrawn(owner, read, write) {
|
|
862
|
+
const view = viewOf(owner);
|
|
863
|
+
if (!view) return () => {};
|
|
864
|
+
const waiting = {
|
|
865
|
+
owner,
|
|
866
|
+
ask: () => measure(owner, read, write),
|
|
867
|
+
asked: null
|
|
868
|
+
};
|
|
869
|
+
let batch = waitingIn.get(view);
|
|
870
|
+
if (!batch) {
|
|
871
|
+
const all = /* @__PURE__ */ new Set();
|
|
872
|
+
batch = {
|
|
873
|
+
all,
|
|
874
|
+
stop: afterFrame(view, () => {
|
|
875
|
+
waitingIn.delete(view);
|
|
876
|
+
const live = [...all].filter((one) => !one.owner.isDisposed);
|
|
877
|
+
if (!live.length) return;
|
|
878
|
+
for (const one of live) runSafely(() => one.asked = one.ask());
|
|
879
|
+
runSafely(() => measureNow(live[0].owner));
|
|
880
|
+
})
|
|
881
|
+
};
|
|
882
|
+
waitingIn.set(view, batch);
|
|
810
883
|
}
|
|
811
|
-
|
|
884
|
+
const { all, stop } = batch;
|
|
885
|
+
all.add(waiting);
|
|
886
|
+
return () => {
|
|
887
|
+
waiting.asked?.();
|
|
888
|
+
if (!all.delete(waiting) || all.size || waitingIn.get(view)?.all !== all) return;
|
|
889
|
+
stop();
|
|
890
|
+
waitingIn.delete(view);
|
|
891
|
+
};
|
|
812
892
|
}
|
|
813
893
|
//#endregion
|
|
814
894
|
//#region src/core/component-tree.ts
|
|
@@ -6617,12 +6697,11 @@ function givenList(list) {
|
|
|
6617
6697
|
//#endregion
|
|
6618
6698
|
//#region src/core/show-icon.ts
|
|
6619
6699
|
/**
|
|
6620
|
-
* Shows an icon in `into`, a part of the kit: an `<img>` for an address, or the app's component.
|
|
6621
|
-
* it
|
|
6700
|
+
* Shows an icon in `into`, a part of the kit: an `<img>` for an address, or the app's component. It goes with `into`;
|
|
6701
|
+
* `clearParts(into)` takes it out for another one.
|
|
6622
6702
|
*/
|
|
6623
6703
|
function showIcon(source, into) {
|
|
6624
|
-
|
|
6625
|
-
return () => removePart(icon);
|
|
6704
|
+
iconPart(into, source);
|
|
6626
6705
|
}
|
|
6627
6706
|
//#endregion
|
|
6628
6707
|
//#region src/core/icon-source.ts
|
|
@@ -7606,7 +7685,6 @@ var MenuList = class MenuList extends Component {
|
|
|
7606
7685
|
let description = null;
|
|
7607
7686
|
let shortcut = null;
|
|
7608
7687
|
let arrow = null;
|
|
7609
|
-
let release = null;
|
|
7610
7688
|
let source = null;
|
|
7611
7689
|
let caption = null;
|
|
7612
7690
|
const bind = (read, write) => button.bindings.watch(() => {
|
|
@@ -7642,8 +7720,8 @@ var MenuList = class MenuList extends Component {
|
|
|
7642
7720
|
bind(() => fieldOf(item, "icon", this), (next) => {
|
|
7643
7721
|
if (Object.is(next, source)) return;
|
|
7644
7722
|
source = next;
|
|
7645
|
-
|
|
7646
|
-
|
|
7723
|
+
clearParts(icon);
|
|
7724
|
+
if (next) showIcon(next, icon);
|
|
7647
7725
|
});
|
|
7648
7726
|
bind(() => givenField(item, "description") ?? "", (value) => {
|
|
7649
7727
|
if (!value) {
|
|
@@ -7687,7 +7765,6 @@ var MenuList = class MenuList extends Component {
|
|
|
7687
7765
|
this.keepSubmenu(entry);
|
|
7688
7766
|
});
|
|
7689
7767
|
button.motif.setDisposable(() => {
|
|
7690
|
-
release?.();
|
|
7691
7768
|
if (this.isDisposed || !this.built) return;
|
|
7692
7769
|
if (this.built.get(item) === entry) this.built.delete(item);
|
|
7693
7770
|
if (this.hoverEntry === entry) this.cancelHover();
|
|
@@ -7970,9 +8047,7 @@ var Button = class extends Control {
|
|
|
7970
8047
|
this.listen();
|
|
7971
8048
|
this.placeChildren();
|
|
7972
8049
|
this.motif.setDisposable(() => {
|
|
7973
|
-
|
|
7974
|
-
parts.releaseIcon();
|
|
7975
|
-
parts.stopArrowLabel?.();
|
|
8050
|
+
this.parts.stopArrowLabel?.();
|
|
7976
8051
|
const content = this.peekProperty("dropDown");
|
|
7977
8052
|
if (content && !content.isDisposed) content.dispose();
|
|
7978
8053
|
});
|
|
@@ -8168,7 +8243,6 @@ var Button = class extends Control {
|
|
|
8168
8243
|
stopArrowLabel: null,
|
|
8169
8244
|
caption: null,
|
|
8170
8245
|
icon: null,
|
|
8171
|
-
releaseIcon: () => {},
|
|
8172
8246
|
spinner: null,
|
|
8173
8247
|
chevron: null,
|
|
8174
8248
|
popup: null,
|
|
@@ -8251,8 +8325,6 @@ var Button = class extends Control {
|
|
|
8251
8325
|
renderIcon() {
|
|
8252
8326
|
const parts = this.parts;
|
|
8253
8327
|
const icon = this.peekProperty("icon");
|
|
8254
|
-
parts.releaseIcon();
|
|
8255
|
-
parts.releaseIcon = () => {};
|
|
8256
8328
|
mark(this, "data-icon", !!icon);
|
|
8257
8329
|
this.renderIconOnly();
|
|
8258
8330
|
if (!icon) {
|
|
@@ -8266,7 +8338,7 @@ var Button = class extends Control {
|
|
|
8266
8338
|
parts.icon.attr.add({ "aria-hidden": "true" });
|
|
8267
8339
|
}
|
|
8268
8340
|
clearParts(parts.icon);
|
|
8269
|
-
|
|
8341
|
+
showIcon(icon, parts.icon);
|
|
8270
8342
|
}
|
|
8271
8343
|
renderBusy(busy) {
|
|
8272
8344
|
const parts = this.parts;
|
|
@@ -8712,7 +8784,6 @@ var Field = class extends Control {
|
|
|
8712
8784
|
parts.stopClearLabel?.();
|
|
8713
8785
|
parts.leaveGroup?.();
|
|
8714
8786
|
parts.stopLanding?.();
|
|
8715
|
-
parts.releaseIcon();
|
|
8716
8787
|
parts.valueChanged.dispose();
|
|
8717
8788
|
parts.validated.dispose();
|
|
8718
8789
|
});
|
|
@@ -9109,7 +9180,6 @@ var Field = class extends Control {
|
|
|
9109
9180
|
counterText: "",
|
|
9110
9181
|
clear: null,
|
|
9111
9182
|
stopClearLabel: null,
|
|
9112
|
-
releaseIcon: () => {},
|
|
9113
9183
|
buttons: createSignal([]),
|
|
9114
9184
|
buttonParts: /* @__PURE__ */ new Map(),
|
|
9115
9185
|
buttonAreas: /* @__PURE__ */ new WeakSet(),
|
|
@@ -9239,10 +9309,8 @@ var Field = class extends Control {
|
|
|
9239
9309
|
this.renderDescribedBy();
|
|
9240
9310
|
}
|
|
9241
9311
|
renderIcon() {
|
|
9242
|
-
|
|
9312
|
+
this.parts;
|
|
9243
9313
|
const icon = this.peekProperty("icon");
|
|
9244
|
-
parts.releaseIcon();
|
|
9245
|
-
parts.releaseIcon = () => {};
|
|
9246
9314
|
mark(this, "data-icon", !!icon);
|
|
9247
9315
|
if (!icon) {
|
|
9248
9316
|
this.removeArea("icon");
|
|
@@ -9251,7 +9319,7 @@ var Field = class extends Control {
|
|
|
9251
9319
|
const area = this.area("icon");
|
|
9252
9320
|
put(area, "aria-hidden", "true");
|
|
9253
9321
|
clearParts(area);
|
|
9254
|
-
|
|
9322
|
+
showIcon(icon, area);
|
|
9255
9323
|
}
|
|
9256
9324
|
/**
|
|
9257
9325
|
* Gives the places the buttons now. Each place lists its buttons once (`start`, `end`): a field of a button changes
|
|
@@ -9293,7 +9361,6 @@ var Field = class extends Control {
|
|
|
9293
9361
|
let caption = null;
|
|
9294
9362
|
let captionText = "";
|
|
9295
9363
|
let source;
|
|
9296
|
-
let release = null;
|
|
9297
9364
|
const bind = (read, write) => buttonPart.bindings.watch(() => {
|
|
9298
9365
|
const value = read();
|
|
9299
9366
|
untracked(() => write(value));
|
|
@@ -9313,10 +9380,10 @@ var Field = class extends Control {
|
|
|
9313
9380
|
});
|
|
9314
9381
|
bind(() => givenField(button, "icon"), (next) => {
|
|
9315
9382
|
kept$1(icon, next !== void 0);
|
|
9316
|
-
if (Object.is(next, source)
|
|
9383
|
+
if (Object.is(next, source)) return;
|
|
9317
9384
|
source = next;
|
|
9318
|
-
|
|
9319
|
-
|
|
9385
|
+
clearParts(icon);
|
|
9386
|
+
if (next !== void 0) showIcon(next, icon);
|
|
9320
9387
|
});
|
|
9321
9388
|
buttonPart.motif.on("click", (_, event) => givenValue(button, "click")?.({
|
|
9322
9389
|
button,
|
|
@@ -9324,7 +9391,6 @@ var Field = class extends Control {
|
|
|
9324
9391
|
event
|
|
9325
9392
|
}));
|
|
9326
9393
|
buttonPart.motif.setDisposable(() => {
|
|
9327
|
-
release?.();
|
|
9328
9394
|
if (parts.buttonParts.get(button) === buttonPart) parts.buttonParts.delete(button);
|
|
9329
9395
|
});
|
|
9330
9396
|
return buttonPart;
|
|
@@ -12446,6 +12512,7 @@ function isEmptyKey(key) {
|
|
|
12446
12512
|
}
|
|
12447
12513
|
//#endregion
|
|
12448
12514
|
//#region src/parts/data/KeyedItems.ts
|
|
12515
|
+
/** The caches of a source, by value field and by the `normalizeKey` given (`null`: none). */
|
|
12449
12516
|
var registry = /* @__PURE__ */ new WeakMap();
|
|
12450
12517
|
var watched = /* @__PURE__ */ new WeakSet();
|
|
12451
12518
|
/** The same text for equal keys: `1` and `'1'` are one key, equal dates are one key. */
|
|
@@ -12456,14 +12523,32 @@ function keyString(key) {
|
|
|
12456
12523
|
}
|
|
12457
12524
|
var sameText = (a, b, locale) => foldText(a.trim(), locale) === foldText(b.trim(), locale);
|
|
12458
12525
|
/**
|
|
12526
|
+
* A key as databases commonly compare keys when they disregard what this cache does not: trailing spaces (a `char(n)`
|
|
12527
|
+
* column), case, accents, the width of a character, or how a number is written (`'007'` and `7`). `null` for a key
|
|
12528
|
+
* that is not a text or a number. It never decides a match: it only tells the cache to ask the source again.
|
|
12529
|
+
*/
|
|
12530
|
+
function looseKey(key) {
|
|
12531
|
+
if (typeof key === "number" || typeof key === "bigint") return String(key);
|
|
12532
|
+
if (typeof key !== "string") return null;
|
|
12533
|
+
const text = key.normalize("NFKD").replace(/\p{M}+/gu, "").trim().toLowerCase().replace(/ı/g, "i");
|
|
12534
|
+
return /^[+-]?\d+(\.\d+)?$/.test(text) ? String(Number(text)) : text;
|
|
12535
|
+
}
|
|
12536
|
+
/**
|
|
12459
12537
|
* Items by key, from a data source of the data layer (any adapter) or an array: what a grid cell, a
|
|
12460
12538
|
* drop-down's field or a filter list needs to turn a key into its item. Keys are requested when they
|
|
12461
12539
|
* are needed and only once. Keys requested at the same moment go out together, in one request
|
|
12462
12540
|
* per `batchSize` keys (`valueField in [...]`), or in one request per key for a service that only returns
|
|
12463
|
-
* one item by key (`resolve: 'byKey'`). There is one cache per source
|
|
12464
|
-
* every grid, column and list that uses it (`KeyedItems.of`). Requests go through the source's
|
|
12541
|
+
* one item by key (`resolve: 'byKey'`). There is one cache per source, value field and `normalizeKey`,
|
|
12542
|
+
* shared by every grid, column and list that uses it (`KeyedItems.of`). Requests go through the source's
|
|
12465
12543
|
* adapter, so the source's own query (filter, page, search) never changes.
|
|
12466
12544
|
*
|
|
12545
|
+
* Which item a key stands for is the source's decision: a source may compare keys its own way (a
|
|
12546
|
+
* database that disregards trailing spaces, case or accents, or reads `'007'` as `7`). The items of a
|
|
12547
|
+
* batch are matched to the keys asked for; when keys are left over while the source returned items no
|
|
12548
|
+
* key matched here, or items that differ from a key only in such a way, those keys are asked for one
|
|
12549
|
+
* by one, and what the source returns for a key is that key's item. `normalizeKey` tells the cache the
|
|
12550
|
+
* rule itself: keys equal once normalized are one key, also in an array, where no source decides.
|
|
12551
|
+
*
|
|
12467
12552
|
* @example
|
|
12468
12553
|
* const customers = KeyedItems.of(customerSource, 'id');
|
|
12469
12554
|
* customers.onResolved(() => redraw());
|
|
@@ -12475,8 +12560,11 @@ var KeyedItems = class KeyedItems {
|
|
|
12475
12560
|
static keyString(key) {
|
|
12476
12561
|
return keyString(key);
|
|
12477
12562
|
}
|
|
12478
|
-
/**
|
|
12479
|
-
|
|
12563
|
+
/**
|
|
12564
|
+
* The shared cache of a source, value field and `normalizeKey`. Every data source over the same adapter shares it; give
|
|
12565
|
+
* the same `normalizeKey` function wherever the source is used, so they share one cache.
|
|
12566
|
+
*/
|
|
12567
|
+
static of(source, valueField, normalizeKey) {
|
|
12480
12568
|
const owner = Array.isArray(source) ? source : source.adapter;
|
|
12481
12569
|
if (!Array.isArray(source) && valueField !== void 0) {
|
|
12482
12570
|
const fields = owner.keys.fields;
|
|
@@ -12484,14 +12572,17 @@ var KeyedItems = class KeyedItems {
|
|
|
12484
12572
|
}
|
|
12485
12573
|
let byField = registry.get(owner);
|
|
12486
12574
|
if (!byField) registry.set(owner, byField = /* @__PURE__ */ new Map());
|
|
12487
|
-
let
|
|
12488
|
-
if (!
|
|
12575
|
+
let byRule = byField.get(valueField ?? "");
|
|
12576
|
+
if (!byRule) byField.set(valueField ?? "", byRule = /* @__PURE__ */ new Map());
|
|
12577
|
+
let items = byRule.get(normalizeKey ?? null);
|
|
12578
|
+
if (!items) byRule.set(normalizeKey ?? null, items = new KeyedItems(source, valueField, normalizeKey ?? void 0));
|
|
12489
12579
|
if (!Array.isArray(source)) items.watch(source);
|
|
12490
12580
|
return items;
|
|
12491
12581
|
}
|
|
12492
|
-
constructor(source, valueField) {
|
|
12582
|
+
constructor(source, valueField, normalizeKey) {
|
|
12493
12583
|
_defineProperty(this, "source", void 0);
|
|
12494
12584
|
_defineProperty(this, "valueField", void 0);
|
|
12585
|
+
_defineProperty(this, "normalizeKey", void 0);
|
|
12495
12586
|
_defineProperty(
|
|
12496
12587
|
this,
|
|
12497
12588
|
/**
|
|
@@ -12535,6 +12626,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12535
12626
|
);
|
|
12536
12627
|
this.source = source;
|
|
12537
12628
|
this.valueField = valueField;
|
|
12629
|
+
this.normalizeKey = normalizeKey;
|
|
12538
12630
|
const adapter = this.adapter;
|
|
12539
12631
|
this.resolve = adapter && !adapter.capabilities.filter ? "byKey" : "batch";
|
|
12540
12632
|
adapter?.onChanged((e) => this.changed(e.changes));
|
|
@@ -12549,12 +12641,24 @@ var KeyedItems = class KeyedItems {
|
|
|
12549
12641
|
if (this.inMemory) return item !== null && typeof item === "object" && "value" in item ? item.value : item;
|
|
12550
12642
|
return this.adapter.keyOf(item);
|
|
12551
12643
|
}
|
|
12644
|
+
/** The string the cache keeps a key under: equal for keys it counts as one (`normalizeKey`). */
|
|
12645
|
+
keyStringOf(key) {
|
|
12646
|
+
return keyString(this.normalizeKey ? this.normalizeKey(key) : key);
|
|
12647
|
+
}
|
|
12552
12648
|
sameKey(a, b) {
|
|
12553
|
-
return
|
|
12649
|
+
return this.keyStringOf(a) === this.keyStringOf(b);
|
|
12650
|
+
}
|
|
12651
|
+
/**
|
|
12652
|
+
* The item a key stands for, as a string: equal for keys the source matched to the same item (`'A'` and `'A '`
|
|
12653
|
+
* where it disregards trailing spaces). A key not found yet stands for itself.
|
|
12654
|
+
*/
|
|
12655
|
+
itemKeyOf(key) {
|
|
12656
|
+
const item = this.get(key)?.item;
|
|
12657
|
+
return item === void 0 ? this.keyStringOf(key) : this.keyStringOf(this.valueOf(item));
|
|
12554
12658
|
}
|
|
12555
12659
|
/** What is known of a key now, or `undefined` if it was never requested (an array knows every key). */
|
|
12556
12660
|
get(key) {
|
|
12557
|
-
const ks =
|
|
12661
|
+
const ks = this.keyStringOf(key);
|
|
12558
12662
|
const known = this.entries.get(ks);
|
|
12559
12663
|
if (known || !this.inMemory) return known;
|
|
12560
12664
|
const item = this.fromArray(ks);
|
|
@@ -12569,7 +12673,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12569
12673
|
const waits = /* @__PURE__ */ new Set();
|
|
12570
12674
|
for (const key of keys) {
|
|
12571
12675
|
if (isEmptyKey(key)) continue;
|
|
12572
|
-
const ks =
|
|
12676
|
+
const ks = this.keyStringOf(key);
|
|
12573
12677
|
const known = this.entries.get(ks);
|
|
12574
12678
|
if (known && known.state !== "loading") continue;
|
|
12575
12679
|
const wait = this.waiting.get(ks);
|
|
@@ -12589,7 +12693,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12589
12693
|
retry(keys) {
|
|
12590
12694
|
const list = [...keys];
|
|
12591
12695
|
for (const key of list) {
|
|
12592
|
-
const ks =
|
|
12696
|
+
const ks = this.keyStringOf(key);
|
|
12593
12697
|
if (this.entries.get(ks)?.failed) this.entries.delete(ks);
|
|
12594
12698
|
}
|
|
12595
12699
|
return this.request(list);
|
|
@@ -12597,7 +12701,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12597
12701
|
/** Stores what an editor selected for a key, its item or its text, which appears immediately without a request. */
|
|
12598
12702
|
remember(key, itemOrText) {
|
|
12599
12703
|
if (key === null || key === void 0) return;
|
|
12600
|
-
const ks =
|
|
12704
|
+
const ks = this.keyStringOf(key);
|
|
12601
12705
|
this.entries.set(ks, typeof itemOrText === "string" ? {
|
|
12602
12706
|
state: "found",
|
|
12603
12707
|
text: itemOrText
|
|
@@ -12615,7 +12719,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12615
12719
|
const out = [];
|
|
12616
12720
|
for (const item of pool) {
|
|
12617
12721
|
if (!sameText(search.textOf(item), text, locale)) continue;
|
|
12618
|
-
const ks =
|
|
12722
|
+
const ks = this.keyStringOf(this.valueOf(item));
|
|
12619
12723
|
if (seen.has(ks)) continue;
|
|
12620
12724
|
seen.add(ks);
|
|
12621
12725
|
out.push(item);
|
|
@@ -12699,7 +12803,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12699
12803
|
const rows = this.source;
|
|
12700
12804
|
if (!this.index || !this.index.has(ks) && rows.length !== this.indexedLength) {
|
|
12701
12805
|
this.index = /* @__PURE__ */ new Map();
|
|
12702
|
-
for (const item of rows) this.index.set(
|
|
12806
|
+
for (const item of rows) this.index.set(this.keyStringOf(this.valueOf(item)), item);
|
|
12703
12807
|
this.indexedLength = rows.length;
|
|
12704
12808
|
}
|
|
12705
12809
|
return this.index.get(ks);
|
|
@@ -12726,6 +12830,10 @@ var KeyedItems = class KeyedItems {
|
|
|
12726
12830
|
jobs.push(() => this.loadMany(field, part, generation));
|
|
12727
12831
|
}
|
|
12728
12832
|
}
|
|
12833
|
+
await this.inTurns(jobs);
|
|
12834
|
+
}
|
|
12835
|
+
/** Runs the jobs `parallelRequests` at a time. */
|
|
12836
|
+
async inTurns(jobs) {
|
|
12729
12837
|
let next = 0;
|
|
12730
12838
|
const worker = async () => {
|
|
12731
12839
|
while (next < jobs.length) await jobs[next++]();
|
|
@@ -12741,24 +12849,56 @@ var KeyedItems = class KeyedItems {
|
|
|
12741
12849
|
}
|
|
12742
12850
|
if (generation !== this.generation) return;
|
|
12743
12851
|
const found = /* @__PURE__ */ new Map();
|
|
12744
|
-
for (const row of rows ?? []) found.set(
|
|
12745
|
-
|
|
12746
|
-
|
|
12852
|
+
for (const row of rows ?? []) found.set(this.keyStringOf(this.valueOf(row)), row);
|
|
12853
|
+
const matched = /* @__PURE__ */ new Set();
|
|
12854
|
+
const left = [];
|
|
12855
|
+
const settled = [];
|
|
12856
|
+
for (const [ks, key] of part) {
|
|
12747
12857
|
const item = found.get(ks);
|
|
12858
|
+
if (item !== void 0) matched.add(item);
|
|
12859
|
+
if (item === void 0 && rows) {
|
|
12860
|
+
left.push([ks, key]);
|
|
12861
|
+
continue;
|
|
12862
|
+
}
|
|
12863
|
+
this.waiting.delete(ks);
|
|
12748
12864
|
this.entries.set(ks, item !== void 0 ? {
|
|
12749
12865
|
state: "found",
|
|
12750
12866
|
item
|
|
12751
|
-
} :
|
|
12867
|
+
} : {
|
|
12752
12868
|
state: "missing",
|
|
12753
12869
|
failed: true
|
|
12754
12870
|
});
|
|
12871
|
+
settled.push(ks);
|
|
12755
12872
|
}
|
|
12756
|
-
|
|
12873
|
+
const own = rows !== null && left.length > 0 && (rows.some((row) => !matched.has(row)) || this.looselyIn(left, rows));
|
|
12874
|
+
for (const [ks] of own ? [] : left) {
|
|
12875
|
+
this.waiting.delete(ks);
|
|
12876
|
+
this.entries.set(ks, { state: "missing" });
|
|
12877
|
+
settled.push(ks);
|
|
12878
|
+
}
|
|
12879
|
+
if (settled.length) this.resolvedEmitter.fire(settled);
|
|
12880
|
+
if (own) await this.inTurns(left.map(([ks, key]) => () => this.loadOne(ks, key, generation, field)));
|
|
12757
12881
|
}
|
|
12758
|
-
|
|
12882
|
+
/** Whether an item differs from one of `keys` only in what databases often disregard (`looseKey`). */
|
|
12883
|
+
looselyIn(keys, rows) {
|
|
12884
|
+
const loose = /* @__PURE__ */ new Set();
|
|
12885
|
+
for (const row of rows) {
|
|
12886
|
+
const key = looseKey(this.valueOf(row));
|
|
12887
|
+
if (key !== null) loose.add(key);
|
|
12888
|
+
}
|
|
12889
|
+
return keys.some(([, key]) => {
|
|
12890
|
+
const k = looseKey(key);
|
|
12891
|
+
return k !== null && loose.has(k);
|
|
12892
|
+
});
|
|
12893
|
+
}
|
|
12894
|
+
/** One key asked for alone: by the adapter's key, or by `field` when the value is not the key. What comes is that key's. */
|
|
12895
|
+
async loadOne(ks, key, generation, field) {
|
|
12759
12896
|
let entry;
|
|
12760
12897
|
try {
|
|
12761
|
-
const item = await this.adapter.
|
|
12898
|
+
const item = field && this.valueField ? (await this.adapter.load({
|
|
12899
|
+
filter: data.where(field, "=", key),
|
|
12900
|
+
take: 1
|
|
12901
|
+
})).rows[0] : await this.adapter.byKey(key);
|
|
12762
12902
|
entry = item === void 0 ? { state: "missing" } : {
|
|
12763
12903
|
state: "found",
|
|
12764
12904
|
item
|
|
@@ -12780,7 +12920,7 @@ var KeyedItems = class KeyedItems {
|
|
|
12780
12920
|
for (const item of items) {
|
|
12781
12921
|
const value = this.valueOf(item);
|
|
12782
12922
|
if (value === null || value === void 0) continue;
|
|
12783
|
-
const ks =
|
|
12923
|
+
const ks = this.keyStringOf(value);
|
|
12784
12924
|
if (this.entries.get(ks)?.state === "found") continue;
|
|
12785
12925
|
this.entries.set(ks, {
|
|
12786
12926
|
state: "found",
|
|
@@ -12796,11 +12936,10 @@ var KeyedItems = class KeyedItems {
|
|
|
12796
12936
|
if (this.entries.size) this.clear();
|
|
12797
12937
|
return;
|
|
12798
12938
|
}
|
|
12939
|
+
const changed = new Set(changes.map((change) => this.keyStringOf(change.key)));
|
|
12799
12940
|
const keys = [];
|
|
12800
|
-
for (const
|
|
12801
|
-
|
|
12802
|
-
if (this.entries.delete(ks)) keys.push(ks);
|
|
12803
|
-
}
|
|
12941
|
+
for (const [ks, entry] of this.entries) if (changed.has(ks) || entry.item !== void 0 && changed.has(this.keyStringOf(this.valueOf(entry.item)))) keys.push(ks);
|
|
12942
|
+
for (const ks of keys) this.entries.delete(ks);
|
|
12804
12943
|
if (keys.length) this.resolvedEmitter.fire(keys);
|
|
12805
12944
|
}
|
|
12806
12945
|
batchFieldOfKey() {
|
|
@@ -12835,6 +12974,15 @@ var DataItems = class {
|
|
|
12835
12974
|
"valueField",
|
|
12836
12975
|
void 0
|
|
12837
12976
|
);
|
|
12977
|
+
_defineProperty(
|
|
12978
|
+
this,
|
|
12979
|
+
/**
|
|
12980
|
+
* Values equal once normalized are one value (`KeyedItems.normalizeKey`): the rule of keys a source compares its own
|
|
12981
|
+
* way, for items in memory and to spare the source the requests that find it out.
|
|
12982
|
+
*/
|
|
12983
|
+
"normalizeKey",
|
|
12984
|
+
void 0
|
|
12985
|
+
);
|
|
12838
12986
|
_defineProperty(this, "searchMode", "contains");
|
|
12839
12987
|
_defineProperty(this, "onChanged", this.changedEmitter.event);
|
|
12840
12988
|
}
|
|
@@ -12916,25 +13064,73 @@ var DataItems = class {
|
|
|
12916
13064
|
const near = this.findLoaded(value, valueOf, same);
|
|
12917
13065
|
if (near !== void 0 || !this.source) return near;
|
|
12918
13066
|
if (isEmptyKey(value)) return void 0;
|
|
12919
|
-
const known =
|
|
13067
|
+
const known = this.keyed(this.source);
|
|
12920
13068
|
await known.request([value]);
|
|
12921
13069
|
return known.get(value)?.item;
|
|
12922
13070
|
}
|
|
12923
13071
|
findLoaded(value, valueOf, same = Object.is) {
|
|
12924
|
-
return (this.source ? this.loaded : this.array).find((
|
|
13072
|
+
return (this.source ? this.loaded : this.array).find(this.matcher(value, valueOf, same));
|
|
13073
|
+
}
|
|
13074
|
+
/**
|
|
13075
|
+
* Whether `item` is the item of `value`: its value is the same, the same once normalized (`normalizeKey`), or the
|
|
13076
|
+
* data source matched `value` to it (a key it compares its own way, such as `'A '` for `'A'`).
|
|
13077
|
+
*/
|
|
13078
|
+
holds(item, value, valueOf, same = Object.is) {
|
|
13079
|
+
return this.matcher(value, valueOf, same)(item);
|
|
13080
|
+
}
|
|
13081
|
+
/** The test of `holds` for one value, with what is known of it read once: for many items. */
|
|
13082
|
+
matcher(value, valueOf, same = Object.is) {
|
|
13083
|
+
if (isEmptyKey(value)) return (item) => same(valueOf(item), value);
|
|
13084
|
+
const normalized = this.normalizeKey ? this.keyStringOf(value) : null;
|
|
13085
|
+
const matched = this.known(value)?.item;
|
|
13086
|
+
const matchedKey = matched === void 0 ? null : this.keyStringOf(valueOf(matched));
|
|
13087
|
+
return (item) => {
|
|
13088
|
+
const own = valueOf(item);
|
|
13089
|
+
if (same(own, value)) return true;
|
|
13090
|
+
if (normalized === null && matchedKey === null) return false;
|
|
13091
|
+
const key = this.keyStringOf(own);
|
|
13092
|
+
return key === normalized || key === matchedKey;
|
|
13093
|
+
};
|
|
13094
|
+
}
|
|
13095
|
+
/**
|
|
13096
|
+
* Whether two values stand for the same item: they are the same, the same once normalized (`normalizeKey`), or the
|
|
13097
|
+
* data source matched them to one item (`'A '` and `'A'` where it disregards trailing spaces).
|
|
13098
|
+
*/
|
|
13099
|
+
sameItem(a, b) {
|
|
13100
|
+
if (Object.is(a, b)) return true;
|
|
13101
|
+
if (isEmptyKey(a) || isEmptyKey(b)) return false;
|
|
13102
|
+
if (this.normalizeKey && this.keyStringOf(a) === this.keyStringOf(b)) return true;
|
|
13103
|
+
if (!this.source) return false;
|
|
13104
|
+
const cache = this.keyed(this.source);
|
|
13105
|
+
if (cache.get(a)?.item === void 0 && cache.get(b)?.item === void 0) return false;
|
|
13106
|
+
return cache.itemKeyOf(a) === cache.itemKeyOf(b);
|
|
13107
|
+
}
|
|
13108
|
+
/** Of `values` (the chosen ones), the one that stands for the same item as `value` (`sameItem`); `null` when none does. */
|
|
13109
|
+
heldIn(values, value) {
|
|
13110
|
+
if (values.has(value)) return { value };
|
|
13111
|
+
if (!values.size || !this.normalizeKey && !this.source) return null;
|
|
13112
|
+
for (const held of values) if (this.sameItem(held, value)) return { value: held };
|
|
13113
|
+
return null;
|
|
12925
13114
|
}
|
|
12926
13115
|
/** What is known of the item `find` requested from the data source: loading, found, or not in the source. */
|
|
12927
13116
|
known(value) {
|
|
12928
13117
|
if (!this.source || isEmptyKey(value)) return void 0;
|
|
12929
|
-
return
|
|
13118
|
+
return this.keyed(this.source).get(value);
|
|
12930
13119
|
}
|
|
12931
13120
|
/** Requests the item of `value` from the data source again after its request failed. */
|
|
12932
13121
|
async retry(value) {
|
|
12933
13122
|
if (!this.source || isEmptyKey(value)) return void 0;
|
|
12934
|
-
const known =
|
|
13123
|
+
const known = this.keyed(this.source);
|
|
12935
13124
|
await known.retry([value]);
|
|
12936
13125
|
return known.get(value)?.item;
|
|
12937
13126
|
}
|
|
13127
|
+
/** The cache of the data source, shared by every list and grid that reads it with the same value field and rule. */
|
|
13128
|
+
keyed(source) {
|
|
13129
|
+
return KeyedItems.of(source, this.valueField, this.normalizeKey);
|
|
13130
|
+
}
|
|
13131
|
+
keyStringOf(value) {
|
|
13132
|
+
return KeyedItems.keyString(this.normalizeKey ? this.normalizeKey(value) : value);
|
|
13133
|
+
}
|
|
12938
13134
|
reload() {
|
|
12939
13135
|
return this.source ? this.source.reload() : Promise.resolve();
|
|
12940
13136
|
}
|
|
@@ -12987,7 +13183,8 @@ var OptionList = class extends Component {
|
|
|
12987
13183
|
this,
|
|
12988
13184
|
/**
|
|
12989
13185
|
* Draws an option's content instead of its text, into `host`. `option` holds the option's parts, for an owner that
|
|
12990
|
-
* marks the option itself.
|
|
13186
|
+
* marks the option itself. `host` (`option.text`) is made for each drawing and goes when the option is drawn again
|
|
13187
|
+
* or goes; a cleanup function returned is given to it and runs then.
|
|
12991
13188
|
*/
|
|
12992
13189
|
"draw",
|
|
12993
13190
|
null
|
|
@@ -13539,7 +13736,7 @@ var OptionList = class extends Component {
|
|
|
13539
13736
|
makeOption(entry) {
|
|
13540
13737
|
const row = loose("div", "mx-list__item");
|
|
13541
13738
|
row.attr.add({ role: "option" });
|
|
13542
|
-
|
|
13739
|
+
let text = part(row, "span", "mx-list__text");
|
|
13543
13740
|
const option = {
|
|
13544
13741
|
row,
|
|
13545
13742
|
text,
|
|
@@ -13549,13 +13746,9 @@ var OptionList = class extends Component {
|
|
|
13549
13746
|
let checkHost = null;
|
|
13550
13747
|
let iconHost = null;
|
|
13551
13748
|
let iconShown = null;
|
|
13552
|
-
let releaseIcon = null;
|
|
13553
13749
|
let drawnWith;
|
|
13554
|
-
let releaseDrawn = null;
|
|
13555
13750
|
let shownText = null;
|
|
13556
13751
|
row.motif.setDisposable(() => {
|
|
13557
|
-
releaseIcon?.();
|
|
13558
|
-
releaseDrawn?.();
|
|
13559
13752
|
if (this.partsOf?.get(entry) === option) this.partsOf.delete(entry);
|
|
13560
13753
|
});
|
|
13561
13754
|
this.bind(row, () => entry.at.value, (index) => {
|
|
@@ -13603,28 +13796,28 @@ var OptionList = class extends Component {
|
|
|
13603
13796
|
this.bind(row, () => (this.state.value, this.iconOf?.(item) ?? null), (source) => {
|
|
13604
13797
|
if (source === iconShown) return;
|
|
13605
13798
|
iconShown = source;
|
|
13606
|
-
releaseIcon?.();
|
|
13607
|
-
releaseIcon = null;
|
|
13608
13799
|
removePart(iconHost);
|
|
13609
13800
|
iconHost = null;
|
|
13610
13801
|
if (source === null) return;
|
|
13611
13802
|
iconHost = partBefore(row, text, "span", "mx-list__icon");
|
|
13612
13803
|
iconHost.attr.add({ "aria-hidden": "true" });
|
|
13613
|
-
|
|
13804
|
+
showIcon(source, iconHost);
|
|
13614
13805
|
});
|
|
13615
13806
|
this.bind(row, () => (this.state.value, {
|
|
13616
13807
|
draw: this.draw,
|
|
13617
13808
|
value: this.draw ? null : this.textOf(item)
|
|
13618
13809
|
}), ({ draw, value }) => {
|
|
13619
13810
|
if (draw !== drawnWith && (draw || drawnWith)) {
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13811
|
+
if (drawnWith) {
|
|
13812
|
+
const drawn = text;
|
|
13813
|
+
text = option.text = partBefore(row, drawn, "span", "mx-list__text");
|
|
13814
|
+
removePart(drawn);
|
|
13815
|
+
}
|
|
13623
13816
|
drawnWith = draw;
|
|
13624
13817
|
shownText = null;
|
|
13625
13818
|
if (draw) {
|
|
13626
13819
|
const release = draw(item, text, option);
|
|
13627
|
-
|
|
13820
|
+
if (typeof release === "function") text.motif.setDisposable(release);
|
|
13628
13821
|
}
|
|
13629
13822
|
}
|
|
13630
13823
|
if (value !== null && value !== shownText) {
|
|
@@ -13636,16 +13829,11 @@ var OptionList = class extends Component {
|
|
|
13636
13829
|
}
|
|
13637
13830
|
/**
|
|
13638
13831
|
* Binds an option's text to `read`, read again when the items are given again or refreshed, and written in place.
|
|
13639
|
-
* For a `draw` that writes the text itself; the
|
|
13832
|
+
* For a `draw` that writes the text itself; the binding goes with the text part it writes.
|
|
13640
13833
|
*/
|
|
13641
13834
|
bindText(option, read) {
|
|
13642
|
-
|
|
13643
|
-
this.bind(
|
|
13644
|
-
if (value !== null) text$1(option.text, value);
|
|
13645
|
-
});
|
|
13646
|
-
return () => {
|
|
13647
|
-
live = false;
|
|
13648
|
-
};
|
|
13835
|
+
const text = option.text;
|
|
13836
|
+
this.bind(text, () => (this.state.value, read()), (value) => text$1(text, value));
|
|
13649
13837
|
}
|
|
13650
13838
|
/** The index of the option an event started in, asked of the options drawn; -1 for none. */
|
|
13651
13839
|
indexOf(e) {
|
|
@@ -13704,6 +13892,7 @@ var OWN$82 = [
|
|
|
13704
13892
|
var FUNCTIONS$7 = [
|
|
13705
13893
|
"textField",
|
|
13706
13894
|
"valueField",
|
|
13895
|
+
"normalizeKey",
|
|
13707
13896
|
"iconField",
|
|
13708
13897
|
"groupField",
|
|
13709
13898
|
"enabledField",
|
|
@@ -13740,9 +13929,12 @@ var DropDown = class extends Field {
|
|
|
13740
13929
|
if (own.onClosed) this.onClosed(own.onClosed);
|
|
13741
13930
|
const parts = this.dropParts;
|
|
13742
13931
|
glyphPart(this.area("actions"), "chevron-down", "mx-drop-down__chevron");
|
|
13932
|
+
this.observeProperty("dataSource", () => this.renderSource());
|
|
13933
|
+
this.observeProperty("valueField", (field) => parts.source.valueField = typeof field === "string" ? field : void 0);
|
|
13743
13934
|
const stopField = follow$1(this, "field", () => {
|
|
13744
13935
|
this.getProperty("textField");
|
|
13745
13936
|
this.getProperty("valueField");
|
|
13937
|
+
parts.source.normalizeKey = this.getProperty("normalizeKey") ?? void 0;
|
|
13746
13938
|
return {
|
|
13747
13939
|
tick: `${this.getProperty("chosenTick") ?? 0}|${this.getProperty("refreshed") ?? 0}`,
|
|
13748
13940
|
items: this.items,
|
|
@@ -13752,8 +13944,6 @@ var DropDown = class extends Field {
|
|
|
13752
13944
|
template: this.getProperty("fieldTemplate")
|
|
13753
13945
|
};
|
|
13754
13946
|
}, ({ tick, items, value, valueText, placeholder, template }) => this.renderField(tick, items, value, valueText, placeholder, template));
|
|
13755
|
-
this.observeProperty("dataSource", () => this.renderSource());
|
|
13756
|
-
this.observeProperty("valueField", (field) => parts.source.valueField = typeof field === "string" ? field : void 0);
|
|
13757
13947
|
parts.source.onChanged(() => this.sourceChanged());
|
|
13758
13948
|
this.listen();
|
|
13759
13949
|
this.motif.setDisposable(() => {
|
|
@@ -13762,7 +13952,6 @@ var DropDown = class extends Field {
|
|
|
13762
13952
|
parts.source.dispose();
|
|
13763
13953
|
parts.stopList?.();
|
|
13764
13954
|
parts.stopLanguage?.();
|
|
13765
|
-
parts.releaseField();
|
|
13766
13955
|
parts.opened.dispose();
|
|
13767
13956
|
parts.closed.dispose();
|
|
13768
13957
|
});
|
|
@@ -13785,6 +13974,12 @@ var DropDown = class extends Field {
|
|
|
13785
13974
|
set valueField(value) {
|
|
13786
13975
|
this.assignProperty("valueField", functionValue(value));
|
|
13787
13976
|
}
|
|
13977
|
+
get normalizeKey() {
|
|
13978
|
+
return this.getProperty("normalizeKey");
|
|
13979
|
+
}
|
|
13980
|
+
set normalizeKey(value) {
|
|
13981
|
+
this.assignProperty("normalizeKey", functionValue(value));
|
|
13982
|
+
}
|
|
13788
13983
|
get iconField() {
|
|
13789
13984
|
return this.getProperty("iconField");
|
|
13790
13985
|
}
|
|
@@ -13973,7 +14168,6 @@ var DropDown = class extends Field {
|
|
|
13973
14168
|
valuePart: part(textPart, "span", "mx-drop-down__value"),
|
|
13974
14169
|
waitPart: null,
|
|
13975
14170
|
drawnPart: null,
|
|
13976
|
-
releaseField: () => {},
|
|
13977
14171
|
popup: null,
|
|
13978
14172
|
list: null,
|
|
13979
14173
|
search: null,
|
|
@@ -14000,22 +14194,26 @@ var DropDown = class extends Field {
|
|
|
14000
14194
|
if (field !== void 0) return readItemField(item, field, "value");
|
|
14001
14195
|
return itemOwnValue(item);
|
|
14002
14196
|
}
|
|
14197
|
+
/** The test for the item of `value`: the same value, the same once normalized, or the one the data source matched to it. */
|
|
14198
|
+
holderOf(value) {
|
|
14199
|
+
return this.dropParts.source.matcher(value, (item) => this.itemValue(item), (a, b) => this.sameValue(a, b));
|
|
14200
|
+
}
|
|
14003
14201
|
indexOfValue() {
|
|
14004
|
-
const
|
|
14202
|
+
const holds = this.holderOf(this.peekValue());
|
|
14005
14203
|
const list = this.dropParts.list;
|
|
14006
14204
|
if (this.dropParts.source.dataSource && list) {
|
|
14007
14205
|
for (let i = 0; i < list.count; i++) {
|
|
14008
14206
|
const item = list.itemOf(i);
|
|
14009
|
-
if (item !== void 0 &&
|
|
14207
|
+
if (item !== void 0 && holds(item)) return i;
|
|
14010
14208
|
}
|
|
14011
14209
|
return -1;
|
|
14012
14210
|
}
|
|
14013
|
-
return this.visibleItems().findIndex(
|
|
14211
|
+
return this.visibleItems().findIndex(holds);
|
|
14014
14212
|
}
|
|
14015
14213
|
/** The item of `value`: among the items in memory, or the one known from a data source (asked by key when needed). */
|
|
14016
14214
|
itemOfValue(items, value) {
|
|
14017
14215
|
const parts = this.dropParts;
|
|
14018
|
-
const same =
|
|
14216
|
+
const same = this.holderOf(value);
|
|
14019
14217
|
if (!parts.source.dataSource) return givenList(items).find(same);
|
|
14020
14218
|
if (isEmptyKey(value)) return void 0;
|
|
14021
14219
|
if (parts.chosen !== void 0 && same(parts.chosen)) return parts.chosen;
|
|
@@ -14223,7 +14421,7 @@ var DropDown = class extends Field {
|
|
|
14223
14421
|
const list = new OptionList();
|
|
14224
14422
|
list.textOf = (item) => this.itemText(item);
|
|
14225
14423
|
list.enabledOf = (item) => readItemField(item, this.peekProperty("enabledField"), "enabled") !== false;
|
|
14226
|
-
list.isSelected = (item) => this.
|
|
14424
|
+
list.isSelected = (item) => this.holderOf(this.peekValue())(item);
|
|
14227
14425
|
list.emptyText = () => parts.source.loading ? uiLocale.strings.loading : uiLocale.strings.noItems;
|
|
14228
14426
|
list.onChosen((e) => this.choose(e.item, e.event));
|
|
14229
14427
|
popup.controls.add(list);
|
|
@@ -14307,8 +14505,6 @@ var DropDown = class extends Field {
|
|
|
14307
14505
|
const same = parts.fieldShown?.length === shown.length && shown.every((v, i) => Object.is(v, parts.fieldShown[i]));
|
|
14308
14506
|
parts.fieldShown = shown;
|
|
14309
14507
|
if (same) return;
|
|
14310
|
-
parts.releaseField();
|
|
14311
|
-
parts.releaseField = () => {};
|
|
14312
14508
|
parts.state = state;
|
|
14313
14509
|
const loading = state === "loading";
|
|
14314
14510
|
const empty = item === void 0 && !text && !loading;
|
|
@@ -14324,12 +14520,12 @@ var DropDown = class extends Field {
|
|
|
14324
14520
|
kept$1(parts.waitPart, loading);
|
|
14325
14521
|
}
|
|
14326
14522
|
if (loading) this.addSpinner();
|
|
14327
|
-
|
|
14523
|
+
const before = parts.drawnPart;
|
|
14524
|
+
parts.drawnPart = drawn ? partBefore(parts.textPart, before, "span", "mx-drop-down__drawn") : null;
|
|
14525
|
+
removePart(before);
|
|
14328
14526
|
if (parts.drawnPart) {
|
|
14329
|
-
|
|
14330
|
-
parts.drawnPart.
|
|
14331
|
-
if (drawn) parts.releaseField = template(item, parts.drawnPart) ?? (() => {});
|
|
14332
|
-
kept$1(parts.drawnPart, drawn);
|
|
14527
|
+
const release = template(item, parts.drawnPart);
|
|
14528
|
+
if (typeof release === "function") parts.drawnPart.motif.setDisposable(release);
|
|
14333
14529
|
}
|
|
14334
14530
|
text$1(parts.valuePart, loading || drawn ? "" : empty ? placeholder : text);
|
|
14335
14531
|
kept$1(parts.valuePart, !loading && !drawn);
|
|
@@ -24644,6 +24840,8 @@ var Toolbar = class extends Control {
|
|
|
24644
24840
|
"fit",
|
|
24645
24841
|
(bar) => {
|
|
24646
24842
|
this.parts.measuring = false;
|
|
24843
|
+
this.parts.stopFirst = null;
|
|
24844
|
+
if (bar.shown) this.parts.first = false;
|
|
24647
24845
|
this.parts.laidOut = bar.length;
|
|
24648
24846
|
if (!this.menuMode()) return;
|
|
24649
24847
|
untracked(() => {
|
|
@@ -24651,6 +24849,7 @@ var Toolbar = class extends Control {
|
|
|
24651
24849
|
for (const kid of bar.kids) if (!out.includes(kid)) mark(kid.part, "data-overflowed", false);
|
|
24652
24850
|
this.parts.out = new Set(out.map((kid) => kid.part));
|
|
24653
24851
|
this.showOverflow(out);
|
|
24852
|
+
this.keepRoom(bar, out);
|
|
24654
24853
|
});
|
|
24655
24854
|
}
|
|
24656
24855
|
);
|
|
@@ -24765,6 +24964,7 @@ var Toolbar = class extends Control {
|
|
|
24765
24964
|
overflowed: /* @__PURE__ */ new Set(),
|
|
24766
24965
|
more: null,
|
|
24767
24966
|
stopMoreLabel: null,
|
|
24967
|
+
reserve: null,
|
|
24768
24968
|
restyleQueued: false,
|
|
24769
24969
|
laying: [],
|
|
24770
24970
|
laidOut: -1,
|
|
@@ -24776,6 +24976,8 @@ var Toolbar = class extends Control {
|
|
|
24776
24976
|
stretched: false,
|
|
24777
24977
|
measuring: false,
|
|
24778
24978
|
stopRefit: null,
|
|
24979
|
+
first: true,
|
|
24980
|
+
stopFirst: null,
|
|
24779
24981
|
moreLength: null,
|
|
24780
24982
|
itemClick: new Emitter()
|
|
24781
24983
|
};
|
|
@@ -24907,7 +25109,7 @@ var Toolbar = class extends Control {
|
|
|
24907
25109
|
/** The parts in the bar in order, without the "more" button. For a list or a condition, the parts it holds. */
|
|
24908
25110
|
barContent(from = this, found = []) {
|
|
24909
25111
|
for (const part of from.controls.items) {
|
|
24910
|
-
if (part === this.parts.more) continue;
|
|
25112
|
+
if (part === this.parts.more || part === this.parts.reserve) continue;
|
|
24911
25113
|
if (isElement(part.element)) found.push(part);
|
|
24912
25114
|
else this.barContent(part, found);
|
|
24913
25115
|
}
|
|
@@ -24928,7 +25130,7 @@ var Toolbar = class extends Control {
|
|
|
24928
25130
|
}
|
|
24929
25131
|
/** A control added to the bar or taken away: the arrows and the room follow. The "more" button is no part of the bar. */
|
|
24930
25132
|
childChanged(control) {
|
|
24931
|
-
if (control === this.parts.more) return;
|
|
25133
|
+
if (control === this.parts.more || control === this.parts.reserve) return;
|
|
24932
25134
|
this.queueRestyle();
|
|
24933
25135
|
this.layout();
|
|
24934
25136
|
}
|
|
@@ -24985,12 +25187,19 @@ var Toolbar = class extends Control {
|
|
|
24985
25187
|
parts.out.clear();
|
|
24986
25188
|
for (const kid of parts.laying) mark(kid.part, "data-overflowed", false);
|
|
24987
25189
|
if (parts.more) mark(parts.more, "data-idle", true);
|
|
25190
|
+
if (parts.reserve) mark(parts.reserve, "data-idle", true);
|
|
24988
25191
|
parts.stopRefit?.();
|
|
24989
25192
|
parts.stopRefit = null;
|
|
24990
|
-
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
25193
|
+
parts.stopFirst?.();
|
|
25194
|
+
parts.stopFirst = null;
|
|
25195
|
+
if (!this.menuMode()) {
|
|
25196
|
+
parts.measuring = false;
|
|
25197
|
+
this.showOverflow([]);
|
|
25198
|
+
return;
|
|
25199
|
+
}
|
|
25200
|
+
parts.measuring = true;
|
|
25201
|
+
if (parts.first && canMeasure(this)) parts.stopFirst = measureAfterDrawn(this, this.readBar, this.fit);
|
|
25202
|
+
else measure(this, this.readBar, this.fit);
|
|
24994
25203
|
});
|
|
24995
25204
|
}
|
|
24996
25205
|
/**
|
|
@@ -25031,6 +25240,34 @@ var Toolbar = class extends Control {
|
|
|
25031
25240
|
menuMode() {
|
|
25032
25241
|
return (this.peekProperty("overflow") ?? "menu") === "menu";
|
|
25033
25242
|
}
|
|
25243
|
+
/**
|
|
25244
|
+
* Keeps the room of the parts put in the "more" menu in the bar's own size, so it still asks what holds it for the
|
|
25245
|
+
* room of every part: a hidden part as long as they are, which takes no room on the bar (it grows by a millionth of
|
|
25246
|
+
* the room to spare). A bar sized by its parts then grows when what holds it does, and its size notice puts them
|
|
25247
|
+
* back; without it, the bar would stay as small as the parts left on it.
|
|
25248
|
+
*/
|
|
25249
|
+
keepRoom({ kids, gap, sizes }, out) {
|
|
25250
|
+
const parts = this.parts;
|
|
25251
|
+
const shown = kids.filter((kid) => sizes.has(kid));
|
|
25252
|
+
const always = new Set(shown.filter((kid) => kid.movable && kid.overflow === "always"));
|
|
25253
|
+
const length = (list, more) => list.reduce((sum, kid) => sum + sizes.get(kid), 0) + gap * Math.max(0, list.length - 1) + (more ? (list.length ? gap : 0) + (parts.moreLength ?? 0) : 0);
|
|
25254
|
+
const missing = length(shown.filter((kid) => !always.has(kid)), always.size > 0) - length(shown.filter((kid) => !out.includes(kid)), out.some((kid) => !kid.separator));
|
|
25255
|
+
if (missing < .5) {
|
|
25256
|
+
if (parts.reserve) mark(parts.reserve, "data-idle", true);
|
|
25257
|
+
return;
|
|
25258
|
+
}
|
|
25259
|
+
const reserve = parts.reserve ?? this.makeReserve();
|
|
25260
|
+
css(reserve, "--_reserve", `${missing}px`);
|
|
25261
|
+
css(reserve, "--_reserve-gap", `${gap}px`);
|
|
25262
|
+
mark(reserve, "data-idle", false);
|
|
25263
|
+
}
|
|
25264
|
+
makeReserve() {
|
|
25265
|
+
const reserve = loose("span", "mx-toolbar__reserve");
|
|
25266
|
+
put(reserve, "aria-hidden", "true");
|
|
25267
|
+
this.parts.reserve = reserve;
|
|
25268
|
+
this.controls.add(reserve);
|
|
25269
|
+
return reserve;
|
|
25270
|
+
}
|
|
25034
25271
|
showOverflow(out) {
|
|
25035
25272
|
const parts = this.parts;
|
|
25036
25273
|
const focused = rememberFocus();
|
|
@@ -30199,7 +30436,6 @@ var MxForm = class MxForm extends FocusContainer {
|
|
|
30199
30436
|
if (parts.open) this.closeWith(void 0, "owner");
|
|
30200
30437
|
parts.pending = null;
|
|
30201
30438
|
for (const resolve of parts.waiters.splice(0)) resolve("cancel");
|
|
30202
|
-
parts.releaseIcon();
|
|
30203
30439
|
parts.stopLabels?.();
|
|
30204
30440
|
this.removeChip();
|
|
30205
30441
|
for (const emitter of [
|
|
@@ -30520,7 +30756,6 @@ var MxForm = class MxForm extends FocusContainer {
|
|
|
30520
30756
|
const self = this;
|
|
30521
30757
|
return {
|
|
30522
30758
|
iconPart,
|
|
30523
|
-
releaseIcon: () => {},
|
|
30524
30759
|
titlePart,
|
|
30525
30760
|
titleId,
|
|
30526
30761
|
minimize: null,
|
|
@@ -30665,11 +30900,9 @@ var MxForm = class MxForm extends FocusContainer {
|
|
|
30665
30900
|
renderIcon() {
|
|
30666
30901
|
const parts = this.parts;
|
|
30667
30902
|
const icon = this.peekProperty("icon");
|
|
30668
|
-
parts.releaseIcon();
|
|
30669
|
-
parts.releaseIcon = () => {};
|
|
30670
30903
|
kept$1(parts.iconPart, !!icon);
|
|
30671
30904
|
clearParts(parts.iconPart);
|
|
30672
|
-
if (icon)
|
|
30905
|
+
if (icon) showIcon(icon, parts.iconPart);
|
|
30673
30906
|
}
|
|
30674
30907
|
/** The title bar buttons: minimize (modeless only), maximize, close. */
|
|
30675
30908
|
renderTools() {
|
|
@@ -31347,6 +31580,7 @@ var OWN$45 = [
|
|
|
31347
31580
|
var FUNCTIONS$6 = [
|
|
31348
31581
|
"textField",
|
|
31349
31582
|
"valueField",
|
|
31583
|
+
"normalizeKey",
|
|
31350
31584
|
"iconField",
|
|
31351
31585
|
"groupField",
|
|
31352
31586
|
"enabledField",
|
|
@@ -31381,6 +31615,10 @@ var ComboBox = class extends Field {
|
|
|
31381
31615
|
this.observeProperty("clearButton", () => this.renderClear());
|
|
31382
31616
|
this.observeProperty("dataSource", () => this.renderSource());
|
|
31383
31617
|
this.observeProperty("valueField", (field) => parts.items.valueField = typeof field === "string" ? field : void 0);
|
|
31618
|
+
this.observeProperty("normalizeKey", (rule) => {
|
|
31619
|
+
parts.items.normalizeKey = rule ?? void 0;
|
|
31620
|
+
this.renderValue(this.peekValue());
|
|
31621
|
+
});
|
|
31384
31622
|
this.observeProperty("searchMode", (mode) => parts.items.searchMode = mode === "startswith" ? "startswith" : "contains");
|
|
31385
31623
|
parts.items.textOf = (item) => this.itemText(item);
|
|
31386
31624
|
parts.items.onChanged(() => this.itemsChanged());
|
|
@@ -31423,6 +31661,12 @@ var ComboBox = class extends Field {
|
|
|
31423
31661
|
set valueField(value) {
|
|
31424
31662
|
this.assignProperty("valueField", functionValue(value));
|
|
31425
31663
|
}
|
|
31664
|
+
get normalizeKey() {
|
|
31665
|
+
return this.getProperty("normalizeKey");
|
|
31666
|
+
}
|
|
31667
|
+
set normalizeKey(value) {
|
|
31668
|
+
this.assignProperty("normalizeKey", functionValue(value));
|
|
31669
|
+
}
|
|
31426
31670
|
get iconField() {
|
|
31427
31671
|
return this.getProperty("iconField");
|
|
31428
31672
|
}
|
|
@@ -31595,7 +31839,7 @@ var ComboBox = class extends Field {
|
|
|
31595
31839
|
return;
|
|
31596
31840
|
}
|
|
31597
31841
|
const lookup = ++parts.lookup;
|
|
31598
|
-
this.showText(parts.chosen !== void 0 && this.
|
|
31842
|
+
this.showText(parts.chosen !== void 0 && this.holderOf(value)(parts.chosen) ? this.itemText(parts.chosen) : "");
|
|
31599
31843
|
parts.items.find(value, (item) => this.itemValue(item)).then((item) => {
|
|
31600
31844
|
if (lookup !== parts.lookup || this.isDisposed) return;
|
|
31601
31845
|
parts.chosen = item;
|
|
@@ -31609,6 +31853,10 @@ var ComboBox = class extends Field {
|
|
|
31609
31853
|
itemText(item) {
|
|
31610
31854
|
return String(readItemField(item, this.peekProperty("textField"), "text") ?? "");
|
|
31611
31855
|
}
|
|
31856
|
+
/** The test for the item of `value`: the same value, the same once normalized, or the one the data source matched to it. */
|
|
31857
|
+
holderOf(value) {
|
|
31858
|
+
return this.comboParts.items.matcher(value, (item) => this.itemValue(item), (a, b) => this.sameValue(a, b));
|
|
31859
|
+
}
|
|
31612
31860
|
itemValue(item) {
|
|
31613
31861
|
const field = this.peekProperty("valueField");
|
|
31614
31862
|
if (field !== void 0) return readItemField(item, field, "value");
|
|
@@ -31787,11 +32035,14 @@ var ComboBox = class extends Field {
|
|
|
31787
32035
|
if (!list) return;
|
|
31788
32036
|
const value = this.peekValue();
|
|
31789
32037
|
let index = -1;
|
|
31790
|
-
if (!parts.editing && value !== null)
|
|
31791
|
-
const
|
|
31792
|
-
|
|
31793
|
-
|
|
31794
|
-
|
|
32038
|
+
if (!parts.editing && value !== null) {
|
|
32039
|
+
const holds = this.holderOf(value);
|
|
32040
|
+
for (let i = 0; i < list.count; i++) {
|
|
32041
|
+
const item = list.itemOf(i);
|
|
32042
|
+
if (item !== void 0 && holds(item)) {
|
|
32043
|
+
index = i;
|
|
32044
|
+
break;
|
|
32045
|
+
}
|
|
31795
32046
|
}
|
|
31796
32047
|
}
|
|
31797
32048
|
if (index >= 0) list.setActive(index);
|
|
@@ -31829,7 +32080,7 @@ var ComboBox = class extends Field {
|
|
|
31829
32080
|
const list = new OptionList();
|
|
31830
32081
|
list.textOf = (item) => this.itemText(item);
|
|
31831
32082
|
list.enabledOf = (item) => this.canChoose(item);
|
|
31832
|
-
list.isSelected = (item) => this.
|
|
32083
|
+
list.isSelected = (item) => this.holderOf(this.peekValue())(item);
|
|
31833
32084
|
list.emptyText = () => parts.items.loading ? uiLocale.strings.loading : uiLocale.strings.noItems;
|
|
31834
32085
|
list.onChosen((e) => {
|
|
31835
32086
|
this.choose(e.item, this.itemValue(e.item), e.event);
|
|
@@ -33200,7 +33451,6 @@ var Tab = class extends Control {
|
|
|
33200
33451
|
this.observeProperty("key", () => parts.owner?.tabChanged(this));
|
|
33201
33452
|
this.observeProperty("lazy", () => parts.owner?.tabChanged(this));
|
|
33202
33453
|
this.motif.setDisposable(() => {
|
|
33203
|
-
parts.releaseIcon();
|
|
33204
33454
|
parts.stopCloseHint?.();
|
|
33205
33455
|
removePart(parts.headerPart);
|
|
33206
33456
|
parts.owner?.tabGone(this);
|
|
@@ -33399,7 +33649,6 @@ var Tab = class extends Control {
|
|
|
33399
33649
|
headerPart,
|
|
33400
33650
|
label,
|
|
33401
33651
|
icon: null,
|
|
33402
|
-
releaseIcon: () => {},
|
|
33403
33652
|
badge: null,
|
|
33404
33653
|
close: null,
|
|
33405
33654
|
stopCloseHint: null,
|
|
@@ -33418,8 +33667,6 @@ var Tab = class extends Control {
|
|
|
33418
33667
|
renderIcon() {
|
|
33419
33668
|
const parts = this.parts;
|
|
33420
33669
|
const icon = this.peekProperty("icon");
|
|
33421
|
-
parts.releaseIcon();
|
|
33422
|
-
parts.releaseIcon = () => {};
|
|
33423
33670
|
if (!icon) {
|
|
33424
33671
|
removePart(parts.icon);
|
|
33425
33672
|
parts.icon = null;
|
|
@@ -33429,7 +33676,7 @@ var Tab = class extends Control {
|
|
|
33429
33676
|
parts.icon.attr.add({ "aria-hidden": "true" });
|
|
33430
33677
|
}
|
|
33431
33678
|
clearParts(parts.icon);
|
|
33432
|
-
|
|
33679
|
+
showIcon(icon, parts.icon);
|
|
33433
33680
|
}
|
|
33434
33681
|
parts.owner?.tabResized();
|
|
33435
33682
|
}
|
|
@@ -34081,11 +34328,11 @@ var ListRows = class {
|
|
|
34081
34328
|
//#endregion
|
|
34082
34329
|
//#region src/components/listbox/select-all-state.ts
|
|
34083
34330
|
/** Whether the items the list shows are all chosen (`true`), none of them (`false`) or some (`'mixed'`). */
|
|
34084
|
-
function selectAllState(items, chosen,
|
|
34331
|
+
function selectAllState(items, chosen, isChosen, enabledOf) {
|
|
34085
34332
|
if (!chosen.size) return false;
|
|
34086
34333
|
const rows = items.loaded.filter(enabledOf);
|
|
34087
34334
|
let hits = 0;
|
|
34088
|
-
for (const row of rows) if (
|
|
34335
|
+
for (const row of rows) if (isChosen(row)) hits++;
|
|
34089
34336
|
if (!hits) return items.dataSource && !items.searchText ? "mixed" : false;
|
|
34090
34337
|
return hits === rows.length && (!items.dataSource || chosen.size >= items.count) ? true : "mixed";
|
|
34091
34338
|
}
|
|
@@ -34170,6 +34417,7 @@ var OWN$40 = [
|
|
|
34170
34417
|
var FUNCTIONS$5 = [
|
|
34171
34418
|
"textField",
|
|
34172
34419
|
"valueField",
|
|
34420
|
+
"normalizeKey",
|
|
34173
34421
|
"iconField",
|
|
34174
34422
|
"groupField",
|
|
34175
34423
|
"enabledField",
|
|
@@ -34231,7 +34479,13 @@ var TagBox = class extends Field {
|
|
|
34231
34479
|
this.observeProperty("matchWidth", (on) => {
|
|
34232
34480
|
if (parts.popup) parts.popup.matchWidth = on !== false;
|
|
34233
34481
|
});
|
|
34234
|
-
this.observeProperty("valueField", () => {
|
|
34482
|
+
this.observeProperty("valueField", (field) => {
|
|
34483
|
+
parts.items.valueField = typeof field === "string" ? field : void 0;
|
|
34484
|
+
parts.known.clear();
|
|
34485
|
+
this.renderValue(this.peekValue());
|
|
34486
|
+
});
|
|
34487
|
+
this.observeProperty("normalizeKey", (rule) => {
|
|
34488
|
+
parts.items.normalizeKey = rule ?? void 0;
|
|
34235
34489
|
parts.known.clear();
|
|
34236
34490
|
this.renderValue(this.peekValue());
|
|
34237
34491
|
});
|
|
@@ -34256,7 +34510,6 @@ var TagBox = class extends Field {
|
|
|
34256
34510
|
this.motif.setDisposable(() => {
|
|
34257
34511
|
stopLocale();
|
|
34258
34512
|
clearTimeout(parts.timer);
|
|
34259
|
-
for (const slot of [...parts.slots.values()].flat()) slot.release?.();
|
|
34260
34513
|
parts.items.dispose();
|
|
34261
34514
|
parts.opened.dispose();
|
|
34262
34515
|
parts.closed.dispose();
|
|
@@ -34286,6 +34539,12 @@ var TagBox = class extends Field {
|
|
|
34286
34539
|
set valueField(value) {
|
|
34287
34540
|
this.assignProperty("valueField", functionValue(value));
|
|
34288
34541
|
}
|
|
34542
|
+
get normalizeKey() {
|
|
34543
|
+
return this.getProperty("normalizeKey");
|
|
34544
|
+
}
|
|
34545
|
+
set normalizeKey(value) {
|
|
34546
|
+
this.assignProperty("normalizeKey", functionValue(value));
|
|
34547
|
+
}
|
|
34289
34548
|
get iconField() {
|
|
34290
34549
|
return this.getProperty("iconField");
|
|
34291
34550
|
}
|
|
@@ -34535,6 +34794,11 @@ var TagBox = class extends Field {
|
|
|
34535
34794
|
itemText(item) {
|
|
34536
34795
|
return String(readItemField(item, this.peekProperty("textField"), "text") ?? "");
|
|
34537
34796
|
}
|
|
34797
|
+
/** Whether `item` is chosen: its value is, or a chosen value stands for it (`DataItems.sameItem`). */
|
|
34798
|
+
isChosen(item) {
|
|
34799
|
+
const parts = this.tagParts;
|
|
34800
|
+
return parts.items.heldIn(parts.chosen, this.itemValue(item)) !== null;
|
|
34801
|
+
}
|
|
34538
34802
|
itemValue(item) {
|
|
34539
34803
|
const field = this.peekProperty("valueField");
|
|
34540
34804
|
if (field !== void 0) return readItemField(item, field, "value");
|
|
@@ -34596,7 +34860,7 @@ var TagBox = class extends Field {
|
|
|
34596
34860
|
}
|
|
34597
34861
|
allState() {
|
|
34598
34862
|
const parts = this.tagParts;
|
|
34599
|
-
return selectAllState(parts.items, parts.chosen, (item) => this.
|
|
34863
|
+
return selectAllState(parts.items, parts.chosen, (item) => this.isChosen(item), (item) => this.canChoose(item));
|
|
34600
34864
|
}
|
|
34601
34865
|
renderSource() {
|
|
34602
34866
|
const parts = this.tagParts;
|
|
@@ -34633,7 +34897,6 @@ var TagBox = class extends Field {
|
|
|
34633
34897
|
});
|
|
34634
34898
|
list.push(slot.tag);
|
|
34635
34899
|
}
|
|
34636
|
-
for (const slot of [...old.values()].flat()) slot.release?.();
|
|
34637
34900
|
parts.slots = slots;
|
|
34638
34901
|
parts.more = null;
|
|
34639
34902
|
if (shown < values.length && !parts.moreTag) {
|
|
@@ -34694,7 +34957,8 @@ var TagBox = class extends Field {
|
|
|
34694
34957
|
this.freshLabel(slot);
|
|
34695
34958
|
slot.item = item;
|
|
34696
34959
|
slot.template = template;
|
|
34697
|
-
|
|
34960
|
+
const release = template(item, slot.label);
|
|
34961
|
+
if (typeof release === "function") slot.label.motif.setDisposable(release);
|
|
34698
34962
|
return;
|
|
34699
34963
|
}
|
|
34700
34964
|
if (slot.text === null && slot.template) this.freshLabel(slot);
|
|
@@ -34705,8 +34969,6 @@ var TagBox = class extends Field {
|
|
|
34705
34969
|
}
|
|
34706
34970
|
/** A new label for a template to draw in, the one drawn before taken out. */
|
|
34707
34971
|
freshLabel(slot) {
|
|
34708
|
-
slot.release?.();
|
|
34709
|
-
slot.release = void 0;
|
|
34710
34972
|
removePart(slot.label);
|
|
34711
34973
|
slot.label = partBefore(slot.tag, slot.remove, "span", "mx-tag-box__tag-text");
|
|
34712
34974
|
slot.text = null;
|
|
@@ -34729,9 +34991,9 @@ var TagBox = class extends Field {
|
|
|
34729
34991
|
list.enabledOf = (row) => {
|
|
34730
34992
|
if (row === selectAllRow) return true;
|
|
34731
34993
|
const item = row;
|
|
34732
|
-
return this.canChoose(item) && (!this.atLimit() ||
|
|
34994
|
+
return this.canChoose(item) && (!this.atLimit() || this.isChosen(item));
|
|
34733
34995
|
};
|
|
34734
|
-
list.isSelected = (row) => row === selectAllRow ? this.allState() === true :
|
|
34996
|
+
list.isSelected = (row) => row === selectAllRow ? this.allState() === true : this.isChosen(row);
|
|
34735
34997
|
list.emptyText = () => parts.items.loading ? uiLocale.strings.loading : uiLocale.strings.noItems;
|
|
34736
34998
|
list.onChosen((e) => this.chosen(e));
|
|
34737
34999
|
popup.controls.add(list);
|
|
@@ -34774,7 +35036,7 @@ var TagBox = class extends Field {
|
|
|
34774
35036
|
parts.sourceCount = -1;
|
|
34775
35037
|
list.groupOf = group === void 0 ? null : (row) => row === selectAllRow ? void 0 : readItemField(row, group, "group") ?? void 0;
|
|
34776
35038
|
let shown = parts.items.loaded;
|
|
34777
|
-
if (this.peekProperty("hideSelected")) shown = shown.filter((item) => !
|
|
35039
|
+
if (this.peekProperty("hideSelected")) shown = shown.filter((item) => !this.isChosen(item));
|
|
34778
35040
|
list.setItems(withAll && shown.length ? [selectAllRow, ...shown] : shown);
|
|
34779
35041
|
}
|
|
34780
35042
|
this.pointAt();
|
|
@@ -34783,12 +35045,12 @@ var TagBox = class extends Field {
|
|
|
34783
35045
|
drawRow(row, host, option, template) {
|
|
34784
35046
|
const list = this.tagParts.list;
|
|
34785
35047
|
if (row === selectAllRow) {
|
|
34786
|
-
|
|
35048
|
+
list.bindText(option, () => uiLocale.strings.selectAll);
|
|
34787
35049
|
this.keepSelectAllRow(option);
|
|
34788
|
-
return
|
|
35050
|
+
return;
|
|
34789
35051
|
}
|
|
34790
35052
|
if (template) return template(row, host);
|
|
34791
|
-
|
|
35053
|
+
list.bindText(option, () => this.itemText(row));
|
|
34792
35054
|
}
|
|
34793
35055
|
listChanged() {
|
|
34794
35056
|
const parts = this.tagParts;
|
|
@@ -34862,7 +35124,8 @@ var TagBox = class extends Field {
|
|
|
34862
35124
|
if (!this.canChange() || !this.canChoose(item)) return;
|
|
34863
35125
|
const value = this.itemValue(item);
|
|
34864
35126
|
const values = this.values();
|
|
34865
|
-
|
|
35127
|
+
const held = parts.items.heldIn(parts.chosen, value);
|
|
35128
|
+
if (held) this.commit(values.filter((v) => !Object.is(v, held.value)), event);
|
|
34866
35129
|
else {
|
|
34867
35130
|
if (this.atLimit()) return;
|
|
34868
35131
|
parts.known.remember(item);
|
|
@@ -34890,7 +35153,7 @@ var TagBox = class extends Field {
|
|
|
34890
35153
|
const make = this.peekProperty("customValue");
|
|
34891
35154
|
const value = make ? make(text) : text;
|
|
34892
35155
|
if (value === null || value === void 0 || this.atLimit()) return false;
|
|
34893
|
-
if (!this.tagParts.
|
|
35156
|
+
if (!this.tagParts.items.heldIn(this.tagParts.chosen, value)) this.commit([...this.values(), value], event);
|
|
34894
35157
|
this.chosenDone();
|
|
34895
35158
|
return true;
|
|
34896
35159
|
}
|
|
@@ -34903,7 +35166,7 @@ var TagBox = class extends Field {
|
|
|
34903
35166
|
const current = this.values();
|
|
34904
35167
|
const chosen = new Set(current);
|
|
34905
35168
|
const set = new Set(shown);
|
|
34906
|
-
let next = on ? [...current, ...shown.filter((v) => !
|
|
35169
|
+
let next = on ? [...current, ...shown.filter((v) => !parts.items.heldIn(chosen, v))] : current.filter((v) => !parts.items.heldIn(set, v));
|
|
34907
35170
|
const max = this.peekProperty("maxSelected") ?? 0;
|
|
34908
35171
|
if (max > 0 && next.length > max) next = next.slice(0, Math.max(max, current.length));
|
|
34909
35172
|
this.commit(next, event);
|
|
@@ -36150,6 +36413,7 @@ var CellEditor = class {
|
|
|
36150
36413
|
clearButton: lookup.allowClearing ?? false,
|
|
36151
36414
|
searchEnabled: true
|
|
36152
36415
|
};
|
|
36416
|
+
if (lookup.normalizeKey) options.normalizeKey = lookup.normalizeKey;
|
|
36153
36417
|
if (Array.isArray(source)) {
|
|
36154
36418
|
const test = search.filter ? data.createRowFilter(search.filter, { locale: search.locale }) : null;
|
|
36155
36419
|
options.items = test ? source.filter((item) => item !== null && typeof item === "object" && test(item)) : source;
|
|
@@ -40309,6 +40573,15 @@ var FilterModel = class {
|
|
|
40309
40573
|
"conditionOf",
|
|
40310
40574
|
() => null
|
|
40311
40575
|
);
|
|
40576
|
+
_defineProperty(
|
|
40577
|
+
this,
|
|
40578
|
+
/**
|
|
40579
|
+
* The keys a lookup column's chosen key stands with: the keys its list showed as one item (the source matched them to
|
|
40580
|
+
* it); a key alone otherwise. The grid gives it.
|
|
40581
|
+
*/
|
|
40582
|
+
"keysOf",
|
|
40583
|
+
(_field, value) => [value]
|
|
40584
|
+
);
|
|
40312
40585
|
_defineProperty(
|
|
40313
40586
|
this,
|
|
40314
40587
|
/** Whether the filter row and the header filters are part of the filter value (`filterSyncEnabled`); the grid gives it. */
|
|
@@ -40693,7 +40966,11 @@ var FilterModel = class {
|
|
|
40693
40966
|
if (!this.columns.can(field, "filterRow")) return null;
|
|
40694
40967
|
const col = this.columns.get(field);
|
|
40695
40968
|
if (col.type === "boolean") return typeof f.value === "boolean" ? data.where(field, "=", f.value) : null;
|
|
40696
|
-
if (col.lookup)
|
|
40969
|
+
if (col.lookup) {
|
|
40970
|
+
if (empty$2(f.value)) return null;
|
|
40971
|
+
const keys = this.keysOf(field, f.value);
|
|
40972
|
+
return keys.length > 1 ? data.where(field, "in", [...keys]) : data.where(field, "=", f.value);
|
|
40973
|
+
}
|
|
40697
40974
|
const op = this.operator(field);
|
|
40698
40975
|
if (op === "isblank" || op === "isnotblank") return data.where(field, op);
|
|
40699
40976
|
if (op === "between") {
|
|
@@ -40718,7 +40995,7 @@ var FilterModel = class {
|
|
|
40718
40995
|
const condition = empty$2(v) ? null : own?.(v);
|
|
40719
40996
|
if (empty$2(v)) blank = true;
|
|
40720
40997
|
else if (condition) parts.push(condition);
|
|
40721
|
-
else plain.push(v);
|
|
40998
|
+
else plain.push(...this.keysOf(field, v));
|
|
40722
40999
|
}
|
|
40723
41000
|
const any = data.or(plain.length ? data.where(field, "in", plain) : null, ...parts, blank ? data.where(field, "isblank") : null);
|
|
40724
41001
|
return any && f.filterType === "exclude" ? data.not(any) : any;
|
|
@@ -40809,8 +41086,21 @@ function searchOf(filter) {
|
|
|
40809
41086
|
var LookupValues = class {
|
|
40810
41087
|
constructor(model) {
|
|
40811
41088
|
_defineProperty(this, "model", void 0);
|
|
41089
|
+
_defineProperty(
|
|
41090
|
+
this,
|
|
41091
|
+
/** By column, the keys each entry of its last list stands for, when the source matched more than one key to its item. */
|
|
41092
|
+
"merged",
|
|
41093
|
+
/* @__PURE__ */ new Map()
|
|
41094
|
+
);
|
|
40812
41095
|
this.model = model;
|
|
40813
41096
|
}
|
|
41097
|
+
/** The keys `value` stands with in the column's list (see `FilterModel.keysOf`): itself alone, unless its entry holds several. */
|
|
41098
|
+
keysOf(field, value) {
|
|
41099
|
+
const byKey = this.merged.get(field);
|
|
41100
|
+
if (!byKey?.size) return [value];
|
|
41101
|
+
const items = this.model.lookups.items(this.model.columns.get(field));
|
|
41102
|
+
return byKey.get(items ? items.keyStringOf(value) : String(value)) ?? [value];
|
|
41103
|
+
}
|
|
40814
41104
|
/** The filter of the other columns (and the source's own), which a synced list honors. */
|
|
40815
41105
|
otherFilter(field) {
|
|
40816
41106
|
return data.and(this.model.baseFilter, this.model.filters.expression(void 0, field));
|
|
@@ -40892,9 +41182,25 @@ var LookupValues = class {
|
|
|
40892
41182
|
}
|
|
40893
41183
|
}
|
|
40894
41184
|
await items?.request([...counts.values()].map((b) => b.value));
|
|
41185
|
+
const byItem = /* @__PURE__ */ new Map();
|
|
41186
|
+
for (const b of counts.values()) {
|
|
41187
|
+
const id = b.value === null ? "" : items ? `i${items.itemKeyOf(b.value)}` : `v${typeof b.value}:${String(b.value)}`;
|
|
41188
|
+
const one = byItem.get(id);
|
|
41189
|
+
if (one) {
|
|
41190
|
+
one.count += b.count;
|
|
41191
|
+
one.keys.push(b.value);
|
|
41192
|
+
} else byItem.set(id, {
|
|
41193
|
+
value: b.value,
|
|
41194
|
+
count: b.count,
|
|
41195
|
+
keys: [b.value]
|
|
41196
|
+
});
|
|
41197
|
+
}
|
|
41198
|
+
const merged = /* @__PURE__ */ new Map();
|
|
41199
|
+
for (const one of byItem.values()) if (one.keys.length > 1 && items) merged.set(items.keyStringOf(one.value), one.keys);
|
|
41200
|
+
this.merged.set(field, merged);
|
|
40895
41201
|
const lower = search.trim().toLocaleLowerCase(model.formatter.locale);
|
|
40896
41202
|
const collator = model.formatter.collator;
|
|
40897
|
-
const all = [...
|
|
41203
|
+
const all = [...byItem.values()].filter((b) => !lookups.isMissing(col, b.value)).map((b) => entry(b.value, b.count)).filter((e) => !lower || e.value !== null && e.text.toLocaleLowerCase(model.formatter.locale).includes(lower)).sort((a, b) => a.value === null ? -1 : b.value === null ? 1 : collator.compare(a.text, b.text));
|
|
40898
41204
|
return {
|
|
40899
41205
|
values: all.slice(skip, skip + take),
|
|
40900
41206
|
total: all.length
|
|
@@ -43612,7 +43918,7 @@ var LookupTexts = class {
|
|
|
43612
43918
|
if (!lookup) return null;
|
|
43613
43919
|
const source = readField(lookup, "dataSource");
|
|
43614
43920
|
if (!source) return null;
|
|
43615
|
-
const items = KeyedItems.of(source, lookup.valueField);
|
|
43921
|
+
const items = KeyedItems.of(source, lookup.valueField, lookup.normalizeKey);
|
|
43616
43922
|
if (lookup.resolve) items.resolve = lookup.resolve;
|
|
43617
43923
|
if (lookup.batchSize) items.batchSize = lookup.batchSize;
|
|
43618
43924
|
if (lookup.parallelRequests) items.parallelRequests = lookup.parallelRequests;
|
|
@@ -43623,6 +43929,10 @@ var LookupTexts = class {
|
|
|
43623
43929
|
})));
|
|
43624
43930
|
return items;
|
|
43625
43931
|
}
|
|
43932
|
+
/** The string a key of the column is kept under: by its cache (`normalizeKey`), else as it is. */
|
|
43933
|
+
keyOf(col, value) {
|
|
43934
|
+
return this.items(col)?.keyStringOf(value) ?? KeyedItems.keyString(value);
|
|
43935
|
+
}
|
|
43626
43936
|
/** The text of an item: `textField`, else its `text`, else its value. */
|
|
43627
43937
|
textOf(col, item) {
|
|
43628
43938
|
const field = col.lookup?.textField;
|
|
@@ -43654,7 +43964,7 @@ var LookupTexts = class {
|
|
|
43654
43964
|
state: "none"
|
|
43655
43965
|
};
|
|
43656
43966
|
if (Array.isArray(value) && !(col.textFrom && !edited)) return this.listText(col, value, ask);
|
|
43657
|
-
const chosen = this.chosen.get(col.field)?.get(
|
|
43967
|
+
const chosen = this.chosen.get(col.field)?.get(this.keyOf(col, value));
|
|
43658
43968
|
if (chosen !== void 0) return {
|
|
43659
43969
|
text: chosen,
|
|
43660
43970
|
state: "found"
|
|
@@ -43676,7 +43986,7 @@ var LookupTexts = class {
|
|
|
43676
43986
|
state: "none"
|
|
43677
43987
|
};
|
|
43678
43988
|
if (Array.isArray(value)) return this.listText(col, value, ask);
|
|
43679
|
-
const chosen = this.chosen.get(col.field)?.get(
|
|
43989
|
+
const chosen = this.chosen.get(col.field)?.get(this.keyOf(col, value));
|
|
43680
43990
|
if (chosen !== void 0) return {
|
|
43681
43991
|
text: chosen,
|
|
43682
43992
|
state: "found"
|
|
@@ -43737,7 +44047,7 @@ var LookupTexts = class {
|
|
|
43737
44047
|
textOfKey(col, value) {
|
|
43738
44048
|
if (data.isEmpty(value)) return "";
|
|
43739
44049
|
if (Array.isArray(value)) return joinItems(listValues(value).map((v) => this.textOfKey(col, v)), this.locale());
|
|
43740
|
-
const chosen = this.chosen.get(col.field)?.get(
|
|
44050
|
+
const chosen = this.chosen.get(col.field)?.get(this.keyOf(col, value));
|
|
43741
44051
|
if (chosen !== void 0) return chosen;
|
|
43742
44052
|
const known = this.items(col)?.get(value);
|
|
43743
44053
|
return known?.state === "found" ? known.text ?? this.textOf(col, known.item) : String(value);
|
|
@@ -43754,13 +44064,13 @@ var LookupTexts = class {
|
|
|
43754
44064
|
const text = typeof itemOrText === "string" ? itemOrText : this.textOf(col, itemOrText);
|
|
43755
44065
|
let byKey = this.chosen.get(col.field);
|
|
43756
44066
|
if (!byKey) this.chosen.set(col.field, byKey = /* @__PURE__ */ new Map());
|
|
43757
|
-
byKey.set(
|
|
44067
|
+
byKey.set(this.keyOf(col, value), text);
|
|
43758
44068
|
this.items(col)?.remember(value, itemOrText);
|
|
43759
44069
|
}
|
|
43760
44070
|
/** Whether the source said it does not have the key (a failed request does not count). */
|
|
43761
44071
|
isMissing(col, value) {
|
|
43762
44072
|
if (Array.isArray(value)) return listValues(value).some((v) => this.isMissing(col, v));
|
|
43763
|
-
if (data.isEmpty(value) || this.chosen.get(col.field)?.has(
|
|
44073
|
+
if (data.isEmpty(value) || this.chosen.get(col.field)?.has(this.keyOf(col, value))) return false;
|
|
43764
44074
|
const known = this.items(col)?.get(value);
|
|
43765
44075
|
return known?.state === "missing" && !known.failed;
|
|
43766
44076
|
}
|
|
@@ -43845,7 +44155,7 @@ var LookupTexts = class {
|
|
|
43845
44155
|
return (row) => {
|
|
43846
44156
|
const value = cellValue(col, row);
|
|
43847
44157
|
if (data.isEmpty(value)) return null;
|
|
43848
|
-
const chosen = this.chosen.get(col.field)?.get(
|
|
44158
|
+
const chosen = this.chosen.get(col.field)?.get(this.keyOf(col, value));
|
|
43849
44159
|
if (chosen !== void 0) return chosen;
|
|
43850
44160
|
const known = this.items(col)?.get(value);
|
|
43851
44161
|
return known?.state === "found" ? known.text ?? this.textOf(col, known.item) : null;
|
|
@@ -44816,6 +45126,7 @@ var GridModel = class {
|
|
|
44816
45126
|
};
|
|
44817
45127
|
this.values = new FilterValues(this);
|
|
44818
45128
|
this.filters.conditionOf = (field) => this.values.conditionOf(field);
|
|
45129
|
+
this.filters.keysOf = (field, value) => this.values.lookups.keysOf(field, value);
|
|
44819
45130
|
const filterValue = stored ? this.reviveExpression(stored.filterValue ?? null) : read(props.filterValue);
|
|
44820
45131
|
if (filterValue) {
|
|
44821
45132
|
untracked(() => this.filters.filterValue());
|
|
@@ -48167,7 +48478,6 @@ var LiveOptions = class {
|
|
|
48167
48478
|
};
|
|
48168
48479
|
//#endregion
|
|
48169
48480
|
//#region src/components/datagrid/view/action-button.ts
|
|
48170
|
-
var releases = /* @__PURE__ */ new WeakMap();
|
|
48171
48481
|
/** The key each button was drawn for. */
|
|
48172
48482
|
var keys = /* @__PURE__ */ new WeakMap();
|
|
48173
48483
|
/** The parts of each button's face: made the first time they are needed, then written in place. */
|
|
@@ -48213,14 +48523,13 @@ function fillActionButton(button, a) {
|
|
|
48213
48523
|
faces.set(button, face);
|
|
48214
48524
|
const iconOf = a.hasIcon ? a.action.id : null;
|
|
48215
48525
|
if (face.iconOf !== iconOf) {
|
|
48216
|
-
|
|
48217
|
-
releases.delete(button);
|
|
48526
|
+
if (face.holder) clearParts(face.holder);
|
|
48218
48527
|
const icon = iconOf !== null ? readField(a.action, "icon") : null;
|
|
48219
48528
|
if (icon && !face.holder) {
|
|
48220
48529
|
face.holder = partBefore(button, face.text, "span", "mx-button__icon");
|
|
48221
48530
|
face.holder.attr.add({ "aria-hidden": "true" });
|
|
48222
48531
|
}
|
|
48223
|
-
if (icon && face.holder)
|
|
48532
|
+
if (icon && face.holder) showIcon(icon, face.holder);
|
|
48224
48533
|
face.iconOf = iconOf;
|
|
48225
48534
|
face.icon = !!icon;
|
|
48226
48535
|
}
|
|
@@ -48253,13 +48562,16 @@ var NO_FRAME = Object.freeze({
|
|
|
48253
48562
|
/**
|
|
48254
48563
|
* Widths of action buttons, measured once per action (its id, text and look) in a hidden cell and
|
|
48255
48564
|
* kept, so fitting a row's buttons only adds numbers: scrolling triggers no layout. An action not
|
|
48256
|
-
* measured yet counts 0 and is measured
|
|
48257
|
-
*
|
|
48565
|
+
* measured yet counts 0 and is measured once the page is drawn, with everything asked in that frame:
|
|
48566
|
+
* read then, it lays nothing out. `waiting` tells while it waits (the rows keep their buttons out of
|
|
48567
|
+
* sight meanwhile) and `measured` then asks the rows to fit their buttons again. A width of 0 (the
|
|
48568
|
+
* grid is not shown yet) is not kept.
|
|
48258
48569
|
*/
|
|
48259
48570
|
var ActionWidths = class {
|
|
48260
|
-
constructor(host, measured = () => {}) {
|
|
48571
|
+
constructor(host, measured = () => {}, waiting = () => {}) {
|
|
48261
48572
|
_defineProperty(this, "host", void 0);
|
|
48262
48573
|
_defineProperty(this, "measured", void 0);
|
|
48574
|
+
_defineProperty(this, "waiting", void 0);
|
|
48263
48575
|
_defineProperty(this, "widths", /* @__PURE__ */ new Map());
|
|
48264
48576
|
_defineProperty(this, "frameSize", null);
|
|
48265
48577
|
_defineProperty(this, "box", null);
|
|
@@ -48275,6 +48587,12 @@ var ActionWidths = class {
|
|
|
48275
48587
|
"moreProbe",
|
|
48276
48588
|
null
|
|
48277
48589
|
);
|
|
48590
|
+
_defineProperty(
|
|
48591
|
+
this,
|
|
48592
|
+
/** Takes back the read that waits for the page to be drawn. */
|
|
48593
|
+
"pending",
|
|
48594
|
+
null
|
|
48595
|
+
);
|
|
48278
48596
|
_defineProperty(this, "read", () => {
|
|
48279
48597
|
const box = this.box;
|
|
48280
48598
|
const more = this.moreProbe;
|
|
@@ -48298,6 +48616,10 @@ var ActionWidths = class {
|
|
|
48298
48616
|
};
|
|
48299
48617
|
});
|
|
48300
48618
|
_defineProperty(this, "write", (seen) => {
|
|
48619
|
+
if (this.pending) {
|
|
48620
|
+
this.pending = null;
|
|
48621
|
+
this.waiting(false);
|
|
48622
|
+
}
|
|
48301
48623
|
let kept = false;
|
|
48302
48624
|
for (const { key, button, width } of seen.buttons) {
|
|
48303
48625
|
if (this.probes.get(key) === button) this.probes.delete(key);
|
|
@@ -48319,6 +48641,7 @@ var ActionWidths = class {
|
|
|
48319
48641
|
});
|
|
48320
48642
|
this.host = host;
|
|
48321
48643
|
this.measured = measured;
|
|
48644
|
+
this.waiting = waiting;
|
|
48322
48645
|
}
|
|
48323
48646
|
/** Measure again (the density changed). */
|
|
48324
48647
|
clear() {
|
|
@@ -48337,7 +48660,7 @@ var ActionWidths = class {
|
|
|
48337
48660
|
box.controls.add(button);
|
|
48338
48661
|
this.probes.set(key, button);
|
|
48339
48662
|
}
|
|
48340
|
-
|
|
48663
|
+
this.ask(box);
|
|
48341
48664
|
return 0;
|
|
48342
48665
|
}
|
|
48343
48666
|
/** The cell's padding (both sides), the gap between buttons and the width of the "more" button; zeros until measured. */
|
|
@@ -48351,9 +48674,19 @@ var ActionWidths = class {
|
|
|
48351
48674
|
box.controls.add(more);
|
|
48352
48675
|
this.moreProbe = more;
|
|
48353
48676
|
}
|
|
48354
|
-
|
|
48677
|
+
this.ask(box);
|
|
48355
48678
|
return NO_FRAME;
|
|
48356
48679
|
}
|
|
48680
|
+
/** One read for everything asked before the page is drawn; a window that lays nothing out (a test document) reads with its next round. */
|
|
48681
|
+
ask(box) {
|
|
48682
|
+
if (!canMeasure(box)) {
|
|
48683
|
+
measure(box, this.read, this.write);
|
|
48684
|
+
return;
|
|
48685
|
+
}
|
|
48686
|
+
if (this.pending) return;
|
|
48687
|
+
this.pending = measureAfterDrawn(box, this.read, this.write);
|
|
48688
|
+
this.waiting(true);
|
|
48689
|
+
}
|
|
48357
48690
|
cell() {
|
|
48358
48691
|
const host = this.host();
|
|
48359
48692
|
if (!host) return null;
|
|
@@ -48954,7 +49287,6 @@ var TreeView = class extends Control {
|
|
|
48954
49287
|
stopTexts();
|
|
48955
49288
|
for (const stop of parts.watchers.splice(0)) stop();
|
|
48956
49289
|
parts.loads.clear();
|
|
48957
|
-
this.releaseAll();
|
|
48958
49290
|
for (const emitter of [
|
|
48959
49291
|
parts.expanding,
|
|
48960
49292
|
parts.collapsing,
|
|
@@ -49331,7 +49663,6 @@ var TreeView = class extends Control {
|
|
|
49331
49663
|
index: /* @__PURE__ */ new Map(),
|
|
49332
49664
|
elements: /* @__PURE__ */ new Map(),
|
|
49333
49665
|
spaces: [],
|
|
49334
|
-
releases: /* @__PURE__ */ new Map(),
|
|
49335
49666
|
looks: /* @__PURE__ */ new WeakMap(),
|
|
49336
49667
|
stashes: /* @__PURE__ */ new Map(),
|
|
49337
49668
|
expanded: /* @__PURE__ */ new Set(),
|
|
@@ -49724,7 +50055,7 @@ var TreeView = class extends Control {
|
|
|
49724
50055
|
const windowed = parts.rows.length > this.windowFrom;
|
|
49725
50056
|
const old = windowed === parts.windowed ? this.takeRows() : null;
|
|
49726
50057
|
if (!old) {
|
|
49727
|
-
this.
|
|
50058
|
+
this.forgetAll();
|
|
49728
50059
|
clearParts(parts.bodyPart);
|
|
49729
50060
|
parts.spaces = [];
|
|
49730
50061
|
}
|
|
@@ -49772,37 +50103,31 @@ var TreeView = class extends Control {
|
|
|
49772
50103
|
takeRows() {
|
|
49773
50104
|
const parts = this.parts;
|
|
49774
50105
|
const old = /* @__PURE__ */ new Map();
|
|
49775
|
-
for (const [node, drawn] of parts.elements) old.set(node.key,
|
|
49776
|
-
drawn,
|
|
49777
|
-
release: parts.releases.get(node)
|
|
49778
|
-
});
|
|
50106
|
+
for (const [node, drawn] of parts.elements) old.set(node.key, drawn);
|
|
49779
50107
|
parts.elements.clear();
|
|
49780
|
-
parts.releases.clear();
|
|
49781
50108
|
return old;
|
|
49782
50109
|
}
|
|
49783
50110
|
/** The row drawn before for `row`'s key, kept for its new node when what it was drawn with stays; null otherwise. */
|
|
49784
50111
|
keepRow(old, row) {
|
|
49785
50112
|
const parts = this.parts;
|
|
49786
50113
|
const node = row.node;
|
|
49787
|
-
const
|
|
49788
|
-
const look =
|
|
49789
|
-
if (!
|
|
50114
|
+
const drawn = old.get(node.key);
|
|
50115
|
+
const look = drawn && parts.looks.get(drawn);
|
|
50116
|
+
if (!drawn || !look) return null;
|
|
49790
50117
|
const item = node.item;
|
|
49791
50118
|
const template = this.peekProperty("itemTemplate") ?? null;
|
|
49792
50119
|
if (!(look.parentKey === node.parent?.key && look.checks === !!this.peekProperty("showCheckBoxes") && look.template === template && (!template || look.item === item) && look.icon === this.iconOf(item))) return null;
|
|
49793
50120
|
old.delete(node.key);
|
|
49794
|
-
parts.elements.set(node,
|
|
49795
|
-
if (entry.release) parts.releases.set(node, entry.release);
|
|
50121
|
+
parts.elements.set(node, drawn);
|
|
49796
50122
|
look.item = item;
|
|
49797
50123
|
if (!template) text$1(look.text, this.textOf(item));
|
|
49798
|
-
css(
|
|
49799
|
-
return
|
|
50124
|
+
css(drawn.item, "--_level", String(node.level));
|
|
50125
|
+
return drawn;
|
|
49800
50126
|
}
|
|
49801
|
-
/** Lets go of the rows drawn before that were not kept. */
|
|
50127
|
+
/** Lets go of the rows drawn before that were not kept: each goes with what it holds, its template's cleanup too. */
|
|
49802
50128
|
dropRows(old) {
|
|
49803
50129
|
const parts = this.parts;
|
|
49804
|
-
for (const
|
|
49805
|
-
release?.();
|
|
50130
|
+
for (const drawn of old.values()) {
|
|
49806
50131
|
const stash = parts.stashes.get(drawn);
|
|
49807
50132
|
if (stash) {
|
|
49808
50133
|
parts.stashes.delete(drawn);
|
|
@@ -49825,21 +50150,17 @@ var TreeView = class extends Control {
|
|
|
49825
50150
|
const parts = this.parts;
|
|
49826
50151
|
const taken = /* @__PURE__ */ new Map();
|
|
49827
50152
|
if (rows) {
|
|
49828
|
-
for (const [key,
|
|
49829
|
-
if (!isWithin(
|
|
49830
|
-
taken.set(key,
|
|
50153
|
+
for (const [key, drawn] of rows) {
|
|
50154
|
+
if (!isWithin(drawn.item, group)) continue;
|
|
50155
|
+
taken.set(key, drawn);
|
|
49831
50156
|
rows.delete(key);
|
|
49832
50157
|
}
|
|
49833
50158
|
return taken;
|
|
49834
50159
|
}
|
|
49835
50160
|
for (const [node, drawn] of parts.elements) {
|
|
49836
50161
|
if (!isWithin(drawn.item, group)) continue;
|
|
49837
|
-
taken.set(node.key,
|
|
49838
|
-
drawn,
|
|
49839
|
-
release: parts.releases.get(node)
|
|
49840
|
-
});
|
|
50162
|
+
taken.set(node.key, drawn);
|
|
49841
50163
|
parts.elements.delete(node);
|
|
49842
|
-
parts.releases.delete(node);
|
|
49843
50164
|
}
|
|
49844
50165
|
return taken;
|
|
49845
50166
|
}
|
|
@@ -49966,26 +50287,25 @@ var TreeView = class extends Control {
|
|
|
49966
50287
|
const parts = this.parts;
|
|
49967
50288
|
const row = parts.rows[0];
|
|
49968
50289
|
if (!row) return 32;
|
|
49969
|
-
const
|
|
49970
|
-
const probe = this.rowParts(row, releases);
|
|
50290
|
+
const probe = this.rowParts(row);
|
|
49971
50291
|
this.renderItem(probe, row);
|
|
49972
50292
|
parts.bodyPart.controls.add(probe.item);
|
|
49973
50293
|
const height = rectOf(probe.item).height;
|
|
49974
|
-
for (const release of releases) release();
|
|
49975
50294
|
removePart(probe.item);
|
|
49976
50295
|
return height || 32;
|
|
49977
50296
|
}
|
|
49978
50297
|
itemPart(row) {
|
|
49979
50298
|
const parts = this.parts;
|
|
49980
|
-
const
|
|
49981
|
-
const drawn = this.rowParts(row, releases);
|
|
49982
|
-
if (releases.length) parts.releases.set(row.node, () => releases.forEach((r) => r()));
|
|
50299
|
+
const drawn = this.rowParts(row);
|
|
49983
50300
|
parts.elements.set(row.node, drawn);
|
|
49984
50301
|
this.renderItem(drawn, row);
|
|
49985
50302
|
return drawn;
|
|
49986
50303
|
}
|
|
49987
|
-
/**
|
|
49988
|
-
|
|
50304
|
+
/**
|
|
50305
|
+
* The parts of a row, not kept by the tree yet. The icon and what the template drew go with the row; the template's
|
|
50306
|
+
* cleanup, given to the text part it drew in, runs as the core disposes the row.
|
|
50307
|
+
*/
|
|
50308
|
+
rowParts(row) {
|
|
49989
50309
|
const node = row.node;
|
|
49990
50310
|
const item = node.item;
|
|
49991
50311
|
const itemPart = loose("div", "mx-tree-view__item");
|
|
@@ -50005,12 +50325,12 @@ var TreeView = class extends Control {
|
|
|
50005
50325
|
if (icon !== void 0 && icon !== null) {
|
|
50006
50326
|
const host = part(line, "span", "mx-tree-view__icon");
|
|
50007
50327
|
host.attr.add({ "aria-hidden": "true" });
|
|
50008
|
-
|
|
50328
|
+
showIcon(icon, host);
|
|
50009
50329
|
}
|
|
50010
50330
|
const text = part(line, "span", "mx-tree-view__text");
|
|
50011
50331
|
const template = this.peekProperty("itemTemplate");
|
|
50012
50332
|
const release = template ? template(item, text) : void 0;
|
|
50013
|
-
if (release)
|
|
50333
|
+
if (typeof release === "function") text.motif.setDisposable(release);
|
|
50014
50334
|
if (!template) text$1(text, this.textOf(item));
|
|
50015
50335
|
const drawn = {
|
|
50016
50336
|
item: itemPart,
|
|
@@ -50173,19 +50493,14 @@ var TreeView = class extends Control {
|
|
|
50173
50493
|
this.controls.insert(this.controls.items.indexOf(parts.bodyPart), search);
|
|
50174
50494
|
parts.search = search;
|
|
50175
50495
|
}
|
|
50176
|
-
/**
|
|
50496
|
+
/** The tree keeps the row drawn for `node` no longer; the row goes with what it holds when it is taken out. */
|
|
50177
50497
|
forget(node) {
|
|
50178
|
-
|
|
50179
|
-
parts.releases.get(node)?.();
|
|
50180
|
-
parts.releases.delete(node);
|
|
50181
|
-
parts.elements.delete(node);
|
|
50498
|
+
this.parts.elements.delete(node);
|
|
50182
50499
|
}
|
|
50183
|
-
|
|
50500
|
+
/** The tree keeps no row drawn so far, the hidden ones included; they go when the rows are taken out. */
|
|
50501
|
+
forgetAll() {
|
|
50184
50502
|
const parts = this.parts;
|
|
50185
|
-
for (const release of parts.releases.values()) release();
|
|
50186
|
-
parts.releases.clear();
|
|
50187
50503
|
parts.elements.clear();
|
|
50188
|
-
for (const stash of parts.stashes.values()) for (const { release } of stash.values()) release?.();
|
|
50189
50504
|
parts.stashes.clear();
|
|
50190
50505
|
}
|
|
50191
50506
|
scrollToRow(at) {
|
|
@@ -50768,7 +51083,9 @@ var escapeAttr = (v) => v.replace(/["\\]/g, "\\$&");
|
|
|
50768
51083
|
/**
|
|
50769
51084
|
* Per-column CSS of one grid: columns not shown, alignment and sticky offsets, written as rules keyed
|
|
50770
51085
|
* by `data-field` (a pinned band's header by `data-band`, at the offset of its columns). Changing a width or pinning a column rewrites this sheet only; no cell gets a
|
|
50771
|
-
* binding of its own and no row is touched. A
|
|
51086
|
+
* binding of its own and no row is touched. A rule finds the rows through the parts that hold them (the head, the body,
|
|
51087
|
+
* the foot, the copy of a dragged row), which carry the grid's id, and goes on by child combinators only: the rows of a
|
|
51088
|
+
* grid inside this one (in a row's details, in a cell) are that grid's. A constructable stylesheet adopted by the document (or
|
|
50772
51089
|
* shadow root) where there is one, which also works under a strict Content Security Policy; else a
|
|
50773
51090
|
* `<style>` element inside the grid.
|
|
50774
51091
|
*/
|
|
@@ -50792,12 +51109,12 @@ var ColumnStyles = class {
|
|
|
50792
51109
|
}
|
|
50793
51110
|
/** `placed`: every column's cells get their track by number, so a row may leave out the cells of columns not drawn (virtual columns). */
|
|
50794
51111
|
update(visible, offsets, align, bands = [], placed = false) {
|
|
50795
|
-
const
|
|
51112
|
+
const rows = `[data-grid-id="${this.gridId}"] > .mx-data-grid__row`;
|
|
50796
51113
|
const rules = [];
|
|
50797
51114
|
const shown = new Set(visible);
|
|
50798
51115
|
const track = new Map(visible.map((f, i) => [f, i + 1]));
|
|
50799
51116
|
for (const field of this.columns.state.order) {
|
|
50800
|
-
const sel = `${
|
|
51117
|
+
const sel = `${rows} > [data-field="${escapeAttr(field)}"]`;
|
|
50801
51118
|
if (!shown.has(field)) {
|
|
50802
51119
|
rules.push(`${sel}{display:none}`);
|
|
50803
51120
|
continue;
|
|
@@ -50806,7 +51123,7 @@ var ColumnStyles = class {
|
|
|
50806
51123
|
const a = align.get(field);
|
|
50807
51124
|
if (a && a !== "start") {
|
|
50808
51125
|
rules.push(`${sel}.mx-data-grid__cell{text-align:${a}}`);
|
|
50809
|
-
rules.push(`${sel} .mx-data-grid__title{text-align:${a}}`);
|
|
51126
|
+
rules.push(`${sel} > .mx-data-grid__title{text-align:${a}}`);
|
|
50810
51127
|
}
|
|
50811
51128
|
const sticky = offsets.get(field);
|
|
50812
51129
|
if (sticky) {
|
|
@@ -50820,7 +51137,7 @@ var ColumnStyles = class {
|
|
|
50820
51137
|
if (!first || !last) continue;
|
|
50821
51138
|
const near = first.side === "start" ? first : last;
|
|
50822
51139
|
const edge = first.side === "start" ? last.edge : first.edge;
|
|
50823
|
-
const sel = `${
|
|
51140
|
+
const sel = `${rows} > [data-band="${escapeAttr(band.id)}"]`;
|
|
50824
51141
|
rules.push(`${sel}{position:sticky;inset-inline-${near.side}:${near.offset}px;z-index:var(--_z-sticky)}`);
|
|
50825
51142
|
if (edge) rules.push(`${sel}{box-shadow:var(--_sticky-${near.side})}`);
|
|
50826
51143
|
}
|
|
@@ -52375,7 +52692,10 @@ var GridRow = class {
|
|
|
52375
52692
|
for (const [field, text] of this.texts) {
|
|
52376
52693
|
const col = model.columns.get(field);
|
|
52377
52694
|
if (!col.lookup || model.lookups.items(col) !== items) continue;
|
|
52378
|
-
if (wanted
|
|
52695
|
+
if (wanted) {
|
|
52696
|
+
const value = model.value(this.rowId, this.row, col);
|
|
52697
|
+
if (!(Array.isArray(value) ? value : [value]).some((key) => wanted.has(items.keyStringOf(key)))) continue;
|
|
52698
|
+
}
|
|
52379
52699
|
this.drawLookup(this.cellParts.get(field), text, col);
|
|
52380
52700
|
}
|
|
52381
52701
|
}
|
|
@@ -55568,6 +55888,7 @@ var OWN$36 = [
|
|
|
55568
55888
|
var FUNCTIONS$3 = [
|
|
55569
55889
|
"textField",
|
|
55570
55890
|
"valueField",
|
|
55891
|
+
"normalizeKey",
|
|
55571
55892
|
"iconField",
|
|
55572
55893
|
"groupField",
|
|
55573
55894
|
"enabledField",
|
|
@@ -55610,7 +55931,13 @@ var ListBox = class extends Field {
|
|
|
55610
55931
|
this.observeProperty("searchEnabled", () => this.renderSearch());
|
|
55611
55932
|
this.observeProperty("height", (height) => this.renderHeight(height));
|
|
55612
55933
|
this.observeProperty("selectionMode", (mode) => put(this, "data-selection-mode", mode ?? "single"));
|
|
55613
|
-
this.observeProperty("valueField", () => {
|
|
55934
|
+
this.observeProperty("valueField", (field) => {
|
|
55935
|
+
parts.items.valueField = typeof field === "string" ? field : void 0;
|
|
55936
|
+
parts.known.clear();
|
|
55937
|
+
this.renderValue(this.peekValue());
|
|
55938
|
+
});
|
|
55939
|
+
this.observeProperty("normalizeKey", (rule) => {
|
|
55940
|
+
parts.items.normalizeKey = rule ?? void 0;
|
|
55614
55941
|
parts.known.clear();
|
|
55615
55942
|
this.renderValue(this.peekValue());
|
|
55616
55943
|
});
|
|
@@ -55654,6 +55981,12 @@ var ListBox = class extends Field {
|
|
|
55654
55981
|
set valueField(value) {
|
|
55655
55982
|
this.assignProperty("valueField", functionValue(value));
|
|
55656
55983
|
}
|
|
55984
|
+
get normalizeKey() {
|
|
55985
|
+
return this.getProperty("normalizeKey");
|
|
55986
|
+
}
|
|
55987
|
+
set normalizeKey(value) {
|
|
55988
|
+
this.assignProperty("normalizeKey", functionValue(value));
|
|
55989
|
+
}
|
|
55657
55990
|
get iconField() {
|
|
55658
55991
|
return this.getProperty("iconField");
|
|
55659
55992
|
}
|
|
@@ -55808,6 +56141,11 @@ var ListBox = class extends Field {
|
|
|
55808
56141
|
itemText(item) {
|
|
55809
56142
|
return String(readItemField(item, this.peekProperty("textField"), "text") ?? "");
|
|
55810
56143
|
}
|
|
56144
|
+
/** Whether `item` is chosen: its value is, or a chosen value stands for it (`DataItems.sameItem`). */
|
|
56145
|
+
isChosen(item) {
|
|
56146
|
+
const parts = this.listParts;
|
|
56147
|
+
return parts.items.heldIn(parts.chosen, this.itemValue(item)) !== null;
|
|
56148
|
+
}
|
|
55811
56149
|
itemValue(item) {
|
|
55812
56150
|
const field = this.peekProperty("valueField");
|
|
55813
56151
|
if (field !== void 0) return readItemField(item, field, "value");
|
|
@@ -55838,7 +56176,7 @@ var ListBox = class extends Field {
|
|
|
55838
56176
|
setUpList(list) {
|
|
55839
56177
|
list.textOf = (row) => row === selectAllRow ? "" : this.itemText(row);
|
|
55840
56178
|
list.enabledOf = (row) => row === selectAllRow || this.canChoose(row);
|
|
55841
|
-
list.isSelected = (row) => row === selectAllRow ? this.allState() === true : this.
|
|
56179
|
+
list.isSelected = (row) => row === selectAllRow ? this.allState() === true : this.isChosen(row);
|
|
55842
56180
|
list.emptyText = () => this.peekProperty("noItemsText") || (this.listParts.items.loading ? uiLocale.strings.loading : uiLocale.strings.noItems);
|
|
55843
56181
|
}
|
|
55844
56182
|
/** Gives the list a drawing for the template now, made anew only when the template changes. */
|
|
@@ -55849,12 +56187,12 @@ var ListBox = class extends Field {
|
|
|
55849
56187
|
parts.template = template;
|
|
55850
56188
|
list.draw = (row, host, option) => {
|
|
55851
56189
|
if (row === selectAllRow) {
|
|
55852
|
-
|
|
56190
|
+
list.bindText(option, () => uiLocale.strings.selectAll);
|
|
55853
56191
|
this.keepSelectAllRow(option);
|
|
55854
|
-
return
|
|
56192
|
+
return;
|
|
55855
56193
|
}
|
|
55856
56194
|
if (template) return template(row, host);
|
|
55857
|
-
|
|
56195
|
+
list.bindText(option, () => this.itemText(row));
|
|
55858
56196
|
};
|
|
55859
56197
|
}
|
|
55860
56198
|
isMultiple() {
|
|
@@ -55872,7 +56210,7 @@ var ListBox = class extends Field {
|
|
|
55872
56210
|
}
|
|
55873
56211
|
allState() {
|
|
55874
56212
|
const parts = this.listParts;
|
|
55875
|
-
return selectAllState(parts.items, parts.chosen, (item) => this.
|
|
56213
|
+
return selectAllState(parts.items, parts.chosen, (item) => this.isChosen(item), (item) => this.canChoose(item));
|
|
55876
56214
|
}
|
|
55877
56215
|
renderSource() {
|
|
55878
56216
|
const parts = this.listParts;
|
|
@@ -56020,7 +56358,7 @@ var ListBox = class extends Field {
|
|
|
56020
56358
|
let index = -1;
|
|
56021
56359
|
if (parts.chosen.size) for (let i = 0; i < list.count && index < 0; i++) {
|
|
56022
56360
|
const row = list.itemOf(i);
|
|
56023
|
-
if (row !== void 0 && row !== selectAllRow &&
|
|
56361
|
+
if (row !== void 0 && row !== selectAllRow && this.isChosen(row)) index = i;
|
|
56024
56362
|
}
|
|
56025
56363
|
if (index >= 0) list.setActive(index);
|
|
56026
56364
|
else list.move("first");
|
|
@@ -56105,8 +56443,9 @@ var ListBox = class extends Field {
|
|
|
56105
56443
|
}
|
|
56106
56444
|
const values = this.valuesOf(this.peekValue());
|
|
56107
56445
|
let next;
|
|
56446
|
+
const held = parts.items.heldIn(parts.chosen, value);
|
|
56108
56447
|
if (how === "only") next = [value];
|
|
56109
|
-
else if (
|
|
56448
|
+
else if (held) next = how === "toggle" ? values.filter((v) => !Object.is(v, held.value)) : values;
|
|
56110
56449
|
else next = [...values, value];
|
|
56111
56450
|
this.commit(next, event);
|
|
56112
56451
|
}
|
|
@@ -56121,7 +56460,7 @@ var ListBox = class extends Field {
|
|
|
56121
56460
|
const row = parts.list.itemOf(i);
|
|
56122
56461
|
if (row === void 0 || row === selectAllRow || !this.canChoose(row)) continue;
|
|
56123
56462
|
const value = this.itemValue(row);
|
|
56124
|
-
if (!next.some((v) =>
|
|
56463
|
+
if (!next.some((v) => parts.items.sameItem(v, value))) next.push(value);
|
|
56125
56464
|
}
|
|
56126
56465
|
this.commit(next, event);
|
|
56127
56466
|
}
|
|
@@ -56135,7 +56474,7 @@ var ListBox = class extends Field {
|
|
|
56135
56474
|
const current = this.valuesOf(this.peekValue());
|
|
56136
56475
|
const chosen = new Set(current);
|
|
56137
56476
|
const set = new Set(shown);
|
|
56138
|
-
const next = on ? [...current, ...shown.filter((v) => !
|
|
56477
|
+
const next = on ? [...current, ...shown.filter((v) => !parts.items.heldIn(chosen, v))] : current.filter((v) => !parts.items.heldIn(set, v));
|
|
56139
56478
|
this.commit(next, event);
|
|
56140
56479
|
}
|
|
56141
56480
|
};
|
|
@@ -56845,7 +57184,7 @@ var FilterBuilderModel = class {
|
|
|
56845
57184
|
const source = givenField(lookup, "dataSource");
|
|
56846
57185
|
if (!source) return String(v);
|
|
56847
57186
|
this.state.texts;
|
|
56848
|
-
const items = KeyedItems.of(source, givenValue(lookup, "valueField"));
|
|
57187
|
+
const items = KeyedItems.of(source, givenValue(lookup, "valueField"), lookup.normalizeKey);
|
|
56849
57188
|
const known = items.get(v);
|
|
56850
57189
|
if (!known) {
|
|
56851
57190
|
items.request([v]).then(() => untracked(() => this.state.texts++));
|
|
@@ -57933,7 +58272,8 @@ var FilterBuilder = class extends Control {
|
|
|
57933
58272
|
const from = Array.isArray(source) ? { items: source } : { dataSource: source };
|
|
57934
58273
|
const fields = {
|
|
57935
58274
|
valueField: lookup.valueField,
|
|
57936
|
-
textField: lookup.textField
|
|
58275
|
+
textField: lookup.textField,
|
|
58276
|
+
normalizeKey: lookup.normalizeKey
|
|
57937
58277
|
};
|
|
57938
58278
|
if (many) return new TagBox({
|
|
57939
58279
|
...from,
|
|
@@ -58126,6 +58466,7 @@ function builderFields(model, customOperations = []) {
|
|
|
58126
58466
|
const lookup = col.lookup ? {
|
|
58127
58467
|
dataSource: col.lookup.dataSource,
|
|
58128
58468
|
valueField: col.lookup.valueField,
|
|
58469
|
+
normalizeKey: col.lookup.normalizeKey,
|
|
58129
58470
|
textField: col.lookup.textField
|
|
58130
58471
|
} : options ? {
|
|
58131
58472
|
dataSource: options,
|
|
@@ -58887,7 +59228,7 @@ var DataGrid = class extends Control {
|
|
|
58887
59228
|
this.bands = new BandRows(_model, host, this.header);
|
|
58888
59229
|
this.motif.setDisposable(() => this.bands.dispose());
|
|
58889
59230
|
this.filterRow = new FilterRow(_model);
|
|
58890
|
-
this.widths = new ActionWidths(() => this.measurePart, () => _model.notices.tell("actions"));
|
|
59231
|
+
this.widths = new ActionWidths(() => this.measurePart, () => _model.notices.tell("actions"), (on) => mark(this, "data-measuring-actions", on));
|
|
58891
59232
|
onLayout(this, "look", () => {
|
|
58892
59233
|
this.widths.clear();
|
|
58893
59234
|
this.measureSizes();
|
|
@@ -61167,7 +61508,6 @@ var DataGrid = class extends Control {
|
|
|
61167
61508
|
const { model } = this;
|
|
61168
61509
|
const settings = model.settings;
|
|
61169
61510
|
this.class.add("mx-data-grid");
|
|
61170
|
-
this.attr.add({ "data-grid-id": this.gridId });
|
|
61171
61511
|
this.drawRoot();
|
|
61172
61512
|
this.motif.setDisposable(model.notices.before(() => {
|
|
61173
61513
|
for (const check of this.reactions) safeCall(check, "DataGrid");
|
|
@@ -61311,11 +61651,13 @@ var DataGrid = class extends Control {
|
|
|
61311
61651
|
model.showsFilterRow()
|
|
61312
61652
|
];
|
|
61313
61653
|
}, () => {
|
|
61654
|
+
const held = this.tabbable && !this.tabbable.isDisposed && holdsFocus(this.tabbable) ? this.tabbable : null;
|
|
61314
61655
|
const visible = model.columns.visible();
|
|
61315
61656
|
this.findColumns(visible);
|
|
61316
61657
|
this.arrangeColumns(visible, model.showsFilterRow());
|
|
61317
61658
|
model.keepActiveFieldVisible();
|
|
61318
|
-
this.
|
|
61659
|
+
if (held && this.activePart() !== held) this.focusActive(false);
|
|
61660
|
+
else this.syncTabStop();
|
|
61319
61661
|
});
|
|
61320
61662
|
this.whenChanged(() => {
|
|
61321
61663
|
const visible = model.columns.visible();
|
|
@@ -61497,13 +61839,21 @@ var DataGrid = class extends Control {
|
|
|
61497
61839
|
else if (settings.get("tooltips")) this.tip.hovered(this.tipFrom(e));
|
|
61498
61840
|
});
|
|
61499
61841
|
viewport.motif.on("pointerleave", () => this.tip.hide());
|
|
61842
|
+
const rowsOf = { "data-grid-id": this.gridId };
|
|
61500
61843
|
const head = div("mx-data-grid__head", viewport);
|
|
61501
|
-
head.attr.add({
|
|
61844
|
+
head.attr.add({
|
|
61845
|
+
role: "rowgroup",
|
|
61846
|
+
...rowsOf
|
|
61847
|
+
});
|
|
61502
61848
|
this.headPart = head;
|
|
61503
61849
|
head.controls.add(this.header, this.filterRow);
|
|
61850
|
+
this.body.attr.add(rowsOf);
|
|
61504
61851
|
viewport.controls.add(this.body);
|
|
61505
61852
|
const foot = div("mx-data-grid__foot", viewport);
|
|
61506
|
-
foot.attr.add({
|
|
61853
|
+
foot.attr.add({
|
|
61854
|
+
role: "rowgroup",
|
|
61855
|
+
...rowsOf
|
|
61856
|
+
});
|
|
61507
61857
|
this.footPart = foot;
|
|
61508
61858
|
foot.controls.add(this.totalRow);
|
|
61509
61859
|
const overlay = div("mx-data-grid__overlay", main);
|
|
@@ -61806,13 +62156,16 @@ var DataGrid = class extends Control {
|
|
|
61806
62156
|
actionButtons(view) {
|
|
61807
62157
|
return view.actions?.buttonParts() ?? [];
|
|
61808
62158
|
}
|
|
61809
|
-
/**
|
|
61810
|
-
|
|
62159
|
+
/**
|
|
62160
|
+
* Exactly one cell is in the tab order: the active one. `leave: false` keeps the one it was in the tab order, for the
|
|
62161
|
+
* caller to take it out once focus has left it (`focusActive`).
|
|
62162
|
+
*/
|
|
62163
|
+
syncTabStop(leave = true) {
|
|
61811
62164
|
const active = this.keptColumn();
|
|
61812
62165
|
if (active && !this.model.columnWindow.has(active)) this.updateColumns();
|
|
61813
62166
|
const part = this.activePart();
|
|
61814
62167
|
if (!part) return;
|
|
61815
|
-
if (this.tabbable && this.tabbable !== part && !this.tabbable.isDisposed) put(this.tabbable, "tabindex", "-1");
|
|
62168
|
+
if (leave && this.tabbable && this.tabbable !== part && !this.tabbable.isDisposed) put(this.tabbable, "tabindex", "-1");
|
|
61816
62169
|
put(part, "tabindex", this.tabStop ? "0" : "-1");
|
|
61817
62170
|
this.tabbable = part;
|
|
61818
62171
|
}
|
|
@@ -61883,10 +62236,12 @@ var DataGrid = class extends Control {
|
|
|
61883
62236
|
if (reveal && activeRow >= 0) this.body.reveal(activeRow);
|
|
61884
62237
|
const cols = this.model.columns;
|
|
61885
62238
|
if (reveal) this.revealColumn(cols.isBand(activeField) ? cols.leavesIn(activeField, cols.visible())[0] ?? activeField : activeField);
|
|
61886
|
-
this.
|
|
62239
|
+
const was = this.tabbable;
|
|
62240
|
+
this.syncTabStop(false);
|
|
61887
62241
|
const part = this.activePart();
|
|
61888
62242
|
if (!part) return;
|
|
61889
62243
|
focusOn(part, { preventScroll: true });
|
|
62244
|
+
if (was && was !== part && !was.isDisposed) put(was, "tabindex", "-1");
|
|
61890
62245
|
if (this.model.settings.get("tooltips")) this.tip.focus(part);
|
|
61891
62246
|
}
|
|
61892
62247
|
/** The column the active cell is in (a band's first one), drawn even while it is out of view. */
|
|
@@ -73000,7 +73355,6 @@ var Toast = class extends Control {
|
|
|
73000
73355
|
if (own.onClosed) this.onClosed(own.onClosed);
|
|
73001
73356
|
this.motif.setDisposable(() => {
|
|
73002
73357
|
clearTimeout(this.parts.timer);
|
|
73003
|
-
this.parts.releaseIcon();
|
|
73004
73358
|
this.parts.resolve("code");
|
|
73005
73359
|
this.parts.closedEmitter.dispose();
|
|
73006
73360
|
});
|
|
@@ -73143,7 +73497,6 @@ var Toast = class extends Control {
|
|
|
73143
73497
|
const closed = new Promise((r) => resolve = r);
|
|
73144
73498
|
return {
|
|
73145
73499
|
icon,
|
|
73146
|
-
releaseIcon: () => {},
|
|
73147
73500
|
body,
|
|
73148
73501
|
title: null,
|
|
73149
73502
|
titleId: "",
|
|
@@ -73179,8 +73532,6 @@ var Toast = class extends Control {
|
|
|
73179
73532
|
const tone = this.peekProperty("tone") ?? "info";
|
|
73180
73533
|
put(this, "data-tone", tone);
|
|
73181
73534
|
const icon = this.peekProperty("icon");
|
|
73182
|
-
parts.releaseIcon();
|
|
73183
|
-
parts.releaseIcon = () => {};
|
|
73184
73535
|
kept$1(parts.icon, icon !== null);
|
|
73185
73536
|
clearParts(parts.icon);
|
|
73186
73537
|
if (icon === null) return;
|
|
@@ -73188,7 +73539,7 @@ var Toast = class extends Control {
|
|
|
73188
73539
|
glyphPart(parts.icon, GLYPHS[tone] ?? "info", "mx-toast__mark");
|
|
73189
73540
|
return;
|
|
73190
73541
|
}
|
|
73191
|
-
|
|
73542
|
+
showIcon(icon, parts.icon);
|
|
73192
73543
|
}
|
|
73193
73544
|
renderAction() {
|
|
73194
73545
|
const parts = this.parts;
|
|
@@ -73980,7 +74331,6 @@ var DocumentTab = class {
|
|
|
73980
74331
|
_defineProperty(this, "status", void 0);
|
|
73981
74332
|
_defineProperty(this, "description", null);
|
|
73982
74333
|
_defineProperty(this, "icon", null);
|
|
73983
|
-
_defineProperty(this, "releaseIcon", () => {});
|
|
73984
74334
|
_defineProperty(this, "badge", null);
|
|
73985
74335
|
_defineProperty(this, "tooltip", null);
|
|
73986
74336
|
_defineProperty(this, "tipHolder", null);
|
|
@@ -74094,7 +74444,6 @@ var DocumentTab = class {
|
|
|
74094
74444
|
}
|
|
74095
74445
|
dispose() {
|
|
74096
74446
|
for (const stop of this.stops.splice(0)) stop();
|
|
74097
|
-
this.releaseIcon();
|
|
74098
74447
|
this.attachTooltip(null);
|
|
74099
74448
|
removePart(this.headerPart);
|
|
74100
74449
|
if (!this.panel.isDisposed) this.panel.dispose();
|
|
@@ -74213,8 +74562,6 @@ var DocumentTab = class {
|
|
|
74213
74562
|
this.manager.tabChanged(this);
|
|
74214
74563
|
}
|
|
74215
74564
|
renderIcon(icon) {
|
|
74216
|
-
this.releaseIcon();
|
|
74217
|
-
this.releaseIcon = () => {};
|
|
74218
74565
|
if (!icon) {
|
|
74219
74566
|
removePart(this.icon);
|
|
74220
74567
|
this.icon = null;
|
|
@@ -74226,7 +74573,7 @@ var DocumentTab = class {
|
|
|
74226
74573
|
this.icon = host;
|
|
74227
74574
|
}
|
|
74228
74575
|
clearParts(host);
|
|
74229
|
-
|
|
74576
|
+
showIcon(icon, host);
|
|
74230
74577
|
}
|
|
74231
74578
|
mark(this.headerPart, "data-icon", !!icon);
|
|
74232
74579
|
this.manager.tabChanged(this);
|
|
@@ -79498,7 +79845,7 @@ var AutoHideStrip = class {
|
|
|
79498
79845
|
}, (icon) => {
|
|
79499
79846
|
const holder = loose("span", "mx-tabdocs__icon");
|
|
79500
79847
|
holder.attr.add({ "aria-hidden": "true" });
|
|
79501
|
-
|
|
79848
|
+
showIcon(icon, holder);
|
|
79502
79849
|
return holder;
|
|
79503
79850
|
});
|
|
79504
79851
|
const title = part(button, "span", "mx-tabdocs__autohide-title");
|
|
@@ -81206,7 +81553,6 @@ var PhoneBar = class {
|
|
|
81206
81553
|
_defineProperty(this, "unsaved", void 0);
|
|
81207
81554
|
_defineProperty(this, "close", void 0);
|
|
81208
81555
|
_defineProperty(this, "count", void 0);
|
|
81209
|
-
_defineProperty(this, "releaseIcon", () => {});
|
|
81210
81556
|
_defineProperty(this, "shown", null);
|
|
81211
81557
|
_defineProperty(this, "swipe", null);
|
|
81212
81558
|
this.manager = manager;
|
|
@@ -81267,7 +81613,6 @@ var PhoneBar = class {
|
|
|
81267
81613
|
this.count.readLook();
|
|
81268
81614
|
}
|
|
81269
81615
|
dispose() {
|
|
81270
|
-
this.releaseIcon();
|
|
81271
81616
|
if (this.part.parent) this.part.parent.controls.remove(this.part);
|
|
81272
81617
|
else if (!this.part.isDisposed) this.part.dispose();
|
|
81273
81618
|
}
|
|
@@ -81297,12 +81642,10 @@ var PhoneBar = class {
|
|
|
81297
81642
|
focusOn(this.title);
|
|
81298
81643
|
}
|
|
81299
81644
|
renderIcon(doc) {
|
|
81300
|
-
this.releaseIcon();
|
|
81301
|
-
this.releaseIcon = () => {};
|
|
81302
81645
|
const icon = doc?.icon;
|
|
81303
81646
|
kept$1(this.icon, !!icon);
|
|
81304
81647
|
clearParts(this.icon);
|
|
81305
|
-
if (icon)
|
|
81648
|
+
if (icon) showIcon(icon, this.icon);
|
|
81306
81649
|
}
|
|
81307
81650
|
touchStart(e) {
|
|
81308
81651
|
if (e.touches.length !== 1) return;
|
|
@@ -81492,7 +81835,6 @@ var PhoneList = class {
|
|
|
81492
81835
|
this.endGesture();
|
|
81493
81836
|
this.dragged?.boxes?.stop();
|
|
81494
81837
|
this.dragged = null;
|
|
81495
|
-
for (const row of this.rows.values()) row.release();
|
|
81496
81838
|
this.rows.clear();
|
|
81497
81839
|
if (!this.search.isDisposed) this.search.dispose();
|
|
81498
81840
|
if (!this.sheet.isDisposed) this.sheet.dispose();
|
|
@@ -81527,7 +81869,6 @@ var PhoneList = class {
|
|
|
81527
81869
|
}
|
|
81528
81870
|
for (const [doc, row] of this.rows) {
|
|
81529
81871
|
if (seen.has(doc)) continue;
|
|
81530
|
-
row.release();
|
|
81531
81872
|
removePart(row.part);
|
|
81532
81873
|
this.rows.delete(doc);
|
|
81533
81874
|
}
|
|
@@ -81576,13 +81917,12 @@ var PhoneList = class {
|
|
|
81576
81917
|
mark(row.part, "data-pinned", doc.pinned);
|
|
81577
81918
|
mark(row.part, "data-preview", doc.preview);
|
|
81578
81919
|
if (row.icon !== doc.icon) {
|
|
81579
|
-
row.
|
|
81580
|
-
row.release = () => {};
|
|
81920
|
+
if (row.iconHolder) clearParts(row.iconHolder);
|
|
81581
81921
|
if (doc.icon && !row.iconHolder) {
|
|
81582
81922
|
row.iconHolder = partBefore(row.open, row.text, "span", "mx-tabdocs__icon");
|
|
81583
81923
|
row.iconHolder.attr.add({ "aria-hidden": "true" });
|
|
81584
81924
|
}
|
|
81585
|
-
if (doc.icon && row.iconHolder)
|
|
81925
|
+
if (doc.icon && row.iconHolder) showIcon(doc.icon, row.iconHolder);
|
|
81586
81926
|
row.icon = doc.icon;
|
|
81587
81927
|
}
|
|
81588
81928
|
if (row.iconHolder) kept$1(row.iconHolder, !!doc.icon);
|
|
@@ -81634,7 +81974,6 @@ var PhoneList = class {
|
|
|
81634
81974
|
part: rowPart,
|
|
81635
81975
|
open: openPart,
|
|
81636
81976
|
close: closePart,
|
|
81637
|
-
release: () => {},
|
|
81638
81977
|
look: "",
|
|
81639
81978
|
shown: true,
|
|
81640
81979
|
text,
|
|
@@ -81972,7 +82311,6 @@ var PhoneTools = class {
|
|
|
81972
82311
|
put(this.part, "aria-label", m.textOf("tabDocsPhoneTools"));
|
|
81973
82312
|
for (const [doc, entry] of this.buttons) {
|
|
81974
82313
|
if (tools.includes(doc)) continue;
|
|
81975
|
-
entry.release();
|
|
81976
82314
|
removePart(entry.button);
|
|
81977
82315
|
this.buttons.delete(doc);
|
|
81978
82316
|
}
|
|
@@ -81990,7 +82328,6 @@ var PhoneTools = class {
|
|
|
81990
82328
|
for (const { button } of this.buttons.values()) put(button, "tabindex", button === stop ? "0" : "-1");
|
|
81991
82329
|
}
|
|
81992
82330
|
dispose() {
|
|
81993
|
-
for (const entry of this.buttons.values()) entry.release();
|
|
81994
82331
|
this.buttons.clear();
|
|
81995
82332
|
removePart(this.part);
|
|
81996
82333
|
}
|
|
@@ -82008,17 +82345,15 @@ var PhoneTools = class {
|
|
|
82008
82345
|
button,
|
|
82009
82346
|
mark,
|
|
82010
82347
|
label: part(button, "span", "mx-tabdocs__phone-tool-label"),
|
|
82011
|
-
release: () => {},
|
|
82012
82348
|
icon: void 0,
|
|
82013
82349
|
title: ""
|
|
82014
82350
|
};
|
|
82015
82351
|
this.buttons.set(doc, entry);
|
|
82016
82352
|
} else if (entry.icon === icon && entry.title === title) return entry;
|
|
82017
82353
|
if (entry.icon !== icon) {
|
|
82018
|
-
entry.
|
|
82019
|
-
entry.release = () => {};
|
|
82354
|
+
clearParts(entry.mark);
|
|
82020
82355
|
entry.mark.setText("");
|
|
82021
|
-
if (icon)
|
|
82356
|
+
if (icon) showIcon(icon, entry.mark);
|
|
82022
82357
|
}
|
|
82023
82358
|
if (!icon && (entry.icon !== icon || entry.title !== title)) entry.mark.setText(Array.from(title.trim())[0]?.toLocaleUpperCase(uiLocale.locale) ?? "");
|
|
82024
82359
|
text$1(entry.label, title);
|
|
@@ -88241,7 +88576,6 @@ var AccordionItem = class extends Control {
|
|
|
88241
88576
|
parts.header.motif.on("keydown", (_sender, e) => parts.owner?.headerKeyDown(this, e));
|
|
88242
88577
|
this.motif.setDisposable(() => {
|
|
88243
88578
|
clearTimeout(parts.releaseTimer);
|
|
88244
|
-
parts.releaseIcon();
|
|
88245
88579
|
parts.owner?.itemGone(this);
|
|
88246
88580
|
});
|
|
88247
88581
|
}
|
|
@@ -88385,8 +88719,6 @@ var AccordionItem = class extends Control {
|
|
|
88385
88719
|
renderIcon() {
|
|
88386
88720
|
const parts = this.parts;
|
|
88387
88721
|
const icon = this.peekProperty("icon");
|
|
88388
|
-
parts.releaseIcon();
|
|
88389
|
-
parts.releaseIcon = () => {};
|
|
88390
88722
|
if (!icon) {
|
|
88391
88723
|
if (parts.icon) removePart(parts.icon);
|
|
88392
88724
|
parts.icon = null;
|
|
@@ -88399,7 +88731,7 @@ var AccordionItem = class extends Control {
|
|
|
88399
88731
|
parts.icon = host;
|
|
88400
88732
|
}
|
|
88401
88733
|
clearParts(host);
|
|
88402
|
-
|
|
88734
|
+
showIcon(icon, host);
|
|
88403
88735
|
}
|
|
88404
88736
|
get parts() {
|
|
88405
88737
|
const self = this;
|
|
@@ -88431,7 +88763,6 @@ var AccordionItem = class extends Control {
|
|
|
88431
88763
|
headerId,
|
|
88432
88764
|
label,
|
|
88433
88765
|
icon: null,
|
|
88434
|
-
releaseIcon: () => {},
|
|
88435
88766
|
region,
|
|
88436
88767
|
body: loose("div", "mx-accordion__body"),
|
|
88437
88768
|
owner: null,
|
|
@@ -91496,8 +91827,8 @@ var AppointmentEditor = class {
|
|
|
91496
91827
|
columns: settings.columns ?? (phone ? 1 : 2),
|
|
91497
91828
|
minColumnWidth: settings.minColumnWidth ?? "",
|
|
91498
91829
|
labelMode: settings.labelMode,
|
|
91499
|
-
onFieldChanged: () => this.formChanged(layout),
|
|
91500
91830
|
ref: (c) => layout = c,
|
|
91831
|
+
onFieldChanged: () => this.formChanged(layout),
|
|
91501
91832
|
runover: {},
|
|
91502
91833
|
childs: []
|
|
91503
91834
|
});
|
|
@@ -91682,16 +92013,16 @@ var AppointmentEditor = class {
|
|
|
91682
92013
|
colSpan: "all",
|
|
91683
92014
|
visible: () => editing.allowRecurrence && !exception,
|
|
91684
92015
|
template: () => motifComponent(RecurrenceEditor, {
|
|
92016
|
+
ref: (r) => this.recurrence = {
|
|
92017
|
+
editor: r,
|
|
92018
|
+
data
|
|
92019
|
+
},
|
|
91685
92020
|
class: "mx-scheduler__recurrence",
|
|
91686
92021
|
start: () => data.start instanceof Date ? data.start : null,
|
|
91687
92022
|
allDay: () => !!data.allDay,
|
|
91688
92023
|
timeZone: () => data.startTimeZone ? String(data.startTimeZone) : model.zone.name || null,
|
|
91689
92024
|
locale: () => this.host.locale(),
|
|
91690
92025
|
firstDayOfWeek: () => this.host.firstDayOfWeek(),
|
|
91691
|
-
ref: (r) => this.recurrence = {
|
|
91692
|
-
editor: r,
|
|
91693
|
-
data
|
|
91694
|
-
},
|
|
91695
92026
|
runover: { initializeComponent: (sender) => {
|
|
91696
92027
|
sender.bindings.model(() => data.recurrenceRule, (_value) => {
|
|
91697
92028
|
const _owner = data;
|
|
@@ -104526,7 +104857,6 @@ var MenuBar = class MenuBar extends Control {
|
|
|
104526
104857
|
this.motif.setDisposable(() => {
|
|
104527
104858
|
parts.stopDrawing?.();
|
|
104528
104859
|
parts.removeF10?.();
|
|
104529
|
-
for (const slot of parts.slots.values()) slot.releaseIcon?.();
|
|
104530
104860
|
parts.slots.clear();
|
|
104531
104861
|
parts.itemClick.dispose();
|
|
104532
104862
|
parts.itemsChanged.dispose();
|
|
@@ -105085,7 +105415,6 @@ var MenuBar = class MenuBar extends Control {
|
|
|
105085
105415
|
stashed.push(slot);
|
|
105086
105416
|
continue;
|
|
105087
105417
|
}
|
|
105088
|
-
slot.releaseIcon?.();
|
|
105089
105418
|
parts.slots.delete(slot.key);
|
|
105090
105419
|
}
|
|
105091
105420
|
parts.shownSlots = stashed.length ? [...shownSlots, ...stashed] : shownSlots;
|
|
@@ -105107,7 +105436,6 @@ var MenuBar = class MenuBar extends Control {
|
|
|
105107
105436
|
if (left.length === parts.shownSlots.length) return;
|
|
105108
105437
|
for (const slot of parts.shownSlots) {
|
|
105109
105438
|
if (left.includes(slot)) continue;
|
|
105110
|
-
slot.releaseIcon?.();
|
|
105111
105439
|
parts.slots.delete(slot.key);
|
|
105112
105440
|
}
|
|
105113
105441
|
parts.shownSlots = left;
|
|
@@ -105130,7 +105458,6 @@ var MenuBar = class MenuBar extends Control {
|
|
|
105130
105458
|
label: part(button, "span", "mx-menubar__label"),
|
|
105131
105459
|
icon: null,
|
|
105132
105460
|
iconSource: null,
|
|
105133
|
-
releaseIcon: null,
|
|
105134
105461
|
drawnLabel: null,
|
|
105135
105462
|
token: null,
|
|
105136
105463
|
entry: null,
|
|
@@ -105143,8 +105470,6 @@ var MenuBar = class MenuBar extends Control {
|
|
|
105143
105470
|
/** The item's icon, drawn again only when its source changes. */
|
|
105144
105471
|
drawIcon(slot, source) {
|
|
105145
105472
|
if (slot.iconSource === source) return;
|
|
105146
|
-
slot.releaseIcon?.();
|
|
105147
|
-
slot.releaseIcon = null;
|
|
105148
105473
|
slot.iconSource = source;
|
|
105149
105474
|
if (!source) {
|
|
105150
105475
|
removePart(slot.icon);
|
|
@@ -105155,7 +105480,8 @@ var MenuBar = class MenuBar extends Control {
|
|
|
105155
105480
|
slot.icon = partBefore(slot.button, slot.label, "span", "mx-menubar__icon");
|
|
105156
105481
|
slot.icon.attr.add({ "aria-hidden": "true" });
|
|
105157
105482
|
}
|
|
105158
|
-
|
|
105483
|
+
clearParts(slot.icon);
|
|
105484
|
+
showIcon(source, slot.icon);
|
|
105159
105485
|
}
|
|
105160
105486
|
/** The item Tab reaches: the last one focused, else the first. */
|
|
105161
105487
|
stop() {
|
|
@@ -106603,7 +106929,7 @@ var RibbonKeyHints = class {
|
|
|
106603
106929
|
});
|
|
106604
106930
|
return true;
|
|
106605
106931
|
}
|
|
106606
|
-
if (level === "tabs" && this.level === "tabs") whenMeasured(this.owner).then(() => untouched() && this.start("commands"));
|
|
106932
|
+
if (exact.hint.tab && level === "tabs" && this.level === "tabs") whenMeasured(this.owner).then(() => untouched() && this.start("commands"));
|
|
106607
106933
|
else if (this.level === level) this.stop();
|
|
106608
106934
|
return true;
|
|
106609
106935
|
}
|
|
@@ -108130,7 +108456,8 @@ var RibbonMenu = class RibbonMenu extends Control {
|
|
|
108130
108456
|
part: host,
|
|
108131
108457
|
keys: parsed.key ?? "",
|
|
108132
108458
|
text: parsed.text,
|
|
108133
|
-
press: () => this.pressTab(look)
|
|
108459
|
+
press: () => this.pressTab(look),
|
|
108460
|
+
tab: true
|
|
108134
108461
|
});
|
|
108135
108462
|
});
|
|
108136
108463
|
let n = 1;
|
|
@@ -108190,10 +108517,13 @@ var RibbonMenu = class RibbonMenu extends Control {
|
|
|
108190
108517
|
});
|
|
108191
108518
|
} else if (m.type === "content") {
|
|
108192
108519
|
const content = m.control;
|
|
108193
|
-
if (hasFocusableIn(content))
|
|
108520
|
+
if (!hasFocusableIn(content)) return;
|
|
108521
|
+
const label = parseAccessKey(contentName(content));
|
|
108522
|
+
const named = text.text || String(fieldOf(command, "hint", this) ?? "");
|
|
108523
|
+
hints.push({
|
|
108194
108524
|
part: content,
|
|
108195
|
-
keys,
|
|
108196
|
-
text:
|
|
108525
|
+
keys: keys || (named ? "" : label.key ?? ""),
|
|
108526
|
+
text: named || label.text,
|
|
108197
108527
|
press: () => focusFirstIn(content)
|
|
108198
108528
|
});
|
|
108199
108529
|
} else if (m.made) for (const inner of m.made.values()) add(inner);
|
|
@@ -108679,6 +109009,16 @@ function partStops(part, stops) {
|
|
|
108679
109009
|
if (canTakeFocus(part)) stops.push(part);
|
|
108680
109010
|
for (const child of part.controls.items) partStops(child, stops);
|
|
108681
109011
|
}
|
|
109012
|
+
function contentName(part) {
|
|
109013
|
+
if (part instanceof Field) return part.label;
|
|
109014
|
+
const own = part.attr.get("aria-label");
|
|
109015
|
+
if (typeof own === "string" && own) return own;
|
|
109016
|
+
for (const child of part.controls.items) {
|
|
109017
|
+
const name = contentName(child);
|
|
109018
|
+
if (name) return name;
|
|
109019
|
+
}
|
|
109020
|
+
return "";
|
|
109021
|
+
}
|
|
108682
109022
|
function buttonHint(button, keys, text) {
|
|
108683
109023
|
const face = button.faceComponent;
|
|
108684
109024
|
const press = () => {
|