@bootkit/ng0 0.0.0-alpha.2 → 0.0.0-alpha.21

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.
Files changed (99) hide show
  1. package/common/index.d.ts +118 -6
  2. package/components/accordion/index.d.ts +1 -1
  3. package/components/backdrop/index.d.ts +12 -0
  4. package/components/button/index.d.ts +48 -0
  5. package/components/card/index.d.ts +27 -0
  6. package/components/code/index.d.ts +35 -0
  7. package/components/confirmation/index.d.ts +66 -0
  8. package/components/dropdown/index.d.ts +78 -0
  9. package/components/form-field/index.d.ts +72 -0
  10. package/components/list/index.d.ts +127 -0
  11. package/components/modal/index.d.ts +22 -4
  12. package/components/nav/index.d.ts +23 -19
  13. package/components/pagination/index.d.ts +35 -9
  14. package/components/popover/index.d.ts +1 -1
  15. package/components/select/index.d.ts +116 -0
  16. package/components/sidenav/index.d.ts +59 -0
  17. package/components/stepper/index.d.ts +26 -0
  18. package/components/table/index.d.ts +273 -0
  19. package/components/toast/index.d.ts +1 -1
  20. package/components/tooltip/index.d.ts +1 -1
  21. package/components/vertical-menu/index.d.ts +61 -0
  22. package/data/index.d.ts +258 -46
  23. package/date/index.d.ts +34 -0
  24. package/fesm2022/bootkit-ng0-common.mjs +89 -11
  25. package/fesm2022/bootkit-ng0-common.mjs.map +1 -1
  26. package/fesm2022/bootkit-ng0-components-accordion.mjs +13 -13
  27. package/fesm2022/bootkit-ng0-components-accordion.mjs.map +1 -1
  28. package/fesm2022/bootkit-ng0-components-backdrop.mjs +46 -0
  29. package/fesm2022/bootkit-ng0-components-backdrop.mjs.map +1 -0
  30. package/fesm2022/bootkit-ng0-components-button.mjs +119 -0
  31. package/fesm2022/bootkit-ng0-components-button.mjs.map +1 -0
  32. package/fesm2022/bootkit-ng0-components-card.mjs +62 -0
  33. package/fesm2022/bootkit-ng0-components-card.mjs.map +1 -0
  34. package/fesm2022/bootkit-ng0-components-code.mjs +70 -0
  35. package/fesm2022/bootkit-ng0-components-code.mjs.map +1 -0
  36. package/fesm2022/bootkit-ng0-components-collapse.mjs +14 -14
  37. package/fesm2022/bootkit-ng0-components-collapse.mjs.map +1 -1
  38. package/fesm2022/bootkit-ng0-components-confirmation.mjs +167 -0
  39. package/fesm2022/bootkit-ng0-components-confirmation.mjs.map +1 -0
  40. package/fesm2022/bootkit-ng0-components-dropdown.mjs +189 -0
  41. package/fesm2022/bootkit-ng0-components-dropdown.mjs.map +1 -0
  42. package/fesm2022/bootkit-ng0-components-form-field.mjs +147 -0
  43. package/fesm2022/bootkit-ng0-components-form-field.mjs.map +1 -0
  44. package/fesm2022/bootkit-ng0-components-list.mjs +331 -0
  45. package/fesm2022/bootkit-ng0-components-list.mjs.map +1 -0
  46. package/fesm2022/bootkit-ng0-components-modal.mjs +40 -23
  47. package/fesm2022/bootkit-ng0-components-modal.mjs.map +1 -1
  48. package/fesm2022/bootkit-ng0-components-nav.mjs +58 -59
  49. package/fesm2022/bootkit-ng0-components-nav.mjs.map +1 -1
  50. package/fesm2022/bootkit-ng0-components-offcanvas.mjs +9 -9
  51. package/fesm2022/bootkit-ng0-components-offcanvas.mjs.map +1 -1
  52. package/fesm2022/bootkit-ng0-components-overlay.mjs.map +1 -1
  53. package/fesm2022/bootkit-ng0-components-pagination.mjs +58 -23
  54. package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
  55. package/fesm2022/bootkit-ng0-components-popover.mjs +10 -10
  56. package/fesm2022/bootkit-ng0-components-popover.mjs.map +1 -1
  57. package/fesm2022/bootkit-ng0-components-select.mjs +427 -0
  58. package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -0
  59. package/fesm2022/bootkit-ng0-components-sidenav.mjs +153 -0
  60. package/fesm2022/bootkit-ng0-components-sidenav.mjs.map +1 -0
  61. package/fesm2022/bootkit-ng0-components-stepper.mjs +91 -0
  62. package/fesm2022/bootkit-ng0-components-stepper.mjs.map +1 -0
  63. package/fesm2022/bootkit-ng0-components-table.mjs +461 -0
  64. package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -0
  65. package/fesm2022/bootkit-ng0-components-toast.mjs +7 -7
  66. package/fesm2022/bootkit-ng0-components-toast.mjs.map +1 -1
  67. package/fesm2022/bootkit-ng0-components-tooltip.mjs +8 -8
  68. package/fesm2022/bootkit-ng0-components-tooltip.mjs.map +1 -1
  69. package/fesm2022/bootkit-ng0-components-vertical-menu.mjs +161 -0
  70. package/fesm2022/bootkit-ng0-components-vertical-menu.mjs.map +1 -0
  71. package/fesm2022/bootkit-ng0-data.mjs +291 -90
  72. package/fesm2022/bootkit-ng0-data.mjs.map +1 -1
  73. package/fesm2022/bootkit-ng0-date.mjs +50 -0
  74. package/fesm2022/bootkit-ng0-date.mjs.map +1 -0
  75. package/fesm2022/bootkit-ng0-file.mjs +50 -0
  76. package/fesm2022/bootkit-ng0-file.mjs.map +1 -0
  77. package/fesm2022/bootkit-ng0-form.mjs +514 -0
  78. package/fesm2022/bootkit-ng0-form.mjs.map +1 -0
  79. package/fesm2022/bootkit-ng0-http.mjs +225 -179
  80. package/fesm2022/bootkit-ng0-http.mjs.map +1 -1
  81. package/fesm2022/bootkit-ng0-localization-locales.mjs +115 -0
  82. package/fesm2022/bootkit-ng0-localization-locales.mjs.map +1 -0
  83. package/fesm2022/bootkit-ng0-localization.mjs +481 -0
  84. package/fesm2022/bootkit-ng0-localization.mjs.map +1 -0
  85. package/fesm2022/bootkit-ng0-platform-browser.mjs +51 -0
  86. package/fesm2022/bootkit-ng0-platform-browser.mjs.map +1 -0
  87. package/fesm2022/bootkit-ng0-script.mjs +59 -0
  88. package/fesm2022/bootkit-ng0-script.mjs.map +1 -0
  89. package/fesm2022/bootkit-ng0-security.mjs +17 -15
  90. package/fesm2022/bootkit-ng0-security.mjs.map +1 -1
  91. package/file/index.d.ts +22 -0
  92. package/form/index.d.ts +127 -0
  93. package/http/index.d.ts +141 -40
  94. package/localization/index.d.ts +305 -0
  95. package/localization/locales/index.d.ts +7 -0
  96. package/package.json +90 -10
  97. package/platform/browser/index.d.ts +22 -0
  98. package/script/index.d.ts +27 -0
  99. package/security/index.d.ts +3 -9
@@ -0,0 +1,115 @@
1
+ import { Locale } from '@bootkit/ng0/localization';
2
+
3
+ const formatNumber$1 = (n) => n.toLocaleString();
4
+ const EN_US_LOCALE = new Locale({
5
+ name: 'en-US',
6
+ rtl: false,
7
+ dictionary: {
8
+ ok: 'Ok',
9
+ cancel: 'Cancel',
10
+ warning: 'Warning',
11
+ areYouSure: 'Are you sure?',
12
+ noRecords: 'No records.',
13
+ first: 'First',
14
+ last: 'Last',
15
+ next: 'Next',
16
+ previous: 'Previous',
17
+ pageXofY: 'Page {0} of {1}',
18
+ },
19
+ form: {
20
+ validation: {
21
+ errors: {
22
+ '*': (e) => 'Invalid',
23
+ required: (e) => `Required`,
24
+ min: (e) => `Minimum: ${formatNumber$1(e.min)}`,
25
+ max: (e) => `Maximum: ${formatNumber$1(e.max)}`,
26
+ minlength: (e) => `Minimum length: ${e.requiredLength}`,
27
+ maxlength: (e) => `Maximum length: ${e.requiredLength}`,
28
+ email: (e) => `Invalid email`,
29
+ }
30
+ }
31
+ },
32
+ formatters: {
33
+ boolean: {
34
+ Default: ['Yes', 'No'],
35
+ ActiveInactive: ['Active', 'Inactive'],
36
+ YesNo: ['Yes', 'No'],
37
+ TrueFalse: ['True', 'False'],
38
+ EnableDisable: ['Enabled', 'Disabled'],
39
+ OnOff: ['On', 'Off'],
40
+ }
41
+ },
42
+ components: {
43
+ table: {
44
+ noRecords: 'No records found.',
45
+ pagingInfo: (info) => `Showingsdsd ${formatNumber$1(info.firstRecord)}-${formatNumber$1(info.lastRecord)} of ${formatNumber$1(info.totalRecords)} records`
46
+ }
47
+ }
48
+ });
49
+
50
+ const formatNumber = (n) => n.toLocaleString();
51
+ const FA_IR_LOCALE = new Locale({
52
+ name: 'fa-IR',
53
+ rtl: true,
54
+ dictionary: {
55
+ ok: 'تایید',
56
+ cancel: 'لغو',
57
+ warning: 'هشدار',
58
+ areYouSure: 'آیا مطمئن هستید?',
59
+ noRecords: 'بدون رکورد',
60
+ first: 'اولین',
61
+ last: 'آخرین',
62
+ next: 'بعدی',
63
+ previous: 'قبلی',
64
+ pageXofY: 'صفحه {0} از {1}',
65
+ },
66
+ form: {
67
+ validation: {
68
+ errors: {
69
+ '*': (e) => 'نامعتبر',
70
+ required: (e) => `الزامی`,
71
+ min: (e) => `حداقل: ${formatNumber(e.min)}`,
72
+ max: (e) => `حداکثر: ${formatNumber(e.max)}`,
73
+ minlength: (e) => `حداقل ${e.requiredLength} کاراکتر`,
74
+ maxlength: (e) => `حداکثر ${e.requiredLength} کاراکتر`,
75
+ email: (e) => `ایمیل نامعتبر است`,
76
+ }
77
+ }
78
+ },
79
+ formatters: {
80
+ boolean: {
81
+ Default: ['بله', 'خیر', ''],
82
+ ActiveInactive: ['فعال', 'غیرفعال', ''],
83
+ YesNo: ['بله', 'خیر', ''],
84
+ TrueFalse: ['درست', 'غلط', ''],
85
+ EnableDisable: ['فعال', 'غیرفعال', ''],
86
+ OnOff: ['روشن', 'خاموش', ''],
87
+ }
88
+ },
89
+ components: {
90
+ table: {
91
+ noRecords: 'رکوردی وجود ندارد',
92
+ pagingInfo: (info) => `نمایش ${formatNumber(info.firstRecord)}-${formatNumber(info.lastRecord)} از ${formatNumber(info.totalRecords)} رکورد`
93
+ }
94
+ },
95
+ data: {
96
+ logicalOperators: {
97
+ contains: 'شامل',
98
+ startsWith: 'شروع',
99
+ endsWith: 'پایان',
100
+ eq: 'مساوی',
101
+ gt: 'بزرگتر',
102
+ gte: 'بزرگتر یا مساوی',
103
+ lt: 'کوچکتر',
104
+ lte: 'کوچکتر یا مساوی',
105
+ ne: 'مخالف',
106
+ }
107
+ }
108
+ });
109
+
110
+ /**
111
+ * Generated bundle index. Do not edit.
112
+ */
113
+
114
+ export { EN_US_LOCALE, FA_IR_LOCALE };
115
+ //# sourceMappingURL=bootkit-ng0-localization-locales.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootkit-ng0-localization-locales.mjs","sources":["../../../projects/ng0/localization/locales/en-us.ts","../../../projects/ng0/localization/locales/fa-ir.ts","../../../projects/ng0/localization/locales/bootkit-ng0-localization-locales.ts"],"sourcesContent":["import { Locale } from '@bootkit/ng0/localization';\r\n\r\nconst formatNumber = (n: number) => n.toLocaleString();\r\n\r\nexport const EN_US_LOCALE = new Locale({\r\n name: 'en-US',\r\n rtl: false,\r\n dictionary: {\r\n ok: 'Ok',\r\n cancel: 'Cancel',\r\n warning: 'Warning',\r\n areYouSure: 'Are you sure?',\r\n noRecords: 'No records.',\r\n first: 'First',\r\n last: 'Last',\r\n next: 'Next',\r\n previous: 'Previous',\r\n pageXofY: 'Page {0} of {1}',\r\n },\r\n form: {\r\n validation: {\r\n errors: {\r\n '*': (e) => 'Invalid',\r\n required: (e) => `Required`,\r\n min: (e) => `Minimum: ${formatNumber(e.min)}`,\r\n max: (e) => `Maximum: ${formatNumber(e.max)}`,\r\n minlength: (e) => `Minimum length: ${e.requiredLength}`,\r\n maxlength: (e) => `Maximum length: ${e.requiredLength}`,\r\n email: (e) => `Invalid email`,\r\n }\r\n }\r\n },\r\n formatters: {\r\n boolean: {\r\n Default: ['Yes', 'No'],\r\n ActiveInactive: ['Active', 'Inactive'],\r\n YesNo: ['Yes', 'No'],\r\n TrueFalse: ['True', 'False'],\r\n EnableDisable: ['Enabled', 'Disabled'],\r\n OnOff: ['On', 'Off'],\r\n }\r\n },\r\n components: {\r\n table: {\r\n noRecords: 'No records found.',\r\n pagingInfo: (info) => `Showingsdsd ${formatNumber(info.firstRecord)}-${formatNumber(info.lastRecord)} of ${formatNumber(info.totalRecords!)} records`\r\n }\r\n }\r\n});\r\n","import { Locale } from '@bootkit/ng0/localization';\r\n\r\nconst formatNumber = (n: number) => n.toLocaleString();\r\n\r\nexport const FA_IR_LOCALE = new Locale({\r\n name: 'fa-IR',\r\n rtl: true,\r\n dictionary: {\r\n ok: 'تایید',\r\n cancel: 'لغو',\r\n warning: 'هشدار',\r\n areYouSure: 'آیا مطمئن هستید?',\r\n noRecords: 'بدون رکورد',\r\n first: 'اولین',\r\n last: 'آخرین',\r\n next: 'بعدی',\r\n previous: 'قبلی',\r\n pageXofY: 'صفحه {0} از {1}',\r\n },\r\n form: {\r\n validation: {\r\n errors: {\r\n '*': (e) => 'نامعتبر',\r\n required: (e) => `الزامی`,\r\n min: (e) => `حداقل: ${formatNumber(e.min)}`,\r\n max: (e) => `حداکثر: ${formatNumber(e.max)}`,\r\n minlength: (e) => `حداقل ${e.requiredLength} کاراکتر`,\r\n maxlength: (e) => `حداکثر ${e.requiredLength} کاراکتر`,\r\n email: (e) => `ایمیل نامعتبر است`,\r\n }\r\n }\r\n },\r\n formatters: {\r\n boolean: {\r\n Default: ['بله', 'خیر', ''],\r\n ActiveInactive: ['فعال', 'غیرفعال', ''],\r\n YesNo: ['بله', 'خیر', ''],\r\n TrueFalse: ['درست', 'غلط', ''],\r\n EnableDisable: ['فعال', 'غیرفعال', ''],\r\n OnOff: ['روشن', 'خاموش', ''],\r\n }\r\n },\r\n components: {\r\n table: {\r\n noRecords: 'رکوردی وجود ندارد',\r\n pagingInfo: (info) => `نمایش ${formatNumber(info.firstRecord)}-${formatNumber(info.lastRecord)} از ${formatNumber(info.totalRecords!)} رکورد`\r\n }\r\n },\r\n data: {\r\n logicalOperators: {\r\n contains: 'شامل',\r\n startsWith: 'شروع',\r\n endsWith: 'پایان',\r\n eq: 'مساوی',\r\n gt: 'بزرگتر',\r\n gte: 'بزرگتر یا مساوی',\r\n lt: 'کوچکتر',\r\n lte: 'کوچکتر یا مساوی',\r\n ne: 'مخالف',\r\n\r\n }\r\n }\r\n});\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["formatNumber"],"mappings":";;AAEA,MAAMA,cAAY,GAAG,CAAC,CAAS,KAAK,CAAC,CAAC,cAAc,EAAE;AAE/C,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC;AACnC,IAAA,IAAI,EAA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ACJ,KAAA;AACD,IAAA,IAAI,EAAE;AACF,QAAA,gBAAgB,EAAE;AACd,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,UAAU,EAAE,MAAM;AAClB,YAAA,QAAQ,EAAE,OAAO;AACjB,YAAA,EAAE,EAAE,OAAO;AACX,YAAA,EAAE,EAAE,QAAQ;AACZ,YAAA,GAAG,EAAE,iBAAiB;AACtB,YAAA,EAAE,EAAE,QAAQ;AACZ,YAAA,GAAG,EAAE,iBAAiB;AACtB,YAAA,EAAE,EAAE,OAAO;AAEd;AACJ;AACJ,CAAA;;AC9DD;;AAEG;;;;"}
@@ -0,0 +1,481 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Pipe, NgModule, InjectionToken } from '@angular/core';
3
+ import { Subject } from 'rxjs';
4
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+
6
+ /** Locale */
7
+ class Locale {
8
+ definition;
9
+ constructor(definition) {
10
+ this.definition = definition;
11
+ }
12
+ /**
13
+ * Returns the name of the locale
14
+ * @returns The name of the locale
15
+ */
16
+ get name() {
17
+ return this.definition.name;
18
+ }
19
+ /**
20
+ * Translates a key in the dictionary
21
+ * @param key The key to look up
22
+ * @param fallback Optional fallback value if the key is not found
23
+ * @returns The translated string or the fallbackValue if not found
24
+ */
25
+ translate(key, fallback) {
26
+ return this.definition.dictionary?.[key] ?? fallback;
27
+ }
28
+ /**
29
+ * Translates an enum value
30
+ * @param enumName The name of the enum
31
+ * @param enumValue The value of the enum to translate
32
+ * @param fallback
33
+ * @returns The translated string or the enum value itself if not found
34
+ */
35
+ translateEnum(enumName, enumValue, fallback) {
36
+ let e = this.definition.enums?.[enumName];
37
+ if (!e) {
38
+ return fallback || enumValue?.toString();
39
+ }
40
+ if (enumValue === null) {
41
+ return e['[null]'] || e['[empty]'];
42
+ }
43
+ else if (enumValue === undefined) {
44
+ return e['[undefined]'] || e['[empty]'];
45
+ }
46
+ else if (enumValue === '') {
47
+ return e['empty'];
48
+ }
49
+ else {
50
+ return e[enumValue] || e['[?]'] || fallback || enumValue?.toString();
51
+ }
52
+ }
53
+ /**
54
+ * Translates a form validation error
55
+ * @param errorKey The key of the error to translate
56
+ * @param error The error object
57
+ */
58
+ translateError(errorKey, error, fallbackMessage = undefined) {
59
+ const errors = this.definition?.form?.validation?.errors;
60
+ if (!errors) {
61
+ return fallbackMessage;
62
+ }
63
+ const translatorFunc = errors[errorKey] ?? errors['*'];
64
+ return typeof translatorFunc === 'function' ? translatorFunc(error) : fallbackMessage;
65
+ }
66
+ /**
67
+ * Translates validation errors
68
+ * @param errors Validation errors object
69
+ * @returns Array of translated validation errors
70
+ */
71
+ translateErrors(errors) {
72
+ const result = [];
73
+ for (const key in errors) {
74
+ if (Object.prototype.hasOwnProperty.call(errors, key)) {
75
+ result.push({
76
+ key: key,
77
+ value: errors[key],
78
+ text: this.translateError(key, errors[key])
79
+ });
80
+ }
81
+ }
82
+ return result;
83
+ }
84
+ /**
85
+ * Translates the first error in the validation errors object
86
+ * @param errors Validation errors object
87
+ * @returns TranslatedValidationError or undefined if no errors
88
+ */
89
+ translateFirstError(errors, fallbackMessage = undefined) {
90
+ const keys = Object.keys(errors);
91
+ if (keys.length === 0) {
92
+ return undefined;
93
+ }
94
+ const key = keys[0];
95
+ const value = errors[key];
96
+ return {
97
+ key,
98
+ value,
99
+ text: this.translateError(key, value, fallbackMessage)
100
+ };
101
+ }
102
+ /**
103
+ * Clones and extends this object and returns a new Locale (without modifying this object).
104
+ */
105
+ extend(definition) {
106
+ return new Locale({ ...this.definition, ...definition });
107
+ }
108
+ /**
109
+ *
110
+ * @param date Date string or timestamp
111
+ * @returns Formatted date string based on the locale
112
+ */
113
+ formatDate(date, format) {
114
+ return date ? new Date(date).toLocaleDateString(this.definition.name, { hour: '2-digit', minute: '2-digit' }) : '';
115
+ }
116
+ /**
117
+ * Returns a formatter function by its name and parameters.
118
+ * @param format The format string in the form of "formatterName:param1:param2:..."
119
+ * @returns A FormatFunction
120
+ */
121
+ getFormatter(format) {
122
+ let parts = format.split(':');
123
+ let name = parts[0];
124
+ let params = parts.length > 1 ? parts.slice(1) : [];
125
+ switch (name) {
126
+ case 'boolean':
127
+ let booleanKind = params.length > 0 ? params[0] : 'Default';
128
+ let f = this.definition.formatters?.boolean?.[booleanKind];
129
+ if (!Array.isArray(f)) {
130
+ throw new Error(`Boolean formatter is not defined in locale ${this.definition.name}`);
131
+ }
132
+ return (value) => {
133
+ return value === true ? f[0] : (value === false ? f[1] : f[2]);
134
+ };
135
+ case 'enum':
136
+ let enumName = params[0];
137
+ if (!enumName) {
138
+ // throw new Error('Enum name is required for enum formatter');
139
+ return (enumValue) => enumValue?.toString() ?? '';
140
+ }
141
+ return (enumValue) => {
142
+ return this.translateEnum(enumName, enumValue, enumValue?.toString());
143
+ };
144
+ default:
145
+ let customFormatter = this.definition.formatters?.custom?.[name];
146
+ if (customFormatter) {
147
+ return customFormatter;
148
+ }
149
+ throw new Error(`formatter is not defined in locale ${this.definition.name}`);
150
+ }
151
+ }
152
+ }
153
+
154
+ ;
155
+
156
+ class LocalizationService {
157
+ _locales = [];
158
+ _activeLocale;
159
+ _changeSubject = new Subject();
160
+ change = this._changeSubject.asObservable();
161
+ constructor() {
162
+ }
163
+ add(l) {
164
+ if (l instanceof Locale) {
165
+ this._locales.push(l);
166
+ }
167
+ else if (Array.isArray(l)) {
168
+ l.forEach(x => this.add(x));
169
+ }
170
+ else {
171
+ throw Error('Invalid locale');
172
+ }
173
+ if (this._locales.length == 1) {
174
+ this._activeLocale = this._locales[0];
175
+ }
176
+ }
177
+ /** Changes the active locale */
178
+ set(localeName) {
179
+ const locale = this._locales.find(x => x.name === localeName);
180
+ if (locale) {
181
+ this._changeSubject.next({ old: this._activeLocale, new: locale });
182
+ this._activeLocale = locale;
183
+ return;
184
+ }
185
+ throw Error('Locale not found.');
186
+ }
187
+ /** Gets the active locale */
188
+ get() {
189
+ return this._activeLocale;
190
+ }
191
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
192
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizationService, providedIn: 'root' });
193
+ }
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizationService, decorators: [{
195
+ type: Injectable,
196
+ args: [{
197
+ providedIn: 'root'
198
+ }]
199
+ }], ctorParameters: () => [] });
200
+
201
+ /**
202
+ * Pipe to translate a dictionary key into a localized string.
203
+ * It uses the LocalizationService to fetch the translation.
204
+ * If the translation is not found, it returns the fallback string if provided.
205
+ */
206
+ class TranslatePipe {
207
+ _ls;
208
+ constructor(_ls) {
209
+ this._ls = _ls;
210
+ }
211
+ transform(dictionaryKey, fallback) {
212
+ return this._ls.get()?.translate(dictionaryKey, fallback) || dictionaryKey;
213
+ }
214
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TranslatePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
215
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "ng0Translate" });
216
+ }
217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TranslatePipe, decorators: [{
218
+ type: Pipe,
219
+ args: [{
220
+ name: 'ng0Translate',
221
+ standalone: true,
222
+ pure: true
223
+ }]
224
+ }], ctorParameters: () => [{ type: LocalizationService }] });
225
+
226
+ class TranslateEnumPipe {
227
+ _ls;
228
+ constructor(_ls) {
229
+ this._ls = _ls;
230
+ }
231
+ /**
232
+ *
233
+ * @param enumValue
234
+ * @param enumName
235
+ * @param nullValueKey
236
+ * @param returnEnumAsFallback
237
+ * @param fallbackKey
238
+ * @returns
239
+ */
240
+ transform(enumValue, enumName, fallback) {
241
+ return this._ls.get()?.translateEnum(enumName, enumValue, fallback);
242
+ }
243
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TranslateEnumPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
244
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: TranslateEnumPipe, isStandalone: true, name: "ng0TranslateEnum" });
245
+ }
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TranslateEnumPipe, decorators: [{
247
+ type: Pipe,
248
+ args: [{
249
+ name: 'ng0TranslateEnum',
250
+ standalone: true,
251
+ pure: true
252
+ }]
253
+ }], ctorParameters: () => [{ type: LocalizationService }] });
254
+
255
+ class TranslateBooleanPipe {
256
+ localeProvider;
257
+ constructor(localeProvider) {
258
+ this.localeProvider = localeProvider;
259
+ }
260
+ transform(value, falseKey = 'true', trueKey = 'false') {
261
+ return this.localeProvider.get()?.translate(value ? trueKey : falseKey);
262
+ }
263
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TranslateBooleanPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
264
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: TranslateBooleanPipe, isStandalone: true, name: "ng0TranslateBool" });
265
+ }
266
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TranslateBooleanPipe, decorators: [{
267
+ type: Pipe,
268
+ args: [{
269
+ name: 'ng0TranslateBool',
270
+ standalone: true,
271
+ pure: true
272
+ }]
273
+ }], ctorParameters: () => [{ type: LocalizationService }] });
274
+
275
+ class DatePipe {
276
+ _ls;
277
+ constructor(_ls) {
278
+ this._ls = _ls;
279
+ }
280
+ transform(value, format) {
281
+ return this._ls.get()?.formatDate(value, format);
282
+ }
283
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DatePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
284
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: DatePipe, isStandalone: true, name: "ng0Date" });
285
+ }
286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DatePipe, decorators: [{
287
+ type: Pipe,
288
+ args: [{
289
+ name: 'ng0Date',
290
+ standalone: true,
291
+ pure: true
292
+ }]
293
+ }], ctorParameters: () => [{ type: LocalizationService }] });
294
+
295
+ class LocalizePipe {
296
+ _ls;
297
+ constructor(_ls) {
298
+ this._ls = _ls;
299
+ }
300
+ transform(dictionaryKey) {
301
+ return this._ls.get()?.translate(dictionaryKey);
302
+ }
303
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
304
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: LocalizePipe, isStandalone: true, name: "ng0Localize", pure: false });
305
+ }
306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizePipe, decorators: [{
307
+ type: Pipe,
308
+ args: [{
309
+ name: 'ng0Localize',
310
+ standalone: true,
311
+ pure: false
312
+ }]
313
+ }], ctorParameters: () => [{ type: LocalizationService }] });
314
+
315
+ class LocalizeEnumPipe {
316
+ _ls;
317
+ _recompute = true;
318
+ _value;
319
+ constructor(_ls) {
320
+ this._ls = _ls;
321
+ _ls.change.pipe(takeUntilDestroyed()).subscribe(x => this._recompute = true);
322
+ }
323
+ /**
324
+ *
325
+ * @param enumValue
326
+ * @param enumName
327
+ * @param nullValueKey
328
+ * @param returnEnumAsFallback
329
+ * @param fallbackKey
330
+ * @returns
331
+ */
332
+ transform(enumValue, enumName, fallback) {
333
+ if (this._recompute) {
334
+ this._value = this._ls.get()?.translateEnum(enumName, enumValue, fallback);
335
+ this._recompute = false;
336
+ }
337
+ return this._value;
338
+ }
339
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizeEnumPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
340
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: LocalizeEnumPipe, isStandalone: true, name: "ng0LocalizeEnum", pure: false });
341
+ }
342
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizeEnumPipe, decorators: [{
343
+ type: Pipe,
344
+ args: [{
345
+ name: 'ng0LocalizeEnum',
346
+ standalone: true,
347
+ pure: false
348
+ }]
349
+ }], ctorParameters: () => [{ type: LocalizationService }] });
350
+
351
+ class LocalizeBooleanPipe {
352
+ _ls;
353
+ constructor(_ls) {
354
+ this._ls = _ls;
355
+ }
356
+ transform(value, falseKey = 'true', trueKey) {
357
+ return this._ls.get()?.translate(value ? trueKey : falseKey);
358
+ }
359
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizeBooleanPipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
360
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: LocalizeBooleanPipe, isStandalone: true, name: "ng0LocalizeBool", pure: false });
361
+ }
362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizeBooleanPipe, decorators: [{
363
+ type: Pipe,
364
+ args: [{
365
+ name: 'ng0LocalizeBool',
366
+ standalone: true,
367
+ pure: false
368
+ }]
369
+ }], ctorParameters: () => [{ type: LocalizationService }] });
370
+
371
+ class LocalizeDatePipe {
372
+ _ls;
373
+ _value;
374
+ _recompute = true;
375
+ constructor(_ls) {
376
+ this._ls = _ls;
377
+ _ls.change.pipe(takeUntilDestroyed()).subscribe(x => this._recompute = true);
378
+ }
379
+ transform(value, format) {
380
+ if (this._recompute) {
381
+ this._value = this._ls.get()?.formatDate(value, format);
382
+ this._recompute = false;
383
+ }
384
+ return this._value;
385
+ }
386
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizeDatePipe, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Pipe });
387
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: LocalizeDatePipe, isStandalone: true, name: "ng0LocalizeDate", pure: false });
388
+ }
389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizeDatePipe, decorators: [{
390
+ type: Pipe,
391
+ args: [{
392
+ name: 'ng0LocalizeDate',
393
+ standalone: true,
394
+ pure: false
395
+ }]
396
+ }], ctorParameters: () => [{ type: LocalizationService }] });
397
+
398
+ const Declares = [
399
+ // Pure pipes
400
+ TranslatePipe,
401
+ TranslateEnumPipe,
402
+ TranslateBooleanPipe,
403
+ DatePipe,
404
+ // Impure pipes
405
+ LocalizePipe,
406
+ LocalizeEnumPipe,
407
+ LocalizeBooleanPipe,
408
+ LocalizeDatePipe
409
+ ];
410
+ class LocalizationModule {
411
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
412
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: LocalizationModule, imports: [
413
+ // Pure pipes
414
+ TranslatePipe,
415
+ TranslateEnumPipe,
416
+ TranslateBooleanPipe,
417
+ DatePipe,
418
+ // Impure pipes
419
+ LocalizePipe,
420
+ LocalizeEnumPipe,
421
+ LocalizeBooleanPipe,
422
+ LocalizeDatePipe], exports: [
423
+ // Pure pipes
424
+ TranslatePipe,
425
+ TranslateEnumPipe,
426
+ TranslateBooleanPipe,
427
+ DatePipe,
428
+ // Impure pipes
429
+ LocalizePipe,
430
+ LocalizeEnumPipe,
431
+ LocalizeBooleanPipe,
432
+ LocalizeDatePipe] });
433
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizationModule });
434
+ }
435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: LocalizationModule, decorators: [{
436
+ type: NgModule,
437
+ args: [{
438
+ imports: Declares,
439
+ exports: Declares
440
+ }]
441
+ }] });
442
+
443
+ const LOCALE = new InjectionToken('LOCALE');
444
+
445
+ /**
446
+ * Default format function.
447
+ * @param value The item to format.
448
+ * @returns The formatted string.
449
+ */
450
+ function defaultValueFormatter(value) {
451
+ if (value == null) {
452
+ return '';
453
+ }
454
+ return value.toString();
455
+ }
456
+ function ValueFormatterAttribute(locale) {
457
+ return (v) => {
458
+ if (typeof v === 'function')
459
+ return v;
460
+ else if (typeof v === 'string') {
461
+ if (v.startsWith('field:')) {
462
+ let fieldName = v.substring(6);
463
+ return (item, ...options) => item?.[fieldName]?.toString() ?? '';
464
+ }
465
+ else {
466
+ if (locale == null) {
467
+ throw Error('For using locale value formatters, provide a locale object.');
468
+ }
469
+ return locale.getFormatter(v);
470
+ }
471
+ }
472
+ throw Error('invalid value');
473
+ };
474
+ }
475
+
476
+ /**
477
+ * Generated bundle index. Do not edit.
478
+ */
479
+
480
+ export { DatePipe, LOCALE, Locale, LocalizationModule, LocalizationService, LocalizeBooleanPipe, LocalizeDatePipe, LocalizeEnumPipe, LocalizePipe, TranslateBooleanPipe, TranslateEnumPipe, TranslatePipe, ValueFormatterAttribute, defaultValueFormatter };
481
+ //# sourceMappingURL=bootkit-ng0-localization.mjs.map