@dso-toolkit/core 62.5.0 → 62.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dso-annotation-output_3.cjs.entry.js +21 -2
- package/dist/cjs/dso-annotation-output_3.cjs.entry.js.map +1 -1
- package/dist/cjs/dso-info_2.cjs.entry.js +6 -0
- package/dist/cjs/dso-info_2.cjs.entry.js.map +1 -1
- package/dist/cjs/dso-toolkit.cjs.js +1 -1
- package/dist/cjs/dso-viewer-grid.cjs.entry.js +1 -1
- package/dist/cjs/dso-viewer-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/dsot-document-component-demo.cjs.entry.js +72 -25
- package/dist/cjs/dsot-document-component-demo.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/document-component/document-component.css +29 -11
- package/dist/collection/components/document-component/document-component.js +65 -3
- package/dist/collection/components/document-component/document-component.js.map +1 -1
- package/dist/collection/components/document-component/document-component.models.js.map +1 -1
- package/dist/collection/components/document-component-demo/document-component.demo.js +74 -26
- package/dist/collection/components/document-component-demo/document-component.demo.js.map +1 -1
- package/dist/collection/components/selectable/selectable.js +7 -1
- package/dist/collection/components/selectable/selectable.js.map +1 -1
- package/dist/collection/components/viewer-grid/viewer-grid.css +4 -0
- package/dist/components/document-component.js +24 -4
- package/dist/components/document-component.js.map +1 -1
- package/dist/components/dso-viewer-grid.js +1 -1
- package/dist/components/dso-viewer-grid.js.map +1 -1
- package/dist/components/dsot-document-component-demo.js +74 -26
- package/dist/components/dsot-document-component-demo.js.map +1 -1
- package/dist/components/selectable.js +7 -1
- package/dist/components/selectable.js.map +1 -1
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/dso-toolkit.esm.js.map +1 -1
- package/dist/dso-toolkit/{p-7371aee1.entry.js → p-336aefb5.entry.js} +2 -2
- package/dist/dso-toolkit/p-336aefb5.entry.js.map +1 -0
- package/dist/dso-toolkit/{p-f3bd801e.entry.js → p-bf04808f.entry.js} +2 -2
- package/dist/dso-toolkit/{p-f3bd801e.entry.js.map → p-bf04808f.entry.js.map} +1 -1
- package/dist/dso-toolkit/p-c73d611f.entry.js +2 -0
- package/dist/dso-toolkit/p-c73d611f.entry.js.map +1 -0
- package/dist/dso-toolkit/p-d24073fe.entry.js +2 -0
- package/dist/dso-toolkit/p-d24073fe.entry.js.map +1 -0
- package/dist/esm/dso-annotation-output_3.entry.js +22 -3
- package/dist/esm/dso-annotation-output_3.entry.js.map +1 -1
- package/dist/esm/dso-info_2.entry.js +6 -0
- package/dist/esm/dso-info_2.entry.js.map +1 -1
- package/dist/esm/dso-toolkit.js +1 -1
- package/dist/esm/dso-viewer-grid.entry.js +1 -1
- package/dist/esm/dso-viewer-grid.entry.js.map +1 -1
- package/dist/esm/dsot-document-component-demo.entry.js +73 -26
- package/dist/esm/dsot-document-component-demo.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/document-component/document-component.d.ts +11 -2
- package/dist/types/components/document-component/document-component.models.d.ts +6 -0
- package/dist/types/components/document-component-demo/document-component.demo.d.ts +13 -6
- package/dist/types/components/selectable/selectable.d.ts +3 -2
- package/dist/types/components.d.ts +17 -4
- package/package.json +2 -2
- package/dist/dso-toolkit/p-2cd3e805.entry.js +0 -2
- package/dist/dso-toolkit/p-2cd3e805.entry.js.map +0 -1
- package/dist/dso-toolkit/p-7371aee1.entry.js.map +0 -1
- package/dist/dso-toolkit/p-f493248a.entry.js +0 -2
- package/dist/dso-toolkit/p-f493248a.entry.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Fragment } from "@stencil/core";
|
|
1
|
+
import { h, Fragment, Host } from "@stencil/core";
|
|
2
2
|
import { Heading } from "./document-component-heading";
|
|
3
3
|
const wijzigActieLabels = {
|
|
4
4
|
nieuweContainer: "Toegevoegd",
|
|
@@ -16,6 +16,13 @@ export class DocumentComponent {
|
|
|
16
16
|
this.handleOzonContentAnchorClick = (e) => {
|
|
17
17
|
this.dsoOzonContentAnchorClick.emit({ originalEvent: e, ozonContentAnchorClick: e.detail });
|
|
18
18
|
};
|
|
19
|
+
this.handleRecursiveToggleClick = (e) => {
|
|
20
|
+
this.dsoRecursiveToggle.emit({
|
|
21
|
+
originalEvent: e,
|
|
22
|
+
current: this.recursiveToggle,
|
|
23
|
+
next: this.recursiveToggle === true ? false : true,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
19
26
|
this.heading = "h2";
|
|
20
27
|
this.label = undefined;
|
|
21
28
|
this.nummer = undefined;
|
|
@@ -34,6 +41,7 @@ export class DocumentComponent {
|
|
|
34
41
|
this.type = undefined;
|
|
35
42
|
this.wijzigactie = undefined;
|
|
36
43
|
this.mark = undefined;
|
|
44
|
+
this.recursiveToggle = undefined;
|
|
37
45
|
}
|
|
38
46
|
get wijzigactieLabel() {
|
|
39
47
|
return this.wijzigactie && wijzigActieLabels[this.wijzigactie];
|
|
@@ -49,7 +57,17 @@ export class DocumentComponent {
|
|
|
49
57
|
}
|
|
50
58
|
render() {
|
|
51
59
|
const suffix = this.suffix();
|
|
52
|
-
|
|
60
|
+
const collapsible = !!((this.label || this.nummer || this.opschrift || this.alternativeTitle) &&
|
|
61
|
+
this.type !== "LID");
|
|
62
|
+
const showHeading = !!(this.wijzigactie ||
|
|
63
|
+
collapsible ||
|
|
64
|
+
this.label ||
|
|
65
|
+
this.nummer ||
|
|
66
|
+
this.opschrift ||
|
|
67
|
+
this.alternativeTitle ||
|
|
68
|
+
this.bevatOntwerpInformatie ||
|
|
69
|
+
this.annotated);
|
|
70
|
+
return (h(Host, { "not-collapsible": !collapsible }, showHeading && (h("div", { class: "heading-container" }, this.wijzigactie && h("span", { class: "wijzigactie-label" }, this.wijzigactieLabel, ":"), h("div", { class: "heading" }, h(Heading, { heading: this.heading, class: "heading-element", onClick: this.handleHeadingClick }, collapsible && (h("button", { type: "button", class: "toggle-button" }, h("dso-icon", { icon: this.open ? "chevron-down" : "chevron-right" }))), h("div", { class: "title" }, this.notApplicable && h("span", { class: "not-applicable" }, "Niet van toepassing:"), this.label || this.nummer || this.opschrift ? (h(Fragment, null, this.label && (h(Fragment, null, " ", h("dso-ozon-content", { content: this.label, onDsoAnchorClick: this.handleOzonContentAnchorClick, mark: this.mark && ((text) => { var _a; return (_a = this.mark) === null || _a === void 0 ? void 0 : _a.call(this, text, "label"); }), onDsoOzonContentMarkItemHighlight: (e) => this.dsoMarkItemHighlight.emit(Object.assign(Object.assign({}, e.detail), { source: "label" })), inline: true }))), this.nummer && (h(Fragment, null, " ", h("dso-ozon-content", { content: this.nummer, onDsoAnchorClick: this.handleOzonContentAnchorClick, mark: this.mark && ((text) => { var _a; return (_a = this.mark) === null || _a === void 0 ? void 0 : _a.call(this, text, "nummer"); }), onDsoOzonContentMarkItemHighlight: (e) => this.dsoMarkItemHighlight.emit(Object.assign(Object.assign({}, e.detail), { source: "nummer" })), inline: true }))), this.opschrift && (h(Fragment, null, " ", h("dso-ozon-content", { content: this.opschrift, onDsoAnchorClick: this.handleOzonContentAnchorClick, mark: this.mark && ((text) => { var _a; return (_a = this.mark) === null || _a === void 0 ? void 0 : _a.call(this, text, "opschrift"); }), onDsoOzonContentMarkItemHighlight: (e) => this.dsoMarkItemHighlight.emit(Object.assign(Object.assign({}, e.detail), { source: "opschrift" })), inline: true }))))) : (this.alternativeTitle), suffix && h("span", null, " - [", suffix, "]"))), this.recursiveToggle !== undefined && this.open && (h("button", { type: "button", class: "recursive-toggle", title: this.recursiveToggle === true ? "Verberg alles" : "Toon alles", onClick: this.handleRecursiveToggleClick }, h("dso-icon", { icon: this.recursiveToggle === true ? "eye" : "eye-slash" }))), this.genesteOntwerpInformatie && !this.open && !this.bevatOntwerpInformatie && (h(Fragment, null, h("dso-badge", { status: "warning", "aria-describedby": "nested-draft-description" }, "!"), h("dso-tooltip", { id: "nested-draft-description" }, "Er is een ontwerp beschikbaar."))), (this.bevatOntwerpInformatie || this.annotated) && (h("div", { class: "addons" }, this.bevatOntwerpInformatie && (h("dso-label", { status: "warning", compact: true }, "Ontwerp")), this.annotated && (h("dso-annotation-button", { identifier: "expandable", open: this.openAnnotation, onDsoClick: (e) => this.dsoAnnotationToggle.emit({ originalEvent: e }) }))))))), h("div", { class: "annotation-container" }, h("slot", { name: "annotation" })), this.open && (this.inhoud || this.gereserveerd || this.vervallen) && (h("div", { class: "content" }, this.gereserveerd && (h("dso-alert", { status: "info" }, "Dit onderdeel is gereserveerd voor toekomstige toevoeging.")), this.vervallen && h("dso-alert", { status: "info" }, "Dit onderdeel is vervallen."), this.inhoud && (h("dso-ozon-content", { content: this.inhoud, onDsoAnchorClick: this.handleOzonContentAnchorClick, mark: this.mark && ((text) => { var _a; return (_a = this.mark) === null || _a === void 0 ? void 0 : _a.call(this, text, "inhoud"); }), onDsoOzonContentMarkItemHighlight: (e) => this.dsoMarkItemHighlight.emit(Object.assign(Object.assign({}, e.detail), { source: "inhoud" })) })))), h("div", { class: "children-container" }, h("slot", null))));
|
|
53
71
|
}
|
|
54
72
|
static get is() { return "dso-document-component"; }
|
|
55
73
|
static get encapsulation() { return "shadow"; }
|
|
@@ -412,13 +430,57 @@ export class DocumentComponent {
|
|
|
412
430
|
"optional": true,
|
|
413
431
|
"docs": {
|
|
414
432
|
"tags": [],
|
|
415
|
-
"text": "
|
|
433
|
+
"text": "To mark text."
|
|
416
434
|
}
|
|
435
|
+
},
|
|
436
|
+
"recursiveToggle": {
|
|
437
|
+
"type": "any",
|
|
438
|
+
"mutable": false,
|
|
439
|
+
"complexType": {
|
|
440
|
+
"original": "DocumentComponentRecursiveToggleState",
|
|
441
|
+
"resolved": "\"indeterminate\" | boolean | undefined",
|
|
442
|
+
"references": {
|
|
443
|
+
"DocumentComponentRecursiveToggleState": {
|
|
444
|
+
"location": "import",
|
|
445
|
+
"path": "./document-component.models",
|
|
446
|
+
"id": "src/components/document-component/document-component.models.ts::DocumentComponentRecursiveToggleState"
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"required": false,
|
|
451
|
+
"optional": false,
|
|
452
|
+
"docs": {
|
|
453
|
+
"tags": [],
|
|
454
|
+
"text": "Shows the recursive toggle button. When the user activates this button the event `dsoRecursiveToggle` is emitted."
|
|
455
|
+
},
|
|
456
|
+
"attribute": "recursive-toggle",
|
|
457
|
+
"reflect": false
|
|
417
458
|
}
|
|
418
459
|
};
|
|
419
460
|
}
|
|
420
461
|
static get events() {
|
|
421
462
|
return [{
|
|
463
|
+
"method": "dsoRecursiveToggle",
|
|
464
|
+
"name": "dsoRecursiveToggle",
|
|
465
|
+
"bubbles": false,
|
|
466
|
+
"cancelable": true,
|
|
467
|
+
"composed": true,
|
|
468
|
+
"docs": {
|
|
469
|
+
"tags": [],
|
|
470
|
+
"text": "Emitted when the user activates the recursive toggle."
|
|
471
|
+
},
|
|
472
|
+
"complexType": {
|
|
473
|
+
"original": "DocumentComponentRecursiveToggleEvent",
|
|
474
|
+
"resolved": "DocumentComponentRecursiveToggleEvent",
|
|
475
|
+
"references": {
|
|
476
|
+
"DocumentComponentRecursiveToggleEvent": {
|
|
477
|
+
"location": "import",
|
|
478
|
+
"path": "./document-component.models",
|
|
479
|
+
"id": "src/components/document-component/document-component.models.ts::DocumentComponentRecursiveToggleEvent"
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}, {
|
|
422
484
|
"method": "dsoOpenToggle",
|
|
423
485
|
"name": "dsoOpenToggle",
|
|
424
486
|
"bubbles": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-component.js","sourceRoot":"","sources":["../../../src/components/document-component/document-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAsB,KAAK,EAAgB,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAWtG,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAIvD,MAAM,iBAAiB,G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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { h, Component, ComponentInterface, Event, EventEmitter, Fragment, Prop } from \"@stencil/core\";\r\nimport {\r\n DocumentComponentOpenToggleEvent,\r\n DocumentComponentToggleAnnotationEvent,\r\n DocumentComponentOzonContentAnchorClickEvent,\r\n DocumentComponentWijzigactie,\r\n DocumentComponentInputType,\r\n DocumentComponentMarkFunction,\r\n DocumentComponentMarkItemHighlightEvent,\r\n} from \"./document-component.models\";\r\nimport { OzonContentAnchorClickEvent } from \"../ozon-content/ozon-content.interfaces\";\r\nimport { Heading } from \"./document-component-heading\";\r\n\r\nimport { DsoOzonContentCustomEvent } from \"../../components\";\r\n\r\nconst wijzigActieLabels: { [wijzigActie in DocumentComponentWijzigactie]: string } = {\r\n nieuweContainer: \"Toegevoegd\",\r\n verwijder: \"Verwijderd\",\r\n verwijderContainer: \"Verwijderd\",\r\n voegtoe: \"Toegevoegd\",\r\n};\r\n\r\n@Component({\r\n tag: \"dso-document-component\",\r\n styleUrl: \"document-component.scss\",\r\n shadow: true,\r\n})\r\nexport class DocumentComponent implements ComponentInterface {\r\n /**\r\n * The heading element to use.\r\n */\r\n @Prop()\r\n heading: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" = \"h2\";\r\n\r\n /**\r\n * The Label XML.\r\n */\r\n @Prop()\r\n label?: DocumentComponentInputType;\r\n\r\n /**\r\n * The Nummer XML.\r\n */\r\n @Prop()\r\n nummer?: DocumentComponentInputType;\r\n\r\n /**\r\n * The Opschrift XML.\r\n */\r\n @Prop()\r\n opschrift?: DocumentComponentInputType;\r\n\r\n /**\r\n * The Inhoud XML.\r\n */\r\n @Prop()\r\n inhoud?: DocumentComponentInputType;\r\n\r\n /**\r\n * This boolean attribute indicates whether the children are visible.\r\n */\r\n @Prop({ reflect: true })\r\n open = false;\r\n\r\n /**\r\n * Marks this Document Component as belonging to an active filter.\r\n */\r\n @Prop({ reflect: true })\r\n filtered = false;\r\n\r\n /**\r\n * Marks this Document Component as not-applicable.\r\n */\r\n @Prop({ reflect: true })\r\n notApplicable = false;\r\n\r\n /**\r\n * When a child Document Component has a status \"Draft\".\r\n */\r\n @Prop({ reflect: true })\r\n genesteOntwerpInformatie = false;\r\n\r\n /**\r\n * Marks as draft.\r\n */\r\n @Prop({ reflect: true })\r\n bevatOntwerpInformatie = false;\r\n\r\n /**\r\n * Enables annotations.\r\n */\r\n @Prop({ reflect: true })\r\n annotated = false;\r\n\r\n /**\r\n * Marks Document Component as reserved.\r\n */\r\n @Prop()\r\n gereserveerd = false;\r\n\r\n /**\r\n * Marks the Document Component as expired.\r\n */\r\n @Prop()\r\n vervallen = false;\r\n\r\n /**\r\n * When the Annotation Output is opened, set this to true.\r\n */\r\n @Prop()\r\n openAnnotation = false;\r\n\r\n /**\r\n * An alternative title to show when there is nothing to create a title.\r\n */\r\n @Prop()\r\n alternativeTitle?: string;\r\n\r\n /**\r\n * Type of Document Component.\r\n */\r\n @Prop({ reflect: true })\r\n type?: string;\r\n\r\n /**\r\n * The wijzigactie as in STOP.\r\n */\r\n @Prop({ reflect: true })\r\n wijzigactie?: DocumentComponentWijzigactie;\r\n\r\n /**\r\n * Voor het markeren in content.\r\n */\r\n @Prop()\r\n mark?: DocumentComponentMarkFunction;\r\n\r\n /**\r\n * Emitted when the user activates the toggle.\r\n */\r\n @Event({ bubbles: false })\r\n dsoOpenToggle!: EventEmitter<DocumentComponentOpenToggleEvent>;\r\n\r\n /**\r\n * Emitted when the user actives intRef or intIoRef anchors in Ozon Content\r\n */\r\n @Event({ bubbles: false })\r\n dsoOzonContentAnchorClick!: EventEmitter<DocumentComponentOzonContentAnchorClickEvent>;\r\n\r\n /**\r\n * Emitted when the user activates the annotation button.\r\n */\r\n @Event({ bubbles: false })\r\n dsoAnnotationToggle!: EventEmitter<DocumentComponentToggleAnnotationEvent>;\r\n\r\n /**\r\n * Emitted each time a marked item gets highlighted.\r\n */\r\n @Event({ bubbles: false })\r\n dsoMarkItemHighlight!: EventEmitter<DocumentComponentMarkItemHighlightEvent>;\r\n\r\n private get wijzigactieLabel(): string | undefined {\r\n return this.wijzigactie && wijzigActieLabels[this.wijzigactie];\r\n }\r\n\r\n private handleHeadingClick = (e: MouseEvent) => {\r\n if (this.type !== \"LID\") {\r\n this.dsoOpenToggle.emit({ originalEvent: e, open: !this.open });\r\n }\r\n };\r\n\r\n private suffix(): string | undefined {\r\n if (this.vervallen) {\r\n return \"vervallen\";\r\n }\r\n\r\n if (this.gereserveerd) {\r\n return \"gereserveerd\";\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n private handleOzonContentAnchorClick = (e: DsoOzonContentCustomEvent<OzonContentAnchorClickEvent>) => {\r\n this.dsoOzonContentAnchorClick.emit({ originalEvent: e, ozonContentAnchorClick: e.detail });\r\n };\r\n\r\n render() {\r\n const suffix = this.suffix();\r\n\r\n return (\r\n <>\r\n <div class=\"heading-container\">\r\n {this.wijzigactie && <span class=\"wijzigactie-label\">{this.wijzigactieLabel}:</span>}\r\n <div class=\"heading\">\r\n <Heading heading={this.heading} class=\"heading-element\" onClick={this.handleHeadingClick}>\r\n {this.type !== \"LID\" && (\r\n <button type=\"button\" class=\"toggle-button\">\r\n <dso-icon icon={this.open ? \"chevron-down\" : \"chevron-right\"}></dso-icon>\r\n </button>\r\n )}\r\n <div class=\"title\">\r\n {this.notApplicable && <span class=\"not-applicable\">Niet van toepassing:</span>}\r\n {this.label || this.nummer || this.opschrift ? (\r\n <>\r\n {this.label && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content\r\n content={this.label}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"label\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"label\" })\r\n }\r\n inline\r\n ></dso-ozon-content>\r\n </>\r\n )}\r\n {this.nummer && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content\r\n content={this.nummer}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"nummer\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"nummer\" })\r\n }\r\n inline\r\n ></dso-ozon-content>\r\n </>\r\n )}\r\n {this.opschrift && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content\r\n content={this.opschrift}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"opschrift\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"opschrift\" })\r\n }\r\n inline\r\n ></dso-ozon-content>\r\n </>\r\n )}\r\n </>\r\n ) : (\r\n this.alternativeTitle\r\n )}\r\n {suffix && <span> - [{suffix}]</span>}\r\n </div>\r\n </Heading>\r\n {this.genesteOntwerpInformatie && !this.open && !this.bevatOntwerpInformatie && (\r\n <>\r\n <dso-badge status=\"warning\" aria-describedby=\"nested-draft-description\">\r\n !\r\n </dso-badge>\r\n <dso-tooltip id=\"nested-draft-description\">Er is een ontwerp beschikbaar.</dso-tooltip>\r\n </>\r\n )}\r\n {(this.bevatOntwerpInformatie || this.annotated) && (\r\n <div class=\"addons\">\r\n {this.bevatOntwerpInformatie && (\r\n <dso-label status=\"warning\" compact>\r\n Ontwerp\r\n </dso-label>\r\n )}\r\n {this.annotated && (\r\n <dso-annotation-button\r\n identifier=\"expandable\"\r\n open={this.openAnnotation}\r\n onDsoClick={(e) => this.dsoAnnotationToggle.emit({ originalEvent: e })}\r\n ></dso-annotation-button>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n <slot name=\"annotation\" />\r\n {this.open && (this.inhoud || this.gereserveerd || this.vervallen) && (\r\n <div class=\"content\">\r\n {this.gereserveerd && (\r\n <dso-alert status=\"info\">Dit onderdeel is gereserveerd voor toekomstige toevoeging.</dso-alert>\r\n )}\r\n {this.vervallen && <dso-alert status=\"info\">Dit onderdeel is vervallen.</dso-alert>}\r\n {this.inhoud && (\r\n <dso-ozon-content\r\n content={this.inhoud}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"inhoud\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"inhoud\" })\r\n }\r\n ></dso-ozon-content>\r\n )}\r\n </div>\r\n )}\r\n <slot />\r\n </>\r\n );\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"document-component.js","sourceRoot":"","sources":["../../../src/components/document-component/document-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAsB,KAAK,EAAgB,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAa5G,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAIvD,MAAM,iBAAiB,GAA8D;EACnF,eAAe,EAAE,YAAY;EAC7B,SAAS,EAAE,YAAY;EACvB,kBAAkB,EAAE,YAAY;EAChC,OAAO,EAAE,YAAY;CACtB,CAAC;AAOF,MAAM,OAAO,iBAAiB;;IAqJpB,uBAAkB,GAAG,CAAC,CAAa,EAAE,EAAE;MAC7C,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE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;;;;;;;;CACF","sourcesContent":["import { h, Component, ComponentInterface, Event, EventEmitter, Fragment, Prop, Host } from \"@stencil/core\";\r\nimport {\r\n DocumentComponentOpenToggleEvent,\r\n DocumentComponentToggleAnnotationEvent,\r\n DocumentComponentOzonContentAnchorClickEvent,\r\n DocumentComponentWijzigactie,\r\n DocumentComponentInputType,\r\n DocumentComponentMarkFunction,\r\n DocumentComponentMarkItemHighlightEvent,\r\n DocumentComponentRecursiveToggleEvent,\r\n DocumentComponentRecursiveToggleState,\r\n} from \"./document-component.models\";\r\nimport { OzonContentAnchorClickEvent } from \"../ozon-content/ozon-content.interfaces\";\r\nimport { Heading } from \"./document-component-heading\";\r\n\r\nimport { DsoOzonContentCustomEvent } from \"../../components\";\r\n\r\nconst wijzigActieLabels: { [wijzigActie in DocumentComponentWijzigactie]: string } = {\r\n nieuweContainer: \"Toegevoegd\",\r\n verwijder: \"Verwijderd\",\r\n verwijderContainer: \"Verwijderd\",\r\n voegtoe: \"Toegevoegd\",\r\n};\r\n\r\n@Component({\r\n tag: \"dso-document-component\",\r\n styleUrl: \"document-component.scss\",\r\n shadow: true,\r\n})\r\nexport class DocumentComponent implements ComponentInterface {\r\n /**\r\n * The heading element to use.\r\n */\r\n @Prop()\r\n heading: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" = \"h2\";\r\n\r\n /**\r\n * The Label XML.\r\n */\r\n @Prop()\r\n label?: DocumentComponentInputType;\r\n\r\n /**\r\n * The Nummer XML.\r\n */\r\n @Prop()\r\n nummer?: DocumentComponentInputType;\r\n\r\n /**\r\n * The Opschrift XML.\r\n */\r\n @Prop()\r\n opschrift?: DocumentComponentInputType;\r\n\r\n /**\r\n * The Inhoud XML.\r\n */\r\n @Prop()\r\n inhoud?: DocumentComponentInputType;\r\n\r\n /**\r\n * This boolean attribute indicates whether the children are visible.\r\n */\r\n @Prop({ reflect: true })\r\n open = false;\r\n\r\n /**\r\n * Marks this Document Component as belonging to an active filter.\r\n */\r\n @Prop({ reflect: true })\r\n filtered = false;\r\n\r\n /**\r\n * Marks this Document Component as not-applicable.\r\n */\r\n @Prop({ reflect: true })\r\n notApplicable = false;\r\n\r\n /**\r\n * When a child Document Component has a status \"Draft\".\r\n */\r\n @Prop({ reflect: true })\r\n genesteOntwerpInformatie = false;\r\n\r\n /**\r\n * Marks as draft.\r\n */\r\n @Prop({ reflect: true })\r\n bevatOntwerpInformatie = false;\r\n\r\n /**\r\n * Enables annotations.\r\n */\r\n @Prop({ reflect: true })\r\n annotated = false;\r\n\r\n /**\r\n * Marks Document Component as reserved.\r\n */\r\n @Prop()\r\n gereserveerd = false;\r\n\r\n /**\r\n * Marks the Document Component as expired.\r\n */\r\n @Prop()\r\n vervallen = false;\r\n\r\n /**\r\n * When the Annotation Output is opened, set this to true.\r\n */\r\n @Prop()\r\n openAnnotation = false;\r\n\r\n /**\r\n * An alternative title to show when there is nothing to create a title.\r\n */\r\n @Prop()\r\n alternativeTitle?: string;\r\n\r\n /**\r\n * Type of Document Component.\r\n */\r\n @Prop({ reflect: true })\r\n type?: string;\r\n\r\n /**\r\n * The wijzigactie as in STOP.\r\n */\r\n @Prop({ reflect: true })\r\n wijzigactie?: DocumentComponentWijzigactie;\r\n\r\n /**\r\n * To mark text.\r\n */\r\n @Prop()\r\n mark?: DocumentComponentMarkFunction;\r\n\r\n /**\r\n * Shows the recursive toggle button. When the user activates this button the event `dsoRecursiveToggle` is emitted.\r\n */\r\n @Prop()\r\n recursiveToggle: DocumentComponentRecursiveToggleState;\r\n\r\n /**\r\n * Emitted when the user activates the recursive toggle.\r\n */\r\n @Event({ bubbles: false })\r\n dsoRecursiveToggle!: EventEmitter<DocumentComponentRecursiveToggleEvent>;\r\n\r\n /**\r\n * Emitted when the user activates the toggle.\r\n */\r\n @Event({ bubbles: false })\r\n dsoOpenToggle!: EventEmitter<DocumentComponentOpenToggleEvent>;\r\n\r\n /**\r\n * Emitted when the user actives intRef or intIoRef anchors in Ozon Content\r\n */\r\n @Event({ bubbles: false })\r\n dsoOzonContentAnchorClick!: EventEmitter<DocumentComponentOzonContentAnchorClickEvent>;\r\n\r\n /**\r\n * Emitted when the user activates the annotation button.\r\n */\r\n @Event({ bubbles: false })\r\n dsoAnnotationToggle!: EventEmitter<DocumentComponentToggleAnnotationEvent>;\r\n\r\n /**\r\n * Emitted each time a marked item gets highlighted.\r\n */\r\n @Event({ bubbles: false })\r\n dsoMarkItemHighlight!: EventEmitter<DocumentComponentMarkItemHighlightEvent>;\r\n\r\n private get wijzigactieLabel(): string | undefined {\r\n return this.wijzigactie && wijzigActieLabels[this.wijzigactie];\r\n }\r\n\r\n private handleHeadingClick = (e: MouseEvent) => {\r\n if (this.type !== \"LID\") {\r\n this.dsoOpenToggle.emit({ originalEvent: e, open: !this.open });\r\n }\r\n };\r\n\r\n private suffix(): string | undefined {\r\n if (this.vervallen) {\r\n return \"vervallen\";\r\n }\r\n\r\n if (this.gereserveerd) {\r\n return \"gereserveerd\";\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n private handleOzonContentAnchorClick = (e: DsoOzonContentCustomEvent<OzonContentAnchorClickEvent>) => {\r\n this.dsoOzonContentAnchorClick.emit({ originalEvent: e, ozonContentAnchorClick: e.detail });\r\n };\r\n\r\n private handleRecursiveToggleClick = (e: MouseEvent) => {\r\n this.dsoRecursiveToggle.emit({\r\n originalEvent: e,\r\n current: this.recursiveToggle,\r\n next: this.recursiveToggle === true ? false : true,\r\n });\r\n };\r\n\r\n render() {\r\n const suffix = this.suffix();\r\n const collapsible = !!(\r\n (this.label || this.nummer || this.opschrift || this.alternativeTitle) &&\r\n this.type !== \"LID\"\r\n );\r\n const showHeading = !!(\r\n this.wijzigactie ||\r\n collapsible ||\r\n this.label ||\r\n this.nummer ||\r\n this.opschrift ||\r\n this.alternativeTitle ||\r\n this.bevatOntwerpInformatie ||\r\n this.annotated\r\n );\r\n\r\n return (\r\n <Host not-collapsible={!collapsible}>\r\n {showHeading && (\r\n <div class=\"heading-container\">\r\n {this.wijzigactie && <span class=\"wijzigactie-label\">{this.wijzigactieLabel}:</span>}\r\n <div class=\"heading\">\r\n <Heading heading={this.heading} class=\"heading-element\" onClick={this.handleHeadingClick}>\r\n {collapsible && (\r\n <button type=\"button\" class=\"toggle-button\">\r\n <dso-icon icon={this.open ? \"chevron-down\" : \"chevron-right\"}></dso-icon>\r\n </button>\r\n )}\r\n <div class=\"title\">\r\n {this.notApplicable && <span class=\"not-applicable\">Niet van toepassing:</span>}\r\n {this.label || this.nummer || this.opschrift ? (\r\n <>\r\n {this.label && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content\r\n content={this.label}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"label\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"label\" })\r\n }\r\n inline\r\n ></dso-ozon-content>\r\n </>\r\n )}\r\n {this.nummer && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content\r\n content={this.nummer}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"nummer\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"nummer\" })\r\n }\r\n inline\r\n ></dso-ozon-content>\r\n </>\r\n )}\r\n {this.opschrift && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content\r\n content={this.opschrift}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"opschrift\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"opschrift\" })\r\n }\r\n inline\r\n ></dso-ozon-content>\r\n </>\r\n )}\r\n </>\r\n ) : (\r\n this.alternativeTitle\r\n )}\r\n {suffix && <span> - [{suffix}]</span>}\r\n </div>\r\n </Heading>\r\n {this.recursiveToggle !== undefined && this.open && (\r\n <button\r\n type=\"button\"\r\n class=\"recursive-toggle\"\r\n title={this.recursiveToggle === true ? \"Verberg alles\" : \"Toon alles\"}\r\n onClick={this.handleRecursiveToggleClick}\r\n >\r\n <dso-icon icon={this.recursiveToggle === true ? \"eye\" : \"eye-slash\"} />\r\n </button>\r\n )}\r\n {this.genesteOntwerpInformatie && !this.open && !this.bevatOntwerpInformatie && (\r\n <>\r\n <dso-badge status=\"warning\" aria-describedby=\"nested-draft-description\">\r\n !\r\n </dso-badge>\r\n <dso-tooltip id=\"nested-draft-description\">Er is een ontwerp beschikbaar.</dso-tooltip>\r\n </>\r\n )}\r\n {(this.bevatOntwerpInformatie || this.annotated) && (\r\n <div class=\"addons\">\r\n {this.bevatOntwerpInformatie && (\r\n <dso-label status=\"warning\" compact>\r\n Ontwerp\r\n </dso-label>\r\n )}\r\n {this.annotated && (\r\n <dso-annotation-button\r\n identifier=\"expandable\"\r\n open={this.openAnnotation}\r\n onDsoClick={(e) => this.dsoAnnotationToggle.emit({ originalEvent: e })}\r\n ></dso-annotation-button>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n )}\r\n <div class=\"annotation-container\">\r\n <slot name=\"annotation\" />\r\n </div>\r\n {this.open && (this.inhoud || this.gereserveerd || this.vervallen) && (\r\n <div class=\"content\">\r\n {this.gereserveerd && (\r\n <dso-alert status=\"info\">Dit onderdeel is gereserveerd voor toekomstige toevoeging.</dso-alert>\r\n )}\r\n {this.vervallen && <dso-alert status=\"info\">Dit onderdeel is vervallen.</dso-alert>}\r\n {this.inhoud && (\r\n <dso-ozon-content\r\n content={this.inhoud}\r\n onDsoAnchorClick={this.handleOzonContentAnchorClick}\r\n mark={this.mark && ((text) => this.mark?.(text, \"inhoud\"))}\r\n onDsoOzonContentMarkItemHighlight={(e) =>\r\n this.dsoMarkItemHighlight.emit({ ...e.detail, source: \"inhoud\" })\r\n }\r\n />\r\n )}\r\n </div>\r\n )}\r\n <div class=\"children-container\">\r\n <slot />\r\n </div>\r\n </Host>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-component.models.js","sourceRoot":"","sources":["../../../src/components/document-component/document-component.models.ts"],"names":[],"mappings":"","sourcesContent":["import { DsoOzonContentCustomEvent } from \"../../components\";\r\nimport { OzonContentAnchorClickEvent, OzonContentText } from \"../ozon-content/ozon-content.interfaces\";\r\n\r\nexport interface DocumentComponentOpenToggleEvent {\r\n originalEvent: Event;\r\n open: boolean;\r\n}\r\n\r\nexport interface DocumentComponentToggleAnnotationEvent {\r\n originalEvent: Event;\r\n}\r\n\r\nexport type DocumentComponentWijzigactie = \"voegtoe\" | \"verwijder\" | \"nieuweContainer\" | \"verwijderContainer\";\r\n\r\nexport interface DocumentComponentOzonContentAnchorClickEvent {\r\n originalEvent: DsoOzonContentCustomEvent<OzonContentAnchorClickEvent>;\r\n ozonContentAnchorClick: OzonContentAnchorClickEvent;\r\n}\r\n\r\nexport type DocumentComponentInputType = XMLDocument | string;\r\n\r\nexport type DocumentComponentSource = \"label\" | \"nummer\" | \"opschrift\" | \"inhoud\";\r\n\r\nexport type DocumentComponentMarkFunction = (text: string, source: DocumentComponentSource) => OzonContentText[];\r\n\r\nexport interface DocumentComponentMarkItemHighlightEvent {\r\n source: DocumentComponentSource;\r\n text: string;\r\n elementRef: HTMLElement;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"document-component.models.js","sourceRoot":"","sources":["../../../src/components/document-component/document-component.models.ts"],"names":[],"mappings":"","sourcesContent":["import { DsoOzonContentCustomEvent } from \"../../components\";\r\nimport { OzonContentAnchorClickEvent, OzonContentText } from \"../ozon-content/ozon-content.interfaces\";\r\n\r\nexport interface DocumentComponentOpenToggleEvent {\r\n originalEvent: Event;\r\n open: boolean;\r\n}\r\n\r\nexport interface DocumentComponentToggleAnnotationEvent {\r\n originalEvent: Event;\r\n}\r\n\r\nexport type DocumentComponentWijzigactie = \"voegtoe\" | \"verwijder\" | \"nieuweContainer\" | \"verwijderContainer\";\r\n\r\nexport interface DocumentComponentOzonContentAnchorClickEvent {\r\n originalEvent: DsoOzonContentCustomEvent<OzonContentAnchorClickEvent>;\r\n ozonContentAnchorClick: OzonContentAnchorClickEvent;\r\n}\r\n\r\nexport type DocumentComponentInputType = XMLDocument | string;\r\n\r\nexport type DocumentComponentSource = \"label\" | \"nummer\" | \"opschrift\" | \"inhoud\";\r\n\r\nexport type DocumentComponentMarkFunction = (text: string, source: DocumentComponentSource) => OzonContentText[];\r\n\r\nexport interface DocumentComponentMarkItemHighlightEvent {\r\n source: DocumentComponentSource;\r\n text: string;\r\n elementRef: HTMLElement;\r\n}\r\n\r\nexport type DocumentComponentRecursiveToggleState = undefined | boolean | \"indeterminate\";\r\n\r\nexport interface DocumentComponentRecursiveToggleEvent {\r\n originalEvent: MouseEvent;\r\n current: DocumentComponentRecursiveToggleState;\r\n next: boolean;\r\n}\r\n"]}
|
|
@@ -1,19 +1,37 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
1
|
+
import { h, Fragment } from "@stencil/core";
|
|
2
2
|
import sampleSize from "lodash.samplesize";
|
|
3
3
|
import random from "lodash.random";
|
|
4
4
|
export class DocumentComponentDemo {
|
|
5
5
|
constructor() {
|
|
6
|
+
this.handleRecursiveToggle = (documentComponent, detail) => {
|
|
7
|
+
const embeddedDocuments = this.getEmbeddedDocumentComponents(documentComponent);
|
|
8
|
+
if (!embeddedDocuments) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
for (const d of embeddedDocuments.documentComponents) {
|
|
12
|
+
this.handleOpenToggle(d, detail.next);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
6
15
|
this.DocumentComponent = ({ path }) => {
|
|
7
|
-
var _a;
|
|
8
16
|
const documentComponent = path.at(-1);
|
|
17
|
+
if (!documentComponent) {
|
|
18
|
+
return h(Fragment, null);
|
|
19
|
+
}
|
|
9
20
|
const { DocumentComponent } = this;
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
const embeddedDocuments = this.getEmbeddedDocumentComponents(documentComponent);
|
|
22
|
+
return (h("dso-document-component", { annotated: documentComponent.volgordeNummer % 4 === 2, bevatOntwerpInformatie: !!documentComponent.bevatOntwerpInformatie, filtered: this.isOpen(documentComponent)
|
|
23
|
+
? this.isFiltered(documentComponent)
|
|
24
|
+
: this.hasFilteredChildren(documentComponent), genesteOntwerpInformatie: this.hasNestedDraft(documentComponent), gereserveerd: documentComponent.gereserveerd, heading: "h2", inhoud: documentComponent.inhoud, label: documentComponent.labelXml, openAnnotation: this.isOpenedAnnotation(documentComponent), notApplicable: this.isNotApplicable(documentComponent) || path.some((p) => this.isNotApplicable(p)), nummer: documentComponent.nummerXml, onDsoAnnotationToggle: () => this.handleAnnotationToggle(documentComponent), onDsoOpenToggle: () => this.handleOpenToggle(documentComponent), onDsoOzonContentAnchorClick: (e) => this.handleOzonContentAnchorClick(e), open: this.isOpen(documentComponent), opschrift: documentComponent.opschrift, type: documentComponent.type, vervallen: documentComponent.vervallen, wijzigactie: documentComponent.wijzigactie, recursiveToggle: this.recursiveToggleState(documentComponent), onDsoRecursiveToggle: (e) => this.handleRecursiveToggle(documentComponent, e.detail) }, this.isOpenedAnnotation(documentComponent) && (h("dso-annotation-output", { slot: "annotation", open: true, identifier: "test", onDsoClose: () => this.handleAnnotationToggle(documentComponent) }, h("span", { slot: "title" }, "Annotaties"), h("dso-slide-toggle", { checked: this.isCheckedSlideToggle(documentComponent), onDsoActiveChange: () => this.handleSelectableChange(documentComponent) }, "Delfzijl"))), this.showContent(documentComponent) && (embeddedDocuments === null || embeddedDocuments === void 0 ? void 0 : embeddedDocuments.documentComponents.length) && (h("ul", null, embeddedDocuments.documentComponents.map((d) => (h("li", { key: d.documentTechnischId }, h(DocumentComponent, { path: [...path, d] }))))))));
|
|
25
|
+
};
|
|
26
|
+
this.MenuButton = ({ documentComponent }) => {
|
|
27
|
+
const { labelXml, nummerXml, type } = documentComponent;
|
|
28
|
+
return (h("button", { type: "button", onClick: () => (this.document = documentComponent) }, !labelXml && !nummerXml ? (h("span", null, h("i", null, type))) : (h(Fragment, null, labelXml && (h(Fragment, null, h("dso-ozon-content", { content: labelXml, inline: true }))), nummerXml && (h(Fragment, null, " ", h("dso-ozon-content", { content: nummerXml, inline: true })))))));
|
|
12
29
|
};
|
|
13
30
|
this.showCanvas = false;
|
|
14
31
|
this.jsonFile = undefined;
|
|
15
32
|
this.openDefault = false;
|
|
16
33
|
this.response = undefined;
|
|
34
|
+
this.document = undefined;
|
|
17
35
|
this.openOrClosed = [];
|
|
18
36
|
this.openedAnnotation = [];
|
|
19
37
|
this.filtered = [];
|
|
@@ -31,13 +49,25 @@ export class DocumentComponentDemo {
|
|
|
31
49
|
async componentDidLoad() {
|
|
32
50
|
await this.loadData();
|
|
33
51
|
}
|
|
34
|
-
getEmbeddedDocumentComponents(
|
|
35
|
-
var _a, _b
|
|
36
|
-
|
|
52
|
+
getEmbeddedDocumentComponents(documentEmbedded) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
if ((_a = documentEmbedded === null || documentEmbedded === void 0 ? void 0 : documentEmbedded._embedded) === null || _a === void 0 ? void 0 : _a.ontwerpTekststructuurDocumentComponenten) {
|
|
55
|
+
return {
|
|
56
|
+
documentComponents: documentEmbedded._embedded.ontwerpTekststructuurDocumentComponenten,
|
|
57
|
+
ontwerp: true,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if ((_b = documentEmbedded === null || documentEmbedded === void 0 ? void 0 : documentEmbedded._embedded) === null || _b === void 0 ? void 0 : _b.tekststructuurDocumentComponenten) {
|
|
61
|
+
return {
|
|
62
|
+
documentComponents: documentEmbedded._embedded.tekststructuurDocumentComponenten,
|
|
63
|
+
ontwerp: false,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
37
67
|
}
|
|
38
68
|
concatEmbeddedDocumentComponents(documentComponent) {
|
|
39
|
-
var _a;
|
|
40
|
-
const embeddedDocuments = [...((_a = this.getEmbeddedDocumentComponents(documentComponent)) !== null &&
|
|
69
|
+
var _a, _b;
|
|
70
|
+
const embeddedDocuments = [...((_b = (_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.documentComponents) !== null && _b !== void 0 ? _b : [])];
|
|
41
71
|
for (const d of embeddedDocuments) {
|
|
42
72
|
embeddedDocuments.push(...this.concatEmbeddedDocumentComponents(d));
|
|
43
73
|
}
|
|
@@ -49,24 +79,31 @@ export class DocumentComponentDemo {
|
|
|
49
79
|
return sampleSize(documentComponents, size);
|
|
50
80
|
}
|
|
51
81
|
async loadData() {
|
|
52
|
-
var _a;
|
|
82
|
+
var _a, _b;
|
|
53
83
|
if (!this.jsonFile) {
|
|
54
84
|
this.response = undefined;
|
|
85
|
+
this.document = undefined;
|
|
55
86
|
return;
|
|
56
87
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
|
|
88
|
+
this.response = await fetch(this.jsonFile).then((r) => r.json());
|
|
89
|
+
this.document = (_a = this.getEmbeddedDocumentComponents(this.response)) === null || _a === void 0 ? void 0 : _a.documentComponents[0];
|
|
90
|
+
if (((_b = this.document) === null || _b === void 0 ? void 0 : _b.type) === "LICHAAM") {
|
|
91
|
+
this.notApplicable = this.selectRandomDocumentComponents(this.document);
|
|
92
|
+
this.filtered = this.selectRandomDocumentComponents(this.document, this.notApplicable);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.notApplicable = [];
|
|
96
|
+
this.filtered = [];
|
|
63
97
|
}
|
|
64
98
|
}
|
|
65
|
-
handleOpenToggle(
|
|
66
|
-
const isOpenOrClosed = this.openOrClosed.includes(documentComponent);
|
|
67
|
-
this.openOrClosed
|
|
68
|
-
|
|
69
|
-
|
|
99
|
+
handleOpenToggle(documentComponent, force) {
|
|
100
|
+
const isOpenOrClosed = typeof force === "boolean" ? force : this.openOrClosed.includes(documentComponent);
|
|
101
|
+
if (isOpenOrClosed && this.openOrClosed.includes(documentComponent)) {
|
|
102
|
+
this.openOrClosed = this.openOrClosed.filter((d) => d !== documentComponent);
|
|
103
|
+
}
|
|
104
|
+
else if (!isOpenOrClosed && !this.openOrClosed.includes(documentComponent)) {
|
|
105
|
+
this.openOrClosed = [...this.openOrClosed, documentComponent];
|
|
106
|
+
}
|
|
70
107
|
}
|
|
71
108
|
handleAnnotationToggle(documentComponent) {
|
|
72
109
|
this.openedAnnotation = this.isOpenedAnnotation(documentComponent)
|
|
@@ -90,7 +127,7 @@ export class DocumentComponentDemo {
|
|
|
90
127
|
hasFilteredChildren(documentComponent) {
|
|
91
128
|
var _a, _b;
|
|
92
129
|
return (this.filtered.includes(documentComponent) ||
|
|
93
|
-
((_b = (_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.some((d) => this.hasFilteredChildren(d))) !== null && _b !== void 0 ? _b : false));
|
|
130
|
+
((_b = (_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.documentComponents.some((d) => this.hasFilteredChildren(d))) !== null && _b !== void 0 ? _b : false));
|
|
94
131
|
}
|
|
95
132
|
isOpen(documentComponent) {
|
|
96
133
|
return documentComponent.type === "LID" || this.openDefault
|
|
@@ -108,16 +145,26 @@ export class DocumentComponentDemo {
|
|
|
108
145
|
}
|
|
109
146
|
hasNestedDraft(documentComponent) {
|
|
110
147
|
var _a, _b;
|
|
111
|
-
return ((_b = (_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.some((d) => !!d.bevatOntwerpInformatie || this.hasNestedDraft(d))) !== null && _b !== void 0 ? _b : false);
|
|
148
|
+
return ((_b = (_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.documentComponents.some((d) => !!d.bevatOntwerpInformatie || this.hasNestedDraft(d))) !== null && _b !== void 0 ? _b : false);
|
|
112
149
|
}
|
|
113
150
|
showContent(documentComponent) {
|
|
114
151
|
var _a;
|
|
115
152
|
return (this.isOpen(documentComponent) &&
|
|
116
|
-
!!(((_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.length) || documentComponent.inhoud));
|
|
153
|
+
!!(((_a = this.getEmbeddedDocumentComponents(documentComponent)) === null || _a === void 0 ? void 0 : _a.documentComponents.length) || documentComponent.inhoud));
|
|
154
|
+
}
|
|
155
|
+
recursiveToggleState(documentComponent) {
|
|
156
|
+
const embeddedDocuments = this.getEmbeddedDocumentComponents(documentComponent);
|
|
157
|
+
if (!embeddedDocuments ||
|
|
158
|
+
embeddedDocuments.documentComponents.length <= 1 ||
|
|
159
|
+
!embeddedDocuments.documentComponents.some((d) => d.type === "ARTIKEL")) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
return embeddedDocuments.documentComponents.every((d) => this.isOpen(d));
|
|
117
163
|
}
|
|
118
164
|
render() {
|
|
119
|
-
|
|
120
|
-
|
|
165
|
+
var _a, _b;
|
|
166
|
+
const { DocumentComponent, MenuButton } = this;
|
|
167
|
+
return (h("dso-responsive-element", { class: "dso-document-components" }, h("div", { class: "dso-navbar" }, h("ul", { class: "dso-nav dso-nav-sub" }, (_b = (_a = this.getEmbeddedDocumentComponents(this.response)) === null || _a === void 0 ? void 0 : _a.documentComponents) === null || _b === void 0 ? void 0 : _b.map((d) => (h("li", { class: this.document === d ? "dso-active" : undefined }, h(MenuButton, { documentComponent: d })))))), this.document && h(DocumentComponent, { path: [this.document] })));
|
|
121
168
|
}
|
|
122
169
|
static get is() { return "dsot-document-component-demo"; }
|
|
123
170
|
static get encapsulation() { return "scoped"; }
|
|
@@ -191,6 +238,7 @@ export class DocumentComponentDemo {
|
|
|
191
238
|
static get states() {
|
|
192
239
|
return {
|
|
193
240
|
"response": {},
|
|
241
|
+
"document": {},
|
|
194
242
|
"openOrClosed": {},
|
|
195
243
|
"openedAnnotation": {},
|
|
196
244
|
"filtered": {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-component.demo.js","sourceRoot":"","sources":["../../../src/components/document-component-demo/document-component.demo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAsB,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAC1G,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,MAAM,MAAM,eAAe,CAAC;AA8BnC,MAAM,OAAO,qBAAqB;;IA2LxB,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE;;MAC/D,MAAM,iBAAiB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;MAEtC,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;MAEnC,OAAO,CACL,cACG,iBAAiB;SAChB,MAAA,IAAI,CAAC,6BAA6B,CAAC,iBAAiB,CAAC,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnE,UAAI,GAAG,EAAE,CAAC,CAAC,mBAAmB;UAC5B,8BACE,SAAS,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EACtB,sBAAsB,EAAE,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAClD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAC3E,wBAAwB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAChD,YAAY,EAAE,CAAC,CAAC,YAAY,EAC5B,OAAO,EAAC,IAAI,EACZ,MAAM,EAAE,CAAC,CAAC,MAAM,EAChB,KAAK,EAAE,CAAC,CAAC,QAAQ,EACjB,cAAc,EAAE,IAAI,CAAC,kBAAkB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,iBAAiB,EAAE,GAAG,IAAI,CAAC;IAEnC,OAAO,CACL,8BAAwB,KAAK,EAAC,yBAAyB,IACpD,IAAI,CAAC,QAAQ,IAAI,EAAC,iBAAiB,IAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAI,CACvC,CAC1B,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { h, Component, ComponentInterface, State, Prop, Watch, Event, EventEmitter } from \"@stencil/core\";\r\nimport sampleSize from \"lodash.samplesize\";\r\nimport random from \"lodash.random\";\r\n\r\nimport {\r\n DocumentComponentOzonContentAnchorClickEvent,\r\n DocumentComponentOpenToggleEvent,\r\n} from \"../document-component/document-component.models\";\r\nimport { DsoDocumentComponentCustomEvent } from \"../../components\";\r\n\r\ninterface DocumentComponent {\r\n documentTechnischId: string;\r\n type?: string;\r\n labelXml?: string;\r\n nummerXml?: string;\r\n opschrift?: string;\r\n inhoud?: string;\r\n gereserveerd?: boolean;\r\n vervallen?: boolean;\r\n bevatOntwerpInformatie?: boolean;\r\n wijzigactie?: \"voegtoe\" | \"verwijder\" | \"nieuweContainer\" | \"verwijderContainer\";\r\n _embedded?: {\r\n ontwerpTekststructuurDocumentComponenten?: DocumentComponent[];\r\n tekststructuurDocumentComponenten?: DocumentComponent[];\r\n };\r\n}\r\n\r\n@Component({\r\n tag: \"dsot-document-component-demo\",\r\n scoped: true,\r\n styleUrl: \"document-component.demo.scss\",\r\n})\r\nexport class DocumentComponentDemo implements ComponentInterface {\r\n /**\r\n * Show canvas to where Document Component extends.\r\n */\r\n @Prop({ reflect: true })\r\n showCanvas = false;\r\n\r\n /**\r\n * Name of the file to load.\r\n */\r\n @Prop()\r\n jsonFile?: string;\r\n\r\n /**\r\n * The default state for all Document Components.\r\n */\r\n @Prop()\r\n openDefault = false;\r\n\r\n /**\r\n * To demo user interacting with IntRef or IntIoRef elements.\r\n */\r\n @Event()\r\n dsotOzonContentAnchorClick!: EventEmitter<DocumentComponentOzonContentAnchorClickEvent>;\r\n\r\n @State()\r\n response?: DocumentComponent;\r\n\r\n @State()\r\n openOrClosed: DocumentComponent[] = [];\r\n\r\n @State()\r\n openedAnnotation: DocumentComponent[] = [];\r\n\r\n @State()\r\n filtered: DocumentComponent[] = [];\r\n\r\n @State()\r\n notApplicable: DocumentComponent[] = [];\r\n\r\n @State()\r\n activeAnnotationSelectables: DocumentComponent[] = [];\r\n\r\n @Watch(\"jsonFile\")\r\n async jsonFileWatcher() {\r\n this.openOrClosed = [];\r\n\r\n await this.loadData();\r\n }\r\n\r\n @Watch(\"openDefault\")\r\n async openDefaultWatcher() {\r\n this.openOrClosed = [];\r\n\r\n await this.loadData();\r\n }\r\n\r\n async componentDidLoad(): Promise<void> {\r\n await this.loadData();\r\n }\r\n\r\n private getEmbeddedDocumentComponents(documentComponent: DocumentComponent | undefined) {\r\n return (\r\n documentComponent?._embedded?.ontwerpTekststructuurDocumentComponenten ??\r\n documentComponent?._embedded?.tekststructuurDocumentComponenten\r\n );\r\n }\r\n\r\n private concatEmbeddedDocumentComponents(documentComponent: DocumentComponent): DocumentComponent[] {\r\n const embeddedDocuments = [...(this.getEmbeddedDocumentComponents(documentComponent) ?? [])];\r\n\r\n for (const d of embeddedDocuments) {\r\n embeddedDocuments.push(...this.concatEmbeddedDocumentComponents(d));\r\n }\r\n\r\n return embeddedDocuments;\r\n }\r\n\r\n private selectRandomDocumentComponents(\r\n documentComponent: DocumentComponent,\r\n exclude: DocumentComponent[] = [],\r\n ): DocumentComponent[] {\r\n const documentComponents = this.concatEmbeddedDocumentComponents(documentComponent).filter(\r\n (d) => !exclude.includes(d),\r\n );\r\n const size = random(0, Math.floor(documentComponents.length / 10));\r\n\r\n return sampleSize(documentComponents, size);\r\n }\r\n\r\n private async loadData() {\r\n if (!this.jsonFile) {\r\n this.response = undefined;\r\n\r\n return;\r\n }\r\n\r\n const data = await fetch(this.jsonFile).then((r) => r.json());\r\n const lichaam = this.getEmbeddedDocumentComponents(data)?.find(\r\n (documentComponent) => documentComponent.type === \"LICHAAM\",\r\n );\r\n\r\n if (lichaam) {\r\n this.response = lichaam;\r\n\r\n this.notApplicable = this.selectRandomDocumentComponents(lichaam);\r\n this.filtered = this.selectRandomDocumentComponents(lichaam, this.notApplicable);\r\n }\r\n }\r\n\r\n private handleOpenToggle(\r\n _e: DsoDocumentComponentCustomEvent<DocumentComponentOpenToggleEvent>,\r\n documentComponent: DocumentComponent,\r\n ) {\r\n const isOpenOrClosed = this.openOrClosed.includes(documentComponent);\r\n\r\n this.openOrClosed = !isOpenOrClosed\r\n ? [...this.openOrClosed, documentComponent]\r\n : this.openOrClosed.filter((d) => d !== documentComponent);\r\n }\r\n\r\n private handleAnnotationToggle(documentComponent: DocumentComponent) {\r\n this.openedAnnotation = this.isOpenedAnnotation(documentComponent)\r\n ? this.openedAnnotation.filter((d) => d !== documentComponent)\r\n : [...this.openedAnnotation, documentComponent];\r\n\r\n if (!this.isOpen(documentComponent)) {\r\n this.openOrClosed = [...this.openOrClosed, documentComponent];\r\n }\r\n }\r\n\r\n private handleSelectableChange(documentComponent: DocumentComponent) {\r\n this.activeAnnotationSelectables = this.isCheckedSlideToggle(documentComponent)\r\n ? this.activeAnnotationSelectables.filter((d) => d !== documentComponent)\r\n : [...this.activeAnnotationSelectables, documentComponent];\r\n }\r\n\r\n private handleOzonContentAnchorClick(\r\n e: DsoDocumentComponentCustomEvent<DocumentComponentOzonContentAnchorClickEvent>,\r\n ) {\r\n this.dsotOzonContentAnchorClick.emit(e.detail);\r\n }\r\n\r\n private isCheckedSlideToggle(documentComponent: DocumentComponent) {\r\n return this.activeAnnotationSelectables.includes(documentComponent);\r\n }\r\n\r\n private hasFilteredChildren(documentComponent: DocumentComponent): boolean {\r\n return (\r\n this.filtered.includes(documentComponent) ||\r\n (this.getEmbeddedDocumentComponents(documentComponent)?.some((d) => this.hasFilteredChildren(d)) ?? false)\r\n );\r\n }\r\n\r\n private isOpen(documentComponent: DocumentComponent): boolean {\r\n return documentComponent.type === \"LID\" || this.openDefault\r\n ? !this.openOrClosed.includes(documentComponent)\r\n : this.openOrClosed.includes(documentComponent);\r\n }\r\n\r\n private isOpenedAnnotation(documentComponent: DocumentComponent): boolean {\r\n return this.openedAnnotation.includes(documentComponent);\r\n }\r\n\r\n private isFiltered(documentComponent: DocumentComponent): boolean {\r\n return this.filtered.includes(documentComponent);\r\n }\r\n\r\n private isNotApplicable(documentComponent: DocumentComponent): boolean {\r\n return this.notApplicable.includes(documentComponent);\r\n }\r\n\r\n private hasNestedDraft(documentComponent: DocumentComponent): boolean {\r\n return (\r\n this.getEmbeddedDocumentComponents(documentComponent)?.some(\r\n (d) => !!d.bevatOntwerpInformatie || this.hasNestedDraft(d),\r\n ) ?? false\r\n );\r\n }\r\n\r\n private showContent(documentComponent: DocumentComponent): boolean {\r\n return (\r\n this.isOpen(documentComponent) &&\r\n !!(this.getEmbeddedDocumentComponents(documentComponent)?.length || documentComponent.inhoud)\r\n );\r\n }\r\n\r\n private DocumentComponent = ({ path }: DocumentComponentProps) => {\r\n const documentComponent = path.at(-1);\r\n\r\n const { DocumentComponent } = this;\r\n\r\n return (\r\n <ul>\r\n {documentComponent &&\r\n this.getEmbeddedDocumentComponents(documentComponent)?.map((d, i) => (\r\n <li key={d.documentTechnischId}>\r\n <dso-document-component\r\n annotated={i % 3 === 2}\r\n bevatOntwerpInformatie={!!d.bevatOntwerpInformatie}\r\n filtered={this.isOpen(d) ? this.isFiltered(d) : this.hasFilteredChildren(d)}\r\n genesteOntwerpInformatie={this.hasNestedDraft(d)}\r\n gereserveerd={d.gereserveerd}\r\n heading=\"h2\"\r\n inhoud={d.inhoud}\r\n label={d.labelXml}\r\n openAnnotation={this.isOpenedAnnotation(d)}\r\n notApplicable={this.isNotApplicable(d) || path.some((p) => this.isNotApplicable(p))}\r\n nummer={d.nummerXml}\r\n onDsoAnnotationToggle={() => this.handleAnnotationToggle(d)}\r\n onDsoOpenToggle={(e) => this.handleOpenToggle(e, d)}\r\n onDsoOzonContentAnchorClick={(e) => this.handleOzonContentAnchorClick(e)}\r\n open={this.isOpen(d)}\r\n opschrift={d.opschrift}\r\n type={d.type}\r\n vervallen={d.vervallen}\r\n wijzigactie={d.wijzigactie}\r\n >\r\n {this.isOpenedAnnotation(d) && (\r\n <dso-annotation-output\r\n slot=\"annotation\"\r\n open\r\n identifier=\"test\"\r\n onDsoClose={() => this.handleAnnotationToggle(d)}\r\n >\r\n <span slot=\"title\">Annotaties</span>\r\n <dso-slide-toggle\r\n checked={this.isCheckedSlideToggle(d)}\r\n onDsoActiveChange={() => this.handleSelectableChange(d)}\r\n >\r\n Delfzijl\r\n </dso-slide-toggle>\r\n </dso-annotation-output>\r\n )}\r\n {this.showContent(d) && <DocumentComponent path={[...path, d]} />}\r\n </dso-document-component>\r\n </li>\r\n ))}\r\n </ul>\r\n );\r\n };\r\n\r\n render() {\r\n const { DocumentComponent } = this;\r\n\r\n return (\r\n <dso-responsive-element class=\"dso-document-components\">\r\n {this.response && <DocumentComponent path={[this.response]} />}\r\n </dso-responsive-element>\r\n );\r\n }\r\n}\r\n\r\ninterface DocumentComponentProps {\r\n path: DocumentComponent[];\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"document-component.demo.js","sourceRoot":"","sources":["../../../src/components/document-component-demo/document-component.demo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAsB,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpH,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,MAAM,MAAM,eAAe,CAAC;AAkCnC,MAAM,OAAO,qBAAqB;;IAyNxB,0BAAqB,GAAG,CAC9B,iBAAoC,EACpC,MAA6C,EAC7C,EAAE;MACF,MAAM,iBA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AC,CAAC,SAAS;UACvD,EAAC,UAAU,IAAC,iBAAiB,EAAE,CAAC,GAAI,CACjC,CACN,CAAC,CACC,CACD;MACL,IAAI,CAAC,QAAQ,IAAI,EAAC,iBAAiB,IAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAI,CACvC,CAC1B,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BF","sourcesContent":["import { h, Component, ComponentInterface, State, Prop, Watch, Event, EventEmitter, Fragment } from \"@stencil/core\";\r\nimport sampleSize from \"lodash.samplesize\";\r\nimport random from \"lodash.random\";\r\n\r\nimport {\r\n DocumentComponentOzonContentAnchorClickEvent,\r\n DocumentComponentRecursiveToggleEvent,\r\n} from \"../document-component/document-component.models\";\r\nimport { DsoDocumentComponentCustomEvent } from \"../../components\";\r\n\r\ninterface DocumentEmbedded {\r\n _embedded?: {\r\n ontwerpTekststructuurDocumentComponenten?: DocumentComponent[];\r\n tekststructuurDocumentComponenten?: DocumentComponent[];\r\n };\r\n}\r\n\r\ninterface DocumentComponent extends DocumentEmbedded {\r\n documentTechnischId: string;\r\n type?: string;\r\n labelXml?: string;\r\n nummerXml?: string;\r\n volgordeNummer: number;\r\n opschrift?: string;\r\n inhoud?: string;\r\n gereserveerd?: boolean;\r\n vervallen?: boolean;\r\n bevatOntwerpInformatie?: boolean;\r\n wijzigactie?: \"voegtoe\" | \"verwijder\" | \"nieuweContainer\" | \"verwijderContainer\";\r\n}\r\n\r\n@Component({\r\n tag: \"dsot-document-component-demo\",\r\n scoped: true, // scoped because we are immitating the usage of <dso-document-component> in a page\r\n styleUrl: \"document-component.demo.scss\",\r\n})\r\nexport class DocumentComponentDemo implements ComponentInterface {\r\n /**\r\n * Show canvas to where Document Component extends.\r\n */\r\n @Prop({ reflect: true })\r\n showCanvas = false;\r\n\r\n /**\r\n * Name of the file to load.\r\n */\r\n @Prop()\r\n jsonFile?: string;\r\n\r\n /**\r\n * The default state for all Document Components.\r\n */\r\n @Prop()\r\n openDefault = false;\r\n\r\n /**\r\n * To demo user interacting with IntRef or IntIoRef elements.\r\n */\r\n @Event()\r\n dsotOzonContentAnchorClick!: EventEmitter<DocumentComponentOzonContentAnchorClickEvent>;\r\n\r\n @State()\r\n response?: DocumentEmbedded;\r\n\r\n @State()\r\n document?: DocumentComponent;\r\n\r\n @State()\r\n openOrClosed: DocumentComponent[] = [];\r\n\r\n @State()\r\n openedAnnotation: DocumentComponent[] = [];\r\n\r\n @State()\r\n filtered: DocumentComponent[] = [];\r\n\r\n @State()\r\n notApplicable: DocumentComponent[] = [];\r\n\r\n @State()\r\n activeAnnotationSelectables: DocumentComponent[] = [];\r\n\r\n @Watch(\"jsonFile\")\r\n async jsonFileWatcher() {\r\n this.openOrClosed = [];\r\n\r\n await this.loadData();\r\n }\r\n\r\n @Watch(\"openDefault\")\r\n async openDefaultWatcher() {\r\n this.openOrClosed = [];\r\n\r\n await this.loadData();\r\n }\r\n\r\n async componentDidLoad(): Promise<void> {\r\n await this.loadData();\r\n }\r\n\r\n private getEmbeddedDocumentComponents(documentEmbedded: DocumentEmbedded | undefined) {\r\n if (documentEmbedded?._embedded?.ontwerpTekststructuurDocumentComponenten) {\r\n return {\r\n documentComponents: documentEmbedded._embedded.ontwerpTekststructuurDocumentComponenten,\r\n ontwerp: true,\r\n };\r\n }\r\n\r\n if (documentEmbedded?._embedded?.tekststructuurDocumentComponenten) {\r\n return {\r\n documentComponents: documentEmbedded._embedded.tekststructuurDocumentComponenten,\r\n ontwerp: false,\r\n };\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n private concatEmbeddedDocumentComponents(documentComponent: DocumentComponent): DocumentComponent[] {\r\n const embeddedDocuments = [...(this.getEmbeddedDocumentComponents(documentComponent)?.documentComponents ?? [])];\r\n\r\n for (const d of embeddedDocuments) {\r\n embeddedDocuments.push(...this.concatEmbeddedDocumentComponents(d));\r\n }\r\n\r\n return embeddedDocuments;\r\n }\r\n\r\n private selectRandomDocumentComponents(\r\n documentComponent: DocumentComponent,\r\n exclude: DocumentComponent[] = [],\r\n ): DocumentComponent[] {\r\n const documentComponents = this.concatEmbeddedDocumentComponents(documentComponent).filter(\r\n (d) => !exclude.includes(d),\r\n );\r\n const size = random(0, Math.floor(documentComponents.length / 10));\r\n\r\n return sampleSize(documentComponents, size);\r\n }\r\n\r\n private async loadData() {\r\n if (!this.jsonFile) {\r\n this.response = undefined;\r\n this.document = undefined;\r\n\r\n return;\r\n }\r\n\r\n this.response = await fetch(this.jsonFile).then((r) => r.json());\r\n this.document = this.getEmbeddedDocumentComponents(this.response)?.documentComponents[0];\r\n\r\n if (this.document?.type === \"LICHAAM\") {\r\n this.notApplicable = this.selectRandomDocumentComponents(this.document);\r\n this.filtered = this.selectRandomDocumentComponents(this.document, this.notApplicable);\r\n } else {\r\n this.notApplicable = [];\r\n this.filtered = [];\r\n }\r\n }\r\n\r\n private handleOpenToggle(documentComponent: DocumentComponent, force?: boolean) {\r\n const isOpenOrClosed = typeof force === \"boolean\" ? force : this.openOrClosed.includes(documentComponent);\r\n\r\n if (isOpenOrClosed && this.openOrClosed.includes(documentComponent)) {\r\n this.openOrClosed = this.openOrClosed.filter((d) => d !== documentComponent);\r\n } else if (!isOpenOrClosed && !this.openOrClosed.includes(documentComponent)) {\r\n this.openOrClosed = [...this.openOrClosed, documentComponent];\r\n }\r\n }\r\n\r\n private handleAnnotationToggle(documentComponent: DocumentComponent) {\r\n this.openedAnnotation = this.isOpenedAnnotation(documentComponent)\r\n ? this.openedAnnotation.filter((d) => d !== documentComponent)\r\n : [...this.openedAnnotation, documentComponent];\r\n\r\n if (!this.isOpen(documentComponent)) {\r\n this.openOrClosed = [...this.openOrClosed, documentComponent];\r\n }\r\n }\r\n\r\n private handleSelectableChange(documentComponent: DocumentComponent) {\r\n this.activeAnnotationSelectables = this.isCheckedSlideToggle(documentComponent)\r\n ? this.activeAnnotationSelectables.filter((d) => d !== documentComponent)\r\n : [...this.activeAnnotationSelectables, documentComponent];\r\n }\r\n\r\n private handleOzonContentAnchorClick(\r\n e: DsoDocumentComponentCustomEvent<DocumentComponentOzonContentAnchorClickEvent>,\r\n ) {\r\n this.dsotOzonContentAnchorClick.emit(e.detail);\r\n }\r\n\r\n private isCheckedSlideToggle(documentComponent: DocumentComponent) {\r\n return this.activeAnnotationSelectables.includes(documentComponent);\r\n }\r\n\r\n private hasFilteredChildren(documentComponent: DocumentComponent): boolean {\r\n return (\r\n this.filtered.includes(documentComponent) ||\r\n (this.getEmbeddedDocumentComponents(documentComponent)?.documentComponents.some((d) =>\r\n this.hasFilteredChildren(d),\r\n ) ??\r\n false)\r\n );\r\n }\r\n\r\n private isOpen(documentComponent: DocumentComponent): boolean {\r\n return documentComponent.type === \"LID\" || this.openDefault\r\n ? !this.openOrClosed.includes(documentComponent)\r\n : this.openOrClosed.includes(documentComponent);\r\n }\r\n\r\n private isOpenedAnnotation(documentComponent: DocumentComponent): boolean {\r\n return this.openedAnnotation.includes(documentComponent);\r\n }\r\n\r\n private isFiltered(documentComponent: DocumentComponent): boolean {\r\n return this.filtered.includes(documentComponent);\r\n }\r\n\r\n private isNotApplicable(documentComponent: DocumentComponent): boolean {\r\n return this.notApplicable.includes(documentComponent);\r\n }\r\n\r\n private hasNestedDraft(documentComponent: DocumentComponent): boolean {\r\n return (\r\n this.getEmbeddedDocumentComponents(documentComponent)?.documentComponents.some(\r\n (d) => !!d.bevatOntwerpInformatie || this.hasNestedDraft(d),\r\n ) ?? false\r\n );\r\n }\r\n\r\n private showContent(documentComponent: DocumentComponent): boolean {\r\n return (\r\n this.isOpen(documentComponent) &&\r\n !!(this.getEmbeddedDocumentComponents(documentComponent)?.documentComponents.length || documentComponent.inhoud)\r\n );\r\n }\r\n\r\n private recursiveToggleState(documentComponent: DocumentComponent): undefined | boolean | \"indeterminate\" {\r\n const embeddedDocuments = this.getEmbeddedDocumentComponents(documentComponent);\r\n\r\n if (\r\n !embeddedDocuments ||\r\n embeddedDocuments.documentComponents.length <= 1 ||\r\n !embeddedDocuments.documentComponents.some((d) => d.type === \"ARTIKEL\")\r\n ) {\r\n return undefined;\r\n }\r\n\r\n return embeddedDocuments.documentComponents.every((d) => this.isOpen(d));\r\n }\r\n\r\n private handleRecursiveToggle = (\r\n documentComponent: DocumentComponent,\r\n detail: DocumentComponentRecursiveToggleEvent,\r\n ) => {\r\n const embeddedDocuments = this.getEmbeddedDocumentComponents(documentComponent);\r\n if (!embeddedDocuments) {\r\n return;\r\n }\r\n\r\n for (const d of embeddedDocuments.documentComponents) {\r\n this.handleOpenToggle(d, detail.next);\r\n }\r\n };\r\n\r\n private DocumentComponent = ({ path }: DocumentComponentProps) => {\r\n const documentComponent = path.at(-1);\r\n if (!documentComponent) {\r\n return <Fragment />;\r\n }\r\n\r\n const { DocumentComponent } = this;\r\n\r\n const embeddedDocuments = this.getEmbeddedDocumentComponents(documentComponent);\r\n\r\n return (\r\n <dso-document-component\r\n annotated={documentComponent.volgordeNummer % 4 === 2}\r\n bevatOntwerpInformatie={!!documentComponent.bevatOntwerpInformatie}\r\n filtered={\r\n this.isOpen(documentComponent)\r\n ? this.isFiltered(documentComponent)\r\n : this.hasFilteredChildren(documentComponent)\r\n }\r\n genesteOntwerpInformatie={this.hasNestedDraft(documentComponent)}\r\n gereserveerd={documentComponent.gereserveerd}\r\n heading=\"h2\"\r\n inhoud={documentComponent.inhoud}\r\n label={documentComponent.labelXml}\r\n openAnnotation={this.isOpenedAnnotation(documentComponent)}\r\n notApplicable={this.isNotApplicable(documentComponent) || path.some((p) => this.isNotApplicable(p))}\r\n nummer={documentComponent.nummerXml}\r\n onDsoAnnotationToggle={() => this.handleAnnotationToggle(documentComponent)}\r\n onDsoOpenToggle={() => this.handleOpenToggle(documentComponent)}\r\n onDsoOzonContentAnchorClick={(e) => this.handleOzonContentAnchorClick(e)}\r\n open={this.isOpen(documentComponent)}\r\n opschrift={documentComponent.opschrift}\r\n type={documentComponent.type}\r\n vervallen={documentComponent.vervallen}\r\n wijzigactie={documentComponent.wijzigactie}\r\n recursiveToggle={this.recursiveToggleState(documentComponent)}\r\n onDsoRecursiveToggle={(e) => this.handleRecursiveToggle(documentComponent, e.detail)}\r\n >\r\n {this.isOpenedAnnotation(documentComponent) && (\r\n <dso-annotation-output\r\n slot=\"annotation\"\r\n open\r\n identifier=\"test\"\r\n onDsoClose={() => this.handleAnnotationToggle(documentComponent)}\r\n >\r\n <span slot=\"title\">Annotaties</span>\r\n <dso-slide-toggle\r\n checked={this.isCheckedSlideToggle(documentComponent)}\r\n onDsoActiveChange={() => this.handleSelectableChange(documentComponent)}\r\n >\r\n Delfzijl\r\n </dso-slide-toggle>\r\n </dso-annotation-output>\r\n )}\r\n {this.showContent(documentComponent) && embeddedDocuments?.documentComponents.length && (\r\n <ul>\r\n {embeddedDocuments.documentComponents.map((d) => (\r\n <li key={d.documentTechnischId}>\r\n <DocumentComponent path={[...path, d]} />\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n </dso-document-component>\r\n );\r\n };\r\n\r\n render() {\r\n const { DocumentComponent, MenuButton } = this;\r\n\r\n return (\r\n <dso-responsive-element class=\"dso-document-components\">\r\n <div class=\"dso-navbar\">\r\n <ul class=\"dso-nav dso-nav-sub\">\r\n {this.getEmbeddedDocumentComponents(this.response)?.documentComponents?.map((d) => (\r\n <li class={this.document === d ? \"dso-active\" : undefined}>\r\n <MenuButton documentComponent={d} />\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n {this.document && <DocumentComponent path={[this.document]} />}\r\n </dso-responsive-element>\r\n );\r\n }\r\n\r\n private MenuButton = ({ documentComponent }: MenuItemProps) => {\r\n const { labelXml, nummerXml, type } = documentComponent;\r\n\r\n return (\r\n <button type=\"button\" onClick={() => (this.document = documentComponent)}>\r\n {!labelXml && !nummerXml ? (\r\n <span>\r\n <i>{type}</i>\r\n </span>\r\n ) : (\r\n <>\r\n {labelXml && (\r\n <>\r\n <dso-ozon-content content={labelXml} inline></dso-ozon-content>\r\n </>\r\n )}\r\n {nummerXml && (\r\n <>\r\n {\" \"}\r\n <dso-ozon-content content={nummerXml} inline></dso-ozon-content>\r\n </>\r\n )}\r\n </>\r\n )}\r\n </button>\r\n );\r\n };\r\n}\r\n\r\ninterface MenuItemProps {\r\n documentComponent: DocumentComponent;\r\n}\r\n\r\ninterface DocumentComponentProps {\r\n path: DocumentComponent[];\r\n}\r\n"]}
|
|
@@ -15,6 +15,7 @@ export class Selectable {
|
|
|
15
15
|
originalEvent: e,
|
|
16
16
|
checked: target instanceof HTMLInputElement && target.checked,
|
|
17
17
|
});
|
|
18
|
+
forceUpdate(this.host);
|
|
18
19
|
};
|
|
19
20
|
this.type = undefined;
|
|
20
21
|
this.identifier = undefined;
|
|
@@ -64,6 +65,11 @@ export class Selectable {
|
|
|
64
65
|
const hasInfo = !!this.host.querySelector('[slot="info"]');
|
|
65
66
|
return (h(Fragment, null, h("div", { class: "dso-selectable-container" }, h("div", { class: clsx("dso-selectable-input-wrapper", { "dso-keyboard-focus": this.keyboardFocus }) }, h("input", { type: this.type, id: this.getIdentifier(), value: this.value, name: this.name, "aria-invalid": (_a = this.invalid) === null || _a === void 0 ? void 0 : _a.toString(), "aria-describedby": hasInfo && this.infoFixed ? this.describedById : undefined, "aria-labelledBy": this.labelledById, disabled: this.disabled, required: this.required, checked: this.checked, onChange: this.handleOnChange, onBlur: () => (this.keyboardFocus = false), onKeyUp: () => (this.keyboardFocus = true), ref: (el) => (this.input = el) }), !this.labelledById ? (h("label", { htmlFor: this.getIdentifier() }, h("slot", null))) : (h("label", null, h("slot", null)))), hasInfo && !this.infoFixed && (h("dso-info-button", { active: this.infoActive, onDsoToggle: (e) => (this.infoActive = e.detail.active) }))), hasInfo && (h("dso-info", { id: hasInfo && this.infoFixed ? this.describedById : undefined, fixed: this.infoFixed, active: this.infoActive, onDsoClose: () => (this.infoActive = false) }, h("div", null, h("slot", { name: "info" })))), h("slot", { name: "options" })));
|
|
66
67
|
}
|
|
68
|
+
componentDidRender() {
|
|
69
|
+
if (this.input && typeof this.checked === "boolean" && this.input.checked !== this.checked) {
|
|
70
|
+
this.input.checked = this.checked;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
67
73
|
getIdentifier() {
|
|
68
74
|
var _a;
|
|
69
75
|
return (_a = this.identifier) !== null && _a !== void 0 ? _a : this.fallbackIdentifier;
|
|
@@ -250,7 +256,7 @@ export class Selectable {
|
|
|
250
256
|
"text": "Mark the Selectable as checked"
|
|
251
257
|
},
|
|
252
258
|
"attribute": "checked",
|
|
253
|
-
"reflect":
|
|
259
|
+
"reflect": true
|
|
254
260
|
},
|
|
255
261
|
"indeterminate": {
|
|
256
262
|
"type": "boolean",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectable.js","sourceRoot":"","sources":["../../../src/components/selectable/selectable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,CAAC,EACD,SAAS,EACT,IAAI,EACJ,KAAK,EAEL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,WAAW,EACX,KAAK,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"selectable.js","sourceRoot":"","sources":["../../../src/components/selectable/selectable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,CAAC,EACD,SAAS,EACT,IAAI,EACJ,KAAK,EAEL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,WAAW,EACX,KAAK,EACL,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE;;;;GAIG;AAMH,MAAM,OAAO,UAAU;;IA0Gb,uBAAkB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAIvD,mBAAc,GAAG,CAAC,CAAQ,EAAE,EAAE;MACpC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;MAErB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CACpB,CACG;MACL,OAAO,IAAI,CACV,gBACE,EAAE,EAAE,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAC9D,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAE3C;UACE,YAAM,IAAI,EAAC,MAAM,GAAQ,CACrB,CACG,CACZ;MACD,YAAM,IAAI,EAAC,SAAS,GAAG,CACd,CACZ,CAAC;EACJ,CAAC;EAED,kBAAkB;IAChB,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE;MAC1F,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;KACnC;EACH,CAAC;EAEO,aAAa;;IACnB,OAAO,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,CAAC,kBAAkB,CAAC;EACpD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\r\n h,\r\n Component,\r\n Prop,\r\n Event,\r\n EventEmitter,\r\n Fragment,\r\n Element,\r\n State,\r\n forceUpdate,\r\n Watch,\r\n Method,\r\n ComponentInterface,\r\n} from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\nimport { createIdentifier } from \"../../utils/create-identifier\";\r\nimport { SelectableChangeEvent } from \"./selectable.interfaces\";\r\n\r\n/**\r\n * @slot - The label for this control\r\n * @slot info - Rich Content to be slotted in Info.\r\n * @slot options - for further nested selectable options: `<ul class=\"dso-selectable-options\" slot=\"options\">` and wrap each Selectable in a `<li>`.\r\n */\r\n@Component({\r\n tag: \"dso-selectable\",\r\n styleUrl: \"selectable.scss\",\r\n scoped: true,\r\n})\r\nexport class Selectable implements ComponentInterface {\r\n /**\r\n * Type of Selectable.\r\n *\r\n * `checkbox`: Multiple options\r\n * `radio`: Single option.\r\n */\r\n @Prop()\r\n type!: \"checkbox\" | \"radio\";\r\n\r\n /**\r\n * To set `<input id>` attribute for external references.\r\n */\r\n @Prop()\r\n identifier?: string;\r\n\r\n /**\r\n * Name of the Selectable. Can be used to group Selectables.\r\n */\r\n @Prop()\r\n name?: string;\r\n\r\n /**\r\n * The value of the Selectable.\r\n */\r\n @Prop()\r\n value!: string;\r\n\r\n /**\r\n * Set to true of the current value is not valid.\r\n */\r\n @Prop()\r\n invalid?: boolean;\r\n\r\n /**\r\n * To link this control to an element that describes it.\r\n */\r\n @Prop()\r\n describedById?: string;\r\n\r\n /**\r\n * To link this control to an element that labels it.\r\n */\r\n @Prop()\r\n labelledById?: string;\r\n\r\n /**\r\n * To disable the Selectable.\r\n */\r\n @Prop()\r\n disabled?: boolean;\r\n\r\n /**\r\n * To mark the Selectable as required.\r\n */\r\n @Prop()\r\n required?: boolean;\r\n\r\n /**\r\n * Mark the Selectable as checked\r\n */\r\n @Prop({ reflect: true })\r\n checked?: boolean;\r\n\r\n /**\r\n * An indeterminate state is neither true or false. It means the answer is somewhere in between.\r\n *\r\n * Can be used to indicate child Selectables that are a mix of checked and unchecked.\r\n */\r\n @Prop()\r\n indeterminate?: boolean;\r\n\r\n /**\r\n * Set to true if the Info should not be toggled and always visible.\r\n */\r\n @Prop()\r\n infoFixed?: boolean;\r\n\r\n /**\r\n * Emitted when the user checks or unchecks the Selectable.\r\n */\r\n @Event()\r\n dsoChange!: EventEmitter<SelectableChangeEvent>;\r\n\r\n @Element()\r\n host!: HTMLDsoSelectableElement;\r\n\r\n @State()\r\n infoActive = false;\r\n\r\n @State()\r\n keyboardFocus = false;\r\n\r\n /**\r\n * Method to toggle the Info. Is set to `active` when passed.\r\n *\r\n * If `active` is not passed, Info is toggled to opposite value.\r\n * @param active\r\n */\r\n @Method()\r\n async toggleInfo(active?: boolean) {\r\n this.infoActive = active ?? !this.infoActive;\r\n }\r\n\r\n private mutationObserver?: MutationObserver;\r\n\r\n private fallbackIdentifier = createIdentifier(\"DsoSelectable\");\r\n\r\n private input: HTMLInputElement | undefined;\r\n\r\n private handleOnChange = (e: Event) => {\r\n const { target } = e;\r\n\r\n this.dsoChange.emit({\r\n originalEvent: e,\r\n checked: target instanceof HTMLInputElement && target.checked,\r\n });\r\n\r\n forceUpdate(this.host);\r\n };\r\n\r\n componentDidLoad() {\r\n this.mutationObserver?.disconnect();\r\n\r\n this.mutationObserver = new MutationObserver(() => forceUpdate(this.host));\r\n this.mutationObserver.observe(this.host, {\r\n childList: true,\r\n });\r\n\r\n this.setIndeterminate();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.mutationObserver?.disconnect();\r\n }\r\n\r\n @Watch(\"indeterminate\")\r\n setIndeterminate() {\r\n if (!(this.input instanceof HTMLInputElement) || this.type !== \"checkbox\") {\r\n return;\r\n }\r\n\r\n this.input.indeterminate = !!this.indeterminate;\r\n }\r\n\r\n render() {\r\n const hasInfo = !!this.host.querySelector('[slot=\"info\"]');\r\n\r\n return (\r\n <Fragment>\r\n <div class=\"dso-selectable-container\">\r\n <div class={clsx(\"dso-selectable-input-wrapper\", { \"dso-keyboard-focus\": this.keyboardFocus })}>\r\n <input\r\n type={this.type}\r\n id={this.getIdentifier()}\r\n value={this.value}\r\n name={this.name}\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={hasInfo && this.infoFixed ? this.describedById : undefined}\r\n aria-labelledBy={this.labelledById}\r\n disabled={this.disabled}\r\n required={this.required}\r\n checked={this.checked}\r\n onChange={this.handleOnChange}\r\n onBlur={() => (this.keyboardFocus = false)}\r\n onKeyUp={() => (this.keyboardFocus = true)}\r\n ref={(el) => (this.input = el)}\r\n />\r\n {!this.labelledById ? (\r\n <label htmlFor={this.getIdentifier()}>\r\n <slot />\r\n </label>\r\n ) : (\r\n <label>\r\n <slot />\r\n </label>\r\n )}\r\n </div>\r\n {hasInfo && !this.infoFixed && (\r\n <dso-info-button\r\n active={this.infoActive}\r\n onDsoToggle={(e) => (this.infoActive = e.detail.active)}\r\n ></dso-info-button>\r\n )}\r\n </div>\r\n {hasInfo && (\r\n <dso-info\r\n id={hasInfo && this.infoFixed ? this.describedById : undefined}\r\n fixed={this.infoFixed}\r\n active={this.infoActive}\r\n onDsoClose={() => (this.infoActive = false)}\r\n >\r\n <div>\r\n <slot name=\"info\"></slot>\r\n </div>\r\n </dso-info>\r\n )}\r\n <slot name=\"options\" />\r\n </Fragment>\r\n );\r\n }\r\n\r\n componentDidRender(): void {\r\n if (this.input && typeof this.checked === \"boolean\" && this.input.checked !== this.checked) {\r\n this.input.checked = this.checked;\r\n }\r\n }\r\n\r\n private getIdentifier(): string {\r\n return this.identifier ?? this.fallbackIdentifier;\r\n }\r\n}\r\n"]}
|