design-angular-kit 1.2.1 → 1.2.2
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/README.md +461 -0
- package/esm2022/design-angular-kit.mjs +5 -0
- package/esm2022/lib/abstracts/abstract-form.component.mjs +186 -0
- package/esm2022/lib/abstracts/abstract.component.mjs +46 -0
- package/esm2022/lib/components/core/accordion/accordion.component.mjs +39 -0
- package/esm2022/lib/components/core/alert/alert.component.mjs +71 -0
- package/esm2022/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.mjs +43 -0
- package/esm2022/lib/components/core/avatar/avatar-group/avatar-group.component.mjs +40 -0
- package/esm2022/lib/components/core/avatar/avatar.directive.mjs +78 -0
- package/esm2022/lib/components/core/avatar/avatar.module.mjs +33 -0
- package/esm2022/lib/components/core/badge/badge.directive.mjs +39 -0
- package/esm2022/lib/components/core/button/button.directive.mjs +80 -0
- package/esm2022/lib/components/core/callout/callout.component.mjs +64 -0
- package/esm2022/lib/components/core/card/card.component.mjs +59 -0
- package/esm2022/lib/components/core/carousel/carousel/carousel.component.mjs +84 -0
- package/esm2022/lib/components/core/carousel/carousel-item/carousel-item.component.mjs +19 -0
- package/esm2022/lib/components/core/carousel/carousel.module.mjs +18 -0
- package/esm2022/lib/components/core/chip/chip.component.mjs +136 -0
- package/esm2022/lib/components/core/collapse/collapse.component.mjs +116 -0
- package/esm2022/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.mjs +27 -0
- package/esm2022/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.mjs +11 -0
- package/esm2022/lib/components/core/dimmer/dimmer.component.mjs +55 -0
- package/esm2022/lib/components/core/dimmer/dimmer.module.mjs +19 -0
- package/esm2022/lib/components/core/dropdown/dropdown/dropdown.component.mjs +147 -0
- package/esm2022/lib/components/core/dropdown/dropdown-item/dropdown-item.component.mjs +70 -0
- package/esm2022/lib/components/core/dropdown/dropdown.module.mjs +18 -0
- package/esm2022/lib/components/core/forward/forward.directive.mjs +57 -0
- package/esm2022/lib/components/core/link/link.component.mjs +42 -0
- package/esm2022/lib/components/core/list/list/list.component.mjs +22 -0
- package/esm2022/lib/components/core/list/list-item/list-item.component.mjs +56 -0
- package/esm2022/lib/components/core/list/list.module.mjs +18 -0
- package/esm2022/lib/components/core/modal/modal.component.mjs +194 -0
- package/esm2022/lib/components/core/notifications/notifications.component.mjs +111 -0
- package/esm2022/lib/components/core/pagination/pagination.component.mjs +130 -0
- package/esm2022/lib/components/core/popover/popover.directive.mjs +176 -0
- package/esm2022/lib/components/core/progress-bar/progress-bar.component.mjs +34 -0
- package/esm2022/lib/components/core/progress-button/progress-button.component.mjs +25 -0
- package/esm2022/lib/components/core/spinner/spinner.component.mjs +30 -0
- package/esm2022/lib/components/core/steppers/steppers-container/steppers-container.component.mjs +116 -0
- package/esm2022/lib/components/core/steppers/steppers-item/steppers-item.component.mjs +22 -0
- package/esm2022/lib/components/core/steppers/steppers.module.mjs +18 -0
- package/esm2022/lib/components/core/tab/tab-container/tab-container.component.mjs +97 -0
- package/esm2022/lib/components/core/tab/tab-item/tab-item.component.mjs +39 -0
- package/esm2022/lib/components/core/tab/tab.module.mjs +18 -0
- package/esm2022/lib/components/core/table/sort/sort-header/sort-header.component.mjs +134 -0
- package/esm2022/lib/components/core/table/sort/sort.directive.mjs +123 -0
- package/esm2022/lib/components/core/table/table.component.mjs +45 -0
- package/esm2022/lib/components/core/table/table.module.mjs +19 -0
- package/esm2022/lib/components/core/timeline/timeline-item/timeline-item.component.mjs +90 -0
- package/esm2022/lib/components/core/timeline/timeline.component.mjs +36 -0
- package/esm2022/lib/components/core/timeline/timeline.module.mjs +18 -0
- package/esm2022/lib/components/core/tooltip/tooltip.directive.mjs +143 -0
- package/esm2022/lib/components/form/autocomplete/autocomplete.component.mjs +112 -0
- package/esm2022/lib/components/form/checkbox/checkbox.component.mjs +48 -0
- package/esm2022/lib/components/form/form.module.mjs +63 -0
- package/esm2022/lib/components/form/input/input.component.mjs +190 -0
- package/esm2022/lib/components/form/password-input/password-input.component.mjs +149 -0
- package/esm2022/lib/components/form/radio-button/radio-button.component.mjs +60 -0
- package/esm2022/lib/components/form/range/range.component.mjs +64 -0
- package/esm2022/lib/components/form/rating/rating.component.mjs +50 -0
- package/esm2022/lib/components/form/select/select.component.mjs +70 -0
- package/esm2022/lib/components/form/textarea/textarea.component.mjs +55 -0
- package/esm2022/lib/components/form/transfer/store/transfer.reducers.mjs +191 -0
- package/esm2022/lib/components/form/transfer/store/transfer.state.mjs +2 -0
- package/esm2022/lib/components/form/transfer/store/transfer.store.mjs +70 -0
- package/esm2022/lib/components/form/transfer/transfer-list/transfer-list.component.mjs +72 -0
- package/esm2022/lib/components/form/transfer/transfer.component.mjs +149 -0
- package/esm2022/lib/components/form/transfer/transfer.model.mjs +6 -0
- package/esm2022/lib/components/form/upload-drag-drop/upload-drag-drop.component.mjs +142 -0
- package/esm2022/lib/components/form/upload-file-list/upload-file-list.component.mjs +107 -0
- package/esm2022/lib/components/navigation/back-button/back-button.component.mjs +67 -0
- package/esm2022/lib/components/navigation/back-to-top/back-to-top.component.mjs +68 -0
- package/esm2022/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.mjs +51 -0
- package/esm2022/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.mjs +21 -0
- package/esm2022/lib/components/navigation/breadcrumbs/breadcrumbs.module.mjs +18 -0
- package/esm2022/lib/components/navigation/header/header.component.mjs +103 -0
- package/esm2022/lib/components/navigation/megamenu/megamenu.component.mjs +27 -0
- package/esm2022/lib/components/navigation/navbar/navbar/navbar.component.mjs +49 -0
- package/esm2022/lib/components/navigation/navbar/navbar-item/navbar-item.component.mjs +11 -0
- package/esm2022/lib/components/navigation/navbar/navbar.module.mjs +18 -0
- package/esm2022/lib/components/navigation/navscroll/navscroll-list-item.component.mjs +98 -0
- package/esm2022/lib/components/navigation/navscroll/navscroll-list-items.component.mjs +44 -0
- package/esm2022/lib/components/navigation/navscroll/navscroll.component.mjs +116 -0
- package/esm2022/lib/components/navigation/navscroll/navscroll.model.mjs +2 -0
- package/esm2022/lib/components/navigation/navscroll/navscroll.store.mjs +68 -0
- package/esm2022/lib/components/navigation/navscroll/navscroll.utils.mjs +23 -0
- package/esm2022/lib/components/navigation/sidebar/sidebar.component.mjs +50 -0
- package/esm2022/lib/components/navigation/skiplink/skiplink/skiplink.component.mjs +27 -0
- package/esm2022/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.mjs +26 -0
- package/esm2022/lib/components/navigation/skiplink/skiplink.module.mjs +18 -0
- package/esm2022/lib/components/utils/error-page/error-page.component.mjs +74 -0
- package/esm2022/lib/components/utils/icon/icon.component.mjs +63 -0
- package/esm2022/lib/components/utils/language-switcher/language-switcher.component.mjs +50 -0
- package/esm2022/lib/design-angular-kit.module.mjs +233 -0
- package/esm2022/lib/enums/colors.enums.mjs +12 -0
- package/esm2022/lib/enums/sizes.enum.mjs +9 -0
- package/esm2022/lib/interfaces/core.mjs +16 -0
- package/esm2022/lib/interfaces/design-angular-kit-config.mjs +7 -0
- package/esm2022/lib/interfaces/form.mjs +2 -0
- package/esm2022/lib/interfaces/icon.mjs +168 -0
- package/esm2022/lib/interfaces/sortable-table.mjs +6 -0
- package/esm2022/lib/interfaces/utils.mjs +2 -0
- package/esm2022/lib/pipes/date-ago.pipe.mjs +56 -0
- package/esm2022/lib/pipes/duration.pipe.mjs +115 -0
- package/esm2022/lib/pipes/mark-matching-text.pipe.mjs +48 -0
- package/esm2022/lib/provide-design-angular-kit.mjs +64 -0
- package/esm2022/lib/services/notification/notification.service.mjs +120 -0
- package/esm2022/lib/utils/coercion.mjs +18 -0
- package/esm2022/lib/utils/date-utils.mjs +162 -0
- package/esm2022/lib/utils/file-utils.mjs +73 -0
- package/esm2022/lib/utils/regex.mjs +35 -0
- package/esm2022/lib/validators/it-validators.mjs +156 -0
- package/esm2022/public_api.mjs +110 -0
- package/fesm2022/design-angular-kit.mjs +6731 -0
- package/fesm2022/design-angular-kit.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/abstracts/abstract-form.component.d.ts +87 -0
- package/lib/abstracts/abstract.component.d.ts +30 -0
- package/lib/components/core/accordion/accordion.component.d.ts +18 -0
- package/lib/components/core/alert/alert.component.d.ts +44 -0
- package/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.d.ts +29 -0
- package/lib/components/core/avatar/avatar-group/avatar-group.component.d.ts +15 -0
- package/lib/components/core/avatar/avatar.directive.d.ts +33 -0
- package/lib/components/core/avatar/avatar.module.d.ts +9 -0
- package/lib/components/core/badge/badge.directive.d.ts +23 -0
- package/lib/components/core/button/button.directive.d.ts +48 -0
- package/lib/components/core/callout/callout.component.d.ts +50 -0
- package/lib/components/core/card/card.component.d.ts +69 -0
- package/lib/components/core/carousel/carousel/carousel.component.d.ts +65 -0
- package/lib/components/core/carousel/carousel-item/carousel-item.component.d.ts +15 -0
- package/lib/components/core/carousel/carousel.module.d.ts +8 -0
- package/lib/components/core/chip/chip.component.d.ts +76 -0
- package/lib/components/core/collapse/collapse.component.d.ts +67 -0
- package/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.d.ts +12 -0
- package/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.d.ts +5 -0
- package/lib/components/core/dimmer/dimmer.component.d.ts +24 -0
- package/lib/components/core/dimmer/dimmer.module.d.ts +9 -0
- package/lib/components/core/dropdown/dropdown/dropdown.component.d.ts +94 -0
- package/lib/components/core/dropdown/dropdown-item/dropdown-item.component.d.ts +46 -0
- package/lib/components/core/dropdown/dropdown.module.d.ts +8 -0
- package/lib/components/core/forward/forward.directive.d.ts +14 -0
- package/lib/components/core/link/link.component.d.ts +35 -0
- package/lib/components/core/list/list/list.component.d.ts +24 -0
- package/lib/components/core/list/list-item/list-item.component.d.ts +41 -0
- package/lib/components/core/list/list.module.d.ts +8 -0
- package/lib/components/core/modal/modal.component.d.ts +135 -0
- package/lib/components/core/notifications/notifications.component.d.ts +45 -0
- package/lib/components/core/pagination/pagination.component.d.ts +92 -0
- package/lib/components/core/popover/popover.directive.d.ts +99 -0
- package/lib/components/core/progress-bar/progress-bar.component.d.ts +31 -0
- package/lib/components/core/progress-button/progress-button.component.d.ts +21 -0
- package/lib/components/core/spinner/spinner.component.d.ts +24 -0
- package/lib/components/core/steppers/steppers-container/steppers-container.component.d.ts +130 -0
- package/lib/components/core/steppers/steppers-item/steppers-item.component.d.ts +24 -0
- package/lib/components/core/steppers/steppers.module.d.ts +8 -0
- package/lib/components/core/tab/tab-container/tab-container.component.d.ts +60 -0
- package/lib/components/core/tab/tab-item/tab-item.component.d.ts +38 -0
- package/lib/components/core/tab/tab.module.d.ts +8 -0
- package/lib/components/core/table/sort/sort-header/sort-header.component.d.ts +72 -0
- package/lib/components/core/table/sort/sort.directive.d.ts +53 -0
- package/lib/components/core/table/table.component.d.ts +60 -0
- package/lib/components/core/table/table.module.d.ts +9 -0
- package/lib/components/core/timeline/timeline-item/timeline-item.component.d.ts +79 -0
- package/lib/components/core/timeline/timeline.component.d.ts +21 -0
- package/lib/components/core/timeline/timeline.module.d.ts +8 -0
- package/lib/components/core/tooltip/tooltip.directive.d.ts +82 -0
- package/lib/components/form/autocomplete/autocomplete.component.d.ts +59 -0
- package/lib/components/form/checkbox/checkbox.component.d.ts +41 -0
- package/lib/components/form/form.module.d.ts +18 -0
- package/lib/components/form/input/input.component.d.ts +95 -0
- package/lib/components/form/password-input/password-input.component.d.ts +80 -0
- package/lib/components/form/radio-button/radio-button.component.d.ts +38 -0
- package/lib/components/form/range/range.component.d.ts +42 -0
- package/lib/components/form/rating/rating.component.d.ts +24 -0
- package/lib/components/form/select/select.component.d.ts +36 -0
- package/lib/components/form/textarea/textarea.component.d.ts +34 -0
- package/lib/components/form/transfer/store/transfer.reducers.d.ts +103 -0
- package/lib/components/form/transfer/store/transfer.state.d.ts +18 -0
- package/lib/components/form/transfer/store/transfer.store.d.ts +23 -0
- package/lib/components/form/transfer/transfer-list/transfer-list.component.d.ts +48 -0
- package/lib/components/form/transfer/transfer.component.d.ts +75 -0
- package/{src/lib/components/form/transfer/transfer.model.ts → lib/components/form/transfer/transfer.model.d.ts} +2 -9
- package/lib/components/form/upload-drag-drop/upload-drag-drop.component.d.ts +60 -0
- package/lib/components/form/upload-file-list/upload-file-list.component.d.ts +62 -0
- package/lib/components/navigation/back-button/back-button.component.d.ts +47 -0
- package/lib/components/navigation/back-to-top/back-to-top.component.d.ts +50 -0
- package/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.d.ts +28 -0
- package/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.d.ts +23 -0
- package/lib/components/navigation/breadcrumbs/breadcrumbs.module.d.ts +8 -0
- package/lib/components/navigation/header/header.component.d.ts +38 -0
- package/lib/components/navigation/megamenu/megamenu.component.d.ts +22 -0
- package/lib/components/navigation/navbar/navbar/navbar.component.d.ts +19 -0
- package/lib/components/navigation/navbar/navbar-item/navbar-item.component.d.ts +5 -0
- package/lib/components/navigation/navbar/navbar.module.d.ts +8 -0
- package/lib/components/navigation/navscroll/navscroll-list-item.component.d.ts +16 -0
- package/lib/components/navigation/navscroll/navscroll-list-items.component.d.ts +7 -0
- package/lib/components/navigation/navscroll/navscroll.component.d.ts +47 -0
- package/{src/lib/components/navigation/navscroll/navscroll.model.ts → lib/components/navigation/navscroll/navscroll.model.d.ts} +5 -7
- package/lib/components/navigation/navscroll/navscroll.store.d.ts +16 -0
- package/lib/components/navigation/navscroll/navscroll.utils.d.ts +6 -0
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +26 -0
- package/lib/components/navigation/skiplink/skiplink/skiplink.component.d.ts +17 -0
- package/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.d.ts +24 -0
- package/lib/components/navigation/skiplink/skiplink.module.d.ts +8 -0
- package/lib/components/utils/error-page/error-page.component.d.ts +44 -0
- package/lib/components/utils/icon/icon.component.d.ts +53 -0
- package/lib/components/utils/language-switcher/language-switcher.component.d.ts +27 -0
- package/lib/design-angular-kit.module.d.ts +53 -0
- package/lib/enums/colors.enums.d.ts +10 -0
- package/lib/enums/sizes.enum.d.ts +7 -0
- package/{src/lib/interfaces/core.ts → lib/interfaces/core.d.ts} +53 -95
- package/lib/interfaces/design-angular-kit-config.d.ts +30 -0
- package/lib/interfaces/form.d.ts +67 -0
- package/lib/interfaces/icon.d.ts +4 -0
- package/lib/interfaces/sortable-table.d.ts +33 -0
- package/lib/interfaces/utils.d.ts +10 -0
- package/lib/pipes/date-ago.pipe.d.ts +17 -0
- package/lib/pipes/duration.pipe.d.ts +35 -0
- package/lib/pipes/mark-matching-text.pipe.d.ts +18 -0
- package/lib/provide-design-angular-kit.d.ts +7 -0
- package/lib/services/notification/notification.service.d.ts +63 -0
- package/{src/lib/utils/coercion.ts → lib/utils/coercion.d.ts} +1 -7
- package/lib/utils/date-utils.d.ts +79 -0
- package/lib/utils/file-utils.d.ts +32 -0
- package/lib/utils/regex.d.ts +34 -0
- package/lib/validators/it-validators.d.ts +69 -0
- package/package.json +14 -9
- package/{src/public_api.ts → public_api.d.ts} +0 -43
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +29 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/index.spec.d.ts +1 -0
- package/schematics/ng-add/index.spec.js +43 -0
- package/schematics/ng-add/index.spec.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/add-animations.d.ts +2 -0
- package/schematics/ng-add/rules/setup-project/add-animations.js +11 -0
- package/schematics/ng-add/rules/setup-project/add-animations.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/add-assets.d.ts +3 -0
- package/schematics/ng-add/rules/setup-project/add-assets.js +50 -0
- package/schematics/ng-add/rules/setup-project/add-assets.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.d.ts +3 -0
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.js +43 -0
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/add-http-client.d.ts +2 -0
- package/schematics/ng-add/rules/setup-project/add-http-client.js +11 -0
- package/schematics/ng-add/rules/setup-project/add-http-client.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.d.ts +11 -0
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.js +112 -0
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/add-localisation.d.ts +3 -0
- package/schematics/ng-add/rules/setup-project/add-localisation.js +50 -0
- package/schematics/ng-add/rules/setup-project/add-localisation.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/angular-json-helper.d.ts +2 -0
- package/schematics/ng-add/rules/setup-project/angular-json-helper.js +13 -0
- package/schematics/ng-add/rules/setup-project/angular-json-helper.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/exceptions.d.ts +7 -0
- package/schematics/ng-add/rules/setup-project/exceptions.js +17 -0
- package/schematics/ng-add/rules/setup-project/exceptions.js.map +1 -0
- package/schematics/ng-add/rules/setup-project/index.js +23 -0
- package/schematics/ng-add/rules/setup-project/index.js.map +1 -0
- package/schematics/ng-add/{schema.ts → schema.d.ts} +1 -1
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/setup-project.d.ts +3 -0
- package/schematics/ng-add/setup-project.js +37 -0
- package/schematics/ng-add/setup-project.js.map +1 -0
- package/schematics/ng-add/setup-project.spec.d.ts +1 -0
- package/schematics/ng-add/setup-project.spec.js +139 -0
- package/schematics/ng-add/setup-project.spec.js.map +1 -0
- package/schematics/ng-add/utils.d.ts +14 -0
- package/schematics/ng-add/utils.js +49 -0
- package/schematics/ng-add/utils.js.map +1 -0
- package/schematics/ng-add/versions-helper.d.ts +3 -0
- package/schematics/ng-add/versions-helper.js +40 -0
- package/schematics/ng-add/versions-helper.js.map +1 -0
- package/.eslintrc.json +0 -31
- package/karma.conf.js +0 -38
- package/ng-package.json +0 -9
- package/ng-package.prod.json +0 -8
- package/schematics/ng-add/index.spec.ts +0 -45
- package/schematics/ng-add/index.ts +0 -36
- package/schematics/ng-add/rules/setup-project/add-animations.ts +0 -7
- package/schematics/ng-add/rules/setup-project/add-assets.ts +0 -45
- package/schematics/ng-add/rules/setup-project/add-design-angular-kit.ts +0 -40
- package/schematics/ng-add/rules/setup-project/add-http-client.ts +0 -7
- package/schematics/ng-add/rules/setup-project/add-import-to-style-file.ts +0 -120
- package/schematics/ng-add/rules/setup-project/add-localisation.ts +0 -45
- package/schematics/ng-add/rules/setup-project/angular-json-helper.ts +0 -11
- package/schematics/ng-add/rules/setup-project/exceptions.ts +0 -13
- package/schematics/ng-add/setup-project.spec.ts +0 -166
- package/schematics/ng-add/setup-project.ts +0 -31
- package/schematics/ng-add/utils.ts +0 -71
- package/schematics/ng-add/versions-helper.ts +0 -41
- package/src/lib/abstracts/abstract-form.component.ts +0 -200
- package/src/lib/abstracts/abstract.component.ts +0 -63
- package/src/lib/components/core/accordion/accordion.component.html +0 -27
- package/src/lib/components/core/accordion/accordion.component.spec.ts +0 -21
- package/src/lib/components/core/accordion/accordion.component.ts +0 -40
- package/src/lib/components/core/alert/alert.component.html +0 -19
- package/src/lib/components/core/alert/alert.component.scss +0 -3
- package/src/lib/components/core/alert/alert.component.spec.ts +0 -62
- package/src/lib/components/core/alert/alert.component.ts +0 -75
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.html +0 -23
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.scss +0 -17
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.spec.ts +0 -21
- package/src/lib/components/core/avatar/avatar-dropdown/avatar-dropdown.component.ts +0 -50
- package/src/lib/components/core/avatar/avatar-group/avatar-group.component.html +0 -7
- package/src/lib/components/core/avatar/avatar-group/avatar-group.component.spec.ts +0 -38
- package/src/lib/components/core/avatar/avatar-group/avatar-group.component.ts +0 -25
- package/src/lib/components/core/avatar/avatar.directive.ts +0 -73
- package/src/lib/components/core/avatar/avatar.module.ts +0 -18
- package/src/lib/components/core/badge/badge.directive.spec.ts +0 -59
- package/src/lib/components/core/badge/badge.directive.ts +0 -39
- package/src/lib/components/core/button/button.directive.spec.ts +0 -96
- package/src/lib/components/core/button/button.directive.ts +0 -89
- package/src/lib/components/core/callout/callout.component.html +0 -25
- package/src/lib/components/core/callout/callout.component.spec.ts +0 -138
- package/src/lib/components/core/callout/callout.component.ts +0 -92
- package/src/lib/components/core/card/card.component.html +0 -35
- package/src/lib/components/core/card/card.component.scss +0 -30
- package/src/lib/components/core/card/card.component.spec.ts +0 -21
- package/src/lib/components/core/card/card.component.ts +0 -78
- package/src/lib/components/core/carousel/carousel/carousel.component.html +0 -29
- package/src/lib/components/core/carousel/carousel/carousel.component.scss +0 -1
- package/src/lib/components/core/carousel/carousel/carousel.component.spec.ts +0 -21
- package/src/lib/components/core/carousel/carousel/carousel.component.ts +0 -119
- package/src/lib/components/core/carousel/carousel-item/carousel-item.component.html +0 -3
- package/src/lib/components/core/carousel/carousel-item/carousel-item.component.spec.ts +0 -22
- package/src/lib/components/core/carousel/carousel-item/carousel-item.component.ts +0 -20
- package/src/lib/components/core/carousel/carousel.module.ts +0 -11
- package/src/lib/components/core/chip/chip.component.html +0 -26
- package/src/lib/components/core/chip/chip.component.spec.ts +0 -87
- package/src/lib/components/core/chip/chip.component.ts +0 -154
- package/src/lib/components/core/collapse/collapse.component.html +0 -3
- package/src/lib/components/core/collapse/collapse.component.spec.ts +0 -21
- package/src/lib/components/core/collapse/collapse.component.ts +0 -124
- package/src/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.html +0 -3
- package/src/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.spec.ts +0 -35
- package/src/lib/components/core/dimmer/dimmer-buttons/dimmer-buttons.component.ts +0 -23
- package/src/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.html +0 -3
- package/src/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.spec.ts +0 -22
- package/src/lib/components/core/dimmer/dimmer-icon/dimmer-icon.component.ts +0 -10
- package/src/lib/components/core/dimmer/dimmer.component.html +0 -7
- package/src/lib/components/core/dimmer/dimmer.component.spec.ts +0 -49
- package/src/lib/components/core/dimmer/dimmer.component.ts +0 -50
- package/src/lib/components/core/dimmer/dimmer.module.ts +0 -12
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.html +0 -45
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.scss +0 -3
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.spec.ts +0 -21
- package/src/lib/components/core/dropdown/dropdown/dropdown.component.ts +0 -186
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.html +0 -18
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.scss +0 -4
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.spec.ts +0 -21
- package/src/lib/components/core/dropdown/dropdown-item/dropdown-item.component.ts +0 -82
- package/src/lib/components/core/dropdown/dropdown.module.ts +0 -11
- package/src/lib/components/core/forward/forward.directive.spec.ts +0 -60
- package/src/lib/components/core/forward/forward.directive.ts +0 -43
- package/src/lib/components/core/link/link.component.html +0 -13
- package/src/lib/components/core/link/link.component.spec.ts +0 -21
- package/src/lib/components/core/link/link.component.ts +0 -54
- package/src/lib/components/core/list/list/list.component.html +0 -13
- package/src/lib/components/core/list/list/list.component.spec.ts +0 -21
- package/src/lib/components/core/list/list/list.component.ts +0 -30
- package/src/lib/components/core/list/list-item/list-item.component.html +0 -42
- package/src/lib/components/core/list/list-item/list-item.component.scss +0 -16
- package/src/lib/components/core/list/list-item/list-item.component.spec.ts +0 -21
- package/src/lib/components/core/list/list-item/list-item.component.ts +0 -75
- package/src/lib/components/core/list/list.module.ts +0 -11
- package/src/lib/components/core/modal/modal.component.html +0 -36
- package/src/lib/components/core/modal/modal.component.scss +0 -3
- package/src/lib/components/core/modal/modal.component.spec.ts +0 -21
- package/src/lib/components/core/modal/modal.component.ts +0 -218
- package/src/lib/components/core/notifications/notifications.component.html +0 -25
- package/src/lib/components/core/notifications/notifications.component.scss +0 -3
- package/src/lib/components/core/notifications/notifications.component.spec.ts +0 -21
- package/src/lib/components/core/notifications/notifications.component.ts +0 -123
- package/src/lib/components/core/pagination/pagination.component.html +0 -107
- package/src/lib/components/core/pagination/pagination.component.spec.ts +0 -21
- package/src/lib/components/core/pagination/pagination.component.ts +0 -157
- package/src/lib/components/core/popover/popover.directive.spec.ts +0 -21
- package/src/lib/components/core/popover/popover.directive.ts +0 -171
- package/src/lib/components/core/progress-bar/progress-bar.component.html +0 -20
- package/src/lib/components/core/progress-bar/progress-bar.component.spec.ts +0 -21
- package/src/lib/components/core/progress-bar/progress-bar.component.ts +0 -46
- package/src/lib/components/core/progress-button/progress-button.component.html +0 -5
- package/src/lib/components/core/progress-button/progress-button.component.spec.ts +0 -21
- package/src/lib/components/core/progress-button/progress-button.component.ts +0 -39
- package/src/lib/components/core/spinner/spinner.component.html +0 -7
- package/src/lib/components/core/spinner/spinner.component.spec.ts +0 -80
- package/src/lib/components/core/spinner/spinner.component.ts +0 -31
- package/src/lib/components/core/steppers/steppers-container/steppers-container.component.html +0 -126
- package/src/lib/components/core/steppers/steppers-container/steppers-container.component.spec.ts +0 -21
- package/src/lib/components/core/steppers/steppers-container/steppers-container.component.ts +0 -185
- package/src/lib/components/core/steppers/steppers-item/steppers-item.component.html +0 -3
- package/src/lib/components/core/steppers/steppers-item/steppers-item.component.spec.ts +0 -22
- package/src/lib/components/core/steppers/steppers-item/steppers-item.component.ts +0 -33
- package/src/lib/components/core/steppers/steppers.module.ts +0 -11
- package/src/lib/components/core/tab/tab-container/tab-container.component.html +0 -78
- package/src/lib/components/core/tab/tab-container/tab-container.component.spec.ts +0 -21
- package/src/lib/components/core/tab/tab-container/tab-container.component.ts +0 -137
- package/src/lib/components/core/tab/tab-item/tab-item.component.html +0 -3
- package/src/lib/components/core/tab/tab-item/tab-item.component.spec.ts +0 -22
- package/src/lib/components/core/tab/tab-item/tab-item.component.ts +0 -50
- package/src/lib/components/core/tab/tab.module.ts +0 -11
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.html +0 -27
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.scss +0 -65
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.spec.ts +0 -25
- package/src/lib/components/core/table/sort/sort-header/sort-header.component.ts +0 -164
- package/src/lib/components/core/table/sort/sort.directive.spec.ts +0 -73
- package/src/lib/components/core/table/sort/sort.directive.ts +0 -142
- package/src/lib/components/core/table/table.component.html +0 -23
- package/src/lib/components/core/table/table.component.scss +0 -7
- package/src/lib/components/core/table/table.component.spec.ts +0 -21
- package/src/lib/components/core/table/table.component.ts +0 -70
- package/src/lib/components/core/table/table.module.ts +0 -12
- package/src/lib/components/core/timeline/timeline-item/timeline-item.component.html +0 -47
- package/src/lib/components/core/timeline/timeline-item/timeline-item.component.spec.ts +0 -24
- package/src/lib/components/core/timeline/timeline-item/timeline-item.component.ts +0 -102
- package/src/lib/components/core/timeline/timeline.component.html +0 -21
- package/src/lib/components/core/timeline/timeline.component.spec.ts +0 -21
- package/src/lib/components/core/timeline/timeline.component.ts +0 -31
- package/src/lib/components/core/timeline/timeline.module.ts +0 -11
- package/src/lib/components/core/tooltip/tooltip.directive.spec.ts +0 -20
- package/src/lib/components/core/tooltip/tooltip.directive.ts +0 -141
- package/src/lib/components/form/autocomplete/autocomplete.component.html +0 -58
- package/src/lib/components/form/autocomplete/autocomplete.component.spec.ts +0 -21
- package/src/lib/components/form/autocomplete/autocomplete.component.ts +0 -130
- package/src/lib/components/form/checkbox/checkbox.component.html +0 -67
- package/src/lib/components/form/checkbox/checkbox.component.spec.ts +0 -21
- package/src/lib/components/form/checkbox/checkbox.component.ts +0 -65
- package/src/lib/components/form/form.module.ts +0 -34
- package/src/lib/components/form/input/input.component.html +0 -92
- package/src/lib/components/form/input/input.component.scss +0 -29
- package/src/lib/components/form/input/input.component.spec.ts +0 -21
- package/src/lib/components/form/input/input.component.ts +0 -234
- package/src/lib/components/form/password-input/password-input.component.html +0 -65
- package/src/lib/components/form/password-input/password-input.component.scss +0 -9
- package/src/lib/components/form/password-input/password-input.component.spec.ts +0 -21
- package/src/lib/components/form/password-input/password-input.component.ts +0 -171
- package/src/lib/components/form/radio-button/radio-button.component.html +0 -50
- package/src/lib/components/form/radio-button/radio-button.component.scss +0 -14
- package/src/lib/components/form/radio-button/radio-button.component.spec.ts +0 -21
- package/src/lib/components/form/radio-button/radio-button.component.ts +0 -82
- package/src/lib/components/form/range/range.component.html +0 -17
- package/src/lib/components/form/range/range.component.scss +0 -17
- package/src/lib/components/form/range/range.component.spec.ts +0 -21
- package/src/lib/components/form/range/range.component.ts +0 -100
- package/src/lib/components/form/rating/rating.component.html +0 -24
- package/src/lib/components/form/rating/rating.component.spec.ts +0 -21
- package/src/lib/components/form/rating/rating.component.ts +0 -52
- package/src/lib/components/form/select/select.component.html +0 -54
- package/src/lib/components/form/select/select.component.scss +0 -3
- package/src/lib/components/form/select/select.component.spec.ts +0 -22
- package/src/lib/components/form/select/select.component.ts +0 -91
- package/src/lib/components/form/textarea/textarea.component.html +0 -28
- package/src/lib/components/form/textarea/textarea.component.scss +0 -12
- package/src/lib/components/form/textarea/textarea.component.spec.ts +0 -21
- package/src/lib/components/form/textarea/textarea.component.ts +0 -61
- package/src/lib/components/form/transfer/store/transfer.reducers.ts +0 -242
- package/src/lib/components/form/transfer/store/transfer.state.ts +0 -20
- package/src/lib/components/form/transfer/store/transfer.store.ts +0 -88
- package/src/lib/components/form/transfer/transfer-list/transfer-list.component.html +0 -42
- package/src/lib/components/form/transfer/transfer-list/transfer-list.component.spec.ts +0 -33
- package/src/lib/components/form/transfer/transfer-list/transfer-list.component.ts +0 -93
- package/src/lib/components/form/transfer/transfer.component.html +0 -52
- package/src/lib/components/form/transfer/transfer.component.spec.ts +0 -27
- package/src/lib/components/form/transfer/transfer.component.ts +0 -159
- package/src/lib/components/form/upload-drag-drop/upload-drag-drop.component.html +0 -36
- package/src/lib/components/form/upload-drag-drop/upload-drag-drop.component.spec.ts +0 -21
- package/src/lib/components/form/upload-drag-drop/upload-drag-drop.component.ts +0 -170
- package/src/lib/components/form/upload-file-list/upload-file-list.component.html +0 -46
- package/src/lib/components/form/upload-file-list/upload-file-list.component.spec.ts +0 -22
- package/src/lib/components/form/upload-file-list/upload-file-list.component.ts +0 -120
- package/src/lib/components/navigation/back-button/back-button.component.html +0 -25
- package/src/lib/components/navigation/back-button/back-button.component.spec.ts +0 -91
- package/src/lib/components/navigation/back-button/back-button.component.ts +0 -67
- package/src/lib/components/navigation/back-to-top/back-to-top.component.html +0 -11
- package/src/lib/components/navigation/back-to-top/back-to-top.component.spec.ts +0 -21
- package/src/lib/components/navigation/back-to-top/back-to-top.component.ts +0 -80
- package/src/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.html +0 -23
- package/src/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.spec.ts +0 -21
- package/src/lib/components/navigation/breadcrumbs/breadcrumb/breadcrumb.component.ts +0 -68
- package/src/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.html +0 -3
- package/src/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.spec.ts +0 -22
- package/src/lib/components/navigation/breadcrumbs/breadcrumb-item/breadcrumb-item.component.ts +0 -29
- package/src/lib/components/navigation/breadcrumbs/breadcrumbs.module.ts +0 -11
- package/src/lib/components/navigation/header/header.component.html +0 -102
- package/src/lib/components/navigation/header/header.component.scss +0 -3
- package/src/lib/components/navigation/header/header.component.spec.ts +0 -21
- package/src/lib/components/navigation/header/header.component.ts +0 -107
- package/src/lib/components/navigation/megamenu/megamenu.component.html +0 -34
- package/src/lib/components/navigation/megamenu/megamenu.component.scss +0 -5
- package/src/lib/components/navigation/megamenu/megamenu.component.ts +0 -30
- package/src/lib/components/navigation/navbar/navbar/navbar.component.html +0 -28
- package/src/lib/components/navigation/navbar/navbar/navbar.component.ts +0 -45
- package/src/lib/components/navigation/navbar/navbar-item/navbar-item.component.html +0 -3
- package/src/lib/components/navigation/navbar/navbar-item/navbar-item.component.ts +0 -10
- package/src/lib/components/navigation/navbar/navbar.module.ts +0 -11
- package/src/lib/components/navigation/navscroll/navscroll-list-item.component.ts +0 -95
- package/src/lib/components/navigation/navscroll/navscroll-list-items.component.ts +0 -27
- package/src/lib/components/navigation/navscroll/navscroll.component.html +0 -101
- package/src/lib/components/navigation/navscroll/navscroll.component.scss +0 -9
- package/src/lib/components/navigation/navscroll/navscroll.component.ts +0 -143
- package/src/lib/components/navigation/navscroll/navscroll.store.ts +0 -96
- package/src/lib/components/navigation/navscroll/navscroll.utils.ts +0 -28
- package/src/lib/components/navigation/sidebar/sidebar.component.html +0 -11
- package/src/lib/components/navigation/sidebar/sidebar.component.spec.ts +0 -21
- package/src/lib/components/navigation/sidebar/sidebar.component.ts +0 -39
- package/src/lib/components/navigation/skiplink/skiplink/skiplink.component.html +0 -15
- package/src/lib/components/navigation/skiplink/skiplink/skiplink.component.ts +0 -27
- package/src/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.html +0 -15
- package/src/lib/components/navigation/skiplink/skiplink-item/skiplink-item.component.ts +0 -38
- package/src/lib/components/navigation/skiplink/skiplink.module.ts +0 -11
- package/src/lib/components/utils/error-page/error-page.component.html +0 -33
- package/src/lib/components/utils/error-page/error-page.component.spec.ts +0 -21
- package/src/lib/components/utils/error-page/error-page.component.ts +0 -79
- package/src/lib/components/utils/icon/icon.component.html +0 -6
- package/src/lib/components/utils/icon/icon.component.spec.ts +0 -21
- package/src/lib/components/utils/icon/icon.component.ts +0 -95
- package/src/lib/components/utils/language-switcher/language-switcher.component.html +0 -21
- package/src/lib/components/utils/language-switcher/language-switcher.component.spec.ts +0 -21
- package/src/lib/components/utils/language-switcher/language-switcher.component.ts +0 -56
- package/src/lib/design-angular-kit.module.ts +0 -131
- package/src/lib/enums/colors.enums.ts +0 -10
- package/src/lib/enums/sizes.enum.ts +0 -7
- package/src/lib/interfaces/design-angular-kit-config.ts +0 -34
- package/src/lib/interfaces/form.ts +0 -78
- package/src/lib/interfaces/icon.ts +0 -176
- package/src/lib/interfaces/sortable-table.ts +0 -42
- package/src/lib/interfaces/utils.ts +0 -11
- package/src/lib/pipes/date-ago.pipe.ts +0 -57
- package/src/lib/pipes/duration.pipe.ts +0 -112
- package/src/lib/pipes/mark-matching-text.pipe.ts +0 -43
- package/src/lib/provide-design-angular-kit.ts +0 -73
- package/src/lib/services/notification/notification.service.spec.ts +0 -16
- package/src/lib/services/notification/notification.service.ts +0 -119
- package/src/lib/utils/date-utils.ts +0 -184
- package/src/lib/utils/file-utils.ts +0 -80
- package/src/lib/utils/regex.ts +0 -44
- package/src/lib/validators/it-validators.ts +0 -193
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -24
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.schematics.json +0 -25
- package/tsconfig.spec.json +0 -9
- /package/schematics/ng-add/rules/setup-project/{index.ts → index.d.ts} +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
3
|
-
|
|
4
|
-
type DateAgoPipeInterval = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Indicates in a textual way how much time has passed since the indicated date
|
|
8
|
-
* @example 2 hours ago
|
|
9
|
-
*/
|
|
10
|
-
@Pipe({
|
|
11
|
-
name: 'itDateAgo',
|
|
12
|
-
pure: false,
|
|
13
|
-
standalone: true,
|
|
14
|
-
})
|
|
15
|
-
export class ItDateAgoPipe extends TranslatePipe implements PipeTransform {
|
|
16
|
-
/**
|
|
17
|
-
* Indicates in a textual way how much time has passed since the indicated date
|
|
18
|
-
* @example 2 hours ago
|
|
19
|
-
* @param value the Date or date string
|
|
20
|
-
*/
|
|
21
|
-
override transform(value: string | Date): string {
|
|
22
|
-
if (!value) {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const seconds = Math.floor((+new Date() - +new Date(value)) / 1000);
|
|
27
|
-
if (isNaN(seconds)) {
|
|
28
|
-
return '';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// less than 30 seconds ago will show as 'Just now'
|
|
32
|
-
if (seconds < 29) {
|
|
33
|
-
return super.transform('it.date-ago-pipe.just-now');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const intervals = new Map<DateAgoPipeInterval, number>([
|
|
37
|
-
['year', 31536000],
|
|
38
|
-
['month', 2592000],
|
|
39
|
-
['week', 604800],
|
|
40
|
-
['day', 86400],
|
|
41
|
-
['hour', 3600],
|
|
42
|
-
['minute', 60],
|
|
43
|
-
['second', 1],
|
|
44
|
-
]);
|
|
45
|
-
|
|
46
|
-
for (const interval of intervals) {
|
|
47
|
-
const counter = Math.floor(seconds / interval[1]);
|
|
48
|
-
if (counter > 0) {
|
|
49
|
-
return super.transform(`it.date-ago-pipe.${counter === 1 ? 'singular-' : ''}${interval[0]}-ago`, {
|
|
50
|
-
count: counter,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return '';
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
3
|
-
|
|
4
|
-
export type ItDurationPipeType = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Transform a number into a duration.
|
|
8
|
-
* Is necessary indicate the value expressed by the number, for example 'day'.
|
|
9
|
-
* @example
|
|
10
|
-
* - 1, 'day' -> 1 day
|
|
11
|
-
* - 5, 'day' -> 5 days
|
|
12
|
-
* - 7, 'day' -> 1 week
|
|
13
|
-
* - 365, 'day' -> 1 year
|
|
14
|
-
* - 2, 'week' -> 2 weeks
|
|
15
|
-
* ...
|
|
16
|
-
*/
|
|
17
|
-
@Pipe({
|
|
18
|
-
name: 'itDuration',
|
|
19
|
-
standalone: true,
|
|
20
|
-
})
|
|
21
|
-
export class ItDurationPipe extends TranslatePipe implements PipeTransform {
|
|
22
|
-
/**
|
|
23
|
-
* Transform a number into a duration.
|
|
24
|
-
* Is necessary indicate the value expressed by the number, for example 'day'.
|
|
25
|
-
* @example
|
|
26
|
-
* - 1, 'day' -> 1 day
|
|
27
|
-
* - 5, 'day' -> 5 days
|
|
28
|
-
* - 7, 'day' -> 1 week
|
|
29
|
-
* - 8, 'day' -> 1 week
|
|
30
|
-
* - 365, 'day' -> 1 year
|
|
31
|
-
* - 2, 'week' -> 2 weeks
|
|
32
|
-
* - 24, 'month' -> 1 year
|
|
33
|
-
* ...
|
|
34
|
-
* @param value the number
|
|
35
|
-
* @param type the number expressed type
|
|
36
|
-
*/
|
|
37
|
-
override transform(value: string | number | undefined, type: ItDurationPipeType): string {
|
|
38
|
-
let valueAdjust = Number(value);
|
|
39
|
-
if (isNaN(valueAdjust)) {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
switch (type) {
|
|
44
|
-
// eslint-disable-next-line no-fallthrough,@typescript-eslint/ban-ts-comment
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
case 'second':
|
|
47
|
-
if (valueAdjust < 60) {
|
|
48
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
49
|
-
count: valueAdjust,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
valueAdjust = Math.round(valueAdjust / 60);
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
// eslint-disable-next-line no-fallthrough
|
|
56
|
-
case 'minute':
|
|
57
|
-
if (valueAdjust < 60) {
|
|
58
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
59
|
-
count: valueAdjust,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
valueAdjust = Math.round(valueAdjust / 60);
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
// eslint-disable-next-line no-fallthrough
|
|
66
|
-
case 'hour':
|
|
67
|
-
if (valueAdjust < 24) {
|
|
68
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
69
|
-
count: valueAdjust,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
valueAdjust = Math.round(valueAdjust / 24);
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
// eslint-disable-next-line no-fallthrough
|
|
76
|
-
case 'day':
|
|
77
|
-
if (valueAdjust < 7) {
|
|
78
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
79
|
-
count: valueAdjust,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
valueAdjust = Math.round(valueAdjust / 7);
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
// eslint-disable-next-line no-fallthrough
|
|
86
|
-
case 'week':
|
|
87
|
-
if (valueAdjust < 5) {
|
|
88
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
89
|
-
count: valueAdjust,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
valueAdjust = Math.round(valueAdjust / 5);
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
// eslint-disable-next-line no-fallthrough
|
|
96
|
-
case 'month':
|
|
97
|
-
if (valueAdjust < 24) {
|
|
98
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
99
|
-
count: valueAdjust,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
valueAdjust = Math.round(valueAdjust / 24);
|
|
103
|
-
// eslint-disable-next-line no-fallthrough
|
|
104
|
-
case 'year':
|
|
105
|
-
return super.transform(`it.duration.${type}${valueAdjust === 1 ? '' : 's'}`, {
|
|
106
|
-
count: valueAdjust,
|
|
107
|
-
});
|
|
108
|
-
default:
|
|
109
|
-
return '';
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Allows you to highlight text with the <mark> tag
|
|
6
|
-
*/
|
|
7
|
-
@Pipe({
|
|
8
|
-
standalone: true,
|
|
9
|
-
name: 'itMarkMatchingText',
|
|
10
|
-
})
|
|
11
|
-
export class ItMarkMatchingTextPipe implements PipeTransform {
|
|
12
|
-
constructor(private readonly domSanitizer: DomSanitizer) {}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Allows you to highlight text with the <mark> tag
|
|
16
|
-
* @param allString the full text to search from
|
|
17
|
-
* @param searchString the string to search
|
|
18
|
-
*/
|
|
19
|
-
transform(allString: string | undefined, searchString: string | number | null | undefined): SafeHtml | string | undefined {
|
|
20
|
-
if (!searchString) {
|
|
21
|
-
return allString;
|
|
22
|
-
} else if (!allString) {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (typeof searchString === 'number') {
|
|
27
|
-
searchString = searchString.toString();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Check if search string is a substring of pivot string (no case-sensitive)
|
|
31
|
-
const idxOfMatchString = allString.toLowerCase().indexOf(searchString.toLowerCase());
|
|
32
|
-
if (idxOfMatchString !== -1) {
|
|
33
|
-
// retrieve the exactly substring
|
|
34
|
-
const matchingString = allString.substring(idxOfMatchString, idxOfMatchString + searchString.length);
|
|
35
|
-
// Replace original string marking as <strong> (bold) the matchinng substring
|
|
36
|
-
const regEx = new RegExp('(' + matchingString + ')', 'gi');
|
|
37
|
-
const res = allString.replace(regEx, '<mark>$1</mark>');
|
|
38
|
-
return this.domSanitizer.bypassSecurityTrustHtml(res);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return allString;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { HttpClient, provideHttpClient } from '@angular/common/http';
|
|
2
|
-
import { APP_INITIALIZER, EnvironmentProviders, importProvidersFrom, makeEnvironmentProviders, Provider } from '@angular/core';
|
|
3
|
-
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
4
|
-
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
5
|
-
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
6
|
-
import { loadFonts } from 'bootstrap-italia';
|
|
7
|
-
import { DesignAngularKitConfig, IT_ASSET_BASE_PATH } from './interfaces/design-angular-kit-config';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Configures DesignAngularKit library
|
|
11
|
-
* @param config the DesignAngularKit config
|
|
12
|
-
*/
|
|
13
|
-
export function provideDesignAngularKit(config?: DesignAngularKitConfig): EnvironmentProviders {
|
|
14
|
-
let assetBasePath = './bootstrap-italia';
|
|
15
|
-
if (config?.assetBasePath) {
|
|
16
|
-
assetBasePath = config.assetBasePath.endsWith('/')
|
|
17
|
-
? config.assetBasePath.substring(0, config.assetBasePath.lastIndexOf('/'))
|
|
18
|
-
: config.assetBasePath;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const providers: Array<EnvironmentProviders | Provider> = [
|
|
22
|
-
{
|
|
23
|
-
provide: IT_ASSET_BASE_PATH,
|
|
24
|
-
useValue: assetBasePath,
|
|
25
|
-
},
|
|
26
|
-
provideAnimationsAsync(),
|
|
27
|
-
provideHttpClient(),
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
if (config?.loadFont !== false) {
|
|
31
|
-
// Add provider to initialize the bootstrap-italia font
|
|
32
|
-
providers.push({
|
|
33
|
-
provide: APP_INITIALIZER,
|
|
34
|
-
useFactory: () => {
|
|
35
|
-
return () => {
|
|
36
|
-
loadFonts(`${assetBasePath}/dist/fonts`);
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
multi: true,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Add provider to initialize the TranslateModule
|
|
44
|
-
const langPrefix = `${assetBasePath}/i18n/`;
|
|
45
|
-
const langSuffix = `.json`; // TODO: add ?v${version} to prevent cache loading on version change
|
|
46
|
-
providers.push(
|
|
47
|
-
importProvidersFrom(
|
|
48
|
-
TranslateModule.forRoot({
|
|
49
|
-
loader: config?.translateLoader?.(langPrefix, langSuffix) ?? {
|
|
50
|
-
provide: TranslateLoader,
|
|
51
|
-
useFactory: (http: HttpClient) => new TranslateHttpLoader(http, langPrefix, langSuffix),
|
|
52
|
-
deps: [HttpClient],
|
|
53
|
-
},
|
|
54
|
-
defaultLanguage: 'it',
|
|
55
|
-
useDefaultLang: true,
|
|
56
|
-
})
|
|
57
|
-
)
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
// Add provider to initialize library default languages
|
|
61
|
-
providers.push({
|
|
62
|
-
provide: APP_INITIALIZER,
|
|
63
|
-
useFactory: (translateService: TranslateService) => {
|
|
64
|
-
return () => {
|
|
65
|
-
translateService.addLangs(['it', 'en']); // Adds 'it' and 'en' as available languages.
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
multi: true,
|
|
69
|
-
deps: [TranslateService],
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return makeEnvironmentProviders(providers);
|
|
73
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { ItNotificationService } from './notification.service';
|
|
4
|
-
|
|
5
|
-
describe('ItNotificationService', () => {
|
|
6
|
-
let service: ItNotificationService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(ItNotificationService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { filter, Observable, Subject } from 'rxjs';
|
|
3
|
-
import { Notification, NotificationPosition, NotificationType } from '../../interfaces/core';
|
|
4
|
-
|
|
5
|
-
@Injectable({ providedIn: 'root' })
|
|
6
|
-
export class ItNotificationService {
|
|
7
|
-
private subject = new Subject<Notification>();
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Listen on notification arrived
|
|
11
|
-
* @param filterType filter type of notification
|
|
12
|
-
*/
|
|
13
|
-
public onNotification(filterType?: NotificationType): Observable<Notification> {
|
|
14
|
-
return this.subject.asObservable().pipe(filter(n => n && (!filterType || n.type === filterType)));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Show new notification
|
|
19
|
-
* @param notification notification
|
|
20
|
-
*/
|
|
21
|
-
public addNotification(notification: Notification): void {
|
|
22
|
-
this.subject.next(notification);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Create new Standard notification
|
|
27
|
-
* @param title notification title
|
|
28
|
-
* @param message notification message
|
|
29
|
-
* @param dismissible notification dismissible
|
|
30
|
-
* @param duration notification duration (milliseconds)
|
|
31
|
-
* @param position notification position
|
|
32
|
-
*/
|
|
33
|
-
public standard(title: string, message?: string, dismissible?: boolean, duration?: number, position?: NotificationPosition): void {
|
|
34
|
-
this.addNotification({
|
|
35
|
-
type: NotificationType.Standard,
|
|
36
|
-
message,
|
|
37
|
-
title,
|
|
38
|
-
duration,
|
|
39
|
-
dismissible,
|
|
40
|
-
position,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Create new Success notification
|
|
46
|
-
* @param title notification title
|
|
47
|
-
* @param message notification message
|
|
48
|
-
* @param dismissible notification dismissible
|
|
49
|
-
* @param duration notification duration (milliseconds)
|
|
50
|
-
* @param position notification position
|
|
51
|
-
*/
|
|
52
|
-
public success(title: string, message?: string, dismissible?: boolean, duration?: number, position?: NotificationPosition): void {
|
|
53
|
-
this.addNotification({
|
|
54
|
-
type: NotificationType.Success,
|
|
55
|
-
message,
|
|
56
|
-
title,
|
|
57
|
-
duration,
|
|
58
|
-
dismissible,
|
|
59
|
-
position,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Create new Error notification
|
|
65
|
-
* @param title notification title
|
|
66
|
-
* @param message notification message
|
|
67
|
-
* @param dismissible notification dismissible
|
|
68
|
-
* @param duration notification duration (milliseconds)
|
|
69
|
-
* @param position notification position
|
|
70
|
-
*/
|
|
71
|
-
public error(title: string, message?: string, dismissible?: boolean, duration?: number, position?: NotificationPosition): void {
|
|
72
|
-
this.addNotification({
|
|
73
|
-
type: NotificationType.Error,
|
|
74
|
-
message,
|
|
75
|
-
title,
|
|
76
|
-
duration,
|
|
77
|
-
dismissible,
|
|
78
|
-
position,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Create new Warning notification
|
|
84
|
-
* @param title notification title
|
|
85
|
-
* @param message notification message
|
|
86
|
-
* @param dismissible notification dismissible
|
|
87
|
-
* @param duration notification duration (milliseconds)
|
|
88
|
-
* @param position notification position
|
|
89
|
-
*/
|
|
90
|
-
public warning(title: string, message?: string, dismissible?: boolean, duration?: number, position?: NotificationPosition): void {
|
|
91
|
-
this.addNotification({
|
|
92
|
-
type: NotificationType.Warning,
|
|
93
|
-
message,
|
|
94
|
-
title,
|
|
95
|
-
duration,
|
|
96
|
-
dismissible,
|
|
97
|
-
position,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Create new Info notification
|
|
103
|
-
* @param title notification title
|
|
104
|
-
* @param message notification message
|
|
105
|
-
* @param dismissible notification dismissible
|
|
106
|
-
* @param duration notification duration (milliseconds)
|
|
107
|
-
* @param position notification position
|
|
108
|
-
*/
|
|
109
|
-
public info(title: string, message?: string, dismissible?: boolean, duration?: number, position?: NotificationPosition): void {
|
|
110
|
-
this.addNotification({
|
|
111
|
-
type: NotificationType.Info,
|
|
112
|
-
message,
|
|
113
|
-
title,
|
|
114
|
-
duration,
|
|
115
|
-
dismissible,
|
|
116
|
-
position,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { Observable, shareReplay, takeWhile, timer } from 'rxjs';
|
|
2
|
-
import { map } from 'rxjs/operators';
|
|
3
|
-
|
|
4
|
-
export class ItDateUtils {
|
|
5
|
-
/**
|
|
6
|
-
* Add seconds to date
|
|
7
|
-
* @param date the date
|
|
8
|
-
* @param seconds seconds to add
|
|
9
|
-
*/
|
|
10
|
-
public static addSeconds(date: Date, seconds: number): Date {
|
|
11
|
-
const newDate = new Date(date.valueOf());
|
|
12
|
-
newDate.setSeconds(date.getSeconds() + seconds);
|
|
13
|
-
return newDate;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Add minutes to date
|
|
18
|
-
* @param date the date
|
|
19
|
-
* @param minutes minutes to add
|
|
20
|
-
*/
|
|
21
|
-
public static addMinutes(date: Date, minutes: number): Date {
|
|
22
|
-
const newDate = new Date(date.valueOf());
|
|
23
|
-
newDate.setMinutes(date.getMinutes() + minutes);
|
|
24
|
-
return newDate;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Add hours to date
|
|
29
|
-
* @param date the date
|
|
30
|
-
* @param hours hours to add
|
|
31
|
-
*/
|
|
32
|
-
public static addHours(date: Date, hours: number): Date {
|
|
33
|
-
const newDate = new Date(date.valueOf());
|
|
34
|
-
newDate.setHours(date.getHours() + hours);
|
|
35
|
-
return newDate;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Add days to date
|
|
40
|
-
* @param date the date
|
|
41
|
-
* @param days days to add
|
|
42
|
-
*/
|
|
43
|
-
public static addDays(date: Date, days: number): Date {
|
|
44
|
-
const newDate = new Date(date.valueOf());
|
|
45
|
-
newDate.setDate(date.getDate() + days);
|
|
46
|
-
return newDate;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Add years to date
|
|
51
|
-
* @param date the date
|
|
52
|
-
* @param months months to add
|
|
53
|
-
*/
|
|
54
|
-
public static addMonths(date: Date, months: number): Date {
|
|
55
|
-
const newDate = new Date(date.valueOf());
|
|
56
|
-
newDate.setMonth(date.getMonth() + months);
|
|
57
|
-
return newDate;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Add years to date
|
|
62
|
-
* @param date the date
|
|
63
|
-
* @param years years to add
|
|
64
|
-
*/
|
|
65
|
-
public static addYears(date: Date, years: number): Date {
|
|
66
|
-
const newDate = new Date(date.valueOf());
|
|
67
|
-
newDate.setFullYear(date.getFullYear() + years);
|
|
68
|
-
return newDate;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Calculate number of days between two date
|
|
73
|
-
* @param startDate
|
|
74
|
-
* @param endDate
|
|
75
|
-
* @param absolute return unsigned result
|
|
76
|
-
*/
|
|
77
|
-
public static countDays(startDate: Date, endDate: Date, absolute: boolean = false): number {
|
|
78
|
-
const differenceInTime = endDate.getTime() - startDate.getTime();
|
|
79
|
-
const diff = absolute ? Math.abs(differenceInTime) : differenceInTime;
|
|
80
|
-
return Math.ceil(diff / (1000 * 3600 * 24));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Check if string is a date with iso format
|
|
85
|
-
* @param value the string
|
|
86
|
-
*/
|
|
87
|
-
public static isIsoString(value: string | null): boolean {
|
|
88
|
-
if (!value || !/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(value)) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
const d = new Date(value);
|
|
92
|
-
return !!d && !isNaN(d.getTime()) && d.toISOString() === value;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Convert iso string to Date
|
|
97
|
-
* @param isoString the iso string
|
|
98
|
-
*/
|
|
99
|
-
public static isoStringToDate(isoString: string | null): Date | null {
|
|
100
|
-
return isoString ? new Date(Date.parse(isoString)) : null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Remove time from an iso date string
|
|
105
|
-
* @param isoString the iso string
|
|
106
|
-
*/
|
|
107
|
-
public static isoStringRemoveTime(isoString: string): string {
|
|
108
|
-
let date = ItDateUtils.isoStringToDate(isoString);
|
|
109
|
-
if (!date) {
|
|
110
|
-
return isoString;
|
|
111
|
-
}
|
|
112
|
-
const offset = date.getTimezoneOffset();
|
|
113
|
-
date = new Date(date.getTime() - offset * 60 * 1000);
|
|
114
|
-
return date.toISOString().substring(0, isoString.indexOf('T'));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Set iso string hours to 0 and format correctly the date (consider timezone offset)
|
|
119
|
-
* @example '2024-03-04T23:00:00.000Z' -> '2024-03-05T00:00:00.000Z'
|
|
120
|
-
* @param isoString the iso string
|
|
121
|
-
*/
|
|
122
|
-
public static isoStringSetZeroTime(isoString: string): string {
|
|
123
|
-
let date = ItDateUtils.isoStringToDate(isoString);
|
|
124
|
-
if (!date) {
|
|
125
|
-
return isoString;
|
|
126
|
-
}
|
|
127
|
-
const offset = date.getTimezoneOffset();
|
|
128
|
-
date = new Date(date.getTime() - offset * 60 * 1000);
|
|
129
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
130
|
-
return date.toISOString();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Calculate the date time left and return the string format [d h m s]
|
|
135
|
-
* @param endDate
|
|
136
|
-
*/
|
|
137
|
-
public static timeLeftString(endDate: Date): Observable<string> {
|
|
138
|
-
const endTime = endDate.getTime();
|
|
139
|
-
return timer(0, 1000).pipe(
|
|
140
|
-
map(() => Math.floor((endTime - new Date().getTime()) / 1000)),
|
|
141
|
-
takeWhile(delta => delta >= 0),
|
|
142
|
-
map(delta => {
|
|
143
|
-
const arrayResult: Array<string> = [];
|
|
144
|
-
const days = Math.floor(delta / 60 / 60 / 24);
|
|
145
|
-
if (days > 0) {
|
|
146
|
-
arrayResult.push(days + 'd');
|
|
147
|
-
}
|
|
148
|
-
delta -= days * 60 * 60 * 24;
|
|
149
|
-
const hours = Math.floor(delta / 60 / 60) % 24;
|
|
150
|
-
if (hours > 0) {
|
|
151
|
-
arrayResult.push(hours + 'h');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
delta -= hours * 60 * 60;
|
|
155
|
-
const minutes = Math.floor(delta / 60) % 60;
|
|
156
|
-
arrayResult.push(minutes + 'm');
|
|
157
|
-
|
|
158
|
-
delta -= minutes * 60;
|
|
159
|
-
const seconds = delta % 60;
|
|
160
|
-
arrayResult.push(seconds + 's');
|
|
161
|
-
|
|
162
|
-
return arrayResult.join(' ');
|
|
163
|
-
}),
|
|
164
|
-
shareReplay(1)
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Calculate the next day of week
|
|
170
|
-
* @param dayOfWeek Day of week 0=Sunday, 1=Monday...4=Thursday...
|
|
171
|
-
* @param hour the specif hour
|
|
172
|
-
* @param minute the specific minute
|
|
173
|
-
*/
|
|
174
|
-
public static nextWeekDayAndTime(dayOfWeek: number, hour = 0, minute = 0): Date {
|
|
175
|
-
const now = new Date();
|
|
176
|
-
const result = new Date(now.getFullYear(), now.getMonth(), now.getDate() + ((7 + dayOfWeek - now.getDay()) % 7), hour, minute, 0, 0);
|
|
177
|
-
|
|
178
|
-
if (result < now) {
|
|
179
|
-
result.setDate(result.getDate() + 7);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return result;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
|
|
3
|
-
export class ItFileUtils {
|
|
4
|
-
/**
|
|
5
|
-
* Return the file size string
|
|
6
|
-
* @param file the file
|
|
7
|
-
* @param decimals decimal to show
|
|
8
|
-
*/
|
|
9
|
-
public static getFileSizeString(file: File, decimals = 2): string {
|
|
10
|
-
const bytes = file.size;
|
|
11
|
-
if (!+bytes) {
|
|
12
|
-
return '0 Bytes';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const k = 1024;
|
|
16
|
-
const dm = decimals < 0 ? 0 : decimals;
|
|
17
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
18
|
-
|
|
19
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
20
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Convert a file to base64 string
|
|
25
|
-
* @param file the base64 string
|
|
26
|
-
*/
|
|
27
|
-
public static fileToBase64(file: File): Observable<string> {
|
|
28
|
-
const reader = new FileReader();
|
|
29
|
-
reader.readAsDataURL(file);
|
|
30
|
-
|
|
31
|
-
return new Observable<string>(observer => {
|
|
32
|
-
reader.onload = e => {
|
|
33
|
-
const target = e.target;
|
|
34
|
-
if (!target?.result || target.result instanceof ArrayBuffer) {
|
|
35
|
-
return observer.error('Error on parse');
|
|
36
|
-
}
|
|
37
|
-
observer.next(target.result);
|
|
38
|
-
observer.complete();
|
|
39
|
-
};
|
|
40
|
-
reader.onerror = error => {
|
|
41
|
-
observer.error(error);
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Convert base64 to Blob
|
|
48
|
-
* @param base64 the base64 string
|
|
49
|
-
* @param mimeType the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types">MIME type</a> (example 'application/pdf')
|
|
50
|
-
*/
|
|
51
|
-
public static base64ToBlob(base64: string, mimeType: string): Blob {
|
|
52
|
-
const byteString = window.atob(base64);
|
|
53
|
-
const arrayBuffer = new ArrayBuffer(byteString.length);
|
|
54
|
-
const int8Array = new Uint8Array(arrayBuffer);
|
|
55
|
-
for (let i = 0; i < byteString.length; i++) {
|
|
56
|
-
int8Array[i] = byteString.charCodeAt(i);
|
|
57
|
-
}
|
|
58
|
-
return new Blob([int8Array], { type: mimeType });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Convert base64 to File
|
|
63
|
-
* @param base64 the base64 string
|
|
64
|
-
* @param mimeType the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types">MIME type</a> (example 'application/pdf')
|
|
65
|
-
* @param filename the file name
|
|
66
|
-
*/
|
|
67
|
-
public static base64ToFile(base64: string, mimeType: string, filename: string): File {
|
|
68
|
-
const fileBlob = ItFileUtils.base64ToBlob(base64, mimeType);
|
|
69
|
-
return new File([fileBlob], filename, { type: mimeType });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Extract the MIME type from base64 string
|
|
74
|
-
* @param base64 the base64 string
|
|
75
|
-
*/
|
|
76
|
-
public static getMimeTypeFromBase64(base64: string): string | undefined {
|
|
77
|
-
const mime = base64.match(/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/);
|
|
78
|
-
return mime?.length ? mime[1] : undefined;
|
|
79
|
-
}
|
|
80
|
-
}
|