@siemens/element-ng 48.2.0-rc.1 → 48.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/fesm2022/siemens-element-ng-header-dropdown.mjs +13 -1
- package/fesm2022/siemens-element-ng-header-dropdown.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ip-input.mjs +24 -28
- package/fesm2022/siemens-element-ng-ip-input.mjs.map +1 -1
- package/header-dropdown/index.d.ts +7 -0
- package/ip-input/index.d.ts +0 -1
- package/package.json +3 -3
- package/schematics/collection.json +6 -0
- package/schematics/migrations/action-modal-migration/action-modal-migration.js +121 -0
- package/schematics/migrations/action-modal-migration/action-modal.mappings.js +98 -0
- package/schematics/migrations/action-modal-migration/index.js +5 -0
- package/schematics/migrations/index.js +13 -0
- package/schematics/migrations/schema.json +16 -0
- package/schematics/migrations/to-legacy-migration/to-legacy-migration.js +55 -0
- package/schematics/migrations/to-legacy-migration/to-legacy-replacement.js +35 -0
- package/schematics/simpl-siemens-migration/index.js +2 -1
- package/schematics/utils/html-utils.js +72 -0
- package/schematics/utils/index.js +2 -0
- package/schematics/utils/template-utils.js +114 -0
- package/schematics/utils/ts-utils.js +96 -0
package/README.md
CHANGED
|
@@ -49,3 +49,8 @@ The source code in the folder [bootstrap](./projects/element-theme/src/styles/bo
|
|
|
49
49
|
is based on [Bootstrap (v5.1.3)](https://github.com/twbs/bootstrap). We changed and adapted
|
|
50
50
|
the SASS component files to our needs. At that point in time, it was under _MIT License_
|
|
51
51
|
and _Copyright (c) 2011-2024 The Bootstrap Authors_.
|
|
52
|
+
|
|
53
|
+
### API Goldens
|
|
54
|
+
|
|
55
|
+
The source code in the folder [tools/api-goldens](./tools/api-goldens/) is based on [dev-infra-private-build-tooling-builds](https://github.com/angular/dev-infra-private-build-tooling-builds/tree/main/bazel/api-golden).
|
|
56
|
+
We changed and adapted the code to our needs. At that point in time it was under _MIT License_ and _Copyright Google LLC_.
|
|
@@ -242,6 +242,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
242
242
|
* Must only be opened using an {@link SiHeaderDropdownTriggerDirective}.
|
|
243
243
|
*/
|
|
244
244
|
class SiHeaderDropdownComponent {
|
|
245
|
+
/** @internal */
|
|
245
246
|
trigger = inject(SiHeaderDropdownTriggerDirective);
|
|
246
247
|
focusTrap = viewChild.required(CdkTrapFocus);
|
|
247
248
|
previousElement = null;
|
|
@@ -265,21 +266,29 @@ class SiHeaderDropdownComponent {
|
|
|
265
266
|
}
|
|
266
267
|
});
|
|
267
268
|
}
|
|
269
|
+
/** @internal */
|
|
268
270
|
get show() {
|
|
269
271
|
return this.trigger.isOpen;
|
|
270
272
|
}
|
|
273
|
+
/** @internal */
|
|
274
|
+
get overlay() {
|
|
275
|
+
return this.trigger.isOverlay;
|
|
276
|
+
}
|
|
277
|
+
/** @internal */
|
|
271
278
|
get submenu() {
|
|
272
279
|
return this.trigger.level > 1;
|
|
273
280
|
}
|
|
281
|
+
/** @internal */
|
|
274
282
|
get trapFocus() {
|
|
275
283
|
return (this.trigger.isOverlay ||
|
|
276
284
|
(!this.options?.disableRootFocusTrapForInlineMode && this.trigger.level === 1));
|
|
277
285
|
}
|
|
286
|
+
/** @internal */
|
|
278
287
|
escape() {
|
|
279
288
|
this.trigger?.close();
|
|
280
289
|
}
|
|
281
290
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiHeaderDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
282
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.0.6", type: SiHeaderDropdownComponent, isStandalone: true, selector: "si-header-dropdown", host: { attributes: { "role": "group" }, listeners: { "keydown.escape": "escape()" }, properties: { "id": "trigger.ariaControls", "attr.aria-labelledby": "trigger.id", "class.show": "this.show", "class.sub-menu": "this.submenu" }, classAttribute: "dropdown-menu position-static" }, viewQueries: [{ propertyName: "focusTrap", first: true, predicate: CdkTrapFocus, descendants: true, isSignal: true }], ngImport: i0, template: "<div [cdkTrapFocus]=\"trapFocus\" [cdkTrapFocusAutoCapture]=\"this.trigger.isOverlay\">\n <ng-content />\n</div>\n", styles: [":host.sub-menu{min-inline-size:200px}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
291
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.0.6", type: SiHeaderDropdownComponent, isStandalone: true, selector: "si-header-dropdown", host: { attributes: { "role": "group" }, listeners: { "keydown.escape": "escape()" }, properties: { "id": "trigger.ariaControls", "attr.aria-labelledby": "trigger.id", "class.show": "this.show", "class.header-dropdown-overlay": "this.overlay", "class.sub-menu": "this.submenu" }, classAttribute: "dropdown-menu position-static" }, viewQueries: [{ propertyName: "focusTrap", first: true, predicate: CdkTrapFocus, descendants: true, isSignal: true }], ngImport: i0, template: "<div [cdkTrapFocus]=\"trapFocus\" [cdkTrapFocusAutoCapture]=\"this.trigger.isOverlay\">\n <ng-content />\n</div>\n", styles: [":host.sub-menu{min-inline-size:200px}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
283
292
|
}
|
|
284
293
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: SiHeaderDropdownComponent, decorators: [{
|
|
285
294
|
type: Component,
|
|
@@ -292,6 +301,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
|
|
|
292
301
|
}], ctorParameters: () => [], propDecorators: { show: [{
|
|
293
302
|
type: HostBinding,
|
|
294
303
|
args: ['class.show']
|
|
304
|
+
}], overlay: [{
|
|
305
|
+
type: HostBinding,
|
|
306
|
+
args: ['class.header-dropdown-overlay']
|
|
295
307
|
}], submenu: [{
|
|
296
308
|
type: HostBinding,
|
|
297
309
|
args: ['class.sub-menu']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-element-ng-header-dropdown.mjs","sources":["../../../../projects/element-ng/header-dropdown/si-header.model.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown-trigger.directive.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown.component.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown.component.html","../../../../projects/element-ng/header-dropdown/si-header-dropdown-item.component.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown-item.component.html","../../../../projects/element-ng/header-dropdown/si-header-dropdown-items-factory.component.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown-items-factory.component.html","../../../../projects/element-ng/header-dropdown/index.ts","../../../../projects/element-ng/header-dropdown/siemens-element-ng-header-dropdown.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { ConnectedPosition } from '@angular/cdk/overlay';\nimport { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\n\n/** @internal */\nexport interface HeaderWithDropdowns {\n /** Called whenever an item is triggered that is not opening another dropdown. */\n onDropdownItemTriggered?(): void;\n /** Whether the dropdown should be opened inline. */\n inlineDropdown?: Observable<boolean>;\n /** The position of the dropdown if opened in an overlay. */\n overlayPosition?: ConnectedPosition[];\n /** Called whenever a dropdown is opened **/\n dropdownOpened?(trigger: SiHeaderDropdownTriggerDirective): void;\n /** Called whenever a dropdown is close **/\n dropdownClosed?(trigger: SiHeaderDropdownTriggerDirective): void;\n}\n\n/** @internal */\nexport const SI_HEADER_WITH_DROPDOWNS = new InjectionToken<HeaderWithDropdowns>(\n 'si-header.with-dropdowns'\n);\n\n/**\n * Can be used to pass context-specific options to a header-dropdown\n * that should / or cannot be provided by a consuming application.\n * @internal\n */\nexport interface HeaderDropdownOptions {\n /**\n * If the inline navbar is already wrapped in a focus trap,\n * set this property to prevent the header-dropdown from creating a focus trap.\n */\n disableRootFocusTrapForInlineMode: boolean;\n}\n\n/** @internal */\nexport const SI_HEADER_DROPDOWN_OPTIONS = new InjectionToken<HeaderDropdownOptions>(\n 'si-header-dropdown.options'\n);\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n Component,\n ComponentRef,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n HostBinding,\n HostListener,\n inject,\n Injector,\n input,\n OnChanges,\n OnDestroy,\n OnInit,\n output,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\nimport { of, Subject } from 'rxjs';\nimport { filter, skip, take, takeUntil } from 'rxjs/operators';\n\nimport { SI_HEADER_WITH_DROPDOWNS } from './si-header.model';\n\n@Component({ template: '', host: { '[attr.aria-owns]': 'ariaOwns()' } })\nclass SiHeaderAnchorComponent {\n readonly ariaOwns = input<string>();\n}\n\n/**\n * Trigger to open dropdowns in a navbar.\n * A dropdown will always be attached to the view, even if not visible.\n *\n * If a dropdown is opened in desktop mode, it will be reattached to an overlay while being opened.\n */\n@Directive({\n selector: '[siHeaderDropdownTriggerFor]',\n host: {\n class: 'dropdown-toggle'\n },\n exportAs: 'siHeaderDropdownTrigger'\n})\nexport class SiHeaderDropdownTriggerDirective implements OnChanges, OnInit, OnDestroy {\n private static idCounter = 0;\n\n /** Template that be rendered inside the dropdown. */\n readonly dropdown = input.required<TemplateRef<unknown>>({ alias: 'siHeaderDropdownTriggerFor' });\n /** Data that should be passed as template context to the dropdown. */\n readonly dropdownData = input<unknown>();\n /** Emits whenever a dropdown is opened or closed. */\n readonly openChange = output<boolean>();\n\n private readonly dropdownClose = new Subject<void>();\n\n /** Child triggers will set themselves here if they are open. */\n private openSubmenu?: SiHeaderDropdownTriggerDirective;\n\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(Overlay);\n private readonly parent = inject(SiHeaderDropdownTriggerDirective, {\n optional: true,\n skipSelf: true\n });\n /** @internal */\n readonly navbar = inject(SI_HEADER_WITH_DROPDOWNS, { optional: true });\n\n // we need to create a new injector, so that the parent can be injected properly\n private readonly injector = Injector.create({ parent: inject(Injector), providers: [] });\n private viewRef?: EmbeddedViewRef<unknown>;\n private portal?: TemplatePortal<unknown>;\n private overlayRef?: OverlayRef;\n\n /** @internal */\n readonly level: number = this.parent ? this.parent.level + 1 : 1;\n\n // used to prevent immediate re-creation of the overlay if this trigger was clicked while overlay is open\n private destroying = false;\n\n /** @internal */\n @HostBinding('id') readonly id =\n `si-navbar-dropdown-trigger-${SiHeaderDropdownTriggerDirective.idCounter++}`;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n @HostBinding('class.show') @HostBinding('attr.aria-expanded') protected _isOpen = false;\n\n /** @internal */\n @HostBinding('attr.aria-controls') readonly ariaControls =\n `si-navbar-dropdown-${SiHeaderDropdownTriggerDirective.idCounter}`;\n\n private headerAnchorComponentRef?: ComponentRef<SiHeaderAnchorComponent>;\n\n /** Whether the dropdown is open. */\n get isOpen(): boolean {\n return this._isOpen;\n }\n\n /** @internal */\n get isOverlay(): boolean {\n return !!this.overlayRef;\n }\n\n ngOnChanges(): void {\n if (this.portal) {\n this.portal.templateRef = this.dropdown();\n this.portal.context = this.dropdownData();\n }\n }\n\n ngOnInit(): void {\n // Always attach the dropdown, so that it can be used with routerLinkActive\n this.attachDropdownInline();\n }\n\n ngOnDestroy(): void {\n this.close();\n this.dropdownClose.complete();\n }\n\n /** Opens the dropdown. */\n open(): void {\n if (this.destroying || this._isOpen) {\n return;\n }\n\n (this.navbar?.inlineDropdown ?? of(false)).pipe(take(1)).subscribe(inline => {\n this._isOpen = true;\n if (!inline) {\n this.attachDropdownOverlay();\n }\n this.navbar?.inlineDropdown\n ?.pipe(skip(1), takeUntil(this.dropdownClose))\n .subscribe(() => this.close());\n });\n\n if (this.parent) {\n this.parent.openSubmenu = this;\n }\n\n if (this.navbar?.dropdownOpened) {\n this.navbar?.dropdownOpened(this);\n }\n this.openChange.emit(true);\n }\n\n /** Closes the dropdown. */\n close(options?: { all?: boolean }): void {\n if (!this._isOpen) {\n return;\n }\n\n if (this.openSubmenu) {\n this.openSubmenu.close();\n }\n\n this.dropdownClose.next();\n this._isOpen = false;\n if (this.overlayRef) {\n this.destroying = true;\n this.overlayRef.detach();\n this.overlayRef.dispose();\n this.viewRef?.destroy();\n this.portal = undefined;\n this.overlayRef = undefined;\n this.headerAnchorComponentRef?.destroy();\n // do not use queueMicrotask, it executed to early\n setTimeout(() => (this.destroying = false));\n this.attachDropdownInline();\n } else {\n this.viewRef?.markForCheck();\n }\n\n if (this.parent) {\n this.parent.openSubmenu = undefined;\n }\n\n if (options?.all && this.parent) {\n this.parent.close(options);\n } else {\n if (this.navbar?.dropdownClosed) {\n this.navbar?.dropdownClosed(this);\n }\n this.openChange.emit(false);\n }\n }\n\n @HostListener('click')\n protected click(): void {\n if (this._isOpen) {\n this.close();\n } else {\n this.open();\n }\n }\n\n private attachDropdownInline(): void {\n this.viewRef = this.viewContainerRef.createEmbeddedView(this.dropdown(), this.dropdownData(), {\n injector: this.injector\n });\n this.viewRef.markForCheck();\n }\n\n private attachDropdownOverlay(): void {\n this.viewRef?.destroy();\n this.overlayRef = this.overlay.create({\n positionStrategy: this.overlay\n .position()\n .flexibleConnectedTo(this.elementRef)\n .withPositions(\n this.navbar?.overlayPosition ??\n (this.level > 1\n ? [\n {\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetX: 2\n }\n ]\n : [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n {\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetX: -4\n }\n ])\n )\n });\n this.portal = new TemplatePortal(\n this.dropdown(),\n this.viewContainerRef,\n this.dropdownData(),\n this.injector\n );\n this.viewRef = this.overlayRef.attach(this.portal);\n this.headerAnchorComponentRef = this.viewContainerRef.createComponent(SiHeaderAnchorComponent);\n this.headerAnchorComponentRef.setInput('ariaOwns', this.ariaControls);\n\n this.overlayRef\n .outsidePointerEvents()\n .pipe(\n filter(event => event.type === 'click'),\n filter(() => !this.openSubmenu),\n takeUntil(this.dropdownClose),\n take(1)\n )\n .subscribe(() => this.close());\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { A11yModule, CdkTrapFocus } from '@angular/cdk/a11y';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n HostListener,\n inject,\n viewChild,\n DOCUMENT\n} from '@angular/core';\n\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\nimport { SI_HEADER_DROPDOWN_OPTIONS } from './si-header.model';\n\n/**\n * Wrapper component for {@link SiHeaderDropdownItemComponent}.\n * Must only be opened using an {@link SiHeaderDropdownTriggerDirective}.\n */\n@Component({\n selector: 'si-header-dropdown',\n imports: [A11yModule],\n templateUrl: './si-header-dropdown.component.html',\n styles: ':host.sub-menu {min-inline-size: 200px}',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'dropdown-menu position-static',\n role: 'group',\n '[id]': 'trigger.ariaControls',\n '[attr.aria-labelledby]': 'trigger.id'\n }\n})\nexport class SiHeaderDropdownComponent {\n protected trigger = inject(SiHeaderDropdownTriggerDirective);\n\n private readonly focusTrap = viewChild.required(CdkTrapFocus);\n private previousElement: Element | null = null;\n private readonly document = inject(DOCUMENT);\n private readonly options = inject(SI_HEADER_DROPDOWN_OPTIONS, { optional: true });\n\n constructor() {\n // The autoFocus feature of the focus trap is not enough, as this component is not newly created when opened in mobile (inline).\n // But we still need autofocus in desktop mode, as the close event is never executed (component is destroyed before).\n this.trigger.openChange.subscribe(change => {\n if (!this.trigger.isOverlay && this.trapFocus && change) {\n this.previousElement = this.document.activeElement;\n this.focusTrap().focusTrap.focusFirstTabbableElementWhenReady();\n } else {\n if (\n this.previousElement &&\n 'focus' in this.previousElement &&\n typeof this.previousElement.focus === 'function'\n ) {\n this.previousElement.focus();\n }\n this.previousElement = null;\n }\n });\n }\n\n @HostBinding('class.show')\n protected get show(): boolean {\n return this.trigger.isOpen;\n }\n\n @HostBinding('class.sub-menu') protected get submenu(): boolean {\n return this.trigger.level > 1;\n }\n\n protected get trapFocus(): boolean {\n return (\n this.trigger.isOverlay ||\n (!this.options?.disableRootFocusTrapForInlineMode && this.trigger.level === 1)\n );\n }\n\n @HostListener('keydown.escape')\n protected escape(): void {\n this.trigger?.close();\n }\n}\n","<div [cdkTrapFocus]=\"trapFocus\" [cdkTrapFocusAutoCapture]=\"this.trigger.isOverlay\">\n <ng-content />\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { NgClass } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, HostListener, inject, input } from '@angular/core';\nimport { SiIconComponent } from '@siemens/element-ng/icon';\n\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\nimport { SI_HEADER_WITH_DROPDOWNS } from './si-header.model';\n\n/**\n * Creates a dropdown-item. Must be used within an {@link SiHeaderDropdownComponent}.\n */\n@Component({\n selector: 'si-header-dropdown-item, a[si-header-dropdown-item], button[si-header-dropdown-item]',\n imports: [NgClass, SiIconComponent],\n templateUrl: './si-header-dropdown-item.component.html',\n styleUrl: './si-header-dropdown-item.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'dropdown-item focus-inside'\n }\n})\nexport class SiHeaderDropdownItemComponent {\n /** Optional icon that will be rendered before the label. */\n readonly icon = input<string>();\n /** Badge that is rendered after the label. */\n readonly badge = input<string | number>();\n /** Badge (always red) that is attached to the icon. */\n readonly iconBadge = input<string | number>();\n /** Color of the badge (not iconBadge). */\n readonly badgeColor = input<string>();\n /** Whether the icon is checked with a radio or check mark. */\n readonly checked = input<'radio' | 'check' | ''>();\n\n protected readonly ownTrigger = inject(SiHeaderDropdownTriggerDirective, {\n self: true,\n optional: true\n });\n protected readonly parentTrigger = inject(SiHeaderDropdownTriggerDirective, { skipSelf: true });\n protected readonly navbar = inject(SI_HEADER_WITH_DROPDOWNS, { optional: true });\n\n @HostListener('click')\n protected click(): void {\n if (!this.ownTrigger) {\n this.parentTrigger.close({ all: true });\n if (this.navbar?.onDropdownItemTriggered) {\n this.navbar?.onDropdownItemTriggered();\n }\n }\n }\n}\n","@if (icon()) {\n <si-icon class=\"icon\" [icon]=\"icon()!\" />\n}\n@if (iconBadge()) {\n <div class=\"badge-text\">{{ iconBadge() }}</div>\n}\n<span class=\"item-title text-truncate\">\n <ng-content />\n</span>\n<div class=\"item-end ps-2 d-flex me-n3 ms-auto gap-1\">\n @if (badge()) {\n <span class=\"mx-0 me-1 ms-2 badge\" [ngClass]=\"'bg-' + badgeColor()\">{{ badge() }}</span>\n }\n @if (checked() === 'check') {\n <div class=\"element-ok icon\" aria-hidden=\"true\"></div>\n }\n @if (checked() === 'radio') {\n <div class=\"element-record-filled icon-small me-2\" aria-hidden=\"true\"></div>\n }\n @if (ownTrigger) {\n <span class=\"element-down-2 dropdown-caret m-0 ps-0\" aria-hidden=\"true\"></span>\n }\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { Component, input, output } from '@angular/core';\nimport { MenuItem } from '@siemens/element-ng/common';\nimport { SiLinkDirective } from '@siemens/element-ng/link';\nimport { SiTranslatePipe } from '@siemens/element-translate-ng/translate';\n\nimport { SiHeaderDropdownItemComponent } from './si-header-dropdown-item.component';\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\nimport { SiHeaderDropdownComponent } from './si-header-dropdown.component';\n\n/**\n * A factory to render multiple {@link MenuItem}.\n * Requires a wrapping {@link SiHeaderDropdownComponent}.\n *\n * @internal\n */\n@Component({\n selector: 'si-header-dropdown-items-factory',\n imports: [\n SiHeaderDropdownComponent,\n SiHeaderDropdownItemComponent,\n SiTranslatePipe,\n SiLinkDirective,\n SiHeaderDropdownTriggerDirective\n ],\n templateUrl: './si-header-dropdown-items-factory.component.html'\n})\nexport class SiHeaderDropdownItemsFactoryComponent {\n readonly items = input.required<MenuItem[]>();\n readonly activeChange = output<boolean>();\n}\n","@for (item of items(); track item) {\n @if (item.isHeading) {\n <div class=\"dropdown-item dropdown-header dropdown-item-static\">\n {{ item.title | translate }}\n </div>\n } @else {\n @if (item.title !== '-') {\n @if (item.items) {\n <button\n type=\"button\"\n si-header-dropdown-item\n [icon]=\"item.icon\"\n [badge]=\"item.badgeStyle !== 'dot' ? item.badge : undefined\"\n [badgeColor]=\"item.badgeColor\"\n [iconBadge]=\"item.badgeStyle === 'dot' ? item.badge : undefined\"\n [siHeaderDropdownTriggerFor]=\"dropdown\"\n >\n {{ item.title | translate }}\n </button>\n <ng-template #dropdown>\n <si-header-dropdown>\n <si-header-dropdown-items-factory [items]=\"item.items\" />\n </si-header-dropdown>\n </ng-template>\n } @else {\n <a\n si-header-dropdown-item\n activeClass=\"active\"\n [siLink]=\"item\"\n [icon]=\"item.icon\"\n [badge]=\"item.badgeStyle !== 'dot' ? item.badge : undefined\"\n [badgeColor]=\"item.badgeColor\"\n [iconBadge]=\"item.badgeStyle === 'dot' ? item.badge : undefined\"\n [checked]=\"item.selectionState\"\n (activeChange)=\"activeChange.emit($event)\"\n >\n {{ item.title | translate }}\n </a>\n }\n } @else {\n <div class=\"dropdown-divider\"></div>\n }\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-header-dropdown.component';\nexport * from './si-header-dropdown-trigger.directive';\nexport * from './si-header-dropdown-item.component';\nexport * from './si-header-dropdown-items-factory.component';\nexport * from './si-header.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA;MACa,wBAAwB,GAAG,IAAI,cAAc,CACxD,0BAA0B;AAgB5B;MACa,0BAA0B,GAAG,IAAI,cAAc,CAC1D,4BAA4B;;AC5C9B;;;AAGG;AA0BH,MACM,uBAAuB,CAAA;IAClB,QAAQ,GAAG,KAAK,EAAU;uGAD/B,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB,+QADN,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAD5B,SAAS;mBAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,kBAAkB,EAAE,YAAY,EAAE,EAAE;;AAKvE;;;;;AAKG;MAQU,gCAAgC,CAAA;AACnC,IAAA,OAAO,SAAS,GAAG,CAAC;;IAGnB,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAuB,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC;;IAExF,YAAY,GAAG,KAAK,EAAW;;IAE/B,UAAU,GAAG,MAAM,EAAW;AAEtB,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG5C,IAAA,WAAW;AAEF,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC3C,IAAA,UAAU,GAA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AA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kCAAkC,EAAA,OAAA,EACnC;wBACP,yBAAyB;wBACzB,6BAA6B;wBAC7B,eAAe;wBACf,eAAe;wBACf;AACD,qBAAA,EAAA,QAAA,EAAA,g9CAAA,EAAA;;;AE3BH;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-header-dropdown.mjs","sources":["../../../../projects/element-ng/header-dropdown/si-header.model.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown-trigger.directive.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown.component.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown.component.html","../../../../projects/element-ng/header-dropdown/si-header-dropdown-item.component.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown-item.component.html","../../../../projects/element-ng/header-dropdown/si-header-dropdown-items-factory.component.ts","../../../../projects/element-ng/header-dropdown/si-header-dropdown-items-factory.component.html","../../../../projects/element-ng/header-dropdown/index.ts","../../../../projects/element-ng/header-dropdown/siemens-element-ng-header-dropdown.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { ConnectedPosition } from '@angular/cdk/overlay';\nimport { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\n\n/** @internal */\nexport interface HeaderWithDropdowns {\n /** Called whenever an item is triggered that is not opening another dropdown. */\n onDropdownItemTriggered?(): void;\n /** Whether the dropdown should be opened inline. */\n inlineDropdown?: Observable<boolean>;\n /** The position of the dropdown if opened in an overlay. */\n overlayPosition?: ConnectedPosition[];\n /** Called whenever a dropdown is opened **/\n dropdownOpened?(trigger: SiHeaderDropdownTriggerDirective): void;\n /** Called whenever a dropdown is close **/\n dropdownClosed?(trigger: SiHeaderDropdownTriggerDirective): void;\n}\n\n/** @internal */\nexport const SI_HEADER_WITH_DROPDOWNS = new InjectionToken<HeaderWithDropdowns>(\n 'si-header.with-dropdowns'\n);\n\n/**\n * Can be used to pass context-specific options to a header-dropdown\n * that should / or cannot be provided by a consuming application.\n * @internal\n */\nexport interface HeaderDropdownOptions {\n /**\n * If the inline navbar is already wrapped in a focus trap,\n * set this property to prevent the header-dropdown from creating a focus trap.\n */\n disableRootFocusTrapForInlineMode: boolean;\n}\n\n/** @internal */\nexport const SI_HEADER_DROPDOWN_OPTIONS = new InjectionToken<HeaderDropdownOptions>(\n 'si-header-dropdown.options'\n);\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n Component,\n ComponentRef,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n HostBinding,\n HostListener,\n inject,\n Injector,\n input,\n OnChanges,\n OnDestroy,\n OnInit,\n output,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\nimport { of, Subject } from 'rxjs';\nimport { filter, skip, take, takeUntil } from 'rxjs/operators';\n\nimport { SI_HEADER_WITH_DROPDOWNS } from './si-header.model';\n\n@Component({ template: '', host: { '[attr.aria-owns]': 'ariaOwns()' } })\nclass SiHeaderAnchorComponent {\n readonly ariaOwns = input<string>();\n}\n\n/**\n * Trigger to open dropdowns in a navbar.\n * A dropdown will always be attached to the view, even if not visible.\n *\n * If a dropdown is opened in desktop mode, it will be reattached to an overlay while being opened.\n */\n@Directive({\n selector: '[siHeaderDropdownTriggerFor]',\n host: {\n class: 'dropdown-toggle'\n },\n exportAs: 'siHeaderDropdownTrigger'\n})\nexport class SiHeaderDropdownTriggerDirective implements OnChanges, OnInit, OnDestroy {\n private static idCounter = 0;\n\n /** Template that be rendered inside the dropdown. */\n readonly dropdown = input.required<TemplateRef<unknown>>({ alias: 'siHeaderDropdownTriggerFor' });\n /** Data that should be passed as template context to the dropdown. */\n readonly dropdownData = input<unknown>();\n /** Emits whenever a dropdown is opened or closed. */\n readonly openChange = output<boolean>();\n\n private readonly dropdownClose = new Subject<void>();\n\n /** Child triggers will set themselves here if they are open. */\n private openSubmenu?: SiHeaderDropdownTriggerDirective;\n\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(Overlay);\n private readonly parent = inject(SiHeaderDropdownTriggerDirective, {\n optional: true,\n skipSelf: true\n });\n /** @internal */\n readonly navbar = inject(SI_HEADER_WITH_DROPDOWNS, { optional: true });\n\n // we need to create a new injector, so that the parent can be injected properly\n private readonly injector = Injector.create({ parent: inject(Injector), providers: [] });\n private viewRef?: EmbeddedViewRef<unknown>;\n private portal?: TemplatePortal<unknown>;\n private overlayRef?: OverlayRef;\n\n /** @internal */\n readonly level: number = this.parent ? this.parent.level + 1 : 1;\n\n // used to prevent immediate re-creation of the overlay if this trigger was clicked while overlay is open\n private destroying = false;\n\n /** @internal */\n @HostBinding('id') readonly id =\n `si-navbar-dropdown-trigger-${SiHeaderDropdownTriggerDirective.idCounter++}`;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n @HostBinding('class.show') @HostBinding('attr.aria-expanded') protected _isOpen = false;\n\n /** @internal */\n @HostBinding('attr.aria-controls') readonly ariaControls =\n `si-navbar-dropdown-${SiHeaderDropdownTriggerDirective.idCounter}`;\n\n private headerAnchorComponentRef?: ComponentRef<SiHeaderAnchorComponent>;\n\n /** Whether the dropdown is open. */\n get isOpen(): boolean {\n return this._isOpen;\n }\n\n /** @internal */\n get isOverlay(): boolean {\n return !!this.overlayRef;\n }\n\n ngOnChanges(): void {\n if (this.portal) {\n this.portal.templateRef = this.dropdown();\n this.portal.context = this.dropdownData();\n }\n }\n\n ngOnInit(): void {\n // Always attach the dropdown, so that it can be used with routerLinkActive\n this.attachDropdownInline();\n }\n\n ngOnDestroy(): void {\n this.close();\n this.dropdownClose.complete();\n }\n\n /** Opens the dropdown. */\n open(): void {\n if (this.destroying || this._isOpen) {\n return;\n }\n\n (this.navbar?.inlineDropdown ?? of(false)).pipe(take(1)).subscribe(inline => {\n this._isOpen = true;\n if (!inline) {\n this.attachDropdownOverlay();\n }\n this.navbar?.inlineDropdown\n ?.pipe(skip(1), takeUntil(this.dropdownClose))\n .subscribe(() => this.close());\n });\n\n if (this.parent) {\n this.parent.openSubmenu = this;\n }\n\n if (this.navbar?.dropdownOpened) {\n this.navbar?.dropdownOpened(this);\n }\n this.openChange.emit(true);\n }\n\n /** Closes the dropdown. */\n close(options?: { all?: boolean }): void {\n if (!this._isOpen) {\n return;\n }\n\n if (this.openSubmenu) {\n this.openSubmenu.close();\n }\n\n this.dropdownClose.next();\n this._isOpen = false;\n if (this.overlayRef) {\n this.destroying = true;\n this.overlayRef.detach();\n this.overlayRef.dispose();\n this.viewRef?.destroy();\n this.portal = undefined;\n this.overlayRef = undefined;\n this.headerAnchorComponentRef?.destroy();\n // do not use queueMicrotask, it executed to early\n setTimeout(() => (this.destroying = false));\n this.attachDropdownInline();\n } else {\n this.viewRef?.markForCheck();\n }\n\n if (this.parent) {\n this.parent.openSubmenu = undefined;\n }\n\n if (options?.all && this.parent) {\n this.parent.close(options);\n } else {\n if (this.navbar?.dropdownClosed) {\n this.navbar?.dropdownClosed(this);\n }\n this.openChange.emit(false);\n }\n }\n\n @HostListener('click')\n protected click(): void {\n if (this._isOpen) {\n this.close();\n } else {\n this.open();\n }\n }\n\n private attachDropdownInline(): void {\n this.viewRef = this.viewContainerRef.createEmbeddedView(this.dropdown(), this.dropdownData(), {\n injector: this.injector\n });\n this.viewRef.markForCheck();\n }\n\n private attachDropdownOverlay(): void {\n this.viewRef?.destroy();\n this.overlayRef = this.overlay.create({\n positionStrategy: this.overlay\n .position()\n .flexibleConnectedTo(this.elementRef)\n .withPositions(\n this.navbar?.overlayPosition ??\n (this.level > 1\n ? [\n {\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetX: 2\n }\n ]\n : [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n {\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetX: -4\n }\n ])\n )\n });\n this.portal = new TemplatePortal(\n this.dropdown(),\n this.viewContainerRef,\n this.dropdownData(),\n this.injector\n );\n this.viewRef = this.overlayRef.attach(this.portal);\n this.headerAnchorComponentRef = this.viewContainerRef.createComponent(SiHeaderAnchorComponent);\n this.headerAnchorComponentRef.setInput('ariaOwns', this.ariaControls);\n\n this.overlayRef\n .outsidePointerEvents()\n .pipe(\n filter(event => event.type === 'click'),\n filter(() => !this.openSubmenu),\n takeUntil(this.dropdownClose),\n take(1)\n )\n .subscribe(() => this.close());\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { A11yModule, CdkTrapFocus } from '@angular/cdk/a11y';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n HostListener,\n inject,\n viewChild,\n DOCUMENT\n} from '@angular/core';\n\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\nimport { SI_HEADER_DROPDOWN_OPTIONS } from './si-header.model';\n\n/**\n * Wrapper component for {@link SiHeaderDropdownItemComponent}.\n * Must only be opened using an {@link SiHeaderDropdownTriggerDirective}.\n */\n@Component({\n selector: 'si-header-dropdown',\n imports: [A11yModule],\n templateUrl: './si-header-dropdown.component.html',\n styles: ':host.sub-menu {min-inline-size: 200px}',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'dropdown-menu position-static',\n role: 'group',\n '[id]': 'trigger.ariaControls',\n '[attr.aria-labelledby]': 'trigger.id'\n }\n})\nexport class SiHeaderDropdownComponent {\n /** @internal */\n protected trigger = inject(SiHeaderDropdownTriggerDirective);\n\n private readonly focusTrap = viewChild.required(CdkTrapFocus);\n private previousElement: Element | null = null;\n private readonly document = inject(DOCUMENT);\n private readonly options = inject(SI_HEADER_DROPDOWN_OPTIONS, { optional: true });\n\n constructor() {\n // The autoFocus feature of the focus trap is not enough, as this component is not newly created when opened in mobile (inline).\n // But we still need autofocus in desktop mode, as the close event is never executed (component is destroyed before).\n this.trigger.openChange.subscribe(change => {\n if (!this.trigger.isOverlay && this.trapFocus && change) {\n this.previousElement = this.document.activeElement;\n this.focusTrap().focusTrap.focusFirstTabbableElementWhenReady();\n } else {\n if (\n this.previousElement &&\n 'focus' in this.previousElement &&\n typeof this.previousElement.focus === 'function'\n ) {\n this.previousElement.focus();\n }\n this.previousElement = null;\n }\n });\n }\n\n /** @internal */\n @HostBinding('class.show')\n protected get show(): boolean {\n return this.trigger.isOpen;\n }\n\n /** @internal */\n @HostBinding('class.header-dropdown-overlay') protected get overlay(): boolean {\n return this.trigger.isOverlay;\n }\n\n /** @internal */\n @HostBinding('class.sub-menu') protected get submenu(): boolean {\n return this.trigger.level > 1;\n }\n\n /** @internal */\n protected get trapFocus(): boolean {\n return (\n this.trigger.isOverlay ||\n (!this.options?.disableRootFocusTrapForInlineMode && this.trigger.level === 1)\n );\n }\n\n /** @internal */\n @HostListener('keydown.escape')\n protected escape(): void {\n this.trigger?.close();\n }\n}\n","<div [cdkTrapFocus]=\"trapFocus\" [cdkTrapFocusAutoCapture]=\"this.trigger.isOverlay\">\n <ng-content />\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { NgClass } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, HostListener, inject, input } from '@angular/core';\nimport { SiIconComponent } from '@siemens/element-ng/icon';\n\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\nimport { SI_HEADER_WITH_DROPDOWNS } from './si-header.model';\n\n/**\n * Creates a dropdown-item. Must be used within an {@link SiHeaderDropdownComponent}.\n */\n@Component({\n selector: 'si-header-dropdown-item, a[si-header-dropdown-item], button[si-header-dropdown-item]',\n imports: [NgClass, SiIconComponent],\n templateUrl: './si-header-dropdown-item.component.html',\n styleUrl: './si-header-dropdown-item.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'dropdown-item focus-inside'\n }\n})\nexport class SiHeaderDropdownItemComponent {\n /** Optional icon that will be rendered before the label. */\n readonly icon = input<string>();\n /** Badge that is rendered after the label. */\n readonly badge = input<string | number>();\n /** Badge (always red) that is attached to the icon. */\n readonly iconBadge = input<string | number>();\n /** Color of the badge (not iconBadge). */\n readonly badgeColor = input<string>();\n /** Whether the icon is checked with a radio or check mark. */\n readonly checked = input<'radio' | 'check' | ''>();\n\n protected readonly ownTrigger = inject(SiHeaderDropdownTriggerDirective, {\n self: true,\n optional: true\n });\n protected readonly parentTrigger = inject(SiHeaderDropdownTriggerDirective, { skipSelf: true });\n protected readonly navbar = inject(SI_HEADER_WITH_DROPDOWNS, { optional: true });\n\n @HostListener('click')\n protected click(): void {\n if (!this.ownTrigger) {\n this.parentTrigger.close({ all: true });\n if (this.navbar?.onDropdownItemTriggered) {\n this.navbar?.onDropdownItemTriggered();\n }\n }\n }\n}\n","@if (icon()) {\n <si-icon class=\"icon\" [icon]=\"icon()!\" />\n}\n@if (iconBadge()) {\n <div class=\"badge-text\">{{ iconBadge() }}</div>\n}\n<span class=\"item-title text-truncate\">\n <ng-content />\n</span>\n<div class=\"item-end ps-2 d-flex me-n3 ms-auto gap-1\">\n @if (badge()) {\n <span class=\"mx-0 me-1 ms-2 badge\" [ngClass]=\"'bg-' + badgeColor()\">{{ badge() }}</span>\n }\n @if (checked() === 'check') {\n <div class=\"element-ok icon\" aria-hidden=\"true\"></div>\n }\n @if (checked() === 'radio') {\n <div class=\"element-record-filled icon-small me-2\" aria-hidden=\"true\"></div>\n }\n @if (ownTrigger) {\n <span class=\"element-down-2 dropdown-caret m-0 ps-0\" aria-hidden=\"true\"></span>\n }\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { Component, input, output } from '@angular/core';\nimport { MenuItem } from '@siemens/element-ng/common';\nimport { SiLinkDirective } from '@siemens/element-ng/link';\nimport { SiTranslatePipe } from '@siemens/element-translate-ng/translate';\n\nimport { SiHeaderDropdownItemComponent } from './si-header-dropdown-item.component';\nimport { SiHeaderDropdownTriggerDirective } from './si-header-dropdown-trigger.directive';\nimport { SiHeaderDropdownComponent } from './si-header-dropdown.component';\n\n/**\n * A factory to render multiple {@link MenuItem}.\n * Requires a wrapping {@link SiHeaderDropdownComponent}.\n *\n * @internal\n */\n@Component({\n selector: 'si-header-dropdown-items-factory',\n imports: [\n SiHeaderDropdownComponent,\n SiHeaderDropdownItemComponent,\n SiTranslatePipe,\n SiLinkDirective,\n SiHeaderDropdownTriggerDirective\n ],\n templateUrl: './si-header-dropdown-items-factory.component.html'\n})\nexport class SiHeaderDropdownItemsFactoryComponent {\n readonly items = input.required<MenuItem[]>();\n readonly activeChange = output<boolean>();\n}\n","@for (item of items(); track item) {\n @if (item.isHeading) {\n <div class=\"dropdown-item dropdown-header dropdown-item-static\">\n {{ item.title | translate }}\n </div>\n } @else {\n @if (item.title !== '-') {\n @if (item.items) {\n <button\n type=\"button\"\n si-header-dropdown-item\n [icon]=\"item.icon\"\n [badge]=\"item.badgeStyle !== 'dot' ? item.badge : undefined\"\n [badgeColor]=\"item.badgeColor\"\n [iconBadge]=\"item.badgeStyle === 'dot' ? item.badge : undefined\"\n [siHeaderDropdownTriggerFor]=\"dropdown\"\n >\n {{ item.title | translate }}\n </button>\n <ng-template #dropdown>\n <si-header-dropdown>\n <si-header-dropdown-items-factory [items]=\"item.items\" />\n </si-header-dropdown>\n </ng-template>\n } @else {\n <a\n si-header-dropdown-item\n activeClass=\"active\"\n [siLink]=\"item\"\n [icon]=\"item.icon\"\n [badge]=\"item.badgeStyle !== 'dot' ? item.badge : undefined\"\n [badgeColor]=\"item.badgeColor\"\n [iconBadge]=\"item.badgeStyle === 'dot' ? item.badge : undefined\"\n [checked]=\"item.selectionState\"\n (activeChange)=\"activeChange.emit($event)\"\n >\n {{ item.title | translate }}\n </a>\n }\n } @else {\n <div class=\"dropdown-divider\"></div>\n }\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-header-dropdown.component';\nexport * from './si-header-dropdown-trigger.directive';\nexport * from './si-header-dropdown-item.component';\nexport * from './si-header-dropdown-items-factory.component';\nexport * from './si-header.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA;MACa,wBAAwB,GAAG,IAAI,cAAc,CACxD,0BAA0B;AAgB5B;MACa,0BAA0B,GAAG,IAAI,cAAc,CAC1D,4BAA4B;;AC5C9B;;;AAGG;AA0BH,MACM,uBAAuB,CAAA;IAClB,QAAQ,GAAG,KAAK,EAAU;uGAD/B,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB,+QADN,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAD5B,SAAS;mBAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,kBAAkB,EAAE,YAAY,EAAE,EAAE;;AAKvE;;;;;AAKG;MAQU,gCAAgC,CAAA;AACnC,IAAA,OAAO,SAAS,GAAG,CAAC;;IAGnB,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAuB,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC;;IAExF,YAAY,GAAG,KAAK,EAAW;;IAE/B,UAAU,GAAG,MAAM,EAAW;AAEtB,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG5C,IAAA,WAAW;AAEF,IAAA,gBAAgB,GAAG,MAAM,CAAC,gB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AAA,EAAA,CAAA,4BAAA,EAAA,cAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,CAAA,EAAA,QAAA,EAAA,CAAA,yBAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAIvB,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAXjD,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kCAAkC,EAAA,OAAA,EACnC;wBACP,yBAAyB;wBACzB,6BAA6B;wBAC7B,eAAe;wBACf,eAAe;wBACf;AACD,qBAAA,EAAA,QAAA,EAAA,g9CAAA,EAAA;;;AE3BH;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
@@ -168,44 +168,35 @@ const splitIpV6Sections = (options) => {
|
|
|
168
168
|
|
|
169
169
|
const ipv4Regex = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
170
170
|
const ipv4CIDRRegex = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([1-9]|1[0-9]|2[0-9]|3[0-2]))$/;
|
|
171
|
-
|
|
172
|
-
const ipV6Regex = /^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})$/;
|
|
173
|
-
// Matches range from 1:2:3:4:5:6:7:8/1 to 1:2:3:4:5:6:7:8/128
|
|
174
|
-
const ipV6CIDRRegex = /^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})\/([1-9]|[1-9][0-9]|10[0-9]|11[0-9]|12[0-8])$/;
|
|
175
|
-
// Matches
|
|
176
|
-
// 1:2:3:4:5:6:7:8
|
|
177
|
-
// 1:: (1:0:0:0:0:0:0:0)
|
|
178
|
-
// 1:2:3:4:5:6:7:: (1:2:3:4:5:6:7:0)
|
|
179
|
-
// 1::8 (1:0:0:0:0:0:0:8)
|
|
180
|
-
// 1:2:3:4:5:6::8 (1:2:3:4:5:6:0:8)
|
|
181
|
-
// 1::7:8 (1:0:0:0:0:0:7:8)
|
|
182
|
-
// 1:2:3:4:5::7:8 (1:2:3:4:5:0:7:8)
|
|
183
|
-
// ...
|
|
184
|
-
const ipV6ZeroCompressionRegex = /^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)$/;
|
|
185
|
-
const ipV6ZeroCompressionCIDRRegex = /^((([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/([1-9]|[1-9][0-9]|10[0-9]|11[0-9]|12[0-8])$/;
|
|
171
|
+
const ipV6Regex = /^((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|:(?::[0-9A-Fa-f]{1,4}){1,7}|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,5}(?::[0-9A-Fa-f]{1,4}){1,2}|(?:[0-9A-Fa-f]{1,4}:){1,4}(?::[0-9A-Fa-f]{1,4}){1,3}|(?:[0-9A-Fa-f]{1,4}:){1,3}(?::[0-9A-Fa-f]{1,4}){1,4}|(?:[0-9A-Fa-f]{1,4}:){1,2}(?::[0-9A-Fa-f]{1,4}){1,5}|[0-9A-Fa-f]{1,4}:(?:(?::[0-9A-Fa-f]{1,4}){1,6})|:(?:(?::[0-9A-Fa-f]{1,4}){1,6}))$/;
|
|
186
172
|
/**
|
|
187
173
|
* Validator factory for a IPV6 address.
|
|
188
|
-
|
|
189
174
|
*/
|
|
190
175
|
const ipV6Validator = (options) => {
|
|
191
176
|
return (control) => {
|
|
192
177
|
const value = control.value;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
valid = value === '' || value?.match(ipV6ZeroCompressionCIDRRegex);
|
|
196
|
-
}
|
|
197
|
-
else if (options.cidr) {
|
|
198
|
-
valid = value === '' || value?.match(ipV6CIDRRegex);
|
|
178
|
+
if (!value) {
|
|
179
|
+
return null;
|
|
199
180
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
181
|
+
const parts = value.split('/');
|
|
182
|
+
const error = { ipv6Address: true };
|
|
183
|
+
if (options.cidr) {
|
|
184
|
+
if (parts.length < 2 || !validateSubnet(parts[1])) {
|
|
185
|
+
return error;
|
|
186
|
+
}
|
|
204
187
|
}
|
|
205
188
|
else {
|
|
206
|
-
|
|
189
|
+
if (parts.length > 1) {
|
|
190
|
+
return error;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (parts[0].split('::').length > (options.zeroCompression ? 2 : 1)) {
|
|
194
|
+
return error;
|
|
207
195
|
}
|
|
208
|
-
|
|
196
|
+
if (!matchIpV6(parts[0])) {
|
|
197
|
+
return error;
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
209
200
|
};
|
|
210
201
|
};
|
|
211
202
|
/**
|
|
@@ -224,6 +215,11 @@ const ipV4CIDRValidator = (control) => {
|
|
|
224
215
|
const valid = v === '' || v?.toString().match(ipv4CIDRRegex);
|
|
225
216
|
return valid ? null : { ipv4Address: true };
|
|
226
217
|
};
|
|
218
|
+
const validateSubnet = (cidr) => {
|
|
219
|
+
const subnet = parseInt(cidr, 10);
|
|
220
|
+
return subnet > 0 && subnet <= 128;
|
|
221
|
+
};
|
|
222
|
+
const matchIpV6 = (ip) => !!ip.match(ipV6Regex) && !!URL.parse(`http://[${ip}]`);
|
|
227
223
|
|
|
228
224
|
/**
|
|
229
225
|
* Copyright (c) Siemens 2016 - 2025
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-element-ng-ip-input.mjs","sources":["../../../../projects/element-ng/ip-input/address-utils.ts","../../../../projects/element-ng/ip-input/address-validators.ts","../../../../projects/element-ng/ip-input/si-ip-input.directive.ts","../../../../projects/element-ng/ip-input/si-ip4-input.directive.ts","../../../../projects/element-ng/ip-input/si-ip6-input.directive.ts","../../../../projects/element-ng/ip-input/index.ts","../../../../projects/element-ng/ip-input/siemens-element-ng-ip-input.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\n/** */\nexport interface Section {\n value: string;\n current?: boolean;\n /** Indicate this is a network mask. */\n mask?: boolean;\n}\n\nexport interface Ip4SplitOptions {\n type?: 'insert' | 'delete' | 'paste';\n input?: string | null;\n pos?: number;\n cidr?: boolean;\n}\n\nexport interface Ip6SplitOptions {\n type?: 'insert' | 'delete' | 'paste';\n input?: string | null;\n pos?: number;\n zeroCompression?: boolean;\n cidr?: boolean;\n}\n\nconst isDigit = (c: string): boolean => c >= '0' && c <= '9';\nconst isHex = (c: string): boolean => (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F');\n\n/**\n * Parse IPv4 input string into IPv4 address section array.\n */\nexport const splitIpV4Sections = (options: Ip4SplitOptions): Section[] => {\n const { input, pos, cidr } = options;\n const sections: Section[] = [{ value: '' }];\n if (!input) {\n return sections;\n }\n let maxDots = 3;\n for (let i = 0; i < input.length; i++) {\n const c = input.charAt(i);\n if (isDigit(c)) {\n sections.at(-1)!.value += c;\n } else if (c === '.' && maxDots > 0) {\n maxDots--;\n sections.push({ value: c }, { value: '' });\n } else if (cidr && c === '/') {\n sections.push({ value: c }, { value: '', mask: true });\n }\n if (pos === i) {\n sections.at(-1)!.current = true;\n }\n }\n\n // Trim empty sections for example the user entered ..\n let previousDivider = false;\n for (let i = 0; i < sections.length; i += 2) {\n const isDivider = sections.at(i)?.value === '' && sections.at(i + 1)?.value === '.';\n if (previousDivider && isDivider) {\n sections.splice(i, 2);\n }\n previousDivider = isDivider;\n }\n\n // Split values > 255 in multiple sections:\n // - 256 will be split into 25 and 6\n // - 255255255 will be split into 255, 255 and 255\n for (let i = 0; i < sections.length; i++) {\n const { value, current } = sections[i];\n if (value.length >= 3 && parseInt(value, 10) > 255) {\n const append: Section[] = [];\n let n = '';\n for (const c of value) {\n if (parseInt(n + c, 10) > 255) {\n append.push({ value: n }, { value: '.' });\n n = c;\n } else {\n n += c;\n }\n }\n if (n.length > 0) {\n append.push({ value: n });\n }\n sections.splice(i, 1, ...append);\n if (current) {\n sections[i + append.length - 1].current = true;\n }\n }\n }\n\n // Split leading zero sections:\n // Assume a string starting by 0 e.g. 012 will be split into 0 and 12\n for (let i = 0; i < sections.length; i++) {\n const sec = sections[i];\n if (sec.value.length > 1 && sec.value.startsWith('0')) {\n sections.splice(i, 1, { value: '0' }, { value: sec.value.substring(1) });\n }\n }\n\n // Ensure the that the CIDR divider is a slash\n if (cidr) {\n const startCidr = 7;\n if (startCidr < sections.length && sections[startCidr].value === '.') {\n sections[startCidr].value = '/';\n }\n const prefixPos = startCidr + 1;\n if (prefixPos < sections.length) {\n const prefixLength = sections[prefixPos].value;\n if (parseInt(prefixLength, 10) > 32) {\n sections[prefixPos].value = prefixLength.substring(0, 2);\n }\n }\n }\n\n return sections;\n};\n\nexport const splitIpV6Sections = (options: Ip6SplitOptions): Section[] => {\n const { type, input, pos, zeroCompression, cidr } = options;\n const sections: Section[] = [{ value: '' }];\n if (!input) {\n return sections;\n }\n\n for (let i = 0; i < input.length; i++) {\n const c = input.charAt(i).toUpperCase();\n if (isHex(c)) {\n sections.at(-1)!.value += c;\n } else if (c === ':') {\n if (input.charAt(i - 1) === c) {\n // Merge :: characters\n sections.at(-2)!.value += c;\n } else {\n sections.push({ value: c }, { value: '' });\n }\n } else if (cidr && c === '/') {\n sections.push({ value: c }, { value: '', mask: true });\n }\n if (pos === i) {\n sections.at(-1)!.current = true;\n }\n }\n\n // Split values > FFFF in multiple sections:\n // - 1FFFF will be split into 1FFF and F\n for (let i = 0; i < sections.length; i++) {\n const { value, current } = sections[i];\n if (value.length > 4) {\n const append: Section[] = [];\n for (let p = 0; p < value.length; p += 4) {\n const part = value.substring(p, p + 4);\n append.push({ value: part });\n if (part.length === 4) {\n append.push({ value: ':' });\n }\n }\n\n sections.splice(i, 1, ...append);\n if (current) {\n sections[i + append.length - 1].current = true;\n }\n }\n }\n\n // Drop invalid zero compression indicators '::'\n const removeEnd = pos === input.length - 1 || type === 'paste';\n let matches = sections.filter(s => s.value.startsWith('::'));\n if (matches) {\n matches = removeEnd ? matches : matches.reverse();\n if (zeroCompression) {\n matches.shift();\n }\n // Only allow one occurrence of ::\n for (const drop of matches) {\n drop.value = drop.value.substring(1);\n }\n }\n\n // Ensure the that the CIDR divider is a slash\n if (cidr) {\n const startCidr = matches.length > 0 ? 13 : 15;\n if (startCidr < sections.length && sections[startCidr].value === ':') {\n sections[startCidr].value = '/';\n }\n const prefixPos = startCidr + 1;\n if (prefixPos < sections.length) {\n const prefixLength = sections[prefixPos].value;\n if (parseInt(prefixLength, 10) > 128) {\n sections[prefixPos].value = prefixLength.substring(0, 2);\n }\n }\n }\n\n return sections;\n};\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\nconst ipv4Regex =\n /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\nconst ipv4CIDRRegex =\n /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\/([1-9]|1[0-9]|2[0-9]|3[0-2]))$/;\n\n// Matches 1:2:3:4:5:6:7:8\nconst ipV6Regex = /^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})$/;\n\n// Matches range from 1:2:3:4:5:6:7:8/1 to 1:2:3:4:5:6:7:8/128\nconst ipV6CIDRRegex =\n /^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})\\/([1-9]|[1-9][0-9]|10[0-9]|11[0-9]|12[0-8])$/;\n\n// Matches\n// 1:2:3:4:5:6:7:8\n// 1:: (1:0:0:0:0:0:0:0)\n// 1:2:3:4:5:6:7:: (1:2:3:4:5:6:7:0)\n// 1::8 (1:0:0:0:0:0:0:8)\n// 1:2:3:4:5:6::8 (1:2:3:4:5:6:0:8)\n// 1::7:8 (1:0:0:0:0:0:7:8)\n// 1:2:3:4:5::7:8 (1:2:3:4:5:0:7:8)\n// ...\nconst ipV6ZeroCompressionRegex =\n /^(([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)$/;\n\nconst ipV6ZeroCompressionCIDRRegex =\n /^((([0-9A-Fa-f]{1,4}:){7})([0-9A-Fa-f]{1,4})|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/([1-9]|[1-9][0-9]|10[0-9]|11[0-9]|12[0-8])$/;\n\n/**\n * Validator factory for a IPV6 address.\n\n */\nexport const ipV6Validator = (options: {\n zeroCompression?: boolean;\n cidr?: boolean;\n}): ValidatorFn => {\n return (control: AbstractControl): ValidationErrors | null => {\n const value = control.value;\n let valid: boolean | RegExpMatchArray | null | undefined;\n if (options.cidr && options.zeroCompression) {\n valid = value === '' || value?.match(ipV6ZeroCompressionCIDRRegex);\n } else if (options.cidr) {\n valid = value === '' || value?.match(ipV6CIDRRegex);\n } else if (options.zeroCompression) {\n valid =\n (value === '' || value?.toString().match(ipV6ZeroCompressionRegex)) &&\n value?.split('::').length <= 2;\n } else {\n valid = value === '' || value?.toString().match(ipV6Regex);\n }\n return valid ? null : { ipv6Address: true };\n };\n};\n\n/**\n * Validates a IPV4 address.\n */\nexport const ipV4Validator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\n const v = control.value;\n const valid = v === '' || v?.toString().match(ipv4Regex);\n return valid ? null : { ipv4Address: true };\n};\n\n/**\n * Validates a IPV4 address including CIDR.\n */\nexport const ipV4CIDRValidator: ValidatorFn = (\n control: AbstractControl\n): ValidationErrors | null => {\n const v = control.value;\n const valid = v === '' || v?.toString().match(ipv4CIDRRegex);\n return valid ? null : { ipv4Address: true };\n};\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n Renderer2,\n signal\n} from '@angular/core';\nimport { SI_FORM_ITEM_CONTROL } from '@siemens/element-ng/form';\n\nconst eventMap = new Map<string, 'insert' | 'delete' | 'paste'>([\n ['insertText', 'insert'],\n ['insertFromPaste', 'paste'],\n ['deleteContentBackward', 'delete']\n]);\n\nexport interface AddrInputEvent {\n type?: 'insert' | 'delete' | 'paste';\n pos: number;\n change: string | null;\n value?: string | null;\n previous?: string | null;\n}\n\n/**\n * Base directive for ip address input fields.\n */\n@Directive({\n selector: 'input[siIpInput]',\n providers: [\n {\n provide: SI_FORM_ITEM_CONTROL,\n useExisting: SiIpInputDirective\n }\n ],\n host: {\n '[id]': 'id()',\n '[disabled]': 'disabled() || null'\n }\n})\nexport abstract class SiIpInputDirective {\n private static idCounter = 0;\n protected readonly elementRef = inject(ElementRef<HTMLInputElement>);\n protected readonly renderer = inject(Renderer2);\n protected readonly inputEl = this.elementRef.nativeElement;\n\n /**\n * @defaultValue\n * ```\n * `si-ip-input-${SiIpInputDirective.idCounter++}`\n * ```\n */\n readonly id = input(`si-ip-input-${SiIpInputDirective.idCounter++}`);\n\n /**\n * Enable CIDR (Classless Inter-Domain Routing) notation.\n * @defaultValue false\n */\n readonly cidr = input(false, { transform: booleanAttribute });\n\n /**\n * Whether the ip address input is disabled.\n * @defaultValue false\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n readonly disabledInput = input(false, { alias: 'disabled' });\n\n private readonly disabledNgControl = signal(false);\n protected readonly disabled = computed(() => this.disabledInput() || this.disabledNgControl());\n protected onTouched: () => void = () => {};\n protected onChange: (value: any) => void = () => {};\n protected value?: string | null = '';\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabledNgControl.set(isDisabled);\n }\n\n writeValue(value?: string | null): void {\n this.value = value;\n this.renderer.setProperty(this.inputEl, 'value', value ?? '');\n }\n\n @HostListener('input', ['$event'])\n protected onInput(e: Event): void {\n const el = e.target as HTMLInputElement;\n const selStart = el.selectionStart ?? 0;\n const { inputType, data } = e as InputEvent;\n const len = data?.length ?? 0;\n this.maskInput({\n value: el.value,\n type: eventMap.get(inputType),\n change: data,\n pos: selStart - len,\n previous: this.value\n });\n\n this.value = el.value;\n this.onChange(this.value);\n }\n\n @HostListener('blur')\n protected blur(): void {\n this.onTouched();\n }\n\n protected abstract maskInput(e: AddrInputEvent): void;\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { Directive } from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator\n} from '@angular/forms';\n\nimport { splitIpV4Sections } from './address-utils';\nimport { ipV4CIDRValidator, ipV4Validator } from './address-validators';\nimport { AddrInputEvent, SiIpInputDirective } from './si-ip-input.directive';\n\n/**\n * Directive for IPv4 address input fields.\n *\n * Usage:\n *\n * ```ts\n * import { SiFormItemComponent } from '@siemens/element-ng/form';\n * import { SiIp4InputDirective } from '@siemens/element-ng/ip-input';\n *\n * @Component({\n * template: `\n * <si-form-item label=\"IPv4 address\">\n * <input type=\"text\" class=\"form-control\" siIpV4 />\n * </si-form-item>\n * `,\n * imports: [SiFormItemComponent, SiIp4InputDirective, ...]\n * })\n * ```\n */\n@Directive({\n selector: 'input[siIpV4]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: SiIp4InputDirective,\n multi: true\n },\n {\n provide: NG_VALIDATORS,\n useExisting: SiIp4InputDirective,\n multi: true\n }\n ],\n exportAs: 'siIpV4'\n})\nexport class SiIp4InputDirective\n extends SiIpInputDirective\n implements ControlValueAccessor, Validator\n{\n validate(control: AbstractControl): ValidationErrors | null {\n return this.cidr() ? ipV4CIDRValidator(control) : ipV4Validator(control);\n }\n\n protected maskInput(e: AddrInputEvent): void {\n const { value, pos, type } = e;\n const sections = splitIpV4Sections({ type, input: value, pos, cidr: this.cidr() });\n\n this.renderer.setProperty(\n this.inputEl,\n 'value',\n sections\n .splice(0, this.cidr() ? 9 : 7)\n .map(s => s.value)\n .join('')\n );\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { computed, Directive } from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator\n} from '@angular/forms';\n\nimport { splitIpV6Sections } from './address-utils';\nimport { ipV6Validator } from './address-validators';\nimport { AddrInputEvent, SiIpInputDirective } from './si-ip-input.directive';\n\n/**\n * Directive for IPv6 address input fields.\n *\n * Usage:\n *\n * ```ts\n * import { SiFormItemComponent } from '@siemens/element-ng/form';\n * import { SiIp6InputDirective } from '@siemens/element-ng/ip-input';\n *\n * @Component({\n * template: `\n * <si-form-item label=\"IPv6 address\">\n * <input type=\"text\" class=\"form-control\" siIpV6 />\n * </si-form-item>\n * `,\n * imports: [SiFormItemComponent, SiIp6InputDirective, ...]\n * })\n * ```\n */\n@Directive({\n selector: 'input[siIpV6]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: SiIp6InputDirective,\n multi: true\n },\n {\n provide: NG_VALIDATORS,\n useExisting: SiIp6InputDirective,\n multi: true\n }\n ],\n exportAs: 'siIpV6'\n})\nexport class SiIp6InputDirective\n extends SiIpInputDirective\n implements ControlValueAccessor, Validator\n{\n protected readonly validatorFn = computed(() =>\n ipV6Validator({ zeroCompression: true, cidr: this.cidr() })\n );\n\n validate(control: AbstractControl): ValidationErrors | null {\n return this.validatorFn()(control);\n }\n\n protected maskInput(e: AddrInputEvent): void {\n const { value, pos, type } = e;\n if (!value) {\n this.renderer.setProperty(this.inputEl, 'value', '');\n return;\n }\n\n // TODO: Restore cursor position\n const sections = splitIpV6Sections({\n type,\n input: value,\n pos,\n zeroCompression: true,\n cidr: this.cidr()\n });\n this.renderer.setProperty(\n this.inputEl,\n 'value',\n sections\n .splice(0, this.cidr() ? 17 : 15)\n .map(s => s.value)\n .join('')\n );\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-ip4-input.directive';\nexport * from './si-ip6-input.directive';\nexport * from './address-validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,OAAO,GAAG,CAAC,CAAS,KAAc,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG;AAC5D,MAAM,KAAK,GAAG,CAAC,CAAS,KAAc,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC;AAEtF;;AAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAAwB,KAAe;IACvE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAO;IACpC,MAAM,QAAQ,GAAc,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,QAAQ;;IAEjB,IAAI,OAAO,GAAG,CAAC;AACf,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK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AAA,EAAA,SAAA,EAdnB;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,iBAAiB;AAC1B,gBAAA,WAAW,EAAE,mBAAmB;AAChC,gBAAA,KAAK,EAAE;AACR,aAAA;AACD,YAAA;AACE,gBAAA,OAAO,EAAE,aAAa;AACtB,gBAAA,WAAW,EAAE,mBAAmB;AAChC,gBAAA,KAAK,EAAE;AACR;AACF,SAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAGU,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAhB/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAA,mBAAqB;AAChC,4BAAA,KAAK,EAAE;AACR,yBAAA;AACD,wBAAA;AACE,4BAAA,OAAO,EAAE,aAAa;AACtB,4BAAA,WAAW,EAAA,mBAAqB;AAChC,4BAAA,KAAK,EAAE;AACR;AACF,qBAAA;AACD,oBAAA,QAAQ,EAAE;AACX,iBAAA;;;ACpDD;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-ip-input.mjs","sources":["../../../../projects/element-ng/ip-input/address-utils.ts","../../../../projects/element-ng/ip-input/address-validators.ts","../../../../projects/element-ng/ip-input/si-ip-input.directive.ts","../../../../projects/element-ng/ip-input/si-ip4-input.directive.ts","../../../../projects/element-ng/ip-input/si-ip6-input.directive.ts","../../../../projects/element-ng/ip-input/index.ts","../../../../projects/element-ng/ip-input/siemens-element-ng-ip-input.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\n/** */\nexport interface Section {\n value: string;\n current?: boolean;\n /** Indicate this is a network mask. */\n mask?: boolean;\n}\n\nexport interface Ip4SplitOptions {\n type?: 'insert' | 'delete' | 'paste';\n input?: string | null;\n pos?: number;\n cidr?: boolean;\n}\n\nexport interface Ip6SplitOptions {\n type?: 'insert' | 'delete' | 'paste';\n input?: string | null;\n pos?: number;\n zeroCompression?: boolean;\n cidr?: boolean;\n}\n\nconst isDigit = (c: string): boolean => c >= '0' && c <= '9';\nconst isHex = (c: string): boolean => (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F');\n\n/**\n * Parse IPv4 input string into IPv4 address section array.\n */\nexport const splitIpV4Sections = (options: Ip4SplitOptions): Section[] => {\n const { input, pos, cidr } = options;\n const sections: Section[] = [{ value: '' }];\n if (!input) {\n return sections;\n }\n let maxDots = 3;\n for (let i = 0; i < input.length; i++) {\n const c = input.charAt(i);\n if (isDigit(c)) {\n sections.at(-1)!.value += c;\n } else if (c === '.' && maxDots > 0) {\n maxDots--;\n sections.push({ value: c }, { value: '' });\n } else if (cidr && c === '/') {\n sections.push({ value: c }, { value: '', mask: true });\n }\n if (pos === i) {\n sections.at(-1)!.current = true;\n }\n }\n\n // Trim empty sections for example the user entered ..\n let previousDivider = false;\n for (let i = 0; i < sections.length; i += 2) {\n const isDivider = sections.at(i)?.value === '' && sections.at(i + 1)?.value === '.';\n if (previousDivider && isDivider) {\n sections.splice(i, 2);\n }\n previousDivider = isDivider;\n }\n\n // Split values > 255 in multiple sections:\n // - 256 will be split into 25 and 6\n // - 255255255 will be split into 255, 255 and 255\n for (let i = 0; i < sections.length; i++) {\n const { value, current } = sections[i];\n if (value.length >= 3 && parseInt(value, 10) > 255) {\n const append: Section[] = [];\n let n = '';\n for (const c of value) {\n if (parseInt(n + c, 10) > 255) {\n append.push({ value: n }, { value: '.' });\n n = c;\n } else {\n n += c;\n }\n }\n if (n.length > 0) {\n append.push({ value: n });\n }\n sections.splice(i, 1, ...append);\n if (current) {\n sections[i + append.length - 1].current = true;\n }\n }\n }\n\n // Split leading zero sections:\n // Assume a string starting by 0 e.g. 012 will be split into 0 and 12\n for (let i = 0; i < sections.length; i++) {\n const sec = sections[i];\n if (sec.value.length > 1 && sec.value.startsWith('0')) {\n sections.splice(i, 1, { value: '0' }, { value: sec.value.substring(1) });\n }\n }\n\n // Ensure the that the CIDR divider is a slash\n if (cidr) {\n const startCidr = 7;\n if (startCidr < sections.length && sections[startCidr].value === '.') {\n sections[startCidr].value = '/';\n }\n const prefixPos = startCidr + 1;\n if (prefixPos < sections.length) {\n const prefixLength = sections[prefixPos].value;\n if (parseInt(prefixLength, 10) > 32) {\n sections[prefixPos].value = prefixLength.substring(0, 2);\n }\n }\n }\n\n return sections;\n};\n\nexport const splitIpV6Sections = (options: Ip6SplitOptions): Section[] => {\n const { type, input, pos, zeroCompression, cidr } = options;\n const sections: Section[] = [{ value: '' }];\n if (!input) {\n return sections;\n }\n\n for (let i = 0; i < input.length; i++) {\n const c = input.charAt(i).toUpperCase();\n if (isHex(c)) {\n sections.at(-1)!.value += c;\n } else if (c === ':') {\n if (input.charAt(i - 1) === c) {\n // Merge :: characters\n sections.at(-2)!.value += c;\n } else {\n sections.push({ value: c }, { value: '' });\n }\n } else if (cidr && c === '/') {\n sections.push({ value: c }, { value: '', mask: true });\n }\n if (pos === i) {\n sections.at(-1)!.current = true;\n }\n }\n\n // Split values > FFFF in multiple sections:\n // - 1FFFF will be split into 1FFF and F\n for (let i = 0; i < sections.length; i++) {\n const { value, current } = sections[i];\n if (value.length > 4) {\n const append: Section[] = [];\n for (let p = 0; p < value.length; p += 4) {\n const part = value.substring(p, p + 4);\n append.push({ value: part });\n if (part.length === 4) {\n append.push({ value: ':' });\n }\n }\n\n sections.splice(i, 1, ...append);\n if (current) {\n sections[i + append.length - 1].current = true;\n }\n }\n }\n\n // Drop invalid zero compression indicators '::'\n const removeEnd = pos === input.length - 1 || type === 'paste';\n let matches = sections.filter(s => s.value.startsWith('::'));\n if (matches) {\n matches = removeEnd ? matches : matches.reverse();\n if (zeroCompression) {\n matches.shift();\n }\n // Only allow one occurrence of ::\n for (const drop of matches) {\n drop.value = drop.value.substring(1);\n }\n }\n\n // Ensure the that the CIDR divider is a slash\n if (cidr) {\n const startCidr = matches.length > 0 ? 13 : 15;\n if (startCidr < sections.length && sections[startCidr].value === ':') {\n sections[startCidr].value = '/';\n }\n const prefixPos = startCidr + 1;\n if (prefixPos < sections.length) {\n const prefixLength = sections[prefixPos].value;\n if (parseInt(prefixLength, 10) > 128) {\n sections[prefixPos].value = prefixLength.substring(0, 2);\n }\n }\n }\n\n return sections;\n};\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\nconst ipv4Regex =\n /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;\n\nconst ipv4CIDRRegex =\n /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\/([1-9]|1[0-9]|2[0-9]|3[0-2]))$/;\n\nconst ipV6Regex =\n /^((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|:(?::[0-9A-Fa-f]{1,4}){1,7}|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,5}(?::[0-9A-Fa-f]{1,4}){1,2}|(?:[0-9A-Fa-f]{1,4}:){1,4}(?::[0-9A-Fa-f]{1,4}){1,3}|(?:[0-9A-Fa-f]{1,4}:){1,3}(?::[0-9A-Fa-f]{1,4}){1,4}|(?:[0-9A-Fa-f]{1,4}:){1,2}(?::[0-9A-Fa-f]{1,4}){1,5}|[0-9A-Fa-f]{1,4}:(?:(?::[0-9A-Fa-f]{1,4}){1,6})|:(?:(?::[0-9A-Fa-f]{1,4}){1,6}))$/;\n/**\n * Validator factory for a IPV6 address.\n */\nexport const ipV6Validator = (options: {\n zeroCompression?: boolean;\n cidr?: boolean;\n}): ValidatorFn => {\n return (control: AbstractControl): ValidationErrors | null => {\n const value = control.value;\n if (!value) {\n return null;\n }\n const parts = value.split('/');\n const error = { ipv6Address: true };\n if (options.cidr) {\n if (parts.length < 2 || !validateSubnet(parts[1])) {\n return error;\n }\n } else {\n if (parts.length > 1) {\n return error;\n }\n }\n if (parts[0].split('::').length > (options.zeroCompression ? 2 : 1)) {\n return error;\n }\n if (!matchIpV6(parts[0])) {\n return error;\n }\n\n return null;\n };\n};\n\n/**\n * Validates a IPV4 address.\n */\nexport const ipV4Validator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\n const v = control.value;\n const valid = v === '' || v?.toString().match(ipv4Regex);\n return valid ? null : { ipv4Address: true };\n};\n\n/**\n * Validates a IPV4 address including CIDR.\n */\nexport const ipV4CIDRValidator: ValidatorFn = (\n control: AbstractControl\n): ValidationErrors | null => {\n const v = control.value;\n const valid = v === '' || v?.toString().match(ipv4CIDRRegex);\n return valid ? null : { ipv4Address: true };\n};\n\nconst validateSubnet = (cidr: string): boolean => {\n const subnet = parseInt(cidr, 10);\n return subnet > 0 && subnet <= 128;\n};\n\nconst matchIpV6 = (ip: string): boolean => !!ip.match(ipV6Regex) && !!URL.parse(`http://[${ip}]`);\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n Renderer2,\n signal\n} from '@angular/core';\nimport { SI_FORM_ITEM_CONTROL } from '@siemens/element-ng/form';\n\nconst eventMap = new Map<string, 'insert' | 'delete' | 'paste'>([\n ['insertText', 'insert'],\n ['insertFromPaste', 'paste'],\n ['deleteContentBackward', 'delete']\n]);\n\nexport interface AddrInputEvent {\n type?: 'insert' | 'delete' | 'paste';\n pos: number;\n change: string | null;\n value?: string | null;\n previous?: string | null;\n}\n\n/**\n * Base directive for ip address input fields.\n */\n@Directive({\n selector: 'input[siIpInput]',\n providers: [\n {\n provide: SI_FORM_ITEM_CONTROL,\n useExisting: SiIpInputDirective\n }\n ],\n host: {\n '[id]': 'id()',\n '[disabled]': 'disabled() || null'\n }\n})\nexport abstract class SiIpInputDirective {\n private static idCounter = 0;\n protected readonly elementRef = inject(ElementRef<HTMLInputElement>);\n protected readonly renderer = inject(Renderer2);\n protected readonly inputEl = this.elementRef.nativeElement;\n\n /**\n * @defaultValue\n * ```\n * `si-ip-input-${SiIpInputDirective.idCounter++}`\n * ```\n */\n readonly id = input(`si-ip-input-${SiIpInputDirective.idCounter++}`);\n\n /**\n * Enable CIDR (Classless Inter-Domain Routing) notation.\n * @defaultValue false\n */\n readonly cidr = input(false, { transform: booleanAttribute });\n\n /**\n * Whether the ip address input is disabled.\n * @defaultValue false\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n readonly disabledInput = input(false, { alias: 'disabled' });\n\n private readonly disabledNgControl = signal(false);\n protected readonly disabled = computed(() => this.disabledInput() || this.disabledNgControl());\n protected onTouched: () => void = () => {};\n protected onChange: (value: any) => void = () => {};\n protected value?: string | null = '';\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabledNgControl.set(isDisabled);\n }\n\n writeValue(value?: string | null): void {\n this.value = value;\n this.renderer.setProperty(this.inputEl, 'value', value ?? '');\n }\n\n @HostListener('input', ['$event'])\n protected onInput(e: Event): void {\n const el = e.target as HTMLInputElement;\n const selStart = el.selectionStart ?? 0;\n const { inputType, data } = e as InputEvent;\n const len = data?.length ?? 0;\n this.maskInput({\n value: el.value,\n type: eventMap.get(inputType),\n change: data,\n pos: selStart - len,\n previous: this.value\n });\n\n this.value = el.value;\n this.onChange(this.value);\n }\n\n @HostListener('blur')\n protected blur(): void {\n this.onTouched();\n }\n\n protected abstract maskInput(e: AddrInputEvent): void;\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { Directive } from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator\n} from '@angular/forms';\n\nimport { splitIpV4Sections } from './address-utils';\nimport { ipV4CIDRValidator, ipV4Validator } from './address-validators';\nimport { AddrInputEvent, SiIpInputDirective } from './si-ip-input.directive';\n\n/**\n * Directive for IPv4 address input fields.\n *\n * Usage:\n *\n * ```ts\n * import { SiFormItemComponent } from '@siemens/element-ng/form';\n * import { SiIp4InputDirective } from '@siemens/element-ng/ip-input';\n *\n * @Component({\n * template: `\n * <si-form-item label=\"IPv4 address\">\n * <input type=\"text\" class=\"form-control\" siIpV4 />\n * </si-form-item>\n * `,\n * imports: [SiFormItemComponent, SiIp4InputDirective, ...]\n * })\n * ```\n */\n@Directive({\n selector: 'input[siIpV4]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: SiIp4InputDirective,\n multi: true\n },\n {\n provide: NG_VALIDATORS,\n useExisting: SiIp4InputDirective,\n multi: true\n }\n ],\n exportAs: 'siIpV4'\n})\nexport class SiIp4InputDirective\n extends SiIpInputDirective\n implements ControlValueAccessor, Validator\n{\n validate(control: AbstractControl): ValidationErrors | null {\n return this.cidr() ? ipV4CIDRValidator(control) : ipV4Validator(control);\n }\n\n protected maskInput(e: AddrInputEvent): void {\n const { value, pos, type } = e;\n const sections = splitIpV4Sections({ type, input: value, pos, cidr: this.cidr() });\n\n this.renderer.setProperty(\n this.inputEl,\n 'value',\n sections\n .splice(0, this.cidr() ? 9 : 7)\n .map(s => s.value)\n .join('')\n );\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport { computed, Directive } from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator\n} from '@angular/forms';\n\nimport { splitIpV6Sections } from './address-utils';\nimport { ipV6Validator } from './address-validators';\nimport { AddrInputEvent, SiIpInputDirective } from './si-ip-input.directive';\n\n/**\n * Directive for IPv6 address input fields.\n *\n * Usage:\n *\n * ```ts\n * import { SiFormItemComponent } from '@siemens/element-ng/form';\n * import { SiIp6InputDirective } from '@siemens/element-ng/ip-input';\n *\n * @Component({\n * template: `\n * <si-form-item label=\"IPv6 address\">\n * <input type=\"text\" class=\"form-control\" siIpV6 />\n * </si-form-item>\n * `,\n * imports: [SiFormItemComponent, SiIp6InputDirective, ...]\n * })\n * ```\n */\n@Directive({\n selector: 'input[siIpV6]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: SiIp6InputDirective,\n multi: true\n },\n {\n provide: NG_VALIDATORS,\n useExisting: SiIp6InputDirective,\n multi: true\n }\n ],\n exportAs: 'siIpV6'\n})\nexport class SiIp6InputDirective\n extends SiIpInputDirective\n implements ControlValueAccessor, Validator\n{\n protected readonly validatorFn = computed(() =>\n ipV6Validator({ zeroCompression: true, cidr: this.cidr() })\n );\n\n validate(control: AbstractControl): ValidationErrors | null {\n return this.validatorFn()(control);\n }\n\n protected maskInput(e: AddrInputEvent): void {\n const { value, pos, type } = e;\n if (!value) {\n this.renderer.setProperty(this.inputEl, 'value', '');\n return;\n }\n\n // TODO: Restore cursor position\n const sections = splitIpV6Sections({\n type,\n input: value,\n pos,\n zeroCompression: true,\n cidr: this.cidr()\n });\n this.renderer.setProperty(\n this.inputEl,\n 'value',\n sections\n .splice(0, this.cidr() ? 17 : 15)\n .map(s => s.value)\n .join('')\n );\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-ip4-input.directive';\nexport * from './si-ip6-input.directive';\nexport * from './address-validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,OAAO,GAAG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AAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAA,mBAAqB;AAChC,4BAAA,KAAK,EAAE;AACR,yBAAA;AACD,wBAAA;AACE,4BAAA,OAAO,EAAE,aAAa;AACtB,4BAAA,WAAW,EAAA,mBAAqB;AAChC,4BAAA,KAAK,EAAE;AACR;AACF,qBAAA;AACD,oBAAA,QAAQ,EAAE;AACX,iBAAA;;;ACpDD;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
@@ -66,15 +66,22 @@ declare class SiHeaderDropdownTriggerDirective implements OnChanges, OnInit, OnD
|
|
|
66
66
|
* Must only be opened using an {@link SiHeaderDropdownTriggerDirective}.
|
|
67
67
|
*/
|
|
68
68
|
declare class SiHeaderDropdownComponent {
|
|
69
|
+
/** @internal */
|
|
69
70
|
protected trigger: SiHeaderDropdownTriggerDirective;
|
|
70
71
|
private readonly focusTrap;
|
|
71
72
|
private previousElement;
|
|
72
73
|
private readonly document;
|
|
73
74
|
private readonly options;
|
|
74
75
|
constructor();
|
|
76
|
+
/** @internal */
|
|
75
77
|
protected get show(): boolean;
|
|
78
|
+
/** @internal */
|
|
79
|
+
protected get overlay(): boolean;
|
|
80
|
+
/** @internal */
|
|
76
81
|
protected get submenu(): boolean;
|
|
82
|
+
/** @internal */
|
|
77
83
|
protected get trapFocus(): boolean;
|
|
84
|
+
/** @internal */
|
|
78
85
|
protected escape(): void;
|
|
79
86
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SiHeaderDropdownComponent, never>;
|
|
80
87
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SiHeaderDropdownComponent, "si-header-dropdown", never, {}, {}, never, ["*"], true, never>;
|
package/ip-input/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siemens/element-ng",
|
|
3
3
|
"description": "Element Angular component library, implementing the Siemens Design Language",
|
|
4
|
-
"version": "48.2.0
|
|
4
|
+
"version": "48.2.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@angular/router": "20",
|
|
31
31
|
"@ngx-formly/bootstrap": "^6.2.2",
|
|
32
32
|
"@ngx-formly/core": "^6.2.2",
|
|
33
|
-
"@siemens/element-translate-ng": "48.2.0
|
|
34
|
-
"@siemens/element-theme": "48.2.0
|
|
33
|
+
"@siemens/element-translate-ng": "48.2.0",
|
|
34
|
+
"@siemens/element-theme": "48.2.0",
|
|
35
35
|
"@siemens/ngx-datatable": "22 - 24",
|
|
36
36
|
"flag-icons": "^7.3.2",
|
|
37
37
|
"google-libphonenumber": "^3.2.40",
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
"factory": "./ts-import-to-siemens-migration/index#tsImportMigration",
|
|
24
24
|
"schema": "./ts-import-to-siemens-migration/schema.json",
|
|
25
25
|
"aliases": ["ts-i-migration"]
|
|
26
|
+
},
|
|
27
|
+
"migrate-v47-to-v48": {
|
|
28
|
+
"description": "A migration schematic for updating Element from v47 to v48",
|
|
29
|
+
"factory": "./migrations/index#v47to48Migration",
|
|
30
|
+
"schema": "./migrations/schema.json",
|
|
31
|
+
"aliases": ["v47-to-v48"]
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { SchematicsException } from '@angular-devkit/schematics';
|
|
6
|
+
import * as ts from 'typescript';
|
|
7
|
+
import { discoverSourceFiles, getImportSpecifiers } from '../../utils/index.js';
|
|
8
|
+
import { ACTION_DIALOG_TYPES_REPLACEMENTS, ACTION_MODAL_SYMBOLS, DIALOG_METHOD_CONFIGS, LEGACY_METHODS } from './action-modal.mappings.js';
|
|
9
|
+
/**
|
|
10
|
+
* Migration rule for action modal methods.
|
|
11
|
+
* @param options - The options object containing the path to the project files to be migrated.
|
|
12
|
+
* @returns A schematic rule for migrating action modal methods.
|
|
13
|
+
*/
|
|
14
|
+
export const actionModalMigrationRule = (options) => {
|
|
15
|
+
return (tree, context) => {
|
|
16
|
+
context.logger.info('🔄 Migrating action modal methods to v48...');
|
|
17
|
+
const tsSourceFiles = discoverSourceFiles(tree, context, options.path);
|
|
18
|
+
for (const filePath of tsSourceFiles) {
|
|
19
|
+
const content = tree.read(filePath);
|
|
20
|
+
if (!content) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const sourceFile = ts.createSourceFile(filePath, content.toString(), ts.ScriptTarget.Latest, true);
|
|
24
|
+
// Match both @siemens/element-ng and @simpl/element-ng, with or without /action-modal
|
|
25
|
+
// This ensures we only process files that import from these modules
|
|
26
|
+
const modulePathToMatch = /@(siemens|simpl)\/element-ng(\/action-modal)?/;
|
|
27
|
+
const actionModalImports = getImportSpecifiers(sourceFile, modulePathToMatch, ACTION_MODAL_SYMBOLS);
|
|
28
|
+
if (!actionModalImports?.length) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const pendingTransformations = [];
|
|
32
|
+
const visitNodeAndCollectTransformations = (node) => {
|
|
33
|
+
// Collect method call transformations
|
|
34
|
+
if (ts.isCallExpression(node)) {
|
|
35
|
+
const methodTransformation = createActionDialogMethodCallTransformation(node);
|
|
36
|
+
if (methodTransformation) {
|
|
37
|
+
pendingTransformations.push(methodTransformation);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Collect type reference transformations
|
|
41
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
42
|
+
const typeTransformation = createActionDialogTypeTransformation(node);
|
|
43
|
+
if (typeTransformation) {
|
|
44
|
+
pendingTransformations.push(typeTransformation);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
node.forEachChild(visitNodeAndCollectTransformations);
|
|
48
|
+
};
|
|
49
|
+
sourceFile.forEachChild(visitNodeAndCollectTransformations);
|
|
50
|
+
if (pendingTransformations.length > 0) {
|
|
51
|
+
applyCodeTransformations(tree, filePath, pendingTransformations);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return tree;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const createActionDialogMethodCallTransformation = (node) => {
|
|
58
|
+
const expression = node.expression;
|
|
59
|
+
if (!ts.isPropertyAccessExpression(expression)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const methodName = expression.name.text;
|
|
63
|
+
if (!LEGACY_METHODS.includes(methodName)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const dialogPropertiesArray = generateDialogProperties(methodName, node.arguments);
|
|
67
|
+
const printer = ts.createPrinter();
|
|
68
|
+
const newNode = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(expression.expression, ts.factory.createIdentifier('showActionDialog')), undefined, [ts.factory.createObjectLiteralExpression(dialogPropertiesArray)]);
|
|
69
|
+
const newCode = printer.printNode(ts.EmitHint.Expression, newNode, node.getSourceFile());
|
|
70
|
+
return {
|
|
71
|
+
node,
|
|
72
|
+
newCode,
|
|
73
|
+
type: 'method-call'
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const createActionDialogTypeTransformation = (node) => {
|
|
77
|
+
const nodeText = node.getText().trim();
|
|
78
|
+
const matchingReplacement = ACTION_DIALOG_TYPES_REPLACEMENTS.find(typeReplacement => nodeText === typeReplacement.old);
|
|
79
|
+
if (!matchingReplacement) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
node,
|
|
84
|
+
newCode: `'${matchingReplacement.new}'`,
|
|
85
|
+
type: 'type-reference'
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Generates the dialog properties for the action dialog.
|
|
90
|
+
* @param methodName - The name of the method being migrated.
|
|
91
|
+
* @param nodeArguments - The arguments passed to the method.
|
|
92
|
+
* @returns An array of PropertyAssignment nodes for TypeScript printer.
|
|
93
|
+
* @throws SchematicsException if the method configuration is unknown.
|
|
94
|
+
*/
|
|
95
|
+
const generateDialogProperties = (methodName, nodeArguments) => {
|
|
96
|
+
const methodConfig = DIALOG_METHOD_CONFIGS[methodName];
|
|
97
|
+
if (!methodConfig) {
|
|
98
|
+
throw new SchematicsException(`Unknown method configuration for: ${methodName}`);
|
|
99
|
+
}
|
|
100
|
+
const dialogProperties = [
|
|
101
|
+
ts.factory.createPropertyAssignment(ts.factory.createIdentifier('type'), ts.factory.createStringLiteral(methodConfig.type, true))
|
|
102
|
+
];
|
|
103
|
+
nodeArguments.forEach((arg, index) => {
|
|
104
|
+
const paramName = methodConfig.parameters[index];
|
|
105
|
+
if (paramName) {
|
|
106
|
+
dialogProperties.push(ts.factory.createPropertyAssignment(ts.factory.createIdentifier(paramName), arg));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return dialogProperties;
|
|
110
|
+
};
|
|
111
|
+
const applyCodeTransformations = (tree, filePath, codeTransformations) => {
|
|
112
|
+
const recorder = tree.beginUpdate(filePath);
|
|
113
|
+
// Sort by position (descending) to avoid offset issues
|
|
114
|
+
codeTransformations
|
|
115
|
+
.sort((a, b) => b.node.getStart() - a.node.getStart())
|
|
116
|
+
.forEach(({ node, newCode }) => {
|
|
117
|
+
recorder.remove(node.getStart(), node.getWidth());
|
|
118
|
+
recorder.insertLeft(node.getStart(), newCode);
|
|
119
|
+
});
|
|
120
|
+
tree.commitUpdate(recorder);
|
|
121
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export const ACTION_MODAL_SYMBOLS = [
|
|
6
|
+
'AlertDialogResult',
|
|
7
|
+
'ConfirmationDialogResult',
|
|
8
|
+
'DeleteConfirmationDialogResult',
|
|
9
|
+
'EditDiscardDialogResult',
|
|
10
|
+
'SiActionDialogService'
|
|
11
|
+
];
|
|
12
|
+
export const LEGACY_METHODS = [
|
|
13
|
+
'showAlertDialog',
|
|
14
|
+
'showConfirmationDialog',
|
|
15
|
+
'showEditDiscardDialog',
|
|
16
|
+
'showDeleteConfirmationDialog'
|
|
17
|
+
];
|
|
18
|
+
export const DIALOG_METHOD_CONFIGS = {
|
|
19
|
+
showAlertDialog: {
|
|
20
|
+
type: 'alert',
|
|
21
|
+
parameters: ['message', 'heading', 'confirmBtnName', 'translationParams', 'icon', 'diOptions']
|
|
22
|
+
},
|
|
23
|
+
showConfirmationDialog: {
|
|
24
|
+
type: 'confirmation',
|
|
25
|
+
parameters: [
|
|
26
|
+
'message',
|
|
27
|
+
'heading',
|
|
28
|
+
'confirmBtnName',
|
|
29
|
+
'declineBtnName',
|
|
30
|
+
'translationParams',
|
|
31
|
+
'icon',
|
|
32
|
+
'diOptions'
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
showEditDiscardDialog: {
|
|
36
|
+
type: 'edit-discard',
|
|
37
|
+
parameters: [
|
|
38
|
+
'disableSave',
|
|
39
|
+
'message',
|
|
40
|
+
'heading',
|
|
41
|
+
'saveBtnName',
|
|
42
|
+
'discardBtnName',
|
|
43
|
+
'cancelBtnName',
|
|
44
|
+
'disableSaveMessage',
|
|
45
|
+
'disableSaveDiscardBtnName',
|
|
46
|
+
'translationParams',
|
|
47
|
+
'icon',
|
|
48
|
+
'diOptions'
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
showDeleteConfirmationDialog: {
|
|
52
|
+
type: 'delete-confirm',
|
|
53
|
+
parameters: [
|
|
54
|
+
'message',
|
|
55
|
+
'heading',
|
|
56
|
+
'deleteBtnName',
|
|
57
|
+
'cancelBtnName',
|
|
58
|
+
'translationParams',
|
|
59
|
+
'icon',
|
|
60
|
+
'diOptions'
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export const ACTION_DIALOG_TYPES_REPLACEMENTS = [
|
|
65
|
+
// Alert dialog
|
|
66
|
+
{
|
|
67
|
+
old: 'AlertDialogResult.Confirm',
|
|
68
|
+
new: 'confirm'
|
|
69
|
+
},
|
|
70
|
+
// Edit discard dialog
|
|
71
|
+
{
|
|
72
|
+
old: 'EditDiscardDialogResult.Save',
|
|
73
|
+
new: 'save'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
old: 'EditDiscardDialogResult.Discard',
|
|
77
|
+
new: 'discard'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
old: 'EditDiscardDialogResult.Cancel',
|
|
81
|
+
new: 'cancel'
|
|
82
|
+
},
|
|
83
|
+
// Confirmation dialog
|
|
84
|
+
{
|
|
85
|
+
old: 'ConfirmationDialogResult.Confirm',
|
|
86
|
+
new: 'confirm'
|
|
87
|
+
},
|
|
88
|
+
{ old: 'ConfirmationDialogResult.Decline', new: 'decline' },
|
|
89
|
+
// Delete confirmation dialog
|
|
90
|
+
{
|
|
91
|
+
old: 'DeleteConfirmationDialogResult.Delete',
|
|
92
|
+
new: 'delete'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
old: 'DeleteConfirmationDialogResult.Cancel',
|
|
96
|
+
new: 'cancel'
|
|
97
|
+
}
|
|
98
|
+
];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { chain } from '@angular-devkit/schematics';
|
|
6
|
+
import { actionModalMigrationRule } from './action-modal-migration/index.js';
|
|
7
|
+
import { toLegacyMigrationRule } from './to-legacy-migration/to-legacy-migration';
|
|
8
|
+
export const v47to48Migration = (options) => {
|
|
9
|
+
return (tree, context) => {
|
|
10
|
+
context.logger.info('🚀 Starting migration from v47 to v48...');
|
|
11
|
+
return chain([actionModalMigrationRule(options), toLegacyMigrationRule(options)])(tree, context);
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "v47to48MigrationSchema",
|
|
4
|
+
"title": "Siemens Element v47 to v48 migration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Path to the directory where the migration should be applied.",
|
|
10
|
+
"x-prompt": "Which directory do you want to migrate?",
|
|
11
|
+
"format": "path",
|
|
12
|
+
"default": "/"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { EmitHint } from 'typescript';
|
|
3
|
+
import { discoverSourceFiles, renameAttribute, renameElementTag, renameIdentifier } from '../../utils/index.js';
|
|
4
|
+
import { IDENTIFIER_RENAMING_INSTRUCTIONS, ELEMENT_RENAMING_INSTRUCTIONS, ATTRIBUTE_RENAMING_INSTRUCTIONS } from './to-legacy-replacement.js';
|
|
5
|
+
export const toLegacyMigrationRule = (options) => {
|
|
6
|
+
return (tree, context) => {
|
|
7
|
+
context.logger.info('🔄 Running legacy migration rule...');
|
|
8
|
+
const tsSourceFiles = discoverSourceFiles(tree, context, options.path);
|
|
9
|
+
for (const filePath of tsSourceFiles) {
|
|
10
|
+
const content = tree.read(filePath);
|
|
11
|
+
if (!content) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const sourceFile = ts.createSourceFile(filePath, content.toString(), ts.ScriptTarget.Latest, true);
|
|
15
|
+
const changeInstructions = renameIdentifier({
|
|
16
|
+
sourceFile,
|
|
17
|
+
renamingInstructions: IDENTIFIER_RENAMING_INSTRUCTIONS
|
|
18
|
+
});
|
|
19
|
+
let recorder = undefined;
|
|
20
|
+
let printer = undefined;
|
|
21
|
+
for (const changeInstruction of changeInstructions) {
|
|
22
|
+
recorder ??= tree.beginUpdate(filePath);
|
|
23
|
+
printer ??= ts.createPrinter();
|
|
24
|
+
recorder.remove(changeInstruction.start, changeInstruction.width);
|
|
25
|
+
recorder.insertLeft(changeInstruction.start, printer.printNode(EmitHint.Unspecified, changeInstruction.newNode, sourceFile));
|
|
26
|
+
}
|
|
27
|
+
if (!recorder) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
for (const [fromName, toName] of ELEMENT_RENAMING_INSTRUCTIONS) {
|
|
31
|
+
renameElementTag({
|
|
32
|
+
tree,
|
|
33
|
+
recorder,
|
|
34
|
+
sourceFile,
|
|
35
|
+
filePath,
|
|
36
|
+
fromName,
|
|
37
|
+
toName
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
for (const [fromName, toName] of ATTRIBUTE_RENAMING_INSTRUCTIONS) {
|
|
41
|
+
renameAttribute({
|
|
42
|
+
tree,
|
|
43
|
+
recorder,
|
|
44
|
+
sourceFile,
|
|
45
|
+
filePath,
|
|
46
|
+
fromName,
|
|
47
|
+
toName
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
tree.commitUpdate(recorder);
|
|
51
|
+
}
|
|
52
|
+
context.logger.info(`✅ Legacy migration complete!`);
|
|
53
|
+
return tree;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
export const IDENTIFIER_RENAMING_INSTRUCTIONS = [
|
|
6
|
+
{
|
|
7
|
+
module: /@(siemens|simpl)\/element-ng(\/icon)?/,
|
|
8
|
+
symbolRenamings: [['SiIconComponent', 'SiIconLegacyComponent']]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
module: /@(siemens|simpl)\/element-ng(\/tabs)?/,
|
|
12
|
+
symbolRenamings: [
|
|
13
|
+
['SiTabComponent', 'SiTabLegacyComponent'],
|
|
14
|
+
['SiTabsetComponent', 'SiTabsetLegacyComponent'],
|
|
15
|
+
['SiTabsModule', 'SiTabsLegacyModule']
|
|
16
|
+
],
|
|
17
|
+
toModule: '@siemens/element-ng/tabs-legacy'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
module: /@(siemens|simpl)\/element-ng(\/popover)?/,
|
|
21
|
+
symbolRenamings: [
|
|
22
|
+
['SiPopoverDirective', 'SiPopoverLegacyDirective'],
|
|
23
|
+
['SiPopoverModule', 'SiPopoverLegacyModule']
|
|
24
|
+
],
|
|
25
|
+
toModule: '@siemens/element-ng/popover-legacy'
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
export const ELEMENT_RENAMING_INSTRUCTIONS = [
|
|
29
|
+
['si-icon', 'si-icon-legacy'],
|
|
30
|
+
['si-tabset', 'si-tabset-legacy'],
|
|
31
|
+
['si-tab', 'si-tab-legacy']
|
|
32
|
+
];
|
|
33
|
+
export const ATTRIBUTE_RENAMING_INSTRUCTIONS = [
|
|
34
|
+
['siPopover', 'siPopoverLegacy']
|
|
35
|
+
];
|
|
@@ -10,7 +10,8 @@ export const simplSiemensMigration = (_options) => {
|
|
|
10
10
|
context.logger.info('🚀 Starting Simpl to Siemens migration...');
|
|
11
11
|
const chainedRules = chain([
|
|
12
12
|
schematic('migrate-ts-imports-to-siemens', _options),
|
|
13
|
-
schematic('migrate-scss-imports-to-siemens', _options)
|
|
13
|
+
schematic('migrate-scss-imports-to-siemens', _options),
|
|
14
|
+
schematic('migrate-v47-to-v48', _options)
|
|
14
15
|
]);
|
|
15
16
|
return chainedRules(tree, context);
|
|
16
17
|
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Siemens 2016 - 2025
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { HtmlParser, RecursiveVisitor, visitAll } from '@angular/compiler';
|
|
6
|
+
export const findElement = (template, filter) => {
|
|
7
|
+
const { rootNodes, errors } = parseTemplate(template);
|
|
8
|
+
// Only evaluate templates without parse errors.
|
|
9
|
+
if (!errors.length) {
|
|
10
|
+
const visitor = new ElementCollector(filter);
|
|
11
|
+
visitAll(visitor, rootNodes);
|
|
12
|
+
return visitor.matches;
|
|
13
|
+
}
|
|
14
|
+
return [];
|
|
15
|
+
};
|
|
16
|
+
export const findAttribute = (template, filter) => {
|
|
17
|
+
const { rootNodes, errors } = parseTemplate(template);
|
|
18
|
+
// Only evaluate templates without parse errors.
|
|
19
|
+
if (!errors.length) {
|
|
20
|
+
const visitor = new AttributeCollector(filter);
|
|
21
|
+
visitAll(visitor, rootNodes);
|
|
22
|
+
return visitor.matches;
|
|
23
|
+
}
|
|
24
|
+
return [];
|
|
25
|
+
};
|
|
26
|
+
const parseTemplate = (template) => {
|
|
27
|
+
return new HtmlParser().parse(template, '', {
|
|
28
|
+
// Allows for ICUs to be parsed.
|
|
29
|
+
tokenizeExpansionForms: true,
|
|
30
|
+
// Explicitly disable blocks so that their characters are treated as plain text.
|
|
31
|
+
tokenizeBlocks: true,
|
|
32
|
+
preserveLineEndings: true
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
class ElementCollector extends RecursiveVisitor {
|
|
36
|
+
filter;
|
|
37
|
+
/**
|
|
38
|
+
* All elements which match the filter
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue []
|
|
41
|
+
*/
|
|
42
|
+
matches = [];
|
|
43
|
+
constructor(filter) {
|
|
44
|
+
super();
|
|
45
|
+
this.filter = filter;
|
|
46
|
+
}
|
|
47
|
+
visitElement(ast, context) {
|
|
48
|
+
if (this.filter(ast)) {
|
|
49
|
+
this.matches.push(ast);
|
|
50
|
+
}
|
|
51
|
+
super.visitElement(ast, context);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class AttributeCollector extends RecursiveVisitor {
|
|
55
|
+
filter;
|
|
56
|
+
/**
|
|
57
|
+
* All attributes which match the filter
|
|
58
|
+
*
|
|
59
|
+
* @defaultValue []
|
|
60
|
+
*/
|
|
61
|
+
matches = [];
|
|
62
|
+
constructor(filter) {
|
|
63
|
+
super();
|
|
64
|
+
this.filter = filter;
|
|
65
|
+
}
|
|
66
|
+
visitAttribute(ast, context) {
|
|
67
|
+
if (this.filter(ast)) {
|
|
68
|
+
this.matches.push(ast);
|
|
69
|
+
}
|
|
70
|
+
super.visitAttribute(ast, context);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { join, dirname } from 'path';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import { findAttribute, findElement } from './html-utils.js';
|
|
4
|
+
const getInlineTemplates = (source) => {
|
|
5
|
+
const templateNodes = [];
|
|
6
|
+
const componentDecoratorVisitor = (node) => {
|
|
7
|
+
if (ts.isDecorator(node) &&
|
|
8
|
+
ts.isCallExpression(node.expression) &&
|
|
9
|
+
ts.isIdentifier(node.expression.expression) &&
|
|
10
|
+
node.expression.expression.text === 'Component') {
|
|
11
|
+
const arg = node.expression.arguments[0];
|
|
12
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
13
|
+
const template = arg.properties.find(property => ts.isPropertyAssignment(property) &&
|
|
14
|
+
ts.isIdentifier(property.name) &&
|
|
15
|
+
property.name.text === 'template');
|
|
16
|
+
const initializer = template?.initializer;
|
|
17
|
+
if (initializer &&
|
|
18
|
+
(ts.isNoSubstitutionTemplateLiteral(initializer) || ts.isStringLiteral(initializer))) {
|
|
19
|
+
templateNodes.push(initializer);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
node.forEachChild(componentDecoratorVisitor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
source.forEachChild(componentDecoratorVisitor);
|
|
28
|
+
return templateNodes;
|
|
29
|
+
};
|
|
30
|
+
const getTemplateUrl = (source) => {
|
|
31
|
+
const templateUrls = [];
|
|
32
|
+
const componentDecoratorVisitor = (node) => {
|
|
33
|
+
if (ts.isDecorator(node) &&
|
|
34
|
+
ts.isCallExpression(node.expression) &&
|
|
35
|
+
ts.isIdentifier(node.expression.expression) &&
|
|
36
|
+
node.expression.expression.text === 'Component') {
|
|
37
|
+
const arg = node.expression.arguments[0];
|
|
38
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
39
|
+
const template = arg.properties.find(property => ts.isPropertyAssignment(property) &&
|
|
40
|
+
ts.isIdentifier(property.name) &&
|
|
41
|
+
property.name.text === 'templateUrl');
|
|
42
|
+
const initializer = template?.initializer;
|
|
43
|
+
if (initializer && ts.isStringLiteral(initializer)) {
|
|
44
|
+
templateUrls.push(initializer.text);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
node.forEachChild(componentDecoratorVisitor);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
source.forEachChild(componentDecoratorVisitor);
|
|
53
|
+
return templateUrls;
|
|
54
|
+
};
|
|
55
|
+
const renameElementTagInTemplate = ({ template, offset, recorder, fromName, toName }) => {
|
|
56
|
+
findElement(template, element => element.name === fromName).forEach(el => {
|
|
57
|
+
recorder.remove(el.startSourceSpan.start.offset + 1 + offset, fromName.length);
|
|
58
|
+
recorder.insertLeft(el.startSourceSpan.start.offset + 1 + offset, toName);
|
|
59
|
+
if (el.endSourceSpan && el.startSourceSpan.start !== el.endSourceSpan.start) {
|
|
60
|
+
recorder.remove(el.endSourceSpan?.start.offset + 2 + offset, fromName.length);
|
|
61
|
+
recorder.insertLeft(el.endSourceSpan?.start.offset + 2 + offset, toName);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const renameAttributeInTemplate = ({ template, offset, recorder, fromName, toName }) => {
|
|
66
|
+
findAttribute(template, element => element.name === fromName).forEach(el => {
|
|
67
|
+
recorder.remove(el.sourceSpan.start.offset + offset, fromName.length);
|
|
68
|
+
recorder.insertLeft(el.sourceSpan.start.offset + offset, toName);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export const renameElementTag = ({ tree, filePath, sourceFile, recorder, fromName, toName }) => {
|
|
72
|
+
getInlineTemplates(sourceFile).forEach(template => renameElementTagInTemplate({
|
|
73
|
+
template: template.text,
|
|
74
|
+
offset: template.getStart() + 1,
|
|
75
|
+
toName,
|
|
76
|
+
fromName,
|
|
77
|
+
recorder
|
|
78
|
+
}));
|
|
79
|
+
getTemplateUrl(sourceFile).forEach(templateUrl => {
|
|
80
|
+
const templatePath = join(dirname(filePath), templateUrl);
|
|
81
|
+
const templateContent = tree.read(templatePath).toString('utf-8');
|
|
82
|
+
const templateRecorder = tree.beginUpdate(templatePath);
|
|
83
|
+
renameElementTagInTemplate({
|
|
84
|
+
template: templateContent,
|
|
85
|
+
offset: 0,
|
|
86
|
+
toName,
|
|
87
|
+
fromName,
|
|
88
|
+
recorder: templateRecorder
|
|
89
|
+
});
|
|
90
|
+
tree.commitUpdate(templateRecorder);
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
export const renameAttribute = ({ tree, filePath, sourceFile, recorder, fromName, toName }) => {
|
|
94
|
+
getInlineTemplates(sourceFile).forEach(template => renameAttributeInTemplate({
|
|
95
|
+
template: template.text,
|
|
96
|
+
offset: template.getStart() + 1,
|
|
97
|
+
toName,
|
|
98
|
+
fromName,
|
|
99
|
+
recorder
|
|
100
|
+
}));
|
|
101
|
+
getTemplateUrl(sourceFile).forEach(templateUrl => {
|
|
102
|
+
const templatePath = join(dirname(filePath), templateUrl);
|
|
103
|
+
const templateContent = tree.read(templatePath).toString('utf-8');
|
|
104
|
+
const templateRecorder = tree.beginUpdate(templatePath);
|
|
105
|
+
renameAttributeInTemplate({
|
|
106
|
+
template: templateContent,
|
|
107
|
+
offset: 0,
|
|
108
|
+
toName,
|
|
109
|
+
fromName,
|
|
110
|
+
recorder: templateRecorder
|
|
111
|
+
});
|
|
112
|
+
tree.commitUpdate(templateRecorder);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
@@ -97,3 +97,99 @@ const visitDirectory = (fs, dirPath) => {
|
|
|
97
97
|
});
|
|
98
98
|
return files;
|
|
99
99
|
};
|
|
100
|
+
/** Finds an import specifier with a particular name. */
|
|
101
|
+
export const findImportSpecifier = (nodes, specifierName) => {
|
|
102
|
+
return nodes.find(element => {
|
|
103
|
+
const { name, propertyName } = element;
|
|
104
|
+
return propertyName ? propertyName.text === specifierName : name.text === specifierName;
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Note: returns only matching imports specifiers,
|
|
109
|
+
* Unmatched imports will be ignored (you won't get undefined), but a shorter array.
|
|
110
|
+
*/
|
|
111
|
+
export const getImportSpecifiers = (sourceFile, moduleName, specifierOrSpecifiers) => {
|
|
112
|
+
const matches = [];
|
|
113
|
+
for (const node of sourceFile.statements) {
|
|
114
|
+
if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const namedBindings = node.importClause?.namedBindings;
|
|
118
|
+
const isMatch = typeof moduleName === 'string'
|
|
119
|
+
? node.moduleSpecifier.text === moduleName
|
|
120
|
+
: moduleName.test(node.moduleSpecifier.text);
|
|
121
|
+
if (!isMatch || !namedBindings || !ts.isNamedImports(namedBindings)) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (typeof specifierOrSpecifiers === 'string') {
|
|
125
|
+
const match = findImportSpecifier(namedBindings.elements, specifierOrSpecifiers);
|
|
126
|
+
if (match) {
|
|
127
|
+
matches.push(match);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
for (const specifierName of specifierOrSpecifiers) {
|
|
132
|
+
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
133
|
+
if (match) {
|
|
134
|
+
matches.push(match);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return matches;
|
|
140
|
+
};
|
|
141
|
+
export function* renameIdentifier({ sourceFile, renamingInstructions }) {
|
|
142
|
+
for (const node of sourceFile.statements) {
|
|
143
|
+
if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier)) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
for (const renamingInstruction of renamingInstructions) {
|
|
147
|
+
if (!renamingInstruction.module.test(node.moduleSpecifier.text)) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (!(node.importClause?.namedBindings && ts.isNamedImports(node.importClause.namedBindings))) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
for (const [index, [fromName, toName]] of renamingInstruction.symbolRenamings.entries()) {
|
|
154
|
+
const importSpecifiers = findImportSpecifier(node.importClause.namedBindings.elements, fromName);
|
|
155
|
+
if (!importSpecifiers) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
yield {
|
|
159
|
+
start: importSpecifiers.name.getStart(),
|
|
160
|
+
width: importSpecifiers.name.getWidth(),
|
|
161
|
+
newNode: ts.factory.createIdentifier(toName)
|
|
162
|
+
};
|
|
163
|
+
if (renamingInstruction.toModule &&
|
|
164
|
+
!node.moduleSpecifier.text.endsWith('@simpl/element-ng') &&
|
|
165
|
+
index === 0) {
|
|
166
|
+
const newPath = node.moduleSpecifier.text.replace(renamingInstruction.module, renamingInstruction.toModule);
|
|
167
|
+
yield {
|
|
168
|
+
start: node.moduleSpecifier.getStart(),
|
|
169
|
+
width: node.moduleSpecifier.getWidth(),
|
|
170
|
+
newNode: ts.factory.createStringLiteral(newPath, true)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const visitor = function* (visitedNode) {
|
|
174
|
+
if (ts.isIdentifier(visitedNode) && visitedNode.text === fromName) {
|
|
175
|
+
yield {
|
|
176
|
+
start: visitedNode.getStart(),
|
|
177
|
+
width: visitedNode.getWidth(),
|
|
178
|
+
newNode: ts.factory.createIdentifier(toName)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
for (const child of visitedNode.getChildren()) {
|
|
183
|
+
yield* visitor(child);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
for (const statement of sourceFile.statements) {
|
|
188
|
+
if (!ts.isImportDeclaration(statement)) {
|
|
189
|
+
yield* visitor(statement);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|