@fundamental-ngx/ui5-webcomponents-ai 0.66.1-rc.2 → 0.66.1-rc.21
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/fesm2022/fundamental-ngx-ui5-webcomponents-ai-button-state.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-button-state.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-button.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-button.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-input.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-input.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-prompt-input.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-prompt-input.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-text-area.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-text-area.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-toolbar-label.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-toolbar-label.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-utils.mjs +20 -5
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-utils.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-versioning.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-versioning.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-writing-assistant.mjs +4 -3
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai-writing-assistant.mjs.map +1 -1
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai.mjs +52 -29
- package/fesm2022/fundamental-ngx-ui5-webcomponents-ai.mjs.map +1 -1
- package/package.json +4 -4
- package/types/fundamental-ngx-ui5-webcomponents-ai-utils.d.ts +5 -2
- package/types/fundamental-ngx-ui5-webcomponents-ai.d.ts +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-toolbar-label.mjs","sources":["../../../../libs/ui5-webcomponents-ai/toolbar-label/index.ts","../../../../libs/ui5-webcomponents-ai/toolbar-label/fundamental-ngx-ui5-webcomponents-ai-toolbar-label.ts"],"sourcesContent":["\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n output,\n AfterViewInit,\n effect,\n runInInjectionContext,\n inject,\n Injector,\n booleanAttribute,\n computed,\n signal\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/ToolbarLabel.js';\nimport { default as _ToolbarLabel } from '@ui5/webcomponents-ai/dist/ToolbarLabel.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n ContentDensityObserver,\n contentDensityObserverProviders,\n ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\nimport { default as ToolbarItemOverflowBehavior } from '@ui5/webcomponents/dist/types/ToolbarItemOverflowBehavior.js';\n\n@Component({\n standalone: true,\n selector: 'ui5-ai-toolbar-label, [ui5-ai-toolbar-label]',\n template: '<ng-content></ng-content>',\n exportAs: 'ui5ToolbarLabel',\n providers: [\n contentDensityObserverProviders({\n supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n })\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ToolbarLabel implements AfterViewInit {\n\n /**\n * Defines the text of the label.\n */\n text = input<typeof _ToolbarLabel.prototype.text | undefined>(\"\");\n\n /**\n * Co-overflow tag. Items in the same `ui5-toolbar` whose `overflowGroup` is the same\nnon-empty string overflow as one atomic unit: either all visible in the bar, or all\nin the overflow popover, never split. The empty string (the default) means \"no group\" —\nthe item participates in overflow independently.\n\nThe tag is a free-form, case-sensitive string label (e.g. `\"filters\"`, `\"search\"`). It is\nlayout-only and carries no ARIA, keyboard, or visual-cluster semantics. Items in a\nnon-empty group must have `overflowPriority = \"Default\"`; `AlwaysOverflow` and\n`NeverOverflow` are forbidden inside a group — setting one of those on a grouped item\nemits a one-shot `console.warn` and the item's priority is treated as `Default` for\nthe layout pass. Spacers (`ui5-toolbar-spacer`) do not participate in grouping; setting\na non-empty `overflowGroup` on a spacer emits a one-shot `console.warn` and the spacer's\nexisting overflow behavior is unchanged.\n\nThe visible bar always preserves slot order — ungrouped items between group members\nkeep their slot positions and the toolbar never reorders DOM children. In the popover\ngroup members appear adjacent in slot order.\n */\n overflowGroup = input<typeof _ToolbarLabel.prototype.overflowGroup | undefined>();\n\n /**\n * Property used to define the access of the item to the overflow Popover. If \"NeverOverflow\" option is set,\nthe item never goes in the Popover, if \"AlwaysOverflow\" - it never comes out of it.\n */\n overflowPriority = input<typeof _ToolbarLabel.prototype.overflowPriority | undefined>(\"Default\");\n\n /**\n * Defines if the toolbar overflow popup should close upon interaction with the item.\nIt will close by default.\n */\n preventOverflowClosing = input(false, { transform: booleanAttribute }); // className is now passed\n\n\n\n\n /**\n * Available slots for content projection in this component.\n *\n * Slots allow you to insert custom content into predefined areas of the web component.\n * Use the `slot` attribute on child elements to target specific slots.\n *\n * - **(default)**: Wrapped component slot.\n *\n * @example\n * ```html\n * <ui5-ai-toolbar-label>\n * <div slot=\"header\">Custom header content</div>\n * <p>Default slot content</p>\n * </ui5-ai-toolbar-label>\n * ```\n *\n * @readonly\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}\n */\n readonly slots = [\n {\n \"name\": \"default\",\n \"description\": \"Wrapped component slot.\",\n \"since\": \"2.20.0\"\n }\n ];\n\n\n public elementRef: ElementRef<_ToolbarLabel> = inject(ElementRef);\n public injector = inject(Injector);\n\n /**\n * Content density observer is injected to activate automatic CSS class and\n * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n * @private\n */\n private readonly _contentDensityObserver = inject(ContentDensityObserver);\n\n get element(): _ToolbarLabel {\n return this.elementRef.nativeElement;\n }\n\n ngAfterViewInit(): void {\n const wcElement = this.element;\n \n const inputsToSync = [\n 'text',\n 'overflowGroup',\n 'overflowPriority',\n 'preventOverflowClosing',\n ];\n \n // Synchronize inputs (properties)\n for (const inputName of inputsToSync) {\n // Find the corresponding camelCase signal property on the Angular component\n const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n // Use the Injector to run the effect in the correct context\n if (this[signalName] && typeof this[signalName] === 'function') {\n runInInjectionContext(this.injector, (): void => {\n effect((): void => {\n // Read the signal value\n const value = this[signalName]();\n if (wcElement) {\n //
|
|
1
|
+
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-toolbar-label.mjs","sources":["../../../../libs/ui5-webcomponents-ai/toolbar-label/index.ts","../../../../libs/ui5-webcomponents-ai/toolbar-label/fundamental-ngx-ui5-webcomponents-ai-toolbar-label.ts"],"sourcesContent":["\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n output,\n AfterViewInit,\n effect,\n runInInjectionContext,\n inject,\n Injector,\n booleanAttribute,\n computed,\n signal\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/ToolbarLabel.js';\nimport { default as _ToolbarLabel } from '@ui5/webcomponents-ai/dist/ToolbarLabel.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n ContentDensityObserver,\n contentDensityObserverProviders,\n ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\nimport { default as ToolbarItemOverflowBehavior } from '@ui5/webcomponents/dist/types/ToolbarItemOverflowBehavior.js';\n\n@Component({\n standalone: true,\n selector: 'ui5-ai-toolbar-label, [ui5-ai-toolbar-label]',\n template: '<ng-content></ng-content>',\n exportAs: 'ui5ToolbarLabel',\n providers: [\n contentDensityObserverProviders({\n supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n })\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ToolbarLabel implements AfterViewInit {\n\n /**\n * Defines the text of the label.\n */\n text = input<typeof _ToolbarLabel.prototype.text | undefined>(\"\");\n\n /**\n * Co-overflow tag. Items in the same `ui5-toolbar` whose `overflowGroup` is the same\nnon-empty string overflow as one atomic unit: either all visible in the bar, or all\nin the overflow popover, never split. The empty string (the default) means \"no group\" —\nthe item participates in overflow independently.\n\nThe tag is a free-form, case-sensitive string label (e.g. `\"filters\"`, `\"search\"`). It is\nlayout-only and carries no ARIA, keyboard, or visual-cluster semantics. Items in a\nnon-empty group must have `overflowPriority = \"Default\"`; `AlwaysOverflow` and\n`NeverOverflow` are forbidden inside a group — setting one of those on a grouped item\nemits a one-shot `console.warn` and the item's priority is treated as `Default` for\nthe layout pass. Spacers (`ui5-toolbar-spacer`) do not participate in grouping; setting\na non-empty `overflowGroup` on a spacer emits a one-shot `console.warn` and the spacer's\nexisting overflow behavior is unchanged.\n\nThe visible bar always preserves slot order — ungrouped items between group members\nkeep their slot positions and the toolbar never reorders DOM children. In the popover\ngroup members appear adjacent in slot order.\n */\n overflowGroup = input<typeof _ToolbarLabel.prototype.overflowGroup | undefined>();\n\n /**\n * Property used to define the access of the item to the overflow Popover. If \"NeverOverflow\" option is set,\nthe item never goes in the Popover, if \"AlwaysOverflow\" - it never comes out of it.\n */\n overflowPriority = input<typeof _ToolbarLabel.prototype.overflowPriority | undefined>(\"Default\");\n\n /**\n * Defines if the toolbar overflow popup should close upon interaction with the item.\nIt will close by default.\n */\n preventOverflowClosing = input(false, { transform: booleanAttribute }); // className is now passed\n\n\n\n\n /**\n * Available slots for content projection in this component.\n *\n * Slots allow you to insert custom content into predefined areas of the web component.\n * Use the `slot` attribute on child elements to target specific slots.\n *\n * - **(default)**: Wrapped component slot.\n *\n * @example\n * ```html\n * <ui5-ai-toolbar-label>\n * <div slot=\"header\">Custom header content</div>\n * <p>Default slot content</p>\n * </ui5-ai-toolbar-label>\n * ```\n *\n * @readonly\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}\n */\n readonly slots = [\n {\n \"name\": \"default\",\n \"description\": \"Wrapped component slot.\",\n \"since\": \"2.20.0\"\n }\n ];\n\n\n public elementRef: ElementRef<_ToolbarLabel> = inject(ElementRef);\n public injector = inject(Injector);\n\n /**\n * Content density observer is injected to activate automatic CSS class and\n * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n * @private\n */\n private readonly _contentDensityObserver = inject(ContentDensityObserver);\n\n get element(): _ToolbarLabel {\n return this.elementRef.nativeElement;\n }\n\n ngAfterViewInit(): void {\n const wcElement = this.element;\n \n const inputsToSync = [\n 'text',\n 'overflowGroup',\n 'overflowPriority',\n 'preventOverflowClosing',\n ];\n \n // Synchronize inputs (properties)\n for (const inputName of inputsToSync) {\n // Find the corresponding camelCase signal property on the Angular component\n const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n // Use the Injector to run the effect in the correct context\n if (this[signalName] && typeof this[signalName] === 'function') {\n let lastWritten: unknown;\n runInInjectionContext(this.injector, (): void => {\n effect((): void => {\n // Read the signal value\n const value = this[signalName]();\n if (wcElement) {\n // Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before\n if (value === undefined && lastWritten === undefined && wcElement[inputName]) {\n return;\n }\n // Write the value to the Web Component's property\n wcElement[inputName] = value;\n lastWritten = value;\n }\n });\n });\n }\n }\n \n \n \n\n }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAwCa,YAAY,CAAA;AAZzB,IAAA,WAAA,GAAA;AAcE;;AAEG;QACH,IAAA,CAAA,IAAI,GAAG,KAAK,CAAkD,EAAE;iFAAC;AAEjE;;;;;;;;;;;;;;;;;;AAkBG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK;qGAA4D;AAEjF;;;AAGG;QACH,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAA8D,SAAS;6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,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAPZ;AACT,YAAA,+BAA+B,CAAC;gBAC9B,uBAAuB,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,IAAI;aAC9E;AACF,SAAA,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EANS,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAS1B,YAAY,EAAA,UAAA,EAAA,CAAA;kBAZxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,8CAA8C;AACxD,oBAAA,QAAQ,EAAE,2BAA2B;AACrC,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,SAAS,EAAE;AACT,wBAAA,+BAA+B,CAAC;4BAC9B,uBAAuB,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,IAAI;yBAC9E;AACF,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAChD,iBAAA;;;ACvCD;;AAEG;;;;"}
|
|
@@ -13,6 +13,8 @@ class GenericControlValueAccessor {
|
|
|
13
13
|
this._valueSet = false;
|
|
14
14
|
this._initialized = false;
|
|
15
15
|
this._disabled = false;
|
|
16
|
+
this._rafId = null;
|
|
17
|
+
this._listeners = [];
|
|
16
18
|
}
|
|
17
19
|
// Default config if none provided
|
|
18
20
|
get effectiveConfig() {
|
|
@@ -25,10 +27,19 @@ class GenericControlValueAccessor {
|
|
|
25
27
|
ngAfterViewInit() {
|
|
26
28
|
// Initialize after the UI5 web component is ready
|
|
27
29
|
// Use requestAnimationFrame for zoneless compatibility instead of setTimeout
|
|
28
|
-
requestAnimationFrame(() => {
|
|
30
|
+
this._rafId = requestAnimationFrame(() => {
|
|
31
|
+
this._rafId = null;
|
|
29
32
|
this.initializeComponent();
|
|
30
33
|
});
|
|
31
34
|
}
|
|
35
|
+
ngOnDestroy() {
|
|
36
|
+
if (this._rafId !== null) {
|
|
37
|
+
cancelAnimationFrame(this._rafId);
|
|
38
|
+
this._rafId = null;
|
|
39
|
+
}
|
|
40
|
+
this._listeners.forEach((removeListener) => removeListener());
|
|
41
|
+
this._listeners = [];
|
|
42
|
+
}
|
|
32
43
|
setDisabledState(isDisabled) {
|
|
33
44
|
this._disabled = isDisabled;
|
|
34
45
|
const element = this.elementRef.nativeElement;
|
|
@@ -59,7 +70,7 @@ class GenericControlValueAccessor {
|
|
|
59
70
|
if (element && element.addEventListener) {
|
|
60
71
|
// Listen to all configured events
|
|
61
72
|
for (const eventName of config.events) {
|
|
62
|
-
|
|
73
|
+
const listener = (e) => {
|
|
63
74
|
if (this.onChange) {
|
|
64
75
|
const valueToEmit = this.getValueToEmit(config, e);
|
|
65
76
|
if (valueToEmit !== undefined) {
|
|
@@ -71,16 +82,20 @@ class GenericControlValueAccessor {
|
|
|
71
82
|
this.cdr.markForCheck();
|
|
72
83
|
}
|
|
73
84
|
}
|
|
74
|
-
}
|
|
85
|
+
};
|
|
86
|
+
element.addEventListener(eventName, listener);
|
|
87
|
+
this._listeners.push(() => element.removeEventListener(eventName, listener));
|
|
75
88
|
}
|
|
76
89
|
// Listen to focusout for touched state
|
|
77
|
-
|
|
90
|
+
const focusoutListener = () => {
|
|
78
91
|
if (this.onTouched) {
|
|
79
92
|
this.onTouched();
|
|
80
93
|
// Manually trigger change detection for zoneless compatibility
|
|
81
94
|
this.cdr.markForCheck();
|
|
82
95
|
}
|
|
83
|
-
}
|
|
96
|
+
};
|
|
97
|
+
element.addEventListener('focusout', focusoutListener);
|
|
98
|
+
this._listeners.push(() => element.removeEventListener('focusout', focusoutListener));
|
|
84
99
|
}
|
|
85
100
|
// Only apply stored value if writeValue was called (form control exists).
|
|
86
101
|
// Without this check, we'd overwrite native element values (e.g., value="Hello") with null.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-utils.mjs","sources":["../../../../libs/ui5-webcomponents-ai/utils/cva.ts","../../../../libs/ui5-webcomponents-ai/utils/fundamental-ngx-ui5-webcomponents-ai-utils.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n forwardRef,\n inject,\n InjectionToken\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * Configuration for the CVA behavior\n */\nexport interface CvaConfig {\n /** The property to bind to (e.g., 'value', 'checked') */\n property: string;\n /** The event(s) to listen to (e.g., 'change', 'input', or 'change,input') */\n events: string[];\n /** Value transformer function (e.g., for boolean coercion) */\n transformValue?: (value: any) => any;\n /**\n * Radio button mode: compares form control value with element's value attribute\n * and sets checked state accordingly. When true, the CVA will:\n * - Write: compare formControl.value === element.value, set element.checked\n * - Read: return element.value (not just true/false)\n */\n isRadioButton?: boolean;\n}\n\n/** Injection token for CVA configuration */\nexport const CVA_CONFIG = new InjectionToken<CvaConfig>('CVA_CONFIG');\n\n@Directive({\n selector: '[noop]',\n standalone: true,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => GenericControlValueAccessor),\n multi: true\n }\n ]\n})\nexport class GenericControlValueAccessor<ValueType = any> implements ControlValueAccessor, AfterViewInit {\n onChange!: (val: ValueType) => void;\n onTouched!: () => void;\n\n private elementRef = inject(ElementRef);\n private cdr = inject(ChangeDetectorRef);\n private config = inject(CVA_CONFIG, { optional: true });\n\n private _value: ValueType | null = null;\n private _valueSet = false;\n private _initialized = false;\n private _disabled = false;\n\n // Default config if none provided\n private get effectiveConfig(): CvaConfig {\n return (\n this.config || {\n property: 'value',\n events: ['change', 'input'],\n transformValue: (v) => v || ''\n }\n );\n }\n\n ngAfterViewInit(): void {\n // Initialize after the UI5 web component is ready\n // Use requestAnimationFrame for zoneless compatibility instead of setTimeout\n requestAnimationFrame(() => {\n this.initializeComponent();\n });\n }\n\n setDisabledState(isDisabled: boolean): void {\n this._disabled = isDisabled;\n const element = this.elementRef.nativeElement;\n if (element && this._initialized) {\n element.disabled = isDisabled;\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n }\n\n registerOnChange(fn: (newVal: ValueType) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n writeValue(val: ValueType): void {\n this._value = val;\n this._valueSet = true;\n if (this._initialized) {\n this.updateElementValue(val);\n }\n }\n\n private initializeComponent(): void {\n const element = this.elementRef.nativeElement;\n const config = this.effectiveConfig;\n this._initialized = true;\n\n // Set up event listeners on the UI5 web component\n\n if (element && element.addEventListener) {\n // Listen to all configured events\n for (const eventName of config.events) {\n element.addEventListener(eventName, (e: any) => {\n if (this.onChange) {\n const valueToEmit = this.getValueToEmit(config, e);\n if (valueToEmit !== undefined) {\n const transformedValue = config.transformValue\n ? config.transformValue(valueToEmit)\n : valueToEmit;\n this.onChange(transformedValue);\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n }\n });\n }\n\n // Listen to focusout for touched state\n element.addEventListener('focusout', () => {\n if (this.onTouched) {\n this.onTouched();\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n });\n }\n\n // Only apply stored value if writeValue was called (form control exists).\n // Without this check, we'd overwrite native element values (e.g., value=\"Hello\") with null.\n if (this._valueSet) {\n this.updateElementValue(this._value);\n }\n\n // Set initial disabled state if it was set before initialization\n if (this._disabled) {\n element.disabled = this._disabled;\n }\n }\n\n private getValueToEmit(config: CvaConfig, event: any): ValueType | undefined {\n // For radio buttons, emit the element's value when checked\n // For other components, emit the property value\n if (config.isRadioButton) {\n // Only emit if this radio button was checked\n if (event.target.checked) {\n return event.target.value;\n } else {\n // Don't emit anything if radio was unchecked (another one was selected)\n return;\n }\n } else {\n return event.target[config.property];\n }\n }\n\n private updateElementValue(value: ValueType | null): void {\n const element = this.elementRef.nativeElement;\n const config = this.effectiveConfig;\n\n if (element && this._initialized) {\n if (config.isRadioButton) {\n // For radio buttons, compare the form value with this element's value\n // and set checked accordingly\n const isChecked = element.value === value;\n element.checked = isChecked;\n } else {\n // For other components, set the property directly\n const transformedValue = config.transformValue ? config.transformValue(value) : value;\n element[config.property] = transformedValue;\n }\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AA8BA;MACa,UAAU,GAAG,IAAI,cAAc,CAAY,YAAY;MAavD,2BAA2B,CAAA;AAXxC,IAAA,WAAA,GAAA;AAeY,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAC/B,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAE/C,IAAA,CAAA,MAAM,GAAqB,IAAI;QAC/B,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,YAAY,GAAG,KAAK;QACpB,IAAA,CAAA,SAAS,GAAG,KAAK;AAiI5B,IAAA;;AA9HG,IAAA,IAAY,eAAe,GAAA;AACvB,QAAA,QACI,IAAI,CAAC,MAAM,IAAI;AACX,YAAA,QAAQ,EAAE,OAAO;AACjB,YAAA,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;YAC3B,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI;AAC/B,SAAA;IAET;IAEA,eAAe,GAAA;;;QAGX,qBAAqB,CAAC,MAAK;YACvB,IAAI,CAAC,mBAAmB,EAAE;AAC9B,QAAA,CAAC,CAAC;IACN;AAEA,IAAA,gBAAgB,CAAC,UAAmB,EAAA;AAChC,QAAA,IAA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ai-utils.mjs","sources":["../../../../libs/ui5-webcomponents-ai/utils/cva.ts","../../../../libs/ui5-webcomponents-ai/utils/fundamental-ngx-ui5-webcomponents-ai-utils.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n forwardRef,\n inject,\n InjectionToken,\n OnDestroy\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * Configuration for the CVA behavior\n */\nexport interface CvaConfig {\n /** The property to bind to (e.g., 'value', 'checked') */\n property: string;\n /** The event(s) to listen to (e.g., 'change', 'input', or 'change,input') */\n events: string[];\n /** Value transformer function (e.g., for boolean coercion) */\n transformValue?: (value: any) => any;\n /**\n * Radio button mode: compares form control value with element's value attribute\n * and sets checked state accordingly. When true, the CVA will:\n * - Write: compare formControl.value === element.value, set element.checked\n * - Read: return element.value (not just true/false)\n */\n isRadioButton?: boolean;\n}\n\n/** Injection token for CVA configuration */\nexport const CVA_CONFIG = new InjectionToken<CvaConfig>('CVA_CONFIG');\n\n@Directive({\n selector: '[noop]',\n standalone: true,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => GenericControlValueAccessor),\n multi: true\n }\n ]\n})\nexport class GenericControlValueAccessor<ValueType = any> implements ControlValueAccessor, AfterViewInit, OnDestroy {\n onChange!: (val: ValueType) => void;\n onTouched!: () => void;\n\n private elementRef = inject(ElementRef);\n private cdr = inject(ChangeDetectorRef);\n private config = inject(CVA_CONFIG, { optional: true });\n\n private _value: ValueType | null = null;\n private _valueSet = false;\n private _initialized = false;\n private _disabled = false;\n private _rafId: number | null = null;\n private _listeners: Array<() => void> = [];\n\n // Default config if none provided\n private get effectiveConfig(): CvaConfig {\n return (\n this.config || {\n property: 'value',\n events: ['change', 'input'],\n transformValue: (v) => v || ''\n }\n );\n }\n\n ngAfterViewInit(): void {\n // Initialize after the UI5 web component is ready\n // Use requestAnimationFrame for zoneless compatibility instead of setTimeout\n this._rafId = requestAnimationFrame(() => {\n this._rafId = null;\n this.initializeComponent();\n });\n }\n\n ngOnDestroy(): void {\n if (this._rafId !== null) {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n this._listeners.forEach((removeListener) => removeListener());\n this._listeners = [];\n }\n\n setDisabledState(isDisabled: boolean): void {\n this._disabled = isDisabled;\n const element = this.elementRef.nativeElement;\n if (element && this._initialized) {\n element.disabled = isDisabled;\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n }\n\n registerOnChange(fn: (newVal: ValueType) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n writeValue(val: ValueType): void {\n this._value = val;\n this._valueSet = true;\n if (this._initialized) {\n this.updateElementValue(val);\n }\n }\n\n private initializeComponent(): void {\n const element = this.elementRef.nativeElement;\n const config = this.effectiveConfig;\n this._initialized = true;\n\n // Set up event listeners on the UI5 web component\n\n if (element && element.addEventListener) {\n // Listen to all configured events\n for (const eventName of config.events) {\n const listener = (e: any): void => {\n if (this.onChange) {\n const valueToEmit = this.getValueToEmit(config, e);\n if (valueToEmit !== undefined) {\n const transformedValue = config.transformValue\n ? config.transformValue(valueToEmit)\n : valueToEmit;\n this.onChange(transformedValue);\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n }\n };\n element.addEventListener(eventName, listener);\n this._listeners.push((): void => element.removeEventListener(eventName, listener));\n }\n\n // Listen to focusout for touched state\n const focusoutListener = (): void => {\n if (this.onTouched) {\n this.onTouched();\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n };\n element.addEventListener('focusout', focusoutListener);\n this._listeners.push((): void => element.removeEventListener('focusout', focusoutListener));\n }\n\n // Only apply stored value if writeValue was called (form control exists).\n // Without this check, we'd overwrite native element values (e.g., value=\"Hello\") with null.\n if (this._valueSet) {\n this.updateElementValue(this._value);\n }\n\n // Set initial disabled state if it was set before initialization\n if (this._disabled) {\n element.disabled = this._disabled;\n }\n }\n\n private getValueToEmit(config: CvaConfig, event: any): ValueType | undefined {\n // For radio buttons, emit the element's value when checked\n // For other components, emit the property value\n if (config.isRadioButton) {\n // Only emit if this radio button was checked\n if (event.target.checked) {\n return event.target.value;\n } else {\n // Don't emit anything if radio was unchecked (another one was selected)\n return;\n }\n } else {\n return event.target[config.property];\n }\n }\n\n private updateElementValue(value: ValueType | null): void {\n const element = this.elementRef.nativeElement;\n const config = this.effectiveConfig;\n\n if (element && this._initialized) {\n if (config.isRadioButton) {\n // For radio buttons, compare the form value with this element's value\n // and set checked accordingly\n const isChecked = element.value === value;\n element.checked = isChecked;\n } else {\n // For other components, set the property directly\n const transformedValue = config.transformValue ? config.transformValue(value) : value;\n element[config.property] = transformedValue;\n }\n // Manually trigger change detection for zoneless compatibility\n this.cdr.markForCheck();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AA+BA;MACa,UAAU,GAAG,IAAI,cAAc,CAAY,YAAY;MAavD,2BAA2B,CAAA;AAXxC,IAAA,WAAA,GAAA;AAeY,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAC/B,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAE/C,IAAA,CAAA,MAAM,GAAqB,IAAI;QAC/B,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,YAAY,GAAG,KAAK;QACpB,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,MAAM,GAAkB,IAAI;QAC5B,IAAA,CAAA,UAAU,GAAsB,EAAE;AA+I7C,IAAA;;AA5IG,IAAA,IAAY,eAAe,GAAA;AACvB,QAAA,QACI,IAAI,CAAC,MAAM,IAAI;AACX,YAAA,Q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CAAC,GAAG,gBAAgB;YAC/C;;AAEA,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE;QAC3B;IACJ;8GA3JS,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,QAAA,EAAA,SAAA,EARzB;AACP,YAAA;AACI,gBAAA,OAAO,EAAE,iBAAiB;AAC1B,gBAAA,WAAW,EAAE,UAAU,CAAC,MAAM,2BAA2B,CAAC;AAC1D,gBAAA,KAAK,EAAE;AACV;AACJ,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAEQ,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAXvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,QAAQ;AAClB,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,SAAS,EAAE;AACP,wBAAA;AACI,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,iCAAiC,CAAC;AAC1D,4BAAA,KAAK,EAAE;AACV;AACJ;AACJ,iBAAA;;;AC5CD;;AAEG;;;;"}
|
|
@@ -109,18 +109,19 @@ class Versioning {
|
|
|
109
109
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
110
110
|
// Use the Injector to run the effect in the correct context
|
|
111
111
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
112
|
+
let lastWritten;
|
|
112
113
|
runInInjectionContext(this.injector, () => {
|
|
113
114
|
effect(() => {
|
|
114
115
|
// Read the signal value
|
|
115
116
|
const value = this[signalName]();
|
|
116
117
|
if (wcElement) {
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
if (value === undefined && wcElement[inputName]) {
|
|
118
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
119
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
// Write the value to the Web Component's property
|
|
123
123
|
wcElement[inputName] = value;
|
|
124
|
+
lastWritten = value;
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
127
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-versioning.mjs","sources":["../../../../libs/ui5-webcomponents-ai/versioning/index.ts","../../../../libs/ui5-webcomponents-ai/versioning/fundamental-ngx-ui5-webcomponents-ai-versioning.ts"],"sourcesContent":["\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n output,\n AfterViewInit,\n effect,\n runInInjectionContext,\n inject,\n Injector,\n booleanAttribute,\n computed,\n signal,\n DestroyRef\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/Versioning.js';\nimport { default as _Versioning } from '@ui5/webcomponents-ai/dist/Versioning.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n ContentDensityObserver,\n contentDensityObserverProviders,\n ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\nimport { default as ToolbarItemOverflowBehavior } from '@ui5/webcomponents/dist/types/ToolbarItemOverflowBehavior.js';\n\n@Component({\n standalone: true,\n selector: 'ui5-ai-versioning, [ui5-ai-versioning]',\n template: '<ng-content></ng-content>',\n exportAs: 'ui5Versioning',\n providers: [\n contentDensityObserverProviders({\n supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n })\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Versioning implements AfterViewInit {\n\n /**\n * Indicates the index of the currently displayed result version.\n\nThis property represents the current position in the version history.\n */\n currentStep = input<typeof _Versioning.prototype.currentStep | undefined>(0);\n\n /**\n * The total number of available result versions.\n\nNote: Versioning is hidden if the value is `0`.\n */\n totalSteps = input<typeof _Versioning.prototype.totalSteps | undefined>(0);\n\n /**\n * Co-overflow tag. Items in the same `ui5-toolbar` whose `overflowGroup` is the same\nnon-empty string overflow as one atomic unit: either all visible in the bar, or all\nin the overflow popover, never split. The empty string (the default) means \"no group\" —\nthe item participates in overflow independently.\n\nThe tag is a free-form, case-sensitive string label (e.g. `\"filters\"`, `\"search\"`). It is\nlayout-only and carries no ARIA, keyboard, or visual-cluster semantics. Items in a\nnon-empty group must have `overflowPriority = \"Default\"`; `AlwaysOverflow` and\n`NeverOverflow` are forbidden inside a group — setting one of those on a grouped item\nemits a one-shot `console.warn` and the item's priority is treated as `Default` for\nthe layout pass. Spacers (`ui5-toolbar-spacer`) do not participate in grouping; setting\na non-empty `overflowGroup` on a spacer emits a one-shot `console.warn` and the spacer's\nexisting overflow behavior is unchanged.\n\nThe visible bar always preserves slot order — ungrouped items between group members\nkeep their slot positions and the toolbar never reorders DOM children. In the popover\ngroup members appear adjacent in slot order.\n */\n overflowGroup = input<typeof _Versioning.prototype.overflowGroup | undefined>();\n\n /**\n * Property used to define the access of the item to the overflow Popover. If \"NeverOverflow\" option is set,\nthe item never goes in the Popover, if \"AlwaysOverflow\" - it never comes out of it.\n */\n overflowPriority = input<typeof _Versioning.prototype.overflowPriority | undefined>(\"Default\");\n\n /**\n * Defines if the toolbar overflow popup should close upon interaction with the item.\nIt will close by default.\n */\n preventOverflowClosing = input(false, { transform: booleanAttribute }); // className is now passed\n\n\n\n /**\n * Fired when the user clicks on version navigation buttons.\n */\n ui5VersionChange = output<UI5CustomEvent<_Versioning, 'version-change'>>();\n\n /**\n * Available slots for content projection in this component.\n *\n * Slots allow you to insert custom content into predefined areas of the web component.\n * Use the `slot` attribute on child elements to target specific slots.\n *\n * - **(default)**: Wrapped component slot.\n *\n * @example\n * ```html\n * <ui5-ai-versioning>\n * <div slot=\"header\">Custom header content</div>\n * <p>Default slot content</p>\n * </ui5-ai-versioning>\n * ```\n *\n * @readonly\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}\n */\n readonly slots = [\n {\n \"name\": \"default\",\n \"description\": \"Wrapped component slot.\",\n \"since\": \"2.20.0\"\n }\n ];\n\n\n public elementRef: ElementRef<_Versioning> = inject(ElementRef);\n public injector = inject(Injector);\n\n /**\n * Content density observer is injected to activate automatic CSS class and\n * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n * @private\n */\n private readonly _contentDensityObserver = inject(ContentDensityObserver);\n private readonly _destroyRef = inject(DestroyRef);\n\n get element(): _Versioning {\n return this.elementRef.nativeElement;\n }\n\n ngAfterViewInit(): void {\n const wcElement = this.element;\n \n const inputsToSync = [\n 'currentStep',\n 'totalSteps',\n 'overflowGroup',\n 'overflowPriority',\n 'preventOverflowClosing',\n ];\n \n // Synchronize inputs (properties)\n for (const inputName of inputsToSync) {\n // Find the corresponding camelCase signal property on the Angular component\n const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n // Use the Injector to run the effect in the correct context\n if (this[signalName] && typeof this[signalName] === 'function') {\n runInInjectionContext(this.injector, (): void => {\n effect((): void => {\n // Read the signal value\n const value = this[signalName]();\n if (wcElement) {\n // Skip writes when the signal is undefined and the property is already truthy\n // This prevents clobbering imperatively-set values (e.g., from RouterLink)\n if (value === undefined && wcElement[inputName]) {\n return;\n }\n // Write the value to the Web Component's property\n wcElement[inputName] = value;\n }\n });\n });\n }\n }\n \n \n const outputsToSync = [\n 'ui5VersionChange',\n ];\n \n // Synchronize outputs (events)\n const _listeners: Array<() => void> = [];\n for (const outputName of outputsToSync) {\n // Map Angular output name to UI5 web component event name\n const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);\n // Ensure the output property exists and has an emit function before adding listener\n if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {\n // Cast the listener to the correct type to satisfy TypeScript\n const listener = (e: Event): void => {\n\n this[outputName].emit(e as CustomEvent<any>);\n };\n wcElement.addEventListener(eventName, listener);\n _listeners.push(() => wcElement.removeEventListener(eventName, listener));\n }\n }\n this._destroyRef.onDestroy(() => _listeners.forEach((fn) => fn()));\n \n\n }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAyCa,UAAU,CAAA;AAZvB,IAAA,WAAA,GAAA;AAcE;;;;AAIG;QACH,IAAA,CAAA,WAAW,GAAG,KAAK,CAAuD,CAAC;wFAAC;AAE5E;;;;AAIG;QACH,IAAA,CAAA,UAAU,GAAG,KAAK,CAAsD,CAAC;uFAAC;AAE1E;;;;;;;;;;;;;;;;;;AAkBG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK;qGAA0D;AAE/E;;;AAGG;QACH,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAA4D,SAAS;6FAAC;AAE9F;;;AAGG;QACH,IAAA,CAAA,sBAAsB,GAAG,KAAK,CAAC,KAAK,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,wBAAA,EAAA,8BAAA,EAAA,CAAA,EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG,CAAC;AAIvE;;AAEG;QACH,IAAA,CAAA,gBAAgB,GAAG,MAAM,EAAiD;AAE1E;;;;;;;;;;;;;;;;;;AAkBG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG;AACb,YAAA;AACI,gBAAA,MAAM,EAAE,SAAS;AACjB,gBAAA,aAAa,EAAE,yBAAyB;AACxC,gBAAA,OAAO,EAAE;AACZ;SACJ;AAGM,QAAA,IAAA,CAAA,UAAU,GAA4B,MAAM,CAAC,UAAU,CAAC;AACxD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAElC;;;;AAIG;AACc,QAAA,IAAA,CAAA,uBAA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CAAC,MAAM;AAChD,iBAAA;;;ACxCD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-versioning.mjs","sources":["../../../../libs/ui5-webcomponents-ai/versioning/index.ts","../../../../libs/ui5-webcomponents-ai/versioning/fundamental-ngx-ui5-webcomponents-ai-versioning.ts"],"sourcesContent":["\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n output,\n AfterViewInit,\n effect,\n runInInjectionContext,\n inject,\n Injector,\n booleanAttribute,\n computed,\n signal,\n DestroyRef\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/Versioning.js';\nimport { default as _Versioning } from '@ui5/webcomponents-ai/dist/Versioning.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n ContentDensityObserver,\n contentDensityObserverProviders,\n ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\nimport { default as ToolbarItemOverflowBehavior } from '@ui5/webcomponents/dist/types/ToolbarItemOverflowBehavior.js';\n\n@Component({\n standalone: true,\n selector: 'ui5-ai-versioning, [ui5-ai-versioning]',\n template: '<ng-content></ng-content>',\n exportAs: 'ui5Versioning',\n providers: [\n contentDensityObserverProviders({\n supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n })\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Versioning implements AfterViewInit {\n\n /**\n * Indicates the index of the currently displayed result version.\n\nThis property represents the current position in the version history.\n */\n currentStep = input<typeof _Versioning.prototype.currentStep | undefined>(0);\n\n /**\n * The total number of available result versions.\n\nNote: Versioning is hidden if the value is `0`.\n */\n totalSteps = input<typeof _Versioning.prototype.totalSteps | undefined>(0);\n\n /**\n * Co-overflow tag. Items in the same `ui5-toolbar` whose `overflowGroup` is the same\nnon-empty string overflow as one atomic unit: either all visible in the bar, or all\nin the overflow popover, never split. The empty string (the default) means \"no group\" —\nthe item participates in overflow independently.\n\nThe tag is a free-form, case-sensitive string label (e.g. `\"filters\"`, `\"search\"`). It is\nlayout-only and carries no ARIA, keyboard, or visual-cluster semantics. Items in a\nnon-empty group must have `overflowPriority = \"Default\"`; `AlwaysOverflow` and\n`NeverOverflow` are forbidden inside a group — setting one of those on a grouped item\nemits a one-shot `console.warn` and the item's priority is treated as `Default` for\nthe layout pass. Spacers (`ui5-toolbar-spacer`) do not participate in grouping; setting\na non-empty `overflowGroup` on a spacer emits a one-shot `console.warn` and the spacer's\nexisting overflow behavior is unchanged.\n\nThe visible bar always preserves slot order — ungrouped items between group members\nkeep their slot positions and the toolbar never reorders DOM children. In the popover\ngroup members appear adjacent in slot order.\n */\n overflowGroup = input<typeof _Versioning.prototype.overflowGroup | undefined>();\n\n /**\n * Property used to define the access of the item to the overflow Popover. If \"NeverOverflow\" option is set,\nthe item never goes in the Popover, if \"AlwaysOverflow\" - it never comes out of it.\n */\n overflowPriority = input<typeof _Versioning.prototype.overflowPriority | undefined>(\"Default\");\n\n /**\n * Defines if the toolbar overflow popup should close upon interaction with the item.\nIt will close by default.\n */\n preventOverflowClosing = input(false, { transform: booleanAttribute }); // className is now passed\n\n\n\n /**\n * Fired when the user clicks on version navigation buttons.\n */\n ui5VersionChange = output<UI5CustomEvent<_Versioning, 'version-change'>>();\n\n /**\n * Available slots for content projection in this component.\n *\n * Slots allow you to insert custom content into predefined areas of the web component.\n * Use the `slot` attribute on child elements to target specific slots.\n *\n * - **(default)**: Wrapped component slot.\n *\n * @example\n * ```html\n * <ui5-ai-versioning>\n * <div slot=\"header\">Custom header content</div>\n * <p>Default slot content</p>\n * </ui5-ai-versioning>\n * ```\n *\n * @readonly\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}\n */\n readonly slots = [\n {\n \"name\": \"default\",\n \"description\": \"Wrapped component slot.\",\n \"since\": \"2.20.0\"\n }\n ];\n\n\n public elementRef: ElementRef<_Versioning> = inject(ElementRef);\n public injector = inject(Injector);\n\n /**\n * Content density observer is injected to activate automatic CSS class and\n * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n * @private\n */\n private readonly _contentDensityObserver = inject(ContentDensityObserver);\n private readonly _destroyRef = inject(DestroyRef);\n\n get element(): _Versioning {\n return this.elementRef.nativeElement;\n }\n\n ngAfterViewInit(): void {\n const wcElement = this.element;\n \n const inputsToSync = [\n 'currentStep',\n 'totalSteps',\n 'overflowGroup',\n 'overflowPriority',\n 'preventOverflowClosing',\n ];\n \n // Synchronize inputs (properties)\n for (const inputName of inputsToSync) {\n // Find the corresponding camelCase signal property on the Angular component\n const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n // Use the Injector to run the effect in the correct context\n if (this[signalName] && typeof this[signalName] === 'function') {\n let lastWritten: unknown;\n runInInjectionContext(this.injector, (): void => {\n effect((): void => {\n // Read the signal value\n const value = this[signalName]();\n if (wcElement) {\n // Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before\n if (value === undefined && lastWritten === undefined && wcElement[inputName]) {\n return;\n }\n // Write the value to the Web Component's property\n wcElement[inputName] = value;\n lastWritten = value;\n }\n });\n });\n }\n }\n \n \n const outputsToSync = [\n 'ui5VersionChange',\n ];\n \n // Synchronize outputs (events)\n const _listeners: Array<() => void> = [];\n for (const outputName of outputsToSync) {\n // Map Angular output name to UI5 web component event name\n const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);\n // Ensure the output property exists and has an emit function before adding listener\n if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {\n // Cast the listener to the correct type to satisfy TypeScript\n const listener = (e: Event): void => {\n\n this[outputName].emit(e as CustomEvent<any>);\n };\n wcElement.addEventListener(eventName, listener);\n _listeners.push(() => wcElement.removeEventListener(eventName, listener));\n }\n }\n this._destroyRef.onDestroy(() => _listeners.forEach((fn) => fn()));\n \n\n }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;M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BAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,sBAAA,EAAA,EAAA,iBAAA,EAAA,wBAAA,EAAA,UAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,gBAAA,EAAA,kBAAA,EAAA,EAAA,SAAA,EAPV;AACT,YAAA,+BAA+B,CAAC;gBAC9B,uBAAuB,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,IAAI;aAC9E;AACF,SAAA,EAAA,QAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EANS,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAS1B,UAAU,EAAA,UAAA,EAAA,CAAA;kBAZtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,wCAAwC;AAClD,oBAAA,QAAQ,EAAE,2BAA2B;AACrC,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE;AACT,wBAAA,+BAA+B,CAAC;4BAC9B,uBAAuB,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,IAAI;yBAC9E;AACF,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAChD,iBAAA;;;ACxCD;;AAEG;;;;"}
|
|
@@ -67,18 +67,19 @@ class WritingAssistant {
|
|
|
67
67
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
68
68
|
// Use the Injector to run the effect in the correct context
|
|
69
69
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
70
|
+
let lastWritten;
|
|
70
71
|
runInInjectionContext(this.injector, () => {
|
|
71
72
|
effect(() => {
|
|
72
73
|
// Read the signal value
|
|
73
74
|
const value = this[signalName]();
|
|
74
75
|
if (wcElement) {
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
if (value === undefined && wcElement[inputName]) {
|
|
76
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
77
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
// Write the value to the Web Component's property
|
|
81
81
|
wcElement[inputName] = value;
|
|
82
|
+
lastWritten = value;
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-writing-assistant.mjs","sources":["../../../../libs/ui5-webcomponents-ai/writing-assistant/index.ts","../../../../libs/ui5-webcomponents-ai/writing-assistant/fundamental-ngx-ui5-webcomponents-ai-writing-assistant.ts"],"sourcesContent":["\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n output,\n AfterViewInit,\n effect,\n runInInjectionContext,\n inject,\n Injector,\n booleanAttribute,\n computed,\n signal,\n DestroyRef\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/WritingAssistant.js';\nimport { default as _WritingAssistant } from '@ui5/webcomponents-ai/dist/WritingAssistant.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n ContentDensityObserver,\n contentDensityObserverProviders,\n ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\n\n\n@Component({\n standalone: true,\n selector: 'ui5-ai-writing-assistant, [ui5-ai-writing-assistant]',\n template: '<ng-content></ng-content>',\n exportAs: 'ui5WritingAssistant',\n providers: [\n contentDensityObserverProviders({\n supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n })\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WritingAssistant implements AfterViewInit {\n\n /**\n * Indicates the index of the currently displayed result version.\n\nThe index is **0-based** (i.e. `0` represents the first result).\nThis property is synchronized with the parent AI TextArea component.\n */\n currentVersion = input<typeof _WritingAssistant.prototype.currentVersion | undefined>(0);\n\n /**\n * Defines the prompt description of the Writing Assistant.\n\nThis text is displayed in the toolbar to indicate the current or last\nperformed AI action (e.g., \"Generated text\", \"Simplified text\").\n */\n promptDescription = input<typeof _WritingAssistant.prototype.promptDescription | undefined>(\"\");\n\n /**\n * Indicates the total number of result versions available.\n\nThis property determines whether version navigation controls are displayed.\nWhen totalVersions > 0, previous/next buttons become available.\n */\n totalVersions = input<typeof _WritingAssistant.prototype.totalVersions | undefined>(0); // className is now passed\n\n\n\n /**\n * Fired when the user clicks on the AI button.\n */\n ui5ButtonClick = output<UI5CustomEvent<_WritingAssistant, 'button-click'>>();\n\n /**\n * Fired when the user clicks on the \"Stop\" button to stop ongoing AI text generation.\n */\n ui5StopGeneration = output<UI5CustomEvent<_WritingAssistant, 'stop-generation'>>();\n\n /**\n * Fired when the user clicks on version navigation buttons.\n */\n ui5VersionChange = output<UI5CustomEvent<_WritingAssistant, 'version-change'>>();\n\n\n public elementRef: ElementRef<_WritingAssistant> = inject(ElementRef);\n public injector = inject(Injector);\n\n /**\n * Content density observer is injected to activate automatic CSS class and\n * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n * @private\n */\n private readonly _contentDensityObserver = inject(ContentDensityObserver);\n private readonly _destroyRef = inject(DestroyRef);\n\n get element(): _WritingAssistant {\n return this.elementRef.nativeElement;\n }\n\n ngAfterViewInit(): void {\n const wcElement = this.element;\n \n const inputsToSync = [\n 'currentVersion',\n 'promptDescription',\n 'totalVersions',\n ];\n \n // Synchronize inputs (properties)\n for (const inputName of inputsToSync) {\n // Find the corresponding camelCase signal property on the Angular component\n const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n // Use the Injector to run the effect in the correct context\n if (this[signalName] && typeof this[signalName] === 'function') {\n runInInjectionContext(this.injector, (): void => {\n effect((): void => {\n // Read the signal value\n const value = this[signalName]();\n if (wcElement) {\n //
|
|
1
|
+
{"version":3,"file":"fundamental-ngx-ui5-webcomponents-ai-writing-assistant.mjs","sources":["../../../../libs/ui5-webcomponents-ai/writing-assistant/index.ts","../../../../libs/ui5-webcomponents-ai/writing-assistant/fundamental-ngx-ui5-webcomponents-ai-writing-assistant.ts"],"sourcesContent":["\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n input,\n output,\n AfterViewInit,\n effect,\n runInInjectionContext,\n inject,\n Injector,\n booleanAttribute,\n computed,\n signal,\n DestroyRef\n} from '@angular/core';\nimport '@ui5/webcomponents-ai/dist/WritingAssistant.js';\nimport { default as _WritingAssistant } from '@ui5/webcomponents-ai/dist/WritingAssistant.js';\nimport { UI5CustomEvent } from '@ui5/webcomponents-base';\nimport {\n ContentDensityObserver,\n contentDensityObserverProviders,\n ContentDensityMode\n} from '@fundamental-ngx/core/content-density';\n\n\n\n\n@Component({\n standalone: true,\n selector: 'ui5-ai-writing-assistant, [ui5-ai-writing-assistant]',\n template: '<ng-content></ng-content>',\n exportAs: 'ui5WritingAssistant',\n providers: [\n contentDensityObserverProviders({\n supportedContentDensity: [ContentDensityMode.COMPACT, ContentDensityMode.COZY]\n })\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WritingAssistant implements AfterViewInit {\n\n /**\n * Indicates the index of the currently displayed result version.\n\nThe index is **0-based** (i.e. `0` represents the first result).\nThis property is synchronized with the parent AI TextArea component.\n */\n currentVersion = input<typeof _WritingAssistant.prototype.currentVersion | undefined>(0);\n\n /**\n * Defines the prompt description of the Writing Assistant.\n\nThis text is displayed in the toolbar to indicate the current or last\nperformed AI action (e.g., \"Generated text\", \"Simplified text\").\n */\n promptDescription = input<typeof _WritingAssistant.prototype.promptDescription | undefined>(\"\");\n\n /**\n * Indicates the total number of result versions available.\n\nThis property determines whether version navigation controls are displayed.\nWhen totalVersions > 0, previous/next buttons become available.\n */\n totalVersions = input<typeof _WritingAssistant.prototype.totalVersions | undefined>(0); // className is now passed\n\n\n\n /**\n * Fired when the user clicks on the AI button.\n */\n ui5ButtonClick = output<UI5CustomEvent<_WritingAssistant, 'button-click'>>();\n\n /**\n * Fired when the user clicks on the \"Stop\" button to stop ongoing AI text generation.\n */\n ui5StopGeneration = output<UI5CustomEvent<_WritingAssistant, 'stop-generation'>>();\n\n /**\n * Fired when the user clicks on version navigation buttons.\n */\n ui5VersionChange = output<UI5CustomEvent<_WritingAssistant, 'version-change'>>();\n\n\n public elementRef: ElementRef<_WritingAssistant> = inject(ElementRef);\n public injector = inject(Injector);\n\n /**\n * Content density observer is injected to activate automatic CSS class and\n * UI5 attribute application. The observer self-initializes, no explicit subscribe() needed.\n * @private\n */\n private readonly _contentDensityObserver = inject(ContentDensityObserver);\n private readonly _destroyRef = inject(DestroyRef);\n\n get element(): _WritingAssistant {\n return this.elementRef.nativeElement;\n }\n\n ngAfterViewInit(): void {\n const wcElement = this.element;\n \n const inputsToSync = [\n 'currentVersion',\n 'promptDescription',\n 'totalVersions',\n ];\n \n // Synchronize inputs (properties)\n for (const inputName of inputsToSync) {\n // Find the corresponding camelCase signal property on the Angular component\n const signalName = inputName.replace(/-./g, (x: string) => x[1].toUpperCase());\n\n // Use the Injector to run the effect in the correct context\n if (this[signalName] && typeof this[signalName] === 'function') {\n let lastWritten: unknown;\n runInInjectionContext(this.injector, (): void => {\n effect((): void => {\n // Read the signal value\n const value = this[signalName]();\n if (wcElement) {\n // Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before\n if (value === undefined && lastWritten === undefined && wcElement[inputName]) {\n return;\n }\n // Write the value to the Web Component's property\n wcElement[inputName] = value;\n lastWritten = value;\n }\n });\n });\n }\n }\n \n \n const outputsToSync = [\n 'ui5ButtonClick',\n 'ui5StopGeneration',\n 'ui5VersionChange',\n ];\n \n // Synchronize outputs (events)\n const _listeners: Array<() => void> = [];\n for (const outputName of outputsToSync) {\n // Map Angular output name to UI5 web component event name\n const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);\n // Ensure the output property exists and has an emit function before adding listener\n if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {\n // Cast the listener to the correct type to satisfy TypeScript\n const listener = (e: Event): void => {\n\n this[outputName].emit(e as CustomEvent<any>);\n };\n wcElement.addEventListener(eventName, listener);\n _listeners.push(() => wcElement.removeEventListener(eventName, listener));\n }\n }\n this._destroyRef.onDestroy(() => _listeners.forEach((fn) => fn()));\n \n\n }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAyCa,gBAAgB,CAAA;AAZ7B,IAAA,WAAA,GAAA;AAcE;;;;;AAKG;QACH,IAAA,CAAA,cAAc,GAAG,KAAK,CAAgE,CAAC;2FAAC;AAExF;;;;;AAKG;QACH,IAAA,CAAA,iBAAiB,GAAG,KAAK,CAAmE,EAAE;8FAAC;AAE/F;;;;;AAKG;QACH,IAAA,CAAA,aAAa,GAAG,KAAK,CAA+D,CAAC;AAAC,QAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,eAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAA,CAAC;AAIvF;;AAEG;QACH,IAAA,CAAA,cAAc,GAAG,MAAM,EAAqD;AAE5E;;AAEG;QACH,IAAA,CAAA,iBAAiB,GAAG,MAAM,EAAwD;AAElF;;AAEG;QACH,IAAA,CAAA,gBAAgB,GAAG,MAAM,EAAuD;AAGzE,QAAA,IAAA,CAAA,UAAU,GAAkC,MAAM,CAAC,UAAU,CAAC;AAC9D,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAElC;;;;AAIG;AACc,QAAA,IAAA,CAAA,uBAAuB,GAAG,MAAM,CAAC,sBAAsB,CAAC;AACxD,QAAA,IAAA,CAAA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._listeners = [];
|
|
28
30
|
}
|
|
29
31
|
// Default config if none provided
|
|
30
32
|
get effectiveConfig() {
|
|
@@ -37,10 +39,19 @@ class GenericControlValueAccessor {
|
|
|
37
39
|
ngAfterViewInit() {
|
|
38
40
|
// Initialize after the UI5 web component is ready
|
|
39
41
|
// Use requestAnimationFrame for zoneless compatibility instead of setTimeout
|
|
40
|
-
requestAnimationFrame(() => {
|
|
42
|
+
this._rafId = requestAnimationFrame(() => {
|
|
43
|
+
this._rafId = null;
|
|
41
44
|
this.initializeComponent();
|
|
42
45
|
});
|
|
43
46
|
}
|
|
47
|
+
ngOnDestroy() {
|
|
48
|
+
if (this._rafId !== null) {
|
|
49
|
+
cancelAnimationFrame(this._rafId);
|
|
50
|
+
this._rafId = null;
|
|
51
|
+
}
|
|
52
|
+
this._listeners.forEach((removeListener) => removeListener());
|
|
53
|
+
this._listeners = [];
|
|
54
|
+
}
|
|
44
55
|
setDisabledState(isDisabled) {
|
|
45
56
|
this._disabled = isDisabled;
|
|
46
57
|
const element = this.elementRef.nativeElement;
|
|
@@ -71,7 +82,7 @@ class GenericControlValueAccessor {
|
|
|
71
82
|
if (element && element.addEventListener) {
|
|
72
83
|
// Listen to all configured events
|
|
73
84
|
for (const eventName of config.events) {
|
|
74
|
-
|
|
85
|
+
const listener = (e) => {
|
|
75
86
|
if (this.onChange) {
|
|
76
87
|
const valueToEmit = this.getValueToEmit(config, e);
|
|
77
88
|
if (valueToEmit !== undefined) {
|
|
@@ -83,16 +94,20 @@ class GenericControlValueAccessor {
|
|
|
83
94
|
this.cdr.markForCheck();
|
|
84
95
|
}
|
|
85
96
|
}
|
|
86
|
-
}
|
|
97
|
+
};
|
|
98
|
+
element.addEventListener(eventName, listener);
|
|
99
|
+
this._listeners.push(() => element.removeEventListener(eventName, listener));
|
|
87
100
|
}
|
|
88
101
|
// Listen to focusout for touched state
|
|
89
|
-
|
|
102
|
+
const focusoutListener = () => {
|
|
90
103
|
if (this.onTouched) {
|
|
91
104
|
this.onTouched();
|
|
92
105
|
// Manually trigger change detection for zoneless compatibility
|
|
93
106
|
this.cdr.markForCheck();
|
|
94
107
|
}
|
|
95
|
-
}
|
|
108
|
+
};
|
|
109
|
+
element.addEventListener('focusout', focusoutListener);
|
|
110
|
+
this._listeners.push(() => element.removeEventListener('focusout', focusoutListener));
|
|
96
111
|
}
|
|
97
112
|
// Only apply stored value if writeValue was called (form control exists).
|
|
98
113
|
// Without this check, we'd overwrite native element values (e.g., value="Hello") with null.
|
|
@@ -277,18 +292,19 @@ class Button {
|
|
|
277
292
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
278
293
|
// Use the Injector to run the effect in the correct context
|
|
279
294
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
295
|
+
let lastWritten;
|
|
280
296
|
runInInjectionContext(this.injector, () => {
|
|
281
297
|
effect(() => {
|
|
282
298
|
// Read the signal value
|
|
283
299
|
const value = this[signalName]();
|
|
284
300
|
if (wcElement) {
|
|
285
|
-
//
|
|
286
|
-
|
|
287
|
-
if (value === undefined && wcElement[inputName]) {
|
|
301
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
302
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
288
303
|
return;
|
|
289
304
|
}
|
|
290
305
|
// Write the value to the Web Component's property
|
|
291
306
|
wcElement[inputName] = value;
|
|
307
|
+
lastWritten = value;
|
|
292
308
|
}
|
|
293
309
|
});
|
|
294
310
|
});
|
|
@@ -401,18 +417,19 @@ class ButtonState {
|
|
|
401
417
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
402
418
|
// Use the Injector to run the effect in the correct context
|
|
403
419
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
420
|
+
let lastWritten;
|
|
404
421
|
runInInjectionContext(this.injector, () => {
|
|
405
422
|
effect(() => {
|
|
406
423
|
// Read the signal value
|
|
407
424
|
const value = this[signalName]();
|
|
408
425
|
if (wcElement) {
|
|
409
|
-
//
|
|
410
|
-
|
|
411
|
-
if (value === undefined && wcElement[inputName]) {
|
|
426
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
427
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
412
428
|
return;
|
|
413
429
|
}
|
|
414
430
|
// Write the value to the Web Component's property
|
|
415
431
|
wcElement[inputName] = value;
|
|
432
|
+
lastWritten = value;
|
|
416
433
|
}
|
|
417
434
|
});
|
|
418
435
|
});
|
|
@@ -710,18 +727,19 @@ class Input {
|
|
|
710
727
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
711
728
|
// Use the Injector to run the effect in the correct context
|
|
712
729
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
730
|
+
let lastWritten;
|
|
713
731
|
runInInjectionContext(this.injector, () => {
|
|
714
732
|
effect(() => {
|
|
715
733
|
// Read the signal value
|
|
716
734
|
const value = this[signalName]();
|
|
717
735
|
if (wcElement) {
|
|
718
|
-
//
|
|
719
|
-
|
|
720
|
-
if (value === undefined && wcElement[inputName]) {
|
|
736
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
737
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
721
738
|
return;
|
|
722
739
|
}
|
|
723
740
|
// Write the value to the Web Component's property
|
|
724
741
|
wcElement[inputName] = value;
|
|
742
|
+
lastWritten = value;
|
|
725
743
|
}
|
|
726
744
|
});
|
|
727
745
|
});
|
|
@@ -945,18 +963,19 @@ class PromptInput {
|
|
|
945
963
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
946
964
|
// Use the Injector to run the effect in the correct context
|
|
947
965
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
966
|
+
let lastWritten;
|
|
948
967
|
runInInjectionContext(this.injector, () => {
|
|
949
968
|
effect(() => {
|
|
950
969
|
// Read the signal value
|
|
951
970
|
const value = this[signalName]();
|
|
952
971
|
if (wcElement) {
|
|
953
|
-
//
|
|
954
|
-
|
|
955
|
-
if (value === undefined && wcElement[inputName]) {
|
|
972
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
973
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
956
974
|
return;
|
|
957
975
|
}
|
|
958
976
|
// Write the value to the Web Component's property
|
|
959
977
|
wcElement[inputName] = value;
|
|
978
|
+
lastWritten = value;
|
|
960
979
|
}
|
|
961
980
|
});
|
|
962
981
|
});
|
|
@@ -1251,18 +1270,19 @@ class TextArea {
|
|
|
1251
1270
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
1252
1271
|
// Use the Injector to run the effect in the correct context
|
|
1253
1272
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
1273
|
+
let lastWritten;
|
|
1254
1274
|
runInInjectionContext(this.injector, () => {
|
|
1255
1275
|
effect(() => {
|
|
1256
1276
|
// Read the signal value
|
|
1257
1277
|
const value = this[signalName]();
|
|
1258
1278
|
if (wcElement) {
|
|
1259
|
-
//
|
|
1260
|
-
|
|
1261
|
-
if (value === undefined && wcElement[inputName]) {
|
|
1279
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
1280
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
1262
1281
|
return;
|
|
1263
1282
|
}
|
|
1264
1283
|
// Write the value to the Web Component's property
|
|
1265
1284
|
wcElement[inputName] = value;
|
|
1285
|
+
lastWritten = value;
|
|
1266
1286
|
}
|
|
1267
1287
|
});
|
|
1268
1288
|
});
|
|
@@ -1424,18 +1444,19 @@ class ToolbarLabel {
|
|
|
1424
1444
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
1425
1445
|
// Use the Injector to run the effect in the correct context
|
|
1426
1446
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
1447
|
+
let lastWritten;
|
|
1427
1448
|
runInInjectionContext(this.injector, () => {
|
|
1428
1449
|
effect(() => {
|
|
1429
1450
|
// Read the signal value
|
|
1430
1451
|
const value = this[signalName]();
|
|
1431
1452
|
if (wcElement) {
|
|
1432
|
-
//
|
|
1433
|
-
|
|
1434
|
-
if (value === undefined && wcElement[inputName]) {
|
|
1453
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
1454
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
1435
1455
|
return;
|
|
1436
1456
|
}
|
|
1437
1457
|
// Write the value to the Web Component's property
|
|
1438
1458
|
wcElement[inputName] = value;
|
|
1459
|
+
lastWritten = value;
|
|
1439
1460
|
}
|
|
1440
1461
|
});
|
|
1441
1462
|
});
|
|
@@ -1571,18 +1592,19 @@ class Versioning {
|
|
|
1571
1592
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
1572
1593
|
// Use the Injector to run the effect in the correct context
|
|
1573
1594
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
1595
|
+
let lastWritten;
|
|
1574
1596
|
runInInjectionContext(this.injector, () => {
|
|
1575
1597
|
effect(() => {
|
|
1576
1598
|
// Read the signal value
|
|
1577
1599
|
const value = this[signalName]();
|
|
1578
1600
|
if (wcElement) {
|
|
1579
|
-
//
|
|
1580
|
-
|
|
1581
|
-
if (value === undefined && wcElement[inputName]) {
|
|
1601
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
1602
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
1582
1603
|
return;
|
|
1583
1604
|
}
|
|
1584
1605
|
// Write the value to the Web Component's property
|
|
1585
1606
|
wcElement[inputName] = value;
|
|
1607
|
+
lastWritten = value;
|
|
1586
1608
|
}
|
|
1587
1609
|
});
|
|
1588
1610
|
});
|
|
@@ -1695,18 +1717,19 @@ class WritingAssistant {
|
|
|
1695
1717
|
const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
|
|
1696
1718
|
// Use the Injector to run the effect in the correct context
|
|
1697
1719
|
if (this[signalName] && typeof this[signalName] === 'function') {
|
|
1720
|
+
let lastWritten;
|
|
1698
1721
|
runInInjectionContext(this.injector, () => {
|
|
1699
1722
|
effect(() => {
|
|
1700
1723
|
// Read the signal value
|
|
1701
1724
|
const value = this[signalName]();
|
|
1702
1725
|
if (wcElement) {
|
|
1703
|
-
//
|
|
1704
|
-
|
|
1705
|
-
if (value === undefined && wcElement[inputName]) {
|
|
1726
|
+
// Don't clobber externally-set values (e.g. RouterLink href) unless we wrote a value before
|
|
1727
|
+
if (value === undefined && lastWritten === undefined && wcElement[inputName]) {
|
|
1706
1728
|
return;
|
|
1707
1729
|
}
|
|
1708
1730
|
// Write the value to the Web Component's property
|
|
1709
1731
|
wcElement[inputName] = value;
|
|
1732
|
+
lastWritten = value;
|
|
1710
1733
|
}
|
|
1711
1734
|
});
|
|
1712
1735
|
});
|