Skip to content

Commit 09e7af5

Browse files
fix(templates/lnodetype-wizard): deselect optional DOTypes at LNode creation (#326)
This adds a toggle button next to DOTypes in the LNode create wizard under the template editor.
1 parent 13fbd18 commit 09e7af5

File tree

3 files changed

+92
-52
lines changed

3 files changed

+92
-52
lines changed

__snapshots__/LNodeType wizards.md

Lines changed: 82 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,10 +3482,12 @@
34823482
open=""
34833483
>
34843484
<div id="wizard-content">
3485-
<mwc-select
3485+
<wizard-select
3486+
disabled=""
34863487
fixedmenuposition=""
34873488
label="NamPlt"
34883489
naturalmenuwidth=""
3490+
nullable=""
34893491
>
34903492
<mwc-list-item
34913493
aria-disabled="false"
@@ -3505,8 +3507,8 @@
35053507
>
35063508
Dummy.XCBR1.NamPlt
35073509
</mwc-list-item>
3508-
</mwc-select>
3509-
<mwc-select
3510+
</wizard-select>
3511+
<wizard-select
35103512
fixedmenuposition=""
35113513
label="Beh"
35123514
naturalmenuwidth=""
@@ -3530,11 +3532,13 @@
35303532
>
35313533
Dummy.LLN0.Health
35323534
</mwc-list-item>
3533-
</mwc-select>
3534-
<mwc-select
3535+
</wizard-select>
3536+
<wizard-select
3537+
disabled=""
35353538
fixedmenuposition=""
35363539
label="Health"
35373540
naturalmenuwidth=""
3541+
nullable=""
35383542
>
35393543
<mwc-list-item
35403544
aria-disabled="false"
@@ -3554,11 +3558,13 @@
35543558
>
35553559
Dummy.LLN0.Beh
35563560
</mwc-list-item>
3557-
</mwc-select>
3558-
<mwc-select
3561+
</wizard-select>
3562+
<wizard-select
3563+
disabled=""
35593564
fixedmenuposition=""
35603565
label="Mir"
35613566
naturalmenuwidth=""
3567+
nullable=""
35623568
>
35633569
<mwc-list-item
35643570
aria-disabled="false"
@@ -3569,11 +3575,13 @@
35693575
>
35703576
Dummy.SPS
35713577
</mwc-list-item>
3572-
</mwc-select>
3573-
<mwc-select
3578+
</wizard-select>
3579+
<wizard-select
3580+
disabled=""
35743581
fixedmenuposition=""
35753582
label="Mod"
35763583
naturalmenuwidth=""
3584+
nullable=""
35773585
>
35783586
<mwc-list-item
35793587
aria-disabled="false"
@@ -3584,17 +3592,21 @@
35843592
>
35853593
Dummy.LLN0.Mod
35863594
</mwc-list-item>
3587-
</mwc-select>
3588-
<mwc-select
3595+
</wizard-select>
3596+
<wizard-select
3597+
disabled=""
35893598
fixedmenuposition=""
35903599
label="InRef"
35913600
naturalmenuwidth=""
3601+
nullable=""
35923602
>
3593-
</mwc-select>
3594-
<mwc-select
3603+
</wizard-select>
3604+
<wizard-select
3605+
disabled=""
35953606
fixedmenuposition=""
35963607
label="ClcExp"
35973608
naturalmenuwidth=""
3609+
nullable=""
35983610
>
35993611
<mwc-list-item
36003612
aria-disabled="false"
@@ -3605,11 +3617,13 @@
36053617
>
36063618
Dummy.SPS
36073619
</mwc-list-item>
3608-
</mwc-select>
3609-
<mwc-select
3620+
</wizard-select>
3621+
<wizard-select
3622+
disabled=""
36103623
fixedmenuposition=""
36113624
label="ClcNxtTmms"
36123625
naturalmenuwidth=""
3626+
nullable=""
36133627
>
36143628
<mwc-list-item
36153629
aria-disabled="false"
@@ -3620,11 +3634,13 @@
36203634
>
36213635
Dummy.XCBR1.OpCnt
36223636
</mwc-list-item>
3623-
</mwc-select>
3624-
<mwc-select
3637+
</wizard-select>
3638+
<wizard-select
3639+
disabled=""
36253640
fixedmenuposition=""
36263641
label="ClcStr"
36273642
naturalmenuwidth=""
3643+
nullable=""
36283644
>
36293645
<mwc-list-item
36303646
aria-disabled="false"
@@ -3644,65 +3660,85 @@
36443660
>
36453661
Dummy.XCBR1.BlkOpn
36463662
</mwc-list-item>
3647-
</mwc-select>
3648-
<mwc-select
3663+
</wizard-select>
3664+
<wizard-select
3665+
disabled=""
36493666
fixedmenuposition=""
36503667
label="ClcMth"
36513668
naturalmenuwidth=""
3669+
nullable=""
36523670
>
3653-
</mwc-select>
3654-
<mwc-select
3671+
</wizard-select>
3672+
<wizard-select
3673+
disabled=""
36553674
fixedmenuposition=""
36563675
label="ClcMod"
36573676
naturalmenuwidth=""
3677+
nullable=""
36583678
>
3659-
</mwc-select>
3660-
<mwc-select
3679+
</wizard-select>
3680+
<wizard-select
3681+
disabled=""
36613682
fixedmenuposition=""
36623683
label="ClcIntvTyp"
36633684
naturalmenuwidth=""
3685+
nullable=""
36643686
>
3665-
</mwc-select>
3666-
<mwc-select
3687+
</wizard-select>
3688+
<wizard-select
3689+
disabled=""
36673690
fixedmenuposition=""
36683691
label="ClcIntvPer"
36693692
naturalmenuwidth=""
3693+
nullable=""
36703694
>
3671-
</mwc-select>
3672-
<mwc-select
3695+
</wizard-select>
3696+
<wizard-select
3697+
disabled=""
36733698
fixedmenuposition=""
36743699
label="NumSubIntv"
36753700
naturalmenuwidth=""
3701+
nullable=""
36763702
>
3677-
</mwc-select>
3678-
<mwc-select
3703+
</wizard-select>
3704+
<wizard-select
3705+
disabled=""
36793706
fixedmenuposition=""
36803707
label="ClcRfTyp"
36813708
naturalmenuwidth=""
3709+
nullable=""
36823710
>
3683-
</mwc-select>
3684-
<mwc-select
3711+
</wizard-select>
3712+
<wizard-select
3713+
disabled=""
36853714
fixedmenuposition=""
36863715
label="ClcRfPer"
36873716
naturalmenuwidth=""
3717+
nullable=""
36883718
>
3689-
</mwc-select>
3690-
<mwc-select
3719+
</wizard-select>
3720+
<wizard-select
3721+
disabled=""
36913722
fixedmenuposition=""
36923723
label="ClcSrc"
36933724
naturalmenuwidth=""
3725+
nullable=""
36943726
>
3695-
</mwc-select>
3696-
<mwc-select
3727+
</wizard-select>
3728+
<wizard-select
3729+
disabled=""
36973730
fixedmenuposition=""
36983731
label="InSyn"
36993732
naturalmenuwidth=""
3733+
nullable=""
37003734
>
3701-
</mwc-select>
3702-
<mwc-select
3735+
</wizard-select>
3736+
<wizard-select
3737+
disabled=""
37033738
fixedmenuposition=""
37043739
label="Blk"
37053740
naturalmenuwidth=""
3741+
nullable=""
37063742
>
37073743
<mwc-list-item
37083744
aria-disabled="false"
@@ -3713,14 +3749,16 @@
37133749
>
37143750
Dummy.SPS
37153751
</mwc-list-item>
3716-
</mwc-select>
3717-
<mwc-select
3752+
</wizard-select>
3753+
<wizard-select
3754+
disabled=""
37183755
fixedmenuposition=""
37193756
label="BlkRef"
37203757
naturalmenuwidth=""
3758+
nullable=""
37213759
>
3722-
</mwc-select>
3723-
<mwc-select
3760+
</wizard-select>
3761+
<wizard-select
37243762
fixedmenuposition=""
37253763
label="EnaOpn"
37263764
naturalmenuwidth=""
@@ -3735,8 +3773,8 @@
37353773
>
37363774
Dummy.SPS
37373775
</mwc-list-item>
3738-
</mwc-select>
3739-
<mwc-select
3776+
</wizard-select>
3777+
<wizard-select
37403778
fixedmenuposition=""
37413779
label="EnaCls"
37423780
naturalmenuwidth=""
@@ -3751,7 +3789,7 @@
37513789
>
37523790
Dummy.SPS
37533791
</mwc-list-item>
3754-
</mwc-select>
3792+
</wizard-select>
37553793
</div>
37563794
<mwc-button
37573795
dialogaction="close"

src/editors/templates/lnodetype-wizard.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { List } from '@material/mwc-list';
3434
import { ListItem } from '@material/mwc-list/mwc-list-item';
3535
import { Select } from '@material/mwc-select';
3636
import { SingleSelectedEvent } from '@material/mwc-list/mwc-list-foundation';
37-
import { Switch } from '@material/mwc-switch';
37+
import { WizardSelect } from '../../wizard-select.js';
3838

3939
function updateDoAction(element: Element): WizardActor {
4040
return (inputs: WizardInput[]): EditorAction[] => {
@@ -255,8 +255,8 @@ function getAllDataObjects(nsd74: XMLDocument, base: string): Element[] {
255255
function createNewLNodeType(parent: Element, element: Element): WizardActor {
256256
return (_: WizardInput[], wizard: Element): EditorAction[] => {
257257
const selected = Array.from(
258-
wizard.shadowRoot!.querySelectorAll('mwc-select')
259-
).filter(select => select.value);
258+
wizard.shadowRoot!.querySelectorAll<WizardSelect>('wizard-select')
259+
).filter(select => select.maybeValue);
260260

261261
const actions: Create[] = [];
262262

@@ -325,17 +325,19 @@ function createLNodeTypeHelperWizard(
325325
.querySelectorAll(`DOType[cdc="${DO.getAttribute('type')}"]`)
326326
).sort(doComparator(name));
327327

328-
return html`<mwc-select
328+
return html`<wizard-select
329329
fixedMenuPosition
330330
naturalMenuWidth
331331
label="${name}"
332332
?required=${presCond === 'M'}
333+
?nullable=${presCond !== 'M'}
334+
.maybeValue=${null}
333335
>${validDOTypes.map(
334336
doType =>
335337
html`<mwc-list-item value="${doType.getAttribute('id')}"
336338
>${doType.getAttribute('id')}</mwc-list-item
337339
>`
338-
)}</mwc-select
340+
)}</wizard-select
339341
>`;
340342
}),
341343
},

test/integration/editors/templates/lnodetype-wizard.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ describe('LNodeType wizards', () => {
271271
)!;
272272

273273
beh = parent.wizardUI.shadowRoot!.querySelector<Select>(
274-
'mwc-select:nth-child(2)'
274+
'wizard-select:nth-child(2)'
275275
)!;
276276
enaOpn = parent.wizardUI.shadowRoot!.querySelector<Select>(
277-
'mwc-select:nth-child(21)'
277+
'wizard-select:nth-child(21)'
278278
)!;
279279
enaCls = parent.wizardUI.shadowRoot!.querySelector<Select>(
280-
'mwc-select:nth-child(22)'
280+
'wizard-select:nth-child(22)'
281281
)!;
282282

283283
ens = doc.querySelector('DOType[cdc="ENS"]')!;

0 commit comments

Comments
 (0)