@bootkit/ng0 0.0.0-alpha.31 → 0.0.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/list/index.d.ts +1 -0
- package/components/select/index.d.ts +7 -6
- package/components/sidenav/index.d.ts +95 -34
- package/fesm2022/bootkit-ng0-common.mjs +4 -4
- package/fesm2022/bootkit-ng0-components-accordion.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-accordion.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-backdrop.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-backdrop.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-button.mjs +8 -8
- package/fesm2022/bootkit-ng0-components-card.mjs +11 -11
- package/fesm2022/bootkit-ng0-components-code.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-collapse.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-collapse.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-confirmation.mjs +13 -13
- package/fesm2022/bootkit-ng0-components-confirmation.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-dropdown.mjs +25 -25
- package/fesm2022/bootkit-ng0-components-dropdown.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-form-field.mjs +8 -8
- package/fesm2022/bootkit-ng0-components-form-field.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-list.mjs +19 -18
- package/fesm2022/bootkit-ng0-components-list.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-modal.mjs +8 -8
- package/fesm2022/bootkit-ng0-components-modal.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-nav.mjs +23 -23
- package/fesm2022/bootkit-ng0-components-nav.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs +8 -8
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-pagination.mjs +8 -8
- package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-popover.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-popover.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-select.mjs +12 -11
- package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-sidenav.mjs +192 -64
- package/fesm2022/bootkit-ng0-components-sidenav.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-stepper.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-stepper.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-table.mjs +15 -15
- package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-toast.mjs +6 -6
- package/fesm2022/bootkit-ng0-components-toast.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-tooltip.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-tooltip.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs +22 -22
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-form.mjs +29 -29
- package/fesm2022/bootkit-ng0-form.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-http.mjs +3 -3
- package/fesm2022/bootkit-ng0-layouts-layout1.mjs +13 -38
- package/fesm2022/bootkit-ng0-layouts-layout1.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-localization.mjs +153 -73
- package/fesm2022/bootkit-ng0-localization.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-platform-browser.mjs +7 -7
- package/fesm2022/bootkit-ng0-platform-browser.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-routing.mjs +3 -3
- package/fesm2022/bootkit-ng0-script.mjs +3 -3
- package/fesm2022/bootkit-ng0-security.mjs +14 -14
- package/layouts/layout1/index.d.ts +16 -27
- package/localization/index.d.ts +63 -8
- package/package.json +20 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Pipe, inject, NgModule, InjectionToken } from '@angular/core';
|
|
2
|
+
import { Injectable, Pipe, inject, runInInjectionContext, EnvironmentInjector, NgModule, InjectionToken } from '@angular/core';
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
|
|
@@ -113,6 +113,25 @@ class Locale {
|
|
|
113
113
|
formatDate(date, format) {
|
|
114
114
|
return date ? new Date(date).toLocaleDateString(this.definition.name, { hour: '2-digit', minute: '2-digit' }) : '';
|
|
115
115
|
}
|
|
116
|
+
format(object, formatterName, ...params) {
|
|
117
|
+
let formatter = this.definition.formatters?.[formatterName];
|
|
118
|
+
if (!formatter) {
|
|
119
|
+
throw Error(`The formatter "${formatterName}" is not defined in locale ${this.definition.name}`);
|
|
120
|
+
}
|
|
121
|
+
let formatterType = typeof formatter;
|
|
122
|
+
if (formatterType === 'function') {
|
|
123
|
+
return formatter(object, ...params);
|
|
124
|
+
}
|
|
125
|
+
else if (Array.isArray(formatter)) {
|
|
126
|
+
return formatter[+object];
|
|
127
|
+
}
|
|
128
|
+
else if (formatterType == 'object' && formatter != null) {
|
|
129
|
+
return formatter[object] || '';
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
throw Error(`Invalid locale formatter: ${formatterName}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
116
135
|
}
|
|
117
136
|
|
|
118
137
|
;
|
|
@@ -152,10 +171,10 @@ class LocalizationService {
|
|
|
152
171
|
get() {
|
|
153
172
|
return this._activeLocale;
|
|
154
173
|
}
|
|
155
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
156
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
174
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
175
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizationService, providedIn: 'root' });
|
|
157
176
|
}
|
|
158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizationService, decorators: [{
|
|
159
178
|
type: Injectable,
|
|
160
179
|
args: [{
|
|
161
180
|
providedIn: 'root'
|
|
@@ -175,10 +194,10 @@ class TranslatePipe {
|
|
|
175
194
|
transform(dictionaryKey, fallback) {
|
|
176
195
|
return this._ls.get()?.translate(dictionaryKey, fallback) || dictionaryKey;
|
|
177
196
|
}
|
|
178
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
179
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
197
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TranslatePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
198
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "ng0Translate" });
|
|
180
199
|
}
|
|
181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TranslatePipe, decorators: [{
|
|
182
201
|
type: Pipe,
|
|
183
202
|
args: [{
|
|
184
203
|
name: 'ng0Translate',
|
|
@@ -204,10 +223,10 @@ class TranslateEnumPipe {
|
|
|
204
223
|
transform(enumValue, enumName, fallback) {
|
|
205
224
|
return this._ls.get()?.translateEnum(enumName, enumValue, fallback);
|
|
206
225
|
}
|
|
207
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
208
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
226
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TranslateEnumPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
227
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: TranslateEnumPipe, isStandalone: true, name: "ng0TranslateEnum" });
|
|
209
228
|
}
|
|
210
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TranslateEnumPipe, decorators: [{
|
|
211
230
|
type: Pipe,
|
|
212
231
|
args: [{
|
|
213
232
|
name: 'ng0TranslateEnum',
|
|
@@ -224,10 +243,10 @@ class TranslateBooleanPipe {
|
|
|
224
243
|
transform(value, falseKey = 'true', trueKey = 'false') {
|
|
225
244
|
return this.localeProvider.get()?.translate(value ? trueKey : falseKey);
|
|
226
245
|
}
|
|
227
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
228
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
246
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TranslateBooleanPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
247
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: TranslateBooleanPipe, isStandalone: true, name: "ng0TranslateBool" });
|
|
229
248
|
}
|
|
230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TranslateBooleanPipe, decorators: [{
|
|
231
250
|
type: Pipe,
|
|
232
251
|
args: [{
|
|
233
252
|
name: 'ng0TranslateBool',
|
|
@@ -244,10 +263,10 @@ class DatePipe {
|
|
|
244
263
|
transform(value, format) {
|
|
245
264
|
return this._ls.get()?.formatDate(value, format);
|
|
246
265
|
}
|
|
247
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
248
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: DatePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
267
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: DatePipe, isStandalone: true, name: "ng0Date" });
|
|
249
268
|
}
|
|
250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: DatePipe, decorators: [{
|
|
251
270
|
type: Pipe,
|
|
252
271
|
args: [{
|
|
253
272
|
name: 'ng0Date',
|
|
@@ -264,10 +283,10 @@ class LocalizePipe {
|
|
|
264
283
|
transform(dictionaryKey) {
|
|
265
284
|
return this._ls.get()?.translate(dictionaryKey);
|
|
266
285
|
}
|
|
267
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
268
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
287
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: LocalizePipe, isStandalone: true, name: "ng0Localize", pure: false });
|
|
269
288
|
}
|
|
270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizePipe, decorators: [{
|
|
271
290
|
type: Pipe,
|
|
272
291
|
args: [{
|
|
273
292
|
name: 'ng0Localize',
|
|
@@ -300,10 +319,10 @@ class LocalizeEnumPipe {
|
|
|
300
319
|
}
|
|
301
320
|
return this._value;
|
|
302
321
|
}
|
|
303
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
304
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
322
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizeEnumPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
323
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: LocalizeEnumPipe, isStandalone: true, name: "ng0LocalizeEnum", pure: false });
|
|
305
324
|
}
|
|
306
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizeEnumPipe, decorators: [{
|
|
307
326
|
type: Pipe,
|
|
308
327
|
args: [{
|
|
309
328
|
name: 'ng0LocalizeEnum',
|
|
@@ -320,10 +339,10 @@ class LocalizeBooleanPipe {
|
|
|
320
339
|
transform(value, falseKey = 'true', trueKey) {
|
|
321
340
|
return this._ls.get()?.translate(value ? trueKey : falseKey);
|
|
322
341
|
}
|
|
323
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
324
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
342
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizeBooleanPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
343
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: LocalizeBooleanPipe, isStandalone: true, name: "ng0LocalizeBool", pure: false });
|
|
325
344
|
}
|
|
326
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizeBooleanPipe, decorators: [{
|
|
327
346
|
type: Pipe,
|
|
328
347
|
args: [{
|
|
329
348
|
name: 'ng0LocalizeBool',
|
|
@@ -347,10 +366,10 @@ class LocalizeDatePipe {
|
|
|
347
366
|
}
|
|
348
367
|
return this._value;
|
|
349
368
|
}
|
|
350
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
351
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizeDatePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
370
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: LocalizeDatePipe, isStandalone: true, name: "ng0LocalizeDate", pure: false });
|
|
352
371
|
}
|
|
353
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizeDatePipe, decorators: [{
|
|
354
373
|
type: Pipe,
|
|
355
374
|
args: [{
|
|
356
375
|
name: 'ng0LocalizeDate',
|
|
@@ -368,22 +387,19 @@ function defaultFormatter(obj) {
|
|
|
368
387
|
return obj?.toString() || '';
|
|
369
388
|
}
|
|
370
389
|
/**
|
|
371
|
-
* Creates a field formatter
|
|
372
|
-
* @param field
|
|
373
|
-
* @returns
|
|
374
|
-
* @private
|
|
390
|
+
* Creates a field formatter that retrieves the value of a specified field from an object.
|
|
391
|
+
* @param field The field name to retrieve.
|
|
392
|
+
* @returns An ObjectFormatter function.
|
|
375
393
|
*/
|
|
376
|
-
function
|
|
394
|
+
function fieldFormatter(field) {
|
|
377
395
|
return (obj) => obj?.[field];
|
|
378
396
|
}
|
|
379
397
|
/**
|
|
380
|
-
* Creates an
|
|
381
|
-
*
|
|
382
|
-
* @
|
|
383
|
-
* @returns an ObjectFormatter function.
|
|
384
|
-
* @private
|
|
398
|
+
* Creates an index formatter that retrieves the value at a specified index from an array.
|
|
399
|
+
* @param index The index to retrieve (number or boolean).
|
|
400
|
+
* @returns An ObjectFormatter function.
|
|
385
401
|
*/
|
|
386
|
-
function
|
|
402
|
+
function indexFormatter(index) {
|
|
387
403
|
return (obj) => {
|
|
388
404
|
if (Array.isArray(obj)) {
|
|
389
405
|
return obj[+index]; // use + to cast boolean values to numbers
|
|
@@ -391,19 +407,66 @@ function createIndexFormatter(index) {
|
|
|
391
407
|
throw Error('Object is not an array');
|
|
392
408
|
};
|
|
393
409
|
}
|
|
394
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Creates an array formatter.
|
|
412
|
+
* @param array
|
|
413
|
+
* @returns An ObjectFormatter function.
|
|
414
|
+
*/
|
|
415
|
+
function arrayFormatter(array) {
|
|
395
416
|
if (!Array.isArray(array)) {
|
|
396
417
|
throw Error('Object is not an array');
|
|
397
418
|
}
|
|
398
419
|
return (index) => array[+index];
|
|
399
420
|
}
|
|
400
421
|
/**
|
|
401
|
-
*
|
|
422
|
+
* Creates a number formatter.
|
|
423
|
+
* @param minimumIntegerDigits
|
|
424
|
+
* @param minimumFractionDigits
|
|
425
|
+
* @param maximumFractionDigits
|
|
426
|
+
* @param useGrouping
|
|
427
|
+
* @returns An ObjectFormatter function.
|
|
428
|
+
*/
|
|
429
|
+
function numberFormatter(minimumIntegerDigits, minimumFractionDigits, maximumFractionDigits, useGrouping = true) {
|
|
430
|
+
let locale = inject(LocalizationService, { optional: true })?.get();
|
|
431
|
+
const localeName = locale?.definition.name || 'en-US';
|
|
432
|
+
const f = new Intl.NumberFormat(localeName, {
|
|
433
|
+
minimumIntegerDigits,
|
|
434
|
+
minimumFractionDigits,
|
|
435
|
+
maximumFractionDigits,
|
|
436
|
+
useGrouping,
|
|
437
|
+
});
|
|
438
|
+
return (n) => Number.isFinite(n) ? f.format(n) : '';
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Creates a currency formatter.
|
|
442
|
+
* @param minFractions
|
|
443
|
+
* @param maxFractions
|
|
444
|
+
* @returns
|
|
445
|
+
*/
|
|
446
|
+
function currencyFormatter(minFractions = 1, maxFractions = 2) {
|
|
447
|
+
return (n, minFractions, maxFractions) => Number.isFinite(n) ? n.toString() : '';
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Creates a date formatter.
|
|
451
|
+
* @returns
|
|
452
|
+
*/
|
|
453
|
+
function dateFormatter(options) {
|
|
454
|
+
let locale = inject(LocalizationService, { optional: true })?.get();
|
|
455
|
+
const f = new Intl.DateTimeFormat(locale?.name, options);
|
|
456
|
+
return (d) => f.format(new Date(d));
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Creates a locale-based formatter.
|
|
460
|
+
* @param locale The Locale object.
|
|
402
461
|
* @param formatterName The format string in the form of "formatterName:param1:param2:..."
|
|
403
462
|
* @returns A ValueFormatterFunction
|
|
404
463
|
* @private
|
|
405
464
|
*/
|
|
406
|
-
function
|
|
465
|
+
function localeFormatter(formatterName) {
|
|
466
|
+
let locale = inject(LocalizationService, { optional: true })?.get();
|
|
467
|
+
if (locale == null) {
|
|
468
|
+
throw Error('For using locale formatters, provide a Locale object.');
|
|
469
|
+
}
|
|
407
470
|
let formatter = locale.definition.formatters?.[formatterName];
|
|
408
471
|
let formatterType = typeof formatter;
|
|
409
472
|
if (!formatter) {
|
|
@@ -414,7 +477,7 @@ function createLocaleFormatter(locale, formatterName) {
|
|
|
414
477
|
return formatter;
|
|
415
478
|
}
|
|
416
479
|
else if (Array.isArray(formatter)) {
|
|
417
|
-
return
|
|
480
|
+
return arrayFormatter(formatter);
|
|
418
481
|
}
|
|
419
482
|
else if (formatterType == 'object' && formatter != null) {
|
|
420
483
|
return (value) => formatter[value] || '';
|
|
@@ -423,45 +486,61 @@ function createLocaleFormatter(locale, formatterName) {
|
|
|
423
486
|
throw Error(`Invalid locale formatter: ${formatterName}`);
|
|
424
487
|
}
|
|
425
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* Creates a composite formatter that applies multiple formatters in sequence.
|
|
491
|
+
* @param formatters The list of ObjectFormatterLike values to compose.
|
|
492
|
+
* @returns An ObjectFormatter function.
|
|
493
|
+
*/
|
|
494
|
+
function composite(...formatters) {
|
|
495
|
+
const formattersFuncs = formatters.map(item => createObjectFormatter(item));
|
|
496
|
+
return (obj) => formattersFuncs.reduce((previous, current, index) => index == 0 ? current(obj) : current(previous));
|
|
497
|
+
}
|
|
426
498
|
/**
|
|
427
499
|
* Creates an ObjectFormatter from various ObjectFormatterLike types.
|
|
428
500
|
* @param formatter The ObjectFormatterLike value to convert.
|
|
429
501
|
* @param locale Optional locale object for locale-based formatting.
|
|
502
|
+
* @param params Additional parameters for the formatter.
|
|
430
503
|
* @returns An ObjectFormatter function.
|
|
431
504
|
*/
|
|
432
|
-
function createObjectFormatter(formatter,
|
|
505
|
+
function createObjectFormatter(formatter, ...params) {
|
|
433
506
|
switch (typeof formatter) {
|
|
434
507
|
case 'function':
|
|
435
|
-
return formatter;
|
|
508
|
+
return formatter.bind(null, ...params);
|
|
436
509
|
case 'number':
|
|
437
|
-
return
|
|
510
|
+
return indexFormatter(formatter);
|
|
438
511
|
case 'string':
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
512
|
+
switch (formatter[0]) {
|
|
513
|
+
case '#':
|
|
514
|
+
return numberFormatter(...params);
|
|
515
|
+
case '$':
|
|
516
|
+
return currencyFormatter();
|
|
517
|
+
case '@':
|
|
518
|
+
return dateFormatter();
|
|
519
|
+
case '*':
|
|
520
|
+
return localeFormatter(formatter.substring(1));
|
|
521
|
+
default:
|
|
522
|
+
return fieldFormatter(formatter);
|
|
447
523
|
}
|
|
448
524
|
case 'object':
|
|
449
|
-
if (Array.isArray(formatter)) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
525
|
+
if (Array.isArray(formatter) && formatter.length > 0) {
|
|
526
|
+
if (formatter[0] == 'C') {
|
|
527
|
+
return composite(formatter.slice(1));
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
return createObjectFormatter(formatter[0], ...formatter.slice(1));
|
|
531
|
+
}
|
|
453
532
|
}
|
|
454
533
|
break;
|
|
455
534
|
}
|
|
456
|
-
throw Error('invalid formatter
|
|
535
|
+
throw Error('invalid formatter', { cause: formatter });
|
|
457
536
|
}
|
|
458
537
|
/**
|
|
459
|
-
* Creates a function that converts a ObjectFormatterLike value into a ObjectFormatter.
|
|
460
|
-
* @param
|
|
538
|
+
* Creates a transform function that converts a ObjectFormatterLike value into a ObjectFormatter.
|
|
539
|
+
* @param injector The EnvironmentInjector to use for dependency injection.
|
|
461
540
|
* @returns A function that takes a ObjectFormatterLike and returns a ObjectFormatter.
|
|
462
541
|
*/
|
|
463
|
-
function objectFormatterAttribute(
|
|
464
|
-
return (
|
|
542
|
+
function objectFormatterAttribute(injector) {
|
|
543
|
+
return (x) => runInInjectionContext(injector, createObjectFormatter.bind(null, x));
|
|
465
544
|
}
|
|
466
545
|
;
|
|
467
546
|
|
|
@@ -469,14 +548,15 @@ function objectFormatterAttribute(locale) {
|
|
|
469
548
|
* Format pipe to format objects using various formatter types.
|
|
470
549
|
*/
|
|
471
550
|
class FormatPipe {
|
|
472
|
-
|
|
551
|
+
_injector = inject(EnvironmentInjector);
|
|
473
552
|
transform(obj, formatter, ...params) {
|
|
474
|
-
|
|
553
|
+
const f = runInInjectionContext(this._injector, createObjectFormatter.bind(null, formatter, ...params));
|
|
554
|
+
return f(obj);
|
|
475
555
|
}
|
|
476
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
477
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.
|
|
556
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: FormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
557
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: FormatPipe, isStandalone: true, name: "ng0Format" });
|
|
478
558
|
}
|
|
479
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
559
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: FormatPipe, decorators: [{
|
|
480
560
|
type: Pipe,
|
|
481
561
|
args: [{
|
|
482
562
|
name: 'ng0Format',
|
|
@@ -499,8 +579,8 @@ const Declares = [
|
|
|
499
579
|
LocalizeDatePipe
|
|
500
580
|
];
|
|
501
581
|
class LocalizationModule {
|
|
502
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
503
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.
|
|
582
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
583
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: LocalizationModule, imports: [
|
|
504
584
|
// Pure pipes
|
|
505
585
|
TranslatePipe,
|
|
506
586
|
TranslateEnumPipe,
|
|
@@ -523,9 +603,9 @@ class LocalizationModule {
|
|
|
523
603
|
LocalizeEnumPipe,
|
|
524
604
|
LocalizeBooleanPipe,
|
|
525
605
|
LocalizeDatePipe] });
|
|
526
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.
|
|
606
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizationModule });
|
|
527
607
|
}
|
|
528
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
608
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
529
609
|
type: NgModule,
|
|
530
610
|
args: [{
|
|
531
611
|
imports: Declares,
|
|
@@ -539,5 +619,5 @@ const LOCALE = new InjectionToken('LOCALE');
|
|
|
539
619
|
* Generated bundle index. Do not edit.
|
|
540
620
|
*/
|
|
541
621
|
|
|
542
|
-
export { DatePipe, FormatPipe, LOCALE, Locale, LocalizationModule, LocalizationService, LocalizeBooleanPipe, LocalizeDatePipe, LocalizeEnumPipe, LocalizePipe, TranslateBooleanPipe, TranslateEnumPipe, TranslatePipe, createObjectFormatter, defaultFormatter, objectFormatterAttribute };
|
|
622
|
+
export { DatePipe, FormatPipe, LOCALE, Locale, LocalizationModule, LocalizationService, LocalizeBooleanPipe, LocalizeDatePipe, LocalizeEnumPipe, LocalizePipe, TranslateBooleanPipe, TranslateEnumPipe, TranslatePipe, arrayFormatter, composite, createObjectFormatter, currencyFormatter, dateFormatter, defaultFormatter, fieldFormatter, indexFormatter, localeFormatter, numberFormatter, objectFormatterAttribute };
|
|
543
623
|
//# sourceMappingURL=bootkit-ng0-localization.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootkit-ng0-localization.mjs","sources":["../../../projects/ng0/localization/locale.ts","../../../projects/ng0/localization/locale-definition.ts","../../../projects/ng0/localization/localization.service.ts","../../../projects/ng0/localization/translate.pipe.ts","../../../projects/ng0/localization/translate-enum.pipe.ts","../../../projects/ng0/localization/translate-boolean-pipe.ts","../../../projects/ng0/localization/date.pipe.ts","../../../projects/ng0/localization/localize.pipe.ts","../../../projects/ng0/localization/localize-enum.pipe.ts","../../../projects/ng0/localization/localize-boolean-pipe.ts","../../../projects/ng0/localization/localize-date.pipe.ts","../../../projects/ng0/localization/formatter.ts","../../../projects/ng0/localization/format.pipe.ts","../../../projects/ng0/localization/localization.module.ts","../../../projects/ng0/localization/types.ts","../../../projects/ng0/localization/bootkit-ng0-localization.ts"],"sourcesContent":["import { LocaleDefinition } from \"./locale-definition\";\r\nimport { TranslatedValidationError } from \"./types\";\r\nimport { ObjectFormatter } from \"./formatter\";\r\n\r\n/** Locale */\r\nexport class Locale {\r\n constructor(public readonly definition: LocaleDefinition) {\r\n }\r\n\r\n /** \r\n * Returns the name of the locale\r\n * @returns The name of the locale\r\n */\r\n get name(): string {\r\n return this.definition.name;\r\n }\r\n\r\n /** \r\n * Translates a key in the dictionary\r\n * @param key The key to look up\r\n * @param fallback Optional fallback value if the key is not found\r\n * @returns The translated string or the fallbackValue if not found\r\n */\r\n translate(key: string, fallback?: string): string | undefined {\r\n return this.definition.dictionary?.[key] ?? fallback;\r\n }\r\n\r\n /**\r\n * Translates an enum value \r\n * @param enumName The name of the enum \r\n * @param enumValue The value of the enum to translate \r\n * @param fallback\r\n * @returns The translated string or the enum value itself if not found \r\n */\r\n\r\n translateEnum(enumName: string, enumValue: string | number | null | undefined, fallback?: string): string | undefined {\r\n let e = this.definition.enums?.[enumName];\r\n\r\n if (!e) {\r\n return fallback || enumValue?.toString();\r\n }\r\n\r\n if (enumValue === null) {\r\n return e['[null]'] || e['[empty]'];\r\n } else if (enumValue === undefined) {\r\n return e['[undefined]'] || e['[empty]'];\r\n } else if (enumValue === '') {\r\n return e['empty'];\r\n } else {\r\n return e[enumValue] || e['[?]'] || fallback || enumValue?.toString();\r\n }\r\n }\r\n\r\n /** \r\n * Translates a form validation error\r\n * @param errorKey The key of the error to translate\r\n * @param error The error object\r\n */\r\n translateError(errorKey: string, error: any, fallbackMessage: string | undefined = undefined): string | undefined {\r\n const errors = this.definition?.form?.validation?.errors;\r\n\r\n if (!errors) {\r\n return fallbackMessage;\r\n }\r\n\r\n const translatorFunc = errors[errorKey] ?? errors['*'];\r\n return typeof translatorFunc === 'function' ? translatorFunc(error) : fallbackMessage;\r\n }\r\n\r\n /** \r\n * Translates validation errors \r\n * @param errors Validation errors object\r\n * @returns Array of translated validation errors\r\n */\r\n translateErrors(errors: any): TranslatedValidationError[] {\r\n const result: TranslatedValidationError[] = [];\r\n for (const key in errors) {\r\n if (Object.prototype.hasOwnProperty.call(errors, key)) {\r\n result.push({\r\n key: key,\r\n value: errors[key],\r\n text: this.translateError(key, errors[key])\r\n });\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /** \r\n * Translates the first error in the validation errors object \r\n * @param errors Validation errors object\r\n * @returns TranslatedValidationError or undefined if no errors\r\n */\r\n translateFirstError(errors: any, fallbackMessage: string | undefined = undefined): TranslatedValidationError | undefined {\r\n const keys = Object.keys(errors);\r\n if (keys.length === 0) {\r\n return undefined;\r\n }\r\n\r\n const key = keys[0];\r\n const value = errors[key];\r\n return {\r\n key,\r\n value,\r\n text: this.translateError(key, value, fallbackMessage)\r\n };\r\n }\r\n\r\n /**\r\n * Clones and extends this object and returns a new Locale (without modifying this object).\r\n */\r\n extend(definition?: Omit<LocaleDefinition, 'name' | 'rtl'>): Locale {\r\n return new Locale({ ...this.definition, ...definition });\r\n }\r\n\r\n /**\r\n * \r\n * @param date Date string or timestamp\r\n * @returns Formatted date string based on the locale \r\n */\r\n formatDate(date: Date | string | number, format?: string): string {\r\n return date ? new Date(date).toLocaleDateString(this.definition.name, { hour: '2-digit', minute: '2-digit' }) : '';\r\n }\r\n}\r\n","import { ObjectFormatter } from \"./formatter\";\r\n\r\n/** Locale dictionary */\r\nexport type LocaleDictionary = { [key: string]: string; };\r\nexport type LocaleEnums = { [enumName: string]: { [enumValue: string]: string } };\r\n\r\n/** Locale Error Translator */\r\nexport type LocaleValidationErrorTranslator = (error: any) => string;\r\n\r\n\r\n/** Locale validation error translator functions */\r\nexport type LocaleValidationErrorTranslators = {\r\n [key: string]: LocaleValidationErrorTranslator;\r\n};\r\n\r\n/**\r\n * A function to format the paging info of a table.\r\n * \r\n */\r\nexport type TableComponentPagingFormatter = (info: {\r\n /**\r\n * The first record in the current page.\r\n */\r\n firstRecord: number,\r\n\r\n /**\r\n * The last record in the current page.\r\n */\r\n lastRecord: number,\r\n\r\n /**\r\n * The total number of records.\r\n */\r\n totalRecords?: number,\r\n\r\n /**\r\n * The current page index.\r\n */\r\n currentPage: number\r\n}) => string;\r\n\r\n/** \r\n * Locale definition\r\n */\r\nexport interface LocaleDefinition {\r\n /** Locale name */\r\n readonly name: string;\r\n\r\n /** Does this locale belongs to a RTL language */\r\n readonly rtl?: boolean;\r\n\r\n /** Locale dictionary */\r\n dictionary?: LocaleDictionary;\r\n enums?: LocaleEnums,\r\n form?: {\r\n validation?: {\r\n /** Form validation error translators. */\r\n errors?: LocaleValidationErrorTranslators\r\n }\r\n },\r\n data?: {\r\n logicalOperators?: {\r\n [operator: string]: string\r\n }\r\n },\r\n components?: {\r\n table?: {\r\n /**\r\n * No records found message.\r\n */\r\n noRecords?: string;\r\n\r\n /** \r\n * Error message displayed when loading data fails. \r\n */\r\n loadError?: string;\r\n\r\n /**\r\n * A format function to format the paging info.\r\n */\r\n pagingInfo?: TableComponentPagingFormatter;\r\n },\r\n select?: {\r\n placeholder?: string;\r\n }\r\n },\r\n\r\n formatters?: {\r\n // boolean?: {\r\n // [booleanKind: string]: string[] // [false, true]\r\n // },\r\n // enum?: {\r\n // [enumName: string]: { [enumValue: string]: string }\r\n // }\r\n // custom?: {\r\n [formatterName: string]: ObjectFormatter | string[] | {\r\n [value: string]: string\r\n }\r\n // },\r\n // date?: {\r\n // calendars?: {\r\n // [calendar: string]: {\r\n // days: string[],\r\n // daysShort: string[],\r\n // months: string[],\r\n // monthsShort: string[],\r\n // }\r\n // }\r\n // };\r\n // }\r\n }\r\n};\r\n\r\n","import { Injectable } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { Locale } from './locale';\r\nimport { LocaleChangeEvent } from './types';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class LocalizationService {\r\n private _locales: Locale[] = [];\r\n private _activeLocale?: Locale;\r\n private _changeSubject = new Subject<LocaleChangeEvent>();\r\n readonly change = this._changeSubject.asObservable();\r\n\r\n constructor() {\r\n }\r\n\r\n /** \r\n * Adds a Locale \r\n */\r\n add(locale: Locale): void;\r\n /** Adds an array of Locales to this LocaleProvider */\r\n add(locales: Locale[]): void;\r\n add(l: any): void {\r\n if (l instanceof Locale) {\r\n this._locales.push(l);\r\n } else if (Array.isArray(l)) {\r\n l.forEach(x => this.add(x));\r\n } else {\r\n throw Error('Invalid locale');\r\n }\r\n\r\n if (this._locales.length == 1) {\r\n this._activeLocale = this._locales[0];\r\n }\r\n }\r\n\r\n /** Changes the active locale */\r\n set(localeName: string): void {\r\n const locale = this._locales.find(x => x.name === localeName);\r\n if (locale) {\r\n this._changeSubject.next({ old: this._activeLocale, new: locale });\r\n this._activeLocale = locale;\r\n return;\r\n }\r\n\r\n throw Error('Locale not found.');\r\n }\r\n\r\n /** Gets the active locale */\r\n get(): Locale | undefined {\r\n return this._activeLocale;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n\r\n/**\r\n * Pipe to translate a dictionary key into a localized string.\r\n * It uses the LocalizationService to fetch the translation.\r\n * If the translation is not found, it returns the fallback string if provided.\r\n */\r\n@Pipe({\r\n name: 'ng0Translate',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class TranslatePipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(dictionaryKey: string, fallback?: string) {\r\n return this._ls.get()?.translate(dictionaryKey, fallback) || dictionaryKey;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0TranslateEnum',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class TranslateEnumPipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n /**\r\n * \r\n * @param enumValue \r\n * @param enumName \r\n * @param nullValueKey \r\n * @param returnEnumAsFallback\r\n * @param fallbackKey \r\n * @returns \r\n */\r\n transform(enumValue: string | number | null | undefined, enumName: string, fallback?: string): any {\r\n return this._ls.get()?.translateEnum(enumName, enumValue, fallback);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0TranslateBool',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class TranslateBooleanPipe implements PipeTransform {\r\n\r\n constructor(private localeProvider: LocalizationService) {\r\n }\r\n\r\n transform(value: any, falseKey: string = 'true', trueKey: string = 'false'): any {\r\n return this.localeProvider.get()?.translate(value ? trueKey : falseKey);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0Date',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class DatePipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(value: Date | string | number, format?: string) {\r\n return this._ls.get()?.formatDate(value, format);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0Localize',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizePipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(dictionaryKey: string) {\r\n return this._ls.get()?.translate(dictionaryKey);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\n\r\n@Pipe({\r\n name: 'ng0LocalizeEnum',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizeEnumPipe implements PipeTransform {\r\n private _recompute = true;\r\n private _value?: string;\r\n\r\n constructor(private _ls: LocalizationService) {\r\n _ls.change.pipe(takeUntilDestroyed()).subscribe(x => this._recompute = true);\r\n }\r\n\r\n /**\r\n * \r\n * @param enumValue \r\n * @param enumName \r\n * @param nullValueKey \r\n * @param returnEnumAsFallback\r\n * @param fallbackKey \r\n * @returns \r\n */\r\n transform(enumValue: string | number | null | undefined, enumName: string, fallback?: string): any {\r\n if (this._recompute) {\r\n this._value = this._ls.get()?.translateEnum(enumName, enumValue, fallback);\r\n this._recompute = false;\r\n }\r\n\r\n return this._value;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0LocalizeBool',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizeBooleanPipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(value: any, falseKey = 'true', trueKey: 'false') {\r\n return this._ls.get()?.translate(value ? trueKey : falseKey);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { Locale } from './locale';\r\nimport { LocalizationService } from './localization.service';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\n\r\n@Pipe({\r\n name: 'ng0LocalizeDate',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizeDatePipe implements PipeTransform {\r\n private _value?: string;\r\n private _recompute = true;\r\n\r\n constructor(private _ls: LocalizationService) {\r\n _ls.change.pipe(takeUntilDestroyed()).subscribe(x => this._recompute = true);\r\n }\r\n\r\n transform(value: number | string, format?: string) {\r\n if (this._recompute) {\r\n this._value = this._ls.get()?.formatDate(value, format);\r\n this._recompute = false;\r\n }\r\n\r\n return this._value;\r\n }\r\n}\r\n","import { Locale } from \"./locale\";\r\n\r\n/**\r\n * Object formatter function type.\r\n * @param obj The object to format.\r\n * @param params Additional parameters for formatting.\r\n * @returns The formatted value.\r\n */\r\nexport type ObjectFormatter = (obj: any, ...params: any[]) => any;\r\n\r\n/**\r\n * Object formatter-like types. \r\n */\r\nexport type ObjectFormatterLike = ObjectFormatter | string | number | Array<ObjectFormatter | string | number>;\r\n\r\n/**\r\n * Default object formatter function.\r\n * @param value The item to format.\r\n * @returns The formatted string.\r\n */\r\nexport function defaultFormatter(obj: any): string {\r\n return obj?.toString() || '';\r\n}\r\n\r\n/**\r\n * Creates a field formatter function.\r\n * @param field \r\n * @returns\r\n * @private\r\n */\r\nfunction createFieldFormatter(field: string): ObjectFormatter {\r\n return (obj: any) => obj?.[field];\r\n}\r\n\r\n/**\r\n * Creates an array index formatter function.\r\n * An array index formatter always returns the item at the specified index from an array object.\r\n * @param index \r\n * @returns an ObjectFormatter function.\r\n * @private\r\n */\r\nfunction createIndexFormatter(index: number | boolean): ObjectFormatter {\r\n return (obj: any) => {\r\n if (Array.isArray(obj)) {\r\n return obj[+index]; // use + to cast boolean values to numbers\r\n }\r\n\r\n throw Error('Object is not an array');\r\n }\r\n}\r\n\r\nfunction createArrayFormatter(array: any[]): ObjectFormatter {\r\n if (!Array.isArray(array)) {\r\n throw Error('Object is not an array');\r\n }\r\n\r\n return (index: number | boolean) => array[+index];\r\n}\r\n\r\n\r\n/**\r\n * Returns a formatter function by its name and parameters.\r\n * @param formatterName The format string in the form of \"formatterName:param1:param2:...\"\r\n * @returns A ValueFormatterFunction\r\n * @private\r\n */\r\nfunction createLocaleFormatter(locale: Locale, formatterName: string): ObjectFormatter {\r\n let formatter = locale.definition.formatters?.[formatterName];\r\n let formatterType = typeof formatter;\r\n\r\n if (!formatter) {\r\n console.warn(`The formatter \"${formatterName}\" is not defined in locale ${locale.definition.name}`);\r\n return defaultFormatter;\r\n }\r\n\r\n if (formatterType === 'function') {\r\n return formatter as ObjectFormatter;\r\n } else if (Array.isArray(formatter)) {\r\n return createArrayFormatter(formatter);\r\n } else if (formatterType == 'object' && formatter != null) {\r\n return (value: string) => (formatter as any)[value] || '';\r\n } else {\r\n throw Error(`Invalid locale formatter: ${formatterName}`);\r\n }\r\n}\r\n\r\n/**\r\n * Creates an ObjectFormatter from various ObjectFormatterLike types.\r\n * @param formatter The ObjectFormatterLike value to convert. \r\n * @param locale Optional locale object for locale-based formatting. \r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function createObjectFormatter(formatter: ObjectFormatterLike, locale?: Locale): ObjectFormatter {\r\n switch (typeof formatter) {\r\n case 'function':\r\n return formatter;\r\n case 'number':\r\n return createIndexFormatter(formatter);\r\n case 'string':\r\n if (formatter.startsWith('@')) {\r\n if (locale == null) {\r\n throw Error('For using locale formatters, provide a Locale object.')\r\n }\r\n return createLocaleFormatter(locale, formatter.substring(1));\r\n } else {\r\n return createFieldFormatter(formatter);\r\n }\r\n case 'object':\r\n if (Array.isArray(formatter)) {\r\n // Create a composite formatter from multiple formatters.\r\n const formatters = formatter.map(item => createObjectFormatter(item, locale));\r\n return (obj: any) => formatters.reduce((previous, current, index) => index == 0 ? current(obj) : current(previous));\r\n }\r\n break;\r\n }\r\n\r\n throw Error('invalid formatter value', { cause: formatter });\r\n}\r\n\r\n/**\r\n * Creates a function that converts a ObjectFormatterLike value into a ObjectFormatter.\r\n * @param locale Optional locale object for locale-based formatting.\r\n * @returns A function that takes a ObjectFormatterLike and returns a ObjectFormatter.\r\n */\r\nexport function objectFormatterAttribute(locale?: Locale): ((v: ObjectFormatterLike) => ObjectFormatter) {\r\n return (v) => createObjectFormatter(v, locale);\r\n};\r\n","import { inject, Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\nimport { createObjectFormatter, ObjectFormatterLike } from './formatter';\r\n\r\n/**\r\n * Format pipe to format objects using various formatter types.\r\n */\r\n@Pipe({\r\n name: 'ng0Format',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class FormatPipe implements PipeTransform {\r\n private _localizationService = inject(LocalizationService, { optional: true });\r\n\r\n transform(obj: any, formatter: ObjectFormatterLike, ...params: any[]): any {\r\n return createObjectFormatter(formatter, this._localizationService?.get())(obj, ...params);\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { TranslatePipe } from './translate.pipe';\r\nimport { TranslateEnumPipe } from './translate-enum.pipe';\r\nimport { TranslateBooleanPipe } from './translate-boolean-pipe';\r\nimport { DatePipe } from './date.pipe';\r\nimport { LocalizePipe } from './localize.pipe';\r\nimport { LocalizeEnumPipe } from './localize-enum.pipe';\r\nimport { LocalizeBooleanPipe } from './localize-boolean-pipe';\r\nimport { LocalizeDatePipe } from './localize-date.pipe';\r\nimport { FormatPipe } from './format.pipe';\r\n\r\nconst Declares = [\r\n // Pure pipes\r\n TranslatePipe,\r\n TranslateEnumPipe,\r\n TranslateBooleanPipe,\r\n DatePipe,\r\n FormatPipe,\r\n\r\n // Impure pipes\r\n LocalizePipe,\r\n LocalizeEnumPipe,\r\n LocalizeBooleanPipe,\r\n LocalizeDatePipe\r\n];\r\n\r\n@NgModule({\r\n imports: Declares,\r\n exports: Declares\r\n})\r\nexport class LocalizationModule {\r\n}\r\n\r\n","import { InjectionToken } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\nimport { Locale } from './locale';\r\n\r\nexport const LOCALE = new InjectionToken<Locale | LocalizationService>('LOCALE');\r\n\r\nexport interface TranslatedValidationError {\r\n /** Error key */\r\n key: string;\r\n \r\n /** Error object */\r\n value: any;\r\n \r\n /** localized error text */\r\n text?: string;\r\n }\r\n \r\n export interface LocaleChangeEvent {\r\n old?: Locale;\r\n new: Locale;\r\n }\r\n ","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.LocalizationService"],"mappings":";;;;;AAIA;MACa,MAAM,CAAA;AACW,IAAA,UAAA;AAA5B,IAAA,WAAA,CAA4B,UAA4B,EAAA;QAA5B,IAAA,CAAA,UAAU,GAAV,UAAU;IACtC;AAEA;;;AAGG;AACH,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI;IAC7B;AAEA;;;;;AAKG;IACH,SAAS,CAAC,GAAW,EAAE,QAAiB,EAAA;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,IAAI,QAAQ;IACtD;AAEA;;;;;;AAMG;AAEH,IAAA,aAAa,CAAC,QAAgB,EAAE,SAA6C,EAAE,QAAiB,EAAA;QAC9F,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,QAAQ,CAAC;QAEzC,IAAI,CAAC,CAAC,EAAE;AACN,YAAA,OAAO,QAAQ,IAAI,SAAS,EAAE,QAAQ,EAAE;QAC1C;AAEA,QAAA,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;QACpC;AAAO,aAAA,IAAI,SAAS,KAAK,SAAS,EAAE;YAClC,OAAO,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;QACzC;AAAO,aAAA,IAAI,SAAS,KA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VhB,aAAa;YACb,iBAAiB;YACjB,oBAAoB;YACpB,QAAQ;YACR,UAAU;;YAGV,YAAY;YACZ,gBAAgB;YAChB,mBAAmB;YACnB,gBAAgB,CAAA,EAAA,CAAA;wGAOL,kBAAkB,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,QAAQ;AACjB,oBAAA,OAAO,EAAE;AACV,iBAAA;;;MC1BY,MAAM,GAAG,IAAI,cAAc,CAA+B,QAAQ;;ACJ/E;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bootkit-ng0-localization.mjs","sources":["../../../projects/ng0/localization/locale.ts","../../../projects/ng0/localization/locale-definition.ts","../../../projects/ng0/localization/localization.service.ts","../../../projects/ng0/localization/translate.pipe.ts","../../../projects/ng0/localization/translate-enum.pipe.ts","../../../projects/ng0/localization/translate-boolean-pipe.ts","../../../projects/ng0/localization/date.pipe.ts","../../../projects/ng0/localization/localize.pipe.ts","../../../projects/ng0/localization/localize-enum.pipe.ts","../../../projects/ng0/localization/localize-boolean-pipe.ts","../../../projects/ng0/localization/localize-date.pipe.ts","../../../projects/ng0/localization/formatter.ts","../../../projects/ng0/localization/format.pipe.ts","../../../projects/ng0/localization/localization.module.ts","../../../projects/ng0/localization/types.ts","../../../projects/ng0/localization/bootkit-ng0-localization.ts"],"sourcesContent":["import { LocaleDefinition } from \"./locale-definition\";\r\nimport { TranslatedValidationError } from \"./types\";\r\nimport { ObjectFormatter } from \"./formatter\";\r\n\r\n/** Locale */\r\nexport class Locale {\r\n constructor(public readonly definition: LocaleDefinition) {\r\n }\r\n\r\n /** \r\n * Returns the name of the locale\r\n * @returns The name of the locale\r\n */\r\n get name(): string {\r\n return this.definition.name;\r\n }\r\n\r\n /** \r\n * Translates a key in the dictionary\r\n * @param key The key to look up\r\n * @param fallback Optional fallback value if the key is not found\r\n * @returns The translated string or the fallbackValue if not found\r\n */\r\n translate(key: string, fallback?: string): string | undefined {\r\n return this.definition.dictionary?.[key] ?? fallback;\r\n }\r\n\r\n /**\r\n * Translates an enum value \r\n * @param enumName The name of the enum \r\n * @param enumValue The value of the enum to translate \r\n * @param fallback\r\n * @returns The translated string or the enum value itself if not found \r\n */\r\n\r\n translateEnum(enumName: string, enumValue: string | number | null | undefined, fallback?: string): string | undefined {\r\n let e = this.definition.enums?.[enumName];\r\n\r\n if (!e) {\r\n return fallback || enumValue?.toString();\r\n }\r\n\r\n if (enumValue === null) {\r\n return e['[null]'] || e['[empty]'];\r\n } else if (enumValue === undefined) {\r\n return e['[undefined]'] || e['[empty]'];\r\n } else if (enumValue === '') {\r\n return e['empty'];\r\n } else {\r\n return e[enumValue] || e['[?]'] || fallback || enumValue?.toString();\r\n }\r\n }\r\n\r\n /** \r\n * Translates a form validation error\r\n * @param errorKey The key of the error to translate\r\n * @param error The error object\r\n */\r\n translateError(errorKey: string, error: any, fallbackMessage: string | undefined = undefined): string | undefined {\r\n const errors = this.definition?.form?.validation?.errors;\r\n\r\n if (!errors) {\r\n return fallbackMessage;\r\n }\r\n\r\n const translatorFunc = errors[errorKey] ?? errors['*'];\r\n return typeof translatorFunc === 'function' ? translatorFunc(error) : fallbackMessage;\r\n }\r\n\r\n /** \r\n * Translates validation errors \r\n * @param errors Validation errors object\r\n * @returns Array of translated validation errors\r\n */\r\n translateErrors(errors: any): TranslatedValidationError[] {\r\n const result: TranslatedValidationError[] = [];\r\n for (const key in errors) {\r\n if (Object.prototype.hasOwnProperty.call(errors, key)) {\r\n result.push({\r\n key: key,\r\n value: errors[key],\r\n text: this.translateError(key, errors[key])\r\n });\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /** \r\n * Translates the first error in the validation errors object \r\n * @param errors Validation errors object\r\n * @returns TranslatedValidationError or undefined if no errors\r\n */\r\n translateFirstError(errors: any, fallbackMessage: string | undefined = undefined): TranslatedValidationError | undefined {\r\n const keys = Object.keys(errors);\r\n if (keys.length === 0) {\r\n return undefined;\r\n }\r\n\r\n const key = keys[0];\r\n const value = errors[key];\r\n return {\r\n key,\r\n value,\r\n text: this.translateError(key, value, fallbackMessage)\r\n };\r\n }\r\n\r\n /**\r\n * Clones and extends this object and returns a new Locale (without modifying this object).\r\n */\r\n extend(definition?: Omit<LocaleDefinition, 'name' | 'rtl'>): Locale {\r\n return new Locale({ ...this.definition, ...definition });\r\n }\r\n\r\n /**\r\n * \r\n * @param date Date string or timestamp\r\n * @returns Formatted date string based on the locale \r\n */\r\n formatDate(date: Date | string | number, format?: string): string {\r\n return date ? new Date(date).toLocaleDateString(this.definition.name, { hour: '2-digit', minute: '2-digit' }) : '';\r\n }\r\n\r\n format(object: any, formatterName: string, ...params: any[]): string {\r\n let formatter = this.definition.formatters?.[formatterName];\r\n\r\n if (!formatter) {\r\n throw Error(`The formatter \"${formatterName}\" is not defined in locale ${this.definition.name}`);\r\n }\r\n\r\n let formatterType = typeof formatter;\r\n if (formatterType === 'function') {\r\n return (formatter as ObjectFormatter)(object, ...params);\r\n } else if (Array.isArray(formatter)) {\r\n return formatter[+object];\r\n } else if (formatterType == 'object' && formatter != null) {\r\n return (formatter as any)[object] || '';\r\n } else {\r\n throw Error(`Invalid locale formatter: ${formatterName}`);\r\n }\r\n }\r\n}\r\n","import { ObjectFormatter } from \"./formatter\";\r\n\r\n/** Locale dictionary */\r\nexport type LocaleDictionary = { [key: string]: string; };\r\nexport type LocaleEnums = { [enumName: string]: { [enumValue: string]: string } };\r\n\r\n/** Locale Error Translator */\r\nexport type LocaleValidationErrorTranslator = (error: any) => string;\r\n\r\n\r\n/** Locale validation error translator functions */\r\nexport type LocaleValidationErrorTranslators = {\r\n [key: string]: LocaleValidationErrorTranslator;\r\n};\r\n\r\n/**\r\n * A function to format the paging info of a table.\r\n * \r\n */\r\nexport type TableComponentPagingFormatter = (info: {\r\n /**\r\n * The first record in the current page.\r\n */\r\n firstRecord: number,\r\n\r\n /**\r\n * The last record in the current page.\r\n */\r\n lastRecord: number,\r\n\r\n /**\r\n * The total number of records.\r\n */\r\n totalRecords?: number,\r\n\r\n /**\r\n * The current page index.\r\n */\r\n currentPage: number\r\n}) => string;\r\n\r\n/** \r\n * Locale definition\r\n */\r\nexport interface LocaleDefinition {\r\n /** Locale name */\r\n readonly name: string;\r\n\r\n /** Does this locale belongs to a RTL language */\r\n readonly rtl?: boolean;\r\n\r\n /** Locale dictionary */\r\n dictionary?: LocaleDictionary;\r\n enums?: LocaleEnums,\r\n form?: {\r\n validation?: {\r\n /** Form validation error translators. */\r\n errors?: LocaleValidationErrorTranslators\r\n }\r\n },\r\n data?: {\r\n logicalOperators?: {\r\n [operator: string]: string\r\n }\r\n },\r\n components?: {\r\n table?: {\r\n /**\r\n * No records found message.\r\n */\r\n noRecords?: string;\r\n\r\n /** \r\n * Error message displayed when loading data fails. \r\n */\r\n loadError?: string;\r\n\r\n /**\r\n * A format function to format the paging info.\r\n */\r\n pagingInfo?: TableComponentPagingFormatter;\r\n },\r\n select?: {\r\n placeholder?: string;\r\n }\r\n },\r\n\r\n formatters?: {\r\n // boolean?: {\r\n // [booleanKind: string]: string[] // [false, true]\r\n // },\r\n // enum?: {\r\n // [enumName: string]: { [enumValue: string]: string }\r\n // }\r\n // custom?: {\r\n [formatterName: string]: ObjectFormatter | string[] | {\r\n [value: string]: string\r\n }\r\n // },\r\n // date?: {\r\n // calendars?: {\r\n // [calendar: string]: {\r\n // days: string[],\r\n // daysShort: string[],\r\n // months: string[],\r\n // monthsShort: string[],\r\n // }\r\n // }\r\n // };\r\n // }\r\n }\r\n};\r\n\r\n","import { Injectable } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { Locale } from './locale';\r\nimport { LocaleChangeEvent } from './types';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class LocalizationService {\r\n private _locales: Locale[] = [];\r\n private _activeLocale?: Locale;\r\n private _changeSubject = new Subject<LocaleChangeEvent>();\r\n readonly change = this._changeSubject.asObservable();\r\n\r\n constructor() {\r\n }\r\n\r\n /** \r\n * Adds a Locale \r\n */\r\n add(locale: Locale): void;\r\n /** Adds an array of Locales to this LocaleProvider */\r\n add(locales: Locale[]): void;\r\n add(l: any): void {\r\n if (l instanceof Locale) {\r\n this._locales.push(l);\r\n } else if (Array.isArray(l)) {\r\n l.forEach(x => this.add(x));\r\n } else {\r\n throw Error('Invalid locale');\r\n }\r\n\r\n if (this._locales.length == 1) {\r\n this._activeLocale = this._locales[0];\r\n }\r\n }\r\n\r\n /** Changes the active locale */\r\n set(localeName: string): void {\r\n const locale = this._locales.find(x => x.name === localeName);\r\n if (locale) {\r\n this._changeSubject.next({ old: this._activeLocale, new: locale });\r\n this._activeLocale = locale;\r\n return;\r\n }\r\n\r\n throw Error('Locale not found.');\r\n }\r\n\r\n /** Gets the active locale */\r\n get(): Locale | undefined {\r\n return this._activeLocale;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n\r\n/**\r\n * Pipe to translate a dictionary key into a localized string.\r\n * It uses the LocalizationService to fetch the translation.\r\n * If the translation is not found, it returns the fallback string if provided.\r\n */\r\n@Pipe({\r\n name: 'ng0Translate',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class TranslatePipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(dictionaryKey: string, fallback?: string) {\r\n return this._ls.get()?.translate(dictionaryKey, fallback) || dictionaryKey;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0TranslateEnum',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class TranslateEnumPipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n /**\r\n * \r\n * @param enumValue \r\n * @param enumName \r\n * @param nullValueKey \r\n * @param returnEnumAsFallback\r\n * @param fallbackKey \r\n * @returns \r\n */\r\n transform(enumValue: string | number | null | undefined, enumName: string, fallback?: string): any {\r\n return this._ls.get()?.translateEnum(enumName, enumValue, fallback);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0TranslateBool',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class TranslateBooleanPipe implements PipeTransform {\r\n\r\n constructor(private localeProvider: LocalizationService) {\r\n }\r\n\r\n transform(value: any, falseKey: string = 'true', trueKey: string = 'false'): any {\r\n return this.localeProvider.get()?.translate(value ? trueKey : falseKey);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0Date',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class DatePipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(value: Date | string | number, format?: string) {\r\n return this._ls.get()?.formatDate(value, format);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0Localize',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizePipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(dictionaryKey: string) {\r\n return this._ls.get()?.translate(dictionaryKey);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\n\r\n@Pipe({\r\n name: 'ng0LocalizeEnum',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizeEnumPipe implements PipeTransform {\r\n private _recompute = true;\r\n private _value?: string;\r\n\r\n constructor(private _ls: LocalizationService) {\r\n _ls.change.pipe(takeUntilDestroyed()).subscribe(x => this._recompute = true);\r\n }\r\n\r\n /**\r\n * \r\n * @param enumValue \r\n * @param enumName \r\n * @param nullValueKey \r\n * @param returnEnumAsFallback\r\n * @param fallbackKey \r\n * @returns \r\n */\r\n transform(enumValue: string | number | null | undefined, enumName: string, fallback?: string): any {\r\n if (this._recompute) {\r\n this._value = this._ls.get()?.translateEnum(enumName, enumValue, fallback);\r\n this._recompute = false;\r\n }\r\n\r\n return this._value;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\n\r\n@Pipe({\r\n name: 'ng0LocalizeBool',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizeBooleanPipe implements PipeTransform {\r\n constructor(private _ls: LocalizationService) {\r\n }\r\n\r\n transform(value: any, falseKey = 'true', trueKey: 'false') {\r\n return this._ls.get()?.translate(value ? trueKey : falseKey);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { Locale } from './locale';\r\nimport { LocalizationService } from './localization.service';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\n\r\n@Pipe({\r\n name: 'ng0LocalizeDate',\r\n standalone: true,\r\n pure: false\r\n})\r\nexport class LocalizeDatePipe implements PipeTransform {\r\n private _value?: string;\r\n private _recompute = true;\r\n\r\n constructor(private _ls: LocalizationService) {\r\n _ls.change.pipe(takeUntilDestroyed()).subscribe(x => this._recompute = true);\r\n }\r\n\r\n transform(value: number | string, format?: string) {\r\n if (this._recompute) {\r\n this._value = this._ls.get()?.formatDate(value, format);\r\n this._recompute = false;\r\n }\r\n\r\n return this._value;\r\n }\r\n}\r\n","import { EnvironmentInjector, inject, runInInjectionContext } from \"@angular/core\";\r\nimport { Locale } from \"./locale\";\r\nimport { LocalizationService } from \"./localization.service\";\r\n\r\n/**\r\n * Object formatter function type.\r\n * @param obj The object to format.\r\n * @param params Additional parameters for formatting.\r\n * @returns The formatted value.\r\n */\r\nexport type ObjectFormatter = (obj: any, ...params: any[]) => any;\r\n\r\n/**\r\n * Object formatter-like types. \r\n */\r\nexport type ObjectFormatterLike = ObjectFormatter | string | number | Array<ObjectFormatter | string | number | boolean | undefined>;\r\n\r\n/**\r\n * Default object formatter function.\r\n * @param value The item to format.\r\n * @returns The formatted string.\r\n */\r\nexport function defaultFormatter(obj: any): string {\r\n return obj?.toString() || '';\r\n}\r\n\r\n/**\r\n * Creates a field formatter that retrieves the value of a specified field from an object.\r\n * @param field The field name to retrieve.\r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function fieldFormatter(field: string): ObjectFormatter {\r\n return (obj: any) => obj?.[field];\r\n}\r\n\r\n/**\r\n * Creates an index formatter that retrieves the value at a specified index from an array.\r\n * @param index The index to retrieve (number or boolean).\r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function indexFormatter(index: number | boolean): ObjectFormatter {\r\n return (obj: any) => {\r\n if (Array.isArray(obj)) {\r\n return obj[+index]; // use + to cast boolean values to numbers\r\n }\r\n\r\n throw Error('Object is not an array');\r\n }\r\n}\r\n\r\n/**\r\n * Creates an array formatter.\r\n * @param array \r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function arrayFormatter(array: Array<any>): ObjectFormatter {\r\n if (!Array.isArray(array)) {\r\n throw Error('Object is not an array');\r\n }\r\n\r\n return (index: number | boolean) => array[+index];\r\n}\r\n\r\n\r\n/**\r\n * Creates a number formatter.\r\n * @param minimumIntegerDigits \r\n * @param minimumFractionDigits \r\n * @param maximumFractionDigits \r\n * @param useGrouping \r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function numberFormatter(\r\n minimumIntegerDigits?: number,\r\n minimumFractionDigits?: number,\r\n maximumFractionDigits?: number,\r\n useGrouping = true): ObjectFormatter {\r\n let locale = inject(LocalizationService, { optional: true })?.get();\r\n const localeName = locale?.definition.name || 'en-US';\r\n\r\n const f = new Intl.NumberFormat(localeName, {\r\n minimumIntegerDigits,\r\n minimumFractionDigits,\r\n maximumFractionDigits,\r\n useGrouping,\r\n })\r\n\r\n return (n: number) => Number.isFinite(n) ? f.format(n) : '';\r\n}\r\n\r\n/**\r\n * Creates a currency formatter.\r\n * @param minFractions \r\n * @param maxFractions \r\n * @returns \r\n */\r\nexport function currencyFormatter(minFractions = 1, maxFractions = 2): ObjectFormatter {\r\n return (n: number, minFractions, maxFractions) => Number.isFinite(n) ? n.toString() : '';\r\n}\r\n\r\n/**\r\n * Creates a date formatter.\r\n * @returns \r\n */\r\nexport function dateFormatter(options?: Intl.DateTimeFormatOptions): ObjectFormatter {\r\n let locale = inject(LocalizationService, { optional: true })?.get();\r\n \r\n const f = new Intl.DateTimeFormat(locale?.name, options)\r\n return (d: string | number | Date) => f.format(new Date(d as number));\r\n}\r\n\r\n/**\r\n * Creates a locale-based formatter.\r\n * @param locale The Locale object.\r\n * @param formatterName The format string in the form of \"formatterName:param1:param2:...\"\r\n * @returns A ValueFormatterFunction\r\n * @private\r\n */\r\nexport function localeFormatter(formatterName: string): ObjectFormatter {\r\n let locale = inject(LocalizationService, { optional: true })?.get();\r\n\r\n if (locale == null) {\r\n throw Error('For using locale formatters, provide a Locale object.')\r\n }\r\n\r\n let formatter = locale.definition.formatters?.[formatterName];\r\n let formatterType = typeof formatter;\r\n\r\n if (!formatter) {\r\n console.warn(`The formatter \"${formatterName}\" is not defined in locale ${locale.definition.name}`);\r\n return defaultFormatter;\r\n }\r\n\r\n if (formatterType === 'function') {\r\n return formatter as ObjectFormatter;\r\n } else if (Array.isArray(formatter)) {\r\n return arrayFormatter(formatter);\r\n } else if (formatterType == 'object' && formatter != null) {\r\n return (value: string) => (formatter as any)[value] || '';\r\n } else {\r\n throw Error(`Invalid locale formatter: ${formatterName}`);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a composite formatter that applies multiple formatters in sequence. \r\n * @param formatters The list of ObjectFormatterLike values to compose.\r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function composite(...formatters: ObjectFormatterLike[]): ObjectFormatter {\r\n const formattersFuncs = formatters.map(item => createObjectFormatter(item as any));\r\n return (obj: any) => formattersFuncs.reduce(\r\n (previous, current, index) => index == 0 ? current(obj) : current(previous)\r\n );\r\n}\r\n\r\n/**\r\n * Creates an ObjectFormatter from various ObjectFormatterLike types.\r\n * @param formatter The ObjectFormatterLike value to convert. \r\n * @param locale Optional locale object for locale-based formatting.\r\n * @param params Additional parameters for the formatter.\r\n * @returns An ObjectFormatter function.\r\n */\r\nexport function createObjectFormatter(formatter: ObjectFormatterLike, ...params: any[]): ObjectFormatter {\r\n switch (typeof formatter) {\r\n case 'function':\r\n return formatter.bind(null, ...params);\r\n case 'number':\r\n return indexFormatter(formatter);\r\n case 'string':\r\n switch (formatter[0]) {\r\n case '#':\r\n return numberFormatter(...params);\r\n case '$':\r\n return currencyFormatter();\r\n case '@':\r\n return dateFormatter();\r\n case '*':\r\n return localeFormatter(formatter.substring(1));\r\n default:\r\n return fieldFormatter(formatter);\r\n }\r\n\r\n case 'object':\r\n if (Array.isArray(formatter) && formatter.length > 0) {\r\n if (formatter[0] == 'C') {\r\n return composite(formatter.slice(1))\r\n } else {\r\n return createObjectFormatter(formatter[0] as string, ...formatter.slice(1));\r\n }\r\n }\r\n break;\r\n }\r\n\r\n throw Error('invalid formatter', { cause: formatter });\r\n}\r\n\r\n/**\r\n * Creates a transform function that converts a ObjectFormatterLike value into a ObjectFormatter.\r\n * @param injector The EnvironmentInjector to use for dependency injection.\r\n * @returns A function that takes a ObjectFormatterLike and returns a ObjectFormatter.\r\n */\r\nexport function objectFormatterAttribute(injector: EnvironmentInjector): ((v: ObjectFormatterLike) => ObjectFormatter) {\r\n return (x: ObjectFormatterLike) => runInInjectionContext(injector, createObjectFormatter.bind(null, x));\r\n};\r\n","import { EnvironmentInjector, inject, Pipe, PipeTransform, runInInjectionContext } from '@angular/core';\r\nimport { createObjectFormatter, ObjectFormatterLike } from './formatter';\r\n\r\n/**\r\n * Format pipe to format objects using various formatter types.\r\n */\r\n@Pipe({\r\n name: 'ng0Format',\r\n standalone: true,\r\n pure: true\r\n})\r\nexport class FormatPipe implements PipeTransform {\r\n private _injector = inject(EnvironmentInjector);\r\n \r\n transform(obj: any, formatter: ObjectFormatterLike, ...params: any[]): any {\r\n const f = runInInjectionContext(this._injector, createObjectFormatter.bind(null, formatter, ...params));\r\n return f(obj);\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { TranslatePipe } from './translate.pipe';\r\nimport { TranslateEnumPipe } from './translate-enum.pipe';\r\nimport { TranslateBooleanPipe } from './translate-boolean-pipe';\r\nimport { DatePipe } from './date.pipe';\r\nimport { LocalizePipe } from './localize.pipe';\r\nimport { LocalizeEnumPipe } from './localize-enum.pipe';\r\nimport { LocalizeBooleanPipe } from './localize-boolean-pipe';\r\nimport { LocalizeDatePipe } from './localize-date.pipe';\r\nimport { FormatPipe } from './format.pipe';\r\n\r\nconst Declares = [\r\n // Pure pipes\r\n TranslatePipe,\r\n TranslateEnumPipe,\r\n TranslateBooleanPipe,\r\n DatePipe,\r\n FormatPipe,\r\n\r\n // Impure pipes\r\n LocalizePipe,\r\n LocalizeEnumPipe,\r\n LocalizeBooleanPipe,\r\n LocalizeDatePipe\r\n];\r\n\r\n@NgModule({\r\n imports: Declares,\r\n exports: Declares\r\n})\r\nexport class LocalizationModule {\r\n}\r\n\r\n","import { InjectionToken } from '@angular/core';\r\nimport { LocalizationService } from './localization.service';\r\nimport { Locale } from './locale';\r\n\r\nexport const LOCALE = new InjectionToken<Locale | LocalizationService>('LOCALE');\r\n\r\nexport interface TranslatedValidationError {\r\n /** Error key */\r\n key: string;\r\n \r\n /** Error object */\r\n value: any;\r\n \r\n /** localized error text */\r\n text?: string;\r\n }\r\n \r\n export interface LocaleChangeEvent {\r\n old?: Locale;\r\n new: Locale;\r\n }\r\n ","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.LocalizationService"],"mappings":";;;;;AAIA;MACa,MAAM,CAAA;AACW,IAAA,UAAA;AAA5B,IAAA,WAAA,CAA4B,UAA4B,EAAA;QAA5B,IAAA,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,oBAAA,OAAO,EAAE,QAAQ;AACjB,oBAAA,OAAO,EAAE;AACV,iBAAA;;;MC1BY,MAAM,GAAG,IAAI,cAAc,CAA+B,QAAQ;;ACJ/E;;AAEG;;;;"}
|
|
@@ -10,10 +10,10 @@ class ClipboardService {
|
|
|
10
10
|
window.navigator.clipboard.writeText(text);
|
|
11
11
|
this._writeSubject.next(text);
|
|
12
12
|
}
|
|
13
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
14
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
13
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: ClipboardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: ClipboardService, providedIn: 'root' });
|
|
15
15
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: ClipboardService, decorators: [{
|
|
17
17
|
type: Injectable,
|
|
18
18
|
args: [{
|
|
19
19
|
providedIn: 'root'
|
|
@@ -29,16 +29,16 @@ class ClipboardCopyDirective {
|
|
|
29
29
|
_onHostClick() {
|
|
30
30
|
this.clipboardService.writeText(this.value());
|
|
31
31
|
}
|
|
32
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
33
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.
|
|
32
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: ClipboardCopyDirective, deps: [{ token: ClipboardService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
33
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: ClipboardCopyDirective, isStandalone: true, selector: "[ng0-clipboard-copy]", inputs: { value: { classPropertyName: "value", publicName: "ng0-clipboard-copy", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "_onHostClick()" } }, ngImport: i0 });
|
|
34
34
|
}
|
|
35
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: ClipboardCopyDirective, decorators: [{
|
|
36
36
|
type: Directive,
|
|
37
37
|
args: [{
|
|
38
38
|
selector: '[ng0-clipboard-copy]',
|
|
39
39
|
standalone: true
|
|
40
40
|
}]
|
|
41
|
-
}], ctorParameters: () => [{ type: ClipboardService }], propDecorators: { _onHostClick: [{
|
|
41
|
+
}], ctorParameters: () => [{ type: ClipboardService }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "ng0-clipboard-copy", required: false }] }], _onHostClick: [{
|
|
42
42
|
type: HostListener,
|
|
43
43
|
args: ['click']
|
|
44
44
|
}] } });
|