@uni-design-system/uni-angular 2.0.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,32 +1,2213 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { signal, computed, linkedSignal, resource, Injectable, inject, DestroyRef, InjectionToken, input, Component, HostBinding, Input, Renderer2, ElementRef, HostListener, Directive, EventEmitter, effect, Output, output, ViewChild, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { css, keyframes } from '@emotion/css';
|
|
4
|
+
import { UniThemes, LightTheme, Z_INDEX, fadeIn, fadeOut } from '@uni-design-system/uni-core';
|
|
5
|
+
import { NgClass, CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
6
|
+
import { autoUpdate, computePosition, offset, shift, flip, arrow } from '@floating-ui/dom';
|
|
7
|
+
|
|
8
|
+
class UniBaseDatasource {
|
|
9
|
+
selections = signal([], ...(ngDevMode ? [{ debugName: "selections" }] : /* istanbul ignore next */ []));
|
|
10
|
+
sort = signal({
|
|
11
|
+
column: undefined,
|
|
12
|
+
direction: 'indet',
|
|
13
|
+
}, ...(ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []));
|
|
14
|
+
sortColumn = computed(() => this.sort().column, ...(ngDevMode ? [{ debugName: "sortColumn" }] : /* istanbul ignore next */ []));
|
|
15
|
+
sortDirection = computed(() => this.sort().direction, ...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
|
|
16
|
+
pages = computed(() => Array.from({ length: this.pageCount() }, (_, index) => index + 1), ...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
|
|
17
|
+
startIndex = computed(() => {
|
|
18
|
+
const pageSize = this.pageSize();
|
|
19
|
+
const pageIndex = this.pageIndex();
|
|
20
|
+
return pageSize > 0 ? pageIndex * pageSize : 0;
|
|
21
|
+
}, ...(ngDevMode ? [{ debugName: "startIndex" }] : /* istanbul ignore next */ []));
|
|
22
|
+
endIndex = computed(() => {
|
|
23
|
+
const pageSize = this.pageSize();
|
|
24
|
+
const total = this.recordCount();
|
|
25
|
+
// If unpaginated (pageSize = 0), return total count
|
|
26
|
+
if (pageSize === 0) {
|
|
27
|
+
return total;
|
|
28
|
+
}
|
|
29
|
+
const start = this.startIndex();
|
|
30
|
+
return Math.min(start + pageSize, total);
|
|
31
|
+
}, ...(ngDevMode ? [{ debugName: "endIndex" }] : /* istanbul ignore next */ []));
|
|
32
|
+
disablePrevious = computed(() => {
|
|
33
|
+
const pageSize = this.pageSize();
|
|
34
|
+
return pageSize === 0 ? true : this.pageIndex() === 0;
|
|
35
|
+
}, ...(ngDevMode ? [{ debugName: "disablePrevious" }] : /* istanbul ignore next */ []));
|
|
36
|
+
disableNext = computed(() => {
|
|
37
|
+
const pageSize = this.pageSize();
|
|
38
|
+
return pageSize === 0 ? true : this.pageIndex() + 1 >= this.pageCount();
|
|
39
|
+
}, ...(ngDevMode ? [{ debugName: "disableNext" }] : /* istanbul ignore next */ []));
|
|
40
|
+
truncatedPages = computed(() => {
|
|
41
|
+
const currentPage = this.pageIndex() + 1;
|
|
42
|
+
const displayRange = 3;
|
|
43
|
+
const totalPages = this.pageCount();
|
|
44
|
+
const pages = [];
|
|
45
|
+
const startPage = Math.max(1, currentPage - displayRange);
|
|
46
|
+
const endPage = Math.min(totalPages, currentPage + displayRange);
|
|
47
|
+
if (startPage > 1) {
|
|
48
|
+
pages.push(1);
|
|
49
|
+
if (startPage > 2) {
|
|
50
|
+
pages.push('...');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
54
|
+
pages.push(i);
|
|
55
|
+
}
|
|
56
|
+
if (endPage < totalPages) {
|
|
57
|
+
if (endPage < totalPages - 1) {
|
|
58
|
+
pages.push('...');
|
|
59
|
+
}
|
|
60
|
+
pages.push(totalPages);
|
|
61
|
+
}
|
|
62
|
+
return pages;
|
|
63
|
+
}, ...(ngDevMode ? [{ debugName: "truncatedPages" }] : /* istanbul ignore next */ []));
|
|
64
|
+
isSelected(row) {
|
|
65
|
+
return this.selections().some((selection) => selection === row);
|
|
66
|
+
}
|
|
67
|
+
toggleSelection(row) {
|
|
68
|
+
this.selections.update((selections) => {
|
|
69
|
+
return selections.includes(row) ? selections.filter((i) => i !== row) : [...selections, row];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
clearSelections() {
|
|
73
|
+
this.selections.set([]);
|
|
74
|
+
}
|
|
75
|
+
selectAll() {
|
|
76
|
+
this.selections.set([...this.records()]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
class UniRecordDatasource extends UniBaseDatasource {
|
|
81
|
+
_pageNumber = signal(1, ...(ngDevMode ? [{ debugName: "_pageNumber" }] : /* istanbul ignore next */ []));
|
|
82
|
+
_pageSize = signal(0, ...(ngDevMode ? [{ debugName: "_pageSize" }] : /* istanbul ignore next */ [])); // 0 = unpaginated (show all)
|
|
83
|
+
initialRecords = signal([], ...(ngDevMode ? [{ debugName: "initialRecords" }] : /* istanbul ignore next */ []));
|
|
84
|
+
recordCount = computed(() => this.initialRecords().filter(this.filter()).length, ...(ngDevMode ? [{ debugName: "recordCount" }] : /* istanbul ignore next */ []));
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
86
|
+
filter = signal((value) => true, ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
87
|
+
pageIndex = signal(0, ...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
|
|
88
|
+
pageSize = computed(() => this._pageSize(), ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
89
|
+
pageCount = computed(() => {
|
|
90
|
+
const pageSize = this.pageSize();
|
|
91
|
+
return pageSize > 0 ? Math.ceil(this.recordCount() / pageSize) : 1;
|
|
92
|
+
}, ...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
|
|
93
|
+
records = computed(() => {
|
|
94
|
+
const { column, direction } = this.sort();
|
|
95
|
+
const filter = this.filter();
|
|
96
|
+
const pageSize = this.pageSize();
|
|
97
|
+
let filteredRecords = this.initialRecords().filter(filter);
|
|
98
|
+
// Apply sorting if specified
|
|
99
|
+
if (column && direction !== 'indet') {
|
|
100
|
+
filteredRecords = [...filteredRecords].sort((a, b) => {
|
|
101
|
+
const valueA = a[column];
|
|
102
|
+
const valueB = b[column];
|
|
103
|
+
const isString = typeof valueA === 'string';
|
|
104
|
+
const isAsc = direction === 'asc';
|
|
105
|
+
return isString
|
|
106
|
+
? stringCompare(valueA, valueB, isAsc)
|
|
107
|
+
: numberCompare(valueA, valueB, isAsc);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// Apply pagination only if pageSize > 0
|
|
111
|
+
if (pageSize > 0) {
|
|
112
|
+
return filteredRecords.slice(this.startIndex(), this.endIndex());
|
|
113
|
+
}
|
|
114
|
+
// Return all records (unpaginated)
|
|
115
|
+
return filteredRecords;
|
|
116
|
+
}, ...(ngDevMode ? [{ debugName: "records" }] : /* istanbul ignore next */ []));
|
|
117
|
+
constructor(data) {
|
|
118
|
+
super();
|
|
119
|
+
this.initialRecords.set(data);
|
|
120
|
+
}
|
|
121
|
+
sortRecords(sort) {
|
|
122
|
+
this.sort.set(sort);
|
|
123
|
+
}
|
|
124
|
+
firstPage() {
|
|
125
|
+
this.pageIndex.set(0);
|
|
126
|
+
}
|
|
127
|
+
nextPage() {
|
|
128
|
+
if (this.pageIndex() < this.pageCount() - 1) {
|
|
129
|
+
this.pageIndex.update((i) => i + 1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
previousPage() {
|
|
133
|
+
this.pageIndex.update((i) => (i > 1 ? i - 1 : 0));
|
|
134
|
+
}
|
|
135
|
+
lastPage() {
|
|
136
|
+
this.pageIndex.set(this.pageCount() - 1);
|
|
137
|
+
}
|
|
138
|
+
jumpToPage(page) {
|
|
139
|
+
const i = page - 1;
|
|
140
|
+
if (i >= 0 && i < this.pageCount()) {
|
|
141
|
+
this.pageIndex.set(i);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
setPageSize(size) {
|
|
145
|
+
this._pageSize.set(size);
|
|
146
|
+
if (size > 0) {
|
|
147
|
+
this._pageNumber.set(1);
|
|
148
|
+
this.pageIndex.set(0);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
setFilter(filter) {
|
|
152
|
+
this.filter.set(filter);
|
|
153
|
+
}
|
|
154
|
+
clearFilter() {
|
|
155
|
+
this.filter.set(() => true);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function stringCompare(a = 'zzz', b = 'zzz', isAsc) {
|
|
159
|
+
a = a.toString();
|
|
160
|
+
b = b.toString();
|
|
161
|
+
return isAsc
|
|
162
|
+
? a.localeCompare(b, undefined, { sensitivity: 'base' })
|
|
163
|
+
: b.localeCompare(a, undefined, { sensitivity: 'base' });
|
|
164
|
+
}
|
|
165
|
+
function numberCompare(a = 0, b = 0, isAsc) {
|
|
166
|
+
return isAsc ? a - b : b - a;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
class UniServerSideDatasource extends UniBaseDatasource {
|
|
170
|
+
dataLoader;
|
|
171
|
+
_pageNumber = signal(1, ...(ngDevMode ? [{ debugName: "_pageNumber" }] : /* istanbul ignore next */ []));
|
|
172
|
+
_pageSize = signal(10, ...(ngDevMode ? [{ debugName: "_pageSize" }] : /* istanbul ignore next */ []));
|
|
173
|
+
_sortColumn = signal(undefined, ...(ngDevMode ? [{ debugName: "_sortColumn" }] : /* istanbul ignore next */ []));
|
|
174
|
+
_sortDirection = signal('indet', ...(ngDevMode ? [{ debugName: "_sortDirection" }] : /* istanbul ignore next */ []));
|
|
175
|
+
filter = signal({}, ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
176
|
+
sortColumn = computed(() => this._sortColumn(), ...(ngDevMode ? [{ debugName: "sortColumn" }] : /* istanbul ignore next */ []));
|
|
177
|
+
sortDirection = computed(() => this._sortDirection(), ...(ngDevMode ? [{ debugName: "sortDirection" }] : /* istanbul ignore next */ []));
|
|
178
|
+
totalRecords = signal(0, ...(ngDevMode ? [{ debugName: "totalRecords" }] : /* istanbul ignore next */ []));
|
|
179
|
+
dataResource;
|
|
180
|
+
pageIndex = computed(() => this._pageNumber() - 1, ...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
|
|
181
|
+
pageSize = computed(() => this._pageSize(), ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
182
|
+
pageCount = computed(() => {
|
|
183
|
+
const total = this.totalRecords();
|
|
184
|
+
const size = this.pageSize();
|
|
185
|
+
return total > 0 ? Math.ceil(total / size) : 0;
|
|
186
|
+
}, ...(ngDevMode ? [{ debugName: "pageCount" }] : /* istanbul ignore next */ []));
|
|
187
|
+
_records = linkedSignal({ ...(ngDevMode ? { debugName: "_records" } : /* istanbul ignore next */ {}), source: () => ({
|
|
188
|
+
val: this.dataResource.value(),
|
|
189
|
+
status: this.dataResource.status(),
|
|
190
|
+
}),
|
|
191
|
+
computation: (source, previous) => {
|
|
192
|
+
if (source.status === 'loading' && previous) {
|
|
193
|
+
return previous.value;
|
|
194
|
+
}
|
|
195
|
+
return source.val?.data ?? [];
|
|
196
|
+
} });
|
|
197
|
+
records = this._records.asReadonly();
|
|
198
|
+
recordCount = computed(() => this.totalRecords(), ...(ngDevMode ? [{ debugName: "recordCount" }] : /* istanbul ignore next */ []));
|
|
199
|
+
isLoading = computed(() => this.dataResource.isLoading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
200
|
+
error = computed(() => this.dataResource.error(), ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
201
|
+
hasError = computed(() => this.dataResource.hasValue() === false && this.error() !== undefined, ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
202
|
+
constructor(dataLoader, initialPageSize = 10) {
|
|
203
|
+
super();
|
|
204
|
+
this.dataLoader = dataLoader;
|
|
205
|
+
this._pageSize.set(initialPageSize);
|
|
206
|
+
this.dataResource = resource({ ...(ngDevMode ? { debugName: "dataResource" } : /* istanbul ignore next */ {}), params: () => ({
|
|
207
|
+
pageNumber: this._pageNumber(),
|
|
208
|
+
pageSize: this._pageSize(),
|
|
209
|
+
sortColumn: this._sortColumn(),
|
|
210
|
+
sortDirection: this._sortDirection(),
|
|
211
|
+
filter: this.filter(),
|
|
212
|
+
}),
|
|
213
|
+
loader: async (params) => {
|
|
214
|
+
const request = params.params;
|
|
215
|
+
const response = await this.dataLoader(request);
|
|
216
|
+
if (request.pageNumber === 1 || this.totalRecords() === 0) {
|
|
217
|
+
this.totalRecords.set(response.totalRecords);
|
|
218
|
+
}
|
|
219
|
+
return response;
|
|
220
|
+
} });
|
|
221
|
+
}
|
|
222
|
+
sortRecords(sort) {
|
|
223
|
+
this.sort.set(sort);
|
|
224
|
+
this._sortColumn.set(sort.column);
|
|
225
|
+
this._sortDirection.set(sort.direction);
|
|
226
|
+
this._pageNumber.set(1);
|
|
227
|
+
}
|
|
228
|
+
firstPage() {
|
|
229
|
+
this._pageNumber.set(1);
|
|
230
|
+
}
|
|
231
|
+
nextPage() {
|
|
232
|
+
if (this._pageNumber() < this.pageCount()) {
|
|
233
|
+
this._pageNumber.update((n) => n + 1);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
previousPage() {
|
|
237
|
+
if (this._pageNumber() > 1) {
|
|
238
|
+
this._pageNumber.update((n) => n - 1);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
lastPage() {
|
|
242
|
+
this._pageNumber.set(this.pageCount());
|
|
243
|
+
}
|
|
244
|
+
jumpToPage(page) {
|
|
245
|
+
if (page >= 1 && page <= this.pageCount()) {
|
|
246
|
+
this._pageNumber.set(page);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
setPageSize(size) {
|
|
250
|
+
if (size > 0) {
|
|
251
|
+
this._pageSize.set(size);
|
|
252
|
+
this._pageNumber.set(1);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
setFilter(filterValues) {
|
|
256
|
+
this.filter.set(filterValues);
|
|
257
|
+
this._pageNumber.set(1);
|
|
258
|
+
}
|
|
259
|
+
clearFilter() {
|
|
260
|
+
this.filter.set({});
|
|
261
|
+
this._pageNumber.set(1);
|
|
262
|
+
}
|
|
263
|
+
refresh() {
|
|
264
|
+
this.dataResource.reload();
|
|
265
|
+
}
|
|
266
|
+
getPageRequest() {
|
|
267
|
+
return {
|
|
268
|
+
pageNumber: this._pageNumber(),
|
|
269
|
+
pageSize: this._pageSize(),
|
|
270
|
+
sortColumn: this._sortColumn(),
|
|
271
|
+
sortDirection: this._sortDirection(),
|
|
272
|
+
filter: this.filter(),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function memoize(fn) {
|
|
278
|
+
const cache = new Map();
|
|
279
|
+
return ((...args) => {
|
|
280
|
+
const key = JSON.stringify(args);
|
|
281
|
+
if (cache.has(key)) {
|
|
282
|
+
return cache.get(key);
|
|
283
|
+
}
|
|
284
|
+
const result = fn(...args);
|
|
285
|
+
cache.set(key, result);
|
|
286
|
+
return result;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
class LocalStorageService {
|
|
291
|
+
isLocalStorageAvailable = memoize(() => {
|
|
292
|
+
try {
|
|
293
|
+
const test = '__localStorage_test__';
|
|
294
|
+
localStorage.setItem(test, test);
|
|
295
|
+
localStorage.removeItem(test);
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
setItem(key, value) {
|
|
303
|
+
if (!this.isLocalStorageAvailable()) {
|
|
304
|
+
console.warn('LocalStorage is not available');
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
|
|
309
|
+
localStorage.setItem(key, stringValue);
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
console.error('Error saving to localStorage:', error);
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
getItem(key) {
|
|
318
|
+
if (!this.isLocalStorageAvailable()) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
const item = localStorage.getItem(key);
|
|
323
|
+
if (item === null) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
return JSON.parse(item);
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
return item;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
console.error('Error reading from localStorage:', error);
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
removeItem(key) {
|
|
339
|
+
if (!this.isLocalStorageAvailable()) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
try {
|
|
343
|
+
localStorage.removeItem(key);
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
console.error('Error removing from localStorage:', error);
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
clear() {
|
|
352
|
+
if (!this.isLocalStorageAvailable()) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
try {
|
|
356
|
+
localStorage.clear();
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
console.error('Error clearing localStorage:', error);
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
hasKey(key) {
|
|
365
|
+
if (!this.isLocalStorageAvailable()) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
return localStorage.getItem(key) !== null;
|
|
369
|
+
}
|
|
370
|
+
getAllKeys() {
|
|
371
|
+
if (!this.isLocalStorageAvailable()) {
|
|
372
|
+
return [];
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
return Object.keys(localStorage);
|
|
376
|
+
}
|
|
377
|
+
catch (error) {
|
|
378
|
+
console.error('Error getting localStorage keys:', error);
|
|
379
|
+
return [];
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
getSize() {
|
|
383
|
+
if (!this.isLocalStorageAvailable()) {
|
|
384
|
+
return 0;
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
let total = 0;
|
|
388
|
+
for (const key in localStorage) {
|
|
389
|
+
if (Object.prototype.hasOwnProperty.call(localStorage, key)) {
|
|
390
|
+
total += localStorage[key].length + key.length;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return total;
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
console.error('Error calculating localStorage size:', error);
|
|
397
|
+
return 0;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
401
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LocalStorageService, providedIn: 'root' });
|
|
402
|
+
}
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: LocalStorageService, decorators: [{
|
|
404
|
+
type: Injectable,
|
|
405
|
+
args: [{
|
|
406
|
+
providedIn: 'root',
|
|
407
|
+
}]
|
|
408
|
+
}] });
|
|
409
|
+
|
|
410
|
+
class NotificationService {
|
|
411
|
+
/* Alert */
|
|
412
|
+
alert = signal(undefined, ...(ngDevMode ? [{ debugName: "alert" }] : /* istanbul ignore next */ []));
|
|
413
|
+
showAlert = (alert) => this.alert.set(alert);
|
|
414
|
+
hideAlert = () => this.alert.set(undefined);
|
|
415
|
+
/* Snackbar */
|
|
416
|
+
snackbar = signal(undefined, ...(ngDevMode ? [{ debugName: "snackbar" }] : /* istanbul ignore next */ []));
|
|
417
|
+
showSnackbar = (snackbar) => this.snackbar.set(snackbar);
|
|
418
|
+
hideSnackbar = () => this.snackbar.set(undefined);
|
|
419
|
+
/* Confirmation */
|
|
420
|
+
confirmation = signal(undefined, ...(ngDevMode ? [{ debugName: "confirmation" }] : /* istanbul ignore next */ []));
|
|
421
|
+
showConfirmation = (confirmation) => this.confirmation.set(confirmation);
|
|
422
|
+
hideConfirmation = () => this.confirmation.set(undefined);
|
|
423
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
424
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: NotificationService, providedIn: 'root' });
|
|
425
|
+
}
|
|
426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: NotificationService, decorators: [{
|
|
427
|
+
type: Injectable,
|
|
428
|
+
args: [{
|
|
429
|
+
providedIn: 'root',
|
|
430
|
+
}]
|
|
431
|
+
}] });
|
|
432
|
+
|
|
433
|
+
function useTimer() {
|
|
434
|
+
const destroyRef = inject(DestroyRef);
|
|
435
|
+
const msRemaining = signal(0, ...(ngDevMode ? [{ debugName: "msRemaining" }] : /* istanbul ignore next */ []));
|
|
436
|
+
const isPaused = signal(false, ...(ngDevMode ? [{ debugName: "isPaused" }] : /* istanbul ignore next */ []));
|
|
437
|
+
const isActive = computed(() => msRemaining() > 0, ...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
438
|
+
let intervalId = null;
|
|
439
|
+
let endTime = 0;
|
|
440
|
+
let onCompleteCallback;
|
|
441
|
+
const stop = () => {
|
|
442
|
+
if (intervalId)
|
|
443
|
+
clearInterval(intervalId);
|
|
444
|
+
intervalId = null;
|
|
445
|
+
};
|
|
446
|
+
const tick = () => {
|
|
447
|
+
const remaining = Math.max(0, endTime - Date.now());
|
|
448
|
+
msRemaining.set(remaining);
|
|
449
|
+
if (remaining <= 0) {
|
|
450
|
+
stop();
|
|
451
|
+
if (onCompleteCallback)
|
|
452
|
+
onCompleteCallback();
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const start = (durationMs, onComplete) => {
|
|
456
|
+
stop();
|
|
457
|
+
onCompleteCallback = onComplete;
|
|
458
|
+
isPaused.set(false);
|
|
459
|
+
msRemaining.set(durationMs);
|
|
460
|
+
endTime = Date.now() + durationMs;
|
|
461
|
+
intervalId = setInterval(tick, 100);
|
|
462
|
+
};
|
|
463
|
+
const pause = () => {
|
|
464
|
+
if (!isActive() || isPaused())
|
|
465
|
+
return;
|
|
466
|
+
stop();
|
|
467
|
+
isPaused.set(true);
|
|
468
|
+
};
|
|
469
|
+
const resume = () => {
|
|
470
|
+
if (!isActive() || !isPaused())
|
|
471
|
+
return;
|
|
472
|
+
isPaused.set(false);
|
|
473
|
+
endTime = Date.now() + msRemaining();
|
|
474
|
+
intervalId = setInterval(tick, 100);
|
|
475
|
+
};
|
|
476
|
+
destroyRef.onDestroy(() => stop());
|
|
477
|
+
return {
|
|
478
|
+
start,
|
|
479
|
+
pause,
|
|
480
|
+
resume,
|
|
481
|
+
stop: () => {
|
|
482
|
+
stop();
|
|
483
|
+
msRemaining.set(0);
|
|
484
|
+
},
|
|
485
|
+
msRemaining,
|
|
486
|
+
isPaused,
|
|
487
|
+
isActive,
|
|
488
|
+
secondsRemaining: computed(() => Math.ceil(msRemaining() / 1000)),
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
const UNI_THEMES = new InjectionToken('', {
|
|
493
|
+
providedIn: 'root',
|
|
494
|
+
factory: () => UniThemes,
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
const safeParseInt = (n) => typeof n === 'number' ? n : parseInt(n);
|
|
498
|
+
|
|
499
|
+
// noinspection JSUnusedGlobalSymbols
|
|
500
|
+
class ThemeService {
|
|
501
|
+
themes = inject(UNI_THEMES);
|
|
502
|
+
localStorage = inject(LocalStorageService);
|
|
503
|
+
theme = signal(LightTheme, ...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
504
|
+
themeOptions = signal([], ...(ngDevMode ? [{ debugName: "themeOptions" }] : /* istanbul ignore next */ []));
|
|
505
|
+
components = computed(() => this.theme().components, ...(ngDevMode ? [{ debugName: "components" }] : /* istanbul ignore next */ []));
|
|
506
|
+
component = (componentName) => computed(() => this.components()[componentName] || {});
|
|
507
|
+
colors = computed(() => this.theme().colors, ...(ngDevMode ? [{ debugName: "colors" }] : /* istanbul ignore next */ []));
|
|
508
|
+
typeFaces = computed(() => this.theme().typefaces, ...(ngDevMode ? [{ debugName: "typeFaces" }] : /* istanbul ignore next */ []));
|
|
509
|
+
spacing = computed(() => this.theme().spacing, ...(ngDevMode ? [{ debugName: "spacing" }] : /* istanbul ignore next */ []));
|
|
510
|
+
thicknesses = computed(() => this.theme().thicknesses, ...(ngDevMode ? [{ debugName: "thicknesses" }] : /* istanbul ignore next */ []));
|
|
511
|
+
radii = computed(() => this.theme().radii, ...(ngDevMode ? [{ debugName: "radii" }] : /* istanbul ignore next */ []));
|
|
512
|
+
borders = computed(() => this.theme().borders, ...(ngDevMode ? [{ debugName: "borders" }] : /* istanbul ignore next */ []));
|
|
513
|
+
shadows = computed(() => this.theme().shadows, ...(ngDevMode ? [{ debugName: "shadows" }] : /* istanbul ignore next */ []));
|
|
514
|
+
icons = computed(() => this.theme().icons, ...(ngDevMode ? [{ debugName: "icons" }] : /* istanbul ignore next */ []));
|
|
515
|
+
constructor() {
|
|
516
|
+
this.themeOptions.set(Object.keys(this.themes).map((key) => {
|
|
517
|
+
return { label: this.themes[key].name, value: key };
|
|
518
|
+
}));
|
|
519
|
+
this.selectTheme(this.localStorage.getItem('theme') || Object.keys(this.themes)[0] || 'base');
|
|
520
|
+
}
|
|
521
|
+
selectTheme(themeName) {
|
|
522
|
+
this.selectedThemeKey.set(themeName);
|
|
523
|
+
if (this.themes[themeName])
|
|
524
|
+
this.theme.set(this.themes[themeName]);
|
|
525
|
+
this.localStorage.setItem('theme', themeName);
|
|
526
|
+
}
|
|
527
|
+
selectedThemeName = computed(() => this.theme().name, ...(ngDevMode ? [{ debugName: "selectedThemeName" }] : /* istanbul ignore next */ []));
|
|
528
|
+
selectedThemeKey = signal('', ...(ngDevMode ? [{ debugName: "selectedThemeKey" }] : /* istanbul ignore next */ []));
|
|
529
|
+
textClass = (textRole, textColor) => {
|
|
530
|
+
return css([
|
|
531
|
+
{
|
|
532
|
+
...this.typeFaces()[textRole],
|
|
533
|
+
},
|
|
534
|
+
textColor && {
|
|
535
|
+
color: this.colors()[textColor],
|
|
536
|
+
},
|
|
537
|
+
]);
|
|
538
|
+
};
|
|
539
|
+
componentStyle = (componentName, variant, size) => computed(() => {
|
|
540
|
+
const component = this.component(componentName)();
|
|
541
|
+
const { fixed, colors, sizes } = component;
|
|
542
|
+
const colorStyle = colors && colors[variant];
|
|
543
|
+
const sizeStyle = sizes && sizes[size];
|
|
544
|
+
return { ...fixed, ...colorStyle, ...sizeStyle };
|
|
545
|
+
});
|
|
546
|
+
getSpacing = (size) => {
|
|
547
|
+
return size === 'none' ? 'none' : this.spacing()[size];
|
|
548
|
+
};
|
|
549
|
+
getThickness = (thickness) => this.theme().thicknesses[thickness];
|
|
550
|
+
getContentColor = (token, useVariant) => useVariant
|
|
551
|
+
? this.colors()[`on-${token}-variant`]
|
|
552
|
+
: this.colors()[`on-${token}`];
|
|
553
|
+
colorPair = (token, colorVariant) => {
|
|
554
|
+
if (!token)
|
|
555
|
+
return;
|
|
556
|
+
const backgroundColor = this.colors()[token];
|
|
557
|
+
const color = this.getContentColor(token, colorVariant);
|
|
558
|
+
return { color, backgroundColor };
|
|
559
|
+
};
|
|
560
|
+
backgroundColor = (token) => {
|
|
561
|
+
return !token ? undefined : { backgroundColor: this.colors()[token] };
|
|
562
|
+
};
|
|
563
|
+
backgroundImage = (url) => {
|
|
564
|
+
return !url ? undefined : { backgroundImage: `url(${url})` };
|
|
565
|
+
};
|
|
566
|
+
getContainerColors = (color, useVariant) => {
|
|
567
|
+
const token = (color + '-container');
|
|
568
|
+
return this.colorPair(token, useVariant);
|
|
569
|
+
};
|
|
570
|
+
typeface = (typeface) => typeface && this.typeFaces()[typeface];
|
|
571
|
+
colorPalette = () => this.colors();
|
|
572
|
+
color(color) {
|
|
573
|
+
return !color ? undefined : { color: this.colors()[color] };
|
|
574
|
+
}
|
|
575
|
+
getDashedBorder(color, radius) {
|
|
576
|
+
if (!color)
|
|
577
|
+
return;
|
|
578
|
+
const r = radius && this.radii()[radius];
|
|
579
|
+
const borderRadius = r ? safeParseInt(r) : 0;
|
|
580
|
+
const colors = this.colors()[color];
|
|
581
|
+
const strokeColor = colors?.replace('#', '%23');
|
|
582
|
+
return {
|
|
583
|
+
backgroundImage: `url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='${borderRadius}' ry='${borderRadius}' stroke='${strokeColor}' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e")`,
|
|
584
|
+
borderRadius,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
radius(size) {
|
|
588
|
+
return !size ? undefined : { borderRadius: this.radii()[size] };
|
|
589
|
+
}
|
|
590
|
+
getRadiusLeft(size) {
|
|
591
|
+
if (!size)
|
|
592
|
+
return;
|
|
593
|
+
return {
|
|
594
|
+
borderBottomLeftRadius: this.radii()[size],
|
|
595
|
+
borderTopLeftRadius: this.radii()[size],
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
getRadiusRight(size) {
|
|
599
|
+
if (!size)
|
|
600
|
+
return;
|
|
601
|
+
return {
|
|
602
|
+
borderBottomRightRadius: this.radii()[size],
|
|
603
|
+
borderTopRightRadius: this.radii()[size],
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
getRadiusTop(size) {
|
|
607
|
+
if (!size)
|
|
608
|
+
return;
|
|
609
|
+
return {
|
|
610
|
+
borderTopLeftRadius: this.radii()[size],
|
|
611
|
+
borderTopRightRadius: this.radii()[size],
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
getRadiusBottom(size) {
|
|
615
|
+
if (!size)
|
|
616
|
+
return;
|
|
617
|
+
return {
|
|
618
|
+
borderBottomLeftRadius: this.radii()[size],
|
|
619
|
+
borderBottomRightRadius: this.radii()[size],
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
padding(size) {
|
|
623
|
+
return !size ? undefined : { padding: this.spacing()[size] };
|
|
624
|
+
}
|
|
625
|
+
horizontalPadding(size) {
|
|
626
|
+
return !size ? undefined : { paddingInline: this.spacing()[size] };
|
|
627
|
+
}
|
|
628
|
+
verticalPadding(size) {
|
|
629
|
+
return !size ? undefined : { paddingBlock: this.spacing()[size] };
|
|
630
|
+
}
|
|
631
|
+
paddingLeft(size) {
|
|
632
|
+
return !size ? undefined : { paddingLeft: this.spacing()[size] };
|
|
633
|
+
}
|
|
634
|
+
paddingRight(size) {
|
|
635
|
+
return !size ? undefined : { paddingRight: this.spacing()[size] };
|
|
636
|
+
}
|
|
637
|
+
paddingTop(size) {
|
|
638
|
+
return !size ? undefined : { paddingTop: this.spacing()[size] };
|
|
639
|
+
}
|
|
640
|
+
paddingBottom(size) {
|
|
641
|
+
return !size ? undefined : { paddingBottom: this.spacing()[size] };
|
|
642
|
+
}
|
|
643
|
+
border(border) {
|
|
644
|
+
return !border ? undefined : { border: this.borders()[border] };
|
|
645
|
+
}
|
|
646
|
+
borderTop(border) {
|
|
647
|
+
return !border ? undefined : { borderTop: this.borders()[border] };
|
|
648
|
+
}
|
|
649
|
+
borderBottom(border) {
|
|
650
|
+
return !border ? undefined : { borderBottom: this.borders()[border] };
|
|
651
|
+
}
|
|
652
|
+
borderLeft(border) {
|
|
653
|
+
return !border ? undefined : { borderLeft: this.borders()[border] };
|
|
654
|
+
}
|
|
655
|
+
borderRight(border) {
|
|
656
|
+
return !border ? undefined : { borderRight: this.borders()[border] };
|
|
657
|
+
}
|
|
658
|
+
boxShadow(shadow) {
|
|
659
|
+
return !shadow ? undefined : { boxShadow: this.shadows()[shadow] };
|
|
660
|
+
}
|
|
661
|
+
gap(gap) {
|
|
662
|
+
return !gap || gap === 'none' ? undefined : { gap: this.spacing()[gap] };
|
|
663
|
+
}
|
|
664
|
+
zIndex(element) {
|
|
665
|
+
return !element ? undefined : { zIndex: Z_INDEX[element] };
|
|
666
|
+
}
|
|
667
|
+
borderColor(borderColor) {
|
|
668
|
+
return { borderColor: this.colors()[borderColor] };
|
|
669
|
+
}
|
|
670
|
+
getComponentTheme(componentName) {
|
|
671
|
+
return this.component(componentName);
|
|
672
|
+
}
|
|
673
|
+
// Used to get an "always-defined" options object from a component theme.
|
|
674
|
+
getComponentOptions = (componentName) => linkedSignal({
|
|
675
|
+
source: this.getComponentTheme(componentName),
|
|
676
|
+
computation: () => {
|
|
677
|
+
return this.getComponentTheme(componentName)().options || {};
|
|
678
|
+
},
|
|
679
|
+
});
|
|
680
|
+
componentOptions = (componentName) => computed(() => this.component(componentName)().options || {});
|
|
681
|
+
style(prop, value) {
|
|
682
|
+
return !value ? undefined : { [prop]: value };
|
|
683
|
+
}
|
|
684
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
685
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
686
|
+
}
|
|
687
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: ThemeService, decorators: [{
|
|
688
|
+
type: Injectable,
|
|
689
|
+
args: [{
|
|
690
|
+
providedIn: 'root',
|
|
691
|
+
}]
|
|
692
|
+
}], ctorParameters: () => [] });
|
|
693
|
+
|
|
694
|
+
const COMPONENT_NAME = new InjectionToken('');
|
|
695
|
+
class BaseComponent {
|
|
696
|
+
componentName = inject(COMPONENT_NAME);
|
|
697
|
+
theme = inject(ThemeService);
|
|
698
|
+
variant = input('primary', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ [])); // TODO: Make Variant support undefined
|
|
699
|
+
size = input('lg', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
700
|
+
componentTheme = computed(() => this.theme.getComponentTheme(this.componentName)(), ...(ngDevMode ? [{ debugName: "componentTheme" }] : /* istanbul ignore next */ []));
|
|
701
|
+
componentOptions = computed(() => this.theme.getComponentOptions(this.componentName)(), ...(ngDevMode ? [{ debugName: "componentOptions" }] : /* istanbul ignore next */ []));
|
|
702
|
+
style = computed(() => this.theme.componentStyle(this.componentName, this.variant(), this.size())(), ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
703
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
704
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: BaseComponent, isStandalone: true, selector: "ng-component", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true });
|
|
705
|
+
}
|
|
706
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: BaseComponent, decorators: [{
|
|
707
|
+
type: Component,
|
|
708
|
+
args: [{
|
|
709
|
+
standalone: true,
|
|
710
|
+
imports: [],
|
|
711
|
+
template: ``,
|
|
712
|
+
}]
|
|
713
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
714
|
+
|
|
715
|
+
class UniBadgeComponent extends BaseComponent {
|
|
716
|
+
color = input(undefined, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
717
|
+
useVariant = input(false, ...(ngDevMode ? [{ debugName: "useVariant" }] : /* istanbul ignore next */ []));
|
|
718
|
+
width;
|
|
719
|
+
get className() {
|
|
720
|
+
const color = this.color();
|
|
721
|
+
return css([
|
|
722
|
+
{
|
|
723
|
+
...this.theme.getContainerColors(color || 'primary', this.useVariant()),
|
|
724
|
+
...this.theme.typeface('badge'),
|
|
725
|
+
display: 'inline-block',
|
|
726
|
+
padding: '0 16px',
|
|
727
|
+
...this.theme.radius(this.componentOptions().borderRadius),
|
|
728
|
+
textAlign: 'center',
|
|
729
|
+
letterSpacing: 1,
|
|
730
|
+
},
|
|
731
|
+
this.width && {
|
|
732
|
+
minWidth: this.width - 32,
|
|
733
|
+
},
|
|
734
|
+
]);
|
|
735
|
+
}
|
|
736
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniBadgeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
737
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniBadgeComponent, isStandalone: true, selector: "div[uni-badge], Badge", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, useVariant: { classPropertyName: "useVariant", publicName: "useVariant", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: false, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, providers: [{ provide: COMPONENT_NAME, useValue: 'badge' }], usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
738
|
+
}
|
|
739
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniBadgeComponent, decorators: [{
|
|
740
|
+
type: Component,
|
|
741
|
+
args: [{
|
|
742
|
+
selector: 'div[uni-badge], Badge',
|
|
743
|
+
standalone: true,
|
|
744
|
+
imports: [],
|
|
745
|
+
template: `<ng-content></ng-content>`,
|
|
746
|
+
providers: [{ provide: COMPONENT_NAME, useValue: 'badge' }],
|
|
747
|
+
}]
|
|
748
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], useVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "useVariant", required: false }] }], width: [{
|
|
749
|
+
type: Input
|
|
750
|
+
}], className: [{
|
|
751
|
+
type: HostBinding,
|
|
752
|
+
args: ['class']
|
|
753
|
+
}] } });
|
|
754
|
+
|
|
755
|
+
class UniIconComponent {
|
|
756
|
+
themeService = inject(ThemeService);
|
|
757
|
+
color = input(...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
|
|
758
|
+
_path;
|
|
759
|
+
get className() {
|
|
760
|
+
return css([{ ...this.themeService.color(this.color()) }]);
|
|
761
|
+
}
|
|
762
|
+
set name(iconName) {
|
|
763
|
+
const theme = this.themeService.theme();
|
|
764
|
+
this._path = `url("${theme.icons[iconName]}")`;
|
|
765
|
+
}
|
|
766
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
767
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniIconComponent, isStandalone: true, selector: "uni-icon, Icon", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null } }, host: { properties: { "style.-webkit-mask-image": "this._path", "class": "this.className" } }, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;height:100%;width:100%;background-color:currentColor;-webkit-mask-size:contain;-webkit-mask-position:center;-webkit-mask-repeat:no-repeat}\n"] });
|
|
768
|
+
}
|
|
769
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniIconComponent, decorators: [{
|
|
770
|
+
type: Component,
|
|
771
|
+
args: [{ selector: 'uni-icon, Icon', standalone: true, imports: [], template: '', styles: [":host{display:block;height:100%;width:100%;background-color:currentColor;-webkit-mask-size:contain;-webkit-mask-position:center;-webkit-mask-repeat:no-repeat}\n"] }]
|
|
772
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], _path: [{
|
|
773
|
+
type: HostBinding,
|
|
774
|
+
args: ['style.-webkit-mask-image']
|
|
775
|
+
}], className: [{
|
|
776
|
+
type: HostBinding,
|
|
777
|
+
args: ['class']
|
|
778
|
+
}], name: [{
|
|
779
|
+
type: Input
|
|
780
|
+
}] } });
|
|
781
|
+
|
|
782
|
+
class UniBoxComponent {
|
|
783
|
+
theme = inject(ThemeService);
|
|
784
|
+
color = input(...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
|
|
785
|
+
backgroundColor = input(...(ngDevMode ? [undefined, { debugName: "backgroundColor" }] : /* istanbul ignore next */ []));
|
|
786
|
+
borderRadius = input(...(ngDevMode ? [undefined, { debugName: "borderRadius" }] : /* istanbul ignore next */ []));
|
|
787
|
+
borderRadiusLeft = input(...(ngDevMode ? [undefined, { debugName: "borderRadiusLeft" }] : /* istanbul ignore next */ []));
|
|
788
|
+
borderRadiusRight = input(...(ngDevMode ? [undefined, { debugName: "borderRadiusRight" }] : /* istanbul ignore next */ []));
|
|
789
|
+
borderRadiusTop = input(...(ngDevMode ? [undefined, { debugName: "borderRadiusTop" }] : /* istanbul ignore next */ []));
|
|
790
|
+
borderRadiusBottom = input(...(ngDevMode ? [undefined, { debugName: "borderRadiusBottom" }] : /* istanbul ignore next */ []));
|
|
791
|
+
padding = input(...(ngDevMode ? [undefined, { debugName: "padding" }] : /* istanbul ignore next */ []));
|
|
792
|
+
paddingHorizontal = input(...(ngDevMode ? [undefined, { debugName: "paddingHorizontal" }] : /* istanbul ignore next */ []));
|
|
793
|
+
paddingVertical = input(...(ngDevMode ? [undefined, { debugName: "paddingVertical" }] : /* istanbul ignore next */ []));
|
|
794
|
+
paddingLeft = input(...(ngDevMode ? [undefined, { debugName: "paddingLeft" }] : /* istanbul ignore next */ []));
|
|
795
|
+
paddingRight = input(...(ngDevMode ? [undefined, { debugName: "paddingRight" }] : /* istanbul ignore next */ []));
|
|
796
|
+
paddingTop = input(...(ngDevMode ? [undefined, { debugName: "paddingTop" }] : /* istanbul ignore next */ []));
|
|
797
|
+
paddingBottom = input(...(ngDevMode ? [undefined, { debugName: "paddingBottom" }] : /* istanbul ignore next */ []));
|
|
798
|
+
border = input(...(ngDevMode ? [undefined, { debugName: "border" }] : /* istanbul ignore next */ []));
|
|
799
|
+
borderTop = input(...(ngDevMode ? [undefined, { debugName: "borderTop" }] : /* istanbul ignore next */ []));
|
|
800
|
+
borderBottom = input(...(ngDevMode ? [undefined, { debugName: "borderBottom" }] : /* istanbul ignore next */ []));
|
|
801
|
+
borderLeft = input(...(ngDevMode ? [undefined, { debugName: "borderLeft" }] : /* istanbul ignore next */ []));
|
|
802
|
+
borderRight = input(...(ngDevMode ? [undefined, { debugName: "borderRight" }] : /* istanbul ignore next */ []));
|
|
803
|
+
dashBorder = input(false, ...(ngDevMode ? [{ debugName: "dashBorder" }] : /* istanbul ignore next */ []));
|
|
804
|
+
alignSelf = input(...(ngDevMode ? [undefined, { debugName: "alignSelf" }] : /* istanbul ignore next */ []));
|
|
805
|
+
alignItems = input(...(ngDevMode ? [undefined, { debugName: "alignItems" }] : /* istanbul ignore next */ []));
|
|
806
|
+
alignContent = input(...(ngDevMode ? [undefined, { debugName: "alignContent" }] : /* istanbul ignore next */ []));
|
|
807
|
+
justifyContent = input(...(ngDevMode ? [undefined, { debugName: "justifyContent" }] : /* istanbul ignore next */ []));
|
|
808
|
+
grow = input(...(ngDevMode ? [undefined, { debugName: "grow" }] : /* istanbul ignore next */ []));
|
|
809
|
+
display = input(...(ngDevMode ? [undefined, { debugName: "display" }] : /* istanbul ignore next */ []));
|
|
810
|
+
position = input(...(ngDevMode ? [undefined, { debugName: "position" }] : /* istanbul ignore next */ []));
|
|
811
|
+
inset = input(...(ngDevMode ? [undefined, { debugName: "inset" }] : /* istanbul ignore next */ []));
|
|
812
|
+
height = input(...(ngDevMode ? [undefined, { debugName: "height" }] : /* istanbul ignore next */ []));
|
|
813
|
+
minHeight = input(...(ngDevMode ? [undefined, { debugName: "minHeight" }] : /* istanbul ignore next */ []));
|
|
814
|
+
maxHeight = input(...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : /* istanbul ignore next */ []));
|
|
815
|
+
width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
|
|
816
|
+
minWidth = input(...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
817
|
+
maxWidth = input(...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
818
|
+
ignoreDir = input(true, ...(ngDevMode ? [{ debugName: "ignoreDir" }] : /* istanbul ignore next */ []));
|
|
819
|
+
gridArea = input(...(ngDevMode ? [undefined, { debugName: "gridArea" }] : /* istanbul ignore next */ []));
|
|
820
|
+
gridColumn = input(...(ngDevMode ? [undefined, { debugName: "gridColumn" }] : /* istanbul ignore next */ []));
|
|
821
|
+
gridRow = input(...(ngDevMode ? [undefined, { debugName: "gridRow" }] : /* istanbul ignore next */ []));
|
|
822
|
+
overflow = input(...(ngDevMode ? [undefined, { debugName: "overflow" }] : /* istanbul ignore next */ []));
|
|
823
|
+
elevation = input(...(ngDevMode ? [undefined, { debugName: "elevation" }] : /* istanbul ignore next */ [])); // Deprecated, use shadow instead
|
|
824
|
+
shadow = input(...(ngDevMode ? [undefined, { debugName: "shadow" }] : /* istanbul ignore next */ []));
|
|
825
|
+
gap = input(...(ngDevMode ? [undefined, { debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
826
|
+
fullWidth = input(...(ngDevMode ? [undefined, { debugName: "fullWidth" }] : /* istanbul ignore next */ []));
|
|
827
|
+
fullHeight = input(...(ngDevMode ? [undefined, { debugName: "fullHeight" }] : /* istanbul ignore next */ []));
|
|
828
|
+
flexDirection = input(...(ngDevMode ? [undefined, { debugName: "flexDirection" }] : /* istanbul ignore next */ []));
|
|
829
|
+
textAlign = input(...(ngDevMode ? [undefined, { debugName: "textAlign" }] : /* istanbul ignore next */ []));
|
|
830
|
+
wrapItems = input(undefined, ...(ngDevMode ? [{ debugName: "wrapItems" }] : /* istanbul ignore next */ []));
|
|
831
|
+
zIndex = input(...(ngDevMode ? [undefined, { debugName: "zIndex" }] : /* istanbul ignore next */ []));
|
|
832
|
+
get boxClassName() {
|
|
833
|
+
return css([
|
|
834
|
+
{
|
|
835
|
+
...this.theme.colorPair(this.color()),
|
|
836
|
+
...this.theme.backgroundColor(this.backgroundColor()),
|
|
837
|
+
display: this.alignSelf() ? 'flex' : 'block',
|
|
838
|
+
position: this.position(),
|
|
839
|
+
inset: this.inset(),
|
|
840
|
+
boxSizing: 'border-box',
|
|
841
|
+
height: this.height(),
|
|
842
|
+
minHeight: this.minHeight(),
|
|
843
|
+
maxHeight: this.maxHeight(),
|
|
844
|
+
width: this.width(),
|
|
845
|
+
minWidth: this.minWidth(),
|
|
846
|
+
maxWidth: this.maxWidth(),
|
|
847
|
+
flexWrap: this.wrapItems(),
|
|
848
|
+
overflow: this.overflow(),
|
|
849
|
+
...this.theme.padding(this.padding()),
|
|
850
|
+
...this.theme.horizontalPadding(this.paddingHorizontal()),
|
|
851
|
+
...this.theme.verticalPadding(this.paddingVertical()),
|
|
852
|
+
...this.theme.paddingLeft(this.paddingLeft()),
|
|
853
|
+
...this.theme.paddingRight(this.paddingRight()),
|
|
854
|
+
...this.theme.paddingTop(this.paddingTop()),
|
|
855
|
+
...this.theme.paddingBottom(this.paddingBottom()),
|
|
856
|
+
...this.theme.boxShadow(this.elevation()),
|
|
857
|
+
...this.theme.boxShadow(this.shadow()),
|
|
858
|
+
...this.theme.radius(this.borderRadius()),
|
|
859
|
+
...this.theme.getRadiusLeft(this.borderRadiusLeft()),
|
|
860
|
+
...this.theme.getRadiusRight(this.borderRadiusRight()),
|
|
861
|
+
...this.theme.getRadiusTop(this.borderRadiusTop()),
|
|
862
|
+
...this.theme.getRadiusBottom(this.borderRadiusBottom()),
|
|
863
|
+
...this.theme.borderTop(this.borderTop()),
|
|
864
|
+
...this.theme.borderBottom(this.borderBottom()),
|
|
865
|
+
...this.theme.borderLeft(this.borderLeft()),
|
|
866
|
+
...this.theme.borderRight(this.borderRight()),
|
|
867
|
+
...this.theme.gap(this.gap()),
|
|
868
|
+
...this.theme.style('display', this.display()),
|
|
869
|
+
...this.theme.style('alignSelf', this.alignSelf()),
|
|
870
|
+
...this.theme.style('alignItems', this.alignItems()),
|
|
871
|
+
...this.theme.style('justifyContent', this.justifyContent()),
|
|
872
|
+
...this.theme.style('alignContent', this.alignContent()),
|
|
873
|
+
...this.theme.style('flexGrow', this.grow()),
|
|
874
|
+
...this.theme.style('flexDirection', this.flexDirection()),
|
|
875
|
+
...this.theme.style('gridArea', this.gridArea()),
|
|
876
|
+
...this.theme.style('gridColumn', this.gridColumn()),
|
|
877
|
+
...this.theme.style('gridRow', this.gridRow()),
|
|
878
|
+
...this.theme.style('textAlign', this.textAlign()),
|
|
879
|
+
...this.theme.zIndex(this.zIndex()),
|
|
880
|
+
},
|
|
881
|
+
this.border() &&
|
|
882
|
+
!this.dashBorder() && {
|
|
883
|
+
...this.theme.border(this.border()),
|
|
884
|
+
},
|
|
885
|
+
this.border() &&
|
|
886
|
+
this.dashBorder() && {
|
|
887
|
+
...this.theme.getDashedBorder(this.border(), this.borderRadius()),
|
|
888
|
+
},
|
|
889
|
+
this.fullWidth() && {
|
|
890
|
+
width: '100%',
|
|
891
|
+
},
|
|
892
|
+
this.fullHeight() && {
|
|
893
|
+
height: '100%',
|
|
894
|
+
},
|
|
895
|
+
this.ignoreDir() &&
|
|
896
|
+
(this.flexDirection() ?? 'row') === 'row' && {
|
|
897
|
+
'&:dir(rtl)': {
|
|
898
|
+
flexDirection: 'row-reverse',
|
|
899
|
+
},
|
|
900
|
+
},
|
|
901
|
+
this.ignoreDir() &&
|
|
902
|
+
(this.flexDirection() ?? 'row') === 'row-reverse' && {
|
|
903
|
+
'&:dir(rtl)': {
|
|
904
|
+
flexDirection: 'row',
|
|
905
|
+
},
|
|
906
|
+
},
|
|
907
|
+
]);
|
|
908
|
+
}
|
|
909
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
910
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniBoxComponent, isStandalone: true, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null }, borderRadius: { classPropertyName: "borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null }, borderRadiusLeft: { classPropertyName: "borderRadiusLeft", publicName: "borderRadiusLeft", isSignal: true, isRequired: false, transformFunction: null }, borderRadiusRight: { classPropertyName: "borderRadiusRight", publicName: "borderRadiusRight", isSignal: true, isRequired: false, transformFunction: null }, borderRadiusTop: { classPropertyName: "borderRadiusTop", publicName: "borderRadiusTop", isSignal: true, isRequired: false, transformFunction: null }, borderRadiusBottom: { classPropertyName: "borderRadiusBottom", publicName: "borderRadiusBottom", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, paddingHorizontal: { classPropertyName: "paddingHorizontal", publicName: "paddingHorizontal", isSignal: true, isRequired: false, transformFunction: null }, paddingVertical: { classPropertyName: "paddingVertical", publicName: "paddingVertical", isSignal: true, isRequired: false, transformFunction: null }, paddingLeft: { classPropertyName: "paddingLeft", publicName: "paddingLeft", isSignal: true, isRequired: false, transformFunction: null }, paddingRight: { classPropertyName: "paddingRight", publicName: "paddingRight", isSignal: true, isRequired: false, transformFunction: null }, paddingTop: { classPropertyName: "paddingTop", publicName: "paddingTop", isSignal: true, isRequired: false, transformFunction: null }, paddingBottom: { classPropertyName: "paddingBottom", publicName: "paddingBottom", isSignal: true, isRequired: false, transformFunction: null }, border: { classPropertyName: "border", publicName: "border", isSignal: true, isRequired: false, transformFunction: null }, borderTop: { classPropertyName: "borderTop", publicName: "borderTop", isSignal: true, isRequired: false, transformFunction: null }, borderBottom: { classPropertyName: "borderBottom", publicName: "borderBottom", isSignal: true, isRequired: false, transformFunction: null }, borderLeft: { classPropertyName: "borderLeft", publicName: "borderLeft", isSignal: true, isRequired: false, transformFunction: null }, borderRight: { classPropertyName: "borderRight", publicName: "borderRight", isSignal: true, isRequired: false, transformFunction: null }, dashBorder: { classPropertyName: "dashBorder", publicName: "dashBorder", isSignal: true, isRequired: false, transformFunction: null }, alignSelf: { classPropertyName: "alignSelf", publicName: "alignSelf", isSignal: true, isRequired: false, transformFunction: null }, alignItems: { classPropertyName: "alignItems", publicName: "alignItems", isSignal: true, isRequired: false, transformFunction: null }, alignContent: { classPropertyName: "alignContent", publicName: "alignContent", isSignal: true, isRequired: false, transformFunction: null }, justifyContent: { classPropertyName: "justifyContent", publicName: "justifyContent", isSignal: true, isRequired: false, transformFunction: null }, grow: { classPropertyName: "grow", publicName: "grow", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, ignoreDir: { classPropertyName: "ignoreDir", publicName: "ignoreDir", isSignal: true, isRequired: false, transformFunction: null }, gridArea: { classPropertyName: "gridArea", publicName: "gridArea", isSignal: true, isRequired: false, transformFunction: null }, gridColumn: { classPropertyName: "gridColumn", publicName: "gridColumn", isSignal: true, isRequired: false, transformFunction: null }, gridRow: { classPropertyName: "gridRow", publicName: "gridRow", isSignal: true, isRequired: false, transformFunction: null }, overflow: { classPropertyName: "overflow", publicName: "overflow", isSignal: true, isRequired: false, transformFunction: null }, elevation: { classPropertyName: "elevation", publicName: "elevation", isSignal: true, isRequired: false, transformFunction: null }, shadow: { classPropertyName: "shadow", publicName: "shadow", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, fullHeight: { classPropertyName: "fullHeight", publicName: "fullHeight", isSignal: true, isRequired: false, transformFunction: null }, flexDirection: { classPropertyName: "flexDirection", publicName: "flexDirection", isSignal: true, isRequired: false, transformFunction: null }, textAlign: { classPropertyName: "textAlign", publicName: "textAlign", isSignal: true, isRequired: false, transformFunction: null }, wrapItems: { classPropertyName: "wrapItems", publicName: "wrapItems", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.boxClassName" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
911
|
+
}
|
|
912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniBoxComponent, decorators: [{
|
|
913
|
+
type: Component,
|
|
914
|
+
args: [{
|
|
915
|
+
selector: 'div[uni-box-layout], Box, div[box-layout]',
|
|
916
|
+
standalone: true,
|
|
917
|
+
imports: [],
|
|
918
|
+
template: `<ng-content></ng-content>`,
|
|
919
|
+
}]
|
|
920
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], backgroundColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColor", required: false }] }], borderRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadius", required: false }] }], borderRadiusLeft: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadiusLeft", required: false }] }], borderRadiusRight: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadiusRight", required: false }] }], borderRadiusTop: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadiusTop", required: false }] }], borderRadiusBottom: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRadiusBottom", required: false }] }], padding: [{ type: i0.Input, args: [{ isSignal: true, alias: "padding", required: false }] }], paddingHorizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingHorizontal", required: false }] }], paddingVertical: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingVertical", required: false }] }], paddingLeft: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingLeft", required: false }] }], paddingRight: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingRight", required: false }] }], paddingTop: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingTop", required: false }] }], paddingBottom: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingBottom", required: false }] }], border: [{ type: i0.Input, args: [{ isSignal: true, alias: "border", required: false }] }], borderTop: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderTop", required: false }] }], borderBottom: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderBottom", required: false }] }], borderLeft: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderLeft", required: false }] }], borderRight: [{ type: i0.Input, args: [{ isSignal: true, alias: "borderRight", required: false }] }], dashBorder: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashBorder", required: false }] }], alignSelf: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignSelf", required: false }] }], alignItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignItems", required: false }] }], alignContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignContent", required: false }] }], justifyContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "justifyContent", required: false }] }], grow: [{ type: i0.Input, args: [{ isSignal: true, alias: "grow", required: false }] }], display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], ignoreDir: [{ type: i0.Input, args: [{ isSignal: true, alias: "ignoreDir", required: false }] }], gridArea: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridArea", required: false }] }], gridColumn: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridColumn", required: false }] }], gridRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridRow", required: false }] }], overflow: [{ type: i0.Input, args: [{ isSignal: true, alias: "overflow", required: false }] }], elevation: [{ type: i0.Input, args: [{ isSignal: true, alias: "elevation", required: false }] }], shadow: [{ type: i0.Input, args: [{ isSignal: true, alias: "shadow", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], fullHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullHeight", required: false }] }], flexDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "flexDirection", required: false }] }], textAlign: [{ type: i0.Input, args: [{ isSignal: true, alias: "textAlign", required: false }] }], wrapItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrapItems", required: false }] }], zIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIndex", required: false }] }], boxClassName: [{
|
|
921
|
+
type: HostBinding,
|
|
922
|
+
args: ['class']
|
|
923
|
+
}] } });
|
|
924
|
+
|
|
925
|
+
class UniCenterComponent extends UniBoxComponent {
|
|
926
|
+
display = input('flex', ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
927
|
+
justifyContent = input('center', ...(ngDevMode ? [{ debugName: "justifyContent" }] : /* istanbul ignore next */ []));
|
|
928
|
+
alignItems = input('center', ...(ngDevMode ? [{ debugName: "alignItems" }] : /* istanbul ignore next */ []));
|
|
929
|
+
constructor() {
|
|
930
|
+
super();
|
|
931
|
+
}
|
|
932
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCenterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
933
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniCenterComponent, isStandalone: true, selector: "div[uni-center-layout], div[center-layout]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, justifyContent: { classPropertyName: "justifyContent", publicName: "justifyContent", isSignal: true, isRequired: false, transformFunction: null }, alignItems: { classPropertyName: "alignItems", publicName: "alignItems", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
934
|
+
}
|
|
935
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCenterComponent, decorators: [{
|
|
936
|
+
type: Component,
|
|
937
|
+
args: [{
|
|
938
|
+
selector: 'div[uni-center-layout], div[center-layout]',
|
|
939
|
+
standalone: true,
|
|
940
|
+
imports: [],
|
|
941
|
+
template: `<ng-content></ng-content>`,
|
|
942
|
+
}]
|
|
943
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], justifyContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "justifyContent", required: false }] }], alignItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignItems", required: false }] }] } });
|
|
944
|
+
|
|
945
|
+
class UniGridAreaComponent {
|
|
946
|
+
area;
|
|
947
|
+
get className() {
|
|
948
|
+
return css([{ gridArea: this.area }]);
|
|
949
|
+
}
|
|
950
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniGridAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
951
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: UniGridAreaComponent, isStandalone: true, selector: "GridArea", inputs: { area: "area" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
952
|
+
}
|
|
953
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniGridAreaComponent, decorators: [{
|
|
954
|
+
type: Component,
|
|
955
|
+
args: [{
|
|
956
|
+
selector: 'GridArea',
|
|
957
|
+
standalone: true,
|
|
958
|
+
imports: [],
|
|
959
|
+
template: `<ng-content></ng-content>`,
|
|
960
|
+
}]
|
|
961
|
+
}], propDecorators: { area: [{
|
|
962
|
+
type: Input
|
|
963
|
+
}], className: [{
|
|
964
|
+
type: HostBinding,
|
|
965
|
+
args: ['class']
|
|
966
|
+
}] } });
|
|
967
|
+
|
|
968
|
+
class UniGridComponent extends UniBoxComponent {
|
|
969
|
+
display = input('grid', ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
970
|
+
constructor() {
|
|
971
|
+
super();
|
|
972
|
+
}
|
|
973
|
+
templateAreas;
|
|
974
|
+
templateColumns;
|
|
975
|
+
templateRows;
|
|
976
|
+
outline;
|
|
977
|
+
outlineColor;
|
|
978
|
+
get className() {
|
|
979
|
+
return css([
|
|
980
|
+
this.templateAreas && {
|
|
981
|
+
gridTemplateAreas: this.templateAreas,
|
|
982
|
+
},
|
|
983
|
+
this.templateColumns && {
|
|
984
|
+
gridTemplateColumns: this.templateColumns,
|
|
985
|
+
},
|
|
986
|
+
this.templateRows && {
|
|
987
|
+
gridTemplateRows: this.templateRows,
|
|
988
|
+
},
|
|
989
|
+
this.outline && {
|
|
990
|
+
gap: this.theme.getThickness(this.outline),
|
|
991
|
+
},
|
|
992
|
+
this.outlineColor && {
|
|
993
|
+
backgroundColor: this.theme.colorPalette()[this.outlineColor],
|
|
994
|
+
},
|
|
995
|
+
]);
|
|
996
|
+
}
|
|
997
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
998
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniGridComponent, isStandalone: true, selector: "div[uni-grid-layout], Grid, div[grid-layout]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, templateAreas: { classPropertyName: "templateAreas", publicName: "templateAreas", isSignal: false, isRequired: false, transformFunction: null }, templateColumns: { classPropertyName: "templateColumns", publicName: "templateColumns", isSignal: false, isRequired: false, transformFunction: null }, templateRows: { classPropertyName: "templateRows", publicName: "templateRows", isSignal: false, isRequired: false, transformFunction: null }, outline: { classPropertyName: "outline", publicName: "outline", isSignal: false, isRequired: false, transformFunction: null }, outlineColor: { classPropertyName: "outlineColor", publicName: "outlineColor", isSignal: false, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
999
|
+
}
|
|
1000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniGridComponent, decorators: [{
|
|
1001
|
+
type: Component,
|
|
1002
|
+
args: [{
|
|
1003
|
+
selector: 'div[uni-grid-layout], Grid, div[grid-layout]',
|
|
1004
|
+
standalone: true,
|
|
1005
|
+
imports: [],
|
|
1006
|
+
template: `<ng-content></ng-content>`,
|
|
1007
|
+
}]
|
|
1008
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], templateAreas: [{
|
|
1009
|
+
type: Input
|
|
1010
|
+
}], templateColumns: [{
|
|
1011
|
+
type: Input
|
|
1012
|
+
}], templateRows: [{
|
|
1013
|
+
type: Input
|
|
1014
|
+
}], outline: [{
|
|
1015
|
+
type: Input
|
|
1016
|
+
}], outlineColor: [{
|
|
1017
|
+
type: Input
|
|
1018
|
+
}], className: [{
|
|
1019
|
+
type: HostBinding,
|
|
1020
|
+
args: ['class']
|
|
1021
|
+
}] } });
|
|
1022
|
+
|
|
1023
|
+
class UniRowComponent extends UniBoxComponent {
|
|
1024
|
+
display = input('flex', ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
1025
|
+
flexDirection = input('row', ...(ngDevMode ? [{ debugName: "flexDirection" }] : /* istanbul ignore next */ []));
|
|
1026
|
+
minWidth = input('fit-content', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
1027
|
+
constructor() {
|
|
1028
|
+
super();
|
|
1029
|
+
}
|
|
1030
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1031
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniRowComponent, isStandalone: true, selector: "div[uni-row-layout], Row, div[row-layout]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, flexDirection: { classPropertyName: "flexDirection", publicName: "flexDirection", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
1032
|
+
}
|
|
1033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniRowComponent, decorators: [{
|
|
1034
|
+
type: Component,
|
|
1035
|
+
args: [{
|
|
1036
|
+
selector: 'div[uni-row-layout], Row, div[row-layout]',
|
|
1037
|
+
standalone: true,
|
|
1038
|
+
template: `<ng-content></ng-content>`,
|
|
1039
|
+
}]
|
|
1040
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], flexDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "flexDirection", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }] } });
|
|
1041
|
+
|
|
1042
|
+
class UniStackComponent extends UniBoxComponent {
|
|
1043
|
+
display = input('flex', ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
1044
|
+
flexDirection = input('column', ...(ngDevMode ? [{ debugName: "flexDirection" }] : /* istanbul ignore next */ []));
|
|
1045
|
+
minHeight = input('fit-content', ...(ngDevMode ? [{ debugName: "minHeight" }] : /* istanbul ignore next */ []));
|
|
1046
|
+
constructor() {
|
|
1047
|
+
super();
|
|
1048
|
+
}
|
|
1049
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniStackComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1050
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniStackComponent, isStandalone: true, selector: "div[uni-stack-layout], Stack, div[stack-layout]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, flexDirection: { classPropertyName: "flexDirection", publicName: "flexDirection", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
1051
|
+
}
|
|
1052
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniStackComponent, decorators: [{
|
|
1053
|
+
type: Component,
|
|
1054
|
+
args: [{
|
|
1055
|
+
selector: 'div[uni-stack-layout], Stack, div[stack-layout]',
|
|
1056
|
+
standalone: true,
|
|
1057
|
+
template: `<ng-content></ng-content>`,
|
|
1058
|
+
}]
|
|
1059
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], flexDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "flexDirection", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }] } });
|
|
1060
|
+
|
|
1061
|
+
class UniWrapComponent extends UniBoxComponent {
|
|
1062
|
+
display = input('flex', ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
1063
|
+
wrapItems = input('wrap', ...(ngDevMode ? [{ debugName: "wrapItems" }] : /* istanbul ignore next */ []));
|
|
1064
|
+
constructor() {
|
|
1065
|
+
super();
|
|
1066
|
+
}
|
|
1067
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniWrapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1068
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniWrapComponent, isStandalone: true, selector: "div[uni-wrap-layout], Wrap, div[wrap-layout]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, wrapItems: { classPropertyName: "wrapItems", publicName: "wrapItems", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
1069
|
+
}
|
|
1070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniWrapComponent, decorators: [{
|
|
1071
|
+
type: Component,
|
|
1072
|
+
args: [{
|
|
1073
|
+
selector: 'div[uni-wrap-layout], Wrap, div[wrap-layout]',
|
|
1074
|
+
imports: [],
|
|
1075
|
+
template: `<ng-content></ng-content>`,
|
|
1076
|
+
}]
|
|
1077
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], wrapItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrapItems", required: false }] }] } });
|
|
1078
|
+
|
|
1079
|
+
class UniSymbolComponent {
|
|
1080
|
+
name;
|
|
1081
|
+
fill = 0;
|
|
1082
|
+
weight = 400;
|
|
1083
|
+
grade = 0;
|
|
1084
|
+
opticalSize = 24;
|
|
1085
|
+
get className() {
|
|
1086
|
+
const settings = `'FILL' ${this.fill}, 'wght' ${this.weight}, 'GRAD' ${this.grade}, 'opsz' ${this.opticalSize}`;
|
|
1087
|
+
return ('material-symbols-rounded ' +
|
|
1088
|
+
css({
|
|
1089
|
+
fontVariationSettings: settings,
|
|
1090
|
+
fontSize: `${this.opticalSize}px`,
|
|
1091
|
+
}));
|
|
1092
|
+
}
|
|
1093
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniSymbolComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1094
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: UniSymbolComponent, isStandalone: true, selector: "uni-symbol, Symbol", inputs: { name: "name", fill: "fill", weight: "weight", grade: "grade", opticalSize: "opticalSize" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: `{{ name }}`, isInline: true });
|
|
1095
|
+
}
|
|
1096
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniSymbolComponent, decorators: [{
|
|
1097
|
+
type: Component,
|
|
1098
|
+
args: [{
|
|
1099
|
+
selector: 'uni-symbol, Symbol',
|
|
1100
|
+
standalone: true,
|
|
1101
|
+
imports: [],
|
|
1102
|
+
template: `{{ name }}`,
|
|
1103
|
+
}]
|
|
1104
|
+
}], propDecorators: { name: [{
|
|
1105
|
+
type: Input
|
|
1106
|
+
}], fill: [{
|
|
1107
|
+
type: Input
|
|
1108
|
+
}], weight: [{
|
|
1109
|
+
type: Input
|
|
1110
|
+
}], grade: [{
|
|
1111
|
+
type: Input
|
|
1112
|
+
}], opticalSize: [{
|
|
1113
|
+
type: Input
|
|
1114
|
+
}], className: [{
|
|
1115
|
+
type: HostBinding,
|
|
1116
|
+
args: ['class']
|
|
1117
|
+
}] } });
|
|
1118
|
+
|
|
1119
|
+
// https://css-tricks.com/how-to-recreate-the-ripple-effect-of-material-design-buttons/
|
|
1120
|
+
class RippleDirective {
|
|
1121
|
+
renderer = inject(Renderer2);
|
|
1122
|
+
el = inject(ElementRef);
|
|
1123
|
+
hostEl;
|
|
1124
|
+
constructor() {
|
|
1125
|
+
this.hostEl = this.el.nativeElement;
|
|
1126
|
+
}
|
|
1127
|
+
onClick(e) {
|
|
1128
|
+
if (!e)
|
|
1129
|
+
return;
|
|
1130
|
+
let ripple, d;
|
|
1131
|
+
if (this.hostEl.querySelector(`.${this.rippleClass}`) === null) {
|
|
1132
|
+
ripple = this.renderer.createElement('span');
|
|
1133
|
+
this.renderer.addClass(ripple, this.rippleClass);
|
|
1134
|
+
this.renderer.appendChild(this.hostEl, ripple);
|
|
1135
|
+
}
|
|
1136
|
+
ripple = this.hostEl.querySelector(`.${this.rippleClass}`);
|
|
1137
|
+
this.renderer.appendChild(this.hostEl, ripple);
|
|
1138
|
+
this.renderer.removeClass(ripple, this.animateClass);
|
|
1139
|
+
if (!ripple.offsetHeight && !ripple.offsetWidth) {
|
|
1140
|
+
d = Math.max(this.hostEl.offsetWidth, this.hostEl.offsetHeight);
|
|
1141
|
+
this.renderer.setStyle(ripple, 'width', d + 'px');
|
|
1142
|
+
this.renderer.setStyle(ripple, 'height', d + 'px');
|
|
1143
|
+
}
|
|
1144
|
+
const x = e.pageX - this.hostEl.offsetLeft - ripple.offsetWidth / 2;
|
|
1145
|
+
const y = e.pageY - this.hostEl.offsetTop - ripple.offsetHeight / 2;
|
|
1146
|
+
this.renderer.setStyle(ripple, 'top', y + 'px');
|
|
1147
|
+
this.renderer.setStyle(ripple, 'left', x + 'px');
|
|
1148
|
+
this.renderer.addClass(ripple, this.animateClass);
|
|
1149
|
+
}
|
|
1150
|
+
rippleClass = css({
|
|
1151
|
+
display: 'block',
|
|
1152
|
+
position: 'absolute',
|
|
1153
|
+
background: 'rgba(255, 255, 255, 0.3)',
|
|
1154
|
+
borderRadius: '100%',
|
|
1155
|
+
transform: 'scale(0)',
|
|
1156
|
+
});
|
|
1157
|
+
animateClass = css({
|
|
1158
|
+
animation: 'ripple 0.65s linear',
|
|
1159
|
+
'@keyframes ripple': {
|
|
1160
|
+
'100%': {
|
|
1161
|
+
opacity: 0,
|
|
1162
|
+
transform: 'scale(2.5)',
|
|
1163
|
+
},
|
|
1164
|
+
},
|
|
1165
|
+
});
|
|
1166
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: RippleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1167
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.12", type: RippleDirective, isStandalone: true, selector: "[uniRipple]", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
|
|
1168
|
+
}
|
|
1169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: RippleDirective, decorators: [{
|
|
1170
|
+
type: Directive,
|
|
1171
|
+
args: [{
|
|
1172
|
+
selector: '[uniRipple]',
|
|
1173
|
+
standalone: true,
|
|
1174
|
+
}]
|
|
1175
|
+
}], ctorParameters: () => [], propDecorators: { onClick: [{
|
|
1176
|
+
type: HostListener,
|
|
1177
|
+
args: ['click', ['$event']]
|
|
1178
|
+
}] } });
|
|
1179
|
+
|
|
1180
|
+
class UniButtonComponent extends BaseComponent {
|
|
1181
|
+
disable = input(false, ...(ngDevMode ? [{ debugName: "disable" }] : /* istanbul ignore next */ []));
|
|
1182
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1183
|
+
fullWidth = input(false, ...(ngDevMode ? [{ debugName: "fullWidth" }] : /* istanbul ignore next */ []));
|
|
1184
|
+
symbolLeft;
|
|
1185
|
+
symbolRight;
|
|
1186
|
+
spinnerBox = css({
|
|
1187
|
+
position: 'absolute',
|
|
1188
|
+
left: 0,
|
|
1189
|
+
width: '100%',
|
|
1190
|
+
height: '100%',
|
|
1191
|
+
paddingTop: '6%',
|
|
1192
|
+
paddingBottom: '6%',
|
|
1193
|
+
});
|
|
1194
|
+
get className() {
|
|
1195
|
+
return css([
|
|
1196
|
+
this.style() && {
|
|
1197
|
+
...this.style(),
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
display: 'flex',
|
|
1201
|
+
alignItems: 'center',
|
|
1202
|
+
position: 'relative',
|
|
1203
|
+
overflow: 'hidden',
|
|
1204
|
+
outline: 0,
|
|
1205
|
+
border: 0,
|
|
1206
|
+
cursor: 'pointer',
|
|
1207
|
+
fontFamily: 'Euphemia, sans-serif',
|
|
1208
|
+
transition: 'all 0.28s ease',
|
|
1209
|
+
'&:disabled': {
|
|
1210
|
+
cursor: 'not-allowed !important',
|
|
1211
|
+
},
|
|
1212
|
+
'& .symbolLeft': {
|
|
1213
|
+
marginLeft: -6,
|
|
1214
|
+
marginRight: 4,
|
|
1215
|
+
fontSize: this.symbolSize(),
|
|
1216
|
+
},
|
|
1217
|
+
'& span': {
|
|
1218
|
+
alignContent: 'center',
|
|
1219
|
+
flexGrow: 1,
|
|
1220
|
+
whiteSpace: 'nowrap',
|
|
1221
|
+
},
|
|
1222
|
+
'& .symbolRight': {
|
|
1223
|
+
marginRight: -6,
|
|
1224
|
+
marginLeft: 4,
|
|
1225
|
+
fontSize: this.symbolSize(),
|
|
1226
|
+
},
|
|
1227
|
+
},
|
|
1228
|
+
this.variant() !== 'ghost' && {
|
|
1229
|
+
'&:hover, &:focus': {
|
|
1230
|
+
...this.theme.boxShadow('raised'),
|
|
1231
|
+
},
|
|
1232
|
+
'&:focus-visible': {
|
|
1233
|
+
outline: `2px solid ${this.theme.colors()[this.variant()]}`,
|
|
1234
|
+
outlineOffset: '2px',
|
|
1235
|
+
},
|
|
1236
|
+
},
|
|
1237
|
+
this.variant() === 'ghost' && {
|
|
1238
|
+
'&:hover, &:focus': {
|
|
1239
|
+
backgroundColor: 'rgba(0,0,0,0.1) !important',
|
|
1240
|
+
},
|
|
1241
|
+
'&:focus-visible': {
|
|
1242
|
+
outline: `2px solid ${this.theme.colors()[this.variant()]}`,
|
|
1243
|
+
outlineOffset: '2px',
|
|
1244
|
+
},
|
|
1245
|
+
},
|
|
1246
|
+
this.fullWidth() && {
|
|
1247
|
+
width: '100%',
|
|
1248
|
+
},
|
|
1249
|
+
!this.loading() && {
|
|
1250
|
+
'&:disabled': {
|
|
1251
|
+
...this.componentTheme().colors?.disabled,
|
|
1252
|
+
},
|
|
1253
|
+
},
|
|
1254
|
+
this.loading() && {
|
|
1255
|
+
'&:disabled symbol': {
|
|
1256
|
+
opacity: 0,
|
|
1257
|
+
},
|
|
1258
|
+
'&:disabled span': {
|
|
1259
|
+
opacity: 0,
|
|
1260
|
+
},
|
|
1261
|
+
},
|
|
1262
|
+
]);
|
|
1263
|
+
}
|
|
1264
|
+
symbolSize = computed(() => {
|
|
1265
|
+
const style = this.style();
|
|
1266
|
+
const fontString = style['fontSize'];
|
|
1267
|
+
const fontSize = parseFloat(fontString);
|
|
1268
|
+
return fontSize + 4;
|
|
1269
|
+
}, ...(ngDevMode ? [{ debugName: "symbolSize" }] : /* istanbul ignore next */ []));
|
|
1270
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1271
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniButtonComponent, isStandalone: true, selector: "button[uni-text-button], Button, button[text-button]", inputs: { disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, symbolLeft: { classPropertyName: "symbolLeft", publicName: "symbolLeft", isSignal: false, isRequired: false, transformFunction: null }, symbolRight: { classPropertyName: "symbolRight", publicName: "symbolRight", isSignal: false, isRequired: false, transformFunction: null } }, host: { properties: { "attr.disabled": "disable() || loading() || null", "class": "this.className" } }, providers: [{ provide: COMPONENT_NAME, useValue: 'button' }], usesInheritance: true, hostDirectives: [{ directive: RippleDirective }], ngImport: i0, template: `@if (loading()) {
|
|
1272
|
+
<Box [class]="spinnerBox"><uni-icon name="spinner" /></Box>
|
|
1273
|
+
}
|
|
1274
|
+
@if (symbolLeft) {
|
|
1275
|
+
<Symbol [name]="symbolLeft" class="symbolLeft" />
|
|
1276
|
+
}
|
|
1277
|
+
<span><ng-content></ng-content></span>
|
|
1278
|
+
@if (symbolRight) {
|
|
1279
|
+
<Symbol [name]="symbolRight" class="symbolRight" />
|
|
1280
|
+
} `, isInline: true, dependencies: [{ kind: "component", type: // Keep this import
|
|
1281
|
+
UniIconComponent, selector: "uni-icon, Icon", inputs: ["color", "name"] }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }] });
|
|
15
1282
|
}
|
|
16
1283
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniButtonComponent, decorators: [{
|
|
17
1284
|
type: Component,
|
|
18
|
-
args: [{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1285
|
+
args: [{
|
|
1286
|
+
selector: 'button[uni-text-button], Button, button[text-button]',
|
|
1287
|
+
template: `@if (loading()) {
|
|
1288
|
+
<Box [class]="spinnerBox"><uni-icon name="spinner" /></Box>
|
|
1289
|
+
}
|
|
1290
|
+
@if (symbolLeft) {
|
|
1291
|
+
<Symbol [name]="symbolLeft" class="symbolLeft" />
|
|
1292
|
+
}
|
|
1293
|
+
<span><ng-content></ng-content></span>
|
|
1294
|
+
@if (symbolRight) {
|
|
1295
|
+
<Symbol [name]="symbolRight" class="symbolRight" />
|
|
1296
|
+
} `,
|
|
1297
|
+
providers: [{ provide: COMPONENT_NAME, useValue: 'button' }],
|
|
1298
|
+
imports: [
|
|
1299
|
+
RippleDirective, // Keep this import
|
|
1300
|
+
UniIconComponent,
|
|
1301
|
+
UniBoxComponent,
|
|
1302
|
+
UniSymbolComponent,
|
|
1303
|
+
],
|
|
1304
|
+
host: {
|
|
1305
|
+
'[attr.disabled]': 'disable() || loading() || null',
|
|
1306
|
+
},
|
|
1307
|
+
hostDirectives: [{ directive: RippleDirective }],
|
|
1308
|
+
}]
|
|
1309
|
+
}], propDecorators: { disable: [{ type: i0.Input, args: [{ isSignal: true, alias: "disable", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], symbolLeft: [{
|
|
1310
|
+
type: Input
|
|
1311
|
+
}], symbolRight: [{
|
|
1312
|
+
type: Input
|
|
1313
|
+
}], className: [{
|
|
1314
|
+
type: HostBinding,
|
|
1315
|
+
args: ['class']
|
|
1316
|
+
}] } });
|
|
1317
|
+
|
|
1318
|
+
class UniCardContentComponent extends BaseComponent {
|
|
1319
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCardContentComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1320
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: UniCardContentComponent, isStandalone: true, selector: "uni-card-content, CardContent", providers: [{ provide: COMPONENT_NAME, useValue: 'cardContent' }], usesInheritance: true, ngImport: i0, template: "<div [style]=\"style()\">\n <ng-content></ng-content>\n</div>\n", styles: [""] });
|
|
1321
|
+
}
|
|
1322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCardContentComponent, decorators: [{
|
|
1323
|
+
type: Component,
|
|
1324
|
+
args: [{ selector: 'uni-card-content, CardContent', standalone: true, imports: [], providers: [{ provide: COMPONENT_NAME, useValue: 'cardContent' }], template: "<div [style]=\"style()\">\n <ng-content></ng-content>\n</div>\n" }]
|
|
1325
|
+
}] });
|
|
1326
|
+
|
|
1327
|
+
class UniTextComponent {
|
|
1328
|
+
theme = inject(ThemeService);
|
|
1329
|
+
typeface = input('title-small', ...(ngDevMode ? [{ debugName: "typeface" }] : /* istanbul ignore next */ []));
|
|
1330
|
+
color = input(...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1331
|
+
display = input(...(ngDevMode ? [undefined, { debugName: "display" }] : /* istanbul ignore next */ []));
|
|
1332
|
+
align = input(...(ngDevMode ? [undefined, { debugName: "align" }] : /* istanbul ignore next */ []));
|
|
1333
|
+
nowrap = input(...(ngDevMode ? [undefined, { debugName: "nowrap" }] : /* istanbul ignore next */ []));
|
|
1334
|
+
maxWidth = input(...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
1335
|
+
ellipsis = input(false, ...(ngDevMode ? [{ debugName: "ellipsis" }] : /* istanbul ignore next */ []));
|
|
1336
|
+
get className() {
|
|
1337
|
+
return css([
|
|
1338
|
+
{
|
|
1339
|
+
...this.theme.typeface(this.typeface()),
|
|
1340
|
+
...this.theme.color(this.color()),
|
|
1341
|
+
display: this.display(),
|
|
1342
|
+
},
|
|
1343
|
+
this.align() && {
|
|
1344
|
+
textAlign: this.align(),
|
|
1345
|
+
},
|
|
1346
|
+
this.nowrap() && {
|
|
1347
|
+
whiteSpace: 'nowrap',
|
|
1348
|
+
},
|
|
1349
|
+
this.maxWidth() && {
|
|
1350
|
+
maxWidth: this.maxWidth(),
|
|
1351
|
+
overflow: 'hidden',
|
|
1352
|
+
whiteSpace: 'nowrap',
|
|
1353
|
+
textOverflow: 'ellipsis',
|
|
1354
|
+
display: 'inline-block',
|
|
1355
|
+
},
|
|
1356
|
+
this.ellipsis() && {
|
|
1357
|
+
whiteSpace: 'nowrap',
|
|
1358
|
+
overflow: 'hidden',
|
|
1359
|
+
textOverflow: 'ellipsis',
|
|
1360
|
+
minWidth: 0,
|
|
1361
|
+
},
|
|
1362
|
+
]);
|
|
1363
|
+
}
|
|
1364
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1365
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniTextComponent, isStandalone: true, selector: "uni-text, Text", inputs: { typeface: { classPropertyName: "typeface", publicName: "typeface", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, nowrap: { classPropertyName: "nowrap", publicName: "nowrap", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, ellipsis: { classPropertyName: "ellipsis", publicName: "ellipsis", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
1366
|
+
}
|
|
1367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniTextComponent, decorators: [{
|
|
1368
|
+
type: Component,
|
|
1369
|
+
args: [{
|
|
1370
|
+
selector: 'uni-text, Text',
|
|
1371
|
+
standalone: true,
|
|
1372
|
+
imports: [],
|
|
1373
|
+
template: '<ng-content></ng-content>',
|
|
1374
|
+
}]
|
|
1375
|
+
}], propDecorators: { typeface: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeface", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], nowrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "nowrap", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], ellipsis: [{ type: i0.Input, args: [{ isSignal: true, alias: "ellipsis", required: false }] }], className: [{
|
|
1376
|
+
type: HostBinding,
|
|
1377
|
+
args: ['class']
|
|
1378
|
+
}] } });
|
|
1379
|
+
|
|
1380
|
+
class UniCardComponent extends BaseComponent {
|
|
1381
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCardComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1382
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: UniCardComponent, isStandalone: true, selector: "uni-card, Card", providers: [{ provide: COMPONENT_NAME, useValue: 'card' }], usesInheritance: true, ngImport: i0, template: "<div [style]=\"style()\">\n <ng-content></ng-content>\n</div>\n" });
|
|
1383
|
+
}
|
|
1384
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCardComponent, decorators: [{
|
|
1385
|
+
type: Component,
|
|
1386
|
+
args: [{ selector: 'uni-card, Card', standalone: true, imports: [], providers: [{ provide: COMPONENT_NAME, useValue: 'card' }], template: "<div [style]=\"style()\">\n <ng-content></ng-content>\n</div>\n" }]
|
|
1387
|
+
}] });
|
|
1388
|
+
|
|
1389
|
+
class UniCardHeaderComponent extends BaseComponent {
|
|
1390
|
+
card = inject(UniCardComponent, {
|
|
1391
|
+
optional: true,
|
|
1392
|
+
host: true,
|
|
1393
|
+
skipSelf: true,
|
|
1394
|
+
});
|
|
1395
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
1396
|
+
titleTextRole = input('title-large', ...(ngDevMode ? [{ debugName: "titleTextRole" }] : /* istanbul ignore next */ []));
|
|
1397
|
+
constructor() {
|
|
1398
|
+
super();
|
|
1399
|
+
// this.variant = this.card?.variant;
|
|
1400
|
+
}
|
|
1401
|
+
className = css({
|
|
1402
|
+
display: 'flex',
|
|
1403
|
+
justifyContent: 'space-between',
|
|
1404
|
+
alignItems: 'center',
|
|
1405
|
+
});
|
|
1406
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCardHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1407
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniCardHeaderComponent, isStandalone: true, selector: "uni-card-header, CardHeader", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, titleTextRole: { classPropertyName: "titleTextRole", publicName: "titleTextRole", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: COMPONENT_NAME, useValue: 'cardHeader' }], usesInheritance: true, ngImport: i0, template: "<div [style]=\"style()\" [ngClass]=\"className\">\n <Text [typeface]=\"titleTextRole()\">{{ title() }}</Text>\n <ng-content></ng-content>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
1408
|
+
}
|
|
1409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniCardHeaderComponent, decorators: [{
|
|
1410
|
+
type: Component,
|
|
1411
|
+
args: [{ selector: 'uni-card-header, CardHeader', standalone: true, imports: [UniTextComponent, NgClass], providers: [{ provide: COMPONENT_NAME, useValue: 'cardHeader' }], template: "<div [style]=\"style()\" [ngClass]=\"className\">\n <Text [typeface]=\"titleTextRole()\">{{ title() }}</Text>\n <ng-content></ng-content>\n</div>\n" }]
|
|
1412
|
+
}], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], titleTextRole: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleTextRole", required: false }] }] } });
|
|
1413
|
+
|
|
1414
|
+
class UniIconButtonComponent {
|
|
1415
|
+
theme = inject(ThemeService);
|
|
1416
|
+
config = this.theme.component('iconButton');
|
|
1417
|
+
iconName;
|
|
1418
|
+
symbolName;
|
|
1419
|
+
variant = 'ghost';
|
|
1420
|
+
size = 'lg';
|
|
1421
|
+
disable;
|
|
1422
|
+
loading;
|
|
1423
|
+
opticalSize = 24;
|
|
1424
|
+
get className() {
|
|
1425
|
+
const { sizes, colors } = this.config();
|
|
1426
|
+
const sizeConfig = sizes && sizes[this.size];
|
|
1427
|
+
const colorConfig = colors && colors[this.variant];
|
|
1428
|
+
return css([
|
|
1429
|
+
{
|
|
1430
|
+
position: 'relative',
|
|
1431
|
+
overflow: 'hidden',
|
|
1432
|
+
outline: 0,
|
|
1433
|
+
border: 0,
|
|
1434
|
+
cursor: 'pointer',
|
|
1435
|
+
transition: 'all 0.28s ease',
|
|
1436
|
+
borderRadius: 999,
|
|
1437
|
+
display: 'block',
|
|
1438
|
+
'&:disabled': {
|
|
1439
|
+
cursor: 'not-allowed !important',
|
|
1440
|
+
},
|
|
1441
|
+
'& symbol': {
|
|
1442
|
+
fontSize: 'inherit',
|
|
1443
|
+
lineHeight: 'inherit',
|
|
1444
|
+
},
|
|
1445
|
+
},
|
|
1446
|
+
sizeConfig && {
|
|
1447
|
+
...sizeConfig,
|
|
1448
|
+
},
|
|
1449
|
+
colorConfig && {
|
|
1450
|
+
...colorConfig,
|
|
1451
|
+
},
|
|
1452
|
+
this.symbolName &&
|
|
1453
|
+
!this.loading && {
|
|
1454
|
+
padding: 0,
|
|
1455
|
+
},
|
|
1456
|
+
this.variant !== 'ghost' && {
|
|
1457
|
+
'&:hover': {
|
|
1458
|
+
...this.theme.boxShadow('raised'),
|
|
1459
|
+
},
|
|
1460
|
+
},
|
|
1461
|
+
this.variant === 'ghost' && {
|
|
1462
|
+
'&:hover': {
|
|
1463
|
+
backgroundColor: 'rgba(0,0,0,0.1)',
|
|
1464
|
+
},
|
|
1465
|
+
},
|
|
1466
|
+
!this.loading && {
|
|
1467
|
+
'&:disabled': {
|
|
1468
|
+
...this.config().colors?.disabled,
|
|
1469
|
+
},
|
|
1470
|
+
},
|
|
1471
|
+
]);
|
|
1472
|
+
}
|
|
1473
|
+
ngOnChanges(changes) {
|
|
1474
|
+
const { sizes, colors } = this.config();
|
|
1475
|
+
const sizeConfig = sizes && sizes[this.size];
|
|
1476
|
+
if (this.loading)
|
|
1477
|
+
this.iconName = 'spinner';
|
|
1478
|
+
}
|
|
1479
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniIconButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1480
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniIconButtonComponent, isStandalone: true, selector: "button[uni-icon-button], button[icon-button]", inputs: { iconName: "iconName", symbolName: "symbolName", variant: "variant", size: "size", disable: "disable", loading: "loading", opticalSize: "opticalSize" }, host: { properties: { "attr.disabled": "disable || loading || null", "class": "this.className" } }, usesOnChanges: true, hostDirectives: [{ directive: RippleDirective }], ngImport: i0, template: `
|
|
1481
|
+
@if (symbolName && !loading) {
|
|
1482
|
+
<Symbol [name]="symbolName" [opticalSize]="opticalSize" />
|
|
1483
|
+
} @else if (iconName && !loading) {
|
|
1484
|
+
<Icon [name]="iconName" />
|
|
1485
|
+
}
|
|
1486
|
+
`, isInline: true, dependencies: [{ kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: UniIconComponent, selector: "uni-icon, Icon", inputs: ["color", "name"] }] });
|
|
1487
|
+
}
|
|
1488
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniIconButtonComponent, decorators: [{
|
|
1489
|
+
type: Component,
|
|
1490
|
+
args: [{
|
|
1491
|
+
selector: 'button[uni-icon-button], button[icon-button]',
|
|
1492
|
+
standalone: true,
|
|
1493
|
+
imports: [
|
|
1494
|
+
RippleDirective,
|
|
1495
|
+
UniSymbolComponent,
|
|
1496
|
+
UniIconComponent,
|
|
1497
|
+
// Keep this import
|
|
1498
|
+
],
|
|
1499
|
+
template: `
|
|
1500
|
+
@if (symbolName && !loading) {
|
|
1501
|
+
<Symbol [name]="symbolName" [opticalSize]="opticalSize" />
|
|
1502
|
+
} @else if (iconName && !loading) {
|
|
1503
|
+
<Icon [name]="iconName" />
|
|
1504
|
+
}
|
|
1505
|
+
`,
|
|
1506
|
+
host: {
|
|
1507
|
+
'[attr.disabled]': 'disable || loading || null',
|
|
1508
|
+
},
|
|
1509
|
+
hostDirectives: [{ directive: RippleDirective }],
|
|
1510
|
+
}]
|
|
1511
|
+
}], propDecorators: { iconName: [{
|
|
1512
|
+
type: Input
|
|
1513
|
+
}], symbolName: [{
|
|
1514
|
+
type: Input
|
|
1515
|
+
}], variant: [{
|
|
1516
|
+
type: Input
|
|
1517
|
+
}], size: [{
|
|
1518
|
+
type: Input
|
|
1519
|
+
}], disable: [{
|
|
1520
|
+
type: Input
|
|
1521
|
+
}], loading: [{
|
|
1522
|
+
type: Input
|
|
1523
|
+
}], opticalSize: [{
|
|
1524
|
+
type: Input
|
|
1525
|
+
}], className: [{
|
|
1526
|
+
type: HostBinding,
|
|
1527
|
+
args: ['class']
|
|
1528
|
+
}] } });
|
|
1529
|
+
|
|
1530
|
+
class UniDialogComponent extends BaseComponent {
|
|
1531
|
+
elem = inject(ElementRef);
|
|
1532
|
+
show = input(false, ...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
|
|
1533
|
+
_show = linkedSignal(() => this.show(), ...(ngDevMode ? [{ debugName: "_show" }] : /* istanbul ignore next */ []));
|
|
1534
|
+
defaultCloseButton;
|
|
1535
|
+
showing = new EventEmitter();
|
|
1536
|
+
constructor() {
|
|
1537
|
+
super();
|
|
1538
|
+
effect(() => (this._show() ? this.open() : this.close()));
|
|
1539
|
+
}
|
|
1540
|
+
get _dialog() {
|
|
1541
|
+
return this.elem.nativeElement;
|
|
1542
|
+
}
|
|
1543
|
+
get className() {
|
|
1544
|
+
return css([
|
|
1545
|
+
{
|
|
1546
|
+
...this.theme.radius(this.componentOptions().borderRadius),
|
|
1547
|
+
...this.theme.colorPair(this.componentOptions().color),
|
|
1548
|
+
...this.theme.border(this.componentOptions().border),
|
|
1549
|
+
...this.theme.boxShadow(this.componentOptions().elevation),
|
|
1550
|
+
...this.theme.padding(this.componentOptions().padding || 'none'),
|
|
1551
|
+
'&::backdrop': {
|
|
1552
|
+
...this.componentOptions().backdrop,
|
|
1553
|
+
},
|
|
1554
|
+
'&[open], &::backdrop': {
|
|
1555
|
+
animation: `${this.dialogFadeIn} ease-in 350ms`,
|
|
1556
|
+
},
|
|
1557
|
+
'&[closing], &[closing]::backdrop': {
|
|
1558
|
+
animation: `${this.dialogFadeOut} ease-in 350ms`,
|
|
1559
|
+
},
|
|
1560
|
+
},
|
|
1561
|
+
]);
|
|
1562
|
+
}
|
|
1563
|
+
BackdropClick(event) {
|
|
1564
|
+
if (event.target.nodeName === 'DIALOG') {
|
|
1565
|
+
this.close();
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
ClosingAnimation(e) {
|
|
1569
|
+
// Close the dialog if the animation is finished
|
|
1570
|
+
if (e.animationName.includes(this.dialogFadeOut)) {
|
|
1571
|
+
this._dialog.close();
|
|
1572
|
+
this._dialog.removeAttribute('closing');
|
|
1573
|
+
this.showing.emit(false);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
closeButton = css({
|
|
1577
|
+
position: 'absolute',
|
|
1578
|
+
right: 12,
|
|
1579
|
+
top: 12,
|
|
1580
|
+
});
|
|
1581
|
+
dialogFadeIn = keyframes({ ...fadeIn });
|
|
1582
|
+
dialogFadeOut = keyframes({ ...fadeOut });
|
|
1583
|
+
open() {
|
|
1584
|
+
this._dialog.removeAttribute('closing');
|
|
1585
|
+
this._dialog.showModal();
|
|
1586
|
+
this._show.set(true);
|
|
1587
|
+
this.showing.emit(true);
|
|
1588
|
+
}
|
|
1589
|
+
close() {
|
|
1590
|
+
this._dialog.setAttribute('closing', 'true');
|
|
1591
|
+
this._show.set(false);
|
|
1592
|
+
}
|
|
1593
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1594
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniDialogComponent, isStandalone: true, selector: "dialog[uni-dialog], Dialog", inputs: { show: { classPropertyName: "show", publicName: "show", isSignal: true, isRequired: false, transformFunction: null }, defaultCloseButton: { classPropertyName: "defaultCloseButton", publicName: "defaultCloseButton", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { showing: "showing" }, host: { listeners: { "click": "BackdropClick($event)", "animationend": "ClosingAnimation($event)" }, properties: { "class": "this.className" } }, providers: [{ provide: COMPONENT_NAME, useValue: 'dialog' }], usesInheritance: true, ngImport: i0, template: `
|
|
1595
|
+
@if (defaultCloseButton) {
|
|
1596
|
+
<button
|
|
1597
|
+
icon-button
|
|
1598
|
+
iconName="close"
|
|
1599
|
+
variant="ghost"
|
|
1600
|
+
(click)="close()"
|
|
1601
|
+
[class]="closeButton"
|
|
1602
|
+
size="md"
|
|
1603
|
+
>
|
|
1604
|
+
Close
|
|
1605
|
+
</button>
|
|
1606
|
+
}
|
|
1607
|
+
<ng-content></ng-content>
|
|
1608
|
+
`, isInline: true, dependencies: [{ kind: "component", type: UniIconButtonComponent, selector: "button[uni-icon-button], button[icon-button]", inputs: ["iconName", "symbolName", "variant", "size", "disable", "loading", "opticalSize"] }, { kind: "ngmodule", type: CommonModule }] });
|
|
1609
|
+
}
|
|
1610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDialogComponent, decorators: [{
|
|
1611
|
+
type: Component,
|
|
1612
|
+
args: [{
|
|
1613
|
+
selector: 'dialog[uni-dialog], Dialog',
|
|
1614
|
+
standalone: true,
|
|
1615
|
+
imports: [UniIconButtonComponent, CommonModule],
|
|
1616
|
+
template: `
|
|
1617
|
+
@if (defaultCloseButton) {
|
|
1618
|
+
<button
|
|
1619
|
+
icon-button
|
|
1620
|
+
iconName="close"
|
|
1621
|
+
variant="ghost"
|
|
1622
|
+
(click)="close()"
|
|
1623
|
+
[class]="closeButton"
|
|
1624
|
+
size="md"
|
|
1625
|
+
>
|
|
1626
|
+
Close
|
|
1627
|
+
</button>
|
|
1628
|
+
}
|
|
1629
|
+
<ng-content></ng-content>
|
|
1630
|
+
`,
|
|
1631
|
+
providers: [{ provide: COMPONENT_NAME, useValue: 'dialog' }],
|
|
1632
|
+
}]
|
|
1633
|
+
}], ctorParameters: () => [], propDecorators: { show: [{ type: i0.Input, args: [{ isSignal: true, alias: "show", required: false }] }], defaultCloseButton: [{
|
|
1634
|
+
type: Input
|
|
1635
|
+
}], showing: [{
|
|
1636
|
+
type: Output
|
|
1637
|
+
}], className: [{
|
|
1638
|
+
type: HostBinding,
|
|
1639
|
+
args: ['class']
|
|
1640
|
+
}], BackdropClick: [{
|
|
1641
|
+
type: HostListener,
|
|
1642
|
+
args: ['click', ['$event']]
|
|
1643
|
+
}], ClosingAnimation: [{
|
|
1644
|
+
type: HostListener,
|
|
1645
|
+
args: ['animationend', ['$event']]
|
|
1646
|
+
}] } });
|
|
1647
|
+
|
|
1648
|
+
class UniDialogButtonsComponent {
|
|
1649
|
+
dialog = inject(UniDialogComponent, {
|
|
1650
|
+
optional: true,
|
|
1651
|
+
host: true,
|
|
1652
|
+
skipSelf: true,
|
|
1653
|
+
});
|
|
1654
|
+
confirmButtonText;
|
|
1655
|
+
confirmButtonVariant = 'primary';
|
|
1656
|
+
cancelButtonText;
|
|
1657
|
+
disableConfirm;
|
|
1658
|
+
padding = 'md';
|
|
1659
|
+
paddingBottom = 'lg';
|
|
1660
|
+
justifyContent = 'center';
|
|
1661
|
+
confirmed = new EventEmitter();
|
|
1662
|
+
closeDialog() {
|
|
1663
|
+
this.dialog?.close();
|
|
1664
|
+
}
|
|
1665
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDialogButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1666
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: UniDialogButtonsComponent, isStandalone: true, selector: "uni-dialog-buttons, DialogButtons, div[dialog-buttons]", inputs: { confirmButtonText: "confirmButtonText", confirmButtonVariant: "confirmButtonVariant", cancelButtonText: "cancelButtonText", disableConfirm: "disableConfirm", padding: "padding", paddingBottom: "paddingBottom", justifyContent: "justifyContent" }, outputs: { confirmed: "confirmed" }, ngImport: i0, template: "<div\n row-layout\n gap=\"md\"\n [padding]=\"padding\"\n [paddingBottom]=\"paddingBottom\"\n [justifyContent]=\"justifyContent\"\n>\n <button\n text-button\n [variant]=\"confirmButtonVariant\"\n (click)=\"confirmed.emit(); closeDialog()\"\n [disable]=\"disableConfirm\"\n >\n {{ confirmButtonText || 'Confirm' }}\n </button>\n <button text-button variant=\"warn\" (click)=\"closeDialog()\">\n {{ cancelButtonText || 'Cancel' }}\n </button>\n</div>\n", dependencies: [{ kind: "component", type: UniRowComponent, selector: "div[uni-row-layout], Row, div[row-layout]", inputs: ["display", "flexDirection", "minWidth"] }, { kind: "component", type: UniButtonComponent, selector: "button[uni-text-button], Button, button[text-button]", inputs: ["disable", "loading", "fullWidth", "symbolLeft", "symbolRight"] }] });
|
|
1667
|
+
}
|
|
1668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDialogButtonsComponent, decorators: [{
|
|
1669
|
+
type: Component,
|
|
1670
|
+
args: [{ selector: 'uni-dialog-buttons, DialogButtons, div[dialog-buttons]', standalone: true, imports: [UniRowComponent, UniButtonComponent], template: "<div\n row-layout\n gap=\"md\"\n [padding]=\"padding\"\n [paddingBottom]=\"paddingBottom\"\n [justifyContent]=\"justifyContent\"\n>\n <button\n text-button\n [variant]=\"confirmButtonVariant\"\n (click)=\"confirmed.emit(); closeDialog()\"\n [disable]=\"disableConfirm\"\n >\n {{ confirmButtonText || 'Confirm' }}\n </button>\n <button text-button variant=\"warn\" (click)=\"closeDialog()\">\n {{ cancelButtonText || 'Cancel' }}\n </button>\n</div>\n" }]
|
|
1671
|
+
}], propDecorators: { confirmButtonText: [{
|
|
1672
|
+
type: Input
|
|
1673
|
+
}], confirmButtonVariant: [{
|
|
1674
|
+
type: Input
|
|
1675
|
+
}], cancelButtonText: [{
|
|
1676
|
+
type: Input
|
|
1677
|
+
}], disableConfirm: [{
|
|
1678
|
+
type: Input
|
|
1679
|
+
}], padding: [{
|
|
1680
|
+
type: Input
|
|
1681
|
+
}], paddingBottom: [{
|
|
1682
|
+
type: Input
|
|
1683
|
+
}], justifyContent: [{
|
|
1684
|
+
type: Input
|
|
1685
|
+
}], confirmed: [{
|
|
1686
|
+
type: Output
|
|
1687
|
+
}] } });
|
|
1688
|
+
|
|
1689
|
+
class UniDialogHeaderComponent extends BaseComponent {
|
|
1690
|
+
dialog = inject(UniDialogComponent, {
|
|
1691
|
+
optional: true,
|
|
1692
|
+
host: true,
|
|
1693
|
+
skipSelf: true,
|
|
1694
|
+
});
|
|
1695
|
+
closeDialog() {
|
|
1696
|
+
this.dialog?.close();
|
|
1697
|
+
}
|
|
1698
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDialogHeaderComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1699
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.12", type: UniDialogHeaderComponent, isStandalone: true, selector: "div[uni-dialog-header], DialogHeader", providers: [{ provide: COMPONENT_NAME, useValue: 'dialogHeader' }], usesInheritance: true, ngImport: i0, template: "<div\n row-layout\n [color]=\"componentOptions().color\"\n [borderRadius]=\"componentOptions().borderRadius\"\n [height]=\"componentOptions().height\"\n alignItems=\"center\"\n paddingHorizontal=\"sm\"\n>\n <Box [width]=\"26\"></Box>\n <Box [grow]=\"1\">\n <Text\n [typeface]=\"componentOptions().textRole\"\n [color]=\"componentOptions().textColor\"\n display=\"block\"\n [align]=\"componentOptions().textAlign || 'center'\"\n ><ng-content></ng-content\n ></Text>\n </Box>\n <button\n icon-button\n [iconName]=\"componentOptions().closeButtonIcon\"\n [symbolName]=\"componentOptions().closeButtonSymbol\"\n variant=\"ghost\"\n (click)=\"closeDialog()\"\n [size]=\"componentOptions().closeButtonSize || 'md'\"\n >\n Close\n </button>\n</div>\n", dependencies: [{ kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "component", type: UniIconButtonComponent, selector: "button[uni-icon-button], button[icon-button]", inputs: ["iconName", "symbolName", "variant", "size", "disable", "loading", "opticalSize"] }, { kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniRowComponent, selector: "div[uni-row-layout], Row, div[row-layout]", inputs: ["display", "flexDirection", "minWidth"] }] });
|
|
1700
|
+
}
|
|
1701
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDialogHeaderComponent, decorators: [{
|
|
1702
|
+
type: Component,
|
|
1703
|
+
args: [{ selector: 'div[uni-dialog-header], DialogHeader', standalone: true, imports: [UniBoxComponent, UniIconButtonComponent, UniTextComponent, UniRowComponent], providers: [{ provide: COMPONENT_NAME, useValue: 'dialogHeader' }], template: "<div\n row-layout\n [color]=\"componentOptions().color\"\n [borderRadius]=\"componentOptions().borderRadius\"\n [height]=\"componentOptions().height\"\n alignItems=\"center\"\n paddingHorizontal=\"sm\"\n>\n <Box [width]=\"26\"></Box>\n <Box [grow]=\"1\">\n <Text\n [typeface]=\"componentOptions().textRole\"\n [color]=\"componentOptions().textColor\"\n display=\"block\"\n [align]=\"componentOptions().textAlign || 'center'\"\n ><ng-content></ng-content\n ></Text>\n </Box>\n <button\n icon-button\n [iconName]=\"componentOptions().closeButtonIcon\"\n [symbolName]=\"componentOptions().closeButtonSymbol\"\n variant=\"ghost\"\n (click)=\"closeDialog()\"\n [size]=\"componentOptions().closeButtonSize || 'md'\"\n >\n Close\n </button>\n</div>\n" }]
|
|
1704
|
+
}] });
|
|
1705
|
+
|
|
1706
|
+
class UniDividerComponent {
|
|
1707
|
+
themeService = inject(ThemeService);
|
|
1708
|
+
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
1709
|
+
border = input('primary', ...(ngDevMode ? [{ debugName: "border" }] : /* istanbul ignore next */ []));
|
|
1710
|
+
get className() {
|
|
1711
|
+
return css([
|
|
1712
|
+
{
|
|
1713
|
+
display: 'block',
|
|
1714
|
+
},
|
|
1715
|
+
this.orientation() === 'horizontal' && {
|
|
1716
|
+
...this.themeService.borderBottom(this.border()),
|
|
1717
|
+
width: '100%',
|
|
1718
|
+
},
|
|
1719
|
+
this.orientation() === 'vertical' && {
|
|
1720
|
+
...this.themeService.borderLeft(this.border()),
|
|
1721
|
+
height: '100%',
|
|
1722
|
+
},
|
|
1723
|
+
]);
|
|
1724
|
+
}
|
|
1725
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1726
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniDividerComponent, isStandalone: true, selector: "uni-divider, Divider", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, border: { classPropertyName: "border", publicName: "border", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: ``, isInline: true });
|
|
1727
|
+
}
|
|
1728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDividerComponent, decorators: [{
|
|
1729
|
+
type: Component,
|
|
1730
|
+
args: [{
|
|
1731
|
+
selector: 'uni-divider, Divider',
|
|
1732
|
+
standalone: true,
|
|
1733
|
+
imports: [],
|
|
1734
|
+
template: ``,
|
|
1735
|
+
}]
|
|
1736
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], border: [{ type: i0.Input, args: [{ isSignal: true, alias: "border", required: false }] }], className: [{
|
|
1737
|
+
type: HostBinding,
|
|
1738
|
+
args: ['class']
|
|
1739
|
+
}] } });
|
|
1740
|
+
|
|
1741
|
+
class UniDropdownComponent extends BaseComponent {
|
|
1742
|
+
renderer = inject(Renderer2);
|
|
1743
|
+
cleanupAutoUpdate;
|
|
1744
|
+
delay = 100;
|
|
1745
|
+
// Reactively track visibility status using Signals
|
|
1746
|
+
showing = signal(false, ...(ngDevMode ? [{ debugName: "showing" }] : /* istanbul ignore next */ []));
|
|
1747
|
+
trigger = input.required(...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
1748
|
+
placement = input('bottom-start', ...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
1749
|
+
offset = input({ mainAxis: 4, alignmentAxis: 12 }, ...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
1750
|
+
paddingVertical = input(...(ngDevMode ? [undefined, { debugName: "paddingVertical" }] : /* istanbul ignore next */ []));
|
|
1751
|
+
paddingHorizontal = input(...(ngDevMode ? [undefined, { debugName: "paddingHorizontal" }] : /* istanbul ignore next */ []));
|
|
1752
|
+
dropdownShowing = output();
|
|
1753
|
+
dropdownHiding = output();
|
|
1754
|
+
dropdownRef;
|
|
1755
|
+
get _trigger() {
|
|
1756
|
+
return this.trigger();
|
|
1757
|
+
}
|
|
1758
|
+
get _dropdown() {
|
|
1759
|
+
return this.dropdownRef.nativeElement;
|
|
1760
|
+
}
|
|
1761
|
+
transformOriginMap = {
|
|
1762
|
+
top: 'bottom center',
|
|
1763
|
+
right: 'center left',
|
|
1764
|
+
bottom: 'top center',
|
|
1765
|
+
left: 'center right',
|
|
1766
|
+
'top-start': 'bottom left',
|
|
1767
|
+
'top-end': 'bottom right',
|
|
1768
|
+
'right-start': 'top left',
|
|
1769
|
+
'right-end': 'bottom left',
|
|
1770
|
+
'bottom-start': 'top left',
|
|
1771
|
+
'bottom-end': 'top right',
|
|
1772
|
+
'left-start': 'top right',
|
|
1773
|
+
'left-end': 'bottom right',
|
|
1774
|
+
};
|
|
1775
|
+
dropdownClass = computed(() => {
|
|
1776
|
+
const currentPlacement = this.placement();
|
|
1777
|
+
return css([
|
|
1778
|
+
{
|
|
1779
|
+
// Reset browser agent default popover styles
|
|
1780
|
+
border: 'none',
|
|
1781
|
+
background: 'transparent',
|
|
1782
|
+
margin: 0,
|
|
1783
|
+
padding: 0,
|
|
1784
|
+
overflow: 'visible',
|
|
1785
|
+
width: 'max-content',
|
|
1786
|
+
position: 'absolute',
|
|
1787
|
+
top: 0,
|
|
1788
|
+
left: 0,
|
|
1789
|
+
zIndex: 1,
|
|
1790
|
+
// 2. Animate discrete properties across top layer layout contexts
|
|
1791
|
+
transitionProperty: 'transform, opacity, display, overlay',
|
|
1792
|
+
transitionDuration: `${this.delay}ms`,
|
|
1793
|
+
transitionTimingFunction: 'linear',
|
|
1794
|
+
transitionBehavior: 'allow-discrete',
|
|
1795
|
+
// Hidden State (Closed)
|
|
1796
|
+
opacity: 0,
|
|
1797
|
+
transform: 'scale(0.8)',
|
|
1798
|
+
transformOrigin: this.transformOriginMap[currentPlacement],
|
|
1799
|
+
// 3. Active state styling controlled via the native browser pseudo-class
|
|
1800
|
+
['&:popover-open']: {
|
|
1801
|
+
opacity: 1,
|
|
1802
|
+
transform: 'scale(1)',
|
|
1803
|
+
},
|
|
1804
|
+
// 4. Starting-style rules what properties animate *from* when transitioning in
|
|
1805
|
+
['@starting-style']: {
|
|
1806
|
+
['&:popover-open']: {
|
|
1807
|
+
opacity: 0,
|
|
1808
|
+
transform: 'scale(0.8)',
|
|
1809
|
+
},
|
|
1810
|
+
},
|
|
1811
|
+
},
|
|
1812
|
+
]);
|
|
1813
|
+
}, ...(ngDevMode ? [{ debugName: "dropdownClass" }] : /* istanbul ignore next */ []));
|
|
1814
|
+
ngOnInit() {
|
|
1815
|
+
// Single native click binding to manage open/close commands
|
|
1816
|
+
this.renderer.listen(this._trigger, 'click', (e) => {
|
|
1817
|
+
e.stopPropagation();
|
|
1818
|
+
this.toggleDropdown();
|
|
1819
|
+
});
|
|
1820
|
+
// Sync state if user invokes light-dismiss via outside click or Escape key
|
|
1821
|
+
this.renderer.listen(this._dropdown, 'toggle', (event) => {
|
|
1822
|
+
const isOpened = event.newState === 'open';
|
|
1823
|
+
this.showing.set(isOpened);
|
|
1824
|
+
if (isOpened) {
|
|
1825
|
+
this.dropdownShowing.emit(true);
|
|
1826
|
+
this.cleanupAutoUpdate = autoUpdate(this._trigger, this._dropdown, () => this.updatePosition());
|
|
1827
|
+
}
|
|
1828
|
+
else {
|
|
1829
|
+
this.dropdownHiding.emit(true);
|
|
1830
|
+
if (this.cleanupAutoUpdate) {
|
|
1831
|
+
this.cleanupAutoUpdate();
|
|
1832
|
+
this.cleanupAutoUpdate = undefined;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
toggleDropdown() {
|
|
1838
|
+
if (this.showing()) {
|
|
1839
|
+
this._dropdown.hidePopover();
|
|
1840
|
+
}
|
|
1841
|
+
else {
|
|
1842
|
+
this._dropdown.showPopover();
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
hideDropdown() {
|
|
1846
|
+
this._dropdown.hidePopover();
|
|
1847
|
+
}
|
|
1848
|
+
async updatePosition() {
|
|
1849
|
+
const { x, y } = await computePosition(this._trigger, this._dropdown, {
|
|
1850
|
+
placement: this.placement(),
|
|
1851
|
+
middleware: [offset(this.offset()), shift({ padding: 5 })],
|
|
1852
|
+
});
|
|
1853
|
+
this.renderer.setStyle(this._dropdown, 'left', `${x}px`);
|
|
1854
|
+
this.renderer.setStyle(this._dropdown, 'top', `${y}px`);
|
|
1855
|
+
}
|
|
1856
|
+
ngOnDestroy() {
|
|
1857
|
+
if (this.cleanupAutoUpdate)
|
|
1858
|
+
this.cleanupAutoUpdate();
|
|
1859
|
+
try {
|
|
1860
|
+
this._dropdown.hidePopover();
|
|
1861
|
+
}
|
|
1862
|
+
catch { }
|
|
1863
|
+
}
|
|
1864
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1865
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniDropdownComponent, isStandalone: true, selector: "uni-dropdown, Dropdown", inputs: { trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: true, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, paddingVertical: { classPropertyName: "paddingVertical", publicName: "paddingVertical", isSignal: true, isRequired: false, transformFunction: null }, paddingHorizontal: { classPropertyName: "paddingHorizontal", publicName: "paddingHorizontal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dropdownShowing: "dropdownShowing", dropdownHiding: "dropdownHiding" }, providers: [{ provide: COMPONENT_NAME, useValue: 'dropdown' }], viewQueries: [{ propertyName: "dropdownRef", first: true, predicate: ["dropdown"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1866
|
+
<!-- 1. The native 'popover' attribute brings it to the top layer with native light-dismiss -->
|
|
1867
|
+
<div #dropdown popover="auto" [class]="dropdownClass()">
|
|
1868
|
+
<div
|
|
1869
|
+
box-layout
|
|
1870
|
+
[border]="componentOptions().border"
|
|
1871
|
+
[borderRadius]="componentOptions().borderRadius"
|
|
1872
|
+
[paddingVertical]="paddingVertical()"
|
|
1873
|
+
[paddingHorizontal]="paddingHorizontal()"
|
|
1874
|
+
[color]="componentOptions().color"
|
|
1875
|
+
[shadow]="componentOptions().shadow"
|
|
1876
|
+
>
|
|
1877
|
+
<ng-content></ng-content>
|
|
1878
|
+
</div>
|
|
1879
|
+
</div>
|
|
1880
|
+
`, isInline: true, dependencies: [{ kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }] });
|
|
1881
|
+
}
|
|
1882
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniDropdownComponent, decorators: [{
|
|
1883
|
+
type: Component,
|
|
1884
|
+
args: [{
|
|
1885
|
+
selector: 'uni-dropdown, Dropdown',
|
|
1886
|
+
standalone: true,
|
|
1887
|
+
imports: [UniBoxComponent],
|
|
1888
|
+
template: `
|
|
1889
|
+
<!-- 1. The native 'popover' attribute brings it to the top layer with native light-dismiss -->
|
|
1890
|
+
<div #dropdown popover="auto" [class]="dropdownClass()">
|
|
1891
|
+
<div
|
|
1892
|
+
box-layout
|
|
1893
|
+
[border]="componentOptions().border"
|
|
1894
|
+
[borderRadius]="componentOptions().borderRadius"
|
|
1895
|
+
[paddingVertical]="paddingVertical()"
|
|
1896
|
+
[paddingHorizontal]="paddingHorizontal()"
|
|
1897
|
+
[color]="componentOptions().color"
|
|
1898
|
+
[shadow]="componentOptions().shadow"
|
|
1899
|
+
>
|
|
1900
|
+
<ng-content></ng-content>
|
|
1901
|
+
</div>
|
|
1902
|
+
</div>
|
|
1903
|
+
`,
|
|
1904
|
+
providers: [{ provide: COMPONENT_NAME, useValue: 'dropdown' }],
|
|
1905
|
+
}]
|
|
1906
|
+
}], propDecorators: { trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], paddingVertical: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingVertical", required: false }] }], paddingHorizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingHorizontal", required: false }] }], dropdownShowing: [{ type: i0.Output, args: ["dropdownShowing"] }], dropdownHiding: [{ type: i0.Output, args: ["dropdownHiding"] }], dropdownRef: [{
|
|
1907
|
+
type: ViewChild,
|
|
1908
|
+
args: ['dropdown', { static: true }]
|
|
1909
|
+
}] } });
|
|
1910
|
+
|
|
1911
|
+
class UniMenuItemComponent extends UniBoxComponent {
|
|
1912
|
+
_elementRef = inject(ElementRef);
|
|
1913
|
+
display = input('flex', ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
1914
|
+
flexDirection = input('row', ...(ngDevMode ? [{ debugName: "flexDirection" }] : /* istanbul ignore next */ []));
|
|
1915
|
+
alignItems = input('center', ...(ngDevMode ? [{ debugName: "alignItems" }] : /* istanbul ignore next */ []));
|
|
1916
|
+
paddingHorizontal = input('md', ...(ngDevMode ? [{ debugName: "paddingHorizontal" }] : /* istanbul ignore next */ []));
|
|
1917
|
+
gap = input('md', ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
1918
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1919
|
+
template = input(...(ngDevMode ? [undefined, { debugName: "template" }] : /* istanbul ignore next */ []));
|
|
1920
|
+
context = input(...(ngDevMode ? [undefined, { debugName: "context" }] : /* istanbul ignore next */ []));
|
|
1921
|
+
symbolName = input(...(ngDevMode ? [undefined, { debugName: "symbolName" }] : /* istanbul ignore next */ []));
|
|
1922
|
+
active = input(...(ngDevMode ? [undefined, { debugName: "active" }] : /* istanbul ignore next */ []));
|
|
1923
|
+
hoverColor = input('primary-container', ...(ngDevMode ? [{ debugName: "hoverColor" }] : /* istanbul ignore next */ []));
|
|
1924
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1925
|
+
get className() {
|
|
1926
|
+
return css([
|
|
1927
|
+
{
|
|
1928
|
+
cursor: 'pointer',
|
|
1929
|
+
transition: 'all 0.35s ease',
|
|
1930
|
+
height: 38,
|
|
1931
|
+
'&:hover': {
|
|
1932
|
+
...this.theme.colorPair(this.hoverColor()),
|
|
1933
|
+
},
|
|
1934
|
+
},
|
|
1935
|
+
]);
|
|
1936
|
+
}
|
|
1937
|
+
focus() {
|
|
1938
|
+
this._elementRef.nativeElement.focus();
|
|
1939
|
+
}
|
|
1940
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1941
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniMenuItemComponent, isStandalone: true, selector: "div[uni-menu-item], div[menu-item]", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, flexDirection: { classPropertyName: "flexDirection", publicName: "flexDirection", isSignal: true, isRequired: false, transformFunction: null }, alignItems: { classPropertyName: "alignItems", publicName: "alignItems", isSignal: true, isRequired: false, transformFunction: null }, paddingHorizontal: { classPropertyName: "paddingHorizontal", publicName: "paddingHorizontal", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null }, symbolName: { classPropertyName: "symbolName", publicName: "symbolName", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, hoverColor: { classPropertyName: "hoverColor", publicName: "hoverColor", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, usesInheritance: true, ngImport: i0, template: "@let tpl = template();\n@let symbol = symbolName();\n@if (symbol) {\n <Symbol [name]=\"symbol\"></Symbol>\n}\n<div box-layout [grow]=\"1\">\n @if (tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"context()\"\n ></ng-container>\n } @else {\n <Text role=\"label\" display=\"block\" [nowrap]=\"true\">\n {{ label() }}\n </Text>\n }\n</div>\n@if (active()) {\n <Symbol name=\"check\"></Symbol>\n}\n", styles: [":host:focus{background:#ccc;color:#fff}:host.disabled{color:#ddd;pointer-events:none}\n"], dependencies: [{ kind: "component", type: UniTextComponent, selector: "uni-text, Text", inputs: ["typeface", "color", "display", "align", "nowrap", "maxWidth", "ellipsis"] }, { kind: "component", type: UniSymbolComponent, selector: "uni-symbol, Symbol", inputs: ["name", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: UniBoxComponent, selector: "div[uni-box-layout], Box, div[box-layout]", inputs: ["color", "backgroundColor", "borderRadius", "borderRadiusLeft", "borderRadiusRight", "borderRadiusTop", "borderRadiusBottom", "padding", "paddingHorizontal", "paddingVertical", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "dashBorder", "alignSelf", "alignItems", "alignContent", "justifyContent", "grow", "display", "position", "inset", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "ignoreDir", "gridArea", "gridColumn", "gridRow", "overflow", "elevation", "shadow", "gap", "fullWidth", "fullHeight", "flexDirection", "textAlign", "wrapItems", "zIndex"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1942
|
+
}
|
|
1943
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuItemComponent, decorators: [{
|
|
1944
|
+
type: Component,
|
|
1945
|
+
args: [{ selector: 'div[uni-menu-item], div[menu-item]', standalone: true, imports: [UniTextComponent, UniSymbolComponent, UniBoxComponent, NgTemplateOutlet], template: "@let tpl = template();\n@let symbol = symbolName();\n@if (symbol) {\n <Symbol [name]=\"symbol\"></Symbol>\n}\n<div box-layout [grow]=\"1\">\n @if (tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"context()\"\n ></ng-container>\n } @else {\n <Text role=\"label\" display=\"block\" [nowrap]=\"true\">\n {{ label() }}\n </Text>\n }\n</div>\n@if (active()) {\n <Symbol name=\"check\"></Symbol>\n}\n", styles: [":host:focus{background:#ccc;color:#fff}:host.disabled{color:#ddd;pointer-events:none}\n"] }]
|
|
1946
|
+
}], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], flexDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "flexDirection", required: false }] }], alignItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignItems", required: false }] }], paddingHorizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "paddingHorizontal", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }], symbolName: [{ type: i0.Input, args: [{ isSignal: true, alias: "symbolName", required: false }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], hoverColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoverColor", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], className: [{
|
|
1947
|
+
type: HostBinding,
|
|
1948
|
+
args: ['class']
|
|
1949
|
+
}] } });
|
|
1950
|
+
|
|
1951
|
+
class UniMenuComponent {
|
|
1952
|
+
cdr = inject(ChangeDetectorRef);
|
|
1953
|
+
// Modern Signal Inputs for perfect Zoneless tracking
|
|
1954
|
+
menuItems = input.required(...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
|
|
1955
|
+
activeItem = input(...(ngDevMode ? [undefined, { debugName: "activeItem" }] : /* istanbul ignore next */ []));
|
|
1956
|
+
placement = input('bottom-start', ...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
1957
|
+
// Modern Signal Output
|
|
1958
|
+
menuItemClicked = output();
|
|
1959
|
+
TriggerClassName = css({ display: 'inline-block' });
|
|
1960
|
+
get className() {
|
|
1961
|
+
return css({
|
|
1962
|
+
margin: 'unset',
|
|
1963
|
+
padding: 'unset',
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
handleMenuItemClick(item, dropdown) {
|
|
1967
|
+
if (item.action) {
|
|
1968
|
+
item.action();
|
|
1969
|
+
}
|
|
1970
|
+
this.menuItemClicked.emit(item);
|
|
1971
|
+
dropdown.hideDropdown();
|
|
1972
|
+
// Explicitly request a render tick if item.action() updated any internal state
|
|
1973
|
+
this.cdr.markForCheck();
|
|
1974
|
+
}
|
|
1975
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1976
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: UniMenuComponent, isStandalone: true, selector: "Menu, uni-menu", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, activeItem: { classPropertyName: "activeItem", publicName: "activeItem", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { menuItemClicked: "menuItemClicked" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: `
|
|
1977
|
+
<div #trigger [class]="TriggerClassName">
|
|
1978
|
+
<ng-content></ng-content>
|
|
1979
|
+
</div>
|
|
1980
|
+
|
|
1981
|
+
@if (menuItems()) {
|
|
1982
|
+
<Dropdown [trigger]="trigger" [placement]="placement()" paddingVertical="xs" #dropdown>
|
|
1983
|
+
@for (item of menuItems(); track item) {
|
|
1984
|
+
<div
|
|
1985
|
+
menu-item
|
|
1986
|
+
[label]="item.label"
|
|
1987
|
+
[symbolName]="item.symbolName"
|
|
1988
|
+
[active]="activeItem() === item"
|
|
1989
|
+
[template]="item.template"
|
|
1990
|
+
[context]="item.context"
|
|
1991
|
+
(click)="handleMenuItemClick(item, dropdown)"
|
|
1992
|
+
></div>
|
|
1993
|
+
}
|
|
1994
|
+
</Dropdown>
|
|
1995
|
+
}
|
|
1996
|
+
`, isInline: true, dependencies: [{ kind: "component", type: UniMenuItemComponent, selector: "div[uni-menu-item], div[menu-item]", inputs: ["display", "flexDirection", "alignItems", "paddingHorizontal", "gap", "label", "template", "context", "symbolName", "active", "hoverColor", "disabled"] }, { kind: "component", type: UniDropdownComponent, selector: "uni-dropdown, Dropdown", inputs: ["trigger", "placement", "offset", "paddingVertical", "paddingHorizontal"], outputs: ["dropdownShowing", "dropdownHiding"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1997
|
+
}
|
|
1998
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniMenuComponent, decorators: [{
|
|
1999
|
+
type: Component,
|
|
2000
|
+
args: [{
|
|
2001
|
+
selector: 'Menu, uni-menu',
|
|
2002
|
+
standalone: true,
|
|
2003
|
+
imports: [UniMenuItemComponent, UniDropdownComponent],
|
|
2004
|
+
changeDetection: ChangeDetectionStrategy.OnPush, // Crucial for zoneless
|
|
2005
|
+
template: `
|
|
2006
|
+
<div #trigger [class]="TriggerClassName">
|
|
2007
|
+
<ng-content></ng-content>
|
|
2008
|
+
</div>
|
|
2009
|
+
|
|
2010
|
+
@if (menuItems()) {
|
|
2011
|
+
<Dropdown [trigger]="trigger" [placement]="placement()" paddingVertical="xs" #dropdown>
|
|
2012
|
+
@for (item of menuItems(); track item) {
|
|
2013
|
+
<div
|
|
2014
|
+
menu-item
|
|
2015
|
+
[label]="item.label"
|
|
2016
|
+
[symbolName]="item.symbolName"
|
|
2017
|
+
[active]="activeItem() === item"
|
|
2018
|
+
[template]="item.template"
|
|
2019
|
+
[context]="item.context"
|
|
2020
|
+
(click)="handleMenuItemClick(item, dropdown)"
|
|
2021
|
+
></div>
|
|
2022
|
+
}
|
|
2023
|
+
</Dropdown>
|
|
2024
|
+
}
|
|
2025
|
+
`,
|
|
2026
|
+
}]
|
|
2027
|
+
}], propDecorators: { menuItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuItems", required: true }] }], activeItem: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeItem", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], menuItemClicked: [{ type: i0.Output, args: ["menuItemClicked"] }], className: [{
|
|
2028
|
+
type: HostBinding,
|
|
2029
|
+
args: ['class']
|
|
2030
|
+
}] } });
|
|
2031
|
+
|
|
2032
|
+
class UniTooltipComponent extends BaseComponent {
|
|
2033
|
+
elRef = inject(ElementRef);
|
|
2034
|
+
renderer = inject(Renderer2);
|
|
2035
|
+
timer = useTimer();
|
|
2036
|
+
hoverDelayMs = signal(500, ...(ngDevMode ? [{ debugName: "hoverDelayMs" }] : /* istanbul ignore next */ []));
|
|
2037
|
+
isMouseInside = signal(false, ...(ngDevMode ? [{ debugName: "isMouseInside" }] : /* istanbul ignore next */ []));
|
|
2038
|
+
tooltip;
|
|
2039
|
+
arrow;
|
|
2040
|
+
hoverDelay = input(500, ...(ngDevMode ? [{ debugName: "hoverDelay" }] : /* istanbul ignore next */ []));
|
|
2041
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2042
|
+
placement = input('top', ...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
2043
|
+
inlineText = input(false, ...(ngDevMode ? [{ debugName: "inlineText" }] : /* istanbul ignore next */ []));
|
|
2044
|
+
appendToBody;
|
|
2045
|
+
constructor() {
|
|
2046
|
+
super();
|
|
2047
|
+
effect(() => {
|
|
2048
|
+
const timerActive = this.timer.isActive();
|
|
2049
|
+
const mouseInside = this.isMouseInside();
|
|
2050
|
+
// If the timer finished and the mouse is still inside, show tooltip
|
|
2051
|
+
if (!timerActive && mouseInside) {
|
|
2052
|
+
this.showTooltip();
|
|
2053
|
+
}
|
|
2054
|
+
// If the mouse left and the timer is not running, hide tooltip
|
|
2055
|
+
else if (!mouseInside) {
|
|
2056
|
+
this.hideTooltip();
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
toggleTooltip() {
|
|
2061
|
+
if (this.tooltip) {
|
|
2062
|
+
this.hideTooltip();
|
|
2063
|
+
}
|
|
2064
|
+
else {
|
|
2065
|
+
this.showTooltip();
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
mouseenter() {
|
|
2069
|
+
this.isMouseInside.set(true);
|
|
2070
|
+
this.timer.start(this.hoverDelayMs());
|
|
2071
|
+
}
|
|
2072
|
+
mouseleave() {
|
|
2073
|
+
this.isMouseInside.set(false);
|
|
2074
|
+
this.timer.stop();
|
|
2075
|
+
}
|
|
2076
|
+
showTooltip() {
|
|
2077
|
+
if (this.tooltip)
|
|
2078
|
+
return;
|
|
2079
|
+
this.initializeTooltip();
|
|
2080
|
+
this.renderer.setAttribute(this.tooltip, 'fade', 'in');
|
|
2081
|
+
}
|
|
2082
|
+
hideTooltip() {
|
|
2083
|
+
if (!this.tooltip)
|
|
2084
|
+
return;
|
|
2085
|
+
this.renderer.setAttribute(this.tooltip, 'fade', 'out');
|
|
2086
|
+
}
|
|
2087
|
+
get className() {
|
|
2088
|
+
return css({
|
|
2089
|
+
display: 'inline-flex',
|
|
2090
|
+
}, this.inlineText() && {
|
|
2091
|
+
cursor: 'help',
|
|
2092
|
+
textDecoration: 'underline',
|
|
2093
|
+
textDecorationStyle: 'dotted',
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
tooltipFadeIn = keyframes({ ...fadeIn });
|
|
2097
|
+
tooltipFadeOut = keyframes({ ...fadeOut });
|
|
2098
|
+
tooltipClassName = css([
|
|
2099
|
+
{
|
|
2100
|
+
...this.theme.colorPair(this.componentOptions().color),
|
|
2101
|
+
...this.theme.radius(this.componentOptions().borderRadius),
|
|
2102
|
+
...this.theme.boxShadow(this.componentOptions().shadow),
|
|
2103
|
+
...this.theme.typeface(this.componentOptions().typeface),
|
|
2104
|
+
padding: 5,
|
|
2105
|
+
width: 'max-content',
|
|
2106
|
+
position: 'absolute',
|
|
2107
|
+
top: 0,
|
|
2108
|
+
left: 0,
|
|
2109
|
+
zIndex: Z_INDEX.tooltip,
|
|
2110
|
+
'&[fade="in"]': {
|
|
2111
|
+
animation: `${this.tooltipFadeIn} ease-in 350ms`,
|
|
2112
|
+
},
|
|
2113
|
+
'&[fade="out"]': {
|
|
2114
|
+
animation: `${this.tooltipFadeOut} ease-in 350ms`,
|
|
2115
|
+
},
|
|
2116
|
+
},
|
|
2117
|
+
]);
|
|
2118
|
+
arrowClassName = css({
|
|
2119
|
+
position: 'absolute',
|
|
2120
|
+
...this.theme.colorPair(this.componentOptions().color),
|
|
2121
|
+
width: 8,
|
|
2122
|
+
height: 8,
|
|
2123
|
+
transform: 'rotate(45deg)',
|
|
2124
|
+
});
|
|
2125
|
+
createTooltip() {
|
|
2126
|
+
this.tooltip = this.renderer.createElement('span');
|
|
2127
|
+
this.renderer.appendChild(this.tooltip, this.renderer.createText(this.label()) // textNode
|
|
2128
|
+
);
|
|
2129
|
+
this.renderer.appendChild(this.appendToBody ? document.body : this.elRef.nativeElement, this.tooltip);
|
|
2130
|
+
this.renderer.addClass(this.tooltip, this.tooltipClassName);
|
|
2131
|
+
this.renderer.listen(this.tooltip, 'animationend', (event) => {
|
|
2132
|
+
if (event.animationName.includes(this.tooltipFadeOut))
|
|
2133
|
+
this.destroyTooltip();
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
createArrow() {
|
|
2137
|
+
this.arrow = this.renderer.createElement('div');
|
|
2138
|
+
this.renderer.appendChild(this.tooltip, this.arrow);
|
|
2139
|
+
this.renderer.addClass(this.arrow, this.arrowClassName);
|
|
2140
|
+
}
|
|
2141
|
+
setPosition() {
|
|
2142
|
+
if (!this.tooltip || !this.arrow)
|
|
2143
|
+
return;
|
|
2144
|
+
computePosition(this.elRef.nativeElement, this.tooltip, {
|
|
2145
|
+
placement: this.placement(),
|
|
2146
|
+
middleware: [offset(6), flip(), shift({ padding: 5 }), arrow({ element: this.arrow })],
|
|
2147
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
2148
|
+
this.renderer.setStyle(this.tooltip, 'top', `${y}px`);
|
|
2149
|
+
this.renderer.setStyle(this.tooltip, 'left', `${x}px`);
|
|
2150
|
+
// Accessing the data
|
|
2151
|
+
const arrowX = middlewareData.arrow?.x;
|
|
2152
|
+
const arrowY = middlewareData.arrow?.y;
|
|
2153
|
+
const staticSide = {
|
|
2154
|
+
top: 'bottom',
|
|
2155
|
+
right: 'left',
|
|
2156
|
+
bottom: 'top',
|
|
2157
|
+
left: 'right',
|
|
2158
|
+
}[placement.split('-')[0]];
|
|
2159
|
+
this.renderer.setStyle(this.arrow, 'top', `${arrowY}px`);
|
|
2160
|
+
this.renderer.setStyle(this.arrow, 'left', `${arrowX}px`);
|
|
2161
|
+
this.renderer.setStyle(this.arrow, 'right', ``);
|
|
2162
|
+
this.renderer.setStyle(this.arrow, 'bottom', ``);
|
|
2163
|
+
if (staticSide) {
|
|
2164
|
+
this.renderer.setStyle(this.arrow, staticSide, `-4px`);
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
initializeTooltip() {
|
|
2169
|
+
this.createTooltip();
|
|
2170
|
+
this.createArrow();
|
|
2171
|
+
this.setPosition();
|
|
2172
|
+
}
|
|
2173
|
+
destroyTooltip() {
|
|
2174
|
+
this.renderer.removeChild(this.appendToBody ? document.body : this.elRef.nativeElement, this.tooltip);
|
|
2175
|
+
this.renderer.removeChild(this.appendToBody ? document.body : this.elRef.nativeElement, this.arrow);
|
|
2176
|
+
this.tooltip = null;
|
|
2177
|
+
this.arrow = null;
|
|
2178
|
+
}
|
|
2179
|
+
ngOnDestroy() {
|
|
2180
|
+
this.hideTooltip();
|
|
2181
|
+
}
|
|
2182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniTooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2183
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.12", type: UniTooltipComponent, isStandalone: true, selector: "uni-tooltip, Tooltip", inputs: { hoverDelay: { classPropertyName: "hoverDelay", publicName: "hoverDelay", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, inlineText: { classPropertyName: "inlineText", publicName: "inlineText", isSignal: true, isRequired: false, transformFunction: null }, appendToBody: { classPropertyName: "appendToBody", publicName: "appendToBody", isSignal: false, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "toggleTooltip()", "mouseenter": "mouseenter()", "mouseleave": "mouseleave()" }, properties: { "class": "this.className" } }, providers: [{ provide: COMPONENT_NAME, useValue: 'tooltip' }], usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
2184
|
+
}
|
|
2185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: UniTooltipComponent, decorators: [{
|
|
2186
|
+
type: Component,
|
|
2187
|
+
args: [{
|
|
2188
|
+
selector: 'uni-tooltip, Tooltip',
|
|
2189
|
+
standalone: true,
|
|
2190
|
+
imports: [],
|
|
2191
|
+
template: `<ng-content></ng-content>`,
|
|
2192
|
+
providers: [{ provide: COMPONENT_NAME, useValue: 'tooltip' }],
|
|
2193
|
+
host: {
|
|
2194
|
+
'(click)': 'toggleTooltip()',
|
|
2195
|
+
'(mouseenter)': 'mouseenter()',
|
|
2196
|
+
'(mouseleave)': 'mouseleave()',
|
|
2197
|
+
},
|
|
2198
|
+
}]
|
|
2199
|
+
}], ctorParameters: () => [], propDecorators: { hoverDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoverDelay", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], inlineText: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineText", required: false }] }], appendToBody: [{
|
|
24
2200
|
type: Input
|
|
2201
|
+
}], className: [{
|
|
2202
|
+
type: HostBinding,
|
|
2203
|
+
args: ['class']
|
|
25
2204
|
}] } });
|
|
26
2205
|
|
|
2206
|
+
//export * from './background';
|
|
2207
|
+
|
|
27
2208
|
/**
|
|
28
2209
|
* Generated bundle index. Do not edit.
|
|
29
2210
|
*/
|
|
30
2211
|
|
|
31
|
-
export { UniButtonComponent };
|
|
2212
|
+
export { LocalStorageService, NotificationService, RippleDirective, ThemeService, UNI_THEMES, UniBadgeComponent, UniBaseDatasource, UniBoxComponent, UniButtonComponent, UniCardComponent, UniCardContentComponent, UniCardHeaderComponent, UniCenterComponent, UniDialogButtonsComponent, UniDialogComponent, UniDialogHeaderComponent, UniDividerComponent, UniDropdownComponent, UniGridAreaComponent, UniGridComponent, UniIconComponent, UniMenuComponent, UniRecordDatasource, UniRowComponent, UniServerSideDatasource, UniStackComponent, UniSymbolComponent, UniTextComponent, UniTooltipComponent, UniWrapComponent, useTimer };
|
|
32
2213
|
//# sourceMappingURL=uni-design-system-uni-angular.mjs.map
|