1
1
import { html , TemplateResult } from 'lit-element' ;
2
2
import { get , translate } from 'lit-translate' ;
3
+ import { ifDefined } from 'lit-html/directives/if-defined' ;
3
4
4
5
import '@material/mwc-checkbox' ;
5
6
import '@material/mwc-switch' ;
6
7
import '@material/mwc-formfield' ;
7
8
import '@material/mwc-list/mwc-list-item' ;
8
9
import '@material/mwc-list/mwc-check-list-item' ;
9
10
import '@material/mwc-icon' ;
11
+
10
12
import { Checkbox } from '@material/mwc-checkbox' ;
11
13
import { List } from '@material/mwc-list' ;
12
14
import { ListItemBase } from '@material/mwc-list/mwc-list-item-base' ;
15
+ import { SingleSelectedEvent } from '@material/mwc-list/mwc-list-foundation' ;
13
16
14
17
import '../../../wizard-textfield.js' ;
15
18
import '../../../filtered-list.js' ;
19
+
16
20
import {
17
21
pTypes104 ,
18
22
stationTypeOptions ,
@@ -35,15 +39,11 @@ import {
35
39
WizardInputElement ,
36
40
WizardMenuActor ,
37
41
} from '../../../foundation.js' ;
38
- import { createTypeRestrictionCheckbox } from '../../../wizards/connectedap.js' ;
39
- import { SingleSelectedEvent } from '@material/mwc-list/mwc-list-foundation' ;
40
- import { ifDefined } from 'lit-html/directives/if-defined' ;
41
- import { typeMaxLength } from '../../../wizards/foundation/p-types.js' ;
42
+ import { getTypeAttribute } from '../foundation/foundation.js' ;
42
43
import {
43
44
createRedundancyGroupWizard ,
44
45
editRedundancyGroupWizard ,
45
46
} from './redundancygroup.js' ;
46
- import { getTypeAttribute } from '../foundation/foundation' ;
47
47
48
48
interface AccessPointDescription {
49
49
element : Element ;
@@ -383,6 +383,21 @@ function createEditTextField(parent: Element, pType: string): TemplateResult {
383
383
pattern ="${ ifDefined ( typePattern [ pType ] ) } "
384
384
.maybeValue =${ parent . querySelector ( `Address > P[type="${ pType } "]` )
385
385
?. innerHTML ?? null }
386
- maxLength ="${ ifDefined ( typeMaxLength [ pType ] ) } "
387
386
> </ wizard-textfield > ` ;
388
387
}
388
+
389
+ function createTypeRestrictionCheckbox ( element : Element ) : TemplateResult {
390
+ return html `< mwc-formfield
391
+ label ="${ translate ( 'connectedap.wizard.addschemainsttype' ) } "
392
+ > < mwc-checkbox
393
+ id ="typeRestriction "
394
+ ?checked =${ hasTypeRestriction ( element ) }
395
+ > </ mwc-checkbox >
396
+ </ mwc-formfield > ` ;
397
+ }
398
+
399
+ function hasTypeRestriction ( element : Element ) : boolean {
400
+ return Array . from ( element . querySelectorAll ( 'Address > P' ) )
401
+ . filter ( p => isPublic ( p ) )
402
+ . some ( pType => pType . getAttribute ( 'xsi:type' ) ) ;
403
+ }
0 commit comments