@acorex/core 16.0.2 → 17.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/common/README.md +3 -0
- package/common/countries/countries.data.d.ts +2 -0
- package/common/countries/country.d.ts +13 -0
- package/common/index.d.ts +2 -0
- package/config/README.md +3 -0
- package/config/index.d.ts +2 -0
- package/config/lib/configs.d.ts +6 -0
- package/config/lib/configs.service.d.ts +12 -0
- package/date-time/README.md +3 -0
- package/date-time/index.d.ts +10 -0
- package/date-time/lib/calendar.service.d.ts +27 -0
- package/date-time/lib/dateTime.config.d.ts +12 -0
- package/date-time/lib/datetime.class.d.ts +138 -0
- package/date-time/lib/datetime.module.d.ts +8 -0
- package/date-time/lib/datetime.pipe.d.ts +12 -0
- package/date-time/lib/formatters/datetime-formatter.d.ts +19 -0
- package/date-time/lib/formatters/timeleft-formatter.d.ts +16 -0
- package/date-time/lib/georgian.calendar.d.ts +21 -0
- package/date-time/lib/holidays.loader.d.ts +21 -0
- package/date-time/lib/jalali.calendar.d.ts +40 -0
- package/esm2022/common/acorex-core-common.mjs +5 -0
- package/esm2022/common/countries/countries.data.mjs +2625 -0
- package/esm2022/common/countries/country.mjs +2 -0
- package/esm2022/common/index.mjs +3 -0
- package/esm2022/config/acorex-core-config.mjs +5 -0
- package/esm2022/config/index.mjs +3 -0
- package/esm2022/config/lib/configs.mjs +7 -0
- package/esm2022/config/lib/configs.service.mjs +27 -0
- package/esm2022/date-time/acorex-core-date-time.mjs +5 -0
- package/esm2022/date-time/index.mjs +11 -0
- package/esm2022/date-time/lib/calendar.service.mjs +100 -0
- package/esm2022/date-time/lib/dateTime.config.mjs +50 -0
- package/esm2022/date-time/lib/datetime.class.mjs +337 -0
- package/esm2022/date-time/lib/datetime.module.mjs +27 -0
- package/esm2022/date-time/lib/datetime.pipe.mjs +29 -0
- package/esm2022/date-time/lib/formatters/datetime-formatter.mjs +32 -0
- package/esm2022/date-time/lib/formatters/timeleft-formatter.mjs +91 -0
- package/esm2022/date-time/lib/georgian.calendar.mjs +203 -0
- package/esm2022/date-time/lib/holidays.loader.mjs +13 -0
- package/esm2022/date-time/lib/jalali.calendar.mjs +440 -0
- package/esm2022/events/acorex-core-events.mjs +5 -0
- package/esm2022/events/index.mjs +3 -0
- package/esm2022/events/lib/event.service.mjs +43 -0
- package/esm2022/events/lib/event.type.mjs +6 -0
- package/esm2022/file/acorex-core-file.mjs +5 -0
- package/esm2022/file/index.mjs +7 -0
- package/esm2022/file/lib/file-download-ref.class.mjs +12 -0
- package/esm2022/file/lib/file-download-result.class.mjs +45 -0
- package/esm2022/file/lib/file-size-formatter.mjs +24 -0
- package/esm2022/file/lib/file-upload-ref.class.mjs +12 -0
- package/esm2022/file/lib/file.module.mjs +20 -0
- package/esm2022/file/lib/file.service.mjs +103 -0
- package/esm2022/format/acorex-core-format.mjs +5 -0
- package/esm2022/format/index.mjs +8 -0
- package/esm2022/format/lib/format.config.mjs +3 -0
- package/esm2022/format/lib/format.module.mjs +64 -0
- package/esm2022/format/lib/format.pipe.mjs +37 -0
- package/esm2022/format/lib/format.service.mjs +95 -0
- package/esm2022/format/lib/format.types.mjs +2 -0
- package/esm2022/format/lib/formatters/number-formatter.mjs +74 -0
- package/esm2022/format/lib/formatters/string-formatter.mjs +15 -0
- package/esm2022/image/acorex-core-image.mjs +5 -0
- package/esm2022/image/index.mjs +2 -0
- package/esm2022/image/lib/image.service.mjs +43 -0
- package/esm2022/index.mjs +2 -44
- package/esm2022/memorize/acorex-core-memorize.mjs +5 -0
- package/esm2022/memorize/index.mjs +2 -0
- package/esm2022/memorize/lib/memorize.decorator.mjs +19 -0
- package/esm2022/pipes/acorex-core-pipes.mjs +5 -0
- package/esm2022/pipes/index.mjs +2 -0
- package/esm2022/pipes/lib/safe/safe.pipe.mjs +38 -0
- package/esm2022/platform/acorex-core-platform.mjs +5 -0
- package/esm2022/platform/index.mjs +2 -0
- package/esm2022/platform/lib/platform.service.mjs +225 -0
- package/esm2022/storage/acorex-core-storage.mjs +5 -0
- package/esm2022/storage/cookie-storage.service.mjs +202 -0
- package/esm2022/storage/index.mjs +5 -0
- package/esm2022/storage/local-storage.service.mjs +58 -0
- package/esm2022/storage/session-storage.service.mjs +22 -0
- package/esm2022/storage/storage.interface.mjs +2 -0
- package/esm2022/translation/acorex-core-translation.mjs +5 -0
- package/esm2022/translation/index.mjs +9 -0
- package/esm2022/translation/lib/translation-scope.resolver.mjs +11 -0
- package/esm2022/translation/lib/translation.config.mjs +20 -0
- package/esm2022/translation/lib/translation.loader.mjs +14 -0
- package/esm2022/translation/lib/translation.module.mjs +40 -0
- package/esm2022/translation/lib/translation.service.mjs +173 -0
- package/esm2022/translation/lib/translation.types.mjs +2 -0
- package/esm2022/translation/lib/translator.directive.mjs +28 -0
- package/esm2022/translation/lib/translator.pipe.mjs +23 -0
- package/esm2022/types/acorex-core-types.mjs +5 -0
- package/esm2022/types/index.mjs +2 -0
- package/esm2022/utils/acorex-core-utils.mjs +5 -0
- package/esm2022/utils/index.mjs +6 -0
- package/esm2022/utils/lib/auto-unsubscribe.mjs +36 -0
- package/esm2022/utils/lib/color-util.mjs +111 -0
- package/esm2022/utils/lib/drawing-util.mjs +35 -0
- package/esm2022/utils/lib/html-util.mjs +39 -0
- package/esm2022/utils/lib/string-util.mjs +19 -0
- package/esm2022/validation/acorex-core-validation.mjs +5 -0
- package/esm2022/validation/index.mjs +18 -0
- package/esm2022/validation/lib/rules/between-rule.mjs +31 -0
- package/esm2022/validation/lib/rules/callback-rule.mjs +29 -0
- package/esm2022/validation/lib/rules/equal-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/greater-than.mjs +29 -0
- package/esm2022/validation/lib/rules/length-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/less-than-rule.mjs +29 -0
- package/esm2022/validation/lib/rules/maxlength-rule.mjs +27 -0
- package/esm2022/validation/lib/rules/minlength-rule.mjs +26 -0
- package/esm2022/validation/lib/rules/regex-rule.mjs +49 -0
- package/esm2022/validation/lib/rules/required-rule.mjs +36 -0
- package/esm2022/validation/lib/validation.config.mjs +33 -0
- package/esm2022/validation/lib/validation.module.mjs +84 -0
- package/esm2022/validation/lib/validation.service.mjs +98 -0
- package/esm2022/validation/lib/validation.types.mjs +3 -0
- package/events/README.md +3 -0
- package/events/index.d.ts +2 -0
- package/{lib/services → events/lib}/event.service.d.ts +8 -0
- package/events/lib/event.type.d.ts +5 -0
- package/fesm2022/acorex-core-common.mjs +2631 -0
- package/fesm2022/acorex-core-common.mjs.map +1 -0
- package/fesm2022/acorex-core-config.mjs +39 -0
- package/fesm2022/acorex-core-config.mjs.map +1 -0
- package/fesm2022/acorex-core-date-time.mjs +1305 -0
- package/fesm2022/acorex-core-date-time.mjs.map +1 -0
- package/fesm2022/acorex-core-events.mjs +56 -0
- package/fesm2022/acorex-core-events.mjs.map +1 -0
- package/fesm2022/acorex-core-file.mjs +214 -0
- package/fesm2022/acorex-core-file.mjs.map +1 -0
- package/fesm2022/acorex-core-format.mjs +282 -0
- package/fesm2022/acorex-core-format.mjs.map +1 -0
- package/fesm2022/acorex-core-image.mjs +50 -0
- package/fesm2022/acorex-core-image.mjs.map +1 -0
- package/fesm2022/acorex-core-memorize.mjs +26 -0
- package/fesm2022/acorex-core-memorize.mjs.map +1 -0
- package/fesm2022/acorex-core-pipes.mjs +44 -0
- package/fesm2022/acorex-core-pipes.mjs.map +1 -0
- package/fesm2022/acorex-core-platform.mjs +232 -0
- package/fesm2022/acorex-core-platform.mjs.map +1 -0
- package/fesm2022/acorex-core-storage.mjs +285 -0
- package/fesm2022/acorex-core-storage.mjs.map +1 -0
- package/fesm2022/acorex-core-translation.mjs +293 -0
- package/fesm2022/acorex-core-translation.mjs.map +1 -0
- package/fesm2022/acorex-core-types.mjs +6 -0
- package/fesm2022/acorex-core-types.mjs.map +1 -0
- package/fesm2022/acorex-core-utils.mjs +247 -0
- package/fesm2022/acorex-core-utils.mjs.map +1 -0
- package/fesm2022/acorex-core-validation.mjs +488 -0
- package/fesm2022/acorex-core-validation.mjs.map +1 -0
- package/fesm2022/acorex-core.mjs +2 -2309
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/file/README.md +3 -0
- package/file/index.d.ts +6 -0
- package/file/lib/file-download-ref.class.d.ts +6 -0
- package/file/lib/file-download-result.class.d.ts +8 -0
- package/file/lib/file-size-formatter.d.ts +16 -0
- package/file/lib/file-upload-ref.class.d.ts +5 -0
- package/file/lib/file.module.d.ts +7 -0
- package/file/lib/file.service.d.ts +18 -0
- package/format/README.md +3 -0
- package/format/index.d.ts +7 -0
- package/format/lib/format.config.d.ts +5 -0
- package/format/lib/format.module.d.ts +18 -0
- package/format/lib/format.pipe.d.ts +12 -0
- package/format/lib/format.service.d.ts +43 -0
- package/format/lib/format.types.d.ts +4 -0
- package/format/lib/formatters/number-formatter.d.ts +23 -0
- package/format/lib/formatters/string-formatter.d.ts +14 -0
- package/image/README.md +3 -0
- package/image/index.d.ts +1 -0
- package/image/lib/image.service.d.ts +11 -0
- package/index.d.ts +1 -43
- package/memorize/README.md +3 -0
- package/memorize/index.d.ts +1 -0
- package/memorize/lib/memorize.decorator.d.ts +1 -0
- package/package.json +98 -5
- package/pipes/README.md +3 -0
- package/pipes/index.d.ts +1 -0
- package/pipes/lib/safe/safe.pipe.d.ts +10 -0
- package/platform/README.md +3 -0
- package/platform/index.d.ts +1 -0
- package/{lib/platform → platform/lib}/platform.service.d.ts +14 -6
- package/storage/README.md +3 -0
- package/storage/cookie-storage.service.d.ts +104 -0
- package/storage/index.d.ts +4 -0
- package/storage/local-storage.service.d.ts +16 -0
- package/storage/session-storage.service.d.ts +10 -0
- package/storage/storage.interface.d.ts +14 -0
- package/translation/README.md +3 -0
- package/translation/index.d.ts +8 -0
- package/translation/lib/translation-scope.resolver.d.ts +2 -0
- package/translation/lib/translation.config.d.ts +14 -0
- package/translation/lib/translation.loader.d.ts +14 -0
- package/translation/lib/translation.module.d.ts +8 -0
- package/translation/lib/translation.service.d.ts +31 -0
- package/translation/lib/translation.types.d.ts +10 -0
- package/translation/lib/translator.directive.d.ts +12 -0
- package/translation/lib/translator.pipe.d.ts +12 -0
- package/types/README.md +3 -0
- package/types/index.d.ts +2 -0
- package/utils/README.md +3 -0
- package/utils/index.d.ts +5 -0
- package/utils/lib/auto-unsubscribe.d.ts +12 -0
- package/utils/lib/color-util.d.ts +24 -0
- package/utils/lib/drawing-util.d.ts +18 -0
- package/utils/lib/html-util.d.ts +5 -0
- package/utils/lib/string-util.d.ts +6 -0
- package/validation/README.md +3 -0
- package/validation/index.d.ts +14 -0
- package/validation/lib/rules/between-rule.d.ts +18 -0
- package/validation/lib/rules/callback-rule.d.ts +23 -0
- package/validation/lib/rules/equal-rule.d.ts +17 -0
- package/validation/lib/rules/greater-than.d.ts +17 -0
- package/validation/lib/rules/length-rule.d.ts +17 -0
- package/validation/lib/rules/less-than-rule.d.ts +17 -0
- package/validation/lib/rules/maxlength-rule.d.ts +16 -0
- package/validation/lib/rules/minlength-rule.d.ts +16 -0
- package/validation/lib/rules/regex-rule.d.ts +17 -0
- package/validation/lib/rules/required-rule.d.ts +16 -0
- package/validation/lib/validation.config.d.ts +15 -0
- package/validation/lib/validation.module.d.ts +17 -0
- package/validation/lib/validation.service.d.ts +35 -0
- package/validation/lib/validation.types.d.ts +21 -0
- package/esm2022/lib/classes/base-page.class.mjs +0 -26
- package/esm2022/lib/classes/color.class.mjs +0 -49
- package/esm2022/lib/classes/datetime.class.mjs +0 -323
- package/esm2022/lib/classes/menu.class.mjs +0 -35
- package/esm2022/lib/classes/navigator.class.mjs +0 -2
- package/esm2022/lib/classes/popup.class.mjs +0 -2
- package/esm2022/lib/classes/promise.class.mjs +0 -21
- package/esm2022/lib/classes/sectionlist.class.mjs +0 -2
- package/esm2022/lib/classes/select.class.mjs +0 -8
- package/esm2022/lib/core.module.mjs +0 -27
- package/esm2022/lib/error/error.class.mjs +0 -2
- package/esm2022/lib/error/error.module.mjs +0 -19
- package/esm2022/lib/error/error.service.mjs +0 -22
- package/esm2022/lib/events/keyboard.mjs +0 -2
- package/esm2022/lib/http/http-error.class.mjs +0 -2
- package/esm2022/lib/http/http-events.interceptor.mjs +0 -3
- package/esm2022/lib/http/http-request.class.mjs +0 -2
- package/esm2022/lib/http/http-result.class.mjs +0 -25
- package/esm2022/lib/http/http.module.mjs +0 -35
- package/esm2022/lib/http/http.service.mjs +0 -148
- package/esm2022/lib/locale/en.json +0 -255
- package/esm2022/lib/locale/fa.json +0 -245
- package/esm2022/lib/pipe/datetime.pipe.mjs +0 -25
- package/esm2022/lib/pipe/htmlToText.pipe.mjs +0 -25
- package/esm2022/lib/platform/index.mjs +0 -2
- package/esm2022/lib/platform/platform.service.mjs +0 -152
- package/esm2022/lib/services/config.mjs +0 -29
- package/esm2022/lib/services/event.service.mjs +0 -34
- package/esm2022/lib/services/navigator.service.mjs +0 -10
- package/esm2022/lib/services/storage.service.mjs +0 -16
- package/esm2022/lib/translator/translator.mjs +0 -26
- package/esm2022/lib/translator/translator.module.mjs +0 -25
- package/esm2022/lib/translator/translator.pipe.mjs +0 -24
- package/esm2022/lib/translator/translator.service.mjs +0 -21
- package/esm2022/lib/utils/array/array-util.mjs +0 -133
- package/esm2022/lib/utils/html/html-util.mjs +0 -200
- package/esm2022/lib/utils/html/html.module.mjs +0 -19
- package/esm2022/lib/utils/math/math-util.mjs +0 -6
- package/esm2022/lib/utils/object/object-util.mjs +0 -83
- package/esm2022/lib/utils/render/on-demand-preload-strategy.service.mjs +0 -21
- package/esm2022/lib/utils/render/render.service.mjs +0 -109
- package/esm2022/lib/utils/render/rendering.module.mjs +0 -35
- package/esm2022/lib/utils/scroll/scroll.directive.mjs +0 -56
- package/esm2022/lib/utils/scroll/scroll.module.mjs +0 -19
- package/esm2022/lib/utils/separator/separator.module.mjs +0 -19
- package/esm2022/lib/utils/separator/separator.pipe.mjs +0 -33
- package/lib/classes/base-page.class.d.ts +0 -13
- package/lib/classes/color.class.d.ts +0 -17
- package/lib/classes/datetime.class.d.ts +0 -63
- package/lib/classes/menu.class.d.ts +0 -34
- package/lib/classes/navigator.class.d.ts +0 -5
- package/lib/classes/popup.class.d.ts +0 -12
- package/lib/classes/promise.class.d.ts +0 -7
- package/lib/classes/sectionlist.class.d.ts +0 -8
- package/lib/classes/select.class.d.ts +0 -7
- package/lib/core.module.d.ts +0 -9
- package/lib/error/error.class.d.ts +0 -4
- package/lib/error/error.module.d.ts +0 -7
- package/lib/error/error.service.d.ts +0 -13
- package/lib/events/keyboard.d.ts +0 -2
- package/lib/http/http-error.class.d.ts +0 -7
- package/lib/http/http-events.interceptor.d.ts +0 -10
- package/lib/http/http-request.class.d.ts +0 -14
- package/lib/http/http-result.class.d.ts +0 -11
- package/lib/http/http.module.d.ts +0 -10
- package/lib/http/http.service.d.ts +0 -23
- package/lib/pipe/datetime.pipe.d.ts +0 -8
- package/lib/pipe/htmlToText.pipe.d.ts +0 -7
- package/lib/platform/index.d.ts +0 -1
- package/lib/services/config.d.ts +0 -9
- package/lib/services/navigator.service.d.ts +0 -8
- package/lib/services/storage.service.d.ts +0 -7
- package/lib/translator/translator.d.ts +0 -9
- package/lib/translator/translator.module.d.ts +0 -8
- package/lib/translator/translator.pipe.d.ts +0 -8
- package/lib/translator/translator.service.d.ts +0 -8
- package/lib/utils/array/array-util.d.ts +0 -6
- package/lib/utils/html/html-util.d.ts +0 -62
- package/lib/utils/html/html.module.d.ts +0 -8
- package/lib/utils/math/math-util.d.ts +0 -3
- package/lib/utils/object/object-util.d.ts +0 -7
- package/lib/utils/render/on-demand-preload-strategy.service.d.ts +0 -10
- package/lib/utils/render/render.service.d.ts +0 -18
- package/lib/utils/render/rendering.module.d.ts +0 -8
- package/lib/utils/scroll/scroll.directive.d.ts +0 -18
- package/lib/utils/scroll/scroll.module.d.ts +0 -8
- package/lib/utils/separator/separator.module.d.ts +0 -8
- package/lib/utils/separator/separator.pipe.d.ts +0 -8
@@ -0,0 +1,45 @@
|
|
1
|
+
export class AXFileDownloadResult {
|
2
|
+
constructor(response) {
|
3
|
+
this._response = response;
|
4
|
+
}
|
5
|
+
save(filename) {
|
6
|
+
this._defaultBrowserDownload(filename);
|
7
|
+
return Promise.resolve();
|
8
|
+
// else {
|
9
|
+
// return new Promise((resolve, reject) => {
|
10
|
+
// const button = document.createElement("button");
|
11
|
+
// button.addEventListener('click', async () => {
|
12
|
+
// button.remove();
|
13
|
+
// const opts = {
|
14
|
+
// types: [{
|
15
|
+
// description: 'Save File',
|
16
|
+
// suggestedName: filename
|
17
|
+
// // accept: {'text/plain': ['.txt']},
|
18
|
+
// }],
|
19
|
+
// };
|
20
|
+
// const result = await window['showSaveFilePicker'](opts);
|
21
|
+
// resolve();
|
22
|
+
// });
|
23
|
+
// button.click();
|
24
|
+
// });
|
25
|
+
// }
|
26
|
+
}
|
27
|
+
blob() {
|
28
|
+
return this._response;
|
29
|
+
}
|
30
|
+
base64() {
|
31
|
+
return new Promise((resolve, reject) => {
|
32
|
+
const reader = new window.FileReader();
|
33
|
+
reader.onloadend = () => resolve(reader.result);
|
34
|
+
reader.onerror = (e) => reject(e);
|
35
|
+
reader.readAsDataURL(this._response);
|
36
|
+
});
|
37
|
+
}
|
38
|
+
_defaultBrowserDownload(filename = 'download') {
|
39
|
+
const link = document.createElement('a');
|
40
|
+
link.href = URL.createObjectURL(this._response);
|
41
|
+
link.download = filename;
|
42
|
+
link.click();
|
43
|
+
}
|
44
|
+
}
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS1kb3dubG9hZC1yZXN1bHQuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvZmlsZS9zcmMvbGliL2ZpbGUtZG93bmxvYWQtcmVzdWx0LmNsYXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sT0FBTyxvQkFBb0I7SUFHL0IsWUFBWSxRQUFjO1FBQ3hCLElBQUksQ0FBQyxTQUFTLEdBQUcsUUFBUSxDQUFDO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AgbGluay5kb3dubG9hZCA9IGZpbGVuYW1lO1xuICAgIGxpbmsuY2xpY2soKTtcbiAgfVxufVxuIl19
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { Injectable } from '@angular/core';
|
2
|
+
import * as i0 from "@angular/core";
|
3
|
+
export class AXFileSizeFormatter {
|
4
|
+
get name() {
|
5
|
+
return 'filesize';
|
6
|
+
}
|
7
|
+
format(value) {
|
8
|
+
const size = Number(value);
|
9
|
+
if (size === 0)
|
10
|
+
return '0 Bytes';
|
11
|
+
if (Number.isNaN(size))
|
12
|
+
return 'Unknown';
|
13
|
+
const k = 1024;
|
14
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
15
|
+
const i = Math.floor(Math.log(size) / Math.log(k));
|
16
|
+
return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
17
|
+
}
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileSizeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
19
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileSizeFormatter }); }
|
20
|
+
}
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileSizeFormatter, decorators: [{
|
22
|
+
type: Injectable
|
23
|
+
}] });
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS1zaXplLWZvcm1hdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9maWxlL3NyYy9saWIvZmlsZS1zaXplLWZvcm1hdHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQ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bG9hdCgoc2l6ZSAvIE1hdGgucG93KGssIGkpKS50b0ZpeGVkKDIpKSArICcgJyArIHNpemVzW2ldO1xuICB9XG59XG4iXX0=
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export class AXFileUploadRef extends Promise {
|
2
|
+
constructor(executor) {
|
3
|
+
super(executor);
|
4
|
+
}
|
5
|
+
//abort the operation
|
6
|
+
abort() {
|
7
|
+
if (this.abortMethod) {
|
8
|
+
this.abortMethod();
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS11cGxvYWQtcmVmLmNsYXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL2ZpbGUvc3JjL2xpYi9maWxlLXVwbG9hZC1yZWYuY2xhc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxPQUFPLGVBQXlCLFNBQVEsT0FBVTtJQUV0RCxZQUNFLFFBR1M7UUFFVCxLQUFLLENBQUMsUUFBZSxDQUFDLENBQUM7SUFDekIsQ0FBQztJQUNELHFCQUFxQjtJQUNkLEtBQUs7UUFDVixJQUFJLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQztZQUNyQixJQUFJLENBQUMsV0FBVyxFQUFFLENBQUM7UUFDckIsQ0FBQztJQUNILENBQUM7Q0FDRiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjbGFzcyBBWEZpbGVVcGxvYWRSZWY8VCA9IGFueT4gZXh0ZW5kcyBQcm9taXNlPFQ+IHtcbiAgcHVibGljIGFib3J0TWV0aG9kOiAoKSA9PiB2b2lkO1xuICBjb25zdHJ1Y3RvcihcbiAgICBleGVjdXRvcjogKFxuICAgICAgcmVzb2x2ZTogKHZhbHVlPzogUHJvbWlzZUxpa2U8VD4pID0+IHZvaWQsXG4gICAgICByZWplY3Q6IChyZWFzb24/OiBhbnkpID0+IHZvaWRcbiAgICApID0+IHZvaWRcbiAgKSB7XG4gICAgc3VwZXIoZXhlY3V0b3IgYXMgYW55KTtcbiAgfVxuICAvL2Fib3J0IHRoZSBvcGVyYXRpb25cbiAgcHVibGljIGFib3J0KCkge1xuICAgIGlmICh0aGlzLmFib3J0TWV0aG9kKSB7XG4gICAgICB0aGlzLmFib3J0TWV0aG9kKCk7XG4gICAgfVxuICB9XG59XG4iXX0=
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { AXFormatModule } from '@acorex/core/format';
|
2
|
+
import { NgModule } from '@angular/core';
|
3
|
+
import { AXFileSizeFormatter } from './file-size-formatter';
|
4
|
+
import * as i0 from "@angular/core";
|
5
|
+
import * as i1 from "@acorex/core/format";
|
6
|
+
export class AXFileModule {
|
7
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
8
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXFileModule, imports: [i1.AXFormatModule] }); }
|
9
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileModule, providers: [AXFileSizeFormatter], imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })] }); }
|
10
|
+
}
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileModule, decorators: [{
|
12
|
+
type: NgModule,
|
13
|
+
args: [{
|
14
|
+
imports: [AXFormatModule.forChild({ formatters: [AXFileSizeFormatter] })],
|
15
|
+
exports: [],
|
16
|
+
declarations: [],
|
17
|
+
providers: [AXFileSizeFormatter],
|
18
|
+
}]
|
19
|
+
}] });
|
20
|
+
//# sourceMappingURL=data:application/json;base64,ey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zaXplLWZvcm1hdHRlcic7XG5cbkBOZ01vZHVsZSh7XG4gIGltcG9ydHM6IFtBWEZvcm1hdE1vZHVsZS5mb3JDaGlsZCh7IGZvcm1hdHRlcnM6IFtBWEZpbGVTaXplRm9ybWF0dGVyXSB9KV0sXG4gIGV4cG9ydHM6IFtdLFxuICBkZWNsYXJhdGlvbnM6IFtdLFxuICBwcm92aWRlcnM6IFtBWEZpbGVTaXplRm9ybWF0dGVyXSxcbn0pXG5leHBvcnQgY2xhc3MgQVhGaWxlTW9kdWxlIHt9XG4iXX0=
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
2
|
+
import { Injectable } from '@angular/core';
|
3
|
+
import { isObservable } from 'rxjs';
|
4
|
+
import { AXFileDownloadRef } from './file-download-ref.class';
|
5
|
+
import { AXFileDownloadResult } from './file-download-result.class';
|
6
|
+
import { AXFileUploadRef } from './file-upload-ref.class';
|
7
|
+
import * as i0 from "@angular/core";
|
8
|
+
import * as i1 from "@angular/common/http";
|
9
|
+
export class AXFileService {
|
10
|
+
constructor(_httpClient) {
|
11
|
+
this._httpClient = _httpClient;
|
12
|
+
this.blobToBase64 = (blob) => new Promise((resolve, reject) => {
|
13
|
+
const reader = new FileReader();
|
14
|
+
reader.onerror = reject;
|
15
|
+
reader.onload = () => {
|
16
|
+
resolve(reader.result);
|
17
|
+
};
|
18
|
+
reader.readAsDataURL(blob);
|
19
|
+
});
|
20
|
+
}
|
21
|
+
download(request) {
|
22
|
+
let s;
|
23
|
+
const promiseFunc = (resolve, reject) => {
|
24
|
+
//TODO: add custome http request
|
25
|
+
//const headers = new HttpHeaders().set('authorization','Bearer '+token);
|
26
|
+
let b;
|
27
|
+
if (typeof request === 'string') {
|
28
|
+
b = this._httpClient.get(request, { responseType: 'blob' });
|
29
|
+
}
|
30
|
+
else if (isObservable(b)) {
|
31
|
+
b = request;
|
32
|
+
}
|
33
|
+
s = b?.subscribe({
|
34
|
+
next: (v) => resolve(new AXFileDownloadResult(v)),
|
35
|
+
error: (e) => reject(e),
|
36
|
+
});
|
37
|
+
};
|
38
|
+
const a = new AXFileDownloadRef(promiseFunc);
|
39
|
+
a.abort = () => {
|
40
|
+
s?.unsubscribe();
|
41
|
+
};
|
42
|
+
return a;
|
43
|
+
}
|
44
|
+
upload(url, files) {
|
45
|
+
let s;
|
46
|
+
const formData = new FormData();
|
47
|
+
files.forEach((f) => {
|
48
|
+
formData.append('files', f);
|
49
|
+
});
|
50
|
+
const promiseFunc = (resolve, reject) => {
|
51
|
+
const b = this._httpClient.post(url, formData);
|
52
|
+
s = b?.subscribe({
|
53
|
+
next: (v) => resolve(v),
|
54
|
+
error: (e) => reject(e),
|
55
|
+
});
|
56
|
+
};
|
57
|
+
const a = new AXFileUploadRef(promiseFunc);
|
58
|
+
a.abort = () => {
|
59
|
+
s?.unsubscribe();
|
60
|
+
};
|
61
|
+
return a;
|
62
|
+
}
|
63
|
+
choose(options) {
|
64
|
+
return new Promise((resolve, reject) => {
|
65
|
+
options = Object.assign({ multiple: false }, options);
|
66
|
+
const input = document.createElement('input');
|
67
|
+
input.style.display = 'none';
|
68
|
+
document.body.appendChild(input);
|
69
|
+
input.type = 'file';
|
70
|
+
input.accept = options.accept || '';
|
71
|
+
input.multiple = options.multiple || false;
|
72
|
+
//
|
73
|
+
const onError = (e) => {
|
74
|
+
reject(e);
|
75
|
+
document.body.removeChild(input);
|
76
|
+
input.remove();
|
77
|
+
input.removeEventListener('change', onChange);
|
78
|
+
input.removeEventListener('error', onError);
|
79
|
+
};
|
80
|
+
//
|
81
|
+
const onChange = () => {
|
82
|
+
resolve(Array.from(input.files || []));
|
83
|
+
document.body.removeChild(input);
|
84
|
+
input.remove();
|
85
|
+
input.removeEventListener('change', onChange);
|
86
|
+
input.removeEventListener('error', onError);
|
87
|
+
};
|
88
|
+
//
|
89
|
+
input.addEventListener('change', onChange);
|
90
|
+
input.addEventListener('error', onError);
|
91
|
+
input.click();
|
92
|
+
});
|
93
|
+
}
|
94
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
95
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileService, providedIn: 'root' }); }
|
96
|
+
}
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFileService, decorators: [{
|
98
|
+
type: Injectable,
|
99
|
+
args: [{
|
100
|
+
providedIn: 'root',
|
101
|
+
}]
|
102
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
103
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL2ZpbGUvc3JjL2xpYi9maWxlLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2xELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUE0QixZQUFZLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDOUQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDOUQsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFDcEUsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDOzs7QUFLMUQsTUFBTSxPQUFPLGFBQWE7SUFDeEIsWUFBb0IsV0FBdUI7UUFBdkIsZ0JBQVcsR0FBWCxXQUFXLENBQV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,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNvcmV4LWNvcmUtZm9ybWF0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL2Zvcm1hdC9zcmMvYWNvcmV4LWNvcmUtZm9ybWF0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from './lib/format.types';
|
2
|
+
export * from './lib/format.config';
|
3
|
+
export * from './lib/format.module';
|
4
|
+
export * from './lib/format.pipe';
|
5
|
+
export * from './lib/format.service';
|
6
|
+
export * from './lib/formatters/number-formatter';
|
7
|
+
export * from './lib/formatters/string-formatter';
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvZm9ybWF0L3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyxtQ0FBbUMsQ0FBQztBQUNsRCxjQ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@ -0,0 +1,64 @@
|
|
1
|
+
import { Inject, NgModule } from '@angular/core';
|
2
|
+
import { AXFormatPipe } from './format.pipe';
|
3
|
+
import { AXNumberFormatter } from './formatters/number-formatter';
|
4
|
+
import { AXFormatterRegistryService } from './format.service';
|
5
|
+
import { AXStringFormatter } from './formatters/string-formatter';
|
6
|
+
import * as i0 from "@angular/core";
|
7
|
+
const BUILT_IN_RULES = [AXNumberFormatter, AXStringFormatter];
|
8
|
+
export class AXFormatModule {
|
9
|
+
static forRoot(configs) {
|
10
|
+
return {
|
11
|
+
ngModule: AXFormatModule,
|
12
|
+
providers: [
|
13
|
+
...(configs?.formatters || []),
|
14
|
+
{
|
15
|
+
provide: 'AXFormatModuleFactory',
|
16
|
+
useFactory: (pluginRegistry) => () => {
|
17
|
+
pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);
|
18
|
+
},
|
19
|
+
deps: [AXFormatterRegistryService],
|
20
|
+
multi: true,
|
21
|
+
},
|
22
|
+
],
|
23
|
+
};
|
24
|
+
}
|
25
|
+
static forChild(configs) {
|
26
|
+
return {
|
27
|
+
ngModule: AXFormatModule,
|
28
|
+
providers: [
|
29
|
+
...(configs?.formatters || []),
|
30
|
+
{
|
31
|
+
provide: 'AXFormatModuleFactory',
|
32
|
+
useFactory: (pluginRegistry) => () => {
|
33
|
+
pluginRegistry.register(...[...BUILT_IN_RULES, ...(configs?.formatters || [])]);
|
34
|
+
},
|
35
|
+
deps: [AXFormatterRegistryService],
|
36
|
+
multi: true,
|
37
|
+
},
|
38
|
+
],
|
39
|
+
};
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* @ignore
|
43
|
+
*/
|
44
|
+
constructor(instances) {
|
45
|
+
instances.forEach((f) => {
|
46
|
+
f();
|
47
|
+
});
|
48
|
+
}
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatModule, deps: [{ token: 'AXFormatModuleFactory' }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
50
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXFormatModule, declarations: [AXFormatPipe], exports: [AXFormatPipe] }); }
|
51
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatModule }); }
|
52
|
+
}
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatModule, decorators: [{
|
54
|
+
type: NgModule,
|
55
|
+
args: [{
|
56
|
+
imports: [],
|
57
|
+
exports: [AXFormatPipe],
|
58
|
+
declarations: [AXFormatPipe],
|
59
|
+
}]
|
60
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
61
|
+
type: Inject,
|
62
|
+
args: ['AXFormatModuleFactory']
|
63
|
+
}] }] });
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0Lm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9mb3JtYXQvc3JjL2xpYi9mb3JtYXQubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQXVCLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN0RSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzdDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2xFLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTlELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLCtCQUErQixDQUFDOztBQUVsRSxNQ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gICAgZigpO1xuICAgIH0pO1xuICB9XG59XG4iXX0=
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { Pipe, inject } from '@angular/core';
|
2
|
+
import { AXFormatService } from './format.service';
|
3
|
+
import { filter, of, startWith, switchMap } from 'rxjs';
|
4
|
+
import { AXEventService } from '@acorex/core/events';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
export class AXFormatPipe {
|
7
|
+
constructor() {
|
8
|
+
this.formatService = inject(AXFormatService);
|
9
|
+
this.eventService = inject(AXEventService);
|
10
|
+
this.triggers = [
|
11
|
+
'AX_CALENDAR_CHANGED',
|
12
|
+
'AX_LANGUAGE_CHANGED',
|
13
|
+
'AX_LANGUAGE_LOADED',
|
14
|
+
];
|
15
|
+
}
|
16
|
+
transform(value, name, options) {
|
17
|
+
// Initial formatted value
|
18
|
+
const initialFormattedValue = this.formatService.format(value, name, options);
|
19
|
+
// React to language changes and re-format the value
|
20
|
+
return this.eventService.onEvent.pipe(filter((event) => this.triggers.includes(event.type)), startWith(initialFormattedValue), // Emit the initial formatted value immediately
|
21
|
+
switchMap((event) => {
|
22
|
+
// Re-call format method on every language change
|
23
|
+
const formattedValue = this.formatService.format(value, name, options);
|
24
|
+
return of(formattedValue);
|
25
|
+
}));
|
26
|
+
}
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
28
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.2", ngImport: i0, type: AXFormatPipe, name: "format" }); }
|
29
|
+
}
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatPipe, decorators: [{
|
31
|
+
type: Pipe,
|
32
|
+
args: [{
|
33
|
+
name: 'format',
|
34
|
+
pure: true,
|
35
|
+
}]
|
36
|
+
}] });
|
37
|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2l0Y2hNYXAoKGV2ZW50KSA9PiB7XG4gICAgICAgIC8vIFJlLWNhbGwgZm9ybWF0IG1ldGhvZCBvbiBldmVyeSBsYW5ndWFnZSBjaGFuZ2VcbiAgICAgICAgY29uc3QgZm9ybWF0dGVkVmFsdWUgPSB0aGlzLmZvcm1hdFNlcnZpY2UuZm9ybWF0KFxuICAgICAgICAgIHZhbHVlLFxuICAgICAgICAgIG5hbWUgYXMgYW55LFxuICAgICAgICAgIG9wdGlvbnNcbiAgICAgICAgKTtcbiAgICAgICAgcmV0dXJuIG9mKGZvcm1hdHRlZFZhbHVlKTtcbiAgICAgIH0pXG4gICAgKTtcbiAgfVxufVxuIl19
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { Injectable, Injector } from '@angular/core';
|
2
|
+
import { Subject } from 'rxjs';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
export class AXFormatterRegistryService {
|
5
|
+
constructor(injector) {
|
6
|
+
this.plugins = [];
|
7
|
+
this.injector = injector;
|
8
|
+
}
|
9
|
+
register(...plugins) {
|
10
|
+
plugins.forEach((t) => {
|
11
|
+
const childInjector = Injector.create({
|
12
|
+
providers: [{ provide: t, useClass: t, deps: [] }],
|
13
|
+
parent: this.injector,
|
14
|
+
});
|
15
|
+
const v = childInjector.get(t);
|
16
|
+
if (v && !this.plugins.some((p) => p.name == v.name)) {
|
17
|
+
this.plugins.push(v);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
get formatters() {
|
22
|
+
return this.plugins;
|
23
|
+
}
|
24
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatterRegistryService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
25
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatterRegistryService, providedIn: 'root' }); }
|
26
|
+
}
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatterRegistryService, decorators: [{
|
28
|
+
type: Injectable,
|
29
|
+
args: [{
|
30
|
+
providedIn: 'root',
|
31
|
+
}]
|
32
|
+
}], ctorParameters: () => [{ type: i0.Injector }] });
|
33
|
+
export class AXFormatService {
|
34
|
+
constructor(pluginRegistry) {
|
35
|
+
this.pluginRegistry = pluginRegistry;
|
36
|
+
this.renderSubject = new Subject();
|
37
|
+
// Observable that other services/components can subscribe to
|
38
|
+
this.onRender = this.renderSubject.asObservable();
|
39
|
+
}
|
40
|
+
render() {
|
41
|
+
this.renderSubject.next();
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Resolves a formatter by its name.
|
45
|
+
* @param name The name of the formatter.
|
46
|
+
* @returns The formatter if found, otherwise throws an error.
|
47
|
+
*/
|
48
|
+
resolveFormatter(name) {
|
49
|
+
const formatter = this.pluginRegistry.formatters.find((c) => c.name == name);
|
50
|
+
if (!formatter) {
|
51
|
+
throw new Error(`Formatter not found: ${name}`);
|
52
|
+
}
|
53
|
+
return formatter;
|
54
|
+
}
|
55
|
+
// Implementation of the format method
|
56
|
+
format(value, formatter, options) {
|
57
|
+
if (typeof formatter === 'string') {
|
58
|
+
const formatterRef = this.resolveFormatter(formatter);
|
59
|
+
return formatterRef.format(value, options);
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
return new AXFormatFluent(this, value);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatService, deps: [{ token: AXFormatterRegistryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatService, providedIn: 'root' }); }
|
67
|
+
}
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXFormatService, decorators: [{
|
69
|
+
type: Injectable,
|
70
|
+
args: [{ providedIn: 'root' }]
|
71
|
+
}], ctorParameters: () => [{ type: AXFormatterRegistryService }] });
|
72
|
+
class AXFormatFluent {
|
73
|
+
constructor(formatService, initialValue) {
|
74
|
+
this.formatService = formatService;
|
75
|
+
this.initialValue = initialValue;
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Formats the value using the specified formatter and options.
|
79
|
+
* @param formatter The name of the formatter to use.
|
80
|
+
* @param options The options to pass to the formatter.
|
81
|
+
* @returns The formatted string.
|
82
|
+
*/
|
83
|
+
to(formatter, options) {
|
84
|
+
try {
|
85
|
+
const formatterRef = this.formatService.resolveFormatter(formatter);
|
86
|
+
return formatterRef.format(this.initialValue, options);
|
87
|
+
}
|
88
|
+
catch (error) {
|
89
|
+
// Handle or log the error as needed
|
90
|
+
console.error(error);
|
91
|
+
return String(this.initialValue);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0LnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvZm9ybWF0L3NyYy9saWIvZm9ybWF0LnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFHckQsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQzs7QUFLL0IsTUFBTSxPQUFPLDBCQUEwQjtJQUtyQyxZQUFZLFFBQWtCO1FBSnRCLFlBQU8sR0FBa0IsRUFBRSxDQUFDO1FBS2xDLElBQUksQ0FBQyxRQUFRLEdBQUcsUUFBUSxDQUFDO0lBQzNCLENBQUM7SUFFRCx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iJdfQ==
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { Injectable } from '@angular/core';
|
2
|
+
import { defaults, isInteger, padStart } from 'lodash-es';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
export class AXNumberFormatter {
|
5
|
+
constructor() {
|
6
|
+
this.separatorsCache = {};
|
7
|
+
}
|
8
|
+
get name() {
|
9
|
+
return 'number';
|
10
|
+
}
|
11
|
+
format(value, options) {
|
12
|
+
const { thousandSeparator, decimalSeparator } = this.getLocaleSeparators(options?.locale);
|
13
|
+
// Merge user options with default options
|
14
|
+
const effectiveOptions = defaults({}, options, {
|
15
|
+
thousandSeparator,
|
16
|
+
decimalSeparator,
|
17
|
+
zeroPadLength: 0,
|
18
|
+
locale: navigator.language,
|
19
|
+
});
|
20
|
+
const sign = value < 0 ? '-' : '';
|
21
|
+
const absoluteValue = Math.abs(value);
|
22
|
+
// Handling zero padding for integer part
|
23
|
+
let integerPart = Math.floor(absoluteValue).toString();
|
24
|
+
if (effectiveOptions.zeroPadLength && effectiveOptions.zeroPadLength > integerPart.length) {
|
25
|
+
integerPart = padStart(integerPart, effectiveOptions.zeroPadLength, '0');
|
26
|
+
}
|
27
|
+
// Applying thousand separator to integer part
|
28
|
+
if (effectiveOptions.thousandSeparator) {
|
29
|
+
integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, effectiveOptions.thousandSeparator);
|
30
|
+
}
|
31
|
+
// Constructing the final formatted value
|
32
|
+
let formattedValue = sign + integerPart;
|
33
|
+
if (effectiveOptions.decimalPlaces !== undefined) {
|
34
|
+
// Limiting decimal places if specified
|
35
|
+
const decimalPart = absoluteValue.toFixed(effectiveOptions.decimalPlaces).split('.')[1];
|
36
|
+
formattedValue += effectiveOptions.decimalSeparator + decimalPart;
|
37
|
+
}
|
38
|
+
else if (!isInteger(value)) {
|
39
|
+
// Showing full decimal part if decimalPlaces is not specified
|
40
|
+
const decimalPart = absoluteValue.toString().split('.')[1] || '';
|
41
|
+
if (decimalPart.length > 0) {
|
42
|
+
formattedValue += effectiveOptions.decimalSeparator + decimalPart;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
return formattedValue;
|
46
|
+
}
|
47
|
+
getLocaleSeparators(locale = navigator.language) {
|
48
|
+
// Use cache if available
|
49
|
+
if (this.separatorsCache[locale]) {
|
50
|
+
return this.separatorsCache[locale];
|
51
|
+
}
|
52
|
+
const numberFormat = new Intl.NumberFormat(locale);
|
53
|
+
const parts = numberFormat.formatToParts(1234567.89);
|
54
|
+
let thousandSeparator = '';
|
55
|
+
let decimalSeparator = '';
|
56
|
+
for (const part of parts) {
|
57
|
+
if (part.type === 'group') {
|
58
|
+
thousandSeparator = part.value;
|
59
|
+
}
|
60
|
+
else if (part.type === 'decimal') {
|
61
|
+
decimalSeparator = part.value;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
// Cache the result
|
65
|
+
this.separatorsCache[locale] = { thousandSeparator, decimalSeparator };
|
66
|
+
return this.separatorsCache[locale];
|
67
|
+
}
|
68
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXNumberFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
69
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXNumberFormatter }); }
|
70
|
+
}
|
71
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: AXNumberFormatter, decorators: [{
|
72
|
+
type: Injectable
|
73
|
+
}] });
|
74
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVtYmVyLWZvcm1hdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9mb3JtYXQvc3JjL2xpYi9mb3JtYXR0ZXJzL251bWJlci1mb3Jt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SByZXN1bHRcbiAgICB0aGlzLnNlcGFyYXRvcnNDYWNoZVtsb2NhbGVdID0geyB0aG91c2FuZFNlcGFyYXRvciwgZGVjaW1hbFNlcGFyYXRvciB9O1xuICAgIHJldHVybiB0aGlzLnNlcGFyYXRvcnNDYWNoZVtsb2NhbGVdO1xuICB9XG59XG4iXX0=
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { get } from 'lodash-es';
|
2
|
+
export class AXStringFormatter {
|
3
|
+
get name() {
|
4
|
+
return 'string';
|
5
|
+
}
|
6
|
+
format(value, options) {
|
7
|
+
if (typeof value != 'string')
|
8
|
+
return String(value);
|
9
|
+
const result = value.replace(/{{\s*([^}]+)\s*}}/g, (match, path) => {
|
10
|
+
return get(options, path.trim()) ?? match;
|
11
|
+
});
|
12
|
+
return result;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLWZvcm1hdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9mb3JtYXQvc3JjL2xpYi9mb3JtYXR0ZXJzL3N0cmluZy1mb3JtYXR0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQWNoQyxNQUFNLE9BQU8saUJBQWlCO0lBQzVCLElBQUksSUFBSTtRQUNOLE9BQU8sUUFBUSxDQUFDO0lBQ2xCLENBQUM7SUFFRCxNQUFNLENBQUMsS0FBYyxFQUFFLE9BQWlDO1FBQ3RELElBQUksT0FBTyxLQUFLLElBQUksUUFBUTtZQUFFLE9BQU8sTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ25ELE1BQU0sTUFBTSxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsb0JBQW9CLEVBQU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lKC97e1xccyooW159XSspXFxzKn19L2csIChtYXRjaCwgcGF0aDogc3RyaW5nKSA9PiB7XG4gICAgICByZXR1cm4gZ2V0KG9wdGlvbnMsIHBhdGgudHJpbSgpKSBhcyBzdHJpbmcgPz8gbWF0Y2g7XG4gICAgfSk7XG4gICAgcmV0dXJuIHJlc3VsdDtcbiAgfVxufVxuIl19
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNvcmV4LWNvcmUtaW1hZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvaW1hZ2Uvc3JjL2Fjb3JleC1jb3JlLWltYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
@@ -0,0 +1,2 @@
|
|
1
|
+
export * from './lib/image.service';
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvcmUvaW1hZ2Uvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUJBQXFCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9pbWFnZS5zZXJ2aWNlJztcbiJdfQ==
|