@siemens/ix 0.0.0-pr-1724-20250228145306 → 0.0.0-pr-1724-20250305102750
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/components/ix-application-header.js +1 -1
- package/components/ix-basic-navigation.js +1 -1
- package/components/ix-checkbox-group.js +3 -3
- package/components/ix-checkbox.js +1 -1
- package/components/ix-custom-field.js +3 -3
- package/components/ix-date-input.js +4 -4
- package/components/ix-drawer.js +1 -1
- package/components/ix-drawer.js.map +1 -1
- package/components/ix-field-label.js +1 -1
- package/components/ix-field-wrapper.js +1 -1
- package/components/ix-helper-text.js +1 -1
- package/components/ix-input.js +4 -4
- package/components/ix-map-navigation.js +1 -1
- package/components/ix-number-input.js +4 -4
- package/components/ix-pagination.js +3 -3
- package/components/ix-radio-group.js +3 -3
- package/components/ix-select.js +1 -1
- package/components/ix-textarea.js +4 -4
- package/components/{p-195f3939.js → p-0736463a.js} +2 -1
- package/components/p-0736463a.js.map +1 -0
- package/components/{p-3843fd6b.js → p-6bc5e411.js} +2 -2
- package/components/{p-3843fd6b.js.map → p-6bc5e411.js.map} +1 -1
- package/components/{p-d54870ca.js → p-90900090.js} +2 -2
- package/components/{p-d54870ca.js.map → p-90900090.js.map} +1 -1
- package/components/{p-cf69fbf3.js → p-9c587ccc.js} +4 -4
- package/components/{p-cf69fbf3.js.map → p-9c587ccc.js.map} +1 -1
- package/components/{p-518dfb05.js → p-bbb5e21c.js} +2 -2
- package/components/{p-518dfb05.js.map → p-bbb5e21c.js.map} +1 -1
- package/components/{p-383f1dc5.js → p-eb4725aa.js} +4 -5
- package/components/p-eb4725aa.js.map +1 -0
- package/dist/cjs/{input.util-94fe9055.js → input.util-622a9947.js} +2 -2
- package/dist/cjs/{input.util-94fe9055.js.map → input.util-622a9947.js.map} +1 -1
- package/dist/cjs/ix-application-header.cjs.entry.js +3 -4
- package/dist/cjs/ix-application-header.cjs.entry.js.map +1 -1
- package/dist/cjs/ix-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/ix-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ix-custom-field.cjs.entry.js +1 -1
- package/dist/cjs/ix-date-input.cjs.entry.js +2 -2
- package/dist/cjs/ix-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ix-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/ix-field-label_2.cjs.entry.js +1 -1
- package/dist/cjs/ix-helper-text.cjs.entry.js +1 -1
- package/dist/cjs/ix-input.cjs.entry.js +2 -2
- package/dist/cjs/ix-number-input.cjs.entry.js +2 -2
- package/dist/cjs/ix-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/ix-select.cjs.entry.js +1 -1
- package/dist/cjs/ix-textarea.cjs.entry.js +2 -2
- package/dist/cjs/{validation-190c7a84.js → validation-f917b33d.js} +2 -1
- package/dist/cjs/validation-f917b33d.js.map +1 -0
- package/dist/collection/components/application-header/application-header.js +3 -4
- package/dist/collection/components/application-header/application-header.js.map +1 -1
- package/dist/collection/components/drawer/drawer.css +0 -1
- package/dist/collection/components/utils/input/validation.js +1 -0
- package/dist/collection/components/utils/input/validation.js.map +1 -1
- package/dist/esm/{input.util-0475b865.js → input.util-0c139612.js} +2 -2
- package/dist/esm/{input.util-0475b865.js.map → input.util-0c139612.js.map} +1 -1
- package/dist/esm/ix-application-header.entry.js +3 -4
- package/dist/esm/ix-application-header.entry.js.map +1 -1
- package/dist/esm/ix-checkbox-group.entry.js +1 -1
- package/dist/esm/ix-checkbox.entry.js +1 -1
- package/dist/esm/ix-custom-field.entry.js +1 -1
- package/dist/esm/ix-date-input.entry.js +2 -2
- package/dist/esm/ix-drawer.entry.js +1 -1
- package/dist/esm/ix-drawer.entry.js.map +1 -1
- package/dist/esm/ix-field-label_2.entry.js +1 -1
- package/dist/esm/ix-helper-text.entry.js +1 -1
- package/dist/esm/ix-input.entry.js +2 -2
- package/dist/esm/ix-number-input.entry.js +2 -2
- package/dist/esm/ix-radio-group.entry.js +1 -1
- package/dist/esm/ix-select.entry.js +1 -1
- package/dist/esm/ix-textarea.entry.js +2 -2
- package/dist/esm/{validation-8c30a49b.js → validation-0bc90f82.js} +2 -1
- package/dist/esm/validation-0bc90f82.js.map +1 -0
- package/dist/siemens-ix/{p-14600cc1.entry.js → p-00579239.entry.js} +2 -2
- package/dist/siemens-ix/{p-8fd85ca3.entry.js → p-278c0495.entry.js} +2 -2
- package/dist/siemens-ix/p-2f450062.entry.js +2 -0
- package/dist/siemens-ix/p-2f450062.entry.js.map +1 -0
- package/dist/siemens-ix/{p-52320e1a.entry.js → p-880fabd1.entry.js} +2 -2
- package/dist/siemens-ix/{p-c5908bd1.entry.js → p-a01a79dc.entry.js} +2 -2
- package/dist/siemens-ix/p-a36a5376.entry.js +2 -0
- package/dist/siemens-ix/p-a36a5376.entry.js.map +1 -0
- package/dist/siemens-ix/{p-ece2b51c.entry.js → p-a677c9b7.entry.js} +2 -2
- package/dist/siemens-ix/{p-ccd19790.entry.js → p-aeacf0af.entry.js} +2 -2
- package/dist/siemens-ix/p-bf21e93a.js +2 -0
- package/dist/siemens-ix/{p-2afe3e27.js → p-cf6ae656.js} +2 -2
- package/dist/siemens-ix/p-cf6ae656.js.map +1 -0
- package/dist/siemens-ix/{p-366ffd65.entry.js → p-db44269c.entry.js} +2 -2
- package/dist/siemens-ix/{p-67e6dbcb.entry.js → p-e366946a.entry.js} +2 -2
- package/dist/siemens-ix/{p-7d5da89d.entry.js → p-ece55b76.entry.js} +2 -2
- package/dist/siemens-ix/{p-c9373966.entry.js → p-f051760c.entry.js} +2 -2
- package/dist/siemens-ix/{p-5d0353d3.entry.js → p-f937ad39.entry.js} +2 -2
- package/dist/siemens-ix/siemens-ix.esm.js +1 -1
- package/hydrate/index.js +5 -5
- package/hydrate/index.mjs +5 -5
- package/package.json +1 -1
- package/components/p-195f3939.js.map +0 -1
- package/components/p-383f1dc5.js.map +0 -1
- package/dist/cjs/validation-190c7a84.js.map +0 -1
- package/dist/esm/validation-8c30a49b.js.map +0 -1
- package/dist/siemens-ix/p-2afe3e27.js.map +0 -1
- package/dist/siemens-ix/p-3b98cd89.entry.js +0 -2
- package/dist/siemens-ix/p-3b98cd89.entry.js.map +0 -1
- package/dist/siemens-ix/p-4b4437ec.js +0 -2
- package/dist/siemens-ix/p-e5a2d990.entry.js +0 -2
- package/dist/siemens-ix/p-e5a2d990.entry.js.map +0 -1
- /package/dist/siemens-ix/{p-14600cc1.entry.js.map → p-00579239.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-8fd85ca3.entry.js.map → p-278c0495.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-52320e1a.entry.js.map → p-880fabd1.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-c5908bd1.entry.js.map → p-a01a79dc.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-ece2b51c.entry.js.map → p-a677c9b7.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-ccd19790.entry.js.map → p-aeacf0af.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-4b4437ec.js.map → p-bf21e93a.js.map} +0 -0
- /package/dist/siemens-ix/{p-366ffd65.entry.js.map → p-db44269c.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-67e6dbcb.entry.js.map → p-e366946a.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-7d5da89d.entry.js.map → p-ece55b76.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-c9373966.entry.js.map → p-f051760c.entry.js.map} +0 -0
- /package/dist/siemens-ix/{p-5d0353d3.entry.js.map → p-f937ad39.entry.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
|
-
const validation = require('./validation-
|
|
6
|
+
const validation = require('./validation-f917b33d.js');
|
|
7
7
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
8
8
|
const a11y = require('./a11y-ae470f01.js');
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
|
-
const validation = require('./validation-
|
|
6
|
+
const validation = require('./validation-f917b33d.js');
|
|
7
7
|
|
|
8
8
|
const customFieldCss = ":host{display:block;width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content}";
|
|
9
9
|
const IxCustomFieldStyle0 = customFieldCss;
|
|
@@ -6,8 +6,8 @@ const index = require('./index-66ad733a.js');
|
|
|
6
6
|
const index$1 = require('./index-b44a6617.js');
|
|
7
7
|
const luxon = require('./luxon-702fbf4c.js');
|
|
8
8
|
const dropdownController = require('./dropdown-controller-aef51729.js');
|
|
9
|
-
const input_util = require('./input.util-
|
|
10
|
-
const validation = require('./validation-
|
|
9
|
+
const input_util = require('./input.util-622a9947.js');
|
|
10
|
+
const validation = require('./validation-f917b33d.js');
|
|
11
11
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
12
12
|
require('./a11y-ae470f01.js');
|
|
13
13
|
require('./mutation-observer-babb20a5.js');
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
6
|
const anime_es = require('./anime.es-e2814360.js');
|
|
7
7
|
|
|
8
|
-
const drawerCss = ":host{top:0;right:0;box-shadow:var(--theme-box-shadow-level-3);display:block;position:absolute;justify-content:flex-start;align-items:center;opacity:0;max-height:100vh;min-height:1.5rem;background-color:var(--theme-color-1);border-radius:0.25rem
|
|
8
|
+
const drawerCss = ":host{top:0;right:0;box-shadow:var(--theme-box-shadow-level-3);display:block;position:absolute;justify-content:flex-start;align-items:center;opacity:0;max-height:100vh;min-height:1.5rem;background-color:var(--theme-color-1);border-radius:0.25rem}:host *,:host *::after,:host *::before{box-sizing:border-box}:host ::-webkit-scrollbar-button{display:none}@-moz-document url-prefix(){:host *{scrollbar-color:var(--theme-scrollbar-thumb--background) var(--theme-scrollbar-track--background);scrollbar-width:thin}}:host ::-webkit-scrollbar{width:0.5rem;height:0.5rem}:host ::-webkit-scrollbar-track{border-radius:5px;background:var(--theme-scrollbar-track--background)}:host ::-webkit-scrollbar-track:hover{background:var(--theme-scrollbar-track--background--hover)}:host ::-webkit-scrollbar-thumb{border-radius:5px;background:var(--theme-scrollbar-thumb--background)}:host ::-webkit-scrollbar-thumb:hover{background:var(--theme-scrollbar-thumb--background--hover)}:host ::-webkit-scrollbar-corner{display:none}:host .drawer-container{z-index:100}:host .header{display:flex;position:relative;align-items:center;justify-content:flex-end;padding:0.5rem;width:100%;order:1}:host .header .header-content{flex-grow:1;margin-right:1rem}:host .content{position:relative;flex:1;order:2;height:100%;width:100%;overflow-y:auto}:host(.display-none){display:none}";
|
|
9
9
|
const IxDrawerStyle0 = drawerCss;
|
|
10
10
|
|
|
11
11
|
const Drawer = class {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"ix-drawer.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,SAAS,GAAG,q3CAAq3C,CAAC;AACx4C,uBAAe,SAAS;;MC0BX,MAAM;IALnB;;;;;;;QAS2B,SAAI,GAAG,KAAK,CAAC;;;;QAK9B,wBAAmB,GAAG,IAAI,CAAC;;;;QAK3B,eAAU,GAAG,KAAK,CAAC;;;;QAKnB,aAAQ,GAAG,EAAE,CAAC;;;;QAKd,aAAQ,GAAG,EAAE,CAAC;;;;QAKd,UAAK,GAAoB,IAAI,CAAC,QAAQ,CAAC;QAY/C,WAAM,GAAG,KAAK,CAAC;QAGP,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAGzC,gBAAW,GAAG,IAAI,CAAC;KA8K7B;IA3KC,aAAa,CAAC,QAAiB,EAAE,QAAkB;QACjD,IAAI,QAAQ,KAAK,QAAQ,EAAE;YACzB,OAAO;SACR;QAED,IAAI,CAAC,YAAY,CAAC,QAA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IAAI,EAAE,OAAO,EACb,IAAI,EAAC,IAAI,EACT,KAAK,QACL,OAAO,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,iBACxB,cAAc,GACV,CACd,EACNA,kEACE,KAAK,EAAC,SAAS,EACf,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,IAEDA,oEAAa,CACT,CACF,CACD,EACP;KACH;;;;;AAjLc,eAAQ,GAAG,GAAH,CAAO;;;;;","names":["anime","h","Host"],"sources":["src/components/drawer/drawer.scss?tag=ix-drawer&encapsulation=shadow","src/components/drawer/drawer.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n@import 'mixins/shadows';\n@import 'common-variables';\n\n:host {\n @include ix-component;\n\n top: 0;\n right: 0;\n @include box-shadow(3);\n\n display: block;\n position: absolute;\n justify-content: flex-start;\n align-items: center;\n opacity: 0;\n\n max-height: 100vh;\n min-height: $large-space;\n background-color: var(--theme-color-1);\n border-radius: $default-border-radius;\n\n transition: all var(--theme-medium-time) ease-out;\n\n .drawer-container {\n z-index: 100;\n }\n\n .header {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: flex-end;\n padding: 0.5rem;\n width: 100%;\n order: 1;\n\n .header-content {\n flex-grow: 1;\n margin-right: $default-space;\n }\n }\n\n .content {\n position: relative;\n flex: 1;\n order: 2;\n height: 100%;\n width: 100%;\n overflow-y: auto;\n }\n}\n\n:host(.display-none) {\n display: none;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport anime from 'animejs';\n\n@Component({\n tag: 'ix-drawer',\n styleUrl: 'drawer.scss',\n shadow: true,\n})\nexport class Drawer {\n /**\n * Show or hide the drawer\n */\n @Prop({ mutable: true }) show = false;\n\n /**\n * Fired in case of an outside click during drawer showed state\n */\n @Prop() closeOnClickOutside = true;\n\n /**\n * Render the drawer with maximum height\n */\n @Prop() fullHeight = false;\n\n /**\n * Min width interpreted as REM\n */\n @Prop() minWidth = 16;\n\n /**\n * Max width interpreted as REM\n */\n @Prop() maxWidth = 28;\n\n /**\n * Width interpreted as REM if not set to 'auto'\n */\n @Prop() width: number | 'auto' = this.minWidth;\n\n /**\n * Fire event after drawer is open\n */\n @Event() open!: EventEmitter;\n\n /**\n * Fire event after drawer is close\n */\n @Event() drawerClose!: EventEmitter;\n\n toggle = false;\n\n private static duration = 300;\n private callback = this.clickedOutside.bind(this);\n private divElement?: HTMLElement;\n\n @State() showContent = true;\n\n @Watch('show')\n onShowChanged(newValue: boolean, oldValue?: boolean) {\n if (newValue === oldValue) {\n return;\n }\n\n this.toggleDrawer(newValue);\n }\n\n /**\n * Toggle or define show state of drawer\n * @param show Overwrite toggle state with boolean\n */\n @Method()\n async toggleDrawer(show?: boolean): Promise<void> {\n show = show ?? !this.show;\n\n if (show) {\n const { defaultPrevented } = this.open.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = true;\n if (!this.toggle && this.divElement) {\n this.slideInRight(this.divElement);\n setTimeout(() => {\n window.addEventListener('mousedown', this.callback);\n }, Drawer.duration);\n }\n } else {\n const { defaultPrevented } = this.drawerClose.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = false;\n\n if (this.toggle && this.divElement) {\n this.slideOutRight(this.divElement);\n }\n\n window.removeEventListener('mousedown', this.callback);\n }\n\n this.toggle = this.show;\n\n return Promise.resolve();\n }\n\n private onCloseClicked() {\n this.toggleDrawer(false);\n }\n\n private clickedOutside(evt: any) {\n if (!this.closeOnClickOutside) {\n return;\n }\n\n const target = evt.target;\n const closestElement = target.closest('#div-container');\n const btn = target.closest('#drawer-btn');\n\n if (\n evt.target.type !== 'button' &&\n closestElement !== this.divElement &&\n target !== btn\n ) {\n this.show = false;\n }\n }\n\n private getConstrainedWidth(width: number) {\n return Math.min(Math.max(width, this.minWidth), this.maxWidth);\n }\n\n private slideOutRight(el: HTMLElement) {\n const initialWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [initialWidth, 0],\n opacity: [1, 0],\n easing: 'easeInSine',\n complete: () => {\n el.classList.add('display-none');\n },\n });\n }\n\n private slideInRight(el: HTMLElement) {\n const targetWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [0, targetWidth],\n opacity: [0, 1],\n easing: 'easeOutSine',\n begin: () => {\n el.classList.remove('display-none');\n },\n complete: () => {\n this.showContent = true;\n },\n });\n }\n\n componentDidLoad() {\n this.toggleDrawer(this.show);\n }\n\n render() {\n return (\n <Host\n class={{\n 'drawer-container': true,\n 'display-none': true,\n }}\n style={{\n width: '0',\n 'max-width': `${this.maxWidth}rem`,\n height: this.fullHeight ? '100%' : 'auto',\n overflow: 'hidden',\n }}\n ref={(el) => (this.divElement = el as HTMLElement)}\n data-testid=\"container\"\n id=\"div-container\"\n >\n <div\n style={{\n width:\n this.width === 'auto'\n ? 'auto'\n : `${this.getConstrainedWidth(this.width)}rem`,\n }}\n >\n <div class=\"header\">\n <div class=\"header-content\">\n <slot name=\"header\"></slot>\n </div>\n <ix-icon-button\n class=\"close-button\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n icon={'close'}\n size=\"24\"\n ghost\n onClick={() => this.onCloseClicked()}\n data-testid=\"close-button\"\n ></ix-icon-button>\n </div>\n <div\n class=\"content\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n >\n <slot></slot>\n </div>\n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,KAAK,EAAE,GAAG;gBACV,WAAW,EAAE,GAAG,IAAI,CAAC,QAAQ,KAAK;gBAClC,MAAM,EAAE,IAAI,CAAC,UAAU,GAAG,MAAM,GAAG,MAAM;gBACzC,QAAQ,EAAE,QAAQ;aACnB,EACD,GAAG,EAAE,CAAC,EAAE,MAAM,IAAI,CAAC,UAAU,GAAG,EAAiB,CAAC,iBACtC,WAAW,EACvB,EAAE,EAAC,eAAe,IAElBD,kEACE,KAAK,EAAE;gBACL,KAAK,EACH,IAAI,CAAC,KAAK,KAAK,MAAM;sBACjB,MAAM;sBACN,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;aACnD,IAEDA,kEAAK,KAAK,EAAC,QAAQ,IACjBA,kEAAK,KAAK,EAAC,gBAAgB,IACzBA,mEAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,EACNA,6EACE,KAAK,EAAC,cAAc,EACpB,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,EACD,IAAI,EAAE,OAAO,EACb,IAAI,EAAC,IAAI,EACT,KAAK,QACL,OAAO,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,iBACxB,cAAc,GACV,CACd,EACNA,kEACE,KAAK,EAAC,SAAS,EACf,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,WAAW,GAAG,OAAO,GAAG,MAAM;aAC7C,IAEDA,oEAAa,CACT,CACF,CACD,EACP;KACH;;;;;AAjLc,eAAQ,GAAG,GAAH,CAAO;;;;;","names":["anime","h","Host"],"sources":["src/components/drawer/drawer.scss?tag=ix-drawer&encapsulation=shadow","src/components/drawer/drawer.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n@import 'mixins/shadows';\n@import 'common-variables';\n\n:host {\n @include ix-component;\n\n top: 0;\n right: 0;\n @include box-shadow(3);\n\n display: block;\n position: absolute;\n justify-content: flex-start;\n align-items: center;\n opacity: 0;\n\n max-height: 100vh;\n min-height: $large-space;\n background-color: var(--theme-color-1);\n border-radius: $default-border-radius;\n\n .drawer-container {\n z-index: 100;\n }\n\n .header {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: flex-end;\n padding: 0.5rem;\n width: 100%;\n order: 1;\n\n .header-content {\n flex-grow: 1;\n margin-right: $default-space;\n }\n }\n\n .content {\n position: relative;\n flex: 1;\n order: 2;\n height: 100%;\n width: 100%;\n overflow-y: auto;\n }\n}\n\n:host(.display-none) {\n display: none;\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport anime from 'animejs';\n\n@Component({\n tag: 'ix-drawer',\n styleUrl: 'drawer.scss',\n shadow: true,\n})\nexport class Drawer {\n /**\n * Show or hide the drawer\n */\n @Prop({ mutable: true }) show = false;\n\n /**\n * Fired in case of an outside click during drawer showed state\n */\n @Prop() closeOnClickOutside = true;\n\n /**\n * Render the drawer with maximum height\n */\n @Prop() fullHeight = false;\n\n /**\n * Min width interpreted as REM\n */\n @Prop() minWidth = 16;\n\n /**\n * Max width interpreted as REM\n */\n @Prop() maxWidth = 28;\n\n /**\n * Width interpreted as REM if not set to 'auto'\n */\n @Prop() width: number | 'auto' = this.minWidth;\n\n /**\n * Fire event after drawer is open\n */\n @Event() open!: EventEmitter;\n\n /**\n * Fire event after drawer is close\n */\n @Event() drawerClose!: EventEmitter;\n\n toggle = false;\n\n private static duration = 300;\n private callback = this.clickedOutside.bind(this);\n private divElement?: HTMLElement;\n\n @State() showContent = true;\n\n @Watch('show')\n onShowChanged(newValue: boolean, oldValue?: boolean) {\n if (newValue === oldValue) {\n return;\n }\n\n this.toggleDrawer(newValue);\n }\n\n /**\n * Toggle or define show state of drawer\n * @param show Overwrite toggle state with boolean\n */\n @Method()\n async toggleDrawer(show?: boolean): Promise<void> {\n show = show ?? !this.show;\n\n if (show) {\n const { defaultPrevented } = this.open.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = true;\n if (!this.toggle && this.divElement) {\n this.slideInRight(this.divElement);\n setTimeout(() => {\n window.addEventListener('mousedown', this.callback);\n }, Drawer.duration);\n }\n } else {\n const { defaultPrevented } = this.drawerClose.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n this.show = false;\n\n if (this.toggle && this.divElement) {\n this.slideOutRight(this.divElement);\n }\n\n window.removeEventListener('mousedown', this.callback);\n }\n\n this.toggle = this.show;\n\n return Promise.resolve();\n }\n\n private onCloseClicked() {\n this.toggleDrawer(false);\n }\n\n private clickedOutside(evt: any) {\n if (!this.closeOnClickOutside) {\n return;\n }\n\n const target = evt.target;\n const closestElement = target.closest('#div-container');\n const btn = target.closest('#drawer-btn');\n\n if (\n evt.target.type !== 'button' &&\n closestElement !== this.divElement &&\n target !== btn\n ) {\n this.show = false;\n }\n }\n\n private getConstrainedWidth(width: number) {\n return Math.min(Math.max(width, this.minWidth), this.maxWidth);\n }\n\n private slideOutRight(el: HTMLElement) {\n const initialWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [initialWidth, 0],\n opacity: [1, 0],\n easing: 'easeInSine',\n complete: () => {\n el.classList.add('display-none');\n },\n });\n }\n\n private slideInRight(el: HTMLElement) {\n const targetWidth = `${this.getConstrainedWidth(\n this.width === 'auto' ? this.minWidth : this.width\n )}rem`;\n\n anime({\n targets: el,\n duration: Drawer.duration,\n width: [0, targetWidth],\n opacity: [0, 1],\n easing: 'easeOutSine',\n begin: () => {\n el.classList.remove('display-none');\n },\n complete: () => {\n this.showContent = true;\n },\n });\n }\n\n componentDidLoad() {\n this.toggleDrawer(this.show);\n }\n\n render() {\n return (\n <Host\n class={{\n 'drawer-container': true,\n 'display-none': true,\n }}\n style={{\n width: '0',\n 'max-width': `${this.maxWidth}rem`,\n height: this.fullHeight ? '100%' : 'auto',\n overflow: 'hidden',\n }}\n ref={(el) => (this.divElement = el as HTMLElement)}\n data-testid=\"container\"\n id=\"div-container\"\n >\n <div\n style={{\n width:\n this.width === 'auto'\n ? 'auto'\n : `${this.getConstrainedWidth(this.width)}rem`,\n }}\n >\n <div class=\"header\">\n <div class=\"header-content\">\n <slot name=\"header\"></slot>\n </div>\n <ix-icon-button\n class=\"close-button\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n icon={'close'}\n size=\"24\"\n ghost\n onClick={() => this.onCloseClicked()}\n data-testid=\"close-button\"\n ></ix-icon-button>\n </div>\n <div\n class=\"content\"\n style={{\n display: this.showContent ? 'block' : 'none',\n }}\n >\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
6
|
const a11y = require('./a11y-ae470f01.js');
|
|
7
7
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
8
|
-
const validation = require('./validation-
|
|
8
|
+
const validation = require('./validation-f917b33d.js');
|
|
9
9
|
const helperTextUtil = require('./helper-text-util-ad0196c0.js');
|
|
10
10
|
require('./index-b44a6617.js');
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
|
-
const validation = require('./validation-
|
|
6
|
+
const validation = require('./validation-f917b33d.js');
|
|
7
7
|
const helperTextUtil = require('./helper-text-util-ad0196c0.js');
|
|
8
8
|
require('./index-b44a6617.js');
|
|
9
9
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
6
|
const index$1 = require('./index-b44a6617.js');
|
|
7
|
-
const validation = require('./validation-
|
|
7
|
+
const validation = require('./validation-f917b33d.js');
|
|
8
8
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
9
|
-
const input_util = require('./input.util-
|
|
9
|
+
const input_util = require('./input.util-622a9947.js');
|
|
10
10
|
require('./a11y-ae470f01.js');
|
|
11
11
|
require('./mutation-observer-babb20a5.js');
|
|
12
12
|
require('./rwd.util-ee53cbd1.js');
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
6
|
const index$1 = require('./index-b44a6617.js');
|
|
7
|
-
const validation = require('./validation-
|
|
7
|
+
const validation = require('./validation-f917b33d.js');
|
|
8
8
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
9
|
-
const input_util = require('./input.util-
|
|
9
|
+
const input_util = require('./input.util-622a9947.js');
|
|
10
10
|
require('./a11y-ae470f01.js');
|
|
11
11
|
require('./mutation-observer-babb20a5.js');
|
|
12
12
|
require('./rwd.util-ee53cbd1.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
|
-
const validation = require('./validation-
|
|
6
|
+
const validation = require('./validation-f917b33d.js');
|
|
7
7
|
|
|
8
8
|
const radioGroupCss = ":host{display:inline-block;position:relative}:host .checkbox-container{display:flex;flex-direction:column;gap:1rem;margin:0.375rem 0;flex-wrap:wrap}:host .checkbox-container.row-layout{flex-direction:row}";
|
|
9
9
|
const IxRadioGroupStyle0 = radioGroupCss;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
6
|
const a11y = require('./a11y-ae470f01.js');
|
|
7
7
|
const focus = require('./focus-935fb067.js');
|
|
8
|
-
const validation = require('./validation-
|
|
8
|
+
const validation = require('./validation-f917b33d.js');
|
|
9
9
|
const listener = require('./listener-5db5521a.js');
|
|
10
10
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
11
11
|
const mutationObserver = require('./mutation-observer-babb20a5.js');
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-66ad733a.js');
|
|
6
|
-
const validation = require('./validation-
|
|
6
|
+
const validation = require('./validation-f917b33d.js');
|
|
7
7
|
const makeRef = require('./make-ref-499e1e41.js');
|
|
8
|
-
const input_util = require('./input.util-
|
|
8
|
+
const input_util = require('./input.util-622a9947.js');
|
|
9
9
|
require('./a11y-ae470f01.js');
|
|
10
10
|
require('./mutation-observer-babb20a5.js');
|
|
11
11
|
require('./rwd.util-ee53cbd1.js');
|
|
@@ -105,6 +105,7 @@ function HookValidationLifecycle(options) {
|
|
|
105
105
|
if (host && checkIfRequiredFunction) {
|
|
106
106
|
host.removeEventListener('valueChange', checkIfRequiredFunction);
|
|
107
107
|
host.removeEventListener('ixBlur', checkIfRequiredFunction);
|
|
108
|
+
checkIfRequiredFunction = null;
|
|
108
109
|
}
|
|
109
110
|
return disconnectedCallback === null || disconnectedCallback === void 0 ? void 0 : disconnectedCallback.call(this);
|
|
110
111
|
};
|
|
@@ -116,4 +117,4 @@ exports.checkFieldClasses = checkFieldClasses;
|
|
|
116
117
|
exports.createClassMutationObserver = createClassMutationObserver;
|
|
117
118
|
exports.shouldSuppressInternalValidation = shouldSuppressInternalValidation;
|
|
118
119
|
|
|
119
|
-
//# sourceMappingURL=validation-
|
|
120
|
+
//# sourceMappingURL=validation-f917b33d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"validation-f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AC,CAAC;YAE9B,IAAI,IAAI,IAAI,qBAAqB,EAAE;gBACjC,qBAAqB,CAAC,OAAO,EAAE,CAAC;gBAChC,qBAAqB,GAAG,IAAI,CAAC;aAC9B;YAED,IAAI,IAAI,IAAI,uBAAuB,EAAE;gBACnC,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;gBACjE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;gBAC5D,uBAAuB,GAAG,IAAI,CAAC;aAChC;YAED,OAAO,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC;SACzC,CAAC;KACH,CAAC;AACJ;;;;;;;","names":["getElement"],"sources":["src/components/utils/input/validation.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getElement } from '@stencil/core';\nimport { HTMLIxFormComponentElement, IxFormComponent } from '.';\nimport { IxComponent } from '../internal';\n\nexport type ClassMutationObserver = {\n destroy: () => void;\n};\n\nexport async function isTouched<T>(host: IxFormComponent<T>) {\n if (typeof host.isTouched === 'function') {\n return host.isTouched();\n }\n}\n\nexport async function shouldSuppressInternalValidation<T>(\n host: IxFormComponent<T>\n) {\n if (\n host.getAssociatedFormElement &&\n typeof host.getAssociatedFormElement === 'function'\n ) {\n const form = await host.getAssociatedFormElement();\n\n if (!form) {\n return false;\n }\n\n return form.noValidate;\n }\n\n return false;\n}\n\nexport function createClassMutationObserver(\n element: HTMLElement,\n callback: () => void,\n options?: {\n includeChildren?: boolean;\n }\n): ClassMutationObserver {\n const observer = new MutationObserver(callback);\n observer.observe(element, {\n subtree: options?.includeChildren,\n childList: options?.includeChildren,\n attributes: true,\n attributeFilter: ['class'],\n });\n\n return {\n destroy() {\n observer.disconnect();\n },\n };\n}\n\nexport type ValidationResultProperty =\n | 'isInvalid'\n | 'isInvalidByRequired'\n | 'isValid'\n | 'isInfo'\n | 'isWarning';\nexport type ValidationResults = Record<ValidationResultProperty, boolean>;\n\nfunction containsClass(\n hostElement: HTMLIxFormComponentElement<unknown>,\n className: string,\n includeChildren: boolean\n) {\n return (\n hostElement.classList.contains(`${className}`) ||\n (includeChildren ? !!hostElement.querySelector(`.${className}`) : false)\n );\n}\n\nexport function checkFieldClasses(\n hostElement: HTMLIxFormComponentElement<unknown>,\n includeChildren = false\n): ValidationResults {\n return {\n isInvalid: containsClass(hostElement, 'ix-invalid', includeChildren),\n isInvalidByRequired: containsClass(\n hostElement,\n 'ix-invalid--required',\n includeChildren\n ),\n isValid: containsClass(hostElement, 'ix-valid', includeChildren),\n isInfo: containsClass(hostElement, 'ix-info', includeChildren),\n isWarning: containsClass(hostElement, 'ix-warning', includeChildren),\n };\n}\n\nexport function HookValidationLifecycle(options?: {\n includeChildren?: boolean;\n}) {\n return (proto: IxComponent, methodName: string) => {\n let checkIfRequiredFunction: (() => Promise<void>) | null;\n let classMutationObserver: ClassMutationObserver | null;\n const { componentWillLoad, disconnectedCallback, connectedCallback } =\n proto;\n\n proto.connectedCallback = function () {\n const host = getElement(\n this\n ) as unknown as HTMLIxFormComponentElement<unknown>;\n\n checkIfRequiredFunction = async () => {\n const skipValidation = await shouldSuppressInternalValidation(host);\n if (skipValidation) {\n return;\n }\n\n if (host.hasValidValue && typeof host.hasValidValue === 'function') {\n const hasValue = await host.hasValidValue();\n const touched = await isTouched(host);\n if (host.required) {\n host.classList.toggle('ix-invalid--required', !hasValue && touched);\n } else {\n host.classList.remove('ix-invalid--required');\n }\n }\n\n if (\n host.getValidityState &&\n typeof host.getValidityState === 'function'\n ) {\n const validityState = await host.getValidityState();\n\n host.classList.toggle(\n `ix-invalid--validity-patternMismatch`,\n validityState.patternMismatch\n );\n }\n };\n\n host.addEventListener('valueChange', checkIfRequiredFunction);\n host.addEventListener('ixBlur', checkIfRequiredFunction);\n setTimeout(checkIfRequiredFunction);\n return connectedCallback?.call(this);\n };\n\n proto.componentWillLoad = function () {\n const host = getElement(\n this\n ) as unknown as HTMLIxFormComponentElement<unknown>;\n classMutationObserver = createClassMutationObserver(\n host,\n () => {\n const result = checkFieldClasses(host, options?.includeChildren);\n proto[methodName].call(this, result);\n },\n options\n );\n const result = checkFieldClasses(host, options?.includeChildren);\n proto[methodName].call(this, result);\n return componentWillLoad?.call(this);\n };\n\n proto.disconnectedCallback = function () {\n const host = getElement(this);\n\n if (host && classMutationObserver) {\n classMutationObserver.destroy();\n classMutationObserver = null;\n }\n\n if (host && checkIfRequiredFunction) {\n host.removeEventListener('valueChange', checkIfRequiredFunction);\n host.removeEventListener('ixBlur', checkIfRequiredFunction);\n checkIfRequiredFunction = null;\n }\n\n return disconnectedCallback?.call(this);\n };\n };\n}\n"],"version":3}
|
|
@@ -82,7 +82,6 @@ export class ApplicationHeader {
|
|
|
82
82
|
}
|
|
83
83
|
async attachSiemensLogoIfLoaded() {
|
|
84
84
|
var _a;
|
|
85
|
-
await window.customElements.whenDefined('ix-siemens-logo');
|
|
86
85
|
const logoElement = document.createElement('ix-siemens-logo');
|
|
87
86
|
if (!this.isLogoSlotted()) {
|
|
88
87
|
(_a = this.hostElement
|
|
@@ -138,12 +137,12 @@ export class ApplicationHeader {
|
|
|
138
137
|
const showApplicationSwitch = ((_a = this.applicationLayoutContext) === null || _a === void 0 ? void 0 : _a.appSwitchConfig) &&
|
|
139
138
|
this.breakpoint !== 'sm' &&
|
|
140
139
|
this.suppressResponsive === false;
|
|
141
|
-
return (h(Host, { key: '
|
|
140
|
+
return (h(Host, { key: '99c3340b760fe51621bfdd8390f8a78781d8ec2f', class: {
|
|
142
141
|
[`breakpoint-${this.breakpoint}`]: true,
|
|
143
|
-
}, slot: "application-header" }, (this.showMenu || showMenuByApplicationFrame) && (h("ix-menu-expand-icon", { key: '
|
|
142
|
+
}, slot: "application-header" }, (this.showMenu || showMenuByApplicationFrame) && (h("ix-menu-expand-icon", { key: '8c8e4c9ea5e5ffdedca71b413ab5ae272ec4cb2e', onClick: () => this.onMenuClick(), expanded: this.menuExpanded })), showApplicationSwitch && (h("ix-icon-button", { key: '1aaa76f6966e05ab9167c3d76129056323d95254', onClick: () => this.showAppSwitch(), icon: "apps", ghost: true, class: "app-switch" })), h("div", { key: '906798cca10aa839cc921c61c68dab394ab93b0e', class: { logo: true } }, h("slot", { key: 'b768d941698bf4a1e769d232dfeffdbf73d67cff', name: "logo" })), h("ix-typography", { key: 'b3a4aa2965702f9fc7c55ff28e6faf14fd7dedc5', format: "body-lg", class: "name" }, this.name), h("div", { key: '2db8a72304dba6df3bab501855f991241baecf19', class: "content" }, this.breakpoint === 'sm' ? (h(Fragment, null, h("ix-icon-button", { class: {
|
|
144
143
|
['context-menu']: true,
|
|
145
144
|
['context-menu-visible']: this.hasSlottedElements,
|
|
146
|
-
}, "data-context-menu": true, icon: "more-menu", ghost: true }), h("ix-dropdown", { "data-overflow-dropdown": true, class: "dropdown", discoverAllSubmenus: true, trigger: this.resolveContextMenuButton() }, h("div", { class: "dropdown-content", onClick: (e) => this.onContentBgClick(e) }, h("slot", { onSlotchange: () => this.updateIsSlottedContent() }))))) : (h("slot", { onSlotchange: () => this.updateIsSlottedContent() })), h("slot", { key: '
|
|
145
|
+
}, "data-context-menu": true, icon: "more-menu", ghost: true }), h("ix-dropdown", { "data-overflow-dropdown": true, class: "dropdown", discoverAllSubmenus: true, trigger: this.resolveContextMenuButton() }, h("div", { class: "dropdown-content", onClick: (e) => this.onContentBgClick(e) }, h("slot", { onSlotchange: () => this.updateIsSlottedContent() }))))) : (h("slot", { onSlotchange: () => this.updateIsSlottedContent() })), h("slot", { key: 'f34d3cd4b5bb06bdeb4e4473adc677b8811a2101', name: "ix-application-header-avatar" }))));
|
|
147
146
|
}
|
|
148
147
|
static get is() { return "ix-application-header"; }
|
|
149
148
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-header.js","sourceRoot":"","sources":["../../../src/components/application-header/application-header.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,QAAQ,EACR,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,wBAAwB,GAEzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAe,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD;;GAEG;AAMH,MAAM,OAAO,iBAAiB;IAL9B;QAaE;;;;;;;WAOG;QACsB,aAAQ,GAAa,KAAK,CAAC;QAgB3C,eAAU,GAAe,IAAI,CAAC;QAC9B,iBAAY,GAAG,KAAK,CAAC;QACrB,uBAAkB,GAAG,KAAK,CAAC;QAE3B,uBAAkB,GAAG,KAAK,CAAC;KAuOrC;IA3NC,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,UAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACzE,CAAC;IAED,iBAAiB;QACf,kBAAkB,CAChB,IAAI,CAAC,WAAW,EAChB,wBAAwB,EACxB,CAAC,GAAG,EAAE,EAAE;YACN,IAAI,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,MAAK,gBAAgB,EAAE,CAAC;gBACnC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;gBACvB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,UAAU,GAAG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;;;;CACF","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n Fragment,\n h,\n Host,\n Prop,\n readTask,\n State,\n Watch,\n} from '@stencil/core';\nimport { showAppSwitch } from '../utils/app-switch';\nimport { applicationLayoutService } from '../utils/application-layout';\nimport {\n ApplicationLayoutContext,\n AppSwitchConfiguration,\n} from '../utils/application-layout/context';\nimport { Breakpoint } from '../utils/breakpoints';\nimport { ContextType, useContextConsumer } from '../utils/context';\nimport { menuController } from '../utils/menu-service/menu-service';\nimport { hasSlottedElements } from '../utils/shadow-dom';\nimport { Disposable } from '../utils/typed-event';\n\n/**\n * @slot logo - Location of the logo\n */\n@Component({\n tag: 'ix-application-header',\n styleUrl: 'application-header.scss',\n shadow: true,\n})\nexport class ApplicationHeader {\n @Element() hostElement!: HTMLIxApplicationHeaderElement;\n\n /**\n * Application name\n */\n @Prop() name?: string;\n\n /**\n * Controls the visibility of the menu toggle button based on the context of the application header.\n *\n * When the application header is utilized outside the application frame, the menu toggle button is displayed.\n * Conversely, if the header is within the application frame, this property is ineffective.\n *\n * @since 2.5.0\n */\n @Prop({ mutable: true }) showMenu?: boolean = false;\n\n /**\n * Event emitted when the menu toggle button is clicked\n *\n * @since 2.5.0\n */\n @Event() menuToggle!: EventEmitter<boolean>;\n\n /**\n * Event emitted when the app switch button is clicked\n *\n * @since 3.0.0\n */\n @Event() openAppSwitch!: EventEmitter<void>;\n\n @State() breakpoint: Breakpoint = 'lg';\n @State() menuExpanded = false;\n @State() suppressResponsive = false;\n\n @State() hasSlottedElements = false;\n\n private menuDisposable?: Disposable;\n private modeDisposable?: Disposable;\n private callbackUpdateAppSwitchModal?: (\n config: AppSwitchConfiguration\n ) => void;\n\n @State() applicationLayoutContext?: ContextType<\n typeof ApplicationLayoutContext\n >;\n\n get contentBackground() {\n return this.hostElement.shadowRoot!.querySelector('.dropdown-content');\n }\n\n componentWillLoad() {\n useContextConsumer(\n this.hostElement,\n ApplicationLayoutContext,\n (ctx) => {\n if (ctx?.host === 'map-navigation') {\n this.suppressResponsive = true;\n this.breakpoint = 'md';\n return;\n }\n\n this.breakpoint = applicationLayoutService.breakpoint;\n this.applicationLayoutContext = ctx;\n\n this.tryUpdateAppSwitch();\n },\n true\n );\n\n this.menuDisposable = menuController.expandChange.on((show) => {\n this.menuExpanded = show;\n });\n\n this.modeDisposable = applicationLayoutService.onChange.on((mode) => {\n if (this.suppressResponsive) {\n return;\n }\n\n this.breakpoint = mode;\n });\n\n this.updateIsSlottedContent();\n }\n\n componentDidLoad() {\n this.attachSiemensLogoIfLoaded();\n }\n\n disconnectedCallback() {\n this.menuDisposable?.dispose();\n this.modeDisposable?.dispose();\n }\n\n @Watch('applicationLayoutContext')\n watchApplicationLayoutContext() {\n if (this.applicationLayoutContext) {\n this.showMenu = false;\n }\n }\n @Watch('suppressResponsive')\n watchSuppressResponsive() {\n this.breakpoint = 'md';\n }\n\n private isLogoSlotted() {\n const slotElement = this.hostElement.shadowRoot!.querySelector(\n 'slot[name=\"logo\"]'\n ) as HTMLSlotElement;\n const nodes = slotElement.assignedNodes({\n flatten: true,\n });\n\n return nodes.length !== 0;\n }\n\n private async attachSiemensLogoIfLoaded() {\n await window.customElements.whenDefined('ix-siemens-logo');\n const logoElement = document.createElement('ix-siemens-logo');\n if (!this.isLogoSlotted()) {\n this.hostElement\n .shadowRoot!.querySelector('.logo')\n ?.appendChild(logoElement);\n }\n }\n\n private async onMenuClick() {\n if (this.applicationLayoutContext) {\n menuController.toggle();\n } else {\n this.menuExpanded = !this.menuExpanded;\n }\n\n this.menuToggle.emit(this.menuExpanded);\n }\n\n private resolveContextMenuButton() {\n return new Promise<HTMLElement>((resolve) =>\n readTask(() =>\n resolve(\n this.hostElement.shadowRoot!.querySelector(\n '[data-context-menu]'\n ) as HTMLElement\n )\n )\n );\n }\n\n private tryUpdateAppSwitch() {\n if (\n !this.callbackUpdateAppSwitchModal ||\n !this.applicationLayoutContext?.appSwitchConfig\n ) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private async showAppSwitch() {\n const { defaultPrevented } = this.openAppSwitch.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n if (!this.applicationLayoutContext?.appSwitchConfig) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal = await showAppSwitch(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private updateIsSlottedContent() {\n const slotElement =\n this.hostElement.shadowRoot!.querySelector('.content slot');\n\n this.hasSlottedElements = hasSlottedElements(slotElement);\n }\n\n private onContentBgClick(e: MouseEvent) {\n if (e.target === this.contentBackground) {\n e.preventDefault();\n }\n }\n\n render() {\n const hasApplicationContextAvailable = !!this.applicationLayoutContext;\n\n const showMenuByApplicationFrame =\n this.breakpoint === 'sm' &&\n this.suppressResponsive === false &&\n hasApplicationContextAvailable;\n\n const showApplicationSwitch =\n this.applicationLayoutContext?.appSwitchConfig &&\n this.breakpoint !== 'sm' &&\n this.suppressResponsive === false;\n\n return (\n <Host\n class={{\n [`breakpoint-${this.breakpoint}`]: true,\n }}\n slot=\"application-header\"\n >\n {(this.showMenu || showMenuByApplicationFrame) && (\n <ix-menu-expand-icon\n onClick={() => this.onMenuClick()}\n expanded={this.menuExpanded}\n ></ix-menu-expand-icon>\n )}\n {showApplicationSwitch && (\n <ix-icon-button\n onClick={() => this.showAppSwitch()}\n icon=\"apps\"\n ghost\n class=\"app-switch\"\n ></ix-icon-button>\n )}\n <div class={{ logo: true }}>\n <slot name=\"logo\"></slot>\n </div>\n <ix-typography format=\"body-lg\" class=\"name\">\n {this.name}\n </ix-typography>\n <div class=\"content\">\n {this.breakpoint === 'sm' ? (\n <Fragment>\n <ix-icon-button\n class={{\n ['context-menu']: true,\n ['context-menu-visible']: this.hasSlottedElements,\n }}\n data-context-menu\n icon=\"more-menu\"\n ghost\n ></ix-icon-button>\n <ix-dropdown\n data-overflow-dropdown\n class=\"dropdown\"\n discoverAllSubmenus\n trigger={this.resolveContextMenuButton()}\n >\n <div\n class=\"dropdown-content\"\n onClick={(e) => this.onContentBgClick(e)}\n >\n <slot\n onSlotchange={() => this.updateIsSlottedContent()}\n ></slot>\n </div>\n </ix-dropdown>\n </Fragment>\n ) : (\n <slot onSlotchange={() => this.updateIsSlottedContent()}></slot>\n )}\n <slot name=\"ix-application-header-avatar\"></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application-header.js","sourceRoot":"","sources":["../../../src/components/application-header/application-header.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,QAAQ,EACR,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,wBAAwB,GAEzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAe,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD;;GAEG;AAMH,MAAM,OAAO,iBAAiB;IAL9B;QAaE;;;;;;;WAOG;QACsB,aAAQ,GAAa,KAAK,CAAC;QAgB3C,eAAU,GAAe,IAAI,CAAC;QAC9B,iBAAY,GAAG,KAAK,CAAC;QACrB,uBAAkB,GAAG,KAAK,CAAC;QAE3B,uBAAkB,GAAG,KAAK,CAAC;KAsOrC;IA1NC,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,UAAW,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CACL,CACZ,CAAC,CAAC,CAAC,CACF,YAAM,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,GAAS,CACjE;gBACD,6DAAM,IAAI,EAAC,8BAA8B,GAAQ,CAC7C,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n Fragment,\n h,\n Host,\n Prop,\n readTask,\n State,\n Watch,\n} from '@stencil/core';\nimport { showAppSwitch } from '../utils/app-switch';\nimport { applicationLayoutService } from '../utils/application-layout';\nimport {\n ApplicationLayoutContext,\n AppSwitchConfiguration,\n} from '../utils/application-layout/context';\nimport { Breakpoint } from '../utils/breakpoints';\nimport { ContextType, useContextConsumer } from '../utils/context';\nimport { menuController } from '../utils/menu-service/menu-service';\nimport { hasSlottedElements } from '../utils/shadow-dom';\nimport { Disposable } from '../utils/typed-event';\n\n/**\n * @slot logo - Location of the logo\n */\n@Component({\n tag: 'ix-application-header',\n styleUrl: 'application-header.scss',\n shadow: true,\n})\nexport class ApplicationHeader {\n @Element() hostElement!: HTMLIxApplicationHeaderElement;\n\n /**\n * Application name\n */\n @Prop() name?: string;\n\n /**\n * Controls the visibility of the menu toggle button based on the context of the application header.\n *\n * When the application header is utilized outside the application frame, the menu toggle button is displayed.\n * Conversely, if the header is within the application frame, this property is ineffective.\n *\n * @since 2.5.0\n */\n @Prop({ mutable: true }) showMenu?: boolean = false;\n\n /**\n * Event emitted when the menu toggle button is clicked\n *\n * @since 2.5.0\n */\n @Event() menuToggle!: EventEmitter<boolean>;\n\n /**\n * Event emitted when the app switch button is clicked\n *\n * @since 3.0.0\n */\n @Event() openAppSwitch!: EventEmitter<void>;\n\n @State() breakpoint: Breakpoint = 'lg';\n @State() menuExpanded = false;\n @State() suppressResponsive = false;\n\n @State() hasSlottedElements = false;\n\n private menuDisposable?: Disposable;\n private modeDisposable?: Disposable;\n private callbackUpdateAppSwitchModal?: (\n config: AppSwitchConfiguration\n ) => void;\n\n @State() applicationLayoutContext?: ContextType<\n typeof ApplicationLayoutContext\n >;\n\n get contentBackground() {\n return this.hostElement.shadowRoot!.querySelector('.dropdown-content');\n }\n\n componentWillLoad() {\n useContextConsumer(\n this.hostElement,\n ApplicationLayoutContext,\n (ctx) => {\n if (ctx?.host === 'map-navigation') {\n this.suppressResponsive = true;\n this.breakpoint = 'md';\n return;\n }\n\n this.breakpoint = applicationLayoutService.breakpoint;\n this.applicationLayoutContext = ctx;\n\n this.tryUpdateAppSwitch();\n },\n true\n );\n\n this.menuDisposable = menuController.expandChange.on((show) => {\n this.menuExpanded = show;\n });\n\n this.modeDisposable = applicationLayoutService.onChange.on((mode) => {\n if (this.suppressResponsive) {\n return;\n }\n\n this.breakpoint = mode;\n });\n\n this.updateIsSlottedContent();\n }\n\n componentDidLoad() {\n this.attachSiemensLogoIfLoaded();\n }\n\n disconnectedCallback() {\n this.menuDisposable?.dispose();\n this.modeDisposable?.dispose();\n }\n\n @Watch('applicationLayoutContext')\n watchApplicationLayoutContext() {\n if (this.applicationLayoutContext) {\n this.showMenu = false;\n }\n }\n @Watch('suppressResponsive')\n watchSuppressResponsive() {\n this.breakpoint = 'md';\n }\n\n private isLogoSlotted() {\n const slotElement = this.hostElement.shadowRoot!.querySelector(\n 'slot[name=\"logo\"]'\n ) as HTMLSlotElement;\n const nodes = slotElement.assignedNodes({\n flatten: true,\n });\n\n return nodes.length !== 0;\n }\n\n private async attachSiemensLogoIfLoaded() {\n const logoElement = document.createElement('ix-siemens-logo');\n if (!this.isLogoSlotted()) {\n this.hostElement\n .shadowRoot!.querySelector('.logo')\n ?.appendChild(logoElement);\n }\n }\n\n private async onMenuClick() {\n if (this.applicationLayoutContext) {\n menuController.toggle();\n } else {\n this.menuExpanded = !this.menuExpanded;\n }\n\n this.menuToggle.emit(this.menuExpanded);\n }\n\n private resolveContextMenuButton() {\n return new Promise<HTMLElement>((resolve) =>\n readTask(() =>\n resolve(\n this.hostElement.shadowRoot!.querySelector(\n '[data-context-menu]'\n ) as HTMLElement\n )\n )\n );\n }\n\n private tryUpdateAppSwitch() {\n if (\n !this.callbackUpdateAppSwitchModal ||\n !this.applicationLayoutContext?.appSwitchConfig\n ) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private async showAppSwitch() {\n const { defaultPrevented } = this.openAppSwitch.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n if (!this.applicationLayoutContext?.appSwitchConfig) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal = await showAppSwitch(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private updateIsSlottedContent() {\n const slotElement =\n this.hostElement.shadowRoot!.querySelector('.content slot');\n\n this.hasSlottedElements = hasSlottedElements(slotElement);\n }\n\n private onContentBgClick(e: MouseEvent) {\n if (e.target === this.contentBackground) {\n e.preventDefault();\n }\n }\n\n render() {\n const hasApplicationContextAvailable = !!this.applicationLayoutContext;\n\n const showMenuByApplicationFrame =\n this.breakpoint === 'sm' &&\n this.suppressResponsive === false &&\n hasApplicationContextAvailable;\n\n const showApplicationSwitch =\n this.applicationLayoutContext?.appSwitchConfig &&\n this.breakpoint !== 'sm' &&\n this.suppressResponsive === false;\n\n return (\n <Host\n class={{\n [`breakpoint-${this.breakpoint}`]: true,\n }}\n slot=\"application-header\"\n >\n {(this.showMenu || showMenuByApplicationFrame) && (\n <ix-menu-expand-icon\n onClick={() => this.onMenuClick()}\n expanded={this.menuExpanded}\n ></ix-menu-expand-icon>\n )}\n {showApplicationSwitch && (\n <ix-icon-button\n onClick={() => this.showAppSwitch()}\n icon=\"apps\"\n ghost\n class=\"app-switch\"\n ></ix-icon-button>\n )}\n <div class={{ logo: true }}>\n <slot name=\"logo\"></slot>\n </div>\n <ix-typography format=\"body-lg\" class=\"name\">\n {this.name}\n </ix-typography>\n <div class=\"content\">\n {this.breakpoint === 'sm' ? (\n <Fragment>\n <ix-icon-button\n class={{\n ['context-menu']: true,\n ['context-menu-visible']: this.hasSlottedElements,\n }}\n data-context-menu\n icon=\"more-menu\"\n ghost\n ></ix-icon-button>\n <ix-dropdown\n data-overflow-dropdown\n class=\"dropdown\"\n discoverAllSubmenus\n trigger={this.resolveContextMenuButton()}\n >\n <div\n class=\"dropdown-content\"\n onClick={(e) => this.onContentBgClick(e)}\n >\n <slot\n onSlotchange={() => this.updateIsSlottedContent()}\n ></slot>\n </div>\n </ix-dropdown>\n </Fragment>\n ) : (\n <slot onSlotchange={() => this.updateIsSlottedContent()}></slot>\n )}\n <slot name=\"ix-application-header-avatar\"></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -102,6 +102,7 @@ export function HookValidationLifecycle(options) {
|
|
|
102
102
|
if (host && checkIfRequiredFunction) {
|
|
103
103
|
host.removeEventListener('valueChange', checkIfRequiredFunction);
|
|
104
104
|
host.removeEventListener('ixBlur', checkIfRequiredFunction);
|
|
105
|
+
checkIfRequiredFunction = null;
|
|
105
106
|
}
|
|
106
107
|
return disconnectedCallback === null || disconnectedCallback === void 0 ? void 0 : disconnectedCallback.call(this);
|
|
107
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../src/components/utils/input/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,IAAwB;IACzD,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QACzC,OAAO,IA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AO;QACL,SAAS,EAAE,aAAa,CAAC,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC;QACpE,mBAAmB,EAAE,aAAa,CAChC,WAAW,EACX,sBAAsB,EACtB,eAAe,CAChB;QACD,OAAO,EAAE,aAAa,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC;QAChE,MAAM,EAAE,aAAa,CAAC,WAAW,EAAE,SAAS,EAAE,eAAe,CAAC;QAC9D,SAAS,EAAE,aAAa,CAAC,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAEvC;IACC,OAAO,CAAC,KAAkB,EAAE,UAAkB,EAAE,EAAE;QAChD,IAAI,
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../src/components/utils/input/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,IAAwB;IACzD,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,IAAwB;IAExB,IACE,IAAI,CAAC,wBAAwB;QAC7B,OAAO,IAAI,CAAC,wBAAwB,KAAK,UAAU,EACnD,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEnD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAAoB,EACpB,QAAoB,EACpB,OAEC;IAED,MAAM,QAAQ,GAAG,IA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oB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getElement } from '@stencil/core';\nimport { HTMLIxFormComponentElement, IxFormComponent } from '.';\nimport { IxComponent } from '../internal';\n\nexport type ClassMutationObserver = {\n destroy: () => void;\n};\n\nexport async function isTouched<T>(host: IxFormComponent<T>) {\n if (typeof host.isTouched === 'function') {\n return host.isTouched();\n }\n}\n\nexport async function shouldSuppressInternalValidation<T>(\n host: IxFormComponent<T>\n) {\n if (\n host.getAssociatedFormElement &&\n typeof host.getAssociatedFormElement === 'function'\n ) {\n const form = await host.getAssociatedFormElement();\n\n if (!form) {\n return false;\n }\n\n return form.noValidate;\n }\n\n return false;\n}\n\nexport function createClassMutationObserver(\n element: HTMLElement,\n callback: () => void,\n options?: {\n includeChildren?: boolean;\n }\n): ClassMutationObserver {\n const observer = new MutationObserver(callback);\n observer.observe(element, {\n subtree: options?.includeChildren,\n childList: options?.includeChildren,\n attributes: true,\n attributeFilter: ['class'],\n });\n\n return {\n destroy() {\n observer.disconnect();\n },\n };\n}\n\nexport type ValidationResultProperty =\n | 'isInvalid'\n | 'isInvalidByRequired'\n | 'isValid'\n | 'isInfo'\n | 'isWarning';\nexport type ValidationResults = Record<ValidationResultProperty, boolean>;\n\nfunction containsClass(\n hostElement: HTMLIxFormComponentElement<unknown>,\n className: string,\n includeChildren: boolean\n) {\n return (\n hostElement.classList.contains(`${className}`) ||\n (includeChildren ? !!hostElement.querySelector(`.${className}`) : false)\n );\n}\n\nexport function checkFieldClasses(\n hostElement: HTMLIxFormComponentElement<unknown>,\n includeChildren = false\n): ValidationResults {\n return {\n isInvalid: containsClass(hostElement, 'ix-invalid', includeChildren),\n isInvalidByRequired: containsClass(\n hostElement,\n 'ix-invalid--required',\n includeChildren\n ),\n isValid: containsClass(hostElement, 'ix-valid', includeChildren),\n isInfo: containsClass(hostElement, 'ix-info', includeChildren),\n isWarning: containsClass(hostElement, 'ix-warning', includeChildren),\n };\n}\n\nexport function HookValidationLifecycle(options?: {\n includeChildren?: boolean;\n}) {\n return (proto: IxComponent, methodName: string) => {\n let checkIfRequiredFunction: (() => Promise<void>) | null;\n let classMutationObserver: ClassMutationObserver | null;\n const { componentWillLoad, disconnectedCallback, connectedCallback } =\n proto;\n\n proto.connectedCallback = function () {\n const host = getElement(\n this\n ) as unknown as HTMLIxFormComponentElement<unknown>;\n\n checkIfRequiredFunction = async () => {\n const skipValidation = await shouldSuppressInternalValidation(host);\n if (skipValidation) {\n return;\n }\n\n if (host.hasValidValue && typeof host.hasValidValue === 'function') {\n const hasValue = await host.hasValidValue();\n const touched = await isTouched(host);\n if (host.required) {\n host.classList.toggle('ix-invalid--required', !hasValue && touched);\n } else {\n host.classList.remove('ix-invalid--required');\n }\n }\n\n if (\n host.getValidityState &&\n typeof host.getValidityState === 'function'\n ) {\n const validityState = await host.getValidityState();\n\n host.classList.toggle(\n `ix-invalid--validity-patternMismatch`,\n validityState.patternMismatch\n );\n }\n };\n\n host.addEventListener('valueChange', checkIfRequiredFunction);\n host.addEventListener('ixBlur', checkIfRequiredFunction);\n setTimeout(checkIfRequiredFunction);\n return connectedCallback?.call(this);\n };\n\n proto.componentWillLoad = function () {\n const host = getElement(\n this\n ) as unknown as HTMLIxFormComponentElement<unknown>;\n classMutationObserver = createClassMutationObserver(\n host,\n () => {\n const result = checkFieldClasses(host, options?.includeChildren);\n proto[methodName].call(this, result);\n },\n options\n );\n const result = checkFieldClasses(host, options?.includeChildren);\n proto[methodName].call(this, result);\n return componentWillLoad?.call(this);\n };\n\n proto.disconnectedCallback = function () {\n const host = getElement(this);\n\n if (host && classMutationObserver) {\n classMutationObserver.destroy();\n classMutationObserver = null;\n }\n\n if (host && checkIfRequiredFunction) {\n host.removeEventListener('valueChange', checkIfRequiredFunction);\n host.removeEventListener('ixBlur', checkIfRequiredFunction);\n checkIfRequiredFunction = null;\n }\n\n return disconnectedCallback?.call(this);\n };\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from './index-3d8cca34.js';
|
|
2
2
|
import { a as a11yBoolean } from './a11y-b10c12e0.js';
|
|
3
|
-
import { s as shouldSuppressInternalValidation } from './validation-
|
|
3
|
+
import { s as shouldSuppressInternalValidation } from './validation-0bc90f82.js';
|
|
4
4
|
import { c as createMutationObserver } from './mutation-observer-db8757e6.js';
|
|
5
5
|
import { a as convertToRemString } from './rwd.util-d8e00a88.js';
|
|
6
6
|
import { a as anime } from './anime.es-a5520566.js';
|
|
@@ -199,4 +199,4 @@ function observeElementUntilVisible(hostElement, updateCallback) {
|
|
|
199
199
|
|
|
200
200
|
export { InputElement as I, SlotEnd as S, TextareaElement as T, addDisposableChangesAndVisibilityObservers as a, adjustPaddingForStartAndEnd as b, SlotStart as c, checkAllowedKeys as d, checkInternalValidity as e, getAriaAttributesForInput as g, mapValidationResult as m, onInputBlur as o };
|
|
201
201
|
|
|
202
|
-
//# sourceMappingURL=input.util-
|
|
202
|
+
//# sourceMappingURL=input.util-0c139612.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"input.util-0475b865.js","mappings":";;;;;;;AAAA;;;;;;;;SAYgB,eAAe,CAAC,KAmB/B;IACC,QACE,8BACE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,KAAK,CAAC,YAAY,EACxB,IAAI,EAAE,KAAK,CAAC,YAAY,EACxB,GAAG,EAAE,KAAK,CAAC,WAAW,EACtB,KAAK,EAAE;YACL,YAAY,EAAE,KAAK,CAAC,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AAC9B;;;;","names":[],"sources":["src/components/input/input.fc.tsx","src/components/input/input.animation.ts","src/components/input/input.util.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { h, FunctionalComponent } from '@stencil/core';\nimport { MakeRef } from '../utils/make-ref';\nimport { A11yAttributes } from '../utils/a11y';\n\nexport function TextareaElement(props: {\n resizeBehavior: 'both' | 'horizontal' | 'vertical' | 'none';\n textareaHeight?: string;\n textareaWidth?: string;\n textareaRows?: number;\n textareaCols?: number;\n disabled: boolean;\n readonly: boolean;\n maxLength?: number;\n minLength?: number;\n isInvalid: boolean;\n required: boolean;\n value: string;\n placeholder?: string;\n textAreaRef: (el: HTMLTextAreaElement | undefined) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <textarea\n readOnly={props.readonly}\n disabled={props.disabled}\n maxLength={props.maxLength}\n minLength={props.minLength}\n cols={props.textareaCols}\n rows={props.textareaRows}\n ref={props.textAreaRef}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n style={{\n resize: props.resizeBehavior,\n height: props.textareaHeight,\n width: props.textareaWidth,\n }}\n {...props.ariaAttributes}\n ></textarea>\n );\n}\n\nexport function InputElement(props: {\n id: string;\n disabled: boolean;\n readonly: boolean;\n maxLength?: string | number;\n minLength?: string | number;\n max?: string | number;\n min?: string | number;\n pattern?: string;\n type: string;\n isInvalid: boolean;\n required: boolean;\n value: string | number;\n placeholder?: string;\n inputRef: (el: HTMLInputElement | undefined) => void;\n onKeyPress: (event: KeyboardEvent) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <input\n id={props.id}\n autoComplete=\"off\"\n readOnly={props.readonly}\n disabled={props.disabled}\n min={props.min}\n max={props.max}\n maxLength={props.maxLength ? Number(props.maxLength) : undefined}\n minLength={props.maxLength ? Number(props.minLength) : undefined}\n ref={props.inputRef}\n pattern={props.pattern}\n type={props.type}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onKeyPress={(event) => props.onKeyPress(event)}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n {...props.ariaAttributes}\n ></input>\n );\n}\n\nexport const SlotEnd: FunctionalComponent<{\n slotEndRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props, children) => {\n return (\n <div class=\"end-container\" ref={props.slotEndRef}>\n <slot name=\"end\" onSlotchange={props.onSlotChange}></slot>\n {children}\n </div>\n );\n};\n\nexport const SlotStart: FunctionalComponent<{\n slotStartRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props) => {\n return (\n <div class=\"start-container\" ref={props.slotStartRef}>\n <slot name=\"start\" onSlotchange={props.onSlotChange}></slot>\n </div>\n );\n};\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport anime from 'animejs';\n\nexport function shakeInput(input: HTMLInputElement) {\n const xMax = 5;\n anime({\n targets: input,\n duration: 200,\n easing: 'easeInOutSine',\n loop: 2,\n translateX: [\n {\n value: xMax * -1,\n },\n {\n value: xMax,\n },\n {\n value: xMax / -2,\n },\n {\n value: xMax / 2,\n },\n {\n value: 0,\n },\n ],\n });\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { A11yAttributes, a11yBoolean } from '../utils/a11y';\nimport {\n IxFormComponent,\n IxInputFieldComponent,\n ValidationResults,\n shouldSuppressInternalValidation,\n} from '../utils/input';\nimport { createMutationObserver } from '../utils/mutation-observer';\nimport { convertToRemString } from '../utils/rwd.util';\nimport { generateUUID } from '../utils/uuid';\nimport { shakeInput } from './input.animation';\n\nexport function createIdIfNotExists(\n element: IxFormComponent,\n idPrefix: string = 'input'\n) {\n return element.hasAttribute('id')\n ? element.getAttribute('id')\n : `${idPrefix}-${generateUUID()}`;\n}\n\nexport function mapValidationResult<T>(\n ref: IxInputFieldComponent<T>,\n result: ValidationResults\n) {\n ref.isInvalid = result.isInvalid || result.isInvalidByRequired;\n ref.isValid = result.isValid;\n ref.isInfo = result.isInfo;\n ref.isWarning = result.isWarning;\n}\n\nexport function checkAllowedKeys<T>(\n comp: IxInputFieldComponent<T>,\n event: KeyboardEvent\n) {\n if (comp.allowedCharactersPattern) {\n const regex = new RegExp(comp.allowedCharactersPattern);\n if (!regex.test(event.key)) {\n event.preventDefault();\n shakeInput(comp.inputRef.current);\n }\n }\n}\n\nexport async function checkInternalValidity<T>(\n comp: IxFormComponent<T>,\n input: HTMLInputElement | HTMLTextAreaElement\n) {\n const validityState = input.validity;\n\n const eventResult = comp.validityStateChange.emit(validityState);\n\n if (eventResult.defaultPrevented) {\n return;\n }\n\n if (!comp.value) {\n return;\n }\n\n const skipValidation = await shouldSuppressInternalValidation(comp);\n if (skipValidation) {\n return;\n }\n\n const { valid } = validityState;\n comp.hostElement.classList.toggle('ix-invalid--validity-invalid', !valid);\n}\n\nexport function onInputBlur<T>(\n comp: IxFormComponent<T>,\n input?: HTMLInputElement | HTMLTextAreaElement | null\n) {\n comp.ixBlur.emit();\n\n if (!input) {\n throw new Error('Input element is not available');\n }\n\n input.setAttribute('data-ix-touched', 'true');\n checkInternalValidity(comp, input);\n}\n\nexport function applyPaddingEnd(\n inputElement: HTMLElement | null,\n width: number,\n options: {\n slotEnd: boolean;\n additionalPaddingRight?: string;\n }\n) {\n if (!inputElement) {\n return;\n }\n\n const remInPixels = 16;\n const padding = convertToRemString(width + remInPixels / 2);\n\n if (options.slotEnd) {\n inputElement.style.paddingRight = `calc(${padding} + ${\n options.additionalPaddingRight ?? '0rem'\n })`;\n } else {\n inputElement.style.paddingLeft = padding;\n }\n}\n\nexport function adjustPaddingForStartAndEnd(\n startElement: HTMLElement | null,\n endElement: HTMLElement | null,\n inputElement: HTMLElement | null\n) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (startElement) {\n const startBoundingRect = startElement.getBoundingClientRect();\n if (startBoundingRect) {\n applyPaddingEnd(inputElement, startBoundingRect.width, {\n slotEnd: false,\n });\n }\n }\n\n if (endElement) {\n const endBoundingRect = endElement.getBoundingClientRect();\n if (endBoundingRect) {\n applyPaddingEnd(inputElement, endBoundingRect.width, {\n slotEnd: true,\n });\n }\n }\n });\n });\n}\n\nexport function getAriaAttributesForInput(\n component: IxInputFieldComponent\n): A11yAttributes {\n const inputAria: A11yAttributes = {\n 'aria-invalid': `${a11yBoolean(component.isInvalid)}`,\n 'aria-required': `${a11yBoolean(component.required)}`,\n };\n\n if (component.isInvalid && component.invalidText) {\n inputAria['aria-errormessage'] = component.invalidText;\n }\n return inputAria;\n}\n\nexport type DisposableChangesAndVisibilityObservers = () => void;\n\nexport const addDisposableChangesAndVisibilityObservers = (\n element: HTMLElement,\n callback: () => void\n): DisposableChangesAndVisibilityObservers => {\n const intersectionObserver = observeElementUntilVisible(element, callback);\n const mutationObserver = createMutationObserver(callback);\n\n mutationObserver.observe(element, {\n subtree: true,\n attributes: true,\n });\n\n return () => {\n intersectionObserver.disconnect();\n mutationObserver.disconnect();\n };\n};\n\nfunction observeElementUntilVisible(\n hostElement: HTMLElement,\n updateCallback: () => void\n): IntersectionObserver {\n const intersectionObserver = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n updateCallback();\n }\n });\n });\n\n intersectionObserver.observe(hostElement);\n return intersectionObserver;\n}\n"],"version":3}
|
|
1
|
+
{"file":"input.util-0c139612.js","mappings":";;;;;;;AAAA;;;;;;;;SAYgB,eAAe,CAAC,KAmB/B;IACC,QACE,8BACE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,KAAK,CAAC,YAAY,EACxB,IAAI,EAAE,KAAK,CAAC,YAAY,EACxB,GAAG,EAAE,KAAK,CAAC,WAAW,EACtB,KAAK,EAAE;YACL,YAAY,EAAE,KAAK,CAAC,SAAS;SAC9B,EACD,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,OAAO,EAAE,CAAC,UAAU;YAClB,MAAM,MAAM,GAAG,UAAU,CAAC,MAA0B,CAAC;YACrD,KAAK,CAAC,uBAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjC,EACD,MAAM,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,EAC5B,KAAK,EAAE;YACL,MAAM,EAAE,KAAK,CAAC,cAAc;YAC5B,MAAM,EAAE,KAAK,CAAC,cAAc;YAC5B,KAAK,EAAE,KAAK,CAAC,aAAa;SAC3B,IACG,KAAK,CAAC,cAAc,EACd,EACZ;AACJ,CAAC;SAEe,YAAY,CAAC,KAoB5B;IACC,QACE,2BACE,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,YAAY,EAAC,KAAK,EAClB,QAAQ,EAAE,KAAK,C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gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE;QAChC,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,OAAO;QACL,oBAAoB,CAAC,UAAU,EAAE,CAAC;QAClC,gBAAgB,CAAC,UAAU,EAAE,CAAC;KAC/B,CAAC;AACJ,EAAE;AAEF,SAAS,0BAA0B,CACjC,WAAwB,EACxB,cAA0B;IAE1B,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,CAAC,OAAO;QAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK;YACpB,IAAI,KAAK,CAAC,cAAc,EAAE;gBACxB,cAAc,EAAE,CAAC;aAClB;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,OAAO,oBAAoB,CAAC;AAC9B;;;;","names":[],"sources":["src/components/input/input.fc.tsx","src/components/input/input.animation.ts","src/components/input/input.util.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { h, FunctionalComponent } from '@stencil/core';\nimport { MakeRef } from '../utils/make-ref';\nimport { A11yAttributes } from '../utils/a11y';\n\nexport function TextareaElement(props: {\n resizeBehavior: 'both' | 'horizontal' | 'vertical' | 'none';\n textareaHeight?: string;\n textareaWidth?: string;\n textareaRows?: number;\n textareaCols?: number;\n disabled: boolean;\n readonly: boolean;\n maxLength?: number;\n minLength?: number;\n isInvalid: boolean;\n required: boolean;\n value: string;\n placeholder?: string;\n textAreaRef: (el: HTMLTextAreaElement | undefined) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <textarea\n readOnly={props.readonly}\n disabled={props.disabled}\n maxLength={props.maxLength}\n minLength={props.minLength}\n cols={props.textareaCols}\n rows={props.textareaRows}\n ref={props.textAreaRef}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n style={{\n resize: props.resizeBehavior,\n height: props.textareaHeight,\n width: props.textareaWidth,\n }}\n {...props.ariaAttributes}\n ></textarea>\n );\n}\n\nexport function InputElement(props: {\n id: string;\n disabled: boolean;\n readonly: boolean;\n maxLength?: string | number;\n minLength?: string | number;\n max?: string | number;\n min?: string | number;\n pattern?: string;\n type: string;\n isInvalid: boolean;\n required: boolean;\n value: string | number;\n placeholder?: string;\n inputRef: (el: HTMLInputElement | undefined) => void;\n onKeyPress: (event: KeyboardEvent) => void;\n valueChange: (value: string) => void;\n updateFormInternalValue: (value: string) => void;\n onBlur: () => void;\n ariaAttributes?: A11yAttributes;\n}) {\n return (\n <input\n id={props.id}\n autoComplete=\"off\"\n readOnly={props.readonly}\n disabled={props.disabled}\n min={props.min}\n max={props.max}\n maxLength={props.maxLength ? Number(props.maxLength) : undefined}\n minLength={props.maxLength ? Number(props.minLength) : undefined}\n ref={props.inputRef}\n pattern={props.pattern}\n type={props.type}\n class={{\n 'is-invalid': props.isInvalid,\n }}\n required={props.required}\n value={props.value}\n placeholder={props.placeholder}\n onKeyPress={(event) => props.onKeyPress(event)}\n onInput={(inputEvent) => {\n const target = inputEvent.target as HTMLInputElement;\n props.updateFormInternalValue(target.value);\n props.valueChange(target.value);\n }}\n onBlur={() => props.onBlur()}\n {...props.ariaAttributes}\n ></input>\n );\n}\n\nexport const SlotEnd: FunctionalComponent<{\n slotEndRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props, children) => {\n return (\n <div class=\"end-container\" ref={props.slotEndRef}>\n <slot name=\"end\" onSlotchange={props.onSlotChange}></slot>\n {children}\n </div>\n );\n};\n\nexport const SlotStart: FunctionalComponent<{\n slotStartRef: MakeRef<HTMLDivElement>;\n onSlotChange?: (e: Event) => void;\n}> = (props) => {\n return (\n <div class=\"start-container\" ref={props.slotStartRef}>\n <slot name=\"start\" onSlotchange={props.onSlotChange}></slot>\n </div>\n );\n};\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport anime from 'animejs';\n\nexport function shakeInput(input: HTMLInputElement) {\n const xMax = 5;\n anime({\n targets: input,\n duration: 200,\n easing: 'easeInOutSine',\n loop: 2,\n translateX: [\n {\n value: xMax * -1,\n },\n {\n value: xMax,\n },\n {\n value: xMax / -2,\n },\n {\n value: xMax / 2,\n },\n {\n value: 0,\n },\n ],\n });\n}\n","/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { A11yAttributes, a11yBoolean } from '../utils/a11y';\nimport {\n IxFormComponent,\n IxInputFieldComponent,\n ValidationResults,\n shouldSuppressInternalValidation,\n} from '../utils/input';\nimport { createMutationObserver } from '../utils/mutation-observer';\nimport { convertToRemString } from '../utils/rwd.util';\nimport { generateUUID } from '../utils/uuid';\nimport { shakeInput } from './input.animation';\n\nexport function createIdIfNotExists(\n element: IxFormComponent,\n idPrefix: string = 'input'\n) {\n return element.hasAttribute('id')\n ? element.getAttribute('id')\n : `${idPrefix}-${generateUUID()}`;\n}\n\nexport function mapValidationResult<T>(\n ref: IxInputFieldComponent<T>,\n result: ValidationResults\n) {\n ref.isInvalid = result.isInvalid || result.isInvalidByRequired;\n ref.isValid = result.isValid;\n ref.isInfo = result.isInfo;\n ref.isWarning = result.isWarning;\n}\n\nexport function checkAllowedKeys<T>(\n comp: IxInputFieldComponent<T>,\n event: KeyboardEvent\n) {\n if (comp.allowedCharactersPattern) {\n const regex = new RegExp(comp.allowedCharactersPattern);\n if (!regex.test(event.key)) {\n event.preventDefault();\n shakeInput(comp.inputRef.current);\n }\n }\n}\n\nexport async function checkInternalValidity<T>(\n comp: IxFormComponent<T>,\n input: HTMLInputElement | HTMLTextAreaElement\n) {\n const validityState = input.validity;\n\n const eventResult = comp.validityStateChange.emit(validityState);\n\n if (eventResult.defaultPrevented) {\n return;\n }\n\n if (!comp.value) {\n return;\n }\n\n const skipValidation = await shouldSuppressInternalValidation(comp);\n if (skipValidation) {\n return;\n }\n\n const { valid } = validityState;\n comp.hostElement.classList.toggle('ix-invalid--validity-invalid', !valid);\n}\n\nexport function onInputBlur<T>(\n comp: IxFormComponent<T>,\n input?: HTMLInputElement | HTMLTextAreaElement | null\n) {\n comp.ixBlur.emit();\n\n if (!input) {\n throw new Error('Input element is not available');\n }\n\n input.setAttribute('data-ix-touched', 'true');\n checkInternalValidity(comp, input);\n}\n\nexport function applyPaddingEnd(\n inputElement: HTMLElement | null,\n width: number,\n options: {\n slotEnd: boolean;\n additionalPaddingRight?: string;\n }\n) {\n if (!inputElement) {\n return;\n }\n\n const remInPixels = 16;\n const padding = convertToRemString(width + remInPixels / 2);\n\n if (options.slotEnd) {\n inputElement.style.paddingRight = `calc(${padding} + ${\n options.additionalPaddingRight ?? '0rem'\n })`;\n } else {\n inputElement.style.paddingLeft = padding;\n }\n}\n\nexport function adjustPaddingForStartAndEnd(\n startElement: HTMLElement | null,\n endElement: HTMLElement | null,\n inputElement: HTMLElement | null\n) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (startElement) {\n const startBoundingRect = startElement.getBoundingClientRect();\n if (startBoundingRect) {\n applyPaddingEnd(inputElement, startBoundingRect.width, {\n slotEnd: false,\n });\n }\n }\n\n if (endElement) {\n const endBoundingRect = endElement.getBoundingClientRect();\n if (endBoundingRect) {\n applyPaddingEnd(inputElement, endBoundingRect.width, {\n slotEnd: true,\n });\n }\n }\n });\n });\n}\n\nexport function getAriaAttributesForInput(\n component: IxInputFieldComponent\n): A11yAttributes {\n const inputAria: A11yAttributes = {\n 'aria-invalid': `${a11yBoolean(component.isInvalid)}`,\n 'aria-required': `${a11yBoolean(component.required)}`,\n };\n\n if (component.isInvalid && component.invalidText) {\n inputAria['aria-errormessage'] = component.invalidText;\n }\n return inputAria;\n}\n\nexport type DisposableChangesAndVisibilityObservers = () => void;\n\nexport const addDisposableChangesAndVisibilityObservers = (\n element: HTMLElement,\n callback: () => void\n): DisposableChangesAndVisibilityObservers => {\n const intersectionObserver = observeElementUntilVisible(element, callback);\n const mutationObserver = createMutationObserver(callback);\n\n mutationObserver.observe(element, {\n subtree: true,\n attributes: true,\n });\n\n return () => {\n intersectionObserver.disconnect();\n mutationObserver.disconnect();\n };\n};\n\nfunction observeElementUntilVisible(\n hostElement: HTMLElement,\n updateCallback: () => void\n): IntersectionObserver {\n const intersectionObserver = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n updateCallback();\n }\n });\n });\n\n intersectionObserver.observe(hostElement);\n return intersectionObserver;\n}\n"],"version":3}
|
|
@@ -81,7 +81,6 @@ const ApplicationHeader = class {
|
|
|
81
81
|
}
|
|
82
82
|
async attachSiemensLogoIfLoaded() {
|
|
83
83
|
var _a;
|
|
84
|
-
await window.customElements.whenDefined('ix-siemens-logo');
|
|
85
84
|
const logoElement = document.createElement('ix-siemens-logo');
|
|
86
85
|
if (!this.isLogoSlotted()) {
|
|
87
86
|
(_a = this.hostElement
|
|
@@ -137,12 +136,12 @@ const ApplicationHeader = class {
|
|
|
137
136
|
const showApplicationSwitch = ((_a = this.applicationLayoutContext) === null || _a === void 0 ? void 0 : _a.appSwitchConfig) &&
|
|
138
137
|
this.breakpoint !== 'sm' &&
|
|
139
138
|
this.suppressResponsive === false;
|
|
140
|
-
return (h(Host, { key: '
|
|
139
|
+
return (h(Host, { key: '99c3340b760fe51621bfdd8390f8a78781d8ec2f', class: {
|
|
141
140
|
[`breakpoint-${this.breakpoint}`]: true,
|
|
142
|
-
}, slot: "application-header" }, (this.showMenu || showMenuByApplicationFrame) && (h("ix-menu-expand-icon", { key: '
|
|
141
|
+
}, slot: "application-header" }, (this.showMenu || showMenuByApplicationFrame) && (h("ix-menu-expand-icon", { key: '8c8e4c9ea5e5ffdedca71b413ab5ae272ec4cb2e', onClick: () => this.onMenuClick(), expanded: this.menuExpanded })), showApplicationSwitch && (h("ix-icon-button", { key: '1aaa76f6966e05ab9167c3d76129056323d95254', onClick: () => this.showAppSwitch(), icon: "apps", ghost: true, class: "app-switch" })), h("div", { key: '906798cca10aa839cc921c61c68dab394ab93b0e', class: { logo: true } }, h("slot", { key: 'b768d941698bf4a1e769d232dfeffdbf73d67cff', name: "logo" })), h("ix-typography", { key: 'b3a4aa2965702f9fc7c55ff28e6faf14fd7dedc5', format: "body-lg", class: "name" }, this.name), h("div", { key: '2db8a72304dba6df3bab501855f991241baecf19', class: "content" }, this.breakpoint === 'sm' ? (h(Fragment, null, h("ix-icon-button", { class: {
|
|
143
142
|
['context-menu']: true,
|
|
144
143
|
['context-menu-visible']: this.hasSlottedElements,
|
|
145
|
-
}, "data-context-menu": true, icon: "more-menu", ghost: true }), h("ix-dropdown", { "data-overflow-dropdown": true, class: "dropdown", discoverAllSubmenus: true, trigger: this.resolveContextMenuButton() }, h("div", { class: "dropdown-content", onClick: (e) => this.onContentBgClick(e) }, h("slot", { onSlotchange: () => this.updateIsSlottedContent() }))))) : (h("slot", { onSlotchange: () => this.updateIsSlottedContent() })), h("slot", { key: '
|
|
144
|
+
}, "data-context-menu": true, icon: "more-menu", ghost: true }), h("ix-dropdown", { "data-overflow-dropdown": true, class: "dropdown", discoverAllSubmenus: true, trigger: this.resolveContextMenuButton() }, h("div", { class: "dropdown-content", onClick: (e) => this.onContentBgClick(e) }, h("slot", { onSlotchange: () => this.updateIsSlottedContent() }))))) : (h("slot", { onSlotchange: () => this.updateIsSlottedContent() })), h("slot", { key: 'f34d3cd4b5bb06bdeb4e4473adc677b8811a2101', name: "ix-application-header-avatar" }))));
|
|
146
145
|
}
|
|
147
146
|
get hostElement() { return getElement(this); }
|
|
148
147
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"ix-application-header.entry.js","mappings":";;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,8oEAA8oE,CAAC;AAC5qE,kCAAe,oBAAoB;;MCyCtB,iBAAiB;IAL9B;;;;;;;;;;;;QAqB2B,aAAQ,GAAa,KAAK,CAAC;QAgB3C,eAAU,GAAe,IAAI,CAAC;QAC9B,iBAAY,GAAG,KAAK,CAAC;QACrB,uBAAkB,GAAG,KAAK,CAAC;QAE3B,uBAAkB,GAAG,KAAK,CAAC;KAuOrC;IA3NC,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,UAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;KACxE;IAED,iBAAiB;QACf,kBAAkB,CAChB,IAAI,CAAC,WAAW,EAChB,wBAAwB,EACxB,CAAC,GAAG;YACF,IAAI,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,MAAK,gBAAgB,EAAE;gBAClC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;gBACvB,OAAO;aACR;YAED,IAAI,CAAC,UAAU,GAAG,wBAAwB,CAAC,UAAU,CAAC;YACtD,IAAI,CAAC,wBAAwB,GAAG,GAAG,CAAC;YAEpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;SAC3B,EACD,IAAI,CACL,CAAC;QAEF,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI;YACxD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,GAAG,wBAAwB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI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C,kBAAkB,EACxB,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAExC,YACE,YAAY,EAAE,MAAM,IAAI,CAAC,sBAAsB,EAAE,GAC3C,CACJ,CACM,CACL,KAEX,YAAM,YAAY,EAAE,MAAM,IAAI,CAAC,sBAAsB,EAAE,GAAS,CACjE,EACD,6DAAM,IAAI,EAAC,8BAA8B,GAAQ,CAC7C,CACD,EACP;KACH;;;;;;;;;;;","names":[],"sources":["src/components/application-header/application-header.scss?tag=ix-application-header&encapsulation=shadow","src/components/application-header/application-header.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n@import 'mixins/break-points';\n\n:host {\n @include ix-component;\n\n display: flex;\n align-items: flex-end;\n flex-wrap: nowrap;\n position: relative;\n width: 100%;\n height: calc(2.75rem + var(--ix-safe-area-inset-top, 0rem));\n min-height: calc(2.75rem + var(--ix-safe-area-inset-top, 0rem));\n padding-top: 0;\n padding-right: calc(1rem + var(--ix-safe-area-inset-right, 0rem));\n padding-bottom: 0.3rem;\n padding-left: calc(0.625rem + var(--ix-safe-area-inset-left, 0rem));\n\n color: var(--theme-app-header--color);\n background-color: var(--theme-app-header--background);\n\n border-bottom: var(--theme-app-header--border-width) solid\n var(--theme-app-header--border-color);\n\n z-index: var(--theme-z-index-fixed);\n\n .app-switch {\n margin-right: 1rem;\n }\n\n .name {\n overflow: hidden;\n overflow-wrap: anywhere;\n text-overflow: ellipsis;\n text-wrap: nowrap;\n max-width: 50%;\n margin-left: 1.5rem;\n margin-right: 2.5rem;\n margin-bottom: 0.25rem;\n color: var(--theme-app-header--color);\n }\n\n .logo {\n display: inline-flex;\n align-items: center;\n position: relative;\n height: 32px;\n overflow: hidden;\n line-height: 0rem;\n color: var(--theme-app-header-logo--color);\n margin-left: 0.375rem;\n }\n\n .content {\n display: flex;\n position: relative;\n flex-direction: row;\n margin-left: auto;\n margin-right: 0px;\n }\n\n .dropdown {\n overflow: visible;\n }\n\n .dropdown-content {\n padding: 1rem;\n }\n\n .context-menu {\n display: none;\n }\n\n .context-menu.context-menu-visible {\n display: block;\n }\n\n @include media-breakpoint-match('sm') {\n .logo {\n display: none;\n }\n }\n\n ::slotted(ix-avatar) {\n margin-left: 1rem;\n }\n}\n\n:host(.breakpoint-sm) {\n .logo {\n margin-left: 0.5rem;\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n Fragment,\n h,\n Host,\n Prop,\n readTask,\n State,\n Watch,\n} from '@stencil/core';\nimport { showAppSwitch } from '../utils/app-switch';\nimport { applicationLayoutService } from '../utils/application-layout';\nimport {\n ApplicationLayoutContext,\n AppSwitchConfiguration,\n} from '../utils/application-layout/context';\nimport { Breakpoint } from '../utils/breakpoints';\nimport { ContextType, useContextConsumer } from '../utils/context';\nimport { menuController } from '../utils/menu-service/menu-service';\nimport { hasSlottedElements } from '../utils/shadow-dom';\nimport { Disposable } from '../utils/typed-event';\n\n/**\n * @slot logo - Location of the logo\n */\n@Component({\n tag: 'ix-application-header',\n styleUrl: 'application-header.scss',\n shadow: true,\n})\nexport class ApplicationHeader {\n @Element() hostElement!: HTMLIxApplicationHeaderElement;\n\n /**\n * Application name\n */\n @Prop() name?: string;\n\n /**\n * Controls the visibility of the menu toggle button based on the context of the application header.\n *\n * When the application header is utilized outside the application frame, the menu toggle button is displayed.\n * Conversely, if the header is within the application frame, this property is ineffective.\n *\n * @since 2.5.0\n */\n @Prop({ mutable: true }) showMenu?: boolean = false;\n\n /**\n * Event emitted when the menu toggle button is clicked\n *\n * @since 2.5.0\n */\n @Event() menuToggle!: EventEmitter<boolean>;\n\n /**\n * Event emitted when the app switch button is clicked\n *\n * @since 3.0.0\n */\n @Event() openAppSwitch!: EventEmitter<void>;\n\n @State() breakpoint: Breakpoint = 'lg';\n @State() menuExpanded = false;\n @State() suppressResponsive = false;\n\n @State() hasSlottedElements = false;\n\n private menuDisposable?: Disposable;\n private modeDisposable?: Disposable;\n private callbackUpdateAppSwitchModal?: (\n config: AppSwitchConfiguration\n ) => void;\n\n @State() applicationLayoutContext?: ContextType<\n typeof ApplicationLayoutContext\n >;\n\n get contentBackground() {\n return this.hostElement.shadowRoot!.querySelector('.dropdown-content');\n }\n\n componentWillLoad() {\n useContextConsumer(\n this.hostElement,\n ApplicationLayoutContext,\n (ctx) => {\n if (ctx?.host === 'map-navigation') {\n this.suppressResponsive = true;\n this.breakpoint = 'md';\n return;\n }\n\n this.breakpoint = applicationLayoutService.breakpoint;\n this.applicationLayoutContext = ctx;\n\n this.tryUpdateAppSwitch();\n },\n true\n );\n\n this.menuDisposable = menuController.expandChange.on((show) => {\n this.menuExpanded = show;\n });\n\n this.modeDisposable = applicationLayoutService.onChange.on((mode) => {\n if (this.suppressResponsive) {\n return;\n }\n\n this.breakpoint = mode;\n });\n\n this.updateIsSlottedContent();\n }\n\n componentDidLoad() {\n this.attachSiemensLogoIfLoaded();\n }\n\n disconnectedCallback() {\n this.menuDisposable?.dispose();\n this.modeDisposable?.dispose();\n }\n\n @Watch('applicationLayoutContext')\n watchApplicationLayoutContext() {\n if (this.applicationLayoutContext) {\n this.showMenu = false;\n }\n }\n @Watch('suppressResponsive')\n watchSuppressResponsive() {\n this.breakpoint = 'md';\n }\n\n private isLogoSlotted() {\n const slotElement = this.hostElement.shadowRoot!.querySelector(\n 'slot[name=\"logo\"]'\n ) as HTMLSlotElement;\n const nodes = slotElement.assignedNodes({\n flatten: true,\n });\n\n return nodes.length !== 0;\n }\n\n private async attachSiemensLogoIfLoaded() {\n await window.customElements.whenDefined('ix-siemens-logo');\n const logoElement = document.createElement('ix-siemens-logo');\n if (!this.isLogoSlotted()) {\n this.hostElement\n .shadowRoot!.querySelector('.logo')\n ?.appendChild(logoElement);\n }\n }\n\n private async onMenuClick() {\n if (this.applicationLayoutContext) {\n menuController.toggle();\n } else {\n this.menuExpanded = !this.menuExpanded;\n }\n\n this.menuToggle.emit(this.menuExpanded);\n }\n\n private resolveContextMenuButton() {\n return new Promise<HTMLElement>((resolve) =>\n readTask(() =>\n resolve(\n this.hostElement.shadowRoot!.querySelector(\n '[data-context-menu]'\n ) as HTMLElement\n )\n )\n );\n }\n\n private tryUpdateAppSwitch() {\n if (\n !this.callbackUpdateAppSwitchModal ||\n !this.applicationLayoutContext?.appSwitchConfig\n ) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private async showAppSwitch() {\n const { defaultPrevented } = this.openAppSwitch.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n if (!this.applicationLayoutContext?.appSwitchConfig) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal = await showAppSwitch(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private updateIsSlottedContent() {\n const slotElement =\n this.hostElement.shadowRoot!.querySelector('.content slot');\n\n this.hasSlottedElements = hasSlottedElements(slotElement);\n }\n\n private onContentBgClick(e: MouseEvent) {\n if (e.target === this.contentBackground) {\n e.preventDefault();\n }\n }\n\n render() {\n const hasApplicationContextAvailable = !!this.applicationLayoutContext;\n\n const showMenuByApplicationFrame =\n this.breakpoint === 'sm' &&\n this.suppressResponsive === false &&\n hasApplicationContextAvailable;\n\n const showApplicationSwitch =\n this.applicationLayoutContext?.appSwitchConfig &&\n this.breakpoint !== 'sm' &&\n this.suppressResponsive === false;\n\n return (\n <Host\n class={{\n [`breakpoint-${this.breakpoint}`]: true,\n }}\n slot=\"application-header\"\n >\n {(this.showMenu || showMenuByApplicationFrame) && (\n <ix-menu-expand-icon\n onClick={() => this.onMenuClick()}\n expanded={this.menuExpanded}\n ></ix-menu-expand-icon>\n )}\n {showApplicationSwitch && (\n <ix-icon-button\n onClick={() => this.showAppSwitch()}\n icon=\"apps\"\n ghost\n class=\"app-switch\"\n ></ix-icon-button>\n )}\n <div class={{ logo: true }}>\n <slot name=\"logo\"></slot>\n </div>\n <ix-typography format=\"body-lg\" class=\"name\">\n {this.name}\n </ix-typography>\n <div class=\"content\">\n {this.breakpoint === 'sm' ? (\n <Fragment>\n <ix-icon-button\n class={{\n ['context-menu']: true,\n ['context-menu-visible']: this.hasSlottedElements,\n }}\n data-context-menu\n icon=\"more-menu\"\n ghost\n ></ix-icon-button>\n <ix-dropdown\n data-overflow-dropdown\n class=\"dropdown\"\n discoverAllSubmenus\n trigger={this.resolveContextMenuButton()}\n >\n <div\n class=\"dropdown-content\"\n onClick={(e) => this.onContentBgClick(e)}\n >\n <slot\n onSlotchange={() => this.updateIsSlottedContent()}\n ></slot>\n </div>\n </ix-dropdown>\n </Fragment>\n ) : (\n <slot onSlotchange={() => this.updateIsSlottedContent()}></slot>\n )}\n <slot name=\"ix-application-header-avatar\"></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"ix-application-header.entry.js","mappings":";;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,8oEAA8oE,CAAC;AAC5qE,kCAAe,oBAAoB;;MCyCtB,iBAAiB;IAL9B;;;;;;;;;;;;QAqB2B,aAAQ,GAAa,KAAK,CAAC;QAgB3C,eAAU,GAAe,IAAI,CAAC;QAC9B,iBAAY,GAAG,KAAK,CAAC;QACrB,uBAAkB,GAAG,KAAK,CAAC;QAE3B,uBAAkB,GAAG,KAAK,CAAC;KAsOrC;IA1NC,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,UAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;KACxE;IAED,iBAAiB;QACf,kBAAkB,CAChB,IAAI,CAAC,WAAW,EAChB,wBAAwB,EACxB,CAAC,GAAG;YACF,IAAI,CAAA,G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AAE,IAAI,EAAE,IACxB,6DAAM,IAAI,EAAC,MAAM,GAAQ,CACrB,EACN,sEAAe,MAAM,EAAC,SAAS,EAAC,KAAK,EAAC,MAAM,IACzC,IAAI,CAAC,IAAI,CACI,EAChB,4DAAK,KAAK,EAAC,SAAS,IACjB,IAAI,CAAC,UAAU,KAAK,IAAI,IACvB,EAAC,QAAQ,QACP,sBACE,KAAK,EAAE;gBACL,CAAC,cAAc,GAAG,IAAI;gBACtB,CAAC,sBAAsB,GAAG,IAAI,CAAC,kBAAkB;aAClD,6BAED,IAAI,EAAC,WAAW,EAChB,KAAK,SACW,EAClB,mDAEE,KAAK,EAAC,UAAU,EAChB,mBAAmB,QACnB,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,IAExC,WACE,KAAK,EAAC,kBAAkB,EACxB,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAExC,YACE,YAAY,EAAE,MAAM,IAAI,CAAC,sBAAsB,EAAE,GAC3C,CACJ,CACM,CACL,KAEX,YAAM,YAAY,EAAE,MAAM,IAAI,CAAC,sBAAsB,EAAE,GAAS,CACjE,EACD,6DAAM,IAAI,EAAC,8BAA8B,GAAQ,CAC7C,CACD,EACP;KACH;;;;;;;;;;;","names":[],"sources":["src/components/application-header/application-header.scss?tag=ix-application-header&encapsulation=shadow","src/components/application-header/application-header.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n@import 'mixins/shadow-dom/component';\n@import 'mixins/break-points';\n\n:host {\n @include ix-component;\n\n display: flex;\n align-items: flex-end;\n flex-wrap: nowrap;\n position: relative;\n width: 100%;\n height: calc(2.75rem + var(--ix-safe-area-inset-top, 0rem));\n min-height: calc(2.75rem + var(--ix-safe-area-inset-top, 0rem));\n padding-top: 0;\n padding-right: calc(1rem + var(--ix-safe-area-inset-right, 0rem));\n padding-bottom: 0.3rem;\n padding-left: calc(0.625rem + var(--ix-safe-area-inset-left, 0rem));\n\n color: var(--theme-app-header--color);\n background-color: var(--theme-app-header--background);\n\n border-bottom: var(--theme-app-header--border-width) solid\n var(--theme-app-header--border-color);\n\n z-index: var(--theme-z-index-fixed);\n\n .app-switch {\n margin-right: 1rem;\n }\n\n .name {\n overflow: hidden;\n overflow-wrap: anywhere;\n text-overflow: ellipsis;\n text-wrap: nowrap;\n max-width: 50%;\n margin-left: 1.5rem;\n margin-right: 2.5rem;\n margin-bottom: 0.25rem;\n color: var(--theme-app-header--color);\n }\n\n .logo {\n display: inline-flex;\n align-items: center;\n position: relative;\n height: 32px;\n overflow: hidden;\n line-height: 0rem;\n color: var(--theme-app-header-logo--color);\n margin-left: 0.375rem;\n }\n\n .content {\n display: flex;\n position: relative;\n flex-direction: row;\n margin-left: auto;\n margin-right: 0px;\n }\n\n .dropdown {\n overflow: visible;\n }\n\n .dropdown-content {\n padding: 1rem;\n }\n\n .context-menu {\n display: none;\n }\n\n .context-menu.context-menu-visible {\n display: block;\n }\n\n @include media-breakpoint-match('sm') {\n .logo {\n display: none;\n }\n }\n\n ::slotted(ix-avatar) {\n margin-left: 1rem;\n }\n}\n\n:host(.breakpoint-sm) {\n .logo {\n margin-left: 0.5rem;\n }\n}\n","/*\n * SPDX-FileCopyrightText: 2023 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n Fragment,\n h,\n Host,\n Prop,\n readTask,\n State,\n Watch,\n} from '@stencil/core';\nimport { showAppSwitch } from '../utils/app-switch';\nimport { applicationLayoutService } from '../utils/application-layout';\nimport {\n ApplicationLayoutContext,\n AppSwitchConfiguration,\n} from '../utils/application-layout/context';\nimport { Breakpoint } from '../utils/breakpoints';\nimport { ContextType, useContextConsumer } from '../utils/context';\nimport { menuController } from '../utils/menu-service/menu-service';\nimport { hasSlottedElements } from '../utils/shadow-dom';\nimport { Disposable } from '../utils/typed-event';\n\n/**\n * @slot logo - Location of the logo\n */\n@Component({\n tag: 'ix-application-header',\n styleUrl: 'application-header.scss',\n shadow: true,\n})\nexport class ApplicationHeader {\n @Element() hostElement!: HTMLIxApplicationHeaderElement;\n\n /**\n * Application name\n */\n @Prop() name?: string;\n\n /**\n * Controls the visibility of the menu toggle button based on the context of the application header.\n *\n * When the application header is utilized outside the application frame, the menu toggle button is displayed.\n * Conversely, if the header is within the application frame, this property is ineffective.\n *\n * @since 2.5.0\n */\n @Prop({ mutable: true }) showMenu?: boolean = false;\n\n /**\n * Event emitted when the menu toggle button is clicked\n *\n * @since 2.5.0\n */\n @Event() menuToggle!: EventEmitter<boolean>;\n\n /**\n * Event emitted when the app switch button is clicked\n *\n * @since 3.0.0\n */\n @Event() openAppSwitch!: EventEmitter<void>;\n\n @State() breakpoint: Breakpoint = 'lg';\n @State() menuExpanded = false;\n @State() suppressResponsive = false;\n\n @State() hasSlottedElements = false;\n\n private menuDisposable?: Disposable;\n private modeDisposable?: Disposable;\n private callbackUpdateAppSwitchModal?: (\n config: AppSwitchConfiguration\n ) => void;\n\n @State() applicationLayoutContext?: ContextType<\n typeof ApplicationLayoutContext\n >;\n\n get contentBackground() {\n return this.hostElement.shadowRoot!.querySelector('.dropdown-content');\n }\n\n componentWillLoad() {\n useContextConsumer(\n this.hostElement,\n ApplicationLayoutContext,\n (ctx) => {\n if (ctx?.host === 'map-navigation') {\n this.suppressResponsive = true;\n this.breakpoint = 'md';\n return;\n }\n\n this.breakpoint = applicationLayoutService.breakpoint;\n this.applicationLayoutContext = ctx;\n\n this.tryUpdateAppSwitch();\n },\n true\n );\n\n this.menuDisposable = menuController.expandChange.on((show) => {\n this.menuExpanded = show;\n });\n\n this.modeDisposable = applicationLayoutService.onChange.on((mode) => {\n if (this.suppressResponsive) {\n return;\n }\n\n this.breakpoint = mode;\n });\n\n this.updateIsSlottedContent();\n }\n\n componentDidLoad() {\n this.attachSiemensLogoIfLoaded();\n }\n\n disconnectedCallback() {\n this.menuDisposable?.dispose();\n this.modeDisposable?.dispose();\n }\n\n @Watch('applicationLayoutContext')\n watchApplicationLayoutContext() {\n if (this.applicationLayoutContext) {\n this.showMenu = false;\n }\n }\n @Watch('suppressResponsive')\n watchSuppressResponsive() {\n this.breakpoint = 'md';\n }\n\n private isLogoSlotted() {\n const slotElement = this.hostElement.shadowRoot!.querySelector(\n 'slot[name=\"logo\"]'\n ) as HTMLSlotElement;\n const nodes = slotElement.assignedNodes({\n flatten: true,\n });\n\n return nodes.length !== 0;\n }\n\n private async attachSiemensLogoIfLoaded() {\n const logoElement = document.createElement('ix-siemens-logo');\n if (!this.isLogoSlotted()) {\n this.hostElement\n .shadowRoot!.querySelector('.logo')\n ?.appendChild(logoElement);\n }\n }\n\n private async onMenuClick() {\n if (this.applicationLayoutContext) {\n menuController.toggle();\n } else {\n this.menuExpanded = !this.menuExpanded;\n }\n\n this.menuToggle.emit(this.menuExpanded);\n }\n\n private resolveContextMenuButton() {\n return new Promise<HTMLElement>((resolve) =>\n readTask(() =>\n resolve(\n this.hostElement.shadowRoot!.querySelector(\n '[data-context-menu]'\n ) as HTMLElement\n )\n )\n );\n }\n\n private tryUpdateAppSwitch() {\n if (\n !this.callbackUpdateAppSwitchModal ||\n !this.applicationLayoutContext?.appSwitchConfig\n ) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private async showAppSwitch() {\n const { defaultPrevented } = this.openAppSwitch.emit();\n\n if (defaultPrevented) {\n return;\n }\n\n if (!this.applicationLayoutContext?.appSwitchConfig) {\n return;\n }\n\n this.callbackUpdateAppSwitchModal = await showAppSwitch(\n this.applicationLayoutContext?.appSwitchConfig\n );\n }\n\n private updateIsSlottedContent() {\n const slotElement =\n this.hostElement.shadowRoot!.querySelector('.content slot');\n\n this.hasSlottedElements = hasSlottedElements(slotElement);\n }\n\n private onContentBgClick(e: MouseEvent) {\n if (e.target === this.contentBackground) {\n e.preventDefault();\n }\n }\n\n render() {\n const hasApplicationContextAvailable = !!this.applicationLayoutContext;\n\n const showMenuByApplicationFrame =\n this.breakpoint === 'sm' &&\n this.suppressResponsive === false &&\n hasApplicationContextAvailable;\n\n const showApplicationSwitch =\n this.applicationLayoutContext?.appSwitchConfig &&\n this.breakpoint !== 'sm' &&\n this.suppressResponsive === false;\n\n return (\n <Host\n class={{\n [`breakpoint-${this.breakpoint}`]: true,\n }}\n slot=\"application-header\"\n >\n {(this.showMenu || showMenuByApplicationFrame) && (\n <ix-menu-expand-icon\n onClick={() => this.onMenuClick()}\n expanded={this.menuExpanded}\n ></ix-menu-expand-icon>\n )}\n {showApplicationSwitch && (\n <ix-icon-button\n onClick={() => this.showAppSwitch()}\n icon=\"apps\"\n ghost\n class=\"app-switch\"\n ></ix-icon-button>\n )}\n <div class={{ logo: true }}>\n <slot name=\"logo\"></slot>\n </div>\n <ix-typography format=\"body-lg\" class=\"name\">\n {this.name}\n </ix-typography>\n <div class=\"content\">\n {this.breakpoint === 'sm' ? (\n <Fragment>\n <ix-icon-button\n class={{\n ['context-menu']: true,\n ['context-menu-visible']: this.hasSlottedElements,\n }}\n data-context-menu\n icon=\"more-menu\"\n ghost\n ></ix-icon-button>\n <ix-dropdown\n data-overflow-dropdown\n class=\"dropdown\"\n discoverAllSubmenus\n trigger={this.resolveContextMenuButton()}\n >\n <div\n class=\"dropdown-content\"\n onClick={(e) => this.onContentBgClick(e)}\n >\n <slot\n onSlotchange={() => this.updateIsSlottedContent()}\n ></slot>\n </div>\n </ix-dropdown>\n </Fragment>\n ) : (\n <slot onSlotchange={() => this.updateIsSlottedContent()}></slot>\n )}\n <slot name=\"ix-application-header-avatar\"></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|