@gnggln/ng-ui-system 1.0.0-alpha.2 → 1.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/entry-accordion.d.ts +4 -0
- package/accordion/index.d.ts +5 -0
- package/accordion/lib/components/accordion/accordion.component.d.ts +125 -0
- package/accordion/lib/components/accordion/accordion.types.d.ts +64 -0
- package/accordion/lib/components/accordion/index.d.ts +2 -0
- package/accordion/lib/core/types/index.d.ts +133 -0
- package/base-layout/entry-base-layout.d.ts +4 -0
- package/base-layout/index.d.ts +5 -0
- package/base-layout/lib/components/base-layout/base-layout.component.d.ts +108 -0
- package/base-layout/lib/components/base-layout/base-layout.types.d.ts +40 -0
- package/base-layout/lib/components/base-layout/index.d.ts +13 -0
- package/base-layout/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/base-layout/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/base-layout/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/base-layout/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/base-layout/lib/components/button/button-area.component.d.ts +93 -0
- package/base-layout/lib/components/button/button.component.d.ts +61 -0
- package/base-layout/lib/components/button/button.types.d.ts +75 -0
- package/base-layout/lib/components/page-header/breadcrumb.service.d.ts +96 -0
- package/base-layout/lib/components/page-header/page-header.component.d.ts +59 -0
- package/base-layout/lib/components/page-header/page-header.types.d.ts +96 -0
- package/base-layout/lib/core/types/index.d.ts +133 -0
- package/blackbox/entry-blackbox.d.ts +4 -0
- package/blackbox/index.d.ts +5 -0
- package/blackbox/lib/components/blackbox/blackbox-debugger.component.d.ts +80 -0
- package/blackbox/lib/components/blackbox/blackbox-debugger.service.d.ts +34 -0
- package/blackbox/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/blackbox/lib/components/blackbox/blackbox-json-viewer.component.d.ts +18 -0
- package/blackbox/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/blackbox/lib/components/blackbox/blackbox.interceptor.d.ts +38 -0
- package/blackbox/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/blackbox/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/blackbox/lib/components/blackbox/index.d.ts +23 -0
- package/blackbox/lib/components/blackbox/ui-track.directive.d.ts +20 -0
- package/blackbox/lib/components/button/button-area.component.d.ts +93 -0
- package/blackbox/lib/components/button/button.component.d.ts +61 -0
- package/blackbox/lib/components/button/button.types.d.ts +75 -0
- package/blackbox/lib/components/button/index.d.ts +15 -0
- package/blackbox/lib/components/modal/confirm-dialog.component.d.ts +46 -0
- package/blackbox/lib/components/modal/index.d.ts +4 -0
- package/blackbox/lib/components/modal/modal.component.d.ts +44 -0
- package/blackbox/lib/components/modal/modal.service.d.ts +93 -0
- package/blackbox/lib/components/modal/modal.types.d.ts +110 -0
- package/blackbox/lib/core/types/index.d.ts +133 -0
- package/button/entry-button.d.ts +4 -0
- package/button/index.d.ts +5 -0
- package/button/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/button/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/button/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/button/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/button/lib/components/button/button-area.component.d.ts +93 -0
- package/button/lib/components/button/button.component.d.ts +61 -0
- package/button/lib/components/button/button.types.d.ts +75 -0
- package/button/lib/components/button/index.d.ts +15 -0
- package/button/lib/core/types/index.d.ts +133 -0
- package/core/entry-core.d.ts +5 -0
- package/core/index.d.ts +5 -0
- package/core/lib/core/types/index.d.ts +133 -0
- package/core/lib/core/utils/index.d.ts +60 -0
- package/crud-table/entry-crud-table.d.ts +4 -0
- package/crud-table/index.d.ts +5 -0
- package/crud-table/lib/components/accordion/accordion.component.d.ts +125 -0
- package/crud-table/lib/components/accordion/accordion.types.d.ts +64 -0
- package/crud-table/lib/components/accordion/index.d.ts +2 -0
- package/crud-table/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/crud-table/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/crud-table/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/crud-table/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/crud-table/lib/components/button/button-area.component.d.ts +93 -0
- package/crud-table/lib/components/button/button.component.d.ts +61 -0
- package/crud-table/lib/components/button/button.types.d.ts +75 -0
- package/crud-table/lib/components/button/index.d.ts +15 -0
- package/crud-table/lib/components/crud-table/crud-table.component.d.ts +143 -0
- package/crud-table/lib/components/crud-table/crud-table.types.d.ts +207 -0
- package/crud-table/lib/components/crud-table/index.d.ts +15 -0
- package/crud-table/lib/components/form-builder/adapters/it-date-adapter.d.ts +32 -0
- package/crud-table/lib/components/form-builder/directives/currency-input.directive.d.ts +48 -0
- package/crud-table/lib/components/form-builder/form-builder.component.d.ts +279 -0
- package/crud-table/lib/components/form-builder/services/form-condition.service.d.ts +46 -0
- package/crud-table/lib/components/form-builder/services/form-error-state.matcher.d.ts +9 -0
- package/crud-table/lib/components/form-builder/services/form-field-error.service.d.ts +38 -0
- package/crud-table/lib/components/form-builder/services/form-validation.service.d.ts +63 -0
- package/crud-table/lib/components/form-builder/services/location.service.d.ts +83 -0
- package/crud-table/lib/components/form-builder/services/nominatim-geocoding.service.d.ts +37 -0
- package/crud-table/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.d.ts +31 -0
- package/crud-table/lib/components/form-builder/sub-components/file-input/file-input.component.d.ts +41 -0
- package/crud-table/lib/components/form-builder/sub-components/form-fields/form-number-field.component.d.ts +42 -0
- package/crud-table/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.d.ts +45 -0
- package/crud-table/lib/components/form-builder/sub-components/form-fields/form-select-field.component.d.ts +44 -0
- package/crud-table/lib/components/form-builder/sub-components/form-fields/form-text-field.component.d.ts +62 -0
- package/crud-table/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.d.ts +39 -0
- package/crud-table/lib/components/form-builder/sub-components/form-fields/index.d.ts +5 -0
- package/crud-table/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.d.ts +84 -0
- package/crud-table/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.d.ts +145 -0
- package/crud-table/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.d.ts +108 -0
- package/crud-table/lib/components/form-builder/types/condition.types.d.ts +51 -0
- package/crud-table/lib/components/form-builder/types/field.types.d.ts +330 -0
- package/crud-table/lib/components/form-builder/types/geocoded-location.types.d.ts +116 -0
- package/crud-table/lib/components/form-builder/types/schema.types.d.ts +304 -0
- package/crud-table/lib/components/form-builder/types/territoriale.types.d.ts +170 -0
- package/crud-table/lib/components/form-builder/types/validation.types.d.ts +179 -0
- package/crud-table/lib/components/modal/confirm-dialog.component.d.ts +46 -0
- package/crud-table/lib/components/modal/modal.service.d.ts +93 -0
- package/crud-table/lib/components/modal/modal.types.d.ts +110 -0
- package/crud-table/lib/core/logging/logger.config.d.ts +18 -0
- package/crud-table/lib/core/logging/logger.service.d.ts +75 -0
- package/crud-table/lib/core/logging/logger.types.d.ts +70 -0
- package/crud-table/lib/core/types/index.d.ts +133 -0
- package/esm2022/accordion/entry-accordion.mjs +5 -0
- package/esm2022/accordion/gnggln-ng-ui-system-accordion.mjs +5 -0
- package/esm2022/accordion/lib/components/accordion/accordion.component.mjs +398 -0
- package/esm2022/accordion/lib/components/accordion/accordion.types.mjs +6 -0
- package/esm2022/accordion/lib/components/accordion/index.mjs +2 -0
- package/esm2022/accordion/lib/core/types/index.mjs +6 -0
- package/esm2022/base-layout/entry-base-layout.mjs +5 -0
- package/esm2022/base-layout/gnggln-ng-ui-system-base-layout.mjs +5 -0
- package/esm2022/base-layout/lib/components/base-layout/base-layout.component.mjs +272 -0
- package/esm2022/base-layout/lib/components/base-layout/base-layout.types.mjs +6 -0
- package/esm2022/base-layout/lib/components/base-layout/index.mjs +14 -0
- package/esm2022/base-layout/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/base-layout/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/base-layout/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/base-layout/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/base-layout/lib/components/button/button-area.component.mjs +210 -0
- package/esm2022/base-layout/lib/components/button/button.component.mjs +180 -0
- package/esm2022/base-layout/lib/components/button/button.types.mjs +6 -0
- package/esm2022/base-layout/lib/components/page-header/breadcrumb.service.mjs +243 -0
- package/esm2022/base-layout/lib/components/page-header/page-header.component.mjs +243 -0
- package/esm2022/base-layout/lib/components/page-header/page-header.types.mjs +21 -0
- package/esm2022/base-layout/lib/core/types/index.mjs +6 -0
- package/esm2022/blackbox/entry-blackbox.mjs +5 -0
- package/esm2022/blackbox/gnggln-ng-ui-system-blackbox.mjs +5 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox-debugger.component.mjs +904 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox-debugger.service.mjs +51 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox-json-viewer.component.mjs +66 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox.interceptor.mjs +135 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/blackbox/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/blackbox/lib/components/blackbox/index.mjs +27 -0
- package/esm2022/blackbox/lib/components/blackbox/ui-track.directive.mjs +69 -0
- package/esm2022/blackbox/lib/components/button/button-area.component.mjs +210 -0
- package/esm2022/blackbox/lib/components/button/button.component.mjs +180 -0
- package/esm2022/blackbox/lib/components/button/button.types.mjs +6 -0
- package/esm2022/blackbox/lib/components/button/index.mjs +16 -0
- package/esm2022/blackbox/lib/components/modal/confirm-dialog.component.mjs +151 -0
- package/esm2022/blackbox/lib/components/modal/index.mjs +4 -0
- package/esm2022/blackbox/lib/components/modal/modal.component.mjs +139 -0
- package/esm2022/blackbox/lib/components/modal/modal.service.mjs +197 -0
- package/esm2022/blackbox/lib/components/modal/modal.types.mjs +6 -0
- package/esm2022/blackbox/lib/core/types/index.mjs +6 -0
- package/esm2022/button/entry-button.mjs +5 -0
- package/esm2022/button/gnggln-ng-ui-system-button.mjs +5 -0
- package/esm2022/button/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/button/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/button/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/button/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/button/lib/components/button/button-area.component.mjs +210 -0
- package/esm2022/button/lib/components/button/button.component.mjs +180 -0
- package/esm2022/button/lib/components/button/button.types.mjs +6 -0
- package/esm2022/button/lib/components/button/index.mjs +16 -0
- package/esm2022/button/lib/core/types/index.mjs +6 -0
- package/esm2022/core/entry-core.mjs +6 -0
- package/esm2022/core/gnggln-ng-ui-system-core.mjs +5 -0
- package/esm2022/core/lib/core/types/index.mjs +6 -0
- package/esm2022/core/lib/core/utils/index.mjs +102 -0
- package/esm2022/crud-table/entry-crud-table.mjs +5 -0
- package/esm2022/crud-table/gnggln-ng-ui-system-crud-table.mjs +5 -0
- package/esm2022/crud-table/lib/components/accordion/accordion.component.mjs +398 -0
- package/esm2022/crud-table/lib/components/accordion/accordion.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/accordion/index.mjs +2 -0
- package/esm2022/crud-table/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/crud-table/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/crud-table/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/crud-table/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/crud-table/lib/components/button/button-area.component.mjs +210 -0
- package/esm2022/crud-table/lib/components/button/button.component.mjs +180 -0
- package/esm2022/crud-table/lib/components/button/button.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/button/index.mjs +16 -0
- package/esm2022/crud-table/lib/components/crud-table/crud-table.component.mjs +789 -0
- package/esm2022/crud-table/lib/components/crud-table/crud-table.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/crud-table/index.mjs +16 -0
- package/esm2022/crud-table/lib/components/form-builder/adapters/it-date-adapter.mjs +82 -0
- package/esm2022/crud-table/lib/components/form-builder/directives/currency-input.directive.mjs +184 -0
- package/esm2022/crud-table/lib/components/form-builder/form-builder.component.mjs +1351 -0
- package/esm2022/crud-table/lib/components/form-builder/services/form-condition.service.mjs +132 -0
- package/esm2022/crud-table/lib/components/form-builder/services/form-error-state.matcher.mjs +10 -0
- package/esm2022/crud-table/lib/components/form-builder/services/form-field-error.service.mjs +103 -0
- package/esm2022/crud-table/lib/components/form-builder/services/form-validation.service.mjs +381 -0
- package/esm2022/crud-table/lib/components/form-builder/services/location.service.mjs +141 -0
- package/esm2022/crud-table/lib/components/form-builder/services/nominatim-geocoding.service.mjs +120 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.mjs +190 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/file-input/file-input.component.mjs +310 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +113 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +105 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +126 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-text-field.component.mjs +147 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.mjs +99 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/form-fields/index.mjs +6 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.mjs +322 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.mjs +648 -0
- package/esm2022/crud-table/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.mjs +432 -0
- package/esm2022/crud-table/lib/components/form-builder/types/condition.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/form-builder/types/field.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/form-builder/types/geocoded-location.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/form-builder/types/schema.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/form-builder/types/territoriale.types.mjs +6 -0
- package/esm2022/crud-table/lib/components/form-builder/types/validation.types.mjs +10 -0
- package/esm2022/crud-table/lib/components/modal/confirm-dialog.component.mjs +151 -0
- package/esm2022/crud-table/lib/components/modal/modal.service.mjs +197 -0
- package/esm2022/crud-table/lib/components/modal/modal.types.mjs +6 -0
- package/esm2022/crud-table/lib/core/logging/logger.config.mjs +18 -0
- package/esm2022/crud-table/lib/core/logging/logger.service.mjs +295 -0
- package/esm2022/crud-table/lib/core/logging/logger.types.mjs +7 -0
- package/esm2022/crud-table/lib/core/types/index.mjs +6 -0
- package/esm2022/crud-table/lib/sources/location-data.opt.json +8942 -0
- package/esm2022/crud-table/lib/sources/nazioni.opt.json +215 -0
- package/esm2022/form-builder/entry-form-builder.mjs +5 -0
- package/esm2022/form-builder/gnggln-ng-ui-system-form-builder.mjs +5 -0
- package/esm2022/form-builder/lib/components/accordion/accordion.component.mjs +398 -0
- package/esm2022/form-builder/lib/components/accordion/accordion.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/accordion/index.mjs +2 -0
- package/esm2022/form-builder/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/form-builder/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/form-builder/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/form-builder/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/form-builder/lib/components/button/button-area.component.mjs +210 -0
- package/esm2022/form-builder/lib/components/button/button.component.mjs +180 -0
- package/esm2022/form-builder/lib/components/button/button.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/button/index.mjs +16 -0
- package/esm2022/form-builder/lib/components/form-builder/adapters/it-date-adapter.mjs +82 -0
- package/esm2022/form-builder/lib/components/form-builder/directives/currency-input.directive.mjs +184 -0
- package/esm2022/form-builder/lib/components/form-builder/form-builder.component.mjs +1351 -0
- package/esm2022/form-builder/lib/components/form-builder/form-wizard.component.mjs +1064 -0
- package/esm2022/form-builder/lib/components/form-builder/index.mjs +24 -0
- package/esm2022/form-builder/lib/components/form-builder/services/form-condition.service.mjs +132 -0
- package/esm2022/form-builder/lib/components/form-builder/services/form-error-state.matcher.mjs +10 -0
- package/esm2022/form-builder/lib/components/form-builder/services/form-field-error.service.mjs +103 -0
- package/esm2022/form-builder/lib/components/form-builder/services/form-validation.service.mjs +381 -0
- package/esm2022/form-builder/lib/components/form-builder/services/location.service.mjs +141 -0
- package/esm2022/form-builder/lib/components/form-builder/services/nominatim-geocoding.service.mjs +120 -0
- package/esm2022/form-builder/lib/components/form-builder/services/wizard-sync.service.mjs +84 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.mjs +190 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/file-input/file-input.component.mjs +310 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +113 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +105 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +126 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-text-field.component.mjs +147 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.mjs +99 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/form-fields/index.mjs +6 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.mjs +322 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.mjs +648 -0
- package/esm2022/form-builder/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.mjs +432 -0
- package/esm2022/form-builder/lib/components/form-builder/types/condition.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/form-builder/types/field.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/form-builder/types/geocoded-location.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/form-builder/types/index.mjs +3 -0
- package/esm2022/form-builder/lib/components/form-builder/types/schema.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/form-builder/types/territoriale.types.mjs +6 -0
- package/esm2022/form-builder/lib/components/form-builder/types/validation.types.mjs +10 -0
- package/esm2022/form-builder/lib/core/logging/logger.config.mjs +18 -0
- package/esm2022/form-builder/lib/core/logging/logger.service.mjs +295 -0
- package/esm2022/form-builder/lib/core/logging/logger.types.mjs +7 -0
- package/esm2022/form-builder/lib/core/types/index.mjs +6 -0
- package/esm2022/form-builder/lib/sources/location-data.opt.json +8942 -0
- package/esm2022/form-builder/lib/sources/nazioni.opt.json +215 -0
- package/esm2022/form-builder-editor/entry-form-builder-editor.mjs +5 -0
- package/esm2022/form-builder-editor/gnggln-ng-ui-system-form-builder-editor.mjs +5 -0
- package/esm2022/form-builder-editor/lib/components/accordion/accordion.component.mjs +398 -0
- package/esm2022/form-builder-editor/lib/components/accordion/accordion.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/accordion/index.mjs +2 -0
- package/esm2022/form-builder-editor/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/form-builder-editor/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/form-builder-editor/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/form-builder-editor/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/form-builder-editor/lib/components/button/button-area.component.mjs +210 -0
- package/esm2022/form-builder-editor/lib/components/button/button.component.mjs +180 -0
- package/esm2022/form-builder-editor/lib/components/button/button.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/button/index.mjs +16 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/adapters/it-date-adapter.mjs +82 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/directives/currency-input.directive.mjs +184 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/form-builder.component.mjs +1351 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/services/form-condition.service.mjs +132 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/services/form-error-state.matcher.mjs +10 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/services/form-field-error.service.mjs +103 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/services/form-validation.service.mjs +381 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/services/location.service.mjs +141 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/services/nominatim-geocoding.service.mjs +120 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.mjs +190 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/file-input/file-input.component.mjs +310 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +113 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +105 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +126 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-text-field.component.mjs +147 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.mjs +99 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/form-fields/index.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.mjs +322 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.mjs +648 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.mjs +432 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/condition.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/field.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/geocoded-location.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/index.mjs +3 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/schema.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/territoriale.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/form-builder/types/validation.types.mjs +10 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/form-builder-editor.component.mjs +730 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/form-builder-editor.service.mjs +56 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/index.mjs +23 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/presets/editor-presets.mjs +395 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/services/editor-persistence.service.mjs +190 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/services/editor-state.service.mjs +324 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/services/field-factory.service.mjs +188 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/condition-editor/condition-editor.component.mjs +667 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/editor-toolbar/editor-toolbar.component.mjs +317 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/field-config-panel/field-config-panel.component.mjs +611 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/field-palette/field-palette.component.mjs +267 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/form-values-panel/form-values-panel.component.mjs +276 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/options-editor/options-editor.component.mjs +323 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/preview-container/preview-container.component.mjs +238 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/section-editor/section-editor.component.mjs +473 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/sub-components/validation-editor/validation-editor.component.mjs +473 -0
- package/esm2022/form-builder-editor/lib/components/form-builder-editor/types/editor.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/components/modal/confirm-dialog.component.mjs +151 -0
- package/esm2022/form-builder-editor/lib/components/modal/index.mjs +4 -0
- package/esm2022/form-builder-editor/lib/components/modal/modal.component.mjs +139 -0
- package/esm2022/form-builder-editor/lib/components/modal/modal.service.mjs +197 -0
- package/esm2022/form-builder-editor/lib/components/modal/modal.types.mjs +6 -0
- package/esm2022/form-builder-editor/lib/core/logging/logger.config.mjs +18 -0
- package/esm2022/form-builder-editor/lib/core/logging/logger.service.mjs +295 -0
- package/esm2022/form-builder-editor/lib/core/logging/logger.types.mjs +7 -0
- package/esm2022/form-builder-editor/lib/core/types/index.mjs +6 -0
- package/esm2022/form-builder-editor/lib/sources/location-data.opt.json +8942 -0
- package/esm2022/form-builder-editor/lib/sources/nazioni.opt.json +215 -0
- package/esm2022/http/entry-http.mjs +5 -0
- package/esm2022/http/gnggln-ng-ui-system-http.mjs +5 -0
- package/esm2022/http/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/http/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/http/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/http/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/http/lib/components/http/http-message.handler.mjs +143 -0
- package/esm2022/http/lib/components/http/http.service.mjs +228 -0
- package/esm2022/http/lib/components/http/http.tokens.mjs +29 -0
- package/esm2022/http/lib/components/http/http.types.mjs +6 -0
- package/esm2022/http/lib/components/http/index.mjs +19 -0
- package/esm2022/http/lib/components/layout-builder/layout-builder.types.mjs +9 -0
- package/esm2022/http/lib/components/layout-builder/layout.service.mjs +239 -0
- package/esm2022/http/lib/components/toast/toast-container.component.mjs +80 -0
- package/esm2022/http/lib/components/toast/toast.component.mjs +151 -0
- package/esm2022/http/lib/components/toast/toast.service.mjs +156 -0
- package/esm2022/http/lib/components/toast/toast.types.mjs +12 -0
- package/esm2022/http/lib/core/types/index.mjs +6 -0
- package/esm2022/http/lib/core/utils/index.mjs +102 -0
- package/esm2022/layout-builder/entry-layout-builder.mjs +5 -0
- package/esm2022/layout-builder/gnggln-ng-ui-system-layout-builder.mjs +5 -0
- package/esm2022/layout-builder/lib/components/layout-builder/index.mjs +18 -0
- package/esm2022/layout-builder/lib/components/layout-builder/layout-builder.component.mjs +1804 -0
- package/esm2022/layout-builder/lib/components/layout-builder/layout-builder.types.mjs +9 -0
- package/esm2022/layout-builder/lib/components/layout-builder/layout.service.mjs +239 -0
- package/esm2022/layout-builder/lib/core/types/index.mjs +6 -0
- package/esm2022/lib/components/accordion/accordion.component.mjs +106 -61
- package/esm2022/lib/components/accordion/accordion.types.mjs +1 -1
- package/esm2022/lib/components/base-layout/base-layout.component.mjs +88 -34
- package/esm2022/lib/components/base-layout/base-layout.types.mjs +1 -1
- package/esm2022/lib/components/base-layout/index.mjs +1 -1
- package/esm2022/lib/components/blackbox/blackbox-debugger.component.mjs +904 -0
- package/esm2022/lib/components/blackbox/blackbox-debugger.service.mjs +51 -0
- package/esm2022/lib/components/blackbox/blackbox-fingerprint.service.mjs +116 -0
- package/esm2022/lib/components/blackbox/blackbox-json-viewer.component.mjs +66 -0
- package/esm2022/lib/components/blackbox/blackbox-storage.service.mjs +286 -0
- package/esm2022/lib/components/blackbox/blackbox.interceptor.mjs +135 -0
- package/esm2022/lib/components/blackbox/blackbox.service.mjs +323 -0
- package/esm2022/lib/components/blackbox/blackbox.types.mjs +25 -0
- package/esm2022/lib/components/blackbox/index.mjs +27 -0
- package/esm2022/lib/components/blackbox/ui-track.directive.mjs +69 -0
- package/esm2022/lib/components/button/button-area.component.mjs +16 -2
- package/esm2022/lib/components/button/button.component.mjs +23 -7
- package/esm2022/lib/components/button/button.types.mjs +1 -1
- package/esm2022/lib/components/crud-table/crud-table.component.mjs +14 -14
- package/esm2022/lib/components/form-builder/form-builder.component.mjs +710 -183
- package/esm2022/lib/components/form-builder/form-wizard.component.mjs +789 -235
- package/esm2022/lib/components/form-builder/index.mjs +7 -2
- package/esm2022/lib/components/form-builder/services/form-error-state.matcher.mjs +10 -0
- package/esm2022/lib/components/form-builder/services/form-field-error.service.mjs +103 -0
- package/esm2022/lib/components/form-builder/services/location.service.mjs +4 -3
- package/esm2022/lib/components/form-builder/services/nominatim-geocoding.service.mjs +120 -0
- package/esm2022/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.mjs +142 -113
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-number-field.component.mjs +113 -0
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.mjs +105 -0
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-select-field.component.mjs +126 -0
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-text-field.component.mjs +147 -0
- package/esm2022/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.mjs +99 -0
- package/esm2022/lib/components/form-builder/sub-components/form-fields/index.mjs +6 -0
- package/esm2022/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.mjs +322 -0
- package/esm2022/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.mjs +3 -3
- package/esm2022/lib/components/form-builder/types/field.types.mjs +1 -1
- package/esm2022/lib/components/form-builder/types/geocoded-location.types.mjs +6 -0
- package/esm2022/lib/components/form-builder/types/index.mjs +3 -2
- package/esm2022/lib/components/form-builder/types/schema.types.mjs +1 -1
- package/esm2022/lib/components/form-builder/types/validation.types.mjs +6 -2
- package/esm2022/lib/components/form-builder-editor/form-builder-editor.component.mjs +3 -3
- package/esm2022/lib/components/form-builder-editor/index.mjs +3 -1
- package/esm2022/lib/components/form-builder-editor/presets/editor-presets.mjs +395 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/preview-container/preview-container.component.mjs +2 -2
- package/esm2022/lib/components/form-builder-editor/sub-components/section-editor/section-editor.component.mjs +2 -1
- package/esm2022/lib/components/http/http-message.handler.mjs +143 -0
- package/esm2022/lib/components/http/http.service.mjs +228 -0
- package/esm2022/lib/components/http/http.tokens.mjs +29 -0
- package/esm2022/lib/components/http/http.types.mjs +6 -0
- package/esm2022/lib/components/http/index.mjs +19 -0
- package/esm2022/lib/components/layout-builder/layout-builder.component.mjs +27 -15
- package/esm2022/lib/components/modal/confirm-dialog.component.mjs +3 -3
- package/esm2022/lib/components/modal/modal.service.mjs +5 -2
- package/esm2022/lib/components/page-header/breadcrumb.service.mjs +5 -4
- package/esm2022/lib/components/table/paginated-table.component.mjs +17 -3
- package/esm2022/lib/components/table/table.types.mjs +1 -1
- package/esm2022/lib/components/toast/index.mjs +18 -0
- package/esm2022/lib/components/toast/toast-container.component.mjs +80 -0
- package/esm2022/lib/components/toast/toast.component.mjs +151 -0
- package/esm2022/lib/components/toast/toast.service.mjs +156 -0
- package/esm2022/lib/components/toast/toast.types.mjs +12 -0
- package/esm2022/lib/core/logging/index.mjs +10 -0
- package/esm2022/lib/core/logging/logger.config.mjs +18 -0
- package/esm2022/lib/core/logging/logger.service.mjs +295 -0
- package/esm2022/lib/core/logging/logger.types.mjs +7 -0
- package/esm2022/lib/core/types/index.mjs +1 -1
- package/esm2022/lib/core/utils/index.mjs +50 -1
- package/esm2022/lib/version/ng-ui-system-version.mjs +12 -0
- package/esm2022/modal/entry-modal.mjs +5 -0
- package/esm2022/modal/gnggln-ng-ui-system-modal.mjs +5 -0
- package/esm2022/modal/lib/components/button/button.component.mjs +180 -0
- package/esm2022/modal/lib/components/button/button.types.mjs +6 -0
- package/esm2022/modal/lib/components/modal/confirm-dialog.component.mjs +151 -0
- package/esm2022/modal/lib/components/modal/index.mjs +4 -0
- package/esm2022/modal/lib/components/modal/modal.component.mjs +139 -0
- package/esm2022/modal/lib/components/modal/modal.service.mjs +197 -0
- package/esm2022/modal/lib/components/modal/modal.types.mjs +6 -0
- package/esm2022/modal/lib/core/types/index.mjs +6 -0
- package/esm2022/page-header/entry-page-header.mjs +5 -0
- package/esm2022/page-header/gnggln-ng-ui-system-page-header.mjs +5 -0
- package/esm2022/page-header/lib/components/page-header/breadcrumb.service.mjs +243 -0
- package/esm2022/page-header/lib/components/page-header/index.mjs +20 -0
- package/esm2022/page-header/lib/components/page-header/page-header.component.mjs +243 -0
- package/esm2022/page-header/lib/components/page-header/page-header.types.mjs +21 -0
- package/esm2022/public-api.mjs +17 -8
- package/esm2022/table/entry-table.mjs +5 -0
- package/esm2022/table/gnggln-ng-ui-system-table.mjs +5 -0
- package/esm2022/table/lib/components/table/index.mjs +2 -0
- package/esm2022/table/lib/components/table/paginated-table.component.mjs +421 -0
- package/esm2022/table/lib/components/table/table.types.mjs +6 -0
- package/esm2022/table/lib/core/utils/index.mjs +102 -0
- package/esm2022/toast/entry-toast.mjs +5 -0
- package/esm2022/toast/gnggln-ng-ui-system-toast.mjs +5 -0
- package/esm2022/toast/lib/components/toast/index.mjs +18 -0
- package/esm2022/toast/lib/components/toast/toast-container.component.mjs +80 -0
- package/esm2022/toast/lib/components/toast/toast.component.mjs +151 -0
- package/esm2022/toast/lib/components/toast/toast.service.mjs +156 -0
- package/esm2022/toast/lib/components/toast/toast.types.mjs +12 -0
- package/esm2022/toast/lib/core/types/index.mjs +6 -0
- package/esm2022/toast/lib/core/utils/index.mjs +102 -0
- package/fesm2022/gnggln-ng-ui-system-accordion.mjs +409 -0
- package/fesm2022/gnggln-ng-ui-system-accordion.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-base-layout.mjs +1905 -0
- package/fesm2022/gnggln-ng-ui-system-base-layout.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-blackbox.mjs +2829 -0
- package/fesm2022/gnggln-ng-ui-system-blackbox.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-button.mjs +1148 -0
- package/fesm2022/gnggln-ng-ui-system-button.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-core.mjs +117 -0
- package/fesm2022/gnggln-ng-ui-system-core.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-crud-table.mjs +49600 -0
- package/fesm2022/gnggln-ng-ui-system-crud-table.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-form-builder-editor.mjs +54332 -0
- package/fesm2022/gnggln-ng-ui-system-form-builder-editor.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-form-builder.mjs +49609 -0
- package/fesm2022/gnggln-ng-ui-system-form-builder.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-http.mjs +1878 -0
- package/fesm2022/gnggln-ng-ui-system-http.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-layout-builder.mjs +2064 -0
- package/fesm2022/gnggln-ng-ui-system-layout-builder.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-modal.mjs +664 -0
- package/fesm2022/gnggln-ng-ui-system-modal.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-page-header.mjs +526 -0
- package/fesm2022/gnggln-ng-ui-system-page-header.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-table.mjs +533 -0
- package/fesm2022/gnggln-ng-ui-system-table.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system-toast.mjs +516 -0
- package/fesm2022/gnggln-ng-ui-system-toast.mjs.map +1 -0
- package/fesm2022/gnggln-ng-ui-system.mjs +10068 -4234
- package/fesm2022/gnggln-ng-ui-system.mjs.map +1 -1
- package/form-builder/entry-form-builder.d.ts +4 -0
- package/form-builder/index.d.ts +5 -0
- package/form-builder/lib/components/accordion/accordion.component.d.ts +125 -0
- package/form-builder/lib/components/accordion/accordion.types.d.ts +64 -0
- package/form-builder/lib/components/accordion/index.d.ts +2 -0
- package/form-builder/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/form-builder/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/form-builder/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/form-builder/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/form-builder/lib/components/button/button-area.component.d.ts +93 -0
- package/form-builder/lib/components/button/button.component.d.ts +61 -0
- package/form-builder/lib/components/button/button.types.d.ts +75 -0
- package/form-builder/lib/components/button/index.d.ts +15 -0
- package/form-builder/lib/components/form-builder/adapters/it-date-adapter.d.ts +32 -0
- package/form-builder/lib/components/form-builder/directives/currency-input.directive.d.ts +48 -0
- package/form-builder/lib/components/form-builder/form-builder.component.d.ts +279 -0
- package/form-builder/lib/components/form-builder/form-wizard.component.d.ts +172 -0
- package/form-builder/lib/components/form-builder/index.d.ts +19 -0
- package/form-builder/lib/components/form-builder/services/form-condition.service.d.ts +46 -0
- package/form-builder/lib/components/form-builder/services/form-error-state.matcher.d.ts +9 -0
- package/form-builder/lib/components/form-builder/services/form-field-error.service.d.ts +38 -0
- package/form-builder/lib/components/form-builder/services/form-validation.service.d.ts +63 -0
- package/form-builder/lib/components/form-builder/services/location.service.d.ts +83 -0
- package/form-builder/lib/components/form-builder/services/nominatim-geocoding.service.d.ts +37 -0
- package/form-builder/lib/components/form-builder/services/wizard-sync.service.d.ts +63 -0
- package/form-builder/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.d.ts +31 -0
- package/form-builder/lib/components/form-builder/sub-components/file-input/file-input.component.d.ts +41 -0
- package/form-builder/lib/components/form-builder/sub-components/form-fields/form-number-field.component.d.ts +42 -0
- package/form-builder/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.d.ts +45 -0
- package/form-builder/lib/components/form-builder/sub-components/form-fields/form-select-field.component.d.ts +44 -0
- package/form-builder/lib/components/form-builder/sub-components/form-fields/form-text-field.component.d.ts +62 -0
- package/form-builder/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.d.ts +39 -0
- package/form-builder/lib/components/form-builder/sub-components/form-fields/index.d.ts +5 -0
- package/form-builder/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.d.ts +84 -0
- package/form-builder/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.d.ts +145 -0
- package/form-builder/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.d.ts +108 -0
- package/form-builder/lib/components/form-builder/types/condition.types.d.ts +51 -0
- package/form-builder/lib/components/form-builder/types/field.types.d.ts +330 -0
- package/form-builder/lib/components/form-builder/types/geocoded-location.types.d.ts +116 -0
- package/form-builder/lib/components/form-builder/types/index.d.ts +6 -0
- package/form-builder/lib/components/form-builder/types/schema.types.d.ts +304 -0
- package/form-builder/lib/components/form-builder/types/territoriale.types.d.ts +170 -0
- package/form-builder/lib/components/form-builder/types/validation.types.d.ts +179 -0
- package/form-builder/lib/core/logging/logger.config.d.ts +18 -0
- package/form-builder/lib/core/logging/logger.service.d.ts +75 -0
- package/form-builder/lib/core/logging/logger.types.d.ts +70 -0
- package/form-builder/lib/core/types/index.d.ts +133 -0
- package/form-builder-editor/entry-form-builder-editor.d.ts +4 -0
- package/form-builder-editor/index.d.ts +5 -0
- package/form-builder-editor/lib/components/accordion/accordion.component.d.ts +125 -0
- package/form-builder-editor/lib/components/accordion/accordion.types.d.ts +64 -0
- package/form-builder-editor/lib/components/accordion/index.d.ts +2 -0
- package/form-builder-editor/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/form-builder-editor/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/form-builder-editor/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/form-builder-editor/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/form-builder-editor/lib/components/button/button-area.component.d.ts +93 -0
- package/form-builder-editor/lib/components/button/button.component.d.ts +61 -0
- package/form-builder-editor/lib/components/button/button.types.d.ts +75 -0
- package/form-builder-editor/lib/components/button/index.d.ts +15 -0
- package/form-builder-editor/lib/components/form-builder/adapters/it-date-adapter.d.ts +32 -0
- package/form-builder-editor/lib/components/form-builder/directives/currency-input.directive.d.ts +48 -0
- package/form-builder-editor/lib/components/form-builder/form-builder.component.d.ts +279 -0
- package/form-builder-editor/lib/components/form-builder/services/form-condition.service.d.ts +46 -0
- package/form-builder-editor/lib/components/form-builder/services/form-error-state.matcher.d.ts +9 -0
- package/form-builder-editor/lib/components/form-builder/services/form-field-error.service.d.ts +38 -0
- package/form-builder-editor/lib/components/form-builder/services/form-validation.service.d.ts +63 -0
- package/form-builder-editor/lib/components/form-builder/services/location.service.d.ts +83 -0
- package/form-builder-editor/lib/components/form-builder/services/nominatim-geocoding.service.d.ts +37 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.d.ts +31 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/file-input/file-input.component.d.ts +41 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-number-field.component.d.ts +42 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.d.ts +45 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-select-field.component.d.ts +44 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-text-field.component.d.ts +62 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.d.ts +39 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/form-fields/index.d.ts +5 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.d.ts +84 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.d.ts +145 -0
- package/form-builder-editor/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.d.ts +108 -0
- package/form-builder-editor/lib/components/form-builder/types/condition.types.d.ts +51 -0
- package/form-builder-editor/lib/components/form-builder/types/field.types.d.ts +330 -0
- package/form-builder-editor/lib/components/form-builder/types/geocoded-location.types.d.ts +116 -0
- package/form-builder-editor/lib/components/form-builder/types/index.d.ts +6 -0
- package/form-builder-editor/lib/components/form-builder/types/schema.types.d.ts +304 -0
- package/form-builder-editor/lib/components/form-builder/types/territoriale.types.d.ts +170 -0
- package/form-builder-editor/lib/components/form-builder/types/validation.types.d.ts +179 -0
- package/form-builder-editor/lib/components/form-builder-editor/form-builder-editor.component.d.ts +117 -0
- package/form-builder-editor/lib/components/form-builder-editor/form-builder-editor.service.d.ts +38 -0
- package/form-builder-editor/lib/components/form-builder-editor/index.d.ts +17 -0
- package/form-builder-editor/lib/components/form-builder-editor/presets/editor-presets.d.ts +25 -0
- package/form-builder-editor/lib/components/form-builder-editor/services/editor-persistence.service.d.ts +42 -0
- package/form-builder-editor/lib/components/form-builder-editor/services/editor-state.service.d.ts +66 -0
- package/form-builder-editor/lib/components/form-builder-editor/services/field-factory.service.d.ts +28 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/condition-editor/condition-editor.component.d.ts +139 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/editor-toolbar/editor-toolbar.component.d.ts +43 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/field-config-panel/field-config-panel.component.d.ts +83 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/field-palette/field-palette.component.d.ts +40 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/form-values-panel/form-values-panel.component.d.ts +51 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/options-editor/options-editor.component.d.ts +63 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/preview-container/preview-container.component.d.ts +68 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/section-editor/section-editor.component.d.ts +82 -0
- package/form-builder-editor/lib/components/form-builder-editor/sub-components/validation-editor/validation-editor.component.d.ts +112 -0
- package/form-builder-editor/lib/components/form-builder-editor/types/editor.types.d.ts +124 -0
- package/form-builder-editor/lib/components/modal/confirm-dialog.component.d.ts +46 -0
- package/form-builder-editor/lib/components/modal/index.d.ts +4 -0
- package/form-builder-editor/lib/components/modal/modal.component.d.ts +44 -0
- package/form-builder-editor/lib/components/modal/modal.service.d.ts +93 -0
- package/form-builder-editor/lib/components/modal/modal.types.d.ts +110 -0
- package/form-builder-editor/lib/core/logging/logger.config.d.ts +18 -0
- package/form-builder-editor/lib/core/logging/logger.service.d.ts +75 -0
- package/form-builder-editor/lib/core/logging/logger.types.d.ts +70 -0
- package/form-builder-editor/lib/core/types/index.d.ts +133 -0
- package/http/entry-http.d.ts +4 -0
- package/http/index.d.ts +5 -0
- package/http/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/http/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/http/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/http/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/http/lib/components/http/http-message.handler.d.ts +59 -0
- package/http/lib/components/http/http.service.d.ts +98 -0
- package/http/lib/components/http/http.tokens.d.ts +29 -0
- package/http/lib/components/http/http.types.d.ts +50 -0
- package/http/lib/components/http/index.d.ts +17 -0
- package/http/lib/components/layout-builder/layout-builder.types.d.ts +436 -0
- package/http/lib/components/layout-builder/layout.service.d.ts +100 -0
- package/http/lib/components/toast/toast-container.component.d.ts +27 -0
- package/http/lib/components/toast/toast.component.d.ts +37 -0
- package/http/lib/components/toast/toast.service.d.ts +39 -0
- package/http/lib/components/toast/toast.types.d.ts +52 -0
- package/http/lib/core/types/index.d.ts +133 -0
- package/http/lib/core/utils/index.d.ts +60 -0
- package/layout-builder/entry-layout-builder.d.ts +4 -0
- package/layout-builder/index.d.ts +5 -0
- package/layout-builder/lib/components/layout-builder/index.d.ts +16 -0
- package/layout-builder/lib/components/layout-builder/layout-builder.component.d.ts +85 -0
- package/layout-builder/lib/components/layout-builder/layout-builder.types.d.ts +436 -0
- package/layout-builder/lib/components/layout-builder/layout.service.d.ts +100 -0
- package/layout-builder/lib/core/types/index.d.ts +133 -0
- package/lib/components/accordion/accordion.component.d.ts +10 -3
- package/lib/components/accordion/accordion.types.d.ts +2 -0
- package/lib/components/base-layout/base-layout.component.d.ts +36 -11
- package/lib/components/base-layout/base-layout.types.d.ts +14 -0
- package/lib/components/base-layout/index.d.ts +1 -1
- package/lib/components/blackbox/blackbox-debugger.component.d.ts +80 -0
- package/lib/components/blackbox/blackbox-debugger.service.d.ts +34 -0
- package/lib/components/blackbox/blackbox-fingerprint.service.d.ts +36 -0
- package/lib/components/blackbox/blackbox-json-viewer.component.d.ts +18 -0
- package/lib/components/blackbox/blackbox-storage.service.d.ts +55 -0
- package/lib/components/blackbox/blackbox.interceptor.d.ts +38 -0
- package/lib/components/blackbox/blackbox.service.d.ts +144 -0
- package/lib/components/blackbox/blackbox.types.d.ts +238 -0
- package/lib/components/blackbox/index.d.ts +23 -0
- package/lib/components/blackbox/ui-track.directive.d.ts +20 -0
- package/lib/components/button/button-area.component.d.ts +6 -1
- package/lib/components/button/button.component.d.ts +8 -2
- package/lib/components/button/button.types.d.ts +5 -0
- package/lib/components/form-builder/form-builder.component.d.ts +125 -29
- package/lib/components/form-builder/form-wizard.component.d.ts +89 -4
- package/lib/components/form-builder/index.d.ts +7 -1
- package/lib/components/form-builder/services/form-error-state.matcher.d.ts +9 -0
- package/lib/components/form-builder/services/form-field-error.service.d.ts +38 -0
- package/lib/components/form-builder/services/nominatim-geocoding.service.d.ts +37 -0
- package/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.d.ts +9 -6
- package/lib/components/form-builder/sub-components/form-fields/form-number-field.component.d.ts +42 -0
- package/lib/components/form-builder/sub-components/form-fields/form-radio-field.component.d.ts +45 -0
- package/lib/components/form-builder/sub-components/form-fields/form-select-field.component.d.ts +44 -0
- package/lib/components/form-builder/sub-components/form-fields/form-text-field.component.d.ts +62 -0
- package/lib/components/form-builder/sub-components/form-fields/form-textarea-field.component.d.ts +39 -0
- package/lib/components/form-builder/sub-components/form-fields/index.d.ts +5 -0
- package/lib/components/form-builder/sub-components/location-geocoded/location-geocoded.component.d.ts +84 -0
- package/lib/components/form-builder/types/field.types.d.ts +48 -6
- package/lib/components/form-builder/types/geocoded-location.types.d.ts +116 -0
- package/lib/components/form-builder/types/index.d.ts +4 -3
- package/lib/components/form-builder/types/schema.types.d.ts +83 -6
- package/lib/components/form-builder/types/validation.types.d.ts +5 -0
- package/lib/components/form-builder-editor/index.d.ts +2 -0
- package/lib/components/form-builder-editor/presets/editor-presets.d.ts +25 -0
- package/lib/components/http/http-message.handler.d.ts +59 -0
- package/lib/components/http/http.service.d.ts +98 -0
- package/lib/components/http/http.tokens.d.ts +29 -0
- package/lib/components/http/http.types.d.ts +50 -0
- package/lib/components/http/index.d.ts +17 -0
- package/lib/components/page-header/breadcrumb.service.d.ts +2 -2
- package/lib/components/table/table.types.d.ts +5 -0
- package/lib/components/toast/index.d.ts +17 -0
- package/lib/components/toast/toast-container.component.d.ts +27 -0
- package/lib/components/toast/toast.component.d.ts +37 -0
- package/lib/components/toast/toast.service.d.ts +39 -0
- package/lib/components/toast/toast.types.d.ts +52 -0
- package/lib/core/logging/index.d.ts +8 -0
- package/lib/core/logging/logger.config.d.ts +18 -0
- package/lib/core/logging/logger.service.d.ts +75 -0
- package/lib/core/logging/logger.types.d.ts +70 -0
- package/lib/core/types/index.d.ts +76 -0
- package/lib/core/utils/index.d.ts +31 -0
- package/lib/version/ng-ui-system-version.d.ts +9 -0
- package/modal/entry-modal.d.ts +4 -0
- package/modal/index.d.ts +5 -0
- package/modal/lib/components/button/button.component.d.ts +61 -0
- package/modal/lib/components/button/button.types.d.ts +75 -0
- package/modal/lib/components/modal/confirm-dialog.component.d.ts +46 -0
- package/modal/lib/components/modal/index.d.ts +4 -0
- package/modal/lib/components/modal/modal.component.d.ts +44 -0
- package/modal/lib/components/modal/modal.service.d.ts +93 -0
- package/modal/lib/components/modal/modal.types.d.ts +110 -0
- package/modal/lib/core/types/index.d.ts +133 -0
- package/package.json +93 -8
- package/page-header/entry-page-header.d.ts +4 -0
- package/page-header/index.d.ts +5 -0
- package/page-header/lib/components/page-header/breadcrumb.service.d.ts +96 -0
- package/page-header/lib/components/page-header/index.d.ts +16 -0
- package/page-header/lib/components/page-header/page-header.component.d.ts +59 -0
- package/page-header/lib/components/page-header/page-header.types.d.ts +96 -0
- package/public-api.d.ts +11 -6
- package/table/entry-table.d.ts +4 -0
- package/table/index.d.ts +5 -0
- package/table/lib/components/table/index.d.ts +2 -0
- package/table/lib/components/table/paginated-table.component.d.ts +85 -0
- package/table/lib/components/table/table.types.d.ts +86 -0
- package/table/lib/core/utils/index.d.ts +60 -0
- package/toast/entry-toast.d.ts +4 -0
- package/toast/index.d.ts +5 -0
- package/toast/lib/components/toast/index.d.ts +17 -0
- package/toast/lib/components/toast/toast-container.component.d.ts +27 -0
- package/toast/lib/components/toast/toast.component.d.ts +37 -0
- package/toast/lib/components/toast/toast.service.d.ts +39 -0
- package/toast/lib/components/toast/toast.types.d.ts +52 -0
- package/toast/lib/core/types/index.d.ts +133 -0
- package/toast/lib/core/utils/index.d.ts +60 -0
|
@@ -0,0 +1,1878 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, inject, ChangeDetectorRef, ApplicationRef, EnvironmentInjector, createComponent, Injectable, PLATFORM_ID, InjectionToken, NgZone } from '@angular/core';
|
|
3
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
4
|
+
import { BehaviorSubject, Subject, throwError } from 'rxjs';
|
|
5
|
+
import { filter, takeUntil, map, catchError, finalize } from 'rxjs/operators';
|
|
6
|
+
import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
7
|
+
import * as i1 from 'lucide-angular';
|
|
8
|
+
import { LucideAngularModule } from 'lucide-angular';
|
|
9
|
+
import { Router, NavigationEnd } from '@angular/router';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Shared utility functions for ng-ui-system components.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Generates a unique ID with an optional prefix.
|
|
16
|
+
* Uses crypto.randomUUID() when available for better randomness, falls back to crypto.getRandomValues().
|
|
17
|
+
* Useful for linking labels to form controls, ARIA attributes, etc.
|
|
18
|
+
*
|
|
19
|
+
* @param prefix - Optional prefix for the generated ID.
|
|
20
|
+
* @returns A unique string ID.
|
|
21
|
+
*/
|
|
22
|
+
function uiUniqueId(prefix = 'ui') {
|
|
23
|
+
let randomPart;
|
|
24
|
+
// Try crypto.randomUUID() first (modern browsers/Node 19+)
|
|
25
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
26
|
+
randomPart = crypto.randomUUID().substring(0, 8);
|
|
27
|
+
}
|
|
28
|
+
// Fallback to crypto.getRandomValues()
|
|
29
|
+
else if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
|
|
30
|
+
const array = new Uint8Array(4);
|
|
31
|
+
crypto.getRandomValues(array);
|
|
32
|
+
randomPart = Array.from(array, (byte) => byte.toString(36))
|
|
33
|
+
.join('')
|
|
34
|
+
.substring(0, 8);
|
|
35
|
+
}
|
|
36
|
+
// Final fallback to Math.random() for older environments
|
|
37
|
+
else {
|
|
38
|
+
randomPart = Math.random().toString(36).substring(2, 9); // NOSONAR - Fallback for environments without crypto API
|
|
39
|
+
}
|
|
40
|
+
return `${prefix}-${randomPart}`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Coerces a value to a boolean.
|
|
44
|
+
* Useful for handling string boolean attributes in templates.
|
|
45
|
+
*
|
|
46
|
+
* @param value - The value to coerce.
|
|
47
|
+
* @returns The boolean representation.
|
|
48
|
+
*/
|
|
49
|
+
function uiCoerceBoolean(value) {
|
|
50
|
+
return value != null && `${value}` !== 'false';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Clamps a number between a minimum and maximum value.
|
|
54
|
+
*
|
|
55
|
+
* @param value - The value to clamp.
|
|
56
|
+
* @param min - The minimum allowed value.
|
|
57
|
+
* @param max - The maximum allowed value.
|
|
58
|
+
* @returns The clamped value.
|
|
59
|
+
*/
|
|
60
|
+
function uiClamp(value, min, max) {
|
|
61
|
+
return Math.max(min, Math.min(max, value));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Removes all `null` and `undefined` values from an object.
|
|
65
|
+
* Returns a new object — the original is not mutated.
|
|
66
|
+
*
|
|
67
|
+
* @param obj - The source object.
|
|
68
|
+
* @returns A shallow copy with nullish entries removed.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* uiFilterNullish({ a: 1, b: null, c: 'x', d: undefined });
|
|
73
|
+
* // → { a: 1, c: 'x' }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function uiFilterNullish(obj) {
|
|
77
|
+
return Object.entries(obj)
|
|
78
|
+
.filter(([, value]) => value !== null && value !== undefined)
|
|
79
|
+
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Converts a key-value object into a URL query string.
|
|
83
|
+
* Nullish values are filtered out automatically.
|
|
84
|
+
*
|
|
85
|
+
* @param params - Query parameter object.
|
|
86
|
+
* @returns A query string like `?key=value&key2=value2`, or an empty string if no params.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* uiQueryParamsToPath({ search: 'test', page: 1, active: true });
|
|
91
|
+
* // → '?search=test&page=1&active=true'
|
|
92
|
+
*
|
|
93
|
+
* uiQueryParamsToPath(undefined);
|
|
94
|
+
* // → ''
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
function uiQueryParamsToPath(params) {
|
|
98
|
+
if (!params)
|
|
99
|
+
return '';
|
|
100
|
+
const searchParams = new URLSearchParams();
|
|
101
|
+
Object.entries(uiFilterNullish(params)).forEach(([key, value]) => {
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
value.forEach((v) => searchParams.append(key, String(v ?? '')));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
searchParams.append(key, String(value ?? ''));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const str = searchParams.toString();
|
|
110
|
+
return str ? `?${str}` : '';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @module ng-ui-system/toast
|
|
115
|
+
* Types and interfaces for the proprietary toast notification system.
|
|
116
|
+
*/
|
|
117
|
+
/** Defaults applied to every toast unless overridden. */
|
|
118
|
+
const UI_TOAST_DEFAULTS = {
|
|
119
|
+
duration: 5000,
|
|
120
|
+
position: 'top-right',
|
|
121
|
+
dismissible: true,
|
|
122
|
+
enableHtml: false,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Individual toast notification element.
|
|
127
|
+
*
|
|
128
|
+
* Rendered dynamically by `UiToastContainerComponent`.
|
|
129
|
+
* Handles its own enter/exit CSS animations and auto-dismiss countdown.
|
|
130
|
+
*
|
|
131
|
+
* @selector ui-toast
|
|
132
|
+
* @internal Not intended for direct use — managed by `UiToastService`.
|
|
133
|
+
*/
|
|
134
|
+
class UiToastComponent {
|
|
135
|
+
constructor() {
|
|
136
|
+
/** Toast message text. */
|
|
137
|
+
this.message = '';
|
|
138
|
+
/** Toast type for styling. */
|
|
139
|
+
this.type = 'info';
|
|
140
|
+
/** Animation state. */
|
|
141
|
+
this.state = 'entering';
|
|
142
|
+
/** Whether the close button is shown. */
|
|
143
|
+
this.dismissible = true;
|
|
144
|
+
/** Whether HTML rendering is enabled. */
|
|
145
|
+
this.enableHtml = false;
|
|
146
|
+
/** Emitted when the user clicks the dismiss button. */
|
|
147
|
+
this.dismissed = new EventEmitter();
|
|
148
|
+
}
|
|
149
|
+
/** Resolved icon name based on type. */
|
|
150
|
+
get resolvedIcon() {
|
|
151
|
+
if (this.icon)
|
|
152
|
+
return this.icon;
|
|
153
|
+
switch (this.type) {
|
|
154
|
+
case 'success': return 'check-circle';
|
|
155
|
+
case 'error': return 'x-circle';
|
|
156
|
+
case 'warning': return 'alert-triangle';
|
|
157
|
+
case 'info':
|
|
158
|
+
default: return 'info';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
ngOnInit() {
|
|
162
|
+
// Transition from entering → visible after the CSS animation completes
|
|
163
|
+
this.enterTimeout = setTimeout(() => {
|
|
164
|
+
this.state = 'visible';
|
|
165
|
+
}, 320);
|
|
166
|
+
}
|
|
167
|
+
ngOnDestroy() {
|
|
168
|
+
if (this.enterTimeout)
|
|
169
|
+
clearTimeout(this.enterTimeout);
|
|
170
|
+
}
|
|
171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
172
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: UiToastComponent, isStandalone: true, selector: "ui-toast", inputs: { message: "message", type: "type", state: "state", dismissible: "dismissible", enableHtml: "enableHtml", icon: "icon", customClass: "customClass" }, outputs: { dismissed: "dismissed" }, host: { classAttribute: "ui-toast-host" }, ngImport: i0, template: `
|
|
173
|
+
<div
|
|
174
|
+
class="ui-toast {{ customClass || '' }}"
|
|
175
|
+
[class.ui-toast--success]="type === 'success'"
|
|
176
|
+
[class.ui-toast--error]="type === 'error'"
|
|
177
|
+
[class.ui-toast--warning]="type === 'warning'"
|
|
178
|
+
[class.ui-toast--info]="type === 'info'"
|
|
179
|
+
[class.ui-toast--entering]="state === 'entering'"
|
|
180
|
+
[class.ui-toast--visible]="state === 'visible'"
|
|
181
|
+
[class.ui-toast--exiting]="state === 'exiting'"
|
|
182
|
+
role="alert"
|
|
183
|
+
aria-live="assertive"
|
|
184
|
+
aria-atomic="true"
|
|
185
|
+
>
|
|
186
|
+
<div class="ui-toast__icon">
|
|
187
|
+
<lucide-icon [name]="resolvedIcon" [size]="20"></lucide-icon>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div class="ui-toast__content">
|
|
191
|
+
@if (enableHtml) {
|
|
192
|
+
<span class="ui-toast__message" [innerHTML]="message"></span>
|
|
193
|
+
} @else {
|
|
194
|
+
<span class="ui-toast__message">{{ message }}</span>
|
|
195
|
+
}
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
@if (dismissible) {
|
|
199
|
+
<button
|
|
200
|
+
class="ui-toast__close"
|
|
201
|
+
type="button"
|
|
202
|
+
(click)="dismissed.emit()"
|
|
203
|
+
aria-label="Chiudi notifica"
|
|
204
|
+
>
|
|
205
|
+
<lucide-icon name="x" [size]="16"></lucide-icon>
|
|
206
|
+
</button>
|
|
207
|
+
}
|
|
208
|
+
</div>
|
|
209
|
+
`, isInline: true, styles: [".ui-toast-host{display:contents}.ui-toast{display:flex;align-items:flex-start;gap:var(--ui-spacing-3, 12px);padding:var(--ui-spacing-3, 12px) var(--ui-spacing-4, 16px);border-radius:var(--ui-radius-md, 8px);min-width:320px;max-width:440px;font-family:var(--ui-font-family, \"Inter\", sans-serif);font-size:var(--ui-font-size-sm, .875rem);font-weight:400;line-height:1.5;color:var(--ui-color-neutral-900, #111827);background:var(--ui-color-surface, #ffffff);border:1px solid var(--ui-color-neutral-200, #e5e7eb);box-shadow:var(--ui-shadow-md);pointer-events:auto;position:relative;overflow:hidden}.ui-toast:before{content:\"\";position:absolute;top:0;bottom:0;left:0;width:4px;background:transparent}.ui-toast--entering{animation:ui-toast-slide-in .25s cubic-bezier(.2,0,0,1) forwards}.ui-toast--visible{opacity:1;transform:translate(0)}.ui-toast--exiting{animation:ui-toast-slide-out .2s cubic-bezier(.4,0,1,1) forwards}.ui-toast--success:before{background:var(--ui-color-success, #10b981)}.ui-toast--success .ui-toast__icon{color:var(--ui-color-success, #10b981)}.ui-toast--error:before{background:var(--ui-color-warn, #ef4444)}.ui-toast--error .ui-toast__icon{color:var(--ui-color-warn, #ef4444)}.ui-toast--warning:before{background:var(--ui-color-warning, #f59e0b)}.ui-toast--warning .ui-toast__icon{color:var(--ui-color-warning, #f59e0b)}.ui-toast--info:before{background:var(--ui-color-info, #3b82f6)}.ui-toast--info .ui-toast__icon{color:var(--ui-color-info, #3b82f6)}.ui-toast__icon{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin-top:2px}.ui-toast__content{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;min-height:20px}.ui-toast__message{word-break:break-word;margin:0}.ui-toast__close{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin:0 -4px 0 0;border:none;border-radius:var(--ui-radius-sm, 4px);background:transparent;color:var(--ui-color-neutral-400, #9ca3af);cursor:pointer;transition-property:background,color;transition-duration:var(--ui-transition-fast);transition-timing-function:ease}.ui-toast__close:hover{background:var(--ui-color-neutral-100, #f3f4f6);color:var(--ui-color-neutral-700, #374151)}.ui-toast__close:focus{outline:none}.ui-toast__close:focus-visible{outline:var(--ui-focus-ring-width) solid var(--ui-focus-ring-color);outline-offset:var(--ui-focus-ring-offset)}@keyframes ui-toast-slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes ui-toast-slide-out{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(100%)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: LucideAngularModule }, { kind: "component", type: i1.LucideAngularComponent, selector: "lucide-angular, lucide-icon, i-lucide, span-lucide", inputs: ["class", "name", "img", "color", "absoluteStrokeWidth", "size", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
210
|
+
}
|
|
211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastComponent, decorators: [{
|
|
212
|
+
type: Component,
|
|
213
|
+
args: [{ selector: 'ui-toast', standalone: true, imports: [CommonModule, LucideAngularModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
214
|
+
'class': 'ui-toast-host',
|
|
215
|
+
}, template: `
|
|
216
|
+
<div
|
|
217
|
+
class="ui-toast {{ customClass || '' }}"
|
|
218
|
+
[class.ui-toast--success]="type === 'success'"
|
|
219
|
+
[class.ui-toast--error]="type === 'error'"
|
|
220
|
+
[class.ui-toast--warning]="type === 'warning'"
|
|
221
|
+
[class.ui-toast--info]="type === 'info'"
|
|
222
|
+
[class.ui-toast--entering]="state === 'entering'"
|
|
223
|
+
[class.ui-toast--visible]="state === 'visible'"
|
|
224
|
+
[class.ui-toast--exiting]="state === 'exiting'"
|
|
225
|
+
role="alert"
|
|
226
|
+
aria-live="assertive"
|
|
227
|
+
aria-atomic="true"
|
|
228
|
+
>
|
|
229
|
+
<div class="ui-toast__icon">
|
|
230
|
+
<lucide-icon [name]="resolvedIcon" [size]="20"></lucide-icon>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<div class="ui-toast__content">
|
|
234
|
+
@if (enableHtml) {
|
|
235
|
+
<span class="ui-toast__message" [innerHTML]="message"></span>
|
|
236
|
+
} @else {
|
|
237
|
+
<span class="ui-toast__message">{{ message }}</span>
|
|
238
|
+
}
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
@if (dismissible) {
|
|
242
|
+
<button
|
|
243
|
+
class="ui-toast__close"
|
|
244
|
+
type="button"
|
|
245
|
+
(click)="dismissed.emit()"
|
|
246
|
+
aria-label="Chiudi notifica"
|
|
247
|
+
>
|
|
248
|
+
<lucide-icon name="x" [size]="16"></lucide-icon>
|
|
249
|
+
</button>
|
|
250
|
+
}
|
|
251
|
+
</div>
|
|
252
|
+
`, styles: [".ui-toast-host{display:contents}.ui-toast{display:flex;align-items:flex-start;gap:var(--ui-spacing-3, 12px);padding:var(--ui-spacing-3, 12px) var(--ui-spacing-4, 16px);border-radius:var(--ui-radius-md, 8px);min-width:320px;max-width:440px;font-family:var(--ui-font-family, \"Inter\", sans-serif);font-size:var(--ui-font-size-sm, .875rem);font-weight:400;line-height:1.5;color:var(--ui-color-neutral-900, #111827);background:var(--ui-color-surface, #ffffff);border:1px solid var(--ui-color-neutral-200, #e5e7eb);box-shadow:var(--ui-shadow-md);pointer-events:auto;position:relative;overflow:hidden}.ui-toast:before{content:\"\";position:absolute;top:0;bottom:0;left:0;width:4px;background:transparent}.ui-toast--entering{animation:ui-toast-slide-in .25s cubic-bezier(.2,0,0,1) forwards}.ui-toast--visible{opacity:1;transform:translate(0)}.ui-toast--exiting{animation:ui-toast-slide-out .2s cubic-bezier(.4,0,1,1) forwards}.ui-toast--success:before{background:var(--ui-color-success, #10b981)}.ui-toast--success .ui-toast__icon{color:var(--ui-color-success, #10b981)}.ui-toast--error:before{background:var(--ui-color-warn, #ef4444)}.ui-toast--error .ui-toast__icon{color:var(--ui-color-warn, #ef4444)}.ui-toast--warning:before{background:var(--ui-color-warning, #f59e0b)}.ui-toast--warning .ui-toast__icon{color:var(--ui-color-warning, #f59e0b)}.ui-toast--info:before{background:var(--ui-color-info, #3b82f6)}.ui-toast--info .ui-toast__icon{color:var(--ui-color-info, #3b82f6)}.ui-toast__icon{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin-top:2px}.ui-toast__content{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;min-height:20px}.ui-toast__message{word-break:break-word;margin:0}.ui-toast__close{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin:0 -4px 0 0;border:none;border-radius:var(--ui-radius-sm, 4px);background:transparent;color:var(--ui-color-neutral-400, #9ca3af);cursor:pointer;transition-property:background,color;transition-duration:var(--ui-transition-fast);transition-timing-function:ease}.ui-toast__close:hover{background:var(--ui-color-neutral-100, #f3f4f6);color:var(--ui-color-neutral-700, #374151)}.ui-toast__close:focus{outline:none}.ui-toast__close:focus-visible{outline:var(--ui-focus-ring-width) solid var(--ui-focus-ring-color);outline-offset:var(--ui-focus-ring-offset)}@keyframes ui-toast-slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes ui-toast-slide-out{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(100%)}}\n"] }]
|
|
253
|
+
}], propDecorators: { message: [{
|
|
254
|
+
type: Input
|
|
255
|
+
}], type: [{
|
|
256
|
+
type: Input
|
|
257
|
+
}], state: [{
|
|
258
|
+
type: Input
|
|
259
|
+
}], dismissible: [{
|
|
260
|
+
type: Input
|
|
261
|
+
}], enableHtml: [{
|
|
262
|
+
type: Input
|
|
263
|
+
}], icon: [{
|
|
264
|
+
type: Input
|
|
265
|
+
}], customClass: [{
|
|
266
|
+
type: Input
|
|
267
|
+
}], dismissed: [{
|
|
268
|
+
type: Output
|
|
269
|
+
}] } });
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Toast container — manages stacking and positioning of active toasts.
|
|
273
|
+
*
|
|
274
|
+
* Dynamically attached to the DOM by `UiToastService` on first use.
|
|
275
|
+
* Renders one `ui-toast` per active notification.
|
|
276
|
+
*
|
|
277
|
+
* @selector ui-toast-container
|
|
278
|
+
* @internal Not intended for direct use.
|
|
279
|
+
*/
|
|
280
|
+
class UiToastContainerComponent {
|
|
281
|
+
constructor() {
|
|
282
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
283
|
+
/** Active toasts — managed by UiToastService. */
|
|
284
|
+
this.toasts = [];
|
|
285
|
+
}
|
|
286
|
+
/** Called by UiToastService to add a toast. */
|
|
287
|
+
addToast(toast) {
|
|
288
|
+
this.toasts = [...this.toasts, toast];
|
|
289
|
+
this.cdr.markForCheck();
|
|
290
|
+
}
|
|
291
|
+
/** Called by UiToastService to remove a toast. */
|
|
292
|
+
removeToast(id) {
|
|
293
|
+
this.toasts = this.toasts.filter(t => t.id !== id);
|
|
294
|
+
this.cdr.markForCheck();
|
|
295
|
+
}
|
|
296
|
+
/** Update a toast's state (e.g. entering → exiting). */
|
|
297
|
+
updateToastState(id, state) {
|
|
298
|
+
const toast = this.toasts.find(t => t.id === id);
|
|
299
|
+
if (toast) {
|
|
300
|
+
toast.state = state;
|
|
301
|
+
this.cdr.markForCheck();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/** Dismiss handler from the toast component. */
|
|
305
|
+
onDismiss(toast) {
|
|
306
|
+
// This is handled by the service via dismiss()
|
|
307
|
+
if (toast.timeoutId)
|
|
308
|
+
clearTimeout(toast.timeoutId);
|
|
309
|
+
this.updateToastState(toast.id, 'exiting');
|
|
310
|
+
setTimeout(() => this.removeToast(toast.id), 260);
|
|
311
|
+
}
|
|
312
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
313
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: UiToastContainerComponent, isStandalone: true, selector: "ui-toast-container", host: { classAttribute: "ui-toast-container-host" }, ngImport: i0, template: `
|
|
314
|
+
@for (toast of toasts; track toast.id) {
|
|
315
|
+
<ui-toast
|
|
316
|
+
[message]="toast.message"
|
|
317
|
+
[type]="toast.type"
|
|
318
|
+
[state]="toast.state"
|
|
319
|
+
[dismissible]="toast.config.dismissible"
|
|
320
|
+
[enableHtml]="toast.config.enableHtml"
|
|
321
|
+
[icon]="toast.config.icon"
|
|
322
|
+
[customClass]="toast.config.customClass"
|
|
323
|
+
(dismissed)="onDismiss(toast)"
|
|
324
|
+
/>
|
|
325
|
+
}
|
|
326
|
+
`, isInline: true, styles: [".ui-toast-container-host{position:fixed;z-index:10000;pointer-events:none;display:flex;flex-direction:column;gap:var(--ui-spacing-3, 12px);padding:var(--ui-spacing-6, 24px);max-height:100vh;overflow:hidden;top:0;right:0;align-items:flex-end}.ui-toast-container-host--top-right{top:0;right:0;align-items:flex-end}.ui-toast-container-host--top-left{top:0;left:0;align-items:flex-start}.ui-toast-container-host--bottom-right{top:auto;bottom:0;right:0;align-items:flex-end;flex-direction:column-reverse}.ui-toast-container-host--bottom-left{top:auto;bottom:0;left:0;align-items:flex-start;flex-direction:column-reverse}.ui-toast-container-host--top-center{top:0;left:50%;right:auto;transform:translate(-50%);align-items:center}.ui-toast-container-host--bottom-center{inset:auto auto 0 50%;transform:translate(-50%);align-items:center;flex-direction:column-reverse}\n"], dependencies: [{ kind: "component", type: UiToastComponent, selector: "ui-toast", inputs: ["message", "type", "state", "dismissible", "enableHtml", "icon", "customClass"], outputs: ["dismissed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
327
|
+
}
|
|
328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastContainerComponent, decorators: [{
|
|
329
|
+
type: Component,
|
|
330
|
+
args: [{ selector: 'ui-toast-container', standalone: true, imports: [UiToastComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
331
|
+
'class': 'ui-toast-container-host',
|
|
332
|
+
}, template: `
|
|
333
|
+
@for (toast of toasts; track toast.id) {
|
|
334
|
+
<ui-toast
|
|
335
|
+
[message]="toast.message"
|
|
336
|
+
[type]="toast.type"
|
|
337
|
+
[state]="toast.state"
|
|
338
|
+
[dismissible]="toast.config.dismissible"
|
|
339
|
+
[enableHtml]="toast.config.enableHtml"
|
|
340
|
+
[icon]="toast.config.icon"
|
|
341
|
+
[customClass]="toast.config.customClass"
|
|
342
|
+
(dismissed)="onDismiss(toast)"
|
|
343
|
+
/>
|
|
344
|
+
}
|
|
345
|
+
`, styles: [".ui-toast-container-host{position:fixed;z-index:10000;pointer-events:none;display:flex;flex-direction:column;gap:var(--ui-spacing-3, 12px);padding:var(--ui-spacing-6, 24px);max-height:100vh;overflow:hidden;top:0;right:0;align-items:flex-end}.ui-toast-container-host--top-right{top:0;right:0;align-items:flex-end}.ui-toast-container-host--top-left{top:0;left:0;align-items:flex-start}.ui-toast-container-host--bottom-right{top:auto;bottom:0;right:0;align-items:flex-end;flex-direction:column-reverse}.ui-toast-container-host--bottom-left{top:auto;bottom:0;left:0;align-items:flex-start;flex-direction:column-reverse}.ui-toast-container-host--top-center{top:0;left:50%;right:auto;transform:translate(-50%);align-items:center}.ui-toast-container-host--bottom-center{inset:auto auto 0 50%;transform:translate(-50%);align-items:center;flex-direction:column-reverse}\n"] }]
|
|
346
|
+
}] });
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @module ng-ui-system/toast
|
|
350
|
+
* Proprietary toast notification service.
|
|
351
|
+
*
|
|
352
|
+
* Zero external dependencies — renders toast components directly into the DOM
|
|
353
|
+
* via Angular's `ApplicationRef`.
|
|
354
|
+
*
|
|
355
|
+
* @usageNotes
|
|
356
|
+
* ### Basic usage
|
|
357
|
+
* ```typescript
|
|
358
|
+
* const toast = inject(UiToastService);
|
|
359
|
+
* toast.success('Record salvato!');
|
|
360
|
+
* toast.error('Errore durante il salvataggio');
|
|
361
|
+
* ```
|
|
362
|
+
*
|
|
363
|
+
* ### With config
|
|
364
|
+
* ```typescript
|
|
365
|
+
* toast.warning('Attenzione', { duration: 8000, position: 'bottom-right' });
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* ### Programmatic dismiss
|
|
369
|
+
* ```typescript
|
|
370
|
+
* const ref = toast.info('Caricamento in corso...', { duration: 0 });
|
|
371
|
+
* // ...later
|
|
372
|
+
* ref.dismiss();
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
375
|
+
* @selector —
|
|
376
|
+
*/
|
|
377
|
+
/**
|
|
378
|
+
* Central toast notification service.
|
|
379
|
+
*
|
|
380
|
+
* Manages a single `UiToastContainerComponent` in the DOM and provides
|
|
381
|
+
* convenience methods for showing typed notifications.
|
|
382
|
+
*/
|
|
383
|
+
class UiToastService {
|
|
384
|
+
constructor() {
|
|
385
|
+
this.appRef = inject(ApplicationRef);
|
|
386
|
+
this.injector = inject(EnvironmentInjector);
|
|
387
|
+
this.document = inject(DOCUMENT);
|
|
388
|
+
/** Reference to the singleton container component. */
|
|
389
|
+
this.containerRef = null;
|
|
390
|
+
}
|
|
391
|
+
// ── Public API ─────────────────────────────────────────────────────
|
|
392
|
+
/** Show a **success** toast. */
|
|
393
|
+
success(message, config) {
|
|
394
|
+
return this.show(message, 'success', config);
|
|
395
|
+
}
|
|
396
|
+
/** Show an **error** toast. */
|
|
397
|
+
error(message, config) {
|
|
398
|
+
return this.show(message, 'error', config);
|
|
399
|
+
}
|
|
400
|
+
/** Show a **warning** toast. */
|
|
401
|
+
warning(message, config) {
|
|
402
|
+
return this.show(message, 'warning', config);
|
|
403
|
+
}
|
|
404
|
+
/** Show an **info** toast. */
|
|
405
|
+
info(message, config) {
|
|
406
|
+
return this.show(message, 'info', config);
|
|
407
|
+
}
|
|
408
|
+
/** Show a toast with explicit type. */
|
|
409
|
+
show(message, type = 'info', config) {
|
|
410
|
+
this.ensureContainer(config?.position);
|
|
411
|
+
const container = this.containerRef.instance;
|
|
412
|
+
const id = uiUniqueId('toast');
|
|
413
|
+
const merged = {
|
|
414
|
+
...UI_TOAST_DEFAULTS,
|
|
415
|
+
...config,
|
|
416
|
+
};
|
|
417
|
+
const data = {
|
|
418
|
+
id,
|
|
419
|
+
message,
|
|
420
|
+
type: config?.type ?? type,
|
|
421
|
+
config: merged,
|
|
422
|
+
state: 'entering',
|
|
423
|
+
};
|
|
424
|
+
// Auto-dismiss
|
|
425
|
+
if (merged.duration > 0) {
|
|
426
|
+
data.timeoutId = setTimeout(() => this.dismiss(id), merged.duration);
|
|
427
|
+
}
|
|
428
|
+
container.addToast(data);
|
|
429
|
+
return {
|
|
430
|
+
id,
|
|
431
|
+
dismiss: () => this.dismiss(id),
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
/** Dismiss a specific toast by ID. */
|
|
435
|
+
dismiss(id) {
|
|
436
|
+
const container = this.containerRef?.instance;
|
|
437
|
+
if (!container)
|
|
438
|
+
return;
|
|
439
|
+
const toast = container.toasts.find(t => t.id === id);
|
|
440
|
+
if (!toast || toast.state === 'exiting')
|
|
441
|
+
return;
|
|
442
|
+
if (toast.timeoutId)
|
|
443
|
+
clearTimeout(toast.timeoutId);
|
|
444
|
+
// Animate out, then remove
|
|
445
|
+
container.updateToastState(id, 'exiting');
|
|
446
|
+
setTimeout(() => container.removeToast(id), 260);
|
|
447
|
+
}
|
|
448
|
+
/** Dismiss all active toasts. */
|
|
449
|
+
dismissAll() {
|
|
450
|
+
const container = this.containerRef?.instance;
|
|
451
|
+
if (!container)
|
|
452
|
+
return;
|
|
453
|
+
const ids = container.toasts.map(t => t.id);
|
|
454
|
+
ids.forEach(id => this.dismiss(id));
|
|
455
|
+
}
|
|
456
|
+
// ── Internals ──────────────────────────────────────────────────────
|
|
457
|
+
/**
|
|
458
|
+
* Ensures the container component exists in the DOM.
|
|
459
|
+
* Creates it lazily on first toast call.
|
|
460
|
+
*/
|
|
461
|
+
ensureContainer(position) {
|
|
462
|
+
if (this.containerRef) {
|
|
463
|
+
// Update position class if needed
|
|
464
|
+
if (position) {
|
|
465
|
+
const el = this.containerRef.location.nativeElement;
|
|
466
|
+
this.applyPositionClass(el, position);
|
|
467
|
+
}
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
// Create the container component dynamically
|
|
471
|
+
this.containerRef = createComponent(UiToastContainerComponent, {
|
|
472
|
+
environmentInjector: this.injector,
|
|
473
|
+
});
|
|
474
|
+
// Attach to Angular's change detection
|
|
475
|
+
this.appRef.attachView(this.containerRef.hostView);
|
|
476
|
+
// Insert into the DOM
|
|
477
|
+
const el = this.containerRef.location.nativeElement;
|
|
478
|
+
this.applyPositionClass(el, position ?? UI_TOAST_DEFAULTS.position);
|
|
479
|
+
this.document.body.appendChild(el);
|
|
480
|
+
}
|
|
481
|
+
/** Apply CSS position modifier class to the container element. */
|
|
482
|
+
applyPositionClass(el, position) {
|
|
483
|
+
// Remove old position classes
|
|
484
|
+
el.className = el.className
|
|
485
|
+
.split(' ')
|
|
486
|
+
.filter(c => !c.startsWith('ui-toast-container-host--'))
|
|
487
|
+
.join(' ');
|
|
488
|
+
el.classList.add(`ui-toast-container-host--${position}`);
|
|
489
|
+
}
|
|
490
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
491
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastService, providedIn: 'root' }); }
|
|
492
|
+
}
|
|
493
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiToastService, decorators: [{
|
|
494
|
+
type: Injectable,
|
|
495
|
+
args: [{ providedIn: 'root' }]
|
|
496
|
+
}] });
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Central service for programmatic control of the `ui-layout-builder` shell.
|
|
500
|
+
*
|
|
501
|
+
* Provides reactive state management for:
|
|
502
|
+
* - Overlay loader (with body scroll locking)
|
|
503
|
+
* - Sidebar open / collapsed state
|
|
504
|
+
* - Context-sensitive FAB actions
|
|
505
|
+
* - Navigation badge and visibility overrides
|
|
506
|
+
* - Layout mode switching (sidebar / topbar / slotted)
|
|
507
|
+
* - Content type (fluid / boxed / fullscreen)
|
|
508
|
+
* - Topbar bar visibility (notification bars show/hide)
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* export class MyPageComponent {
|
|
513
|
+
* private layout = inject(UiLayoutService);
|
|
514
|
+
*
|
|
515
|
+
* async loadData() {
|
|
516
|
+
* this.layout.showLoader();
|
|
517
|
+
* try {
|
|
518
|
+
* await this.api.fetchAll();
|
|
519
|
+
* } finally {
|
|
520
|
+
* this.layout.hideLoader();
|
|
521
|
+
* }
|
|
522
|
+
* }
|
|
523
|
+
* }
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
class UiLayoutService {
|
|
527
|
+
constructor() {
|
|
528
|
+
this.platformId = inject(PLATFORM_ID);
|
|
529
|
+
// ── Loader ───────────────────────────────────────────────────────
|
|
530
|
+
this._loading$ = new BehaviorSubject(false);
|
|
531
|
+
/** Whether the overlay loader is currently visible. */
|
|
532
|
+
this.loading$ = this._loading$.asObservable();
|
|
533
|
+
// ── Layout Mode ─────────────────────────────────────────────────
|
|
534
|
+
this._layoutMode$ = new BehaviorSubject('sidebar');
|
|
535
|
+
/** Current layout mode (sidebar or topbar). */
|
|
536
|
+
this.layoutMode$ = this._layoutMode$.asObservable();
|
|
537
|
+
// ── Content Type ────────────────────────────────────────────────
|
|
538
|
+
this._contentType$ = new BehaviorSubject('fluid');
|
|
539
|
+
/** Current content type (fluid, boxed, fullscreen). */
|
|
540
|
+
this.contentType$ = this._contentType$.asObservable();
|
|
541
|
+
// ── Sidebar ──────────────────────────────────────────────────────
|
|
542
|
+
this._sidebarOpen$ = new BehaviorSubject(false);
|
|
543
|
+
/** Whether the mobile sidebar drawer is open. */
|
|
544
|
+
this.sidebarOpen$ = this._sidebarOpen$.asObservable();
|
|
545
|
+
this._sidebarCollapsed$ = new BehaviorSubject(false);
|
|
546
|
+
/** Whether the desktop sidebar is in collapsed (icon-only) mode. */
|
|
547
|
+
this.sidebarCollapsed$ = this._sidebarCollapsed$.asObservable();
|
|
548
|
+
// ── FAB (context-sensitive) ──────────────────────────────────────
|
|
549
|
+
this._defaultFabConfig = null;
|
|
550
|
+
this._fabConfig$ = new BehaviorSubject(null);
|
|
551
|
+
/** Current FAB configuration (schema default merged with page overrides). */
|
|
552
|
+
this.fabConfig$ = this._fabConfig$.asObservable();
|
|
553
|
+
// ── Navigation helpers ───────────────────────────────────────────
|
|
554
|
+
this._navBadges$ = new BehaviorSubject(new Map());
|
|
555
|
+
/** Observable map of nav-item badges keyed by item ID. */
|
|
556
|
+
this.navBadges$ = this._navBadges$.asObservable();
|
|
557
|
+
this._navVisibility$ = new BehaviorSubject(new Map());
|
|
558
|
+
/** Observable map of nav-item visibility overrides keyed by item ID. */
|
|
559
|
+
this.navVisibility$ = this._navVisibility$.asObservable();
|
|
560
|
+
// ── Bar visibility (topbar notification bars) ───────────────────
|
|
561
|
+
this._barVisibility$ = new BehaviorSubject(new Map());
|
|
562
|
+
/** Observable map of topbar bar visibility keyed by bar ID. */
|
|
563
|
+
this.barVisibility$ = this._barVisibility$.asObservable();
|
|
564
|
+
}
|
|
565
|
+
/** Show the full-screen overlay loader and block body scroll. */
|
|
566
|
+
showLoader() {
|
|
567
|
+
this._loading$.next(true);
|
|
568
|
+
this.setBodyOverflow(true);
|
|
569
|
+
}
|
|
570
|
+
/** Hide the overlay loader and restore body scroll. */
|
|
571
|
+
hideLoader() {
|
|
572
|
+
this._loading$.next(false);
|
|
573
|
+
this.setBodyOverflow(false);
|
|
574
|
+
}
|
|
575
|
+
/** Toggle the overlay loader. */
|
|
576
|
+
toggleLoader() {
|
|
577
|
+
if (this._loading$.value) {
|
|
578
|
+
this.hideLoader();
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
this.showLoader();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
/** Synchronous snapshot of the loading state. */
|
|
585
|
+
isLoading() {
|
|
586
|
+
return this._loading$.value;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Switch layout mode with loader masking the transition.
|
|
590
|
+
* Shows the loader, applies the mode change, then hides the loader
|
|
591
|
+
* after a short delay to prevent visible layout shift.
|
|
592
|
+
*/
|
|
593
|
+
setLayoutMode(mode, transitionMs = 300) {
|
|
594
|
+
if (this._layoutMode$.value === mode)
|
|
595
|
+
return;
|
|
596
|
+
this.showLoader();
|
|
597
|
+
this._layoutMode$.next(mode);
|
|
598
|
+
setTimeout(() => this.hideLoader(), transitionMs);
|
|
599
|
+
}
|
|
600
|
+
/** Synchronous snapshot of the current layout mode. */
|
|
601
|
+
getLayoutMode() {
|
|
602
|
+
return this._layoutMode$.value;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* @internal Called by the layout-builder component to set the initial mode
|
|
606
|
+
* from the schema without triggering the loader transition.
|
|
607
|
+
*/
|
|
608
|
+
_setInitialLayoutMode(mode) {
|
|
609
|
+
this._layoutMode$.next(mode);
|
|
610
|
+
}
|
|
611
|
+
/** Set the content type per-route or globally. */
|
|
612
|
+
setContentType(type) {
|
|
613
|
+
this._contentType$.next(type);
|
|
614
|
+
}
|
|
615
|
+
/** Synchronous snapshot of the current content type. */
|
|
616
|
+
getContentType() {
|
|
617
|
+
return this._contentType$.value;
|
|
618
|
+
}
|
|
619
|
+
/** @internal */
|
|
620
|
+
_setInitialContentType(type) {
|
|
621
|
+
this._contentType$.next(type);
|
|
622
|
+
}
|
|
623
|
+
/** Toggle the desktop sidebar between expanded and collapsed. */
|
|
624
|
+
toggleSidebar() {
|
|
625
|
+
this._sidebarCollapsed$.next(!this._sidebarCollapsed$.value);
|
|
626
|
+
}
|
|
627
|
+
/** Set the desktop sidebar collapsed state explicitly. */
|
|
628
|
+
collapseSidebar(collapsed = true) {
|
|
629
|
+
this._sidebarCollapsed$.next(collapsed);
|
|
630
|
+
}
|
|
631
|
+
/** Open the mobile sidebar drawer. */
|
|
632
|
+
openMobileSidebar() {
|
|
633
|
+
this._sidebarOpen$.next(true);
|
|
634
|
+
}
|
|
635
|
+
/** Close the mobile sidebar drawer. */
|
|
636
|
+
closeMobileSidebar() {
|
|
637
|
+
this._sidebarOpen$.next(false);
|
|
638
|
+
}
|
|
639
|
+
/** Synchronous snapshot: is the mobile sidebar open? */
|
|
640
|
+
isSidebarOpen() {
|
|
641
|
+
return this._sidebarOpen$.value;
|
|
642
|
+
}
|
|
643
|
+
/** Synchronous snapshot: is the desktop sidebar collapsed? */
|
|
644
|
+
isSidebarCollapsed() {
|
|
645
|
+
return this._sidebarCollapsed$.value;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Called internally by the layout-builder component to register the
|
|
649
|
+
* schema-level default FAB config.
|
|
650
|
+
* @internal
|
|
651
|
+
*/
|
|
652
|
+
_setDefaultFabConfig(config) {
|
|
653
|
+
this._defaultFabConfig = config;
|
|
654
|
+
this._fabConfig$.next(config);
|
|
655
|
+
}
|
|
656
|
+
/** Override the FAB main action for the current page context. */
|
|
657
|
+
setMainFabAction(action) {
|
|
658
|
+
const current = this._fabConfig$.value;
|
|
659
|
+
this._fabConfig$.next({
|
|
660
|
+
mainAction: action,
|
|
661
|
+
secondaryActions: current?.secondaryActions ?? [],
|
|
662
|
+
position: current?.position ?? 'bottom-right',
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
/** Override all FAB actions for the current page context. */
|
|
666
|
+
setFabActions(main, secondary) {
|
|
667
|
+
const current = this._fabConfig$.value;
|
|
668
|
+
this._fabConfig$.next({
|
|
669
|
+
mainAction: main,
|
|
670
|
+
secondaryActions: secondary ?? [],
|
|
671
|
+
position: current?.position ?? 'bottom-right',
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
/** Reset FAB to the schema-level default configuration. */
|
|
675
|
+
clearFabActions() {
|
|
676
|
+
this._fabConfig$.next(this._defaultFabConfig);
|
|
677
|
+
}
|
|
678
|
+
/** Set or clear a badge on a navigation item. Pass `null` to remove. */
|
|
679
|
+
setNavBadge(itemId, badge) {
|
|
680
|
+
const map = new Map(this._navBadges$.value);
|
|
681
|
+
if (badge === null) {
|
|
682
|
+
map.delete(itemId);
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
map.set(itemId, badge);
|
|
686
|
+
}
|
|
687
|
+
this._navBadges$.next(map);
|
|
688
|
+
}
|
|
689
|
+
/** Override visibility of a navigation item. */
|
|
690
|
+
setNavItemVisibility(itemId, visible) {
|
|
691
|
+
const map = new Map(this._navVisibility$.value);
|
|
692
|
+
map.set(itemId, visible);
|
|
693
|
+
this._navVisibility$.next(map);
|
|
694
|
+
}
|
|
695
|
+
/** Show a topbar bar by ID. */
|
|
696
|
+
showBar(barId) {
|
|
697
|
+
const map = new Map(this._barVisibility$.value);
|
|
698
|
+
map.set(barId, true);
|
|
699
|
+
this._barVisibility$.next(map);
|
|
700
|
+
}
|
|
701
|
+
/** Hide a topbar bar by ID. */
|
|
702
|
+
hideBar(barId) {
|
|
703
|
+
const map = new Map(this._barVisibility$.value);
|
|
704
|
+
map.set(barId, false);
|
|
705
|
+
this._barVisibility$.next(map);
|
|
706
|
+
}
|
|
707
|
+
/** Toggle visibility of a topbar bar by ID. */
|
|
708
|
+
toggleBar(barId) {
|
|
709
|
+
const map = new Map(this._barVisibility$.value);
|
|
710
|
+
const current = map.get(barId);
|
|
711
|
+
map.set(barId, current === undefined ? false : !current);
|
|
712
|
+
this._barVisibility$.next(map);
|
|
713
|
+
}
|
|
714
|
+
/** Synchronous check of bar visibility (schema `visible` fallback). */
|
|
715
|
+
isBarVisible(barId, schemaVisible = true) {
|
|
716
|
+
const override = this._barVisibility$.value.get(barId);
|
|
717
|
+
return override !== undefined ? override : schemaVisible;
|
|
718
|
+
}
|
|
719
|
+
// ── Private helpers ──────────────────────────────────────────────
|
|
720
|
+
setBodyOverflow(locked) {
|
|
721
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
722
|
+
document.body.style.overflow = locked ? 'hidden' : '';
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiLayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
726
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiLayoutService, providedIn: 'root' }); }
|
|
727
|
+
}
|
|
728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiLayoutService, decorators: [{
|
|
729
|
+
type: Injectable,
|
|
730
|
+
args: [{ providedIn: 'root' }]
|
|
731
|
+
}] });
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* @module ng-ui-system/http
|
|
735
|
+
* Message handler — coordinates toast notifications and loader state
|
|
736
|
+
* for the HTTP service pipeline.
|
|
737
|
+
*
|
|
738
|
+
* Extracted as a standalone injectable so it can be tested independently
|
|
739
|
+
* and potentially reused outside HTTP flows.
|
|
740
|
+
*/
|
|
741
|
+
/**
|
|
742
|
+
* Orchestrates toast notifications and loader state for HTTP requests.
|
|
743
|
+
*
|
|
744
|
+
* Features:
|
|
745
|
+
* - Debounce anti-spam (groups identical messages within 300ms)
|
|
746
|
+
* - Inline message resolution with placeholder replacements
|
|
747
|
+
* - `successMessageResolver` / `errorExtractor` for dynamic messages
|
|
748
|
+
* - Loader integration via `UiLayoutService` (optional)
|
|
749
|
+
*/
|
|
750
|
+
class UiHttpMessageHandler {
|
|
751
|
+
constructor() {
|
|
752
|
+
this.toast = inject(UiToastService);
|
|
753
|
+
this.layout = inject(UiLayoutService, { optional: true });
|
|
754
|
+
/** Debounce time in milliseconds. */
|
|
755
|
+
this.DEBOUNCE_TIME = 300;
|
|
756
|
+
/** Active debounce timeouts keyed by message content. */
|
|
757
|
+
this.messageTimeouts = new Map();
|
|
758
|
+
}
|
|
759
|
+
// ── Loader ─────────────────────────────────────────────────────────
|
|
760
|
+
/** Show the global loader (via UiLayoutService if available). */
|
|
761
|
+
startLoading() {
|
|
762
|
+
this.layout?.showLoader();
|
|
763
|
+
}
|
|
764
|
+
/** Hide the global loader. */
|
|
765
|
+
stopLoading() {
|
|
766
|
+
this.layout?.hideLoader();
|
|
767
|
+
}
|
|
768
|
+
// ── Success ────────────────────────────────────────────────────────
|
|
769
|
+
/**
|
|
770
|
+
* Show a success toast for the given endpoint.
|
|
771
|
+
*
|
|
772
|
+
* Resolution priority:
|
|
773
|
+
* 1. `successMessageResolver()` if provided and returns non-null
|
|
774
|
+
* 2. `messages.success` with placeholder replacements
|
|
775
|
+
* 3. No toast if no message is configured
|
|
776
|
+
*/
|
|
777
|
+
showSuccess(endpoint) {
|
|
778
|
+
if (!endpoint.showSuccess)
|
|
779
|
+
return;
|
|
780
|
+
let message = null;
|
|
781
|
+
// Priority 1: custom resolver
|
|
782
|
+
if (endpoint.successMessageResolver) {
|
|
783
|
+
message = endpoint.successMessageResolver();
|
|
784
|
+
}
|
|
785
|
+
// Priority 2: inline message with replacements
|
|
786
|
+
if (!message && endpoint.messages?.success) {
|
|
787
|
+
message = this.applyReplacements(endpoint.messages.success, endpoint.replacements);
|
|
788
|
+
}
|
|
789
|
+
if (message) {
|
|
790
|
+
this.debounceToast(message, 'success');
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
// ── Error ──────────────────────────────────────────────────────────
|
|
794
|
+
/**
|
|
795
|
+
* Show an error toast for the given endpoint.
|
|
796
|
+
*
|
|
797
|
+
* Resolution priority:
|
|
798
|
+
* 1. `errorExtractor(error)` if provided and returns non-null
|
|
799
|
+
* 2. `messages.error` with placeholder replacements
|
|
800
|
+
* 3. `fallbackMessage` if everything else is empty
|
|
801
|
+
*/
|
|
802
|
+
showError(endpoint, error, fallbackMessage) {
|
|
803
|
+
if (!endpoint.showError)
|
|
804
|
+
return;
|
|
805
|
+
let message = null;
|
|
806
|
+
// Priority 1: error extractor
|
|
807
|
+
if (endpoint.errorExtractor && error) {
|
|
808
|
+
message = endpoint.errorExtractor(error);
|
|
809
|
+
}
|
|
810
|
+
// Priority 2: inline message
|
|
811
|
+
if (!message && endpoint.messages?.error) {
|
|
812
|
+
message = this.applyReplacements(endpoint.messages.error, endpoint.replacements);
|
|
813
|
+
}
|
|
814
|
+
if (message) {
|
|
815
|
+
this.debounceToast(message, 'error');
|
|
816
|
+
}
|
|
817
|
+
else if (fallbackMessage) {
|
|
818
|
+
this.debounceToast(fallbackMessage, 'error');
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
// ── Custom messages ────────────────────────────────────────────────
|
|
822
|
+
/** Show a custom success toast (not tied to an endpoint). */
|
|
823
|
+
showCustomSuccess(message) {
|
|
824
|
+
this.debounceToast(message, 'success');
|
|
825
|
+
}
|
|
826
|
+
/** Show a custom error toast (not tied to an endpoint). */
|
|
827
|
+
showCustomError(message) {
|
|
828
|
+
this.debounceToast(message, 'error');
|
|
829
|
+
}
|
|
830
|
+
// ── Cleanup ────────────────────────────────────────────────────────
|
|
831
|
+
/** Cancel all pending debounce timeouts. */
|
|
832
|
+
clearAllTimeouts() {
|
|
833
|
+
this.messageTimeouts.forEach(t => clearTimeout(t));
|
|
834
|
+
this.messageTimeouts.clear();
|
|
835
|
+
}
|
|
836
|
+
// ── Internals ──────────────────────────────────────────────────────
|
|
837
|
+
/**
|
|
838
|
+
* Debounce mechanism for toast messages.
|
|
839
|
+
* If the same message is requested within DEBOUNCE_TIME ms,
|
|
840
|
+
* only the last one is shown.
|
|
841
|
+
*/
|
|
842
|
+
debounceToast(message, type) {
|
|
843
|
+
const existing = this.messageTimeouts.get(message);
|
|
844
|
+
if (existing)
|
|
845
|
+
clearTimeout(existing);
|
|
846
|
+
const timeout = setTimeout(() => {
|
|
847
|
+
this.toast[type](message);
|
|
848
|
+
this.messageTimeouts.delete(message);
|
|
849
|
+
}, this.DEBOUNCE_TIME);
|
|
850
|
+
this.messageTimeouts.set(message, timeout);
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Replace `${key}` placeholders in a message string.
|
|
854
|
+
*/
|
|
855
|
+
applyReplacements(message, replacements) {
|
|
856
|
+
if (!replacements)
|
|
857
|
+
return message;
|
|
858
|
+
let result = message;
|
|
859
|
+
Object.entries(replacements).forEach(([key, value]) => {
|
|
860
|
+
result = result.replace(new RegExp(`\\$\\{${key}\\}`, 'g'), String(value));
|
|
861
|
+
});
|
|
862
|
+
return result;
|
|
863
|
+
}
|
|
864
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiHttpMessageHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
865
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiHttpMessageHandler, providedIn: 'root' }); }
|
|
866
|
+
}
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiHttpMessageHandler, decorators: [{
|
|
868
|
+
type: Injectable,
|
|
869
|
+
args: [{ providedIn: 'root' }]
|
|
870
|
+
}] });
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* @module ng-ui-system/http
|
|
874
|
+
* Injection tokens for the HTTP orchestration service.
|
|
875
|
+
*/
|
|
876
|
+
/**
|
|
877
|
+
* Optional global configuration for `UiHttpService`.
|
|
878
|
+
*
|
|
879
|
+
* @usageNotes
|
|
880
|
+
* ```typescript
|
|
881
|
+
* providers: [
|
|
882
|
+
* { provide: UI_HTTP_CONFIG, useValue: { baseUrl: '/api' } },
|
|
883
|
+
* ]
|
|
884
|
+
* ```
|
|
885
|
+
*/
|
|
886
|
+
const UI_HTTP_CONFIG = new InjectionToken('UI_HTTP_CONFIG');
|
|
887
|
+
/**
|
|
888
|
+
* Optional headers provider for injecting custom headers (auth, correlation, etc.)
|
|
889
|
+
* into every HTTP request.
|
|
890
|
+
*
|
|
891
|
+
* @usageNotes
|
|
892
|
+
* ```typescript
|
|
893
|
+
* providers: [
|
|
894
|
+
* { provide: UI_HEADERS_PROVIDER, useClass: MyAuthHeadersProvider },
|
|
895
|
+
* ]
|
|
896
|
+
* ```
|
|
897
|
+
*/
|
|
898
|
+
const UI_HEADERS_PROVIDER = new InjectionToken('UI_HEADERS_PROVIDER');
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* @module ng-ui-system/blackbox
|
|
902
|
+
* Types and interfaces for the BlackBox observability service.
|
|
903
|
+
*
|
|
904
|
+
* The BlackBox service acts as a "black box recorder" for user sessions,
|
|
905
|
+
* capturing navigation, UI interactions, form events and HTTP calls
|
|
906
|
+
* in a compressed, opaque format stored in IndexedDB.
|
|
907
|
+
*/
|
|
908
|
+
// ─── Defaults ────────────────────────────────────────────────────────
|
|
909
|
+
/** Default configuration values. */
|
|
910
|
+
const UI_BLACKBOX_DEFAULTS = {
|
|
911
|
+
maxStorageMb: 50,
|
|
912
|
+
flushIntervalMs: 5000,
|
|
913
|
+
flushThreshold: 20,
|
|
914
|
+
bufferDebounceMs: 500,
|
|
915
|
+
formTracking: {
|
|
916
|
+
trackValues: false,
|
|
917
|
+
trackFocus: true,
|
|
918
|
+
trackBlur: true,
|
|
919
|
+
trackValueChanges: true,
|
|
920
|
+
trackValidation: true,
|
|
921
|
+
debounceMs: 500,
|
|
922
|
+
},
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* @module ng-ui-system/blackbox
|
|
927
|
+
* Fingerprint service — generates a stable device/browser hash
|
|
928
|
+
* using the open-source FingerprintJS library (MIT, no API key required).
|
|
929
|
+
*
|
|
930
|
+
* The fingerprint is computed once and cached in `localStorage` under
|
|
931
|
+
* the key `__ui_bb_fp` to avoid redundant recalculations.
|
|
932
|
+
*/
|
|
933
|
+
/** localStorage key for the cached fingerprint. */
|
|
934
|
+
const FP_CACHE_KEY = '__ui_bb_fp';
|
|
935
|
+
/**
|
|
936
|
+
* Generates and caches a stable browser/device fingerprint.
|
|
937
|
+
*
|
|
938
|
+
* Uses `@fingerprintjs/fingerprintjs` (open-source, MIT) which analyses
|
|
939
|
+
* canvas rendering, WebGL, audio context, screen properties, timezone,
|
|
940
|
+
* user-agent, and other browser signals to produce a stable hash.
|
|
941
|
+
*
|
|
942
|
+
* @usageNotes
|
|
943
|
+
* ```typescript
|
|
944
|
+
* const fp = inject(UiBlackboxFingerprintService);
|
|
945
|
+
* const hash = await fp.getFingerprint();
|
|
946
|
+
* // => "a1b2c3d4e5f6..." (stable across sessions)
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
949
|
+
class UiBlackboxFingerprintService {
|
|
950
|
+
constructor() {
|
|
951
|
+
this.platformId = inject(PLATFORM_ID);
|
|
952
|
+
this.cached = null;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Returns the stable fingerprint for this device/browser.
|
|
956
|
+
*
|
|
957
|
+
* On first call, loads FingerprintJS dynamically, computes the hash,
|
|
958
|
+
* and caches it in both memory and `localStorage`.
|
|
959
|
+
* Subsequent calls return the cached value immediately.
|
|
960
|
+
*/
|
|
961
|
+
async getFingerprint() {
|
|
962
|
+
// Return cached value if available
|
|
963
|
+
if (this.cached) {
|
|
964
|
+
return this.cached;
|
|
965
|
+
}
|
|
966
|
+
// SSR guard
|
|
967
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
968
|
+
return 'ssr-placeholder';
|
|
969
|
+
}
|
|
970
|
+
// Try localStorage cache first
|
|
971
|
+
try {
|
|
972
|
+
const stored = localStorage.getItem(FP_CACHE_KEY);
|
|
973
|
+
if (stored) {
|
|
974
|
+
this.cached = stored;
|
|
975
|
+
return stored;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
catch {
|
|
979
|
+
// localStorage may be unavailable (privacy mode, quota exceeded)
|
|
980
|
+
}
|
|
981
|
+
// Compute fingerprint via FingerprintJS
|
|
982
|
+
try {
|
|
983
|
+
const FingerprintJS = await import('@fingerprintjs/fingerprintjs');
|
|
984
|
+
const agent = await FingerprintJS.load();
|
|
985
|
+
const result = await agent.get();
|
|
986
|
+
this.cached = result.visitorId;
|
|
987
|
+
// Persist to localStorage
|
|
988
|
+
try {
|
|
989
|
+
localStorage.setItem(FP_CACHE_KEY, this.cached);
|
|
990
|
+
}
|
|
991
|
+
catch {
|
|
992
|
+
// Silently ignore storage errors
|
|
993
|
+
}
|
|
994
|
+
return this.cached;
|
|
995
|
+
}
|
|
996
|
+
catch {
|
|
997
|
+
// Fallback: generate a pseudo-fingerprint from available signals
|
|
998
|
+
const fallback = this.generateFallbackFingerprint();
|
|
999
|
+
this.cached = fallback;
|
|
1000
|
+
try {
|
|
1001
|
+
localStorage.setItem(FP_CACHE_KEY, fallback);
|
|
1002
|
+
}
|
|
1003
|
+
catch {
|
|
1004
|
+
// Silently ignore
|
|
1005
|
+
}
|
|
1006
|
+
return fallback;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Fallback fingerprint when FingerprintJS is unavailable.
|
|
1011
|
+
* Combines basic browser signals into a hash.
|
|
1012
|
+
* @internal
|
|
1013
|
+
*/
|
|
1014
|
+
generateFallbackFingerprint() {
|
|
1015
|
+
const signals = [
|
|
1016
|
+
navigator.userAgent,
|
|
1017
|
+
navigator.language,
|
|
1018
|
+
screen.width + 'x' + screen.height,
|
|
1019
|
+
screen.colorDepth?.toString() ?? '',
|
|
1020
|
+
Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
1021
|
+
navigator.hardwareConcurrency?.toString() ?? '',
|
|
1022
|
+
].join('|');
|
|
1023
|
+
// Simple string hash (djb2)
|
|
1024
|
+
let hash = 5381;
|
|
1025
|
+
for (let i = 0; i < signals.length; i++) {
|
|
1026
|
+
hash = ((hash << 5) + hash + signals.charCodeAt(i)) >>> 0;
|
|
1027
|
+
}
|
|
1028
|
+
return hash.toString(36).padStart(12, '0');
|
|
1029
|
+
}
|
|
1030
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxFingerprintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1031
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxFingerprintService, providedIn: 'root' }); }
|
|
1032
|
+
}
|
|
1033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxFingerprintService, decorators: [{
|
|
1034
|
+
type: Injectable,
|
|
1035
|
+
args: [{ providedIn: 'root' }]
|
|
1036
|
+
}] });
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* @module ng-ui-system/blackbox
|
|
1040
|
+
* IndexedDB storage adapter for BlackBox sessions.
|
|
1041
|
+
*
|
|
1042
|
+
* Handles persistence, compression (via native CompressionStream gzip),
|
|
1043
|
+
* quota enforcement, and JSONL export.
|
|
1044
|
+
*
|
|
1045
|
+
* Design notes:
|
|
1046
|
+
* - DB name: `ui-blackbox`, object store: `sessions`
|
|
1047
|
+
* - Each session is gzip-compressed before storage for both size
|
|
1048
|
+
* reduction and inherent obfuscation
|
|
1049
|
+
* - Quota enforced by total stored size; oldest sessions are pruned first
|
|
1050
|
+
*/
|
|
1051
|
+
const DB_NAME = 'ui-blackbox';
|
|
1052
|
+
const DB_VERSION = 1;
|
|
1053
|
+
const STORE_NAME = 'sessions';
|
|
1054
|
+
/**
|
|
1055
|
+
* Low-level IndexedDB adapter for reading/writing compressed BlackBox sessions.
|
|
1056
|
+
*
|
|
1057
|
+
* @usageNotes
|
|
1058
|
+
* This service is used internally by `UiBlackboxService`.
|
|
1059
|
+
* Consumers should interact with the higher-level `UiBlackboxService` API.
|
|
1060
|
+
*/
|
|
1061
|
+
class UiBlackboxStorageService {
|
|
1062
|
+
constructor() {
|
|
1063
|
+
this.platformId = inject(PLATFORM_ID);
|
|
1064
|
+
this.db = null;
|
|
1065
|
+
this.maxStorageMb = UI_BLACKBOX_DEFAULTS.maxStorageMb;
|
|
1066
|
+
}
|
|
1067
|
+
// ─── Configuration ─────────────────────────────────────────────────
|
|
1068
|
+
/** Update the storage quota from the parent service config. */
|
|
1069
|
+
setMaxStorageMb(mb) {
|
|
1070
|
+
this.maxStorageMb = mb;
|
|
1071
|
+
}
|
|
1072
|
+
// ─── Database lifecycle ────────────────────────────────────────────
|
|
1073
|
+
/** Open (or create) the IndexedDB database. */
|
|
1074
|
+
async openDb() {
|
|
1075
|
+
if (this.db)
|
|
1076
|
+
return this.db;
|
|
1077
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
1078
|
+
throw new Error('IndexedDB is not available in SSR');
|
|
1079
|
+
}
|
|
1080
|
+
return new Promise((resolve, reject) => {
|
|
1081
|
+
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
1082
|
+
request.onupgradeneeded = () => {
|
|
1083
|
+
const db = request.result;
|
|
1084
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
1085
|
+
const store = db.createObjectStore(STORE_NAME, { keyPath: 'sessionId' });
|
|
1086
|
+
store.createIndex('fingerprint', 'fingerprint', { unique: false });
|
|
1087
|
+
store.createIndex('startedAt', 'startedAt', { unique: false });
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
request.onsuccess = () => {
|
|
1091
|
+
this.db = request.result;
|
|
1092
|
+
resolve(this.db);
|
|
1093
|
+
};
|
|
1094
|
+
request.onerror = () => reject(request.error);
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
// ─── Compression helpers ───────────────────────────────────────────
|
|
1098
|
+
/** Compress a string to a gzip Uint8Array using native CompressionStream. */
|
|
1099
|
+
async compress(data) {
|
|
1100
|
+
const encoder = new TextEncoder();
|
|
1101
|
+
const stream = new Blob([encoder.encode(data)])
|
|
1102
|
+
.stream()
|
|
1103
|
+
.pipeThrough(new CompressionStream('gzip'));
|
|
1104
|
+
const reader = stream.getReader();
|
|
1105
|
+
const chunks = [];
|
|
1106
|
+
let done = false;
|
|
1107
|
+
while (!done) {
|
|
1108
|
+
const result = await reader.read();
|
|
1109
|
+
done = result.done;
|
|
1110
|
+
if (result.value) {
|
|
1111
|
+
chunks.push(result.value);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
// Merge chunks into a single ArrayBuffer-backed Uint8Array
|
|
1115
|
+
const totalLength = chunks.reduce((sum, c) => sum + c.length, 0);
|
|
1116
|
+
const buffer = new ArrayBuffer(totalLength);
|
|
1117
|
+
const merged = new Uint8Array(buffer);
|
|
1118
|
+
let offset = 0;
|
|
1119
|
+
for (const chunk of chunks) {
|
|
1120
|
+
merged.set(chunk, offset);
|
|
1121
|
+
offset += chunk.length;
|
|
1122
|
+
}
|
|
1123
|
+
return merged;
|
|
1124
|
+
}
|
|
1125
|
+
/** Decompress a gzip Uint8Array back to a string. */
|
|
1126
|
+
async decompress(data) {
|
|
1127
|
+
const stream = new Blob([data])
|
|
1128
|
+
.stream()
|
|
1129
|
+
.pipeThrough(new DecompressionStream('gzip'));
|
|
1130
|
+
const reader = stream.getReader();
|
|
1131
|
+
const decoder = new TextDecoder();
|
|
1132
|
+
let result = '';
|
|
1133
|
+
let done = false;
|
|
1134
|
+
while (!done) {
|
|
1135
|
+
const chunk = await reader.read();
|
|
1136
|
+
done = chunk.done;
|
|
1137
|
+
if (chunk.value) {
|
|
1138
|
+
result += decoder.decode(chunk.value, { stream: !done });
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
return result;
|
|
1142
|
+
}
|
|
1143
|
+
// ─── CRUD ──────────────────────────────────────────────────────────
|
|
1144
|
+
/**
|
|
1145
|
+
* Persist a session to IndexedDB (gzip-compressed).
|
|
1146
|
+
* Enforces quota after saving.
|
|
1147
|
+
*/
|
|
1148
|
+
async saveSession(session) {
|
|
1149
|
+
const db = await this.openDb();
|
|
1150
|
+
const json = JSON.stringify(session);
|
|
1151
|
+
const compressed = await this.compress(json);
|
|
1152
|
+
return new Promise((resolve, reject) => {
|
|
1153
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
1154
|
+
const store = tx.objectStore(STORE_NAME);
|
|
1155
|
+
// Store as { sessionId, fingerprint, startedAt, data: Uint8Array }
|
|
1156
|
+
store.put({
|
|
1157
|
+
sessionId: session.sessionId,
|
|
1158
|
+
fingerprint: session.fingerprint,
|
|
1159
|
+
startedAt: session.startedAt,
|
|
1160
|
+
sizeBytes: compressed.byteLength,
|
|
1161
|
+
data: compressed,
|
|
1162
|
+
});
|
|
1163
|
+
tx.oncomplete = () => {
|
|
1164
|
+
this.enforceQuota().then(resolve).catch(resolve);
|
|
1165
|
+
};
|
|
1166
|
+
tx.onerror = () => reject(tx.error);
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Read and decompress a single session by ID.
|
|
1171
|
+
*/
|
|
1172
|
+
async getSession(sessionId) {
|
|
1173
|
+
const db = await this.openDb();
|
|
1174
|
+
return new Promise((resolve, reject) => {
|
|
1175
|
+
const tx = db.transaction(STORE_NAME, 'readonly');
|
|
1176
|
+
const store = tx.objectStore(STORE_NAME);
|
|
1177
|
+
const req = store.get(sessionId);
|
|
1178
|
+
req.onsuccess = async () => {
|
|
1179
|
+
if (!req.result) {
|
|
1180
|
+
resolve(null);
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
try {
|
|
1184
|
+
const json = await this.decompress(req.result.data);
|
|
1185
|
+
resolve(JSON.parse(json));
|
|
1186
|
+
}
|
|
1187
|
+
catch (e) {
|
|
1188
|
+
reject(e);
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
req.onerror = () => reject(req.error);
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Get all stored sessions (decompressed).
|
|
1196
|
+
*/
|
|
1197
|
+
async getAllSessions() {
|
|
1198
|
+
const db = await this.openDb();
|
|
1199
|
+
return new Promise((resolve, reject) => {
|
|
1200
|
+
const tx = db.transaction(STORE_NAME, 'readonly');
|
|
1201
|
+
const store = tx.objectStore(STORE_NAME);
|
|
1202
|
+
const req = store.getAll();
|
|
1203
|
+
req.onsuccess = async () => {
|
|
1204
|
+
try {
|
|
1205
|
+
const sessions = [];
|
|
1206
|
+
for (const record of req.result) {
|
|
1207
|
+
const json = await this.decompress(record.data);
|
|
1208
|
+
sessions.push(JSON.parse(json));
|
|
1209
|
+
}
|
|
1210
|
+
resolve(sessions);
|
|
1211
|
+
}
|
|
1212
|
+
catch (e) {
|
|
1213
|
+
reject(e);
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
req.onerror = () => reject(req.error);
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Get all sessions for a given fingerprint.
|
|
1221
|
+
*/
|
|
1222
|
+
async getSessionsByFingerprint(fingerprint) {
|
|
1223
|
+
const db = await this.openDb();
|
|
1224
|
+
return new Promise((resolve, reject) => {
|
|
1225
|
+
const tx = db.transaction(STORE_NAME, 'readonly');
|
|
1226
|
+
const store = tx.objectStore(STORE_NAME);
|
|
1227
|
+
const index = store.index('fingerprint');
|
|
1228
|
+
const req = index.getAll(fingerprint);
|
|
1229
|
+
req.onsuccess = async () => {
|
|
1230
|
+
try {
|
|
1231
|
+
const sessions = [];
|
|
1232
|
+
for (const record of req.result) {
|
|
1233
|
+
const json = await this.decompress(record.data);
|
|
1234
|
+
sessions.push(JSON.parse(json));
|
|
1235
|
+
}
|
|
1236
|
+
resolve(sessions);
|
|
1237
|
+
}
|
|
1238
|
+
catch (e) {
|
|
1239
|
+
reject(e);
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
req.onerror = () => reject(req.error);
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Generate a downloadable JSONL Blob of all sessions.
|
|
1247
|
+
* Each line is one JSON-serialised session (decompressed).
|
|
1248
|
+
*/
|
|
1249
|
+
async exportDump() {
|
|
1250
|
+
const sessions = await this.getAllSessions();
|
|
1251
|
+
const lines = sessions.map((s) => JSON.stringify(s)).join('\n');
|
|
1252
|
+
return new Blob([lines], { type: 'application/x-ndjson' });
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Delete all stored sessions.
|
|
1256
|
+
*/
|
|
1257
|
+
async clearAll() {
|
|
1258
|
+
const db = await this.openDb();
|
|
1259
|
+
return new Promise((resolve, reject) => {
|
|
1260
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
1261
|
+
const store = tx.objectStore(STORE_NAME);
|
|
1262
|
+
store.clear();
|
|
1263
|
+
tx.oncomplete = () => resolve();
|
|
1264
|
+
tx.onerror = () => reject(tx.error);
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
// ─── Quota enforcement ─────────────────────────────────────────────
|
|
1268
|
+
/**
|
|
1269
|
+
* Prune oldest sessions until total stored size is under `maxStorageMb`.
|
|
1270
|
+
* @internal
|
|
1271
|
+
*/
|
|
1272
|
+
async enforceQuota() {
|
|
1273
|
+
const db = await this.openDb();
|
|
1274
|
+
const maxBytes = this.maxStorageMb * 1024 * 1024;
|
|
1275
|
+
return new Promise((resolve, reject) => {
|
|
1276
|
+
const tx = db.transaction(STORE_NAME, 'readwrite');
|
|
1277
|
+
const store = tx.objectStore(STORE_NAME);
|
|
1278
|
+
const index = store.index('startedAt');
|
|
1279
|
+
// Collect all records sorted by startedAt (ascending = oldest first)
|
|
1280
|
+
const cursorReq = index.openCursor();
|
|
1281
|
+
const records = [];
|
|
1282
|
+
let totalSize = 0;
|
|
1283
|
+
cursorReq.onsuccess = () => {
|
|
1284
|
+
const cursor = cursorReq.result;
|
|
1285
|
+
if (cursor) {
|
|
1286
|
+
const size = cursor.value.sizeBytes || 0;
|
|
1287
|
+
totalSize += size;
|
|
1288
|
+
records.push({ key: cursor.primaryKey, size });
|
|
1289
|
+
cursor.continue();
|
|
1290
|
+
}
|
|
1291
|
+
else {
|
|
1292
|
+
// Cursor exhausted — prune if over quota
|
|
1293
|
+
if (totalSize <= maxBytes) {
|
|
1294
|
+
resolve();
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
let freed = 0;
|
|
1298
|
+
const target = totalSize - maxBytes;
|
|
1299
|
+
for (const record of records) {
|
|
1300
|
+
if (freed >= target)
|
|
1301
|
+
break;
|
|
1302
|
+
store.delete(record.key);
|
|
1303
|
+
freed += record.size;
|
|
1304
|
+
}
|
|
1305
|
+
resolve();
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
cursorReq.onerror = () => reject(cursorReq.error);
|
|
1309
|
+
tx.onerror = () => reject(tx.error);
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1313
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxStorageService, providedIn: 'root' }); }
|
|
1314
|
+
}
|
|
1315
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxStorageService, decorators: [{
|
|
1316
|
+
type: Injectable,
|
|
1317
|
+
args: [{ providedIn: 'root' }]
|
|
1318
|
+
}] });
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* @module ng-ui-system/blackbox
|
|
1322
|
+
* Core BlackBox observability service — the main entry point for session
|
|
1323
|
+
* recording, event buffering, and export.
|
|
1324
|
+
*
|
|
1325
|
+
* Architecture:
|
|
1326
|
+
* - Root singleton (`providedIn: 'root'`)
|
|
1327
|
+
* - On first inject: generates fingerprint, creates session, subscribes to Router events
|
|
1328
|
+
* - Centralised in-memory buffer with periodic/threshold-based flush to IndexedDB
|
|
1329
|
+
* - `window:beforeunload` triggers a final best-effort async flush
|
|
1330
|
+
*/
|
|
1331
|
+
/**
|
|
1332
|
+
* Central BlackBox observability service.
|
|
1333
|
+
*
|
|
1334
|
+
* Records navigation, UI interactions, form events, and HTTP calls
|
|
1335
|
+
* into compressed sessions stored in IndexedDB.
|
|
1336
|
+
*
|
|
1337
|
+
* @usageNotes
|
|
1338
|
+
* The service activates automatically when injected. Provide it at root level
|
|
1339
|
+
* and it will start recording immediately.
|
|
1340
|
+
*
|
|
1341
|
+
* ```typescript
|
|
1342
|
+
* // app.config.ts — just importing the service is enough
|
|
1343
|
+
* import { UiBlackboxService } from '@gnggln/ng-ui-system';
|
|
1344
|
+
*
|
|
1345
|
+
* export const appConfig: ApplicationConfig = {
|
|
1346
|
+
* providers: [
|
|
1347
|
+
* // The service is providedIn: 'root', so it's auto-provided.
|
|
1348
|
+
* // To force eager initialisation:
|
|
1349
|
+
* { provide: APP_INITIALIZER, useFactory: () => () => inject(UiBlackboxService), multi: true },
|
|
1350
|
+
* ],
|
|
1351
|
+
* };
|
|
1352
|
+
* ```
|
|
1353
|
+
*/
|
|
1354
|
+
class UiBlackboxService {
|
|
1355
|
+
constructor() {
|
|
1356
|
+
this.platformId = inject(PLATFORM_ID);
|
|
1357
|
+
this.router = inject(Router);
|
|
1358
|
+
this.zone = inject(NgZone);
|
|
1359
|
+
this.fingerprint = inject(UiBlackboxFingerprintService);
|
|
1360
|
+
this.storage = inject(UiBlackboxStorageService);
|
|
1361
|
+
this.destroy$ = new Subject();
|
|
1362
|
+
this.config = { ...UI_BLACKBOX_DEFAULTS };
|
|
1363
|
+
this.currentStep = null;
|
|
1364
|
+
this.initialised = false;
|
|
1365
|
+
// ─── Centralised event buffer ──────────────────────────────────────
|
|
1366
|
+
this.buffer = [];
|
|
1367
|
+
this.flushTimerId = null;
|
|
1368
|
+
this.beforeUnloadHandler = null;
|
|
1369
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1370
|
+
this.init();
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
// ─── Initialisation ────────────────────────────────────────────────
|
|
1374
|
+
async init() {
|
|
1375
|
+
// Generate session ID
|
|
1376
|
+
const sessionId = this.generateUuid();
|
|
1377
|
+
const fp = await this.fingerprint.getFingerprint();
|
|
1378
|
+
this.session = {
|
|
1379
|
+
sessionId,
|
|
1380
|
+
fingerprint: fp,
|
|
1381
|
+
startedAt: Date.now(),
|
|
1382
|
+
userAgent: navigator.userAgent,
|
|
1383
|
+
steps: [],
|
|
1384
|
+
formEvents: [],
|
|
1385
|
+
calls: [],
|
|
1386
|
+
};
|
|
1387
|
+
// Create initial step from current URL
|
|
1388
|
+
this.currentStep = {
|
|
1389
|
+
timestamp: Date.now(),
|
|
1390
|
+
route: this.router.url,
|
|
1391
|
+
actions: [],
|
|
1392
|
+
};
|
|
1393
|
+
this.session.steps.push(this.currentStep);
|
|
1394
|
+
// Subscribe to router navigation
|
|
1395
|
+
this.router.events
|
|
1396
|
+
.pipe(filter((e) => e instanceof NavigationEnd), takeUntil(this.destroy$))
|
|
1397
|
+
.subscribe((event) => {
|
|
1398
|
+
const previousRoute = this.currentStep?.route;
|
|
1399
|
+
this.currentStep = {
|
|
1400
|
+
timestamp: Date.now(),
|
|
1401
|
+
route: event.urlAfterRedirects,
|
|
1402
|
+
previousRoute,
|
|
1403
|
+
actions: [],
|
|
1404
|
+
};
|
|
1405
|
+
this.pushBufferEvent({ kind: 'step', payload: this.currentStep });
|
|
1406
|
+
});
|
|
1407
|
+
// Setup periodic flush (outside Angular zone to avoid triggering CD)
|
|
1408
|
+
this.zone.runOutsideAngular(() => {
|
|
1409
|
+
this.flushTimerId = setInterval(() => this.flush(), this.config.flushIntervalMs);
|
|
1410
|
+
// Best-effort flush on tab close (IndexedDB is async, no sync fallback)
|
|
1411
|
+
this.beforeUnloadHandler = () => {
|
|
1412
|
+
this.session.endedAt = Date.now();
|
|
1413
|
+
void this.flush();
|
|
1414
|
+
};
|
|
1415
|
+
window.addEventListener('beforeunload', this.beforeUnloadHandler);
|
|
1416
|
+
});
|
|
1417
|
+
this.initialised = true;
|
|
1418
|
+
}
|
|
1419
|
+
// ─── Public API: Configuration ─────────────────────────────────────
|
|
1420
|
+
/**
|
|
1421
|
+
* Update the BlackBox configuration.
|
|
1422
|
+
* Can be called at any time; changes take effect immediately.
|
|
1423
|
+
*/
|
|
1424
|
+
configure(config) {
|
|
1425
|
+
this.config = {
|
|
1426
|
+
...this.config,
|
|
1427
|
+
...config,
|
|
1428
|
+
formTracking: {
|
|
1429
|
+
...this.config.formTracking,
|
|
1430
|
+
...(config.formTracking ?? {}),
|
|
1431
|
+
},
|
|
1432
|
+
};
|
|
1433
|
+
this.storage.setMaxStorageMb(this.config.maxStorageMb);
|
|
1434
|
+
// Restart flush timer with new interval
|
|
1435
|
+
if (this.flushTimerId !== null) {
|
|
1436
|
+
clearInterval(this.flushTimerId);
|
|
1437
|
+
this.zone.runOutsideAngular(() => {
|
|
1438
|
+
this.flushTimerId = setInterval(() => this.flush(), this.config.flushIntervalMs);
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
/** Returns the current configuration (readonly snapshot). */
|
|
1443
|
+
getConfig() {
|
|
1444
|
+
return { ...this.config };
|
|
1445
|
+
}
|
|
1446
|
+
// ─── Public API: Tracking ──────────────────────────────────────────
|
|
1447
|
+
/**
|
|
1448
|
+
* Manually track a UI action (click).
|
|
1449
|
+
*
|
|
1450
|
+
* Called automatically by `UiButtonAreaComponent` and the `[uiTrack]` directive.
|
|
1451
|
+
* Can also be called programmatically for custom interactions.
|
|
1452
|
+
*
|
|
1453
|
+
* @param trackId - Identifier for the action (e.g. button id, link name).
|
|
1454
|
+
* @param meta - Optional metadata: `tag`, `text`, `id` of the element.
|
|
1455
|
+
*/
|
|
1456
|
+
trackAction(trackId, meta) {
|
|
1457
|
+
if (!this.initialised)
|
|
1458
|
+
return;
|
|
1459
|
+
const action = {
|
|
1460
|
+
timestamp: Date.now(),
|
|
1461
|
+
type: 'click',
|
|
1462
|
+
target: {
|
|
1463
|
+
tag: meta?.tag ?? 'unknown',
|
|
1464
|
+
id: meta?.id,
|
|
1465
|
+
trackId,
|
|
1466
|
+
text: meta?.text?.substring(0, 50),
|
|
1467
|
+
},
|
|
1468
|
+
};
|
|
1469
|
+
// Add to current step immediately (for in-memory session access)
|
|
1470
|
+
this.currentStep?.actions.push(action);
|
|
1471
|
+
// Also push to buffer for persistence
|
|
1472
|
+
this.pushBufferEvent({
|
|
1473
|
+
kind: 'action',
|
|
1474
|
+
payload: { ...action, route: this.currentStep?.route ?? this.router.url },
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Track a form interaction event.
|
|
1479
|
+
*
|
|
1480
|
+
* Called automatically by `UiFormBuilderComponent` when the BlackBox
|
|
1481
|
+
* service is available.
|
|
1482
|
+
*/
|
|
1483
|
+
trackFormEvent(event) {
|
|
1484
|
+
if (!this.initialised)
|
|
1485
|
+
return;
|
|
1486
|
+
this.session.formEvents.push(event);
|
|
1487
|
+
this.pushBufferEvent({ kind: 'formEvent', payload: event });
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Track an intercepted HTTP call.
|
|
1491
|
+
* Called by `UiBlackboxInterceptor`.
|
|
1492
|
+
* @internal
|
|
1493
|
+
*/
|
|
1494
|
+
trackHttpCall(call) {
|
|
1495
|
+
if (!this.initialised)
|
|
1496
|
+
return;
|
|
1497
|
+
this.session.calls.push(call);
|
|
1498
|
+
this.pushBufferEvent({ kind: 'httpCall', payload: call });
|
|
1499
|
+
}
|
|
1500
|
+
// ─── Public API: Session access ────────────────────────────────────
|
|
1501
|
+
/**
|
|
1502
|
+
* Returns the current in-memory session (live, not yet flushed).
|
|
1503
|
+
* Useful for debugging or real-time inspection.
|
|
1504
|
+
*/
|
|
1505
|
+
getCurrentSession() {
|
|
1506
|
+
return this.session;
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Retrieve all sessions stored in IndexedDB (decompressed).
|
|
1510
|
+
*/
|
|
1511
|
+
async getSessionHistory() {
|
|
1512
|
+
return this.storage.getAllSessions();
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Retrieve sessions for the current device fingerprint.
|
|
1516
|
+
*/
|
|
1517
|
+
async getSessionsForDevice() {
|
|
1518
|
+
const fp = await this.fingerprint.getFingerprint();
|
|
1519
|
+
return this.storage.getSessionsByFingerprint(fp);
|
|
1520
|
+
}
|
|
1521
|
+
// ─── Public API: Export ────────────────────────────────────────────
|
|
1522
|
+
/**
|
|
1523
|
+
* Export all sessions as a downloadable JSONL Blob.
|
|
1524
|
+
*
|
|
1525
|
+
* @returns A Blob containing JSONL data (one session per line).
|
|
1526
|
+
*
|
|
1527
|
+
* @example
|
|
1528
|
+
* ```typescript
|
|
1529
|
+
* const blob = await blackbox.exportSessions();
|
|
1530
|
+
* const url = URL.createObjectURL(blob);
|
|
1531
|
+
* const a = document.createElement('a');
|
|
1532
|
+
* a.href = url;
|
|
1533
|
+
* a.download = 'blackbox-sessions.jsonl';
|
|
1534
|
+
* a.click();
|
|
1535
|
+
* ```
|
|
1536
|
+
*/
|
|
1537
|
+
async exportSessions() {
|
|
1538
|
+
// Flush current session first
|
|
1539
|
+
await this.flush();
|
|
1540
|
+
return this.storage.exportDump();
|
|
1541
|
+
}
|
|
1542
|
+
// ─── Public API: Lifecycle ─────────────────────────────────────────
|
|
1543
|
+
/**
|
|
1544
|
+
* Explicitly end the current session.
|
|
1545
|
+
* Flushes all buffered events and marks the session as ended.
|
|
1546
|
+
*/
|
|
1547
|
+
async endSession() {
|
|
1548
|
+
if (!this.initialised)
|
|
1549
|
+
return;
|
|
1550
|
+
this.session.endedAt = Date.now();
|
|
1551
|
+
await this.flush();
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Clear all stored sessions from IndexedDB.
|
|
1555
|
+
*/
|
|
1556
|
+
async clearHistory() {
|
|
1557
|
+
return this.storage.clearAll();
|
|
1558
|
+
}
|
|
1559
|
+
// ─── Buffer management ─────────────────────────────────────────────
|
|
1560
|
+
/**
|
|
1561
|
+
* Push an event into the centralised buffer.
|
|
1562
|
+
* Triggers an immediate flush if the buffer exceeds the threshold.
|
|
1563
|
+
* @internal
|
|
1564
|
+
*/
|
|
1565
|
+
pushBufferEvent(event) {
|
|
1566
|
+
this.buffer.push(event);
|
|
1567
|
+
if (this.buffer.length >= this.config.flushThreshold) {
|
|
1568
|
+
this.flush();
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Flush buffered events to IndexedDB asynchronously.
|
|
1573
|
+
* @internal
|
|
1574
|
+
*/
|
|
1575
|
+
async flush() {
|
|
1576
|
+
if (!this.initialised || this.buffer.length === 0)
|
|
1577
|
+
return;
|
|
1578
|
+
// Drain buffer
|
|
1579
|
+
const events = this.buffer.splice(0);
|
|
1580
|
+
// Apply step events to the session
|
|
1581
|
+
for (const event of events) {
|
|
1582
|
+
if (event.kind === 'step') {
|
|
1583
|
+
// Steps are already pushed in real-time; ensure they're in the session
|
|
1584
|
+
if (!this.session.steps.includes(event.payload)) {
|
|
1585
|
+
this.session.steps.push(event.payload);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
// Actions, formEvents, httpCalls are already pushed in real-time
|
|
1589
|
+
// to the in-memory session by trackAction/trackFormEvent/trackHttpCall
|
|
1590
|
+
}
|
|
1591
|
+
// Save the full session snapshot
|
|
1592
|
+
try {
|
|
1593
|
+
await this.storage.saveSession(this.session);
|
|
1594
|
+
}
|
|
1595
|
+
catch (e) {
|
|
1596
|
+
// storage error — re-enqueue events for next flush
|
|
1597
|
+
console.warn('[UiBlackbox] Storage flush failed:', e);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
// ─── Utilities ─────────────────────────────────────────────────────
|
|
1601
|
+
/** Generate a UUID v4. */
|
|
1602
|
+
generateUuid() {
|
|
1603
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
1604
|
+
return crypto.randomUUID();
|
|
1605
|
+
}
|
|
1606
|
+
// Fallback for older browsers
|
|
1607
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
1608
|
+
const r = (Math.random() * 16) | 0;
|
|
1609
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
1610
|
+
return v.toString(16);
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
// ─── Cleanup ───────────────────────────────────────────────────────
|
|
1614
|
+
ngOnDestroy() {
|
|
1615
|
+
this.destroy$.next();
|
|
1616
|
+
this.destroy$.complete();
|
|
1617
|
+
if (this.flushTimerId !== null) {
|
|
1618
|
+
clearInterval(this.flushTimerId);
|
|
1619
|
+
}
|
|
1620
|
+
if (this.beforeUnloadHandler) {
|
|
1621
|
+
window.removeEventListener('beforeunload', this.beforeUnloadHandler);
|
|
1622
|
+
}
|
|
1623
|
+
// Final flush
|
|
1624
|
+
void this.flush();
|
|
1625
|
+
}
|
|
1626
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1627
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxService, providedIn: 'root' }); }
|
|
1628
|
+
}
|
|
1629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiBlackboxService, decorators: [{
|
|
1630
|
+
type: Injectable,
|
|
1631
|
+
args: [{ providedIn: 'root' }]
|
|
1632
|
+
}], ctorParameters: () => [] });
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* @module ng-ui-system/http
|
|
1636
|
+
* Central HTTP orchestration service.
|
|
1637
|
+
*
|
|
1638
|
+
* Wraps Angular's `HttpClient` with an automatic pipeline:
|
|
1639
|
+
* - Loader activation via `UiLayoutService`
|
|
1640
|
+
* - Success / error toasts via `UiToastService`
|
|
1641
|
+
* - Debounced toast messages to prevent spam
|
|
1642
|
+
* - Optional BlackBox tracking of every call
|
|
1643
|
+
* - Pluggable custom headers via `UiHeadersProvider`
|
|
1644
|
+
*
|
|
1645
|
+
* @usageNotes
|
|
1646
|
+
* ### Basic GET
|
|
1647
|
+
* ```typescript
|
|
1648
|
+
* const http = inject(UiHttpService);
|
|
1649
|
+
* const endpoint: UiEndpoint = {
|
|
1650
|
+
* url: '/api/users',
|
|
1651
|
+
* id: 'users_list',
|
|
1652
|
+
* };
|
|
1653
|
+
* http.get<User[]>(endpoint).subscribe(users => { ... });
|
|
1654
|
+
* ```
|
|
1655
|
+
*
|
|
1656
|
+
* ### POST with success toast
|
|
1657
|
+
* ```typescript
|
|
1658
|
+
* const endpoint: UiEndpoint = {
|
|
1659
|
+
* url: '/api/users',
|
|
1660
|
+
* id: 'users_create',
|
|
1661
|
+
* showSuccess: true,
|
|
1662
|
+
* messages: { success: 'Utente creato!' },
|
|
1663
|
+
* };
|
|
1664
|
+
* http.post<User>(endpoint, payload).subscribe();
|
|
1665
|
+
* ```
|
|
1666
|
+
*
|
|
1667
|
+
* ### Custom headers provider
|
|
1668
|
+
* ```typescript
|
|
1669
|
+
* // app.config.ts
|
|
1670
|
+
* { provide: UI_HEADERS_PROVIDER, useClass: MyAuthHeaders }
|
|
1671
|
+
* ```
|
|
1672
|
+
*/
|
|
1673
|
+
/**
|
|
1674
|
+
* Central HTTP service with automatic loader, toast, and error handling.
|
|
1675
|
+
*
|
|
1676
|
+
* All toast flags default to `false` — enable them per-endpoint via
|
|
1677
|
+
* `showSuccess: true` and/or `showError: true`.
|
|
1678
|
+
*/
|
|
1679
|
+
class UiHttpService {
|
|
1680
|
+
constructor() {
|
|
1681
|
+
this.http = inject(HttpClient);
|
|
1682
|
+
this.messageHandler = inject(UiHttpMessageHandler);
|
|
1683
|
+
this.config = inject(UI_HTTP_CONFIG, { optional: true });
|
|
1684
|
+
this.headersProvider = inject(UI_HEADERS_PROVIDER, { optional: true });
|
|
1685
|
+
this.blackbox = inject(UiBlackboxService, { optional: true });
|
|
1686
|
+
}
|
|
1687
|
+
/** Resolved base URL from config token. */
|
|
1688
|
+
get baseUrl() {
|
|
1689
|
+
return this.config?.baseUrl ?? '';
|
|
1690
|
+
}
|
|
1691
|
+
// ── HTTP Methods ───────────────────────────────────────────────────
|
|
1692
|
+
/** Execute a **GET** request. */
|
|
1693
|
+
get(endpoint, options = {}) {
|
|
1694
|
+
return this._request('GET', endpoint, null, options);
|
|
1695
|
+
}
|
|
1696
|
+
/** Execute a **POST** request. */
|
|
1697
|
+
post(endpoint, body, options = {}) {
|
|
1698
|
+
return this._request('POST', endpoint, body, options);
|
|
1699
|
+
}
|
|
1700
|
+
/** Execute a **PUT** request. */
|
|
1701
|
+
put(endpoint, body, options = {}) {
|
|
1702
|
+
return this._request('PUT', endpoint, body, options);
|
|
1703
|
+
}
|
|
1704
|
+
/** Execute a **PATCH** request. */
|
|
1705
|
+
patch(endpoint, body, options = {}) {
|
|
1706
|
+
return this._request('PATCH', endpoint, body, options);
|
|
1707
|
+
}
|
|
1708
|
+
/** Execute a **DELETE** request. */
|
|
1709
|
+
delete(endpoint, body, options = {}) {
|
|
1710
|
+
return this._request('DELETE', endpoint, body ?? null, options);
|
|
1711
|
+
}
|
|
1712
|
+
/**
|
|
1713
|
+
* Download a **binary file** (Blob).
|
|
1714
|
+
*
|
|
1715
|
+
* Applies the same loader / toast pipeline as JSON requests.
|
|
1716
|
+
*/
|
|
1717
|
+
download(endpoint, options = {}) {
|
|
1718
|
+
const headers = this.buildHeaders(options.headers);
|
|
1719
|
+
const requestOptions = {
|
|
1720
|
+
headers,
|
|
1721
|
+
params: options.params,
|
|
1722
|
+
observe: 'body',
|
|
1723
|
+
responseType: 'blob',
|
|
1724
|
+
};
|
|
1725
|
+
const url = this.baseUrl + endpoint.url;
|
|
1726
|
+
const startTime = Date.now();
|
|
1727
|
+
const observable = this.http.get(url, requestOptions);
|
|
1728
|
+
return this._handleRequest(observable, endpoint, 'GET', url, startTime);
|
|
1729
|
+
}
|
|
1730
|
+
// ── Manual controls ────────────────────────────────────────────────
|
|
1731
|
+
/** Show a custom success toast (not tied to an endpoint). */
|
|
1732
|
+
showCustomSuccess(message) {
|
|
1733
|
+
this.messageHandler.showCustomSuccess(message);
|
|
1734
|
+
}
|
|
1735
|
+
/** Show a custom error toast (not tied to an endpoint). */
|
|
1736
|
+
showCustomError(message) {
|
|
1737
|
+
this.messageHandler.showCustomError(message);
|
|
1738
|
+
}
|
|
1739
|
+
/** Manually control the loader state. */
|
|
1740
|
+
setLoading(loading) {
|
|
1741
|
+
if (loading) {
|
|
1742
|
+
this.messageHandler.startLoading();
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
this.messageHandler.stopLoading();
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
/** Show a success toast for a specific endpoint (manual trigger). */
|
|
1749
|
+
showEndpointSuccess(endpoint) {
|
|
1750
|
+
this.messageHandler.showSuccess(endpoint);
|
|
1751
|
+
}
|
|
1752
|
+
/** Show an error toast for a specific endpoint (manual trigger). */
|
|
1753
|
+
showEndpointError(endpoint, error, fallbackMessage) {
|
|
1754
|
+
this.messageHandler.showError(endpoint, error, fallbackMessage);
|
|
1755
|
+
}
|
|
1756
|
+
/** Cancel all pending debounce timeouts. */
|
|
1757
|
+
clearAllToastTimeouts() {
|
|
1758
|
+
this.messageHandler.clearAllTimeouts();
|
|
1759
|
+
}
|
|
1760
|
+
// ── Internals ──────────────────────────────────────────────────────
|
|
1761
|
+
/**
|
|
1762
|
+
* Generic JSON request handler.
|
|
1763
|
+
* Builds headers, serialises body, and pipes through the common pipeline.
|
|
1764
|
+
*/
|
|
1765
|
+
_request(method, endpoint, body, options) {
|
|
1766
|
+
const headers = this.buildHeaders(options.headers);
|
|
1767
|
+
const url = this.baseUrl + endpoint.url;
|
|
1768
|
+
const startTime = Date.now();
|
|
1769
|
+
const requestOptions = {
|
|
1770
|
+
headers,
|
|
1771
|
+
params: options.params,
|
|
1772
|
+
body: body != null ? JSON.stringify(body) : undefined,
|
|
1773
|
+
observe: 'body',
|
|
1774
|
+
};
|
|
1775
|
+
const observable = this.http.request(method, url, requestOptions);
|
|
1776
|
+
return this._handleRequest(observable, endpoint, method, url, startTime);
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Common pipeline applied to every HTTP request:
|
|
1780
|
+
* 1. Start loader
|
|
1781
|
+
* 2. On success → show success toast
|
|
1782
|
+
* 3. On error → show error toast, log, re-throw
|
|
1783
|
+
* 4. Always stop loader
|
|
1784
|
+
* 5. Track in BlackBox (if available and endpoint is trackable)
|
|
1785
|
+
*/
|
|
1786
|
+
_handleRequest(observable, endpoint, method, url, startTime) {
|
|
1787
|
+
this.messageHandler.startLoading();
|
|
1788
|
+
return observable.pipe(map((response) => {
|
|
1789
|
+
this.messageHandler.showSuccess(endpoint);
|
|
1790
|
+
this.trackBlackbox(method, url, startTime, 200, endpoint);
|
|
1791
|
+
return response;
|
|
1792
|
+
}), catchError((error) => {
|
|
1793
|
+
this.handleErrors(error, endpoint);
|
|
1794
|
+
this.trackBlackbox(method, url, startTime, error.status ?? 0, endpoint);
|
|
1795
|
+
return throwError(() => error);
|
|
1796
|
+
}), finalize(() => this.messageHandler.stopLoading()));
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Build the final HttpHeaders by merging:
|
|
1800
|
+
* 1. Default headers from config
|
|
1801
|
+
* 2. Custom headers from UiHeadersProvider
|
|
1802
|
+
* 3. Per-request headers
|
|
1803
|
+
*/
|
|
1804
|
+
buildHeaders(requestHeaders) {
|
|
1805
|
+
const defaults = {
|
|
1806
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
1807
|
+
...(this.config?.defaultHeaders ?? {}),
|
|
1808
|
+
};
|
|
1809
|
+
// Apply custom headers from provider
|
|
1810
|
+
const custom = this.headersProvider?.getHeaders() ?? {};
|
|
1811
|
+
let headers = new HttpHeaders({ ...defaults, ...custom });
|
|
1812
|
+
// Merge per-request headers
|
|
1813
|
+
if (requestHeaders) {
|
|
1814
|
+
requestHeaders.keys().forEach(key => {
|
|
1815
|
+
const value = requestHeaders.get(key);
|
|
1816
|
+
if (value !== null) {
|
|
1817
|
+
headers = headers.set(key, value);
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
return headers;
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Centralised error handling.
|
|
1825
|
+
* Logs the error and delegates toast display to the message handler.
|
|
1826
|
+
*/
|
|
1827
|
+
handleErrors(error, endpoint) {
|
|
1828
|
+
console.error(`[UiHttpService] API Error (${error.status}):`, error.url, error);
|
|
1829
|
+
this.messageHandler.showError(endpoint, error, 'Si è verificato un errore imprevisto');
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Track the HTTP call in BlackBox if the service is available
|
|
1833
|
+
* and the endpoint hasn't opted out.
|
|
1834
|
+
*/
|
|
1835
|
+
trackBlackbox(method, url, startTime, status, endpoint) {
|
|
1836
|
+
if (!this.blackbox || endpoint.trackable === false)
|
|
1837
|
+
return;
|
|
1838
|
+
this.blackbox.trackHttpCall({
|
|
1839
|
+
timestamp: startTime,
|
|
1840
|
+
method,
|
|
1841
|
+
url,
|
|
1842
|
+
status,
|
|
1843
|
+
durationMs: Date.now() - startTime,
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiHttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1847
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiHttpService, providedIn: 'root' }); }
|
|
1848
|
+
}
|
|
1849
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UiHttpService, decorators: [{
|
|
1850
|
+
type: Injectable,
|
|
1851
|
+
args: [{ providedIn: 'root' }]
|
|
1852
|
+
}] });
|
|
1853
|
+
|
|
1854
|
+
/**
|
|
1855
|
+
* ng-ui-system — HTTP Orchestration Service entry point.
|
|
1856
|
+
*
|
|
1857
|
+
* @example
|
|
1858
|
+
* ```typescript
|
|
1859
|
+
* import {
|
|
1860
|
+
* UiHttpService,
|
|
1861
|
+
* UiHttpMessageHandler,
|
|
1862
|
+
* UI_HTTP_CONFIG,
|
|
1863
|
+
* UI_HEADERS_PROVIDER,
|
|
1864
|
+
* } from '@gnggln/ng-ui-system';
|
|
1865
|
+
* ```
|
|
1866
|
+
*/
|
|
1867
|
+
// Services
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Bootstrap del secondary entry `@gnggln/ng-ui-system/http`. Servizio HTTP e tipi endpoint.
|
|
1871
|
+
*/
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Generated bundle index. Do not edit.
|
|
1875
|
+
*/
|
|
1876
|
+
|
|
1877
|
+
export { UI_HEADERS_PROVIDER, UI_HTTP_CONFIG, UiHttpMessageHandler, UiHttpService };
|
|
1878
|
+
//# sourceMappingURL=gnggln-ng-ui-system-http.mjs.map
|