@swiftwc/ui 1.0.1-canary.0 → 1.0.1-canary.2
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/generated/client/index.js +5 -2
- package/generated/components/date-picker.js +54 -33
- package/generated/components/disclosure-group.js +5 -3
- package/generated/components/fine-tooltip.js +3 -5
- package/generated/components/menu-view.js +9 -11
- package/generated/components/navigation-large-title.js +4 -6
- package/generated/components/picker-view.js +218 -96
- package/generated/components/progress-view.js +60 -30
- package/generated/components/scroll-view.js +7 -9
- package/generated/components/sidebar-toggle.js +8 -10
- package/generated/components/tab-view.js +8 -10
- package/generated/components/table-view.js +5 -7
- package/generated/components/text-field.js +13 -13
- package/generated/components/toggle-view.js +12 -14
- package/generated/components/tool-bar.js +3 -5
- package/generated/components/v-keyboard.js +4 -6
- package/generated/css/index.css +19 -17
- package/generated/i18n/index.js +10 -9
- package/generated/internal/class/cleanup-registry.js +9 -7
- package/generated/internal/class/css-style-observer.js +1 -3
- package/generated/internal/class/mutation-observer-set.js +3 -3
- package/generated/internal/class/mutation-observer-singleton.js +29 -14
- package/generated/internal/class/navigation-path.js +5 -3
- package/generated/internal/class/navigation-view.js +2 -4
- package/html-data/en.json +1 -1
- package/package.json +1 -1
- package/scss/components/_label-view.scss +16 -7
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import { I18n } from '../i18n';
|
|
3
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
3
|
import { DictEntry, Dictionary } from '../internal/class/dict-entry';
|
|
@@ -27,7 +26,11 @@ const reflectSpawnedPage = (current, source) => {
|
|
|
27
26
|
const { page: oldSv, toolBarConfig: oldToolbar } = new NavigationPath(current).hydrate(), { page: newSv, toolBarConfig: newToolbar } = new NavigationPath(source).hydrate();
|
|
28
27
|
const oldList = oldSv?.querySelector('list-view'), newList = newSv?.querySelector('list-view'), oldBackBtn = oldToolbar?.at(0)?.querySelector('button'), newBackBtn = newToolbar?.at(0)?.querySelector('button');
|
|
29
28
|
// pre replace list (always exists)
|
|
30
|
-
const oldOpenedDetails =
|
|
29
|
+
const oldOpenedDetails = oldList
|
|
30
|
+
?.querySelectorAll('list-view details[open]>summary')
|
|
31
|
+
.values()
|
|
32
|
+
.map((item) => item.textContent.trim())
|
|
33
|
+
.toArray() ?? [];
|
|
31
34
|
// replace list (always exists)
|
|
32
35
|
if (oldList && newList)
|
|
33
36
|
oldList.replaceWith(newList);
|
|
@@ -127,7 +130,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
127
130
|
};
|
|
128
131
|
}
|
|
129
132
|
#spawnPage = (entries, tag, parentGroupId, searchable = false, title) => {
|
|
130
|
-
debug(`${
|
|
133
|
+
debug(`${PickerView.name} #spawnPage`);
|
|
131
134
|
const body = tag === 'sheet-view'
|
|
132
135
|
? $(html `<dialog is="sheet-view">
|
|
133
136
|
<scroll-view>
|
|
@@ -219,7 +222,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
219
222
|
list?.appendChild(group);
|
|
220
223
|
}
|
|
221
224
|
else {
|
|
222
|
-
const btn =
|
|
225
|
+
const btn = PickerView.#wrapOptionSpawnTag(el);
|
|
223
226
|
const groupId = parentGroupId ? `${parentGroupId}.${i}` : `${i}`;
|
|
224
227
|
btn.dataset.groupId = groupId;
|
|
225
228
|
btn.addEventListener('click', this.#makeGroupClickHandler(el, groupId));
|
|
@@ -250,7 +253,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
250
253
|
}
|
|
251
254
|
};
|
|
252
255
|
#renderButtons(source) {
|
|
253
|
-
debug(`${
|
|
256
|
+
debug(`${PickerView.name} #renderButtons`);
|
|
254
257
|
const { labels, icons } = Dictionary.flatten(source);
|
|
255
258
|
this.#lastRenderedLabelMap = labels;
|
|
256
259
|
this.#lastRenderedIconMap = icons;
|
|
@@ -360,11 +363,11 @@ export class PickerView extends FormAssociatedBase {
|
|
|
360
363
|
// this.#renderButtons({ mode: 'dictionary', source: dictionary })
|
|
361
364
|
// }
|
|
362
365
|
#renderSlotted = (entries) => {
|
|
363
|
-
debug(`${
|
|
366
|
+
debug(`${PickerView.name} ⚡️ mutation`);
|
|
364
367
|
this.#renderButtons(this.#resolveSource()); //this.#renderButtons({ mode: 'list', source: this.#slots?.get('list')?.assignedElements({ flatten: true }) ?? [] })
|
|
365
368
|
};
|
|
366
369
|
#renderValidityMsgs = (entries) => {
|
|
367
|
-
debug(`${
|
|
370
|
+
debug(`${PickerView.name} ⚡️ mutation`);
|
|
368
371
|
this.setValidity(this.validity, this.validationMessage);
|
|
369
372
|
};
|
|
370
373
|
#lastRenderedStyle; //string | null
|
|
@@ -398,53 +401,171 @@ export class PickerView extends FormAssociatedBase {
|
|
|
398
401
|
return getInternals(this);
|
|
399
402
|
}
|
|
400
403
|
get template() {
|
|
401
|
-
if (!
|
|
404
|
+
// if (!PickerView.#templates.has(this.pickerStyle))
|
|
405
|
+
// switch (this.pickerStyle) {
|
|
406
|
+
// case 'sheet':
|
|
407
|
+
// case 'navigation-link':
|
|
408
|
+
// PickerView.#templates.set(
|
|
409
|
+
// this.pickerStyle,
|
|
410
|
+
// $(html`
|
|
411
|
+
// <div part="root picker-stack">
|
|
412
|
+
// <div part="root picker-label-stack">
|
|
413
|
+
// <slot name="label"></slot>
|
|
414
|
+
// </div>
|
|
415
|
+
// <div part="root picker-input-stack">
|
|
416
|
+
// <slot></slot>
|
|
417
|
+
// </div>
|
|
418
|
+
// <slot name="list" hidden></slot>
|
|
419
|
+
// <slot name="validity-options" hidden></slot>
|
|
420
|
+
// </div>
|
|
421
|
+
// `)
|
|
422
|
+
// )
|
|
423
|
+
// break
|
|
424
|
+
// case 'menu':
|
|
425
|
+
// PickerView.#templates.set(
|
|
426
|
+
// this.pickerStyle,
|
|
427
|
+
// $(html`
|
|
428
|
+
// <div part="root picker-stack">
|
|
429
|
+
// <div part="root picker-label-stack">
|
|
430
|
+
// <slot name="label"></slot>
|
|
431
|
+
// </div>
|
|
432
|
+
// <div part="root picker-input-stack">
|
|
433
|
+
// <slot></slot>
|
|
434
|
+
// </div>
|
|
435
|
+
// <slot name="list" hidden></slot>
|
|
436
|
+
// <slot name="validity-options" hidden></slot>
|
|
437
|
+
// </div>
|
|
438
|
+
// `)
|
|
439
|
+
// )
|
|
440
|
+
// break
|
|
441
|
+
// case 'tabs':
|
|
442
|
+
// case 'palette':
|
|
443
|
+
// case 'radio-group':
|
|
444
|
+
// PickerView.#templates.set(
|
|
445
|
+
// this.pickerStyle,
|
|
446
|
+
// $(html`
|
|
447
|
+
// <div part="root picker-stack">
|
|
448
|
+
// <div part="root picker-label-stack">
|
|
449
|
+
// <slot name="label"></slot>
|
|
450
|
+
// </div>
|
|
451
|
+
// <div part="root picker-input-stack">
|
|
452
|
+
// <slot></slot>
|
|
453
|
+
// </div>
|
|
454
|
+
// <slot name="list" hidden></slot>
|
|
455
|
+
// <slot name="validity-options" hidden></slot>
|
|
456
|
+
// </div>
|
|
457
|
+
// `)
|
|
458
|
+
// )
|
|
459
|
+
// break
|
|
460
|
+
// // break
|
|
461
|
+
// // case 'compact':
|
|
462
|
+
// // PickerView.#templates.set(
|
|
463
|
+
// // style,
|
|
464
|
+
// // Object.assign(document.createElement('template'), {
|
|
465
|
+
// // innerHTML: String.raw`
|
|
466
|
+
// // <label part="compact-picker">
|
|
467
|
+
// // <input type="text" part="compact-input">
|
|
468
|
+
// // </label>
|
|
469
|
+
// // `,
|
|
470
|
+
// // })
|
|
471
|
+
// // )
|
|
472
|
+
// // break
|
|
473
|
+
// // case 'fancy':
|
|
474
|
+
// // PickerView.#templates.set(
|
|
475
|
+
// // style,
|
|
476
|
+
// // Object.assign(document.createElement('template'), {
|
|
477
|
+
// // innerHTML: String.raw`
|
|
478
|
+
// // <div part="fancy-picker">
|
|
479
|
+
// // <span>Fancy Picker</span>
|
|
480
|
+
// // <input type="text" part="fancy-input">
|
|
481
|
+
// // </div>
|
|
482
|
+
// // `,
|
|
483
|
+
// // })
|
|
484
|
+
// // )
|
|
485
|
+
// // case 'gg':
|
|
486
|
+
// // PickerView.#templates.set(
|
|
487
|
+
// // style,
|
|
488
|
+
// // Object.assign(document.createElement('template'), {
|
|
489
|
+
// // innerHTML: String.raw`
|
|
490
|
+
// // <label part="root text-field-stack">
|
|
491
|
+
// // <div part="root text-field-label-stack">
|
|
492
|
+
// // <slot name="label"></slot>
|
|
493
|
+
// // </div>
|
|
494
|
+
// // <div part="root text-field-input-stack">
|
|
495
|
+
// // <input type="text" part="root input text-field-form-input" list="tickmarks">
|
|
496
|
+
// // <datalist id="tickmarks">
|
|
497
|
+
// // <option value="0" label="0%"></option>
|
|
498
|
+
// // </datalist>
|
|
499
|
+
// // </div>
|
|
500
|
+
// // <slot name="list" hidden></slot>
|
|
501
|
+
// // </label>`,
|
|
502
|
+
// // })
|
|
503
|
+
// // )
|
|
504
|
+
// // break
|
|
505
|
+
// case 'inline':
|
|
506
|
+
// default:
|
|
507
|
+
// PickerView.#templates.set(
|
|
508
|
+
// this.pickerStyle,
|
|
509
|
+
// $(
|
|
510
|
+
// html` <label part="root picker-stack">
|
|
511
|
+
// <div part="root picker-label-stack">
|
|
512
|
+
// <slot name="label"></slot>
|
|
513
|
+
// </div>
|
|
514
|
+
// <div part="root picker-input-stack">
|
|
515
|
+
// <slot></slot>
|
|
516
|
+
// </div>
|
|
517
|
+
// <slot name="list" hidden></slot>
|
|
518
|
+
// <slot name="validity-options" hidden></slot>
|
|
519
|
+
// </label>`
|
|
520
|
+
// )
|
|
521
|
+
// )
|
|
522
|
+
// break
|
|
523
|
+
// }
|
|
524
|
+
// return PickerView.#templates.get(this.pickerStyle)!
|
|
525
|
+
return PickerView.#templates.getOrInsertComputed(this.pickerStyle, () => {
|
|
402
526
|
switch (this.pickerStyle) {
|
|
403
527
|
case 'sheet':
|
|
404
528
|
case 'navigation-link':
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
</div>
|
|
410
|
-
<div part="root picker-input-stack">
|
|
411
|
-
<slot></slot>
|
|
412
|
-
</div>
|
|
413
|
-
<slot name="list" hidden></slot>
|
|
414
|
-
<slot name="validity-options" hidden></slot>
|
|
529
|
+
return $(html `
|
|
530
|
+
<div part="root picker-stack">
|
|
531
|
+
<div part="root picker-label-stack">
|
|
532
|
+
<slot name="label"></slot>
|
|
415
533
|
</div>
|
|
416
|
-
|
|
417
|
-
|
|
534
|
+
<div part="root picker-input-stack">
|
|
535
|
+
<slot></slot>
|
|
536
|
+
</div>
|
|
537
|
+
<slot name="list" hidden></slot>
|
|
538
|
+
<slot name="validity-options" hidden></slot>
|
|
539
|
+
</div>
|
|
540
|
+
`);
|
|
418
541
|
case 'menu':
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
</div>
|
|
424
|
-
<div part="root picker-input-stack">
|
|
425
|
-
<slot></slot>
|
|
426
|
-
</div>
|
|
427
|
-
<slot name="list" hidden></slot>
|
|
428
|
-
<slot name="validity-options" hidden></slot>
|
|
542
|
+
return $(html `
|
|
543
|
+
<div part="root picker-stack">
|
|
544
|
+
<div part="root picker-label-stack">
|
|
545
|
+
<slot name="label"></slot>
|
|
429
546
|
</div>
|
|
430
|
-
|
|
431
|
-
|
|
547
|
+
<div part="root picker-input-stack">
|
|
548
|
+
<slot></slot>
|
|
549
|
+
</div>
|
|
550
|
+
<slot name="list" hidden></slot>
|
|
551
|
+
<slot name="validity-options" hidden></slot>
|
|
552
|
+
</div>
|
|
553
|
+
`);
|
|
432
554
|
case 'tabs':
|
|
433
555
|
case 'palette':
|
|
434
556
|
case 'radio-group':
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
</div>
|
|
440
|
-
<div part="root picker-input-stack">
|
|
441
|
-
<slot></slot>
|
|
442
|
-
</div>
|
|
443
|
-
<slot name="list" hidden></slot>
|
|
444
|
-
<slot name="validity-options" hidden></slot>
|
|
557
|
+
return $(html `
|
|
558
|
+
<div part="root picker-stack">
|
|
559
|
+
<div part="root picker-label-stack">
|
|
560
|
+
<slot name="label"></slot>
|
|
445
561
|
</div>
|
|
446
|
-
|
|
447
|
-
|
|
562
|
+
<div part="root picker-input-stack">
|
|
563
|
+
<slot></slot>
|
|
564
|
+
</div>
|
|
565
|
+
<slot name="list" hidden></slot>
|
|
566
|
+
<slot name="validity-options" hidden></slot>
|
|
567
|
+
</div>
|
|
568
|
+
`);
|
|
448
569
|
// break
|
|
449
570
|
// case 'compact':
|
|
450
571
|
// PickerView.#templates.set(
|
|
@@ -492,26 +613,25 @@ export class PickerView extends FormAssociatedBase {
|
|
|
492
613
|
// break
|
|
493
614
|
case 'inline':
|
|
494
615
|
default:
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
break;
|
|
616
|
+
return $(html ` <label part="root picker-stack">
|
|
617
|
+
<div part="root picker-label-stack">
|
|
618
|
+
<slot name="label"></slot>
|
|
619
|
+
</div>
|
|
620
|
+
<div part="root picker-input-stack">
|
|
621
|
+
<slot></slot>
|
|
622
|
+
</div>
|
|
623
|
+
<slot name="list" hidden></slot>
|
|
624
|
+
<slot name="validity-options" hidden></slot>
|
|
625
|
+
</label>`);
|
|
506
626
|
}
|
|
507
|
-
|
|
627
|
+
});
|
|
508
628
|
}
|
|
509
629
|
constructor() {
|
|
510
630
|
super();
|
|
511
631
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
512
632
|
}
|
|
513
633
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
514
|
-
debug(`${
|
|
634
|
+
debug(`${PickerView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
515
635
|
switch (name) {
|
|
516
636
|
// case 'horizontal-radio-group-layout':
|
|
517
637
|
// if (oldValue === newValue) break
|
|
@@ -567,13 +687,13 @@ export class PickerView extends FormAssociatedBase {
|
|
|
567
687
|
}
|
|
568
688
|
}
|
|
569
689
|
disconnectedCallback() {
|
|
570
|
-
debug(`${
|
|
690
|
+
debug(`${PickerView.name} ⚡️ disconnect`);
|
|
571
691
|
CleanupRegistry.unregister(this);
|
|
572
692
|
this.#validityObservers.unobserveAll();
|
|
573
693
|
this.#observers.unobserveAll();
|
|
574
694
|
}
|
|
575
695
|
connectedCallback() {
|
|
576
|
-
debug(`${
|
|
696
|
+
debug(`${PickerView.name} ⚡️ connect`);
|
|
577
697
|
CleanupRegistry.register(this, onoff('localechange', () => {
|
|
578
698
|
this.#renderSlotted([]);
|
|
579
699
|
}, I18n.on).on());
|
|
@@ -597,7 +717,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
597
717
|
return Dictionary.fromElements(this.#slots?.get('list')?.assignedElements({ flatten: true }) ?? []);
|
|
598
718
|
}
|
|
599
719
|
#render() {
|
|
600
|
-
debug(`${
|
|
720
|
+
debug(`${PickerView.name} ⚡️ #render (${this.pickerStyle})`);
|
|
601
721
|
// const style = this.getAttribute('picker-style')
|
|
602
722
|
if (this.#lastRenderedStyle === this.pickerStyle)
|
|
603
723
|
return; // skip if already applied
|
|
@@ -641,7 +761,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
641
761
|
this.dispatchEvent(new CustomEvent('selection', { detail: { selection: this.#selection }, bubbles: true, composed: true }));
|
|
642
762
|
};
|
|
643
763
|
#handleTriggerClick = async ({ type, target }) => {
|
|
644
|
-
debug(`${
|
|
764
|
+
debug(`${PickerView.name} ⚡️ trigger.${type}`);
|
|
645
765
|
if (!(target instanceof HTMLElement))
|
|
646
766
|
return;
|
|
647
767
|
this.#spawn?.remove?.();
|
|
@@ -658,7 +778,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
658
778
|
});
|
|
659
779
|
};
|
|
660
780
|
#handlePageBtnClick = async (evt) => {
|
|
661
|
-
debug(`${
|
|
781
|
+
debug(`${PickerView.name} ⚡️ ${evt?.type}`);
|
|
662
782
|
evt.stopImmediatePropagation();
|
|
663
783
|
evt.preventDefault();
|
|
664
784
|
const { currentTarget: btn } = evt;
|
|
@@ -681,7 +801,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
681
801
|
});
|
|
682
802
|
};
|
|
683
803
|
#handleClick({ type, target }) {
|
|
684
|
-
debug(`${
|
|
804
|
+
debug(`${PickerView.name} ⚡️ ${type}`);
|
|
685
805
|
if (!(target instanceof HTMLElement))
|
|
686
806
|
return;
|
|
687
807
|
const btn = target.closest('button');
|
|
@@ -693,7 +813,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
693
813
|
this.#sendValueToForm();
|
|
694
814
|
}
|
|
695
815
|
#handleInput({ type, target }) {
|
|
696
|
-
debug(`${
|
|
816
|
+
debug(`${PickerView.name} ⚡️ ${type}`);
|
|
697
817
|
if (!(target instanceof HTMLElement))
|
|
698
818
|
return;
|
|
699
819
|
switch (this.pickerStyle) {
|
|
@@ -711,7 +831,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
711
831
|
}
|
|
712
832
|
}
|
|
713
833
|
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
714
|
-
debug(`${
|
|
834
|
+
debug(`${PickerView.name} ⚡️ ${type}`);
|
|
715
835
|
if (!(slot instanceof HTMLSlotElement))
|
|
716
836
|
return;
|
|
717
837
|
const assigned = slot.assignedElements();
|
|
@@ -720,7 +840,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
720
840
|
this.#renderValidityMsgs([]);
|
|
721
841
|
};
|
|
722
842
|
#handleListSlotchange = ({ type, target: slot }) => {
|
|
723
|
-
debug(`${
|
|
843
|
+
debug(`${PickerView.name} ⚡️ ${type}`);
|
|
724
844
|
if (!(slot instanceof HTMLSlotElement))
|
|
725
845
|
return;
|
|
726
846
|
const assigned = slot.assignedElements();
|
|
@@ -729,31 +849,31 @@ export class PickerView extends FormAssociatedBase {
|
|
|
729
849
|
this.#renderSlotted([]);
|
|
730
850
|
};
|
|
731
851
|
static #wrapOptionSpawnTag(node) {
|
|
732
|
-
debug(`${
|
|
852
|
+
debug(`${PickerView.name} #wrapOptionSpawnTag`);
|
|
733
853
|
const mount = document.createElement('div');
|
|
734
854
|
render(html `<button type="button" tabindex="0" navigation-link>
|
|
735
855
|
<h-stack distribution="leading" template="auto spacer">
|
|
736
856
|
<label-view data-role="check" style="visibility: hidden">
|
|
737
857
|
<image-view slot="icon" system-name="check"></image-view>
|
|
738
858
|
</label-view>
|
|
739
|
-
${
|
|
859
|
+
${PickerView.#morphITSLabel(node)}
|
|
740
860
|
</h-stack>
|
|
741
861
|
</button>`, mount);
|
|
742
862
|
return mount.firstElementChild; //btn
|
|
743
863
|
}
|
|
744
864
|
#wrapOptionTag(node) {
|
|
745
|
-
debug(`${
|
|
865
|
+
debug(`${PickerView.name} #wrapOptionTag`);
|
|
746
866
|
const tag = node.value;
|
|
747
867
|
const mount = document.createElement('div');
|
|
748
868
|
switch (this.pickerStyle) {
|
|
749
869
|
case 'tabs':
|
|
750
|
-
render(
|
|
870
|
+
render(PickerView.#morphTabsBtn({ name: this.#guuid, node, tag }), mount);
|
|
751
871
|
return mount.firstElementChild; //btn
|
|
752
872
|
case 'palette':
|
|
753
|
-
render(
|
|
873
|
+
render(PickerView.#morphPaletteBtn({ name: this.#guuid, node, tag }), mount);
|
|
754
874
|
return mount.firstElementChild; //btn
|
|
755
875
|
case 'radio-group':
|
|
756
|
-
render(
|
|
876
|
+
render(PickerView.#morphRadioGroupBtn({ name: this.#guuid, node, tag }), mount);
|
|
757
877
|
return mount.firstElementChild; //btn
|
|
758
878
|
default:
|
|
759
879
|
render(html `<button type="button" tabindex="0" value="${tag}">
|
|
@@ -761,7 +881,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
761
881
|
<label-view data-role="check">
|
|
762
882
|
<image-view slot="icon" system-name="check"></image-view>
|
|
763
883
|
</label-view>
|
|
764
|
-
${
|
|
884
|
+
${PickerView.#morphITSLabel(node)}
|
|
765
885
|
</h-stack>
|
|
766
886
|
</button>`, mount);
|
|
767
887
|
return mount.firstElementChild; //btn
|
|
@@ -772,14 +892,14 @@ export class PickerView extends FormAssociatedBase {
|
|
|
772
892
|
return html `<label tabindex="0">
|
|
773
893
|
<h-stack distribution="fill" template="auto spacer" spacing="5">
|
|
774
894
|
<input type="radio" name="${name}" value="${tag}" />
|
|
775
|
-
${
|
|
895
|
+
${PickerView.#morphITSLabel(node)}
|
|
776
896
|
</h-stack>
|
|
777
897
|
</label>`;
|
|
778
898
|
else
|
|
779
899
|
return html `<label>
|
|
780
900
|
<h-stack distribution="fill" template="auto spacer" spacing="5">
|
|
781
901
|
<input type="radio" name="${name}" disabled />
|
|
782
|
-
${
|
|
902
|
+
${PickerView.#morphITSLabel(node)}
|
|
783
903
|
</h-stack>
|
|
784
904
|
</label>`;
|
|
785
905
|
}
|
|
@@ -789,7 +909,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
789
909
|
return html `<label tabindex="0">
|
|
790
910
|
<v-stack template="auto spacer" spacing="5">
|
|
791
911
|
<input type="radio" name="${name}" value="${tag}" style="${style}" />
|
|
792
|
-
${
|
|
912
|
+
${PickerView.#morphITSLabel(node)}
|
|
793
913
|
</v-stack>
|
|
794
914
|
</label>`;
|
|
795
915
|
}
|
|
@@ -797,7 +917,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
797
917
|
return html `<label>
|
|
798
918
|
<v-stack template="auto spacer" spacing="5">
|
|
799
919
|
<input type="radio" name="${name}" disabled />
|
|
800
|
-
${
|
|
920
|
+
${PickerView.#morphITSLabel(node)}
|
|
801
921
|
</v-stack>
|
|
802
922
|
</label>`;
|
|
803
923
|
}
|
|
@@ -820,13 +940,13 @@ export class PickerView extends FormAssociatedBase {
|
|
|
820
940
|
if ('string' === typeof tag) {
|
|
821
941
|
return html `<label tabindex="0">
|
|
822
942
|
<input type="radio" name="${name}" value="${tag}" />
|
|
823
|
-
${
|
|
943
|
+
${PickerView.#morphITSLabel(node)}
|
|
824
944
|
</label>`;
|
|
825
945
|
}
|
|
826
946
|
else
|
|
827
947
|
return html `<label>
|
|
828
948
|
<input type="radio" name="${name}" disabled />
|
|
829
|
-
${
|
|
949
|
+
${PickerView.#morphITSLabel(node)}
|
|
830
950
|
</label>`;
|
|
831
951
|
}
|
|
832
952
|
static #morphITSLabel({ title, subtitle, systemImage }) {
|
|
@@ -839,17 +959,17 @@ export class PickerView extends FormAssociatedBase {
|
|
|
839
959
|
</h-stack>`;
|
|
840
960
|
}
|
|
841
961
|
#wrapOptgroupTag(node) {
|
|
842
|
-
debug(`${
|
|
962
|
+
debug(`${PickerView.name} #wrapOptgroupTag`);
|
|
843
963
|
const mount = document.createElement('div');
|
|
844
964
|
switch (this.pickerStyle) {
|
|
845
965
|
case 'tabs':
|
|
846
|
-
render(
|
|
966
|
+
render(PickerView.#morphTabsBtn({ name: this.#guuid, node }), mount);
|
|
847
967
|
return mount.firstElementChild;
|
|
848
968
|
case 'palette':
|
|
849
|
-
render(
|
|
969
|
+
render(PickerView.#morphPaletteBtn({ name: this.#guuid, node }), mount);
|
|
850
970
|
return mount.firstElementChild;
|
|
851
971
|
case 'radio-group':
|
|
852
|
-
render(
|
|
972
|
+
render(PickerView.#morphRadioGroupBtn({ name: this.#guuid, node }), mount);
|
|
853
973
|
return mount.firstElementChild;
|
|
854
974
|
default:
|
|
855
975
|
render(html `<details is="disclosure-group" disclosure-style="marker-trailing">
|
|
@@ -858,7 +978,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
858
978
|
<label-view data-role="check" style="visibility: hidden">
|
|
859
979
|
<image-view slot="icon" system-name="check"></image-view>
|
|
860
980
|
</label-view>
|
|
861
|
-
${
|
|
981
|
+
${PickerView.#morphITSLabel(node)}
|
|
862
982
|
</h-stack>
|
|
863
983
|
</summary>
|
|
864
984
|
</details>`, mount);
|
|
@@ -869,13 +989,13 @@ export class PickerView extends FormAssociatedBase {
|
|
|
869
989
|
const mount = document.createElement('div');
|
|
870
990
|
switch (this.pickerStyle) {
|
|
871
991
|
case 'tabs':
|
|
872
|
-
render(
|
|
992
|
+
render(PickerView.#morphTabsBtn({ name: this.#guuid, node }), mount);
|
|
873
993
|
return mount.firstElementChild;
|
|
874
994
|
case 'palette':
|
|
875
|
-
render(
|
|
995
|
+
render(PickerView.#morphPaletteBtn({ name: this.#guuid, node }), mount);
|
|
876
996
|
return mount.firstElementChild;
|
|
877
997
|
case 'radio-group':
|
|
878
|
-
render(
|
|
998
|
+
render(PickerView.#morphRadioGroupBtn({ name: this.#guuid, node }), mount);
|
|
879
999
|
return mount.firstElementChild;
|
|
880
1000
|
default:
|
|
881
1001
|
render(html `<menu-view tabindex="0">
|
|
@@ -883,14 +1003,14 @@ export class PickerView extends FormAssociatedBase {
|
|
|
883
1003
|
<label-view data-role="check" style="visibility: hidden">
|
|
884
1004
|
<image-view slot="icon" system-name="check"></image-view>
|
|
885
1005
|
</label-view>
|
|
886
|
-
${
|
|
1006
|
+
${PickerView.#morphITSLabel(node)}
|
|
887
1007
|
</h-stack>
|
|
888
1008
|
</menu-view>`, mount);
|
|
889
1009
|
return mount.firstElementChild;
|
|
890
1010
|
}
|
|
891
1011
|
}
|
|
892
1012
|
#reflectButtons(nodes, container) {
|
|
893
|
-
debug(`${
|
|
1013
|
+
debug(`${PickerView.name} #reflectButtons`);
|
|
894
1014
|
const flatten = ['radio-group', 'palette', 'tabs'].includes(this.pickerStyle);
|
|
895
1015
|
for (const node of nodes) {
|
|
896
1016
|
if (DictEntry.isLeaf(node)) {
|
|
@@ -916,12 +1036,12 @@ export class PickerView extends FormAssociatedBase {
|
|
|
916
1036
|
// }
|
|
917
1037
|
// }
|
|
918
1038
|
#reflectLabel(value) {
|
|
919
|
-
debug(`${
|
|
1039
|
+
debug(`${PickerView.name} #reflectLabel`);
|
|
920
1040
|
queryMorph('[slot=label]', html `<label-view slot="label">${value ? html `<span>${value}</span>` : null}</label-view>`, this);
|
|
921
1041
|
this.#renderSlotted([]);
|
|
922
1042
|
}
|
|
923
1043
|
#reflectSelectionOnButtons() {
|
|
924
|
-
debug(`${
|
|
1044
|
+
debug(`${PickerView.name} #reflectSelectionOnButtons`);
|
|
925
1045
|
self.requestAnimationFrame(() => {
|
|
926
1046
|
this.ariaCurrent = this.#selection;
|
|
927
1047
|
const groupMap = Dictionary.index(this.#lastIndexedRoot);
|
|
@@ -932,7 +1052,10 @@ export class PickerView extends FormAssociatedBase {
|
|
|
932
1052
|
el.querySelector('label-view[data-role="check"]')?.style.setProperty('visibility', el.getAttribute('value') === this.#selection ? 'visible' : 'hidden');
|
|
933
1053
|
// 2. details/optgroups
|
|
934
1054
|
for (const details of root.querySelectorAll('details[is="disclosure-group"]')) {
|
|
935
|
-
const hasSelectedDescendant =
|
|
1055
|
+
const hasSelectedDescendant = details
|
|
1056
|
+
.querySelectorAll('button[value]')
|
|
1057
|
+
.values()
|
|
1058
|
+
.some((btn) => btn.getAttribute('value') === this.#selection);
|
|
936
1059
|
details.querySelector(':scope>summary label-view[data-role="check"]')?.style.setProperty('visibility', hasSelectedDescendant ? 'visible' : 'hidden');
|
|
937
1060
|
}
|
|
938
1061
|
// 3. nav-link buttons — resolved by groupId, same map used for resync
|
|
@@ -964,7 +1087,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
964
1087
|
* Overwrite cvlabel with the label prop of the current(find[value === #selection]) option/dictentry
|
|
965
1088
|
*/
|
|
966
1089
|
#reflectSelectionOnCurrentValueLabel() {
|
|
967
|
-
debug(`${
|
|
1090
|
+
debug(`${PickerView.name} #reflectSelectionOnCurrentValueLabel`);
|
|
968
1091
|
self.requestAnimationFrame(() => {
|
|
969
1092
|
switch (this.pickerStyle) {
|
|
970
1093
|
case 'sheet':
|
|
@@ -1007,7 +1130,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1007
1130
|
});
|
|
1008
1131
|
}
|
|
1009
1132
|
#reflectTriggerHelp() {
|
|
1010
|
-
debug(`${
|
|
1133
|
+
debug(`${PickerView.name} #reflectTriggerHelp`);
|
|
1011
1134
|
let trigger;
|
|
1012
1135
|
switch (this.pickerStyle) {
|
|
1013
1136
|
case 'sheet':
|
|
@@ -1065,7 +1188,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1065
1188
|
message = kebabCase(key);
|
|
1066
1189
|
break;
|
|
1067
1190
|
}
|
|
1068
|
-
debug(`${
|
|
1191
|
+
debug(`${PickerView.name} ⚡️ validity-change`);
|
|
1069
1192
|
return this.#internals.setValidity(flags, this.#customValidity || message, anchor);
|
|
1070
1193
|
};
|
|
1071
1194
|
setCustomValidity = (message) => {
|
|
@@ -1092,4 +1215,3 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1092
1215
|
this.#sendValueToForm(false);
|
|
1093
1216
|
}
|
|
1094
1217
|
}
|
|
1095
|
-
_a = PickerView;
|