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,36 +0,0 @@
|
|
|
1
|
-
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
import { NodePackageInstallTask, RunSchematicTask } from '@angular-devkit/schematics/tasks';
|
|
3
|
-
|
|
4
|
-
import { Schema } from './schema';
|
|
5
|
-
import { addPackageToPackageJson, getPackageVersionFromPackageJson, toSemVerObject } from './utils';
|
|
6
|
-
import { getPackageVersion } from './versions-helper';
|
|
7
|
-
|
|
8
|
-
const DESIGN_ANGULAR_KIT_PACKAGE_NAME = 'design-angular-kit';
|
|
9
|
-
const NG_LATEST_VERSION = '19.0.0';
|
|
10
|
-
|
|
11
|
-
export default function (options: Schema): Rule {
|
|
12
|
-
return (host: Tree, context: SchematicContext) => {
|
|
13
|
-
// Get the version of `@angular/core`
|
|
14
|
-
// This tag should be preferred because all Angular dependencies should have the same version tag if possible.
|
|
15
|
-
const ngCoreVersionTag = getPackageVersionFromPackageJson(host, '@angular/core');
|
|
16
|
-
const designAngularKitVersionRange = getPackageVersionFromPackageJson(host, DESIGN_ANGULAR_KIT_PACKAGE_NAME);
|
|
17
|
-
const angularDependencyVersion = ngCoreVersionTag || NG_LATEST_VERSION;
|
|
18
|
-
|
|
19
|
-
const { major: angularMajorVersion } = toSemVerObject(angularDependencyVersion);
|
|
20
|
-
|
|
21
|
-
const designAngularKitPackageVersion = getPackageVersion({ angularMajorVersion });
|
|
22
|
-
|
|
23
|
-
// The CLI inserts `design-angular-kit` into the `package.json` before this schematic runs.
|
|
24
|
-
// This means that we do not need to insert Design Angular Kit into `package.json` files again.
|
|
25
|
-
if (designAngularKitVersionRange === null) {
|
|
26
|
-
addPackageToPackageJson(host, DESIGN_ANGULAR_KIT_PACKAGE_NAME, designAngularKitPackageVersion);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
addPackageToPackageJson(host, '@angular/cdk', angularDependencyVersion);
|
|
30
|
-
addPackageToPackageJson(host, '@angular/animations', angularDependencyVersion);
|
|
31
|
-
|
|
32
|
-
const installTaskId = context.addTask(new NodePackageInstallTask());
|
|
33
|
-
|
|
34
|
-
context.addTask(new RunSchematicTask('ng-add-setup-project', options), [installTaskId]);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { callRule, noop, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
export function addAnimations(): Rule {
|
|
4
|
-
//this dependency should be provided at application level instead of lib level. ref: provideDesignAngularKit
|
|
5
|
-
//provideAnimationsAsync(),
|
|
6
|
-
return (host: Tree, context: SchematicContext) => callRule(noop(), host, context);
|
|
7
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { JsonArray, JsonObject, workspaces } from '@angular-devkit/core';
|
|
2
|
-
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
3
|
-
import { readWorkspace, writeWorkspace } from '@schematics/angular/utility';
|
|
4
|
-
|
|
5
|
-
import { Schema } from '../../schema';
|
|
6
|
-
import { getProjectTargetOptions } from './angular-json-helper';
|
|
7
|
-
import { NoProjectException } from './exceptions';
|
|
8
|
-
|
|
9
|
-
const ASSETS_CONFIG = {
|
|
10
|
-
glob: '**/*',
|
|
11
|
-
input: './node_modules/bootstrap-italia/',
|
|
12
|
-
output: '/bootstrap-italia/',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function addAssets(options: Schema): Rule {
|
|
16
|
-
return async (host: Tree) => {
|
|
17
|
-
const workspace = await readWorkspace(host);
|
|
18
|
-
|
|
19
|
-
const projectName = options.project || workspace.extensions.defaultProject!.toString();
|
|
20
|
-
const project = workspace.projects.get(projectName);
|
|
21
|
-
if (!project) {
|
|
22
|
-
throw new NoProjectException(projectName);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
addAssetsToAngularJson(project);
|
|
26
|
-
await writeWorkspace(host, workspace);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function addAssetsToAngularJson(project: workspaces.ProjectDefinition) {
|
|
31
|
-
const targetOptions = getProjectTargetOptions(project, 'build');
|
|
32
|
-
const assets = targetOptions.assets as JsonArray | undefined;
|
|
33
|
-
if (!assets) {
|
|
34
|
-
targetOptions.assets = [ASSETS_CONFIG];
|
|
35
|
-
} else {
|
|
36
|
-
const existingAssets = assets.map(s => (typeof s === 'string' ? s : (s as JsonObject)!['input'])) as Array<string>;
|
|
37
|
-
|
|
38
|
-
for (const [, input] of existingAssets.entries()) {
|
|
39
|
-
if (input === ASSETS_CONFIG.input) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
assets.push(ASSETS_CONFIG);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Rule, SchematicContext, Tree, callRule } from '@angular-devkit/schematics';
|
|
2
|
-
import { isStandaloneApp } from '@angular/cdk/schematics';
|
|
3
|
-
import { addRootImport, addRootProvider, readWorkspace } from '@schematics/angular/utility';
|
|
4
|
-
import { getMainFilePath } from '@schematics/angular/utility/standalone/util';
|
|
5
|
-
import { firstValueFrom, map } from 'rxjs';
|
|
6
|
-
import { Schema } from '../../schema';
|
|
7
|
-
import { NoMainFileException, NoProjectException } from './exceptions';
|
|
8
|
-
|
|
9
|
-
export function addDesignAngularKit(options: Schema): Rule {
|
|
10
|
-
return async (host: Tree, context: SchematicContext) => {
|
|
11
|
-
const workspace = await readWorkspace(host);
|
|
12
|
-
const projectName = options.project || (workspace.extensions.defaultProject as string);
|
|
13
|
-
|
|
14
|
-
// 1. getting project by name
|
|
15
|
-
const project = workspace.projects.get(projectName);
|
|
16
|
-
if (!project) {
|
|
17
|
-
throw new NoProjectException(projectName);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// 2. getting main file for project
|
|
21
|
-
const mainFilePath = await getMainFilePath(host, projectName);
|
|
22
|
-
if (!mainFilePath || !host.read(mainFilePath)) {
|
|
23
|
-
throw new NoMainFileException(projectName);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const isNotStandaloneApp = !isStandaloneApp(host, mainFilePath);
|
|
27
|
-
|
|
28
|
-
const rule = isNotStandaloneApp
|
|
29
|
-
? addRootImport(projectName, ({ code, external }) => code`${external('DesignAngularKitModule', 'design-angular-kit')}.forRoot()\n`)
|
|
30
|
-
: addRootProvider(projectName, ({ code, external }) => code`${external('provideDesignAngularKit', 'design-angular-kit')}()`);
|
|
31
|
-
|
|
32
|
-
return firstValueFrom(
|
|
33
|
-
callRule(rule, host, context).pipe(
|
|
34
|
-
map(() => {
|
|
35
|
-
return (): Rule => () => {};
|
|
36
|
-
})
|
|
37
|
-
)
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Rule, SchematicContext, Tree, callRule, noop } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
export function addHttpClient(): Rule {
|
|
4
|
-
//this dependency should be provided at application level instead of lib level. ref: provideDesignAngularKit
|
|
5
|
-
//provideHttpClient(),
|
|
6
|
-
return (host: Tree, context: SchematicContext) => callRule(noop(), host, context);
|
|
7
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { JsonArray, JsonObject, normalize, workspaces } from '@angular-devkit/core';
|
|
2
|
-
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
3
|
-
|
|
4
|
-
import { readWorkspace, writeWorkspace } from '@schematics/angular/utility';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
|
|
7
|
-
import { Schema } from '../../schema';
|
|
8
|
-
import { getProjectTargetOptions } from './angular-json-helper';
|
|
9
|
-
import { NoProjectException } from './exceptions';
|
|
10
|
-
|
|
11
|
-
const BOOTSTRAP_ITALIA_CSS_FILEPATH = 'node_modules/bootstrap-italia/dist/css/bootstrap-italia.min.css';
|
|
12
|
-
const SUPPORTED_BOOTSTRAP_ITALIA_STYLE_MAP: Record<string, string> = {
|
|
13
|
-
'.sass': `
|
|
14
|
-
/* Importazione libreria SCSS di bootstrap-italia */
|
|
15
|
-
@import 'bootstrap-italia/scss/bootstrap-italia'
|
|
16
|
-
`,
|
|
17
|
-
'.scss': `
|
|
18
|
-
/* Importazione libreria SCSS di bootstrap-italia */
|
|
19
|
-
@import '../node_modules/bootstrap-italia/src/scss/bootstrap-italia.scss';
|
|
20
|
-
`,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* if supported
|
|
25
|
-
* add to styles.scss or to style.sass
|
|
26
|
-
* else
|
|
27
|
-
* add css to assets in angular.json
|
|
28
|
-
* @param options
|
|
29
|
-
* @returns Rule
|
|
30
|
-
*/
|
|
31
|
-
export function addImportToStyleFile(options: Schema): Rule {
|
|
32
|
-
return async (host: Tree, context: SchematicContext) => {
|
|
33
|
-
const workspace = await readWorkspace(host);
|
|
34
|
-
|
|
35
|
-
const projectName = options.project || workspace.extensions.defaultProject!.toString();
|
|
36
|
-
const project = workspace.projects.get(projectName);
|
|
37
|
-
if (!project) {
|
|
38
|
-
throw new NoProjectException(projectName);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const styleFilePath = getProjectStyleFile(project as any) || '';
|
|
42
|
-
const styleFileExtension = path.extname(styleFilePath);
|
|
43
|
-
const styleFilePatch = SUPPORTED_BOOTSTRAP_ITALIA_STYLE_MAP[styleFileExtension];
|
|
44
|
-
|
|
45
|
-
// found supported styles
|
|
46
|
-
if (styleFilePatch) {
|
|
47
|
-
return addBootstrapItaliaToStylesFile(styleFilePath, styleFilePatch);
|
|
48
|
-
} else {
|
|
49
|
-
// found some styles, but unsupported
|
|
50
|
-
if (styleFileExtension !== '.css' && styleFileExtension !== '') {
|
|
51
|
-
context.logger.warn('messages.unsupportedStyles(styleFilePath)');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// just patching 'angular.json'
|
|
55
|
-
addBootstrapItaliaToAngularJson(project as any);
|
|
56
|
-
await writeWorkspace(host, workspace);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function addBootstrapItaliaToStylesFile(styleFilePath: string, styleFilePatch: string): Rule {
|
|
62
|
-
return async (host: Tree) => {
|
|
63
|
-
const styleContent = host.read(styleFilePath)!.toString('utf-8');
|
|
64
|
-
|
|
65
|
-
const recorder = host.beginUpdate(styleFilePath);
|
|
66
|
-
recorder.insertRight(styleContent.length, styleFilePatch);
|
|
67
|
-
|
|
68
|
-
host.commitUpdate(recorder);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function addBootstrapItaliaToAngularJson(project: workspaces.ProjectDefinition) {
|
|
73
|
-
const targetOptions = getProjectTargetOptions(project, 'build');
|
|
74
|
-
const styles = targetOptions.styles as JsonArray | undefined;
|
|
75
|
-
if (!styles) {
|
|
76
|
-
targetOptions.styles = [BOOTSTRAP_ITALIA_CSS_FILEPATH];
|
|
77
|
-
} else {
|
|
78
|
-
const existingStyles = styles.map(s => (typeof s === 'string' ? s : (s as JsonObject)!['input'])) as Array<string>;
|
|
79
|
-
|
|
80
|
-
for (const [, stylePath] of existingStyles.entries()) {
|
|
81
|
-
if (stylePath === BOOTSTRAP_ITALIA_CSS_FILEPATH) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
styles.unshift(BOOTSTRAP_ITALIA_CSS_FILEPATH);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Regular expression that matches all possible Angular CLI default style files
|
|
90
|
-
const defaultStyleFileRegex = /styles\.(c|le|sc|sa)ss/;
|
|
91
|
-
|
|
92
|
-
// Regular expression that matches all files that have a proper stylesheet extension
|
|
93
|
-
const validStyleFileRegex = /\.(c|le|sc|sa)ss/;
|
|
94
|
-
|
|
95
|
-
function getProjectStyleFile(project: workspaces.ProjectDefinition, extension?: string): string | null {
|
|
96
|
-
const buildOptions = getProjectTargetOptions(project, 'build');
|
|
97
|
-
|
|
98
|
-
if (buildOptions.styles && Array.isArray(buildOptions.styles) && buildOptions.styles.length) {
|
|
99
|
-
const styles = buildOptions.styles.map(s => (typeof s === 'string' ? s : (s as JsonObject)!['input'])) as Array<string>;
|
|
100
|
-
|
|
101
|
-
// Look for the default style file that is generated for new projects by the Angular CLI. This
|
|
102
|
-
// default style file is usually called `styles.ext` unless it has been changed explicitly.
|
|
103
|
-
const defaultMainStylePath = styles.find(file => (extension ? file === `styles.${extension}` : defaultStyleFileRegex.test(file)));
|
|
104
|
-
|
|
105
|
-
if (defaultMainStylePath) {
|
|
106
|
-
return normalize(defaultMainStylePath);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// If no default style file could be found, use the first style file that matches the given
|
|
110
|
-
// extension. If no extension specified explicitly, we look for any file with a valid style
|
|
111
|
-
// file extension.
|
|
112
|
-
const fallbackStylePath = styles.find(file => (extension ? file.endsWith(`.${extension}`) : validStyleFileRegex.test(file)));
|
|
113
|
-
|
|
114
|
-
if (fallbackStylePath) {
|
|
115
|
-
return normalize(fallbackStylePath);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { JsonArray, JsonObject, workspaces } from '@angular-devkit/core';
|
|
2
|
-
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
3
|
-
import { readWorkspace, writeWorkspace } from '@schematics/angular/utility';
|
|
4
|
-
|
|
5
|
-
import { Schema } from '../../schema';
|
|
6
|
-
import { getProjectTargetOptions } from './angular-json-helper';
|
|
7
|
-
import { NoProjectException } from './exceptions';
|
|
8
|
-
|
|
9
|
-
const LOCALISATION_CONFIG = {
|
|
10
|
-
glob: '**/*',
|
|
11
|
-
input: './node_modules/design-angular-kit/assets/i18n',
|
|
12
|
-
output: '/bootstrap-italia/i18n/',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function addLocalisation(options: Schema): Rule {
|
|
16
|
-
return async (host: Tree) => {
|
|
17
|
-
const workspace = await readWorkspace(host);
|
|
18
|
-
|
|
19
|
-
const projectName = options.project || workspace.extensions.defaultProject!.toString();
|
|
20
|
-
const project = workspace.projects.get(projectName);
|
|
21
|
-
if (!project) {
|
|
22
|
-
throw new NoProjectException(projectName);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
addLocalisationToAngularJson(project);
|
|
26
|
-
await writeWorkspace(host, workspace);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function addLocalisationToAngularJson(project: workspaces.ProjectDefinition) {
|
|
31
|
-
const targetOptions = getProjectTargetOptions(project, 'build');
|
|
32
|
-
const assets = targetOptions.assets as JsonArray | undefined;
|
|
33
|
-
if (!assets) {
|
|
34
|
-
targetOptions.assets = [LOCALISATION_CONFIG];
|
|
35
|
-
} else {
|
|
36
|
-
const existingAssets = assets.map(s => (typeof s === 'string' ? s : (s as JsonObject)!['input'])) as Array<string>;
|
|
37
|
-
|
|
38
|
-
for (const [, input] of existingAssets.entries()) {
|
|
39
|
-
if (input === LOCALISATION_CONFIG.input) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
assets.push(LOCALISATION_CONFIG);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { workspaces } from '@angular-devkit/core';
|
|
2
|
-
import { SchematicsException } from '@angular-devkit/schematics';
|
|
3
|
-
|
|
4
|
-
export function getProjectTargetOptions(project: workspaces.ProjectDefinition, buildTarget: string) {
|
|
5
|
-
const buildTargetObject = project.targets.get(buildTarget);
|
|
6
|
-
if (buildTargetObject && buildTargetObject.options) {
|
|
7
|
-
return buildTargetObject.options;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
throw new SchematicsException(`Cannot determine project target configuration for: ${buildTarget}.`);
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SchematicsException } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
export class NoProjectException extends SchematicsException {
|
|
4
|
-
constructor(project: string) {
|
|
5
|
-
super(`Unable to find project '${project}' in the workspace`);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class NoMainFileException extends SchematicsException {
|
|
10
|
-
constructor(project: string) {
|
|
11
|
-
super(`Unable to find 'build.options.main' file path for project "${project}`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner } from '@angular-devkit/schematics/testing';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { Schema } from './schema';
|
|
4
|
-
|
|
5
|
-
const createApp = async (
|
|
6
|
-
runner: SchematicTestRunner,
|
|
7
|
-
options: Schema,
|
|
8
|
-
{ standalone, style }: { standalone: boolean; style: 'scss' | 'css' | 'sass' }
|
|
9
|
-
) => {
|
|
10
|
-
let tree = await runner.runExternalSchematic('@schematics/angular', 'workspace', {
|
|
11
|
-
name: 'workspace',
|
|
12
|
-
version: '18.0.0',
|
|
13
|
-
newProjectRoot: 'projects',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
tree = await runner.runExternalSchematic(
|
|
17
|
-
'@schematics/angular',
|
|
18
|
-
'application',
|
|
19
|
-
{
|
|
20
|
-
name: options.project,
|
|
21
|
-
standalone,
|
|
22
|
-
style,
|
|
23
|
-
},
|
|
24
|
-
tree
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return { tree };
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
describe(`ng add design-angular-kit | setup-project - library providing`, () => {
|
|
31
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
32
|
-
const runner = new SchematicTestRunner('schematics', collectionPath);
|
|
33
|
-
|
|
34
|
-
const defaultOptions: Schema = {
|
|
35
|
-
project: 'test-project', // Set your default project name
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
it('should add DesignAngularKitModule to the root module - NgModule app', async () => {
|
|
39
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone: false, style: 'scss' });
|
|
40
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
41
|
-
|
|
42
|
-
// Check if the app.module.ts file exists
|
|
43
|
-
const modulePath = '/projects/test-project/src/app/app.module.ts';
|
|
44
|
-
expect(tree.files).toContain(modulePath);
|
|
45
|
-
|
|
46
|
-
// Check if the correct import statement was added
|
|
47
|
-
const content = tree.readContent(modulePath);
|
|
48
|
-
expect(content).toContain(`import { DesignAngularKitModule } from 'design-angular-kit';`);
|
|
49
|
-
expect(content).toContain(`DesignAngularKitModule.forRoot()`);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should add provideDesignAngularKit() to the app config - Standalone app', async () => {
|
|
53
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone: true, style: 'scss' });
|
|
54
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
55
|
-
|
|
56
|
-
// Check if the app.module.ts file exists
|
|
57
|
-
const appConfigPath = '/projects/test-project/src/app/app.config.ts';
|
|
58
|
-
expect(tree.files).toContain(appConfigPath);
|
|
59
|
-
|
|
60
|
-
// Check if the correct import statement was added
|
|
61
|
-
const content = tree.readContent(appConfigPath);
|
|
62
|
-
expect(content).toContain(`import { provideDesignAngularKit } from 'design-angular-kit';`);
|
|
63
|
-
expect(content).toContain(`provideDesignAngularKit()`);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
for (const standalone of [true, false]) {
|
|
68
|
-
describe(`ng add design-angular-kit | setup-project for ${standalone ? 'standalone' : 'NgModule'} app - styles`, () => {
|
|
69
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
70
|
-
const runner = new SchematicTestRunner('schematics', collectionPath);
|
|
71
|
-
|
|
72
|
-
const defaultOptions: Schema = {
|
|
73
|
-
project: 'test-project', // Set your default project name
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
it('should add .scss import to project style file', async () => {
|
|
77
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone, style: 'scss' });
|
|
78
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
79
|
-
|
|
80
|
-
// Check if the styles.scss file exists
|
|
81
|
-
const styleFilePath = '/projects/test-project/src/styles.scss';
|
|
82
|
-
expect(tree.files).toContain(styleFilePath);
|
|
83
|
-
// Check if the correct import statement was added
|
|
84
|
-
const content = tree.readContent(styleFilePath);
|
|
85
|
-
expect(content).toContain(`@import '../node_modules/bootstrap-italia/src/scss/bootstrap-italia.scss';`);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should add .sass import to project style file', async () => {
|
|
89
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone, style: 'sass' });
|
|
90
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
91
|
-
|
|
92
|
-
// Check if the styles.sass file exists
|
|
93
|
-
const styleFilePath = '/projects/test-project/src/styles.sass';
|
|
94
|
-
expect(tree.files).toContain(styleFilePath);
|
|
95
|
-
// Check if the correct import statement was added
|
|
96
|
-
const content = tree.readContent(styleFilePath);
|
|
97
|
-
expect(content).toContain(`@import 'bootstrap-italia/scss/bootstrap-italia'`);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('should add .css import to angular.json', async () => {
|
|
101
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone, style: 'css' });
|
|
102
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
103
|
-
|
|
104
|
-
// Check if the angular.json file exists
|
|
105
|
-
const angularJsonPath = '/angular.json';
|
|
106
|
-
expect(tree.files).toContain(angularJsonPath);
|
|
107
|
-
// Check if the correct import statement was added
|
|
108
|
-
const content = tree.readContent(angularJsonPath);
|
|
109
|
-
expect(content).toContain(`node_modules/bootstrap-italia/dist/css/bootstrap-italia.min.css`);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe(`ng add design-angular-kit | setup-project for ${standalone ? 'standalone' : 'NgModule'} app - assets`, () => {
|
|
114
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
115
|
-
const runner = new SchematicTestRunner('schematics', collectionPath);
|
|
116
|
-
|
|
117
|
-
const defaultOptions: Schema = {
|
|
118
|
-
project: 'test-project', // Set your default project name
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
it('should add bootstrap italia assets to angular.json', async () => {
|
|
122
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone, style: 'css' });
|
|
123
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
124
|
-
|
|
125
|
-
// Check if the angular.json file exists
|
|
126
|
-
const angularJsonPath = '/angular.json';
|
|
127
|
-
expect(tree.files).toContain(angularJsonPath);
|
|
128
|
-
// Check if the correct import statement was added
|
|
129
|
-
const content = tree.readContent(angularJsonPath);
|
|
130
|
-
//"./node_modules/bootstrap-italia/"
|
|
131
|
-
expect(content).toContain(`./node_modules/bootstrap-italia/`);
|
|
132
|
-
const angularJson = JSON.parse(content);
|
|
133
|
-
const assetsConfig = angularJson.projects[defaultOptions.project]?.architect?.build?.options?.assets?.find(
|
|
134
|
-
(item: { input: string }) => item.input === `./node_modules/bootstrap-italia/`
|
|
135
|
-
);
|
|
136
|
-
expect(assetsConfig).toBeDefined(assetsConfig);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
describe(`ng add design-angular-kit | setup-project for ${standalone ? 'standalone' : 'NgModule'} app - localisation`, () => {
|
|
141
|
-
const collectionPath = path.join(__dirname, '../collection.json');
|
|
142
|
-
const runner = new SchematicTestRunner('schematics', collectionPath);
|
|
143
|
-
|
|
144
|
-
const defaultOptions: Schema = {
|
|
145
|
-
project: 'test-project', // Set your default project name
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
it('should add bootstrap italia localisation to angular.json', async () => {
|
|
149
|
-
const { tree: appTree } = await createApp(runner, defaultOptions, { standalone, style: 'css' });
|
|
150
|
-
const tree = await runner.runSchematic('ng-add-setup-project', defaultOptions, appTree);
|
|
151
|
-
|
|
152
|
-
// Check if the angular.json file exists
|
|
153
|
-
const angularJsonPath = '/angular.json';
|
|
154
|
-
expect(tree.files).toContain(angularJsonPath);
|
|
155
|
-
// Check if the correct import statement was added
|
|
156
|
-
const content = tree.readContent(angularJsonPath);
|
|
157
|
-
//"./node_modules/bootstrap-italia/"
|
|
158
|
-
expect(content).toContain(`/node_modules/design-angular-kit/assets/i18n`);
|
|
159
|
-
const angularJson = JSON.parse(content);
|
|
160
|
-
const assetsConfig = angularJson.projects[defaultOptions.project]?.architect?.build?.options?.assets?.find(
|
|
161
|
-
(item: { input: string }) => item.input === `./node_modules/design-angular-kit/assets/i18n`
|
|
162
|
-
);
|
|
163
|
-
expect(assetsConfig).toBeDefined(assetsConfig);
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
import { getProjectFromWorkspace } from '@angular/cdk/schematics';
|
|
4
|
-
import { getWorkspace } from '@schematics/angular/utility/workspace';
|
|
5
|
-
import { addAnimations, addAssets, addDesignAngularKit, addHttpClient, addImportToStyleFile, addLocalisation } from './rules/setup-project';
|
|
6
|
-
import { Schema } from './schema';
|
|
7
|
-
|
|
8
|
-
import { ProjectType } from '@schematics/angular/utility/workspace-models';
|
|
9
|
-
|
|
10
|
-
export default function (options: Schema): Rule {
|
|
11
|
-
return async (host: Tree, context: SchematicContext) => {
|
|
12
|
-
const workspace = await getWorkspace(host);
|
|
13
|
-
const project = getProjectFromWorkspace(workspace, options.project);
|
|
14
|
-
const isAProject = project.extensions['projectType'] === ProjectType.Application;
|
|
15
|
-
|
|
16
|
-
if (isAProject) {
|
|
17
|
-
return chain([
|
|
18
|
-
addAnimations(),
|
|
19
|
-
addHttpClient(),
|
|
20
|
-
addDesignAngularKit(options),
|
|
21
|
-
addImportToStyleFile(options),
|
|
22
|
-
addAssets(options),
|
|
23
|
-
addLocalisation(options),
|
|
24
|
-
]);
|
|
25
|
-
}
|
|
26
|
-
context.logger.warn(
|
|
27
|
-
`Design Angular Kit has been set in your workspace. No additional setup required.\nIf you intend to run the schematics on a specific project, please use -- project option `
|
|
28
|
-
);
|
|
29
|
-
return;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
interface PackageJson {
|
|
4
|
-
dependencies: Record<string, string>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface SemVerObject {
|
|
8
|
-
semVer?: string;
|
|
9
|
-
major?: string;
|
|
10
|
-
minor?: string;
|
|
11
|
-
patch?: string;
|
|
12
|
-
prerelease?: string;
|
|
13
|
-
buildmetadata?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const SEMVER_WITH_PREFIX_REGEX =
|
|
17
|
-
/^[\^~]?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
|
|
18
|
-
|
|
19
|
-
function sortObjectByKeys(obj: Record<string, string>) {
|
|
20
|
-
return Object.keys(obj)
|
|
21
|
-
.sort()
|
|
22
|
-
.reduce(
|
|
23
|
-
(result, key) => {
|
|
24
|
-
result[key] = obj[key];
|
|
25
|
-
return result;
|
|
26
|
-
},
|
|
27
|
-
{} as Record<string, string>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Get a SemVerObject given a semver string */
|
|
32
|
-
export function toSemVerObject(versionString: string) {
|
|
33
|
-
const [semVer, major, minor, patch, prerelease, buildmetadata] = versionString.match(SEMVER_WITH_PREFIX_REGEX) ?? [];
|
|
34
|
-
return { semVer, major, minor, patch, prerelease, buildmetadata } satisfies SemVerObject;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Adds a package to the package.json in the given host tree. */
|
|
38
|
-
export function addPackageToPackageJson(host: Tree, pkg: string, version: string): Tree {
|
|
39
|
-
if (host.exists('package.json')) {
|
|
40
|
-
const sourceText = host.read('package.json')!.toString('utf-8');
|
|
41
|
-
const json = JSON.parse(sourceText) as PackageJson;
|
|
42
|
-
|
|
43
|
-
if (!json.dependencies) {
|
|
44
|
-
json.dependencies = {};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!json.dependencies[pkg]) {
|
|
48
|
-
json.dependencies[pkg] = version;
|
|
49
|
-
json.dependencies = sortObjectByKeys(json.dependencies);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return host;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Gets the version of the specified package by looking at the package.json in the given tree. */
|
|
59
|
-
export function getPackageVersionFromPackageJson(tree: Tree, name: string): string | null {
|
|
60
|
-
if (!tree.exists('package.json')) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const packageJson = JSON.parse(tree.read('package.json')!.toString('utf8')) as PackageJson;
|
|
65
|
-
|
|
66
|
-
if (packageJson.dependencies && packageJson.dependencies[name]) {
|
|
67
|
-
return packageJson.dependencies[name];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const ANGULAR_VERSIONS = {
|
|
2
|
-
v17: '17',
|
|
3
|
-
v18: '18',
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const KIT_VERSION_1_0_0 = '1.0.0';
|
|
7
|
-
const KIT_VERSION_1_1_0 = '1.1.0';
|
|
8
|
-
const DEFAULT = 'DEFAULT';
|
|
9
|
-
const LATEST = 'LATEST';
|
|
10
|
-
|
|
11
|
-
const versionsMap: Record<string, string> = {
|
|
12
|
-
[DEFAULT]: KIT_VERSION_1_0_0,
|
|
13
|
-
[ANGULAR_VERSIONS.v17]: KIT_VERSION_1_0_0,
|
|
14
|
-
[ANGULAR_VERSIONS.v18]: KIT_VERSION_1_1_0,
|
|
15
|
-
[LATEST]: KIT_VERSION_1_1_0,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// Get Design Angular Kit package version given Angular major version
|
|
19
|
-
export function getPackageVersion({ angularMajorVersion }: { angularMajorVersion: string }) {
|
|
20
|
-
if (isNaN(+angularMajorVersion)) {
|
|
21
|
-
throw new Error('Major version is not a number');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let version = versionsMap[DEFAULT];
|
|
25
|
-
|
|
26
|
-
switch (angularMajorVersion) {
|
|
27
|
-
case ANGULAR_VERSIONS.v17:
|
|
28
|
-
version = versionsMap[ANGULAR_VERSIONS.v17];
|
|
29
|
-
break;
|
|
30
|
-
case ANGULAR_VERSIONS.v18:
|
|
31
|
-
version = versionsMap[ANGULAR_VERSIONS.v18];
|
|
32
|
-
break;
|
|
33
|
-
default: {
|
|
34
|
-
if (Number(angularMajorVersion) > Number(ANGULAR_VERSIONS.v18)) {
|
|
35
|
-
version = versionsMap[LATEST];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return version;
|
|
41
|
-
}
|