@yoozsoft/yoozsoft-ng 6.2.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -94
- package/fesm2022/yoozsoft-yoozsoft-ng-autocomplete.mjs +70 -38
- package/fesm2022/yoozsoft-yoozsoft-ng-autocomplete.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs +194 -109
- package/fesm2022/yoozsoft-yoozsoft-ng-datepicker.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-dropdown.mjs +70 -55
- package/fesm2022/yoozsoft-yoozsoft-ng-dropdown.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs +55 -33
- package/fesm2022/yoozsoft-yoozsoft-ng-file-upload.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-footer.mjs +13 -11
- package/fesm2022/yoozsoft-yoozsoft-ng-footer.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-loading.mjs +17 -11
- package/fesm2022/yoozsoft-yoozsoft-ng-loading.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs +37 -28
- package/fesm2022/yoozsoft-yoozsoft-ng-navbar.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-overlay.mjs +7 -6
- package/fesm2022/yoozsoft-yoozsoft-ng-overlay.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-pagination.mjs +39 -28
- package/fesm2022/yoozsoft-yoozsoft-ng-pagination.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs +65 -39
- package/fesm2022/yoozsoft-yoozsoft-ng-password-strength.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-pipes.mjs +3 -3
- package/fesm2022/yoozsoft-yoozsoft-ng-pipes.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-progress.mjs +26 -17
- package/fesm2022/yoozsoft-yoozsoft-ng-progress.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-rating.mjs +155 -0
- package/fesm2022/yoozsoft-yoozsoft-ng-rating.mjs.map +1 -0
- package/fesm2022/yoozsoft-yoozsoft-ng-select.mjs +47 -33
- package/fesm2022/yoozsoft-yoozsoft-ng-select.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs +30 -29
- package/fesm2022/yoozsoft-yoozsoft-ng-sidebar.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-table.mjs +93 -84
- package/fesm2022/yoozsoft-yoozsoft-ng-table.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs +41 -27
- package/fesm2022/yoozsoft-yoozsoft-ng-tiff-viewer.mjs.map +1 -1
- package/fesm2022/yoozsoft-yoozsoft-ng-toast.mjs +20 -18
- package/fesm2022/yoozsoft-yoozsoft-ng-toast.mjs.map +1 -1
- package/package.json +12 -4
- package/rating/package.json +4 -0
- package/types/yoozsoft-yoozsoft-ng-rating.d.ts +56 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, Component, output, signal, effect, forwardRef } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
class YsRating {
|
|
6
|
+
/**Current score */
|
|
7
|
+
score = input(0, /* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [{ debugName: "score" }] : /* istanbul ignore next */ []));
|
|
9
|
+
/**Points cap (default 100) */
|
|
10
|
+
maxScore = input(100, /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "maxScore" }] : /* istanbul ignore next */ []));
|
|
12
|
+
starsCount = input(5, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "starsCount" }] : /* istanbul ignore next */ []));
|
|
14
|
+
/**Icon size in pixel */
|
|
15
|
+
size = input(20, /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
17
|
+
ratingIconClass = input('fas fa-star', /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "ratingIconClass" }] : /* istanbul ignore next */ []));
|
|
19
|
+
/**Icons gap in pixel */
|
|
20
|
+
gap = input(4, /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
22
|
+
ariaLabel = input(/* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
24
|
+
wrapperSize = computed(() => this.size() + this.gap(), /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "wrapperSize" }] : /* istanbul ignore next */ []));
|
|
26
|
+
normalizedAriaLabel = computed(() => this.ariaLabel() ??
|
|
27
|
+
`Rating ${this.normalizedScore()} of ${this.maxScore()}`, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "normalizedAriaLabel" }] : /* istanbul ignore next */ []));
|
|
29
|
+
normalizedScore = computed(() => {
|
|
30
|
+
return Math.min(Math.max(this.score(), 0), this.maxScore());
|
|
31
|
+
}, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "normalizedScore" }] : /* istanbul ignore next */ []));
|
|
33
|
+
normalizedStarsCount = computed(() => Math.max(1, Math.floor(this.starsCount())), /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "normalizedStarsCount" }] : /* istanbul ignore next */ []));
|
|
35
|
+
rating = computed(() => (this.normalizedScore() / this.maxScore()) * this.normalizedStarsCount(), /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "rating" }] : /* istanbul ignore next */ []));
|
|
37
|
+
fillPercents = computed(() => {
|
|
38
|
+
const totalStars = this.normalizedStarsCount();
|
|
39
|
+
if (this.maxScore() <= 0) {
|
|
40
|
+
return Array(totalStars).fill(0);
|
|
41
|
+
}
|
|
42
|
+
const rating = this.rating();
|
|
43
|
+
return Array.from({ length: totalStars }, (_, index) => Math.max(0, Math.min(100, (rating - index) * 100)));
|
|
44
|
+
}, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "fillPercents" }] : /* istanbul ignore next */ []));
|
|
46
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsRating, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
47
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: YsRating, isStandalone: true, selector: "ys-rating", inputs: { score: { classPropertyName: "score", publicName: "score", isSignal: true, isRequired: false, transformFunction: null }, maxScore: { classPropertyName: "maxScore", publicName: "maxScore", isSignal: true, isRequired: false, transformFunction: null }, starsCount: { classPropertyName: "starsCount", publicName: "starsCount", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ratingIconClass: { classPropertyName: "ratingIconClass", publicName: "ratingIconClass", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"ys-rating\" role=\"img\" [style.gap.px]=\"gap()\" [attr.aria-label]=\"normalizedAriaLabel()\">\n\n @for (fill of fillPercents(); track $index) {\n\n <div class=\"rating-wrapper\" [style.width.px]=\"wrapperSize()\" [style.height.px]=\"size()\">\n\n <i class=\"rating-empty\" [class]=\"ratingIconClass()\" [style.fontSize.px]=\"size()\">\n </i>\n\n <div class=\"rating-fill\" [style.width.%]=\"fill\" [style.height.px]=\"size()\">\n\n <i class=\"rating\" [class]=\"ratingIconClass()\" [style.fontSize.px]=\"size()\">\n </i>\n\n </div>\n\n </div>\n\n }\n\n</div>", styles: [":host{--ys-rating-empty: var(--bs-gray-300);--ys-rating-filled: var(--bs-yellow)}.ys-rating{display:inline-flex;align-items:center}.rating-wrapper{position:relative;display:inline-block;line-height:0;overflow:visible}.rating-fill{position:absolute;top:0;inset-inline-start:0;overflow:hidden;pointer-events:none}.rating-empty{color:var(--ys-rating-empty)}.rating-fill .rating{color:var(--ys-rating-filled)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsRating, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ selector: 'ys-rating', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ys-rating\" role=\"img\" [style.gap.px]=\"gap()\" [attr.aria-label]=\"normalizedAriaLabel()\">\n\n @for (fill of fillPercents(); track $index) {\n\n <div class=\"rating-wrapper\" [style.width.px]=\"wrapperSize()\" [style.height.px]=\"size()\">\n\n <i class=\"rating-empty\" [class]=\"ratingIconClass()\" [style.fontSize.px]=\"size()\">\n </i>\n\n <div class=\"rating-fill\" [style.width.%]=\"fill\" [style.height.px]=\"size()\">\n\n <i class=\"rating\" [class]=\"ratingIconClass()\" [style.fontSize.px]=\"size()\">\n </i>\n\n </div>\n\n </div>\n\n }\n\n</div>", styles: [":host{--ys-rating-empty: var(--bs-gray-300);--ys-rating-filled: var(--bs-yellow)}.ys-rating{display:inline-flex;align-items:center}.rating-wrapper{position:relative;display:inline-block;line-height:0;overflow:visible}.rating-fill{position:absolute;top:0;inset-inline-start:0;overflow:hidden;pointer-events:none}.rating-empty{color:var(--ys-rating-empty)}.rating-fill .rating{color:var(--ys-rating-filled)}\n"] }]
|
|
52
|
+
}], propDecorators: { score: [{ type: i0.Input, args: [{ isSignal: true, alias: "score", required: false }] }], maxScore: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxScore", required: false }] }], starsCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "starsCount", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ratingIconClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratingIconClass", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
53
|
+
|
|
54
|
+
class YsRatingInput {
|
|
55
|
+
maxScore = input(100, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "maxScore" }] : /* istanbul ignore next */ []));
|
|
57
|
+
starsCount = input(5, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "starsCount" }] : /* istanbul ignore next */ []));
|
|
59
|
+
size = input(20, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
61
|
+
ratingIconClass = input('fas fa-star', /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "ratingIconClass" }] : /* istanbul ignore next */ []));
|
|
63
|
+
disabled = input(false, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
65
|
+
readonly = input(false, /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
67
|
+
allowClear = input(true, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "allowClear" }] : /* istanbul ignore next */ []));
|
|
69
|
+
valueChange = output();
|
|
70
|
+
value = signal(0, /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
72
|
+
hoverValue = signal(null, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "hoverValue" }] : /* istanbul ignore next */ []));
|
|
74
|
+
displayValue = computed(() => this.hoverValue() ?? this.value(), /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
76
|
+
normalizedStarsCount = computed(() => Math.max(1, Math.floor(this.starsCount())), /* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [{ debugName: "normalizedStarsCount" }] : /* istanbul ignore next */ []));
|
|
78
|
+
stars = computed(() => Array.from({ length: this.normalizedStarsCount() }), /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
|
|
80
|
+
disabledState = signal(false, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
82
|
+
isDisabled = computed(() => this.disabled() || this.readonly() || this.disabledState(), /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
84
|
+
_onChange = () => { };
|
|
85
|
+
_onTouched = () => { };
|
|
86
|
+
constructor() {
|
|
87
|
+
effect(() => {
|
|
88
|
+
if (this.isDisabled()) {
|
|
89
|
+
this.hoverValue.set(null);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
writeValue(value) {
|
|
94
|
+
this.value.set(value ?? 0);
|
|
95
|
+
}
|
|
96
|
+
registerOnChange(fn) {
|
|
97
|
+
this._onChange = fn;
|
|
98
|
+
}
|
|
99
|
+
registerOnTouched(fn) {
|
|
100
|
+
this._onTouched = fn;
|
|
101
|
+
}
|
|
102
|
+
setDisabledState(disabled) {
|
|
103
|
+
this.disabledState.set(disabled);
|
|
104
|
+
}
|
|
105
|
+
hover(index) {
|
|
106
|
+
if (this.isDisabled())
|
|
107
|
+
return;
|
|
108
|
+
const value = ((index + 1) / this.normalizedStarsCount()) * this.maxScore();
|
|
109
|
+
this.hoverValue.set(value);
|
|
110
|
+
}
|
|
111
|
+
leave() {
|
|
112
|
+
this.hoverValue.set(null);
|
|
113
|
+
}
|
|
114
|
+
select(index) {
|
|
115
|
+
if (this.isDisabled())
|
|
116
|
+
return;
|
|
117
|
+
const value = ((index + 1) / this.normalizedStarsCount()) * this.maxScore();
|
|
118
|
+
if (this.allowClear() && value === this.value()) {
|
|
119
|
+
this.value.set(0);
|
|
120
|
+
this._onChange(0);
|
|
121
|
+
this.valueChange.emit(0);
|
|
122
|
+
this._onTouched();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.value.set(value);
|
|
126
|
+
this._onChange(value);
|
|
127
|
+
this.valueChange.emit(value);
|
|
128
|
+
this._onTouched();
|
|
129
|
+
}
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsRatingInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: YsRatingInput, isStandalone: true, selector: "ys-rating-input", inputs: { maxScore: { classPropertyName: "maxScore", publicName: "maxScore", isSignal: true, isRequired: false, transformFunction: null }, starsCount: { classPropertyName: "starsCount", publicName: "starsCount", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ratingIconClass: { classPropertyName: "ratingIconClass", publicName: "ratingIconClass", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [{
|
|
132
|
+
provide: NG_VALUE_ACCESSOR,
|
|
133
|
+
useExisting: forwardRef(() => YsRatingInput),
|
|
134
|
+
multi: true
|
|
135
|
+
}], ngImport: i0, template: "<div class=\"ys-rating-input\">\n\n <ys-rating [score]=\"displayValue()\" [maxScore]=\"maxScore()\" [starsCount]=\"starsCount()\" [size]=\"size()\"\n [ratingIconClass]=\"ratingIconClass()\">\n </ys-rating>\n\n <div class=\"rating-overlay\" [class.readonly]=\"readonly()\">\n\n @for (star of stars(); track $index) {\n\n <button type=\"button\" class=\"rating-hit\" [disabled]=\"isDisabled()\" (focus)=\"hover($index)\" (blur)=\"leave()\"\n (mouseenter)=\"hover($index)\" (mouseleave)=\"leave()\" (click)=\"select($index)\">\n </button>\n\n }\n\n </div>\n\n</div>", styles: [".ys-rating-input{position:relative;display:inline-block}.rating-overlay{position:absolute;inset:0;display:flex;pointer-events:none}.rating-hit{flex:1;border:0;padding:0;margin:0;background:transparent;cursor:pointer;pointer-events:auto}.rating-hit:disabled{cursor:not-allowed}.rating-overlay.readonly .rating-hit{cursor:default}\n"], dependencies: [{ kind: "component", type: YsRating, selector: "ys-rating", inputs: ["score", "maxScore", "starsCount", "size", "ratingIconClass", "gap", "ariaLabel"] }] });
|
|
136
|
+
}
|
|
137
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsRatingInput, decorators: [{
|
|
138
|
+
type: Component,
|
|
139
|
+
args: [{ selector: 'ys-rating-input', imports: [YsRating], providers: [{
|
|
140
|
+
provide: NG_VALUE_ACCESSOR,
|
|
141
|
+
useExisting: forwardRef(() => YsRatingInput),
|
|
142
|
+
multi: true
|
|
143
|
+
}], template: "<div class=\"ys-rating-input\">\n\n <ys-rating [score]=\"displayValue()\" [maxScore]=\"maxScore()\" [starsCount]=\"starsCount()\" [size]=\"size()\"\n [ratingIconClass]=\"ratingIconClass()\">\n </ys-rating>\n\n <div class=\"rating-overlay\" [class.readonly]=\"readonly()\">\n\n @for (star of stars(); track $index) {\n\n <button type=\"button\" class=\"rating-hit\" [disabled]=\"isDisabled()\" (focus)=\"hover($index)\" (blur)=\"leave()\"\n (mouseenter)=\"hover($index)\" (mouseleave)=\"leave()\" (click)=\"select($index)\">\n </button>\n\n }\n\n </div>\n\n</div>", styles: [".ys-rating-input{position:relative;display:inline-block}.rating-overlay{position:absolute;inset:0;display:flex;pointer-events:none}.rating-hit{flex:1;border:0;padding:0;margin:0;background:transparent;cursor:pointer;pointer-events:auto}.rating-hit:disabled{cursor:not-allowed}.rating-overlay.readonly .rating-hit{cursor:default}\n"] }]
|
|
144
|
+
}], ctorParameters: () => [], propDecorators: { maxScore: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxScore", required: false }] }], starsCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "starsCount", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ratingIconClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratingIconClass", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], allowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowClear", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
* Public API Surface of ys-rating
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Generated bundle index. Do not edit.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
export { YsRating, YsRatingInput };
|
|
155
|
+
//# sourceMappingURL=yoozsoft-yoozsoft-ng-rating.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yoozsoft-yoozsoft-ng-rating.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/rating/src/ys-rating/ys-rating.ts","../../../../projects/yoozsoft/yoozsoft-ng/rating/src/ys-rating/ys-rating.html","../../../../projects/yoozsoft/yoozsoft-ng/rating/src/ys-rating-input/ys-rating-input.ts","../../../../projects/yoozsoft/yoozsoft-ng/rating/src/ys-rating-input/ys-rating-input.html","../../../../projects/yoozsoft/yoozsoft-ng/rating/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/rating/yoozsoft-yoozsoft-ng-rating.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\n@Component({\n selector: 'ys-rating',\n imports: [],\n templateUrl: './ys-rating.html',\n styleUrl: './ys-rating.scss',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class YsRating {\n\n /**Current score */\n readonly score = input(0);\n\n /**Points cap (default 100) */\n readonly maxScore = input(100);\n readonly starsCount = input(5);\n\n /**Icon size in pixel */\n readonly size = input(20);\n readonly ratingIconClass = input('fas fa-star');\n\n /**Icons gap in pixel */\n readonly gap = input(4);\n readonly ariaLabel = input<string>();\n\n readonly wrapperSize = computed(() => this.size() + this.gap());\n\n readonly normalizedAriaLabel = computed(() =>\n this.ariaLabel() ??\n `Rating ${this.normalizedScore()} of ${this.maxScore()}`\n );\n\n readonly normalizedScore = computed(() => {\n\n return Math.min(\n Math.max(this.score(), 0),\n this.maxScore()\n );\n\n });\n\n readonly normalizedStarsCount = computed(() =>\n Math.max(1, Math.floor(this.starsCount()))\n );\n\n readonly rating = computed(() =>\n (this.normalizedScore() / this.maxScore()) * this.normalizedStarsCount()\n );\n\n readonly fillPercents = computed(() => {\n\n const totalStars = this.normalizedStarsCount();\n\n if (this.maxScore() <= 0) {\n return Array(totalStars).fill(0);\n }\n\n const rating = this.rating();\n\n return Array.from({ length: totalStars }, (_, index) =>\n Math.max(\n 0,\n Math.min(\n 100,\n (rating - index) * 100\n )\n )\n );\n\n });\n\n}\n","<div class=\"ys-rating\" role=\"img\" [style.gap.px]=\"gap()\" [attr.aria-label]=\"normalizedAriaLabel()\">\n\n @for (fill of fillPercents(); track $index) {\n\n <div class=\"rating-wrapper\" [style.width.px]=\"wrapperSize()\" [style.height.px]=\"size()\">\n\n <i class=\"rating-empty\" [class]=\"ratingIconClass()\" [style.fontSize.px]=\"size()\">\n </i>\n\n <div class=\"rating-fill\" [style.width.%]=\"fill\" [style.height.px]=\"size()\">\n\n <i class=\"rating\" [class]=\"ratingIconClass()\" [style.fontSize.px]=\"size()\">\n </i>\n\n </div>\n\n </div>\n\n }\n\n</div>","import { Component, computed, effect, forwardRef, input, output, signal } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { YsRating } from '../ys-rating/ys-rating';\n\n@Component({\n selector: 'ys-rating-input',\n imports: [YsRating],\n templateUrl: './ys-rating-input.html',\n styleUrl: './ys-rating-input.scss',\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => YsRatingInput),\n multi: true\n }]\n})\nexport class YsRatingInput implements ControlValueAccessor {\n\n readonly maxScore = input(100);\n readonly starsCount = input(5);\n readonly size = input(20);\n readonly ratingIconClass = input('fas fa-star');\n\n readonly disabled = input(false);\n readonly readonly = input(false);\n readonly allowClear = input(true);\n\n readonly valueChange = output<number>();\n\n readonly value = signal(0);\n readonly hoverValue = signal<number | null>(null);\n\n readonly displayValue = computed(() =>\n this.hoverValue() ?? this.value()\n );\n\n readonly normalizedStarsCount = computed(() =>\n Math.max(1, Math.floor(this.starsCount()))\n );\n\n readonly stars = computed(() =>\n Array.from({ length: this.normalizedStarsCount() })\n );\n\n private disabledState = signal(false);\n readonly isDisabled = computed(() => this.disabled() || this.readonly() || this.disabledState());\n\n private _onChange: (value: number) => void = () => { };\n private _onTouched = () => { };\n\n constructor() {\n effect(() => {\n\n if (this.isDisabled()) {\n this.hoverValue.set(null);\n }\n\n });\n }\n\n writeValue(value: number | null): void {\n this.value.set(value ?? 0);\n }\n\n registerOnChange(fn: any) {\n this._onChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this._onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabledState.set(disabled);\n }\n\n hover(index: number) {\n\n if (this.isDisabled())\n return;\n\n const value = ((index + 1) / this.normalizedStarsCount()) * this.maxScore();\n\n this.hoverValue.set(value);\n\n }\n\n leave() {\n this.hoverValue.set(null);\n }\n\n select(index: number) {\n if (this.isDisabled())\n return;\n\n const value = ((index + 1) / this.normalizedStarsCount()) * this.maxScore();\n\n if (this.allowClear() && value === this.value()) {\n\n this.value.set(0);\n\n this._onChange(0);\n this.valueChange.emit(0);\n\n this._onTouched();\n\n return;\n }\n\n this.value.set(value);\n\n this._onChange(value);\n this.valueChange.emit(value);\n\n this._onTouched();\n\n }\n\n}\n","<div class=\"ys-rating-input\">\n\n <ys-rating [score]=\"displayValue()\" [maxScore]=\"maxScore()\" [starsCount]=\"starsCount()\" [size]=\"size()\"\n [ratingIconClass]=\"ratingIconClass()\">\n </ys-rating>\n\n <div class=\"rating-overlay\" [class.readonly]=\"readonly()\">\n\n @for (star of stars(); track $index) {\n\n <button type=\"button\" class=\"rating-hit\" [disabled]=\"isDisabled()\" (focus)=\"hover($index)\" (blur)=\"leave()\"\n (mouseenter)=\"hover($index)\" (mouseleave)=\"leave()\" (click)=\"select($index)\">\n </button>\n\n }\n\n </div>\n\n</div>","/*\r\n * Public API Surface of ys-rating\r\n */\r\n\r\nexport * from './src/ys-rating-input/ys-rating-input';\r\nexport * from './src/ys-rating/ys-rating';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MASa,QAAQ,CAAA;;IAGV,KAAK,GAAG,KAAK,CAAC,CAAC;8EAAC;;IAGhB,QAAQ,GAAG,KAAK,CAAC,GAAG;iFAAC;IACrB,UAAU,GAAG,KAAK,CAAC,CAAC;mFAAC;;IAGrB,IAAI,GAAG,KAAK,CAAC,EAAE;6EAAC;IAChB,eAAe,GAAG,KAAK,CAAC,aAAa;wFAAC;;IAGtC,GAAG,GAAG,KAAK,CAAC,CAAC;4EAAC;AACd,IAAA,SAAS,GAAG,KAAK;6FAAU;AAE3B,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAA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AAA,KAAK,EAAE;aACR,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECbJ,8mBAkBM,EAAA,MAAA,EAAA,CAAA,4UAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDZM,QAAQ,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,YAAA,EAAA,MAAA,EAAA,iBAAA,EAAA,KAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FASP,aAAa,EAAA,UAAA,EAAA,CAAA;kBAXzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,OAAA,EAClB,CAAC,QAAQ,CAAC,aAGR,CAAC;AACV,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,mBAAmB,CAAC;AAC5C,4BAAA,KAAK,EAAE;yBACR,CAAC,EAAA,QAAA,EAAA,8mBAAA,EAAA,MAAA,EAAA,CAAA,4UAAA,CAAA,EAAA;;;AEbJ;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,36 +1,54 @@
|
|
|
1
1
|
import { NgClass } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, output, signal, computed, forwardRef, Component } from '@angular/core';
|
|
3
|
+
import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
6
|
|
|
7
7
|
class YsSelect {
|
|
8
8
|
/**ُSelect element id */
|
|
9
|
-
id = input('ys-select',
|
|
10
|
-
|
|
9
|
+
id = input('ys-select', /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
11
|
+
options = input([], /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
11
13
|
/**Name of field to display in option title */
|
|
12
|
-
optionLabel = input('label',
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
optionLabel = input('label', /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
16
|
+
placeholder = input(/* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
18
|
+
styleClass = input('', /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "styleClass" }] : /* istanbul ignore next */ []));
|
|
20
|
+
invalid = input(false, /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
22
|
+
invalidFeedback = input(/* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [undefined, { debugName: "invalidFeedback" }] : /* istanbul ignore next */ []));
|
|
24
|
+
valid = input(false, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "valid" }] : /* istanbul ignore next */ []));
|
|
26
|
+
validFeedback = input(/* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [undefined, { debugName: "validFeedback" }] : /* istanbul ignore next */ []));
|
|
19
28
|
/**Support multiple attribute */
|
|
20
|
-
multiple = input(false,
|
|
29
|
+
multiple = input(false, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
21
31
|
/**Size of multiple attribute */
|
|
22
|
-
size = input(
|
|
32
|
+
size = input(/* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [undefined, { debugName: "size" }] : /* istanbul ignore next */ []));
|
|
23
34
|
/**Display clear button */
|
|
24
|
-
showClear = input(false,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
showClear = input(false, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "showClear" }] : /* istanbul ignore next */ []));
|
|
37
|
+
clearIconClass = input('fa fa-times', /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "clearIconClass" }] : /* istanbul ignore next */ []));
|
|
39
|
+
disabled = input(false, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
41
|
+
trackBy = input(/* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [undefined, { debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
28
43
|
selectionChange = output();
|
|
29
|
-
disabledState = signal(false,
|
|
30
|
-
|
|
44
|
+
disabledState = signal(false, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
46
|
+
isDisabled = computed(() => this.disabled() || this.disabledState(), /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
31
48
|
onChange = (_) => { };
|
|
32
49
|
onTouched = () => { };
|
|
33
|
-
value = signal(null,
|
|
50
|
+
value = signal(null, /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
34
52
|
writeValue(obj) {
|
|
35
53
|
if (!this.multiple() && this.placeholder() && !obj) {
|
|
36
54
|
this.value.set(null);
|
|
@@ -77,29 +95,25 @@ class YsSelect {
|
|
|
77
95
|
return String(item);
|
|
78
96
|
}
|
|
79
97
|
trackItem(item) {
|
|
80
|
-
return this.trackBy()?.(item)
|
|
81
|
-
?? item;
|
|
98
|
+
return this.trackBy()?.(item) ?? item;
|
|
82
99
|
}
|
|
83
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
84
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: YsSelect, isStandalone: true, selector: "ys-select", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, invalidFeedback: { classPropertyName: "invalidFeedback", publicName: "invalidFeedback", isSignal: true, isRequired: false, transformFunction: null }, valid: { classPropertyName: "valid", publicName: "valid", isSignal: true, isRequired: false, transformFunction: null }, validFeedback: { classPropertyName: "validFeedback", publicName: "validFeedback", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, clearIconClass: { classPropertyName: "clearIconClass", publicName: "clearIconClass", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, providers: [
|
|
85
102
|
{
|
|
86
103
|
provide: NG_VALUE_ACCESSOR,
|
|
87
104
|
useExisting: forwardRef(() => YsSelect),
|
|
88
|
-
multi: true
|
|
89
|
-
}
|
|
90
|
-
], ngImport: i0, template: "<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear(), 'is-valid': valid(), 'is-invalid': invalid()}\">\n\n @if (!multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\">\n\n @if (placeholder()) {\n <option disabled [ngValue]=\"null\" class=\"d-none\">\n {{ placeholder() }}\n </option>\n }\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\" [multiple]=\"multiple()\" [size]=\"size()\">\n\n <!-- @if (placeholder()) {\n <option selected disabled [ngValue]=\"null\">\n {{placeholder()}}\n </option>\n } -->\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (showClear()) {\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\n [disabled]=\"isDisabled()\">\n <span [ngClass]=\"clearIconClass()\"></span>\n </button>\n }\n\n</div>\n\n@if(valid() && validFeedback()){\n\n<div class=\"valid-feedback\">{{validFeedback()}}</div>\n\n}\n\n@if(invalid() && invalidFeedback()){\n\n<div class=\"invalid-feedback\">{{invalidFeedback()}}</div>\n\n}", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
105
|
+
multi: true,
|
|
106
|
+
},
|
|
107
|
+
], ngImport: i0, template: "<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear(), 'is-valid': valid(), 'is-invalid': invalid()}\">\n\n @if (!multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\">\n\n @if (placeholder()) {\n <option disabled [ngValue]=\"null\" class=\"d-none\">\n {{ placeholder() }}\n </option>\n }\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\" [multiple]=\"multiple()\" [size]=\"size()\">\n\n <!-- @if (placeholder()) {\n <option selected disabled [ngValue]=\"null\">\n {{placeholder()}}\n </option>\n } -->\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (showClear()) {\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\n [disabled]=\"isDisabled()\">\n <span [ngClass]=\"clearIconClass()\"></span>\n </button>\n }\n\n</div>\n\n@if(valid() && validFeedback()){\n\n<div class=\"valid-feedback\">{{validFeedback()}}</div>\n\n}\n\n@if(invalid() && invalidFeedback()){\n\n<div class=\"invalid-feedback\">{{invalidFeedback()}}</div>\n\n}", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.SelectMultipleControlValueAccessor, selector: "select[multiple]:not([ngNoCva])[formControlName],select[multiple]:not([ngNoCva])[formControl],select[multiple]:not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
91
108
|
}
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsSelect, decorators: [{
|
|
93
110
|
type: Component,
|
|
94
|
-
args: [{ selector: 'ys-select', imports: [
|
|
95
|
-
FormsModule,
|
|
96
|
-
NgClass
|
|
97
|
-
], providers: [
|
|
111
|
+
args: [{ selector: 'ys-select', imports: [FormsModule, NgClass], changeDetection: ChangeDetectionStrategy.Eager, providers: [
|
|
98
112
|
{
|
|
99
113
|
provide: NG_VALUE_ACCESSOR,
|
|
100
114
|
useExisting: forwardRef(() => YsSelect),
|
|
101
|
-
multi: true
|
|
102
|
-
}
|
|
115
|
+
multi: true,
|
|
116
|
+
},
|
|
103
117
|
], template: "<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear(), 'is-valid': valid(), 'is-invalid': invalid()}\">\n\n @if (!multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\">\n\n @if (placeholder()) {\n <option disabled [ngValue]=\"null\" class=\"d-none\">\n {{ placeholder() }}\n </option>\n }\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\" [multiple]=\"multiple()\" [size]=\"size()\">\n\n <!-- @if (placeholder()) {\n <option selected disabled [ngValue]=\"null\">\n {{placeholder()}}\n </option>\n } -->\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (showClear()) {\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\n [disabled]=\"isDisabled()\">\n <span [ngClass]=\"clearIconClass()\"></span>\n </button>\n }\n\n</div>\n\n@if(valid() && validFeedback()){\n\n<div class=\"valid-feedback\">{{validFeedback()}}</div>\n\n}\n\n@if(invalid() && invalidFeedback()){\n\n<div class=\"invalid-feedback\">{{invalidFeedback()}}</div>\n\n}" }]
|
|
104
118
|
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], invalidFeedback: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidFeedback", required: false }] }], valid: [{ type: i0.Input, args: [{ isSignal: true, alias: "valid", required: false }] }], validFeedback: [{ type: i0.Input, args: [{ isSignal: true, alias: "validFeedback", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }], clearIconClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearIconClass", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }] } });
|
|
105
119
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yoozsoft-yoozsoft-ng-select.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/select/src/ys-select/ys-select.ts","../../../../projects/yoozsoft/yoozsoft-ng/select/src/ys-select/ys-select.html","../../../../projects/yoozsoft/yoozsoft-ng/select/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/select/yoozsoft-yoozsoft-ng-select.ts"],"sourcesContent":["import { NgClass } from '@angular/common';\nimport { Component, computed, forwardRef, input, output, signal } from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n@Component({\n selector: 'ys-select',\n imports: [\n FormsModule,\n NgClass\n ],\n templateUrl: './ys-select.html',\n styleUrl: './ys-select.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => YsSelect),\n multi: true\n }\n ]\n})\nexport class YsSelect<T = any> implements ControlValueAccessor {\n\n /**ُSelect element id */\n id = input('ys-select');\n options = input<T[]>([]);\n /**Name of field to display in option title */\n optionLabel = input('label');\n placeholder = input<string>();\n styleClass = input<string>('');\n invalid = input<boolean>(false);\n invalidFeedback = input<string>();\n valid = input(false);\n validFeedback = input<string>();\n /**Support multiple attribute */\n multiple = input(false);\n /**Size of multiple attribute */\n size = input<number>();\n /**Display clear button */\n showClear = input(false);\n clearIconClass = input('fa fa-times');\n\n disabled = input(false);\n\n trackBy = input<(item: any) => unknown>();\n\n selectionChange = output<any>();\n\n private disabledState = signal(false);\n\n readonly isDisabled = computed(() => this.disabled() || this.disabledState());\n\n private onChange = (_: unknown) => { };\n private onTouched = () => { };\n\n value = signal<T | T[] | null>(null);\n\n writeValue(obj: any): void {\n if (!this.multiple() && this.placeholder() && !obj) {\n this.value.set(null);\n return;\n }\n\n if (this.multiple() && !obj) {\n this.value.set(this.multiple() ? [] : null);\n return;\n }\n\n if (!this.multiple() && obj && Array.isArray(obj)) {\n if (obj.length) {\n this.value.set(obj[0]);\n }\n else {\n this.value.set(null);\n }\n return;\n }\n\n this.value.set(obj);\n }\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n setDisabledState?(isDisabled: boolean): void {\n this.disabledState.set(isDisabled);\n }\n\n onModelChange(value: T | T[] | null) {\n\n this.value.set(value);\n\n this.onChange(value);\n this.onTouched();\n\n this.selectionChange.emit(value);\n }\n\n clearValue() {\n this.value.set(this.multiple() ? [] : null);\n this.onModelChange(this.value());\n }\n\n getLabel(item: any): string {\n\n if (item && typeof item === 'object') {\n return item[this.optionLabel()];\n }\n\n return String(item);\n }\n\n trackItem(item: any) {\n return this.trackBy()?.(item)\n ?? item;\n }\n\n}\n","<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear(), 'is-valid': valid(), 'is-invalid': invalid()}\">\n\n @if (!multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\">\n\n @if (placeholder()) {\n <option disabled [ngValue]=\"null\" class=\"d-none\">\n {{ placeholder() }}\n </option>\n }\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\" [multiple]=\"multiple()\" [size]=\"size()\">\n\n <!-- @if (placeholder()) {\n <option selected disabled [ngValue]=\"null\">\n {{placeholder()}}\n </option>\n } -->\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (showClear()) {\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\n [disabled]=\"isDisabled()\">\n <span [ngClass]=\"clearIconClass()\"></span>\n </button>\n }\n\n</div>\n\n@if(valid() && validFeedback()){\n\n<div class=\"valid-feedback\">{{validFeedback()}}</div>\n\n}\n\n@if(invalid() && invalidFeedback()){\n\n<div class=\"invalid-feedback\">{{invalidFeedback()}}</div>\n\n}","/*\r\n * Public API Surface of ys-select\r\n */\r\n\r\nexport * from './src/ys-select/ys-select';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAoBa,QAAQ,CAAA;;AAGnB,IAAA,EAAE,GAAG,KAAK,CAAC,WAAW,yEAAC;AACvB,IAAA,OAAO,GAAG,KAAK,CAAM,EAAE,8EAAC;;AAExB,IAAA,WAAW,GAAG,KAAK,CAAC,OAAO,kFAAC;IAC5B,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,UAAU,GAAG,KAAK,CAAS,EAAE,iFAAC;AAC9B,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,8EAAC;IAC/B,eAAe,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AACjC,IAAA,KAAK,GAAG,KAAK,CAAC,KAAK,4EAAC;IACpB,aAAa,GAAG,KAAK,CAAA,IAAA,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EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,2CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,qDAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACX,OAAO,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;4FAYE,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAhBpB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EAAA,OAAA,EACZ;wBACP,WAAW;wBACX;qBACD,EAAA,SAAA,EAGU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,cAAc,CAAC;AACvC,4BAAA,KAAK,EAAE;AACR;AACF,qBAAA,EAAA,QAAA,EAAA,whEAAA,EAAA;;;AElBH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"yoozsoft-yoozsoft-ng-select.mjs","sources":["../../../../projects/yoozsoft/yoozsoft-ng/select/src/ys-select/ys-select.ts","../../../../projects/yoozsoft/yoozsoft-ng/select/src/ys-select/ys-select.html","../../../../projects/yoozsoft/yoozsoft-ng/select/public-api.ts","../../../../projects/yoozsoft/yoozsoft-ng/select/yoozsoft-yoozsoft-ng-select.ts"],"sourcesContent":["import { NgClass } from '@angular/common';\r\nimport {\r\n Component,\r\n computed,\r\n forwardRef,\r\n input,\r\n output,\r\n signal,\r\n ChangeDetectionStrategy,\r\n} from '@angular/core';\r\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\r\n\r\n@Component({\r\n selector: 'ys-select',\r\n imports: [FormsModule, NgClass],\r\n templateUrl: './ys-select.html',\r\n styleUrl: './ys-select.scss',\r\n changeDetection: ChangeDetectionStrategy.Eager,\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => YsSelect),\r\n multi: true,\r\n },\r\n ],\r\n})\r\nexport class YsSelect<T = any> implements ControlValueAccessor {\r\n /**ُSelect element id */\r\n id = input('ys-select');\r\n options = input<T[]>([]);\r\n /**Name of field to display in option title */\r\n optionLabel = input('label');\r\n placeholder = input<string>();\r\n styleClass = input<string>('');\r\n invalid = input<boolean>(false);\r\n invalidFeedback = input<string>();\r\n valid = input(false);\r\n validFeedback = input<string>();\r\n /**Support multiple attribute */\r\n multiple = input(false);\r\n /**Size of multiple attribute */\r\n size = input<number>();\r\n /**Display clear button */\r\n showClear = input(false);\r\n clearIconClass = input('fa fa-times');\r\n\r\n disabled = input(false);\r\n\r\n trackBy = input<(item: any) => unknown>();\r\n\r\n selectionChange = output<any>();\r\n\r\n private disabledState = signal(false);\r\n\r\n readonly isDisabled = computed(() => this.disabled() || this.disabledState());\r\n\r\n private onChange = (_: unknown) => {};\r\n private onTouched = () => {};\r\n\r\n value = signal<T | T[] | null>(null);\r\n\r\n writeValue(obj: any): void {\r\n if (!this.multiple() && this.placeholder() && !obj) {\r\n this.value.set(null);\r\n return;\r\n }\r\n\r\n if (this.multiple() && !obj) {\r\n this.value.set(this.multiple() ? [] : null);\r\n return;\r\n }\r\n\r\n if (!this.multiple() && obj && Array.isArray(obj)) {\r\n if (obj.length) {\r\n this.value.set(obj[0]);\r\n } else {\r\n this.value.set(null);\r\n }\r\n return;\r\n }\r\n\r\n this.value.set(obj);\r\n }\r\n registerOnChange(fn: any): void {\r\n this.onChange = fn;\r\n }\r\n registerOnTouched(fn: any): void {\r\n this.onTouched = fn;\r\n }\r\n setDisabledState?(isDisabled: boolean): void {\r\n this.disabledState.set(isDisabled);\r\n }\r\n\r\n onModelChange(value: T | T[] | null) {\r\n this.value.set(value);\r\n\r\n this.onChange(value);\r\n this.onTouched();\r\n\r\n this.selectionChange.emit(value);\r\n }\r\n\r\n clearValue() {\r\n this.value.set(this.multiple() ? [] : null);\r\n this.onModelChange(this.value());\r\n }\r\n\r\n getLabel(item: any): string {\r\n if (item && typeof item === 'object') {\r\n return item[this.optionLabel()];\r\n }\r\n\r\n return String(item);\r\n }\r\n\r\n trackItem(item: any) {\r\n return this.trackBy()?.(item) ?? item;\r\n }\r\n}\r\n","<div class=\"ys-select\" [ngClass]=\"{'input-group': showClear(), 'is-valid': valid(), 'is-invalid': invalid()}\">\n\n @if (!multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\">\n\n @if (placeholder()) {\n <option disabled [ngValue]=\"null\" class=\"d-none\">\n {{ placeholder() }}\n </option>\n }\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (multiple()) {\n <select [id]=\"id()\" class=\"form-select\" [class]=\"styleClass()\"\n [ngClass]=\"{'is-valid': valid(), 'is-invalid': invalid()}\" aria-label=\"Select option\" [ngModel]=\"value()\"\n (ngModelChange)=\"onModelChange($event)\" [disabled]=\"isDisabled()\" [multiple]=\"multiple()\" [size]=\"size()\">\n\n <!-- @if (placeholder()) {\n <option selected disabled [ngValue]=\"null\">\n {{placeholder()}}\n </option>\n } -->\n\n @for (item of options(); track trackItem(item); let i = $index) {\n <option [ngValue]=\"item\">\n <!-- [selected]=\" i === 0 && !placeholder() \" -->\n {{ getLabel(item) }}\n </option>\n }\n\n </select>\n }\n\n @if (showClear()) {\n <button class=\"btn btn-outline-secondary btn-clear\" type=\"button\" id=\"btn-clear\" (click)=\"clearValue()\"\n [disabled]=\"isDisabled()\">\n <span [ngClass]=\"clearIconClass()\"></span>\n </button>\n }\n\n</div>\n\n@if(valid() && validFeedback()){\n\n<div class=\"valid-feedback\">{{validFeedback()}}</div>\n\n}\n\n@if(invalid() && invalidFeedback()){\n\n<div class=\"invalid-feedback\">{{invalidFeedback()}}</div>\n\n}","/*\r\n * Public API Surface of ys-select\r\n */\r\n\r\nexport * from './src/ys-select/ys-select';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MA0Ba,QAAQ,CAAA;;IAEnB,EAAE,GAAG,KAAK,CAAC,WAAW;2EAAC;IACvB,OAAO,GAAG,KAAK,CAAM,EAAE;gFAAC;;IAExB,WAAW,GAAG,KAAK,CAAC,OAAO;oFAAC;AAC5B,IAAA,WAAW,GAAG,KAAK;+FAAU;IAC7B,UAAU,GAAG,KAAK,CAAS,EAAE;mFAAC;IAC9B,OAAO,GAAG,KAAK,CAAU,KAAK;gFAAC;AAC/B,IAAA,eAAe,GAAG,KAAK;mGAAU;IACjC,KAAK,GAAG,KAAK,CAAC,KAAK;8EAAC;AACpB,IAAA,aAAa,GAAG,KAAK;iGAAU;;IAE/B,QAAQ,GAAG,KAAK,CAAC,KAAK;iFAAC;;AAEvB,IAAA,IAAI,GAAG,KAAK;wFAAU;;IAEtB,SAAS,GAAG,KAAK,CAAC,KAAK;kFAAC;IACxB,cAAc,GAAG,KAAK,CAAC,aAAa;uFAAC;IAErC,QAAQ,GAAG,KAAK,CAAC,KAAK;iFAAC;AAEvB,IAAA,OAAO,GAAG,KAAK;2FAA0B;IAEzC,eAAe,GAAG,MAAM,EAAO;IAEvB,aAAa,GAAG,MAAM,CAAC,KAAK;sFAAC;AAE5B,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,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C;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,cAAc,CAAC;AACvC,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,whEAAA,EAAA;;;AExBH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPlatformBrowser } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, PLATFORM_ID, signal, Injectable, input, output, computed, Component } from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, signal, Injectable, input, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { Router, NavigationEnd, RouterLink, RouterLinkActive } from '@angular/router';
|
|
6
6
|
import { filter, map } from 'rxjs';
|
|
@@ -8,8 +8,10 @@ import { filter, map } from 'rxjs';
|
|
|
8
8
|
class SidebarService {
|
|
9
9
|
platformId = inject(PLATFORM_ID);
|
|
10
10
|
mediaQuery;
|
|
11
|
-
_isMobile = signal(false,
|
|
12
|
-
|
|
11
|
+
_isMobile = signal(false, /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "_isMobile" }] : /* istanbul ignore next */ []));
|
|
13
|
+
_isOpen = signal(true, /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "_isOpen" }] : /* istanbul ignore next */ []));
|
|
13
15
|
isMobile = this._isMobile.asReadonly();
|
|
14
16
|
isOpen = this._isOpen.asReadonly();
|
|
15
17
|
constructor() {
|
|
@@ -37,10 +39,10 @@ class SidebarService {
|
|
|
37
39
|
close() {
|
|
38
40
|
this._isOpen.set(false);
|
|
39
41
|
}
|
|
40
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
41
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SidebarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
43
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SidebarService, providedIn: 'root' });
|
|
42
44
|
}
|
|
43
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SidebarService, decorators: [{
|
|
44
46
|
type: Injectable,
|
|
45
47
|
args: [{
|
|
46
48
|
providedIn: 'root',
|
|
@@ -49,21 +51,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
49
51
|
|
|
50
52
|
class YsSidebar {
|
|
51
53
|
router = inject(Router);
|
|
52
|
-
items = input([],
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
items = input([], /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
56
|
+
profile = input(/* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [undefined, { debugName: "profile" }] : /* istanbul ignore next */ []));
|
|
58
|
+
styleClass = input('bg-body', /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "styleClass" }] : /* istanbul ignore next */ []));
|
|
60
|
+
showClose = input(false, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "showClose" }] : /* istanbul ignore next */ []));
|
|
62
|
+
closeStyleClass = input('btn-close-white', /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "closeStyleClass" }] : /* istanbul ignore next */ []));
|
|
57
64
|
close = output();
|
|
58
65
|
itemSelected = output();
|
|
59
|
-
fullName = computed(() => [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
currentUrl = toSignal(this.router.events.pipe(filter(event => event instanceof NavigationEnd), map(() => this.router.url)), {
|
|
64
|
-
initialValue: this.router.url
|
|
66
|
+
fullName = computed(() => [this.profile()?.firstName, this.profile()?.lastName].filter(Boolean).join(' '), /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "fullName" }] : /* istanbul ignore next */ []));
|
|
68
|
+
currentUrl = toSignal(this.router.events.pipe(filter((event) => event instanceof NavigationEnd), map(() => this.router.url)), {
|
|
69
|
+
initialValue: this.router.url,
|
|
65
70
|
});
|
|
66
|
-
expandedMenu = signal(null,
|
|
71
|
+
expandedMenu = signal(null, /* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [{ debugName: "expandedMenu" }] : /* istanbul ignore next */ []));
|
|
67
73
|
getItemKey(item) {
|
|
68
74
|
return item.id ?? item.route ?? item.label ?? null;
|
|
69
75
|
}
|
|
@@ -72,16 +78,14 @@ class YsSidebar {
|
|
|
72
78
|
if (!key) {
|
|
73
79
|
return;
|
|
74
80
|
}
|
|
75
|
-
this.expandedMenu.update(current => current === key ? null : key);
|
|
81
|
+
this.expandedMenu.update((current) => (current === key ? null : key));
|
|
76
82
|
}
|
|
77
83
|
isExpanded(item) {
|
|
78
84
|
return this.expandedMenu() === this.getItemKey(item);
|
|
79
85
|
}
|
|
80
86
|
isParentActive(item) {
|
|
81
87
|
const url = this.currentUrl();
|
|
82
|
-
return item.children?.some(child => child.route &&
|
|
83
|
-
(url === child.route ||
|
|
84
|
-
url.startsWith(child.route + '/'))) ?? false;
|
|
88
|
+
return (item.children?.some((child) => child.route && (url === child.route || url.startsWith(child.route + '/'))) ?? false);
|
|
85
89
|
}
|
|
86
90
|
closeSidebar() {
|
|
87
91
|
this.close.emit();
|
|
@@ -107,15 +111,12 @@ class YsSidebar {
|
|
|
107
111
|
this.onSelectItem(subItem);
|
|
108
112
|
subItem.onClick?.(event);
|
|
109
113
|
}
|
|
110
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
111
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
114
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsSidebar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
115
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: YsSidebar, isStandalone: true, selector: "ys-sidebar", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, profile: { classPropertyName: "profile", publicName: "profile", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, showClose: { classPropertyName: "showClose", publicName: "showClose", isSignal: true, isRequired: false, transformFunction: null }, closeStyleClass: { classPropertyName: "closeStyleClass", publicName: "closeStyleClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", itemSelected: "itemSelected" }, ngImport: i0, template: "<aside class=\"ys-sidebar overflow-auto border-end\" [class]=\"styleClass()\">\r\n @if (showClose()) {\r\n <div class=\"d-flex justify-content-end\">\r\n <button type=\"button\" (click)=\"closeSidebar()\" class=\"btn-close p-2\" [class]=\"closeStyleClass()\"\r\n aria-label=\"Close\"></button>\r\n </div>\r\n }\r\n\r\n @if (profile()?.image || profile()?.role || fullName()) {\r\n <div class=\"sidebar-profile d-flex flex-column justify-content-center border-bottom p-3\" [class.pt-0]=\"showClose()\">\r\n @if (profile()?.image) {\r\n <div class=\"image-wrapper\" [class.mb-3]=\"fullName() || profile()?.role\">\r\n <div class=\"user-image rounded-circle m-auto\">\r\n <img [src]=\"profile()?.image?.src\" class=\"img-fluid\" [alt]=\"profile()?.image?.alt\" />\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (fullName() || profile()?.role) {\r\n <div class=\"profile-details d-flex flex-column text-center\">\r\n @if (fullName()) {\r\n <strong class=\"text-uppercase name\">{{ fullName() }}</strong>\r\n }\r\n\r\n @if (profile()?.role) {\r\n <small class=\"text-uppercase role\">{{ profile()?.role }}</small>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"sidebar-menu p-3\">\r\n <ul class=\"menu-items nav nav-pills flex-column\">\r\n @for (item of items(); track item.id ?? item.route ?? $index) {\r\n @if (item.isDivider) {\r\n <hr class=\"sidebar-divider my-2\" />\r\n } @else {\r\n @if (item.children?.length) {\r\n <li class=\"nav-item mb-2\">\r\n <button type=\"button\" class=\"nav-link d-flex align-items-center justify-content-between w-100\"\r\n [class.active]=\"isParentActive(item)\" (click)=\"toggle(item); item.onClick && item.onClick($event)\"\r\n [disabled]=\"item.disabled\">\r\n @if (item.iconClass) {\r\n <i [class]=\"item.iconClass\"></i>\r\n }\r\n\r\n <span class=\"link-label ms-3 me-auto\">{{ item.label }}</span>\r\n\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info me-1\" [class]=\"item.badgeStyleClass\">{{\r\n item.badgeLabel\r\n }}</span>\r\n }\r\n\r\n <i class=\"fa-solid fa-chevron-right transition-icon\" [class.expanded]=\"isExpanded(item)\">\r\n </i>\r\n </button>\r\n\r\n <ul class=\"menu-sub-items nav nav-pills flex-column ms-3 border-bottom\" [class.expanded]=\"isExpanded(item)\">\r\n @for (subItem of item.children; track subItem.id ?? subItem.route ?? $index) {\r\n @if (subItem.isDivider) {\r\n <hr class=\"sidebar-divider my-1\" />\r\n } @else {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link d-flex align-items-center\" [routerLink]=\"subItem.disabled ? null : subItem.route\"\r\n routerLinkActive=\"active\" (click)=\"onSubItemClick($event, subItem)\" [class.disabled]=\"subItem.disabled\">\r\n @if (subItem.iconClass) {\r\n <i [class]=\"subItem.iconClass\"></i>\r\n }\r\n\r\n <span class=\"link-label ms-3 me-auto\">{{ subItem.label }}</span>\r\n\r\n @if (subItem.badgeLabel) {\r\n <span class=\"badge bg-info\" [class]=\"subItem.badgeStyleClass\">{{\r\n subItem.badgeLabel\r\n }}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n </li>\r\n } @else {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link d-flex align-items-center\" [class.disabled]=\"item.disabled\"\r\n [routerLink]=\"item.disabled ? null : item.route\" routerLinkActive=\"active\"\r\n (click)=\"onItemClick($event, item)\">\r\n @if (item.iconClass) {\r\n <i [class]=\"item.iconClass\"></i>\r\n }\r\n\r\n <span class=\"link-label ms-3 me-auto\">{{ item.label }}</span>\r\n\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info\" [class]=\"item.badgeStyleClass\">\r\n {{ item.badgeLabel }}\r\n </span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n }\r\n }\r\n </ul>\r\n </div>\r\n</aside>", styles: [".ys-sidebar{width:280px;height:100%;position:fixed;left:0;z-index:1001;transition:transform .5s ease,width .5s ease}.ys-sidebar .sidebar-profile .user-image{width:75px;height:75px;overflow:hidden}.ys-sidebar .sidebar-profile .profile-details .role{font-size:.7rem;letter-spacing:1px}.ys-sidebar .sidebar-menu .menu-sub-items .nav-link{height:3em;line-height:3em;font-size:11px}.transition-icon{transition:transform .25s ease}.transition-icon.expanded{transform:rotate(90deg)}.menu-sub-items{max-height:0;overflow:hidden;transition:max-height .25s ease,opacity .25s ease,padding .25 ease;opacity:0;margin-left:.75rem;padding:0;border-left:3px solid var(--bs-border-color);background-color:rgba(var(--bs-secondary-rgb),.07);border-radius:.5rem}.menu-sub-items.expanded{max-height:500px;opacity:1;padding:.5rem}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
112
116
|
}
|
|
113
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: YsSidebar, decorators: [{
|
|
114
118
|
type: Component,
|
|
115
|
-
args: [{ selector: 'ys-sidebar', imports: [
|
|
116
|
-
RouterLink,
|
|
117
|
-
RouterLinkActive
|
|
118
|
-
], template: "<aside class=\"ys-sidebar overflow-auto border-end\" [class]=\"styleClass()\">\n\n @if(showClose()){\n <div class=\"d-flex justify-content-end\">\n <button type=\"button\" (click)=\"closeSidebar()\" class=\"btn-close p-2\" [class]=\"closeStyleClass()\"\n aria-label=\"Close\"></button>\n </div>\n }\n\n @if (profile()?.image || profile()?.role || fullName()) {\n <div class=\"sidebar-profile d-flex flex-column justify-content-center border-bottom p-3\" [class.pt-0]=\"showClose()\">\n\n @if (profile()?.image) {\n <div class=\"image-wrapper\" [class.mb-3]=\"fullName() || profile()?.role\">\n <div class=\"user-image rounded-circle m-auto\">\n <img [src]=\"profile()?.image?.src\" class=\"img-fluid\" [alt]=\"profile()?.image?.alt\">\n </div>\n </div>\n }\n\n @if (fullName() || profile()?.role) {\n <div class=\"profile-details d-flex flex-column text-center\">\n\n @if (fullName()) {\n <strong class=\"text-uppercase name\">{{fullName()}}</strong>\n }\n\n @if (profile()?.role) {\n <small class=\"text-uppercase role\">{{profile()?.role}}</small>\n }\n\n </div>\n }\n\n </div>\n }\n\n <div class=\"sidebar-menu p-3\">\n <ul class=\"menu-items nav nav-pills flex-column\">\n\n @for (item of items(); track item.id ?? item.route ?? $index) {\n\n @if (item.isDivider) {\n <hr class=\"sidebar-divider my-2\" />\n }\n @else {\n\n @if (item.children?.length) {\n <li class=\"nav-item mb-2\">\n\n <button type=\"button\" class=\"nav-link d-flex align-items-center justify-content-between w-100\"\n [class.active]=\"isParentActive(item)\" (click)=\"toggle(item); (item.onClick && item.onClick($event))\"\n [disabled]=\"item.disabled\">\n\n @if (item.iconClass) {\n <i [class]=\"item.iconClass\"></i>\n }\n\n <span class=\"link-label ms-3 me-auto\">{{item.label}}</span>\n\n @if (item.badgeLabel) {\n <span class=\"badge bg-info me-1\" [class]=\"item.badgeStyleClass\">{{item.badgeLabel}}</span>\n }\n\n <i class=\"fa-solid fa-chevron-right transition-icon\" [class.expanded]=\"isExpanded(item)\">\n </i>\n\n </button>\n\n <ul class=\"menu-sub-items nav nav-pills flex-column ms-3 border-bottom\"\n [class.expanded]=\"isExpanded(item)\">\n\n @for (subItem of item.children; track subItem.id ?? subItem.route ?? $index) {\n\n @if (subItem.isDivider) {\n <hr class=\"sidebar-divider my-1\" />\n }\n @else {\n <li class=\"nav-item\">\n <a class=\"nav-link d-flex align-items-center\"\n [routerLink]=\"subItem.disabled ? null : subItem.route\" routerLinkActive=\"active\"\n (click)=\"onSubItemClick($event, subItem)\" [class.disabled]=\"subItem.disabled\">\n\n @if (subItem.iconClass) {\n <i [class]=\"subItem.iconClass\"></i>\n }\n\n <span class=\"link-label ms-3 me-auto\">{{subItem.label}}</span>\n\n @if (subItem.badgeLabel) {\n <span class=\"badge bg-info\" [class]=\"subItem.badgeStyleClass\">{{subItem.badgeLabel}}</span>\n }\n\n </a>\n </li>\n }\n\n }\n </ul>\n\n </li>\n\n }\n @else {\n\n <li class=\"nav-item\">\n <a class=\"nav-link d-flex align-items-center\" [class.disabled]=\"item.disabled\"\n [routerLink]=\"item.disabled ? null : item.route\" routerLinkActive=\"active\"\n (click)=\"onItemClick($event,item)\">\n\n @if (item.iconClass) {\n <i [class]=\"item.iconClass\"></i>\n }\n\n <span class=\"link-label ms-3 me-auto\">{{ item.label }}</span>\n\n @if (item.badgeLabel) {\n <span class=\"badge bg-info\" [class]=\"item.badgeStyleClass\"> {{ item.badgeLabel }} </span>\n }\n\n </a>\n </li>\n\n }\n\n }\n\n }\n </ul>\n </div>\n</aside>", styles: [".ys-sidebar{width:280px;height:100%;position:fixed;left:0;z-index:1001;transition:transform .5s ease,width .5s ease}.ys-sidebar .sidebar-profile .user-image{width:75px;height:75px;overflow:hidden}.ys-sidebar .sidebar-profile .profile-details .role{font-size:.7rem;letter-spacing:1px}.ys-sidebar .sidebar-menu .menu-sub-items .nav-link{height:3em;line-height:3em;font-size:11px}.transition-icon{transition:transform .25s ease}.transition-icon.expanded{transform:rotate(90deg)}.menu-sub-items{max-height:0;overflow:hidden;transition:max-height .25s ease,opacity .25s ease,padding .25 ease;opacity:0;margin-left:.75rem;padding:0;border-left:3px solid var(--bs-border-color);background-color:rgba(var(--bs-secondary-rgb),.07);border-radius:.5rem}.menu-sub-items.expanded{max-height:500px;opacity:1;padding:.5rem}\n"] }]
|
|
119
|
+
args: [{ selector: 'ys-sidebar', imports: [RouterLink, RouterLinkActive], changeDetection: ChangeDetectionStrategy.Eager, template: "<aside class=\"ys-sidebar overflow-auto border-end\" [class]=\"styleClass()\">\r\n @if (showClose()) {\r\n <div class=\"d-flex justify-content-end\">\r\n <button type=\"button\" (click)=\"closeSidebar()\" class=\"btn-close p-2\" [class]=\"closeStyleClass()\"\r\n aria-label=\"Close\"></button>\r\n </div>\r\n }\r\n\r\n @if (profile()?.image || profile()?.role || fullName()) {\r\n <div class=\"sidebar-profile d-flex flex-column justify-content-center border-bottom p-3\" [class.pt-0]=\"showClose()\">\r\n @if (profile()?.image) {\r\n <div class=\"image-wrapper\" [class.mb-3]=\"fullName() || profile()?.role\">\r\n <div class=\"user-image rounded-circle m-auto\">\r\n <img [src]=\"profile()?.image?.src\" class=\"img-fluid\" [alt]=\"profile()?.image?.alt\" />\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (fullName() || profile()?.role) {\r\n <div class=\"profile-details d-flex flex-column text-center\">\r\n @if (fullName()) {\r\n <strong class=\"text-uppercase name\">{{ fullName() }}</strong>\r\n }\r\n\r\n @if (profile()?.role) {\r\n <small class=\"text-uppercase role\">{{ profile()?.role }}</small>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"sidebar-menu p-3\">\r\n <ul class=\"menu-items nav nav-pills flex-column\">\r\n @for (item of items(); track item.id ?? item.route ?? $index) {\r\n @if (item.isDivider) {\r\n <hr class=\"sidebar-divider my-2\" />\r\n } @else {\r\n @if (item.children?.length) {\r\n <li class=\"nav-item mb-2\">\r\n <button type=\"button\" class=\"nav-link d-flex align-items-center justify-content-between w-100\"\r\n [class.active]=\"isParentActive(item)\" (click)=\"toggle(item); item.onClick && item.onClick($event)\"\r\n [disabled]=\"item.disabled\">\r\n @if (item.iconClass) {\r\n <i [class]=\"item.iconClass\"></i>\r\n }\r\n\r\n <span class=\"link-label ms-3 me-auto\">{{ item.label }}</span>\r\n\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info me-1\" [class]=\"item.badgeStyleClass\">{{\r\n item.badgeLabel\r\n }}</span>\r\n }\r\n\r\n <i class=\"fa-solid fa-chevron-right transition-icon\" [class.expanded]=\"isExpanded(item)\">\r\n </i>\r\n </button>\r\n\r\n <ul class=\"menu-sub-items nav nav-pills flex-column ms-3 border-bottom\" [class.expanded]=\"isExpanded(item)\">\r\n @for (subItem of item.children; track subItem.id ?? subItem.route ?? $index) {\r\n @if (subItem.isDivider) {\r\n <hr class=\"sidebar-divider my-1\" />\r\n } @else {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link d-flex align-items-center\" [routerLink]=\"subItem.disabled ? null : subItem.route\"\r\n routerLinkActive=\"active\" (click)=\"onSubItemClick($event, subItem)\" [class.disabled]=\"subItem.disabled\">\r\n @if (subItem.iconClass) {\r\n <i [class]=\"subItem.iconClass\"></i>\r\n }\r\n\r\n <span class=\"link-label ms-3 me-auto\">{{ subItem.label }}</span>\r\n\r\n @if (subItem.badgeLabel) {\r\n <span class=\"badge bg-info\" [class]=\"subItem.badgeStyleClass\">{{\r\n subItem.badgeLabel\r\n }}</span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n }\r\n </ul>\r\n </li>\r\n } @else {\r\n <li class=\"nav-item\">\r\n <a class=\"nav-link d-flex align-items-center\" [class.disabled]=\"item.disabled\"\r\n [routerLink]=\"item.disabled ? null : item.route\" routerLinkActive=\"active\"\r\n (click)=\"onItemClick($event, item)\">\r\n @if (item.iconClass) {\r\n <i [class]=\"item.iconClass\"></i>\r\n }\r\n\r\n <span class=\"link-label ms-3 me-auto\">{{ item.label }}</span>\r\n\r\n @if (item.badgeLabel) {\r\n <span class=\"badge bg-info\" [class]=\"item.badgeStyleClass\">\r\n {{ item.badgeLabel }}\r\n </span>\r\n }\r\n </a>\r\n </li>\r\n }\r\n }\r\n }\r\n </ul>\r\n </div>\r\n</aside>", styles: [".ys-sidebar{width:280px;height:100%;position:fixed;left:0;z-index:1001;transition:transform .5s ease,width .5s ease}.ys-sidebar .sidebar-profile .user-image{width:75px;height:75px;overflow:hidden}.ys-sidebar .sidebar-profile .profile-details .role{font-size:.7rem;letter-spacing:1px}.ys-sidebar .sidebar-menu .menu-sub-items .nav-link{height:3em;line-height:3em;font-size:11px}.transition-icon{transition:transform .25s ease}.transition-icon.expanded{transform:rotate(90deg)}.menu-sub-items{max-height:0;overflow:hidden;transition:max-height .25s ease,opacity .25s ease,padding .25 ease;opacity:0;margin-left:.75rem;padding:0;border-left:3px solid var(--bs-border-color);background-color:rgba(var(--bs-secondary-rgb),.07);border-radius:.5rem}.menu-sub-items.expanded{max-height:500px;opacity:1;padding:.5rem}\n"] }]
|
|
119
120
|
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], profile: [{ type: i0.Input, args: [{ isSignal: true, alias: "profile", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], showClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClose", required: false }] }], closeStyleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeStyleClass", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], itemSelected: [{ type: i0.Output, args: ["itemSelected"] }] } });
|
|
120
121
|
|
|
121
122
|
/*
|