@acorex/components 18.10.2 → 18.10.5
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/map/acorex-components-map.mjs +5 -0
- package/esm2022/map/index.mjs +3 -0
- package/esm2022/map/lib/map.component.mjs +74 -0
- package/esm2022/map/lib/map.module.mjs +18 -0
- package/esm2022/menu/index.mjs +2 -1
- package/esm2022/menu/lib/menu-item/menu-item.component.mjs +6 -18
- package/esm2022/menu/lib/menu-item-text/menu-item-text.component.mjs +11 -0
- package/esm2022/menu/lib/menu.component.mjs +9 -108
- package/esm2022/menu/lib/menu.module.mjs +4 -3
- package/esm2022/menu/lib/menu.service.mjs +2 -7
- package/esm2022/qrcode/lib/qrcode.component.mjs +2 -17
- package/esm2022/range-slider/lib/range-slider.component.mjs +8 -10
- package/esm2022/rate-picker/acorex-components-rate-picker.mjs +5 -0
- package/esm2022/rate-picker/index.mjs +3 -0
- package/esm2022/rate-picker/lib/calculatePercentage.mjs +45 -0
- package/esm2022/rate-picker/lib/rate-picker.component.mjs +184 -0
- package/esm2022/rate-picker/lib/rate-picker.module.mjs +18 -0
- package/esm2022/time-line/acorex-components-time-line.mjs +5 -0
- package/esm2022/time-line/index.mjs +4 -0
- package/esm2022/time-line/lib/time-line-item.component.mjs +34 -0
- package/esm2022/time-line/lib/time-line.component.mjs +11 -0
- package/esm2022/time-line/lib/time-line.module.mjs +19 -0
- package/esm2022/wysiwyg/lib/wysiwyg/wysiwyg-container/wysiwyg-container.component.mjs +3 -3
- package/fesm2022/acorex-components-map.mjs +96 -0
- package/fesm2022/acorex-components-map.mjs.map +1 -0
- package/fesm2022/acorex-components-menu.mjs +25 -132
- package/fesm2022/acorex-components-menu.mjs.map +1 -1
- package/fesm2022/acorex-components-qrcode.mjs +1 -16
- package/fesm2022/acorex-components-qrcode.mjs.map +1 -1
- package/fesm2022/acorex-components-range-slider.mjs +7 -9
- package/fesm2022/acorex-components-range-slider.mjs.map +1 -1
- package/fesm2022/acorex-components-rate-picker.mjs +250 -0
- package/fesm2022/acorex-components-rate-picker.mjs.map +1 -0
- package/fesm2022/acorex-components-time-line.mjs +65 -0
- package/fesm2022/acorex-components-time-line.mjs.map +1 -0
- package/fesm2022/acorex-components-wysiwyg.mjs +2 -2
- package/fesm2022/acorex-components-wysiwyg.mjs.map +1 -1
- package/map/README.md +3 -0
- package/map/index.d.ts +3 -0
- package/map/lib/map.component.d.ts +24 -0
- package/map/lib/map.module.d.ts +8 -0
- package/menu/index.d.ts +1 -0
- package/menu/lib/menu-item/menu-item.component.d.ts +2 -3
- package/menu/lib/menu-item-text/menu-item-text.component.d.ts +5 -0
- package/menu/lib/menu.component.d.ts +1 -6
- package/menu/lib/menu.module.d.ts +9 -8
- package/menu/lib/menu.service.d.ts +0 -5
- package/package.json +77 -59
- package/qrcode/lib/qrcode.component.d.ts +0 -4
- package/rate-picker/README.md +3 -0
- package/rate-picker/index.d.ts +2 -0
- package/rate-picker/lib/calculatePercentage.d.ts +27 -0
- package/rate-picker/lib/rate-picker.component.d.ts +69 -0
- package/rate-picker/lib/rate-picker.module.d.ts +8 -0
- package/time-line/README.md +3 -0
- package/time-line/index.d.ts +3 -0
- package/time-line/lib/time-line-item.component.d.ts +7 -0
- package/time-line/lib/time-line.component.d.ts +5 -0
- package/time-line/lib/time-line.module.d.ts +9 -0
- package/wysiwyg/lib/wysiwyg/wysiwyg-container/wysiwyg-container.component.d.ts +1 -1
@@ -0,0 +1,250 @@
|
|
1
|
+
import { MXValueComponent, AXValuableComponent } from '@acorex/components/common';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { input, computed, signal, viewChild, inject, Renderer2, effect, forwardRef, Component, ViewEncapsulation, ChangeDetectionStrategy, HostBinding, NgModule } from '@angular/core';
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
5
|
+
import { CommonModule } from '@angular/common';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Calculates the horizontal position of a pointer event (mouse or touch) as a percentage
|
9
|
+
* of the target element's width.
|
10
|
+
*
|
11
|
+
* @param event - The mouse or touch event to get the pointer position from.
|
12
|
+
* @returns The percentage of the event's position relative to the target element's width,
|
13
|
+
* or -1 if the event is invalid.
|
14
|
+
*
|
15
|
+
* @remarks
|
16
|
+
* - For `MouseEvent`, it uses the `clientX` property.
|
17
|
+
* - For `TouchEvent`, it uses the `clientX` of the first touch point.
|
18
|
+
* - Returns `-1` if the event is neither a valid `MouseEvent` nor a `TouchEvent`.
|
19
|
+
*
|
20
|
+
* @example
|
21
|
+
* ```typescript
|
22
|
+
* document.addEventListener('click', function(event) {
|
23
|
+
* const percentage = getPointerPercentage(event);
|
24
|
+
* console.log(`Click position: ${percentage.toFixed(2)}% of the element's width`);
|
25
|
+
* });
|
26
|
+
*
|
27
|
+
* document.addEventListener('touchstart', function(event) {
|
28
|
+
* const percentage = getPointerPercentage(event);
|
29
|
+
* console.log(`Touch position: ${percentage.toFixed(2)}% of the element's width`);
|
30
|
+
* });
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
function getPointerPercentage(event) {
|
34
|
+
let clientX;
|
35
|
+
if (event instanceof MouseEvent) {
|
36
|
+
clientX = event.clientX; // Mouse event uses clientX
|
37
|
+
}
|
38
|
+
else if (event instanceof TouchEvent && event.touches.length > 0) {
|
39
|
+
clientX = event.touches[0].clientX; // Touch event uses the first touch's clientX
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
return -1; // Return -1 for invalid events
|
43
|
+
}
|
44
|
+
// Use currentTarget to get the bounding box of the element the event listener is attached to
|
45
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
46
|
+
const clickX = clientX - rect.left; // Calculate X position relative to the element
|
47
|
+
const divWidth = rect.width; // Get the width from the bounding box
|
48
|
+
const percentage = (clickX / divWidth) * 100; // Calculate percentage
|
49
|
+
return percentage;
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* A component for selecting a rating using star icons.
|
54
|
+
*
|
55
|
+
* This component allows users to pick a rating by clicking or dragging over star icons.
|
56
|
+
* It supports rounding options and manages the rating state internally.
|
57
|
+
*/
|
58
|
+
class AXRatePickerComponent extends MXValueComponent {
|
59
|
+
/**
|
60
|
+
* Initializes the component and sets up value change subscription.
|
61
|
+
*/
|
62
|
+
constructor() {
|
63
|
+
super();
|
64
|
+
/** The icon name to use for stars (e.g., 'fa-star'). */
|
65
|
+
this.iconName = input('fa-star');
|
66
|
+
/** The maximum rating value (e.g., 5 stars). */
|
67
|
+
this.max = input(5);
|
68
|
+
/** Determines if the rating should be rounded to the nearest integer. */
|
69
|
+
this.isRound = input(true);
|
70
|
+
/** choosing to have css transition for unchanging value after hover. */
|
71
|
+
this.hasTransition = input(true);
|
72
|
+
/** The percentage of the current rating value relative to the maximum rating. */
|
73
|
+
this.ratePercentage = computed(() => Math.round((this.currentValue() / this.max()) * 10000) / 100);
|
74
|
+
/** The current rating value as a signal. */
|
75
|
+
this.currentValue = signal(this.max());
|
76
|
+
/** State for tracking hover status and previous value. */
|
77
|
+
this.prevState = {
|
78
|
+
ishover: false,
|
79
|
+
previousValue: undefined,
|
80
|
+
};
|
81
|
+
/** Reference to the container element. */
|
82
|
+
this.containerEl = viewChild.required('c');
|
83
|
+
/** Reference to the rating element. */
|
84
|
+
this.ratingEl = viewChild.required('r');
|
85
|
+
/** Renderer for manipulating styles. */
|
86
|
+
this.renderer = inject(Renderer2);
|
87
|
+
/** Array of rating values from 1 to `max`. */
|
88
|
+
this.rates = computed(() => Array(this.max())
|
89
|
+
.fill(0)
|
90
|
+
.map((_, index) => index + 1));
|
91
|
+
effect(() => {
|
92
|
+
if (!this.hasTransition()) {
|
93
|
+
this.renderer.removeStyle(this.ratingEl().nativeElement, 'transition');
|
94
|
+
}
|
95
|
+
return this.hasTransition();
|
96
|
+
});
|
97
|
+
this.onValueChanged.subscribe((val) => {
|
98
|
+
if (val.value < 0) {
|
99
|
+
this.currentValue.set(0);
|
100
|
+
console.warn('ax-rate-picker: value cant be negative!');
|
101
|
+
}
|
102
|
+
else if (val.value > this.max()) {
|
103
|
+
this.currentValue.set(this.max());
|
104
|
+
console.warn('ax-rate-picker: value cant be more than max!');
|
105
|
+
}
|
106
|
+
else {
|
107
|
+
this.currentValue.set(val.value);
|
108
|
+
}
|
109
|
+
});
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* Calculates and updates the rating based on the mouse or touch event.
|
113
|
+
*
|
114
|
+
* @param event - The mouse or touch event triggering the rating calculation.
|
115
|
+
*/
|
116
|
+
calculateRate(event) {
|
117
|
+
if (this.hasTransition()) {
|
118
|
+
this.renderer.removeStyle(this.ratingEl().nativeElement, 'transition');
|
119
|
+
}
|
120
|
+
event.preventDefault();
|
121
|
+
if (!this.readonly && !this.disabled) {
|
122
|
+
const pointerPercentage = getPointerPercentage(event);
|
123
|
+
if (pointerPercentage === -1) {
|
124
|
+
return console.log('Only support touch and click events.');
|
125
|
+
}
|
126
|
+
const value = (pointerPercentage / 100) * this.max();
|
127
|
+
const finalValue = this.isRound() ? Math.ceil(value) : Number.parseFloat(value.toFixed(2));
|
128
|
+
if (finalValue !== this.value) {
|
129
|
+
if (this.prevState.ishover === true) {
|
130
|
+
this.currentValue.set(finalValue);
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
this.commitValue(finalValue);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
/**
|
139
|
+
* Handles mouse enter events to start tracking mouse movements for rating.
|
140
|
+
*/
|
141
|
+
mouseEnter() {
|
142
|
+
this.prevState = {
|
143
|
+
ishover: true,
|
144
|
+
previousValue: this.value,
|
145
|
+
};
|
146
|
+
if (this.hasTransition()) {
|
147
|
+
this.renderer.setStyle(this.ratingEl().nativeElement, 'opacity', '80%');
|
148
|
+
}
|
149
|
+
const moveListener = (moveEvent) => this.calculateRate(moveEvent);
|
150
|
+
const endListener = () => this.onEnd(moveListener, endListener);
|
151
|
+
const container = this.containerEl().nativeElement;
|
152
|
+
container.addEventListener('mousemove', moveListener);
|
153
|
+
container.addEventListener('mouseup', endListener);
|
154
|
+
container.addEventListener('mouseleave', endListener);
|
155
|
+
}
|
156
|
+
mouseLeave() {
|
157
|
+
if (this.hasTransition()) {
|
158
|
+
this.renderer.removeStyle(this.ratingEl().nativeElement, 'opacity');
|
159
|
+
}
|
160
|
+
}
|
161
|
+
/**
|
162
|
+
* Cleans up event listeners and restores the previous rating value.
|
163
|
+
*
|
164
|
+
* @param moveListener - The function to remove for mouse move events.
|
165
|
+
* @param endListener - The function to remove for mouse end events.
|
166
|
+
*/
|
167
|
+
onEnd(moveListener, endListener) {
|
168
|
+
if (this.hasTransition()) {
|
169
|
+
this.renderer.setStyle(this.ratingEl().nativeElement, 'transition', `width ${this.max() * 50 + 250}ms cubic-bezier(0.29, 0.72, 0.68, 0.85)`);
|
170
|
+
this.renderer.removeStyle(this.ratingEl().nativeElement, 'opacity');
|
171
|
+
}
|
172
|
+
this.currentValue.set(this.prevState.previousValue);
|
173
|
+
this.prevState = {
|
174
|
+
ishover: false,
|
175
|
+
previousValue: undefined,
|
176
|
+
};
|
177
|
+
const container = this.containerEl().nativeElement;
|
178
|
+
container.removeEventListener('mousemove', moveListener);
|
179
|
+
container.removeEventListener('mouseup', endListener);
|
180
|
+
container.removeEventListener('mouseleave', endListener);
|
181
|
+
}
|
182
|
+
/**
|
183
|
+
* Determines if the component is active (i.e., not readonly or disabled).
|
184
|
+
*/
|
185
|
+
get isActive() {
|
186
|
+
return !this.readonly && !this.disabled;
|
187
|
+
}
|
188
|
+
/**
|
189
|
+
* Determines if the component is in readonly mode.
|
190
|
+
*/
|
191
|
+
get isReadonly() {
|
192
|
+
return this.readonly;
|
193
|
+
}
|
194
|
+
/**
|
195
|
+
* Determines if the component is disabled.
|
196
|
+
*/
|
197
|
+
get isDisabled() {
|
198
|
+
return this.disabled;
|
199
|
+
}
|
200
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXRatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
201
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: AXRatePickerComponent, selector: "ax-rate-picker", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, iconName: { classPropertyName: "iconName", publicName: "iconName", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, isRound: { classPropertyName: "isRound", publicName: "isRound", isSignal: true, isRequired: false, transformFunction: null }, hasTransition: { classPropertyName: "hasTransition", publicName: "hasTransition", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.active": "this.isActive", "class.readonly": "this.isReadonly", "class.disable": "this.isDisabled" } }, providers: [
|
202
|
+
{ provide: AXValuableComponent, useExisting: AXRatePickerComponent },
|
203
|
+
{
|
204
|
+
provide: NG_VALUE_ACCESSOR,
|
205
|
+
useExisting: forwardRef(() => AXRatePickerComponent),
|
206
|
+
multi: true,
|
207
|
+
},
|
208
|
+
], viewQueries: [{ propertyName: "containerEl", first: true, predicate: ["c"], descendants: true, isSignal: true }, { propertyName: "ratingEl", first: true, predicate: ["r"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n #c\n class=\"ax-rate-picker-container\"\n (click)=\"calculateRate($event)\"\n (touchstart)=\"calculateRate($event)\"\n (mouseenter)=\"mouseEnter()\"\n (mouseleave)=\"mouseLeave()\"\n>\n <div #r class=\"ax-rate-picker-rating\" [style.width.%]=\"ratePercentage()\">\n <div class=\"ax-rate-picker-icons ax-rp-active\">\n @for (rate of rates(); track rate) {\n <i class=\"ax-rate-picker-icon fa-solid\" [class]=\"iconName()\" [class.pointer]=\"!this.readonly\"></i>\n }\n </div>\n </div>\n <div class=\"ax-rate-picker-icons ax-rp-inactive\">\n @for (rate of rates(); track rate) {\n <i class=\"ax-rate-picker-icon fa-solid\" [class]=\"iconName()\"></i>\n }\n </div>\n</div>\n", styles: [":root{--ax-rate-picker-color: rgba(var(--ax-color-primary-500));--ax-rate-picker-background: rgba(var(--ax-color-neutral-300))}ax-rate-picker.active{cursor:pointer}ax-rate-picker.readonly{opacity:.75}ax-rate-picker.disable{cursor:not-allowed;opacity:.5}ax-rate-picker.ax-sm{font-size:1rem}ax-rate-picker.ax-md{font-size:1.5rem}ax-rate-picker.ax-lg{font-size:2rem}ax-rate-picker.ax-xl{font-size:2.5rem}ax-rate-picker.ax-2xl{font-size:3rem}ax-rate-picker.ax-3xl{font-size:4rem}ax-rate-picker .ax-rate-picker-container{position:relative;width:min-content}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-rating{position:relative;z-index:10;overflow:hidden}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-rating .ax-rate-picker-icons{display:flex}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-rating .ax-rate-picker-icons.ax-rp-active{color:var(--ax-rate-picker-color)}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-icons{display:flex}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-icons.ax-rp-inactive{color:var(--ax-rate-picker-background);position:absolute;left:50%;top:50%;translate:-50% -50%;z-index:5}.ax-dark :root{--ax-rate-picker-color: rgba(var(--ax-color-primary-300));--ax-rate-picker-background: rgba(var(--ax-color-neutral-600))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
209
|
+
}
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXRatePickerComponent, decorators: [{
|
211
|
+
type: Component,
|
212
|
+
args: [{ selector: 'ax-rate-picker', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['readonly', 'disabled'], providers: [
|
213
|
+
{ provide: AXValuableComponent, useExisting: AXRatePickerComponent },
|
214
|
+
{
|
215
|
+
provide: NG_VALUE_ACCESSOR,
|
216
|
+
useExisting: forwardRef(() => AXRatePickerComponent),
|
217
|
+
multi: true,
|
218
|
+
},
|
219
|
+
], template: "<div\n #c\n class=\"ax-rate-picker-container\"\n (click)=\"calculateRate($event)\"\n (touchstart)=\"calculateRate($event)\"\n (mouseenter)=\"mouseEnter()\"\n (mouseleave)=\"mouseLeave()\"\n>\n <div #r class=\"ax-rate-picker-rating\" [style.width.%]=\"ratePercentage()\">\n <div class=\"ax-rate-picker-icons ax-rp-active\">\n @for (rate of rates(); track rate) {\n <i class=\"ax-rate-picker-icon fa-solid\" [class]=\"iconName()\" [class.pointer]=\"!this.readonly\"></i>\n }\n </div>\n </div>\n <div class=\"ax-rate-picker-icons ax-rp-inactive\">\n @for (rate of rates(); track rate) {\n <i class=\"ax-rate-picker-icon fa-solid\" [class]=\"iconName()\"></i>\n }\n </div>\n</div>\n", styles: [":root{--ax-rate-picker-color: rgba(var(--ax-color-primary-500));--ax-rate-picker-background: rgba(var(--ax-color-neutral-300))}ax-rate-picker.active{cursor:pointer}ax-rate-picker.readonly{opacity:.75}ax-rate-picker.disable{cursor:not-allowed;opacity:.5}ax-rate-picker.ax-sm{font-size:1rem}ax-rate-picker.ax-md{font-size:1.5rem}ax-rate-picker.ax-lg{font-size:2rem}ax-rate-picker.ax-xl{font-size:2.5rem}ax-rate-picker.ax-2xl{font-size:3rem}ax-rate-picker.ax-3xl{font-size:4rem}ax-rate-picker .ax-rate-picker-container{position:relative;width:min-content}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-rating{position:relative;z-index:10;overflow:hidden}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-rating .ax-rate-picker-icons{display:flex}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-rating .ax-rate-picker-icons.ax-rp-active{color:var(--ax-rate-picker-color)}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-icons{display:flex}ax-rate-picker .ax-rate-picker-container .ax-rate-picker-icons.ax-rp-inactive{color:var(--ax-rate-picker-background);position:absolute;left:50%;top:50%;translate:-50% -50%;z-index:5}.ax-dark :root{--ax-rate-picker-color: rgba(var(--ax-color-primary-300));--ax-rate-picker-background: rgba(var(--ax-color-neutral-600))}\n"] }]
|
220
|
+
}], ctorParameters: () => [], propDecorators: { isActive: [{
|
221
|
+
type: HostBinding,
|
222
|
+
args: ['class.active']
|
223
|
+
}], isReadonly: [{
|
224
|
+
type: HostBinding,
|
225
|
+
args: ['class.readonly']
|
226
|
+
}], isDisabled: [{
|
227
|
+
type: HostBinding,
|
228
|
+
args: ['class.disable']
|
229
|
+
}] } });
|
230
|
+
|
231
|
+
class AXRatePickerModule {
|
232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXRatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
233
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXRatePickerModule, declarations: [AXRatePickerComponent], imports: [CommonModule], exports: [AXRatePickerComponent] }); }
|
234
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXRatePickerModule, imports: [CommonModule] }); }
|
235
|
+
}
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXRatePickerModule, decorators: [{
|
237
|
+
type: NgModule,
|
238
|
+
args: [{
|
239
|
+
declarations: [AXRatePickerComponent],
|
240
|
+
imports: [CommonModule],
|
241
|
+
exports: [AXRatePickerComponent],
|
242
|
+
}]
|
243
|
+
}] });
|
244
|
+
|
245
|
+
/**
|
246
|
+
* Generated bundle index. Do not edit.
|
247
|
+
*/
|
248
|
+
|
249
|
+
export { AXRatePickerComponent, AXRatePickerModule };
|
250
|
+
//# sourceMappingURL=acorex-components-rate-picker.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-components-rate-picker.mjs","sources":["../../../../libs/components/rate-picker/src/lib/calculatePercentage.ts","../../../../libs/components/rate-picker/src/lib/rate-picker.component.ts","../../../../libs/components/rate-picker/src/lib/rate-picker.component.html","../../../../libs/components/rate-picker/src/lib/rate-picker.module.ts","../../../../libs/components/rate-picker/src/acorex-components-rate-picker.ts"],"sourcesContent":["/**\n * Calculates the horizontal position of a pointer event (mouse or touch) as a percentage\n * of the target element's width.\n *\n * @param event - The mouse or touch event to get the pointer position from.\n * @returns The percentage of the event's position relative to the target element's width,\n * or -1 if the event is invalid.\n *\n * @remarks\n * - For `MouseEvent`, it uses the `clientX` property.\n * - For `TouchEvent`, it uses the `clientX` of the first touch point.\n * - Returns `-1` if the event is neither a valid `MouseEvent` nor a `TouchEvent`.\n *\n * @example\n * ```typescript\n * document.addEventListener('click', function(event) {\n * const percentage = getPointerPercentage(event);\n * console.log(`Click position: ${percentage.toFixed(2)}% of the element's width`);\n * });\n *\n * document.addEventListener('touchstart', function(event) {\n * const percentage = getPointerPercentage(event);\n * console.log(`Touch position: ${percentage.toFixed(2)}% of the element's width`);\n * });\n * ```\n */\nexport function getPointerPercentage(event: MouseEvent | TouchEvent): number {\n let clientX: number;\n\n if (event instanceof MouseEvent) {\n clientX = event.clientX; // Mouse event uses clientX\n } else if (event instanceof TouchEvent && event.touches.length > 0) {\n clientX = event.touches[0].clientX; // Touch event uses the first touch's clientX\n } else {\n return -1; // Return -1 for invalid events\n }\n\n // Use currentTarget to get the bounding box of the element the event listener is attached to\n const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n const clickX = clientX - rect.left; // Calculate X position relative to the element\n const divWidth = rect.width; // Get the width from the bounding box\n const percentage = (clickX / divWidth) * 100; // Calculate percentage\n\n return percentage;\n}\n","import { AXValuableComponent, MXValueComponent } from '@acorex/components/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n forwardRef,\n HostBinding,\n inject,\n input,\n Renderer2,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { getPointerPercentage } from './calculatePercentage';\n\n/**\n * A component for selecting a rating using star icons.\n *\n * This component allows users to pick a rating by clicking or dragging over star icons.\n * It supports rounding options and manages the rating state internally.\n */\n@Component({\n selector: 'ax-rate-picker',\n templateUrl: './rate-picker.component.html',\n styleUrls: ['./rate-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n inputs: ['readonly', 'disabled'],\n providers: [\n { provide: AXValuableComponent, useExisting: AXRatePickerComponent },\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AXRatePickerComponent),\n multi: true,\n },\n ],\n})\nexport class AXRatePickerComponent extends MXValueComponent<number> {\n /** The icon name to use for stars (e.g., 'fa-star'). */\n iconName = input('fa-star');\n\n /** The maximum rating value (e.g., 5 stars). */\n max = input(5);\n\n /** Determines if the rating should be rounded to the nearest integer. */\n isRound = input(true);\n\n /** choosing to have css transition for unchanging value after hover. */\n hasTransition = input(true);\n\n /** The percentage of the current rating value relative to the maximum rating. */\n protected ratePercentage = computed(() => Math.round((this.currentValue() / this.max()) * 10000) / 100);\n\n /** The current rating value as a signal. */\n private currentValue = signal(this.max());\n\n /** State for tracking hover status and previous value. */\n private prevState: { ishover: boolean; previousValue?: number } = {\n ishover: false,\n previousValue: undefined,\n };\n\n /** Reference to the container element. */\n containerEl = viewChild.required<ElementRef>('c');\n\n /** Reference to the rating element. */\n ratingEl = viewChild.required<ElementRef>('r');\n\n /** Renderer for manipulating styles. */\n renderer = inject(Renderer2);\n\n /** Array of rating values from 1 to `max`. */\n protected rates = computed(() =>\n Array(this.max())\n .fill(0)\n .map((_, index) => index + 1),\n );\n\n /**\n * Initializes the component and sets up value change subscription.\n */\n constructor() {\n super();\n effect(() => {\n if (!this.hasTransition()) {\n this.renderer.removeStyle(this.ratingEl().nativeElement, 'transition');\n }\n return this.hasTransition();\n });\n this.onValueChanged.subscribe((val: { value }) => {\n if (val.value < 0) {\n this.currentValue.set(0);\n console.warn('ax-rate-picker: value cant be negative!');\n } else if (val.value > this.max()) {\n this.currentValue.set(this.max());\n console.warn('ax-rate-picker: value cant be more than max!');\n } else {\n this.currentValue.set(val.value);\n }\n });\n }\n\n /**\n * Calculates and updates the rating based on the mouse or touch event.\n *\n * @param event - The mouse or touch event triggering the rating calculation.\n */\n protected calculateRate(event: MouseEvent | TouchEvent): void {\n if (this.hasTransition()) {\n this.renderer.removeStyle(this.ratingEl().nativeElement, 'transition');\n }\n event.preventDefault();\n if (!this.readonly && !this.disabled) {\n const pointerPercentage = getPointerPercentage(event);\n if (pointerPercentage === -1) {\n return console.log('Only support touch and click events.');\n }\n const value = (pointerPercentage / 100) * this.max();\n const finalValue = this.isRound() ? Math.ceil(value) : Number.parseFloat(value.toFixed(2));\n if (finalValue !== this.value) {\n if (this.prevState.ishover === true) {\n this.currentValue.set(finalValue);\n } else {\n this.commitValue(finalValue);\n }\n }\n }\n }\n\n /**\n * Handles mouse enter events to start tracking mouse movements for rating.\n */\n protected mouseEnter() {\n this.prevState = {\n ishover: true,\n previousValue: this.value,\n };\n if (this.hasTransition()) {\n this.renderer.setStyle(this.ratingEl().nativeElement, 'opacity', '80%');\n }\n const moveListener = (moveEvent: MouseEvent | TouchEvent) => this.calculateRate(moveEvent);\n const endListener = () => this.onEnd(moveListener, endListener);\n const container = this.containerEl().nativeElement;\n container.addEventListener('mousemove', moveListener);\n container.addEventListener('mouseup', endListener);\n container.addEventListener('mouseleave', endListener);\n }\n mouseLeave() {\n if (this.hasTransition()) {\n this.renderer.removeStyle(this.ratingEl().nativeElement, 'opacity');\n }\n }\n /**\n * Cleans up event listeners and restores the previous rating value.\n *\n * @param moveListener - The function to remove for mouse move events.\n * @param endListener - The function to remove for mouse end events.\n */\n private onEnd(moveListener: (event: MouseEvent | TouchEvent) => void, endListener: () => void): void {\n if (this.hasTransition()) {\n this.renderer.setStyle(\n this.ratingEl().nativeElement,\n 'transition',\n `width ${this.max() * 50 + 250}ms cubic-bezier(0.29, 0.72, 0.68, 0.85)`,\n );\n this.renderer.removeStyle(this.ratingEl().nativeElement, 'opacity');\n }\n\n this.currentValue.set(this.prevState.previousValue);\n this.prevState = {\n ishover: false,\n previousValue: undefined,\n };\n\n const container = this.containerEl().nativeElement;\n container.removeEventListener('mousemove', moveListener);\n container.removeEventListener('mouseup', endListener);\n container.removeEventListener('mouseleave', endListener);\n }\n\n /**\n * Determines if the component is active (i.e., not readonly or disabled).\n */\n @HostBinding('class.active') get isActive() {\n return !this.readonly && !this.disabled;\n }\n\n /**\n * Determines if the component is in readonly mode.\n */\n @HostBinding('class.readonly') get isReadonly() {\n return this.readonly;\n }\n\n /**\n * Determines if the component is disabled.\n */\n @HostBinding('class.disable') get isDisabled() {\n return this.disabled;\n }\n}\n","<div\n #c\n class=\"ax-rate-picker-container\"\n (click)=\"calculateRate($event)\"\n (touchstart)=\"calculateRate($event)\"\n (mouseenter)=\"mouseEnter()\"\n (mouseleave)=\"mouseLeave()\"\n>\n <div #r class=\"ax-rate-picker-rating\" [style.width.%]=\"ratePercentage()\">\n <div class=\"ax-rate-picker-icons ax-rp-active\">\n @for (rate of rates(); track rate) {\n <i class=\"ax-rate-picker-icon fa-solid\" [class]=\"iconName()\" [class.pointer]=\"!this.readonly\"></i>\n }\n </div>\n </div>\n <div class=\"ax-rate-picker-icons ax-rp-inactive\">\n @for (rate of rates(); track rate) {\n <i class=\"ax-rate-picker-icon fa-solid\" [class]=\"iconName()\"></i>\n }\n </div>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXRatePickerComponent } from './rate-picker.component';\n\n@NgModule({\n declarations: [AXRatePickerComponent],\n imports: [CommonModule],\n exports: [AXRatePickerComponent],\n})\nexport class AXRatePickerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;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A;sBAAxC,WAAW;uBAAC,cAAc,CAAA;gBAOQ,UAAU,EAAA,CAAA;sBAA5C,WAAW;uBAAC,gBAAgB,CAAA;gBAOK,UAAU,EAAA,CAAA;sBAA3C,WAAW;uBAAC,eAAe,CAAA;;;MEhMjB,kBAAkB,CAAA;8GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAJd,YAAA,EAAA,CAAA,qBAAqB,CAC1B,EAAA,OAAA,EAAA,CAAA,YAAY,aACZ,qBAAqB,CAAA,EAAA,CAAA,CAAA,EAAA;AAEpB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAHnB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGX,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,qBAAqB,CAAC;AACjC,iBAAA,CAAA;;;ACRD;;AAEG;;;;"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { input, signal, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
3
|
+
import * as i1 from '@angular/common';
|
4
|
+
import { CommonModule } from '@angular/common';
|
5
|
+
|
6
|
+
class AXTimeLineItemComponent {
|
7
|
+
constructor() {
|
8
|
+
this.text = input('');
|
9
|
+
this.isCollapsed = signal(false);
|
10
|
+
}
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
12
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.0", type: AXTimeLineItemComponent, selector: "ax-time-line-item", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
13
|
+
<div class="ax-time-line-header">
|
14
|
+
<span class="ax-time-line-text">{{ text() }}</span>
|
15
|
+
<span
|
16
|
+
class="ax-icon ax-icon-chevron-down ax-collapse-arrow"
|
17
|
+
[ngClass]="{ '-rotation-90': isCollapsed(), 'rotation-90': !isCollapsed() }"
|
18
|
+
></span>
|
19
|
+
</div>
|
20
|
+
<div class="ax-time-line-content"><ng-content></ng-content></div>
|
21
|
+
`, isInline: true, styles: ["ax-time-line-item{padding-bottom:.75rem;display:block}ax-time-line-item .ax-time-line-header{display:flex;justify-content:space-between;align-items:center;padding:0 .75rem}ax-time-line-item .ax-time-line-header .ax-time-line-text{flex:1}ax-time-line-item .ax-time-line-content{padding:.75rem}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
22
|
+
}
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineItemComponent, decorators: [{
|
24
|
+
type: Component,
|
25
|
+
args: [{ selector: 'ax-time-line-item', template: `
|
26
|
+
<div class="ax-time-line-header">
|
27
|
+
<span class="ax-time-line-text">{{ text() }}</span>
|
28
|
+
<span
|
29
|
+
class="ax-icon ax-icon-chevron-down ax-collapse-arrow"
|
30
|
+
[ngClass]="{ '-rotation-90': isCollapsed(), 'rotation-90': !isCollapsed() }"
|
31
|
+
></span>
|
32
|
+
</div>
|
33
|
+
<div class="ax-time-line-content"><ng-content></ng-content></div>
|
34
|
+
`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["ax-time-line-item{padding-bottom:.75rem;display:block}ax-time-line-item .ax-time-line-header{display:flex;justify-content:space-between;align-items:center;padding:0 .75rem}ax-time-line-item .ax-time-line-header .ax-time-line-text{flex:1}ax-time-line-item .ax-time-line-content{padding:.75rem}\n"] }]
|
35
|
+
}] });
|
36
|
+
|
37
|
+
class AXTimeLineComponent {
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
39
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXTimeLineComponent, selector: "ax-time-line", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""] }); }
|
40
|
+
}
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineComponent, decorators: [{
|
42
|
+
type: Component,
|
43
|
+
args: [{ selector: 'ax-time-line', template: "<ng-content></ng-content>\n" }]
|
44
|
+
}] });
|
45
|
+
|
46
|
+
class AXTimeLineModule {
|
47
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
48
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineModule, declarations: [AXTimeLineComponent, AXTimeLineItemComponent], imports: [CommonModule], exports: [AXTimeLineComponent, AXTimeLineItemComponent] }); }
|
49
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineModule, imports: [CommonModule] }); }
|
50
|
+
}
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXTimeLineModule, decorators: [{
|
52
|
+
type: NgModule,
|
53
|
+
args: [{
|
54
|
+
declarations: [AXTimeLineComponent, AXTimeLineItemComponent],
|
55
|
+
imports: [CommonModule],
|
56
|
+
exports: [AXTimeLineComponent, AXTimeLineItemComponent],
|
57
|
+
}]
|
58
|
+
}] });
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Generated bundle index. Do not edit.
|
62
|
+
*/
|
63
|
+
|
64
|
+
export { AXTimeLineComponent, AXTimeLineItemComponent, AXTimeLineModule };
|
65
|
+
//# sourceMappingURL=acorex-components-time-line.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"acorex-components-time-line.mjs","sources":["../../../../libs/components/time-line/src/lib/time-line-item.component.ts","../../../../libs/components/time-line/src/lib/time-line.component.ts","../../../../libs/components/time-line/src/lib/time-line.component.html","../../../../libs/components/time-line/src/lib/time-line.module.ts","../../../../libs/components/time-line/src/acorex-components-time-line.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, signal, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'ax-time-line-item',\n template: `\n <div class=\"ax-time-line-header\">\n <span class=\"ax-time-line-text\">{{ text() }}</span>\n <span\n class=\"ax-icon ax-icon-chevron-down ax-collapse-arrow\"\n [ngClass]=\"{ '-rotation-90': isCollapsed(), 'rotation-90': !isCollapsed() }\"\n ></span>\n </div>\n <div class=\"ax-time-line-content\"><ng-content></ng-content></div>\n `,\n styleUrl: './time-line-item.component.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AXTimeLineItemComponent {\n text = input('');\n\n isCollapsed = signal(false);\n}\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'ax-time-line',\n templateUrl: './time-line.component.html',\n styleUrls: ['./time-line.component.scss'],\n})\nexport class AXTimeLineComponent {}\n","<ng-content></ng-content>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AXTimeLineItemComponent } from './time-line-item.component';\nimport { AXTimeLineComponent } from './time-line.component';\n\n@NgModule({\n declarations: [AXTimeLineComponent, AXTimeLineItemComponent],\n imports: [CommonModule],\n exports: [AXTimeLineComponent, AXTimeLineItemComponent],\n})\nexport class AXTimeLineModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAkBa,uBAAuB,CAAA;AAhBpC,IAAA,WAAA,GAAA;AAiBE,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;AAEjB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAA;8GAJY,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB,EAdxB,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;;;;;;AAST,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,wSAAA,CAAA,EAA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AuB,aACjD,YAAY,CAAA,EAAA,OAAA,EAAA,CACZ,mBAAmB,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA,EAAA;AAE3C,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAHjB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGX,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;oBAC5D,OAAO,EAAE,CAAC,YAAY,CAAC;AACvB,oBAAA,OAAO,EAAE,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;AACxD,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
@@ -96,7 +96,7 @@ class AXWysiwygContainerComponent extends classes((MXInputBaseValueComponent), M
|
|
96
96
|
clearTimeout(this.setTimeOut);
|
97
97
|
}
|
98
98
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
99
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygContainerComponent, selector: "ax-wysiwyg-container", inputs: { look: "look" }, providers: [
|
99
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", type: AXWysiwygContainerComponent, selector: "ax-wysiwyg-container", inputs: { look: "look" }, outputs: { onValueChanged: "onValueChanged" }, providers: [
|
100
100
|
{ provide: AXComponent, useExisting: AXWysiwygContainerComponent },
|
101
101
|
{ provide: AXFocusableComponent, useExisting: AXWysiwygContainerComponent },
|
102
102
|
{ provide: AXClearableComponent, useExisting: AXWysiwygContainerComponent },
|
@@ -110,7 +110,7 @@ class AXWysiwygContainerComponent extends classes((MXInputBaseValueComponent), M
|
|
110
110
|
}
|
111
111
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXWysiwygContainerComponent, decorators: [{
|
112
112
|
type: Component,
|
113
|
-
args: [{ selector: 'ax-wysiwyg-container', inputs: ['look'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
113
|
+
args: [{ selector: 'ax-wysiwyg-container', inputs: ['look'], outputs: ['onValueChanged'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
114
114
|
{ provide: AXComponent, useExisting: AXWysiwygContainerComponent },
|
115
115
|
{ provide: AXFocusableComponent, useExisting: AXWysiwygContainerComponent },
|
116
116
|
{ provide: AXClearableComponent, useExisting: AXWysiwygContainerComponent },
|