@ks-digital/designsystem-angular 0.0.1-alpha.75 → 0.0.1-alpha.76
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/.npmignore +25 -0
- package/fesm2022/ks-digital-designsystem-angular-__internals.mjs +148 -78
- package/fesm2022/ks-digital-designsystem-angular-__internals.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-alert.mjs +59 -33
- package/fesm2022/ks-digital-designsystem-angular-alert.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-breadcrumbs.mjs +79 -43
- package/fesm2022/ks-digital-designsystem-angular-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-button.mjs +187 -61
- package/fesm2022/ks-digital-designsystem-angular-button.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-card.mjs +136 -86
- package/fesm2022/ks-digital-designsystem-angular-card.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-chip.mjs +76 -42
- package/fesm2022/ks-digital-designsystem-angular-chip.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-details.mjs +148 -64
- package/fesm2022/ks-digital-designsystem-angular-details.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-dialog.mjs +106 -48
- package/fesm2022/ks-digital-designsystem-angular-dialog.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-dropdown.mjs +147 -45
- package/fesm2022/ks-digital-designsystem-angular-dropdown.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-error-summary.mjs +83 -48
- package/fesm2022/ks-digital-designsystem-angular-error-summary.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-forms.mjs +495 -210
- package/fesm2022/ks-digital-designsystem-angular-forms.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-heading.mjs +69 -39
- package/fesm2022/ks-digital-designsystem-angular-heading.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-link.mjs +59 -30
- package/fesm2022/ks-digital-designsystem-angular-link.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-pagination.mjs +324 -157
- package/fesm2022/ks-digital-designsystem-angular-pagination.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-paragraph.mjs +41 -24
- package/fesm2022/ks-digital-designsystem-angular-paragraph.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-popover.mjs +147 -45
- package/fesm2022/ks-digital-designsystem-angular-popover.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-search.mjs +266 -144
- package/fesm2022/ks-digital-designsystem-angular-search.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-skeleton.mjs +78 -34
- package/fesm2022/ks-digital-designsystem-angular-skeleton.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-spinner.mjs +132 -53
- package/fesm2022/ks-digital-designsystem-angular-spinner.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-suggestion.mjs +561 -297
- package/fesm2022/ks-digital-designsystem-angular-suggestion.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-table.mjs +219 -76
- package/fesm2022/ks-digital-designsystem-angular-table.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-tabs.mjs +269 -120
- package/fesm2022/ks-digital-designsystem-angular-tabs.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-tag.mjs +84 -37
- package/fesm2022/ks-digital-designsystem-angular-tag.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular-validation-message.mjs +42 -24
- package/fesm2022/ks-digital-designsystem-angular-validation-message.mjs.map +1 -1
- package/fesm2022/ks-digital-designsystem-angular.mjs +1 -6
- package/fesm2022/ks-digital-designsystem-angular.mjs.map +1 -1
- package/package.json +6 -5
- package/types/ks-digital-designsystem-angular-__internals.d.ts +51 -37
- package/types/ks-digital-designsystem-angular-alert.d.ts +18 -9
- package/types/ks-digital-designsystem-angular-breadcrumbs.d.ts +29 -13
- package/types/ks-digital-designsystem-angular-button.d.ts +67 -32
- package/types/ks-digital-designsystem-angular-card.d.ts +38 -23
- package/types/ks-digital-designsystem-angular-chip.d.ts +30 -15
- package/types/ks-digital-designsystem-angular-details.d.ts +32 -18
- package/types/ks-digital-designsystem-angular-dialog.d.ts +40 -18
- package/types/ks-digital-designsystem-angular-dropdown.d.ts +44 -13
- package/types/ks-digital-designsystem-angular-error-summary.d.ts +17 -14
- package/types/ks-digital-designsystem-angular-forms.d.ts +136 -71
- package/types/ks-digital-designsystem-angular-heading.d.ts +22 -19
- package/types/ks-digital-designsystem-angular-link.d.ts +18 -9
- package/types/ks-digital-designsystem-angular-pagination.d.ts +131 -75
- package/types/ks-digital-designsystem-angular-paragraph.d.ts +5 -8
- package/types/ks-digital-designsystem-angular-popover.d.ts +44 -13
- package/types/ks-digital-designsystem-angular-search.d.ts +62 -38
- package/types/ks-digital-designsystem-angular-skeleton.d.ts +18 -15
- package/types/ks-digital-designsystem-angular-spinner.d.ts +42 -23
- package/types/ks-digital-designsystem-angular-suggestion.d.ts +182 -116
- package/types/ks-digital-designsystem-angular-table.d.ts +67 -42
- package/types/ks-digital-designsystem-angular-tabs.d.ts +85 -56
- package/types/ks-digital-designsystem-angular-tag.d.ts +30 -15
- package/types/ks-digital-designsystem-angular-validation-message.d.ts +5 -8
- package/types/ks-digital-designsystem-angular.d.ts +2 -2
|
@@ -1,291 +1,456 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import * as i1 from
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Component, afterRenderEffect, booleanAttribute, computed, contentChild, contentChildren, effect, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
4
|
+
import "@digdir/designsystemet-web";
|
|
5
|
+
import * as i1 from "@ks-digital/designsystem-angular/__internals";
|
|
6
|
+
import { HostColor, HostSize } from "@ks-digital/designsystem-angular/__internals";
|
|
7
|
+
var SuggestionListEmpty = class SuggestionListEmpty {
|
|
8
|
+
templateRef = viewChild("tpl", ...ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []);
|
|
9
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
10
|
+
minVersion: "12.0.0",
|
|
11
|
+
version: "22.2.0",
|
|
12
|
+
ngImport: i0,
|
|
13
|
+
type: SuggestionListEmpty,
|
|
14
|
+
deps: [],
|
|
15
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
16
|
+
});
|
|
17
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
18
|
+
minVersion: "17.2.0",
|
|
19
|
+
version: "22.2.0",
|
|
20
|
+
type: SuggestionListEmpty,
|
|
21
|
+
isStandalone: true,
|
|
22
|
+
selector: "ksd-suggestion-list-empty",
|
|
23
|
+
viewQueries: [{
|
|
24
|
+
propertyName: "templateRef",
|
|
25
|
+
first: true,
|
|
26
|
+
predicate: ["tpl"],
|
|
27
|
+
descendants: true,
|
|
28
|
+
isSignal: true
|
|
29
|
+
}],
|
|
30
|
+
ngImport: i0,
|
|
31
|
+
template: ` <ng-template #tpl><ng-content /></ng-template> `,
|
|
32
|
+
isInline: true,
|
|
33
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
37
|
+
minVersion: "12.0.0",
|
|
38
|
+
version: "22.2.0",
|
|
39
|
+
ngImport: i0,
|
|
40
|
+
type: SuggestionListEmpty,
|
|
41
|
+
decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: "ksd-suggestion-list-empty",
|
|
45
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
46
|
+
template: ` <ng-template #tpl><ng-content /></ng-template> `
|
|
47
|
+
}]
|
|
48
|
+
}],
|
|
49
|
+
propDecorators: { templateRef: [{
|
|
50
|
+
type: i0.ViewChild,
|
|
51
|
+
args: ["tpl", { isSignal: true }]
|
|
52
|
+
}] }
|
|
53
|
+
});
|
|
54
|
+
var SuggestionListOption = class SuggestionListOption {
|
|
55
|
+
templateRef = viewChild("tpl", ...ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []);
|
|
56
|
+
value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
57
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
58
|
+
minVersion: "12.0.0",
|
|
59
|
+
version: "22.2.0",
|
|
60
|
+
ngImport: i0,
|
|
61
|
+
type: SuggestionListOption,
|
|
62
|
+
deps: [],
|
|
63
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
64
|
+
});
|
|
65
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
66
|
+
minVersion: "17.2.0",
|
|
67
|
+
version: "22.2.0",
|
|
68
|
+
type: SuggestionListOption,
|
|
69
|
+
isStandalone: true,
|
|
70
|
+
selector: "ksd-suggestion-list-option",
|
|
71
|
+
inputs: { value: {
|
|
72
|
+
classPropertyName: "value",
|
|
73
|
+
publicName: "value",
|
|
74
|
+
isSignal: true,
|
|
75
|
+
isRequired: true,
|
|
76
|
+
transformFunction: null
|
|
77
|
+
} },
|
|
78
|
+
viewQueries: [{
|
|
79
|
+
propertyName: "templateRef",
|
|
80
|
+
first: true,
|
|
81
|
+
predicate: ["tpl"],
|
|
82
|
+
descendants: true,
|
|
83
|
+
isSignal: true
|
|
84
|
+
}],
|
|
85
|
+
ngImport: i0,
|
|
86
|
+
template: ` <ng-template #tpl><ng-content /></ng-template> `,
|
|
87
|
+
isInline: true,
|
|
88
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
92
|
+
minVersion: "12.0.0",
|
|
93
|
+
version: "22.2.0",
|
|
94
|
+
ngImport: i0,
|
|
95
|
+
type: SuggestionListOption,
|
|
96
|
+
decorators: [{
|
|
97
|
+
type: Component,
|
|
98
|
+
args: [{
|
|
99
|
+
selector: "ksd-suggestion-list-option",
|
|
100
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
101
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
102
|
+
imports: [],
|
|
103
|
+
template: ` <ng-template #tpl><ng-content /></ng-template> `
|
|
104
|
+
}]
|
|
105
|
+
}],
|
|
106
|
+
propDecorators: {
|
|
107
|
+
templateRef: [{
|
|
108
|
+
type: i0.ViewChild,
|
|
109
|
+
args: ["tpl", { isSignal: true }]
|
|
110
|
+
}],
|
|
111
|
+
value: [{
|
|
112
|
+
type: i0.Input,
|
|
113
|
+
args: [{
|
|
114
|
+
isSignal: true,
|
|
115
|
+
alias: "value",
|
|
116
|
+
required: true
|
|
117
|
+
}]
|
|
118
|
+
}]
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
var SuggestionList = class SuggestionList {
|
|
122
|
+
singular = input("%d forslag", ...ngDevMode ? [{ debugName: "singular" }] : /* istanbul ignore next */ []);
|
|
123
|
+
plural = input("%d forslag", ...ngDevMode ? [{ debugName: "plural" }] : /* istanbul ignore next */ []);
|
|
124
|
+
options = contentChildren(SuggestionListOption, {
|
|
125
|
+
...ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {},
|
|
126
|
+
descendants: true
|
|
127
|
+
});
|
|
128
|
+
empty = contentChild(SuggestionListEmpty, ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
130
|
+
minVersion: "12.0.0",
|
|
131
|
+
version: "22.2.0",
|
|
132
|
+
ngImport: i0,
|
|
133
|
+
type: SuggestionList,
|
|
134
|
+
deps: [],
|
|
135
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
136
|
+
});
|
|
137
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
138
|
+
minVersion: "17.2.0",
|
|
139
|
+
version: "22.2.0",
|
|
140
|
+
type: SuggestionList,
|
|
141
|
+
isStandalone: true,
|
|
142
|
+
selector: "ksd-suggestion-list",
|
|
143
|
+
inputs: {
|
|
144
|
+
singular: {
|
|
145
|
+
classPropertyName: "singular",
|
|
146
|
+
publicName: "singular",
|
|
147
|
+
isSignal: true,
|
|
148
|
+
isRequired: false,
|
|
149
|
+
transformFunction: null
|
|
150
|
+
},
|
|
151
|
+
plural: {
|
|
152
|
+
classPropertyName: "plural",
|
|
153
|
+
publicName: "plural",
|
|
154
|
+
isSignal: true,
|
|
155
|
+
isRequired: false,
|
|
156
|
+
transformFunction: null
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
host: { styleAttribute: "display: none;" },
|
|
160
|
+
queries: [{
|
|
161
|
+
propertyName: "options",
|
|
162
|
+
predicate: SuggestionListOption,
|
|
163
|
+
descendants: true,
|
|
164
|
+
isSignal: true
|
|
165
|
+
}, {
|
|
166
|
+
propertyName: "empty",
|
|
167
|
+
first: true,
|
|
168
|
+
predicate: SuggestionListEmpty,
|
|
169
|
+
descendants: true,
|
|
170
|
+
isSignal: true
|
|
171
|
+
}],
|
|
172
|
+
ngImport: i0,
|
|
173
|
+
template: ``,
|
|
174
|
+
isInline: true,
|
|
175
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
179
|
+
minVersion: "12.0.0",
|
|
180
|
+
version: "22.2.0",
|
|
181
|
+
ngImport: i0,
|
|
182
|
+
type: SuggestionList,
|
|
183
|
+
decorators: [{
|
|
184
|
+
type: Component,
|
|
185
|
+
args: [{
|
|
186
|
+
selector: "ksd-suggestion-list",
|
|
187
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
188
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
189
|
+
host: { style: "display: none;" },
|
|
190
|
+
template: ``
|
|
191
|
+
}]
|
|
192
|
+
}],
|
|
193
|
+
propDecorators: {
|
|
194
|
+
singular: [{
|
|
195
|
+
type: i0.Input,
|
|
196
|
+
args: [{
|
|
197
|
+
isSignal: true,
|
|
198
|
+
alias: "singular",
|
|
199
|
+
required: false
|
|
200
|
+
}]
|
|
201
|
+
}],
|
|
202
|
+
plural: [{
|
|
203
|
+
type: i0.Input,
|
|
204
|
+
args: [{
|
|
205
|
+
isSignal: true,
|
|
206
|
+
alias: "plural",
|
|
207
|
+
required: false
|
|
208
|
+
}]
|
|
209
|
+
}],
|
|
210
|
+
options: [{
|
|
211
|
+
type: i0.ContentChildren,
|
|
212
|
+
args: [i0.forwardRef(() => SuggestionListOption), {
|
|
213
|
+
descendants: true,
|
|
214
|
+
isSignal: true
|
|
215
|
+
}]
|
|
216
|
+
}],
|
|
217
|
+
empty: [{
|
|
218
|
+
type: i0.ContentChild,
|
|
219
|
+
args: [i0.forwardRef(() => SuggestionListEmpty), { isSignal: true }]
|
|
220
|
+
}]
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
const isSuggestionItem = (value) => typeof value === "object" && value !== null && "label" in value && "value" in value;
|
|
84
224
|
const sanitizeValues = (values) => values == null ? [] : Array.isArray(values) ? values : [values];
|
|
85
225
|
const toValues = (value) => value == null ? [] : Array.isArray(value) ? value : [value];
|
|
86
|
-
|
|
87
|
-
const labelEntries = (values) => sanitizeValues(values)
|
|
88
|
-
.filter(isSuggestionItem)
|
|
89
|
-
.map((item) => [item.value, item.label]);
|
|
90
|
-
/** Normalizes anything accepted by `[selected]` into the primitive value model. */
|
|
226
|
+
const labelEntries = (values) => sanitizeValues(values).filter(isSuggestionItem).map((item) => [item.value, item.label]);
|
|
91
227
|
const toValue = (values) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return Array.isArray(values) ? primitives : primitives[0];
|
|
228
|
+
if (values == null) return void 0;
|
|
229
|
+
const primitives = sanitizeValues(values).map((value) => isSuggestionItem(value) ? value.value : value);
|
|
230
|
+
return Array.isArray(values) ? primitives : primitives[0];
|
|
96
231
|
};
|
|
97
232
|
const resolveItems = (value, labels) => toValues(value).map((optionValue) => ({
|
|
98
|
-
|
|
99
|
-
|
|
233
|
+
label: labels.get(optionValue) ?? optionValue,
|
|
234
|
+
value: optionValue
|
|
100
235
|
}));
|
|
101
|
-
/** Resolves a primitive value into items, using known labels where available. */
|
|
102
236
|
const toSelected = (value, labels) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return Array.isArray(value) ? items : items[0];
|
|
237
|
+
if (value == null) return void 0;
|
|
238
|
+
const items = resolveItems(value, labels);
|
|
239
|
+
return Array.isArray(value) ? items : items[0];
|
|
107
240
|
};
|
|
108
241
|
const sameValue = (left, right) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
left.every((value, index) => value === right[index]));
|
|
112
|
-
}
|
|
113
|
-
return left === right;
|
|
242
|
+
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
243
|
+
return left === right;
|
|
114
244
|
};
|
|
115
245
|
const nextSelected = (data, previous, multiple) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return data.isConnected
|
|
121
|
-
? previousValues.filter((previousValue) => previousValue !== value)
|
|
122
|
-
: [...previousValues, value];
|
|
246
|
+
const value = data.value;
|
|
247
|
+
if (!multiple) return data.isConnected ? void 0 : value;
|
|
248
|
+
const previousValues = toValues(previous);
|
|
249
|
+
return data.isConnected ? previousValues.filter((previousValue) => previousValue !== value) : [...previousValues, value];
|
|
123
250
|
};
|
|
124
|
-
|
|
125
251
|
const defaultFilter = ({ label, input }) => label.toLowerCase().includes(input.value.trim().toLowerCase());
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
252
|
+
const UNSET = Symbol("unset");
|
|
253
|
+
var Suggestion = class Suggestion {
|
|
254
|
+
multiple = input(false, {
|
|
255
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
256
|
+
transform: booleanAttribute
|
|
257
|
+
});
|
|
258
|
+
creatable = input(false, {
|
|
259
|
+
...ngDevMode ? { debugName: "creatable" } : /* istanbul ignore next */ {},
|
|
260
|
+
transform: booleanAttribute
|
|
261
|
+
});
|
|
262
|
+
filter = input(true, ...ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []);
|
|
263
|
+
value = model(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
264
|
+
selected = input(UNSET, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
265
|
+
selectedChange = output();
|
|
266
|
+
dirty = input(false, {
|
|
267
|
+
...ngDevMode ? { debugName: "dirty" } : /* istanbul ignore next */ {},
|
|
268
|
+
transform: booleanAttribute
|
|
269
|
+
});
|
|
270
|
+
touched = input(false, {
|
|
271
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
272
|
+
transform: booleanAttribute
|
|
273
|
+
});
|
|
274
|
+
touch = output();
|
|
275
|
+
selectedArray = computed(() => resolveItems(this.value(), this.labels()), ...ngDevMode ? [{ debugName: "selectedArray" }] : /* istanbul ignore next */ []);
|
|
276
|
+
suggestionElement = viewChild("suggestionElement", ...ngDevMode ? [{ debugName: "suggestionElement" }] : /* istanbul ignore next */ []);
|
|
277
|
+
labels = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
278
|
+
query = signal("", ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
|
|
279
|
+
suggestionList = contentChild(SuggestionList, ...ngDevMode ? [{ debugName: "suggestionList" }] : /* istanbul ignore next */ []);
|
|
280
|
+
constructor() {
|
|
281
|
+
afterRenderEffect(() => {
|
|
282
|
+
this.query();
|
|
283
|
+
this.filter();
|
|
284
|
+
this.suggestionList()?.options();
|
|
285
|
+
this.syncOptions();
|
|
286
|
+
});
|
|
287
|
+
effect(() => {
|
|
288
|
+
const selected = this.selected();
|
|
289
|
+
if (selected === UNSET) return;
|
|
290
|
+
untracked(() => this.learnLabels(labelEntries(selected)));
|
|
291
|
+
const next = toValue(selected);
|
|
292
|
+
if (sameValue(next, untracked(() => this.value()))) return;
|
|
293
|
+
untracked(() => this.value.set(next));
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
onSelect(event) {
|
|
297
|
+
const customEvent = event;
|
|
298
|
+
customEvent.preventDefault();
|
|
299
|
+
const data = customEvent.detail;
|
|
300
|
+
if (!data) return;
|
|
301
|
+
this.learnLabels([[data.value, data.textContent?.trim() || data.value]]);
|
|
302
|
+
this.setValue(nextSelected(data, this.value(), this.multiple()));
|
|
303
|
+
}
|
|
304
|
+
onFocusOut(event) {
|
|
305
|
+
const suggestionElement = this.suggestionElement()?.nativeElement;
|
|
306
|
+
const nextTarget = event.relatedTarget;
|
|
307
|
+
if (suggestionElement && nextTarget instanceof Node && suggestionElement.contains(nextTarget)) return;
|
|
308
|
+
this.touch.emit();
|
|
309
|
+
}
|
|
310
|
+
onInput(event) {
|
|
311
|
+
const inputElement = event.target;
|
|
312
|
+
this.query.set(inputElement?.value ?? "");
|
|
313
|
+
}
|
|
314
|
+
setValue(value) {
|
|
315
|
+
if (sameValue(value, this.value())) return;
|
|
316
|
+
this.value.set(value);
|
|
317
|
+
this.selectedChange.emit(toSelected(value, this.labels()));
|
|
318
|
+
}
|
|
319
|
+
learnLabels(entries) {
|
|
320
|
+
this.labels.update((current) => {
|
|
321
|
+
let next = null;
|
|
322
|
+
for (const [value, label] of entries) {
|
|
323
|
+
if (current.get(value) === label) continue;
|
|
324
|
+
next ??= new Map(current);
|
|
325
|
+
next.set(value, label);
|
|
326
|
+
}
|
|
327
|
+
return next ?? current;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
syncOptions() {
|
|
331
|
+
const suggestionElement = this.suggestionElement()?.nativeElement;
|
|
332
|
+
if (!suggestionElement) return;
|
|
333
|
+
const input = suggestionElement.querySelector("input");
|
|
334
|
+
const options = Array.from(suggestionElement.querySelectorAll("u-option:not([data-empty])"));
|
|
335
|
+
this.learnLabels(options.map((option) => [option.value, option.label || option.text || option.textContent?.trim() || option.value]));
|
|
336
|
+
const filter = this.filter();
|
|
337
|
+
const filterFn = filter === true ? defaultFilter : filter;
|
|
338
|
+
if (filterFn && input) {
|
|
339
|
+
let index = 0;
|
|
340
|
+
for (const option of options) {
|
|
341
|
+
option.disabled = !filterFn({
|
|
342
|
+
index,
|
|
343
|
+
input,
|
|
344
|
+
label: option.label,
|
|
345
|
+
optionElement: option,
|
|
346
|
+
text: option.text,
|
|
347
|
+
value: option.value
|
|
348
|
+
});
|
|
349
|
+
index++;
|
|
350
|
+
}
|
|
351
|
+
} else for (const option of options) option.disabled = false;
|
|
352
|
+
const visibleOptions = options.filter((option) => !option.disabled && !option.hidden);
|
|
353
|
+
const emptyOption = suggestionElement.querySelector("u-option[data-empty]");
|
|
354
|
+
if (!emptyOption) return;
|
|
355
|
+
if (visibleOptions.length === 0) {
|
|
356
|
+
emptyOption.removeAttribute("hidden");
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
emptyOption.setAttribute("hidden", "");
|
|
360
|
+
}
|
|
361
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
362
|
+
minVersion: "12.0.0",
|
|
363
|
+
version: "22.2.0",
|
|
364
|
+
ngImport: i0,
|
|
365
|
+
type: Suggestion,
|
|
366
|
+
deps: [],
|
|
367
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
368
|
+
});
|
|
369
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
370
|
+
minVersion: "17.0.0",
|
|
371
|
+
version: "22.2.0",
|
|
372
|
+
type: Suggestion,
|
|
373
|
+
isStandalone: true,
|
|
374
|
+
selector: "ksd-suggestion",
|
|
375
|
+
inputs: {
|
|
376
|
+
multiple: {
|
|
377
|
+
classPropertyName: "multiple",
|
|
378
|
+
publicName: "multiple",
|
|
379
|
+
isSignal: true,
|
|
380
|
+
isRequired: false,
|
|
381
|
+
transformFunction: null
|
|
382
|
+
},
|
|
383
|
+
creatable: {
|
|
384
|
+
classPropertyName: "creatable",
|
|
385
|
+
publicName: "creatable",
|
|
386
|
+
isSignal: true,
|
|
387
|
+
isRequired: false,
|
|
388
|
+
transformFunction: null
|
|
389
|
+
},
|
|
390
|
+
filter: {
|
|
391
|
+
classPropertyName: "filter",
|
|
392
|
+
publicName: "filter",
|
|
393
|
+
isSignal: true,
|
|
394
|
+
isRequired: false,
|
|
395
|
+
transformFunction: null
|
|
396
|
+
},
|
|
397
|
+
value: {
|
|
398
|
+
classPropertyName: "value",
|
|
399
|
+
publicName: "value",
|
|
400
|
+
isSignal: true,
|
|
401
|
+
isRequired: false,
|
|
402
|
+
transformFunction: null
|
|
403
|
+
},
|
|
404
|
+
selected: {
|
|
405
|
+
classPropertyName: "selected",
|
|
406
|
+
publicName: "selected",
|
|
407
|
+
isSignal: true,
|
|
408
|
+
isRequired: false,
|
|
409
|
+
transformFunction: null
|
|
410
|
+
},
|
|
411
|
+
dirty: {
|
|
412
|
+
classPropertyName: "dirty",
|
|
413
|
+
publicName: "dirty",
|
|
414
|
+
isSignal: true,
|
|
415
|
+
isRequired: false,
|
|
416
|
+
transformFunction: null
|
|
417
|
+
},
|
|
418
|
+
touched: {
|
|
419
|
+
classPropertyName: "touched",
|
|
420
|
+
publicName: "touched",
|
|
421
|
+
isSignal: true,
|
|
422
|
+
isRequired: false,
|
|
423
|
+
transformFunction: null
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
outputs: {
|
|
427
|
+
value: "valueChange",
|
|
428
|
+
selectedChange: "selectedChange",
|
|
429
|
+
touch: "touch"
|
|
430
|
+
},
|
|
431
|
+
queries: [{
|
|
432
|
+
propertyName: "suggestionList",
|
|
433
|
+
first: true,
|
|
434
|
+
predicate: SuggestionList,
|
|
435
|
+
descendants: true,
|
|
436
|
+
isSignal: true
|
|
437
|
+
}],
|
|
438
|
+
viewQueries: [{
|
|
439
|
+
propertyName: "suggestionElement",
|
|
440
|
+
first: true,
|
|
441
|
+
predicate: ["suggestionElement"],
|
|
442
|
+
descendants: true,
|
|
443
|
+
isSignal: true
|
|
444
|
+
}],
|
|
445
|
+
hostDirectives: [{
|
|
446
|
+
directive: i1.HostSize,
|
|
447
|
+
inputs: ["data-size", "data-size"]
|
|
448
|
+
}, {
|
|
449
|
+
directive: i1.HostColor,
|
|
450
|
+
inputs: ["data-color", "data-color"]
|
|
451
|
+
}],
|
|
452
|
+
ngImport: i0,
|
|
453
|
+
template: `
|
|
289
454
|
<ds-suggestion
|
|
290
455
|
#suggestionElement
|
|
291
456
|
class="ds-suggestion"
|
|
@@ -318,20 +483,42 @@ class Suggestion {
|
|
|
318
483
|
}
|
|
319
484
|
</u-datalist>
|
|
320
485
|
</ds-suggestion>
|
|
321
|
-
`,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
486
|
+
`,
|
|
487
|
+
isInline: true,
|
|
488
|
+
styles: [":host{display:block}\n"],
|
|
489
|
+
dependencies: [{
|
|
490
|
+
kind: "directive",
|
|
491
|
+
type: NgTemplateOutlet,
|
|
492
|
+
selector: "[ngTemplateOutlet]",
|
|
493
|
+
inputs: [
|
|
494
|
+
"ngTemplateOutletContext",
|
|
495
|
+
"ngTemplateOutlet",
|
|
496
|
+
"ngTemplateOutletInjector"
|
|
497
|
+
]
|
|
498
|
+
}],
|
|
499
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
503
|
+
minVersion: "12.0.0",
|
|
504
|
+
version: "22.2.0",
|
|
505
|
+
ngImport: i0,
|
|
506
|
+
type: Suggestion,
|
|
507
|
+
decorators: [{
|
|
508
|
+
type: Component,
|
|
509
|
+
args: [{
|
|
510
|
+
selector: "ksd-suggestion",
|
|
511
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
512
|
+
hostDirectives: [{
|
|
513
|
+
directive: HostSize,
|
|
514
|
+
inputs: ["data-size"]
|
|
515
|
+
}, {
|
|
516
|
+
directive: HostColor,
|
|
517
|
+
inputs: ["data-color"]
|
|
518
|
+
}],
|
|
519
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
520
|
+
imports: [NgTemplateOutlet],
|
|
521
|
+
template: `
|
|
335
522
|
<ds-suggestion
|
|
336
523
|
#suggestionElement
|
|
337
524
|
class="ds-suggestion"
|
|
@@ -364,12 +551,89 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
364
551
|
}
|
|
365
552
|
</u-datalist>
|
|
366
553
|
</ds-suggestion>
|
|
367
|
-
`,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
554
|
+
`,
|
|
555
|
+
styles: [":host{display:block}\n"]
|
|
556
|
+
}]
|
|
557
|
+
}],
|
|
558
|
+
ctorParameters: () => [],
|
|
559
|
+
propDecorators: {
|
|
560
|
+
multiple: [{
|
|
561
|
+
type: i0.Input,
|
|
562
|
+
args: [{
|
|
563
|
+
isSignal: true,
|
|
564
|
+
alias: "multiple",
|
|
565
|
+
required: false
|
|
566
|
+
}]
|
|
567
|
+
}],
|
|
568
|
+
creatable: [{
|
|
569
|
+
type: i0.Input,
|
|
570
|
+
args: [{
|
|
571
|
+
isSignal: true,
|
|
572
|
+
alias: "creatable",
|
|
573
|
+
required: false
|
|
574
|
+
}]
|
|
575
|
+
}],
|
|
576
|
+
filter: [{
|
|
577
|
+
type: i0.Input,
|
|
578
|
+
args: [{
|
|
579
|
+
isSignal: true,
|
|
580
|
+
alias: "filter",
|
|
581
|
+
required: false
|
|
582
|
+
}]
|
|
583
|
+
}],
|
|
584
|
+
value: [{
|
|
585
|
+
type: i0.Input,
|
|
586
|
+
args: [{
|
|
587
|
+
isSignal: true,
|
|
588
|
+
alias: "value",
|
|
589
|
+
required: false
|
|
590
|
+
}]
|
|
591
|
+
}, {
|
|
592
|
+
type: i0.Output,
|
|
593
|
+
args: ["valueChange"]
|
|
594
|
+
}],
|
|
595
|
+
selected: [{
|
|
596
|
+
type: i0.Input,
|
|
597
|
+
args: [{
|
|
598
|
+
isSignal: true,
|
|
599
|
+
alias: "selected",
|
|
600
|
+
required: false
|
|
601
|
+
}]
|
|
602
|
+
}],
|
|
603
|
+
selectedChange: [{
|
|
604
|
+
type: i0.Output,
|
|
605
|
+
args: ["selectedChange"]
|
|
606
|
+
}],
|
|
607
|
+
dirty: [{
|
|
608
|
+
type: i0.Input,
|
|
609
|
+
args: [{
|
|
610
|
+
isSignal: true,
|
|
611
|
+
alias: "dirty",
|
|
612
|
+
required: false
|
|
613
|
+
}]
|
|
614
|
+
}],
|
|
615
|
+
touched: [{
|
|
616
|
+
type: i0.Input,
|
|
617
|
+
args: [{
|
|
618
|
+
isSignal: true,
|
|
619
|
+
alias: "touched",
|
|
620
|
+
required: false
|
|
621
|
+
}]
|
|
622
|
+
}],
|
|
623
|
+
touch: [{
|
|
624
|
+
type: i0.Output,
|
|
625
|
+
args: ["touch"]
|
|
626
|
+
}],
|
|
627
|
+
suggestionElement: [{
|
|
628
|
+
type: i0.ViewChild,
|
|
629
|
+
args: ["suggestionElement", { isSignal: true }]
|
|
630
|
+
}],
|
|
631
|
+
suggestionList: [{
|
|
632
|
+
type: i0.ContentChild,
|
|
633
|
+
args: [i0.forwardRef(() => SuggestionList), { isSignal: true }]
|
|
634
|
+
}]
|
|
635
|
+
}
|
|
636
|
+
});
|
|
374
637
|
export { Suggestion, SuggestionList, SuggestionListEmpty, SuggestionListOption };
|
|
375
|
-
|
|
638
|
+
|
|
639
|
+
//# sourceMappingURL=ks-digital-designsystem-angular-suggestion.mjs.map
|