@sdcorejs/angular 19.3.2 → 19.3.3
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/assets/THEME.md +58 -6
- package/assets/scss/core/form.scss +291 -3
- package/assets/scss/themes/_component-tokens.scss +35 -6
- package/components/badge/index.d.ts +1 -0
- package/components/badge/src/badge.model.d.ts +19 -0
- package/components/section/index.d.ts +1 -0
- package/components/section/src/section-registry.d.ts +11 -0
- package/components/splitter/index.d.ts +1 -1
- package/components/tab-router/src/actions/tab-router.action.d.ts +1 -1
- package/components/tab-router/src/components/tab-router-item/tab-router-item.component.d.ts +4 -2
- package/components/tab-router/src/components/tab-router-nav/tab-router-nav.component.d.ts +31 -3
- package/components/tab-router/src/components/tab-router-outlet/tab-router-outlet.component.d.ts +6 -1
- package/components/tab-router/src/models/tab-router.model.d.ts +5 -0
- package/components/tab-router/src/pipes/tab-info.pipe.d.ts +7 -0
- package/components/tab-router/src/services/tab-router.service.d.ts +5 -0
- package/components/table/index.d.ts +2 -0
- package/components/table/src/components/filter/external-filter/external-filter.component.d.ts +5 -1
- package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +4 -0
- package/components/table/src/configurations/index.d.ts +1 -0
- package/components/table/src/configurations/table-layout.d.ts +16 -0
- package/components/table/src/configurations/table.configuration.d.ts +3 -1
- package/components/table/src/models/index.d.ts +1 -0
- package/components/table/src/models/table-column.model.d.ts +3 -10
- package/components/table/src/models/table-item.model.d.ts +4 -1
- package/components/table/src/models/table-option-loading.model.d.ts +42 -0
- package/components/table/src/models/table-option.model.d.ts +6 -0
- package/components/table/src/services/table-filter/table-filter.model.d.ts +5 -0
- package/components/table/src/services/table-loading/table-loading.util.d.ts +91 -0
- package/components/table/src/services/tree/tree.util.d.ts +2 -0
- package/components/table/src/table.component.d.ts +23 -0
- package/components/upload-file/src/components/file-type-icon/file-type-icon.component.d.ts +15 -0
- package/components/upload-file/src/components/preview/preview.component.d.ts +88 -10
- package/components/upload-file/src/configurations/upload-file.configuration.d.ts +1 -1
- package/components/upload-file/src/helpers/file-type.d.ts +25 -0
- package/components/upload-file/src/pipes/file-meta.pipe.d.ts +9 -0
- package/components/upload-file/src/pipes/file-reason.pipe.d.ts +11 -0
- package/components/upload-file/src/pipes/index.d.ts +2 -0
- package/components/upload-file/src/upload-file.component.d.ts +89 -8
- package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +15 -3
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +390 -75
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +443 -15
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +886 -173
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +7 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +5 -2
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +421 -121
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +17 -2
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +26 -20
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +14 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +210 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BFxO3eHX.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BFxO3eHX.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-Csy2fShj.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-Csy2fShj.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BIIxNR6k.mjs → sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BIIxNR6k.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DjDsau9C.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DjDsau9C.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +265 -10
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-CVEKaR8U.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-CVEKaR8U.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-BqHybMk0.mjs +130 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-BqHybMk0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CND3d2zl.mjs +131 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CND3d2zl.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BbDoQccI.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BbDoQccI.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CB_wJIP8.mjs +460 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CB_wJIP8.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlP4BrhU.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlP4BrhU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-VAMePx_q.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-VAMePx_q.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-BD79VR0c.mjs +148 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-BD79VR0c.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-B1rFhbOc.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-B1rFhbOc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BhCjw6ZL.mjs +467 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BhCjw6ZL.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CnL2FzCx.mjs +90 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CnL2FzCx.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BeH-NYvE.mjs +514 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BeH-NYvE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DpnYSG2j.mjs +61 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DpnYSG2j.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-1bi0JZdf.mjs +170 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-1bi0JZdf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs +87 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs +70 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-BAZLCVci.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-BAZLCVci.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-ikk0cK1M.mjs +522 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-ikk0cK1M.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Cex41xzy.mjs +164 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Cex41xzy.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-D643jEmo.mjs +629 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-D643jEmo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DTWHhNNl.mjs +71 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DTWHhNNl.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-YJUJsrIZ.mjs +115 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-YJUJsrIZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-qH-YO6wP.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-qH-YO6wP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-S0Vuy6Oc.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-S0Vuy6Oc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-Ba73HPGG.mjs +48 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-Ba73HPGG.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-CBlN7eEn.mjs +295 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-CBlN7eEn.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BvzFafUW.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BvzFafUW.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C3uWi8JZ.mjs +165 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C3uWi8JZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C5ELCTEw.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C5ELCTEw.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ClQwnO4h.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ClQwnO4h.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DTUxYZ6g.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DTUxYZ6g.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DpCuYBlL.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DpCuYBlL.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DwZWxmJf.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DwZWxmJf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ydOZduls.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ydOZduls.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-D3B5I9hg.mjs +406 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-D3B5I9hg.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BW-i6BHg.mjs +317 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BW-i6BHg.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-By1mYFa_.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-By1mYFa_.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DwcyKb4j.mjs +143 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DwcyKb4j.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BBR8360C.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BBR8360C.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CAtqPgIH.mjs +357 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CAtqPgIH.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DjMChf6s.mjs +128 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DjMChf6s.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/forms/chip/src/chip.component.d.ts +135 -19
- package/forms/chip/src/index.d.ts +0 -1
- package/i18n/src/en.d.ts +42 -0
- package/modules/layout/components/index.d.ts +2 -0
- package/modules/layout/components/page/page-form-leave.guard.d.ts +9 -0
- package/modules/layout/components/page/page.component.d.ts +38 -2
- package/modules/layout/components/page-list/page-list.component.d.ts +42 -0
- package/modules/layout/components/shared/context-switcher/context-switcher.component.d.ts +1 -1
- package/modules/pattern/README.md +76 -0
- package/modules/pattern/configurations/pattern.configuration.d.ts +30 -0
- package/modules/pattern/configurations/provide-sd-patterns.d.ts +19 -0
- package/modules/pattern/core/mock-api/mock-api.interceptor.d.ts +8 -0
- package/modules/pattern/core/mock-api/mock-api.model.d.ts +62 -0
- package/modules/pattern/core/mock-api/mock-api.state.d.ts +36 -0
- package/modules/pattern/core/mock-api/mock-backend.d.ts +18 -0
- package/modules/pattern/core/mock-api/mock-backend.factory.d.ts +3 -0
- package/modules/pattern/core/mock-api/prng.d.ts +4 -0
- package/modules/pattern/core/mock-api/resources/approval.resource.d.ts +14 -0
- package/modules/pattern/core/mock-api/resources/category.resource.d.ts +9 -0
- package/modules/pattern/core/mock-api/resources/customer.resource.d.ts +22 -0
- package/modules/pattern/core/mock-api/resources/index.d.ts +3 -0
- package/modules/pattern/core/mock-api/resources/names.d.ts +5 -0
- package/modules/pattern/core/mock-api/resources/order.resource.d.ts +44 -0
- package/modules/pattern/core/mock-api/resources/partner.resource.d.ts +16 -0
- package/modules/pattern/core/mock-api/resources/product.resource.d.ts +13 -0
- package/modules/pattern/core/mock-api/resources/settings.resource.d.ts +18 -0
- package/modules/pattern/core/pattern-shell/catalog/pattern-catalog.d.ts +22 -0
- package/modules/pattern/core/pattern-shell/index/index.component.d.ts +9 -0
- package/modules/pattern/core/pattern-shell/settings/pattern-settings.store.d.ts +57 -0
- package/modules/pattern/core/pattern-shell/settings/settings-button.component.d.ts +44 -0
- package/modules/pattern/core/pattern-shell/shell/pattern-source-viewer.d.ts +8 -0
- package/modules/pattern/core/pattern-shell/shell/shell.component.d.ts +13 -0
- package/modules/pattern/core/pattern-shell/source/pattern-source.generated.d.ts +1 -0
- package/modules/pattern/core/pattern-shell/source/source-drawer.component.d.ts +27 -0
- package/modules/pattern/core/pattern-shell/toolbar/toolbar.component.d.ts +24 -0
- package/modules/pattern/core/permission/pattern-permission.d.ts +15 -0
- package/modules/pattern/core/permission/pattern-role.store.d.ts +13 -0
- package/modules/pattern/core/session-state.d.ts +4 -0
- package/modules/pattern/docs/detail.md +237 -0
- package/modules/pattern/docs/drawer.md +484 -0
- package/modules/pattern/docs/flow.md +631 -0
- package/modules/pattern/docs/form.md +518 -0
- package/modules/pattern/docs/header-actions.md +342 -0
- package/modules/pattern/docs/list.md +247 -0
- package/modules/pattern/docs/relation.md +180 -0
- package/modules/pattern/docs/select.md +206 -0
- package/modules/pattern/docs/split.md +350 -0
- package/modules/pattern/docs/states.md +168 -0
- package/modules/pattern/features/approval/entity.resolver.d.ts +4 -0
- package/modules/pattern/features/approval/entity.resolver.ts +21 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.d.ts +13 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.d.ts +7 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
- package/modules/pattern/features/approval/pages/list/list.component.d.ts +26 -0
- package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
- package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
- package/modules/pattern/features/approval/routes.d.ts +3 -0
- package/modules/pattern/features/approval/routes.ts +30 -0
- package/modules/pattern/features/approval/services/approval.model.d.ts +37 -0
- package/modules/pattern/features/approval/services/approval.model.ts +38 -0
- package/modules/pattern/features/approval/services/approval.service.d.ts +12 -0
- package/modules/pattern/features/approval/services/approval.service.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.d.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.d.ts +20 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.d.ts +23 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
- package/modules/pattern/features/category/entity.resolver.d.ts +6 -0
- package/modules/pattern/features/category/entity.resolver.ts +27 -0
- package/modules/pattern/features/category/pages/list/list.component.d.ts +17 -0
- package/modules/pattern/features/category/pages/list/list.component.html +20 -0
- package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
- package/modules/pattern/features/category/routes.d.ts +3 -0
- package/modules/pattern/features/category/routes.ts +42 -0
- package/modules/pattern/features/category/services/category.model.d.ts +34 -0
- package/modules/pattern/features/category/services/category.model.ts +39 -0
- package/modules/pattern/features/category/services/category.service.d.ts +17 -0
- package/modules/pattern/features/category/services/category.service.ts +36 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.d.ts +24 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.d.ts +20 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.d.ts +20 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.d.ts +11 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.d.ts +20 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.d.ts +14 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.d.ts +33 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.d.ts +9 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.d.ts +11 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.d.ts +22 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.d.ts +24 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
- package/modules/pattern/features/customer/entity.resolver.d.ts +4 -0
- package/modules/pattern/features/customer/entity.resolver.ts +21 -0
- package/modules/pattern/features/customer/pages/list/list.component.d.ts +19 -0
- package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
- package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.d.ts +31 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.d.ts +14 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
- package/modules/pattern/features/customer/routes.d.ts +6 -0
- package/modules/pattern/features/customer/routes.ts +59 -0
- package/modules/pattern/features/customer/services/customer.model.d.ts +77 -0
- package/modules/pattern/features/customer/services/customer.model.ts +87 -0
- package/modules/pattern/features/customer/services/customer.service.d.ts +24 -0
- package/modules/pattern/features/customer/services/customer.service.ts +79 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.d.ts +21 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.d.ts +10 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
- package/modules/pattern/features/import/pages/flow/flow.component.d.ts +43 -0
- package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
- package/modules/pattern/features/import/routes.d.ts +2 -0
- package/modules/pattern/features/import/routes.ts +19 -0
- package/modules/pattern/features/import/services/import.model.d.ts +38 -0
- package/modules/pattern/features/import/services/import.model.ts +82 -0
- package/modules/pattern/features/import/services/import.service.d.ts +15 -0
- package/modules/pattern/features/import/services/import.service.ts +18 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.d.ts +9 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.d.ts +22 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.d.ts +30 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.d.ts +33 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.d.ts +12 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.d.ts +25 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
- package/modules/pattern/features/order/entity.resolver.d.ts +9 -0
- package/modules/pattern/features/order/entity.resolver.ts +37 -0
- package/modules/pattern/features/order/pages/create/create.component.d.ts +16 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
- package/modules/pattern/features/order/pages/detail/detail.component.d.ts +26 -0
- package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
- package/modules/pattern/features/order/pages/list/list.component.d.ts +29 -0
- package/modules/pattern/features/order/pages/list/list.component.html +38 -0
- package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
- package/modules/pattern/features/order/pages/update/update.component.d.ts +20 -0
- package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
- package/modules/pattern/features/order/routes.d.ts +7 -0
- package/modules/pattern/features/order/routes.ts +54 -0
- package/modules/pattern/features/order/services/order.model.d.ts +106 -0
- package/modules/pattern/features/order/services/order.model.ts +109 -0
- package/modules/pattern/features/order/services/order.service.d.ts +25 -0
- package/modules/pattern/features/order/services/order.service.ts +63 -0
- package/modules/pattern/features/partner/pages/create/create.component.d.ts +41 -0
- package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
- package/modules/pattern/features/partner/routes.d.ts +2 -0
- package/modules/pattern/features/partner/routes.ts +20 -0
- package/modules/pattern/features/partner/services/partner.model.d.ts +30 -0
- package/modules/pattern/features/partner/services/partner.model.ts +30 -0
- package/modules/pattern/features/partner/services/partner.service.d.ts +13 -0
- package/modules/pattern/features/partner/services/partner.service.ts +17 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.d.ts +23 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.d.ts +20 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.d.ts +22 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
- package/modules/pattern/features/product/entity.resolver.d.ts +4 -0
- package/modules/pattern/features/product/entity.resolver.ts +21 -0
- package/modules/pattern/features/product/pages/create/create.component.d.ts +15 -0
- package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
- package/modules/pattern/features/product/pages/detail/detail.component.d.ts +10 -0
- package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
- package/modules/pattern/features/product/pages/list/list.component.d.ts +15 -0
- package/modules/pattern/features/product/pages/list/list.component.html +30 -0
- package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
- package/modules/pattern/features/product/pages/update/update.component.d.ts +16 -0
- package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.d.ts +14 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
- package/modules/pattern/features/product/routes.d.ts +3 -0
- package/modules/pattern/features/product/routes.ts +48 -0
- package/modules/pattern/features/product/services/product.model.d.ts +34 -0
- package/modules/pattern/features/product/services/product.model.ts +38 -0
- package/modules/pattern/features/product/services/product.service.d.ts +17 -0
- package/modules/pattern/features/product/services/product.service.ts +48 -0
- package/modules/pattern/features/settings/pages/update/update.component.d.ts +26 -0
- package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
- package/modules/pattern/features/settings/routes.d.ts +3 -0
- package/modules/pattern/features/settings/routes.ts +24 -0
- package/modules/pattern/features/settings/services/settings.model.d.ts +17 -0
- package/modules/pattern/features/settings/services/settings.model.ts +18 -0
- package/modules/pattern/features/settings/services/settings.service.d.ts +10 -0
- package/modules/pattern/features/settings/services/settings.service.ts +15 -0
- package/modules/pattern/features/settings/settings.resolver.d.ts +4 -0
- package/modules/pattern/features/settings/settings.resolver.ts +8 -0
- package/modules/pattern/index.d.ts +3 -0
- package/modules/pattern/routes.d.ts +6 -0
- package/modules/pattern/services/base-api.service.d.ts +16 -0
- package/modules/pattern/utils/api-error.d.ts +4 -0
- package/modules/pattern/utils/focus-first-invalid.d.ts +5 -0
- package/modules/pattern/utils/form-api-errors.d.ts +16 -0
- package/modules/pattern/utils/resource-url.d.ts +2 -0
- package/package.json +13 -9
- package/services/unsaved-changes/src/unsaved-changes.adapters.d.ts +9 -0
- package/services/unsaved-changes/src/unsaved-changes.model.d.ts +2 -0
- package/forms/chip/src/pipes/index.d.ts +0 -1
- package/forms/chip/src/pipes/removable-chip.pipe.d.ts +0 -8
|
@@ -2,6 +2,7 @@ import { DOCUMENT } from '@angular/common';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, inject, DestroyRef, signal, computed, effect, Injectable, isSignal } from '@angular/core';
|
|
4
4
|
import { I18nService } from '@sdcorejs/angular/i18n';
|
|
5
|
+
import { PristineChangeEvent } from '@angular/forms';
|
|
5
6
|
|
|
6
7
|
const SD_UNSAVED_CHANGES_WINDOW = new InjectionToken('SD_UNSAVED_CHANGES_WINDOW', {
|
|
7
8
|
factory: () => inject(DOCUMENT).defaultView,
|
|
@@ -93,9 +94,10 @@ class SdUnsavedChangesService {
|
|
|
93
94
|
return existingPrompt;
|
|
94
95
|
const watchers = this.#dirtyEntries(options.scope).map(entry => entry.ref);
|
|
95
96
|
const message = watchers.find(watcher => watcher.message)?.message ?? this.#i18n.t('core.service.unsaved-changes.message');
|
|
97
|
+
const adapter = options.adapter ?? this.#adapter;
|
|
96
98
|
const run = async () => {
|
|
97
99
|
try {
|
|
98
|
-
const rawDecision = await Promise.resolve(
|
|
100
|
+
const rawDecision = await Promise.resolve(adapter.confirm({ reason: options.reason ?? 'manual', scope: options.scope, message, watchers }));
|
|
99
101
|
const decision = typeof rawDecision === 'boolean' ? (rawDecision ? 'discard' : 'cancel') : rawDecision;
|
|
100
102
|
if (decision === 'save')
|
|
101
103
|
return this.saveAll(options.scope);
|
|
@@ -183,11 +185,79 @@ function readDirty(source) {
|
|
|
183
185
|
|
|
184
186
|
function registerSdUnsavedChangesForm(service, form, options) {
|
|
185
187
|
let snapshot = cloneValue(form.getRawValue());
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
+
const valueMode = options.dirty === 'value';
|
|
189
|
+
// why: `<sd-*>` fields join the form in an effect after this call and write their model with `emitEvent: false`;
|
|
190
|
+
// some of them write a user edit without marking the control dirty, or mark it only after the value. The saved
|
|
191
|
+
// value of a control is therefore not tied to its dirty flag: it is read once the task that added the control
|
|
192
|
+
// ends (its model is in by then), and again whenever the form or the control is marked pristine.
|
|
193
|
+
const pending = new Set();
|
|
194
|
+
let settleQueued = false;
|
|
195
|
+
const keyOf = (control) => {
|
|
196
|
+
let current = control;
|
|
197
|
+
while (current && current.parent !== form)
|
|
198
|
+
current = current.parent;
|
|
199
|
+
return current ? Object.entries(form.controls).find(([, child]) => child === current)?.[0] : undefined;
|
|
200
|
+
};
|
|
201
|
+
const takeBaseline = (keys) => {
|
|
202
|
+
if (!valueMode)
|
|
203
|
+
return;
|
|
204
|
+
const value = form.getRawValue();
|
|
205
|
+
const baseline = snapshot;
|
|
206
|
+
for (const key of keys) {
|
|
207
|
+
if (key in form.controls)
|
|
208
|
+
baseline[key] = cloneValue(value[key]);
|
|
209
|
+
pending.delete(key);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const readFormDirty = () => {
|
|
213
|
+
if (!valueMode)
|
|
214
|
+
return form.dirty;
|
|
215
|
+
const value = form.getRawValue();
|
|
216
|
+
const baseline = snapshot;
|
|
217
|
+
return Object.keys(form.controls).some(key => !pending.has(key) && !sameValue(value[key], baseline[key]));
|
|
218
|
+
};
|
|
219
|
+
const dirty = signal(readFormDirty());
|
|
220
|
+
const settle = () => {
|
|
221
|
+
settleQueued = false;
|
|
222
|
+
takeBaseline([...pending]);
|
|
223
|
+
dirty.set(readFormDirty());
|
|
224
|
+
};
|
|
225
|
+
const trackControls = (event) => {
|
|
226
|
+
const baseline = snapshot;
|
|
227
|
+
for (const key of Object.keys(baseline)) {
|
|
228
|
+
if (!(key in form.controls))
|
|
229
|
+
delete baseline[key];
|
|
230
|
+
}
|
|
231
|
+
for (const key of Object.keys(form.controls)) {
|
|
232
|
+
if (!(key in baseline) && !pending.has(key))
|
|
233
|
+
pending.add(key);
|
|
234
|
+
}
|
|
235
|
+
// `form.events` reports the form's own pristine state, with the control that changed it as source.
|
|
236
|
+
if (event instanceof PristineChangeEvent) {
|
|
237
|
+
const key = event.source === form ? undefined : keyOf(event.source);
|
|
238
|
+
if (event.pristine)
|
|
239
|
+
takeBaseline(event.source === form ? Object.keys(form.controls) : key === undefined ? [] : [key]);
|
|
240
|
+
// A field that marks dirty before writing (as Angular's value accessors do) still holds the value before
|
|
241
|
+
// the edit: a control that joined in this very task gets that value as its saved value.
|
|
242
|
+
else if (key !== undefined && pending.has(key))
|
|
243
|
+
takeBaseline([key]);
|
|
244
|
+
}
|
|
245
|
+
if (pending.size && !settleQueued) {
|
|
246
|
+
settleQueued = true;
|
|
247
|
+
queueMicrotask(settle);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
if (valueMode)
|
|
251
|
+
trackControls();
|
|
252
|
+
const subscription = form.events.subscribe(event => {
|
|
253
|
+
if (valueMode)
|
|
254
|
+
trackControls(event);
|
|
255
|
+
dirty.set(readFormDirty());
|
|
256
|
+
});
|
|
188
257
|
const resetToSnapshot = () => {
|
|
189
258
|
form.reset(cloneValue(snapshot));
|
|
190
259
|
form.markAsPristine();
|
|
260
|
+
takeBaseline(Object.keys(form.controls));
|
|
191
261
|
dirty.set(false);
|
|
192
262
|
};
|
|
193
263
|
const registration = service.register({
|
|
@@ -200,6 +270,7 @@ function registerSdUnsavedChangesForm(service, form, options) {
|
|
|
200
270
|
if (result === false)
|
|
201
271
|
return false;
|
|
202
272
|
snapshot = cloneValue(form.getRawValue());
|
|
273
|
+
pending.clear();
|
|
203
274
|
form.markAsPristine();
|
|
204
275
|
dirty.set(false);
|
|
205
276
|
return true;
|
|
@@ -212,6 +283,7 @@ function registerSdUnsavedChangesForm(service, form, options) {
|
|
|
212
283
|
resetToSnapshot();
|
|
213
284
|
else {
|
|
214
285
|
form.markAsPristine();
|
|
286
|
+
takeBaseline(Object.keys(form.controls));
|
|
215
287
|
dirty.set(false);
|
|
216
288
|
}
|
|
217
289
|
return true;
|
|
@@ -224,13 +296,26 @@ function registerSdUnsavedChangesForm(service, form, options) {
|
|
|
224
296
|
resetToSnapshot();
|
|
225
297
|
else {
|
|
226
298
|
form.markAsPristine();
|
|
299
|
+
takeBaseline(Object.keys(form.controls));
|
|
227
300
|
dirty.set(false);
|
|
228
301
|
}
|
|
229
302
|
return true;
|
|
230
303
|
},
|
|
231
304
|
cleanup: () => subscription.unsubscribe(),
|
|
232
305
|
});
|
|
233
|
-
|
|
306
|
+
if (!valueMode)
|
|
307
|
+
return registration;
|
|
308
|
+
// why: in value mode `markPristine()` means "the current value is saved": the form keeps reporting later edits.
|
|
309
|
+
// The registry's own `markPristine()` pins the registration clean until a prompt resets it.
|
|
310
|
+
return {
|
|
311
|
+
...registration,
|
|
312
|
+
markPristine: () => {
|
|
313
|
+
snapshot = cloneValue(form.getRawValue());
|
|
314
|
+
pending.clear();
|
|
315
|
+
form.markAsPristine();
|
|
316
|
+
dirty.set(false);
|
|
317
|
+
},
|
|
318
|
+
};
|
|
234
319
|
}
|
|
235
320
|
function createSdUnsavedChangesCloseGuard(service, options = {}) {
|
|
236
321
|
return () => service.confirmLeave({ ...options, reason: 'close' });
|
|
@@ -246,6 +331,21 @@ function cloneValue(value) {
|
|
|
246
331
|
}
|
|
247
332
|
return value;
|
|
248
333
|
}
|
|
334
|
+
function sameValue(a, b) {
|
|
335
|
+
if (Object.is(a, b))
|
|
336
|
+
return true;
|
|
337
|
+
if (a instanceof Date && b instanceof Date)
|
|
338
|
+
return a.getTime() === b.getTime();
|
|
339
|
+
if (Array.isArray(a) && Array.isArray(b))
|
|
340
|
+
return a.length === b.length && a.every((item, index) => sameValue(item, b[index]));
|
|
341
|
+
if (a && b && typeof a === 'object' && typeof b === 'object' && !Array.isArray(a) && !Array.isArray(b)) {
|
|
342
|
+
const aKeys = Object.keys(a);
|
|
343
|
+
const bKeys = Object.keys(b);
|
|
344
|
+
return (aKeys.length === bKeys.length &&
|
|
345
|
+
aKeys.every(key => sameValue(a[key], b[key])));
|
|
346
|
+
}
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
249
349
|
|
|
250
350
|
/**
|
|
251
351
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdcorejs-angular-services-unsaved-changes.mjs","sources":["../../../projects/sdcorejs-angular/services/unsaved-changes/src/unsaved-changes.tokens.ts","../../../projects/sdcorejs-angular/services/unsaved-changes/src/unsaved-changes.service.ts","../../../projects/sdcorejs-angular/services/unsaved-changes/src/unsaved-changes.adapters.ts","../../../projects/sdcorejs-angular/services/unsaved-changes/sdcorejs-angular-services-unsaved-changes.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { InjectionToken, inject } from '@angular/core';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdUnsavedChangesConfirmationAdapter, SdUnsavedChangesDecision, SdUnsavedChangesPromptContext } from './unsaved-changes.model';\n\nexport interface SdUnsavedChangesWindow {\n addEventListener(type: 'beforeunload', listener: (event: BeforeUnloadEvent) => void): void;\n removeEventListener(type: 'beforeunload', listener: (event: BeforeUnloadEvent) => void): void;\n confirm?(message?: string): boolean;\n}\n\nexport const SD_UNSAVED_CHANGES_WINDOW = new InjectionToken<SdUnsavedChangesWindow | null>('SD_UNSAVED_CHANGES_WINDOW', {\n factory: () => inject(DOCUMENT).defaultView as SdUnsavedChangesWindow | null,\n});\n\nexport const SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER = new InjectionToken<SdUnsavedChangesConfirmationAdapter>(\n 'SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER',\n {\n factory: () => {\n const windowRef = inject(SD_UNSAVED_CHANGES_WINDOW);\n const i18n = inject(I18nService);\n return {\n confirm: (context: SdUnsavedChangesPromptContext): SdUnsavedChangesDecision => {\n if (!windowRef?.confirm) return 'cancel';\n const message = context.message || i18n.t('core.service.unsaved-changes.message');\n return windowRef.confirm(message) ? 'discard' : 'cancel';\n },\n };\n },\n }\n);\n","import { DestroyRef, Injectable, computed, effect, inject, isSignal, signal } from '@angular/core';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport {\n SdUnsavedChangesConfirmOptions,\n SdUnsavedChangesDecision,\n SdUnsavedChangesRegistration,\n SdUnsavedChangesWatcher,\n} from './unsaved-changes.model';\nimport { SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER, SD_UNSAVED_CHANGES_WINDOW } from './unsaved-changes.tokens';\n\ninterface RegistryEntry {\n readonly watcher: SdUnsavedChangesWatcher;\n readonly dirtyOverride: ReturnType<typeof signal<boolean | undefined>>;\n readonly destroyed: ReturnType<typeof signal<boolean>>;\n readonly dirty: ReturnType<typeof computed<boolean>>;\n readonly ref: SdUnsavedChangesRegistration;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class SdUnsavedChangesService {\n readonly #adapter = inject(SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER);\n readonly #window = inject(SD_UNSAVED_CHANGES_WINDOW);\n readonly #i18n = inject(I18nService);\n readonly #destroyRef = inject(DestroyRef);\n readonly #entries = signal<readonly RegistryEntry[]>([]);\n readonly #pendingPrompts = new Map<unknown, Promise<boolean>>();\n\n readonly registrations = computed(() => this.#entries().map(entry => entry.ref));\n readonly dirty = computed(() => this.#dirtyEntries().length > 0);\n\n constructor() {\n effect(onCleanup => {\n if (!this.#window || !this.dirty()) return;\n const listener = (event: BeforeUnloadEvent): void => {\n const message = this.#dirtyEntries()[0]?.watcher.message ?? this.#i18n.t('core.service.unsaved-changes.message');\n event.preventDefault();\n event.returnValue = message;\n };\n this.#window.addEventListener('beforeunload', listener);\n onCleanup(() => this.#window?.removeEventListener('beforeunload', listener));\n });\n\n this.#destroyRef.onDestroy(() => {\n for (const entry of this.#entries()) {\n if (entry.destroyed()) continue;\n entry.destroyed.set(true);\n this.#runCleanup(entry.watcher);\n }\n this.#entries.set([]);\n this.#pendingPrompts.clear();\n });\n }\n\n register(watcher: SdUnsavedChangesWatcher): SdUnsavedChangesRegistration {\n const existing = this.#entries().find(entry => entry.watcher.id === watcher.id && Object.is(entry.watcher.scope, watcher.scope));\n if (existing) {\n if (existing.watcher !== watcher) this.#runCleanup(watcher);\n return existing.ref;\n }\n\n const dirtyOverride = signal<boolean | undefined>(undefined);\n const destroyed = signal(false);\n const dirty = computed(() => !destroyed() && (dirtyOverride() ?? readDirty(watcher.isDirty)));\n const entry = {} as RegistryEntry;\n const ref: SdUnsavedChangesRegistration = {\n id: watcher.id,\n scope: watcher.scope,\n message: watcher.message,\n destroyed: destroyed.asReadonly(),\n dirty,\n markDirty: () => dirtyOverride.set(true),\n markPristine: () => dirtyOverride.set(false),\n save: () => this.#runEntryAction(entry, 'save'),\n reset: () => this.#runEntryAction(entry, 'reset'),\n discard: () => this.#runEntryAction(entry, 'discard'),\n destroy: () => this.#destroyEntry(entry),\n };\n Object.assign(entry, { watcher, dirtyOverride, destroyed, dirty, ref });\n this.#entries.update(entries => [...entries, entry]);\n return ref;\n }\n\n hasChanges(scope?: unknown): boolean {\n return this.#dirtyEntries(scope).length > 0;\n }\n\n confirmLeave(options: SdUnsavedChangesConfirmOptions = {}): Promise<boolean> {\n if (!this.hasChanges(options.scope)) return Promise.resolve(true);\n const promptKey = options.scope;\n const existingPrompt = this.#pendingPrompts.get(promptKey);\n if (existingPrompt) return existingPrompt;\n\n const watchers = this.#dirtyEntries(options.scope).map(entry => entry.ref);\n const message = watchers.find(watcher => watcher.message)?.message ?? this.#i18n.t('core.service.unsaved-changes.message');\n const run = async (): Promise<boolean> => {\n try {\n const rawDecision = await Promise.resolve(\n this.#adapter.confirm({ reason: options.reason ?? 'manual', scope: options.scope, message, watchers })\n );\n const decision: SdUnsavedChangesDecision = typeof rawDecision === 'boolean' ? (rawDecision ? 'discard' : 'cancel') : rawDecision;\n if (decision === 'save') return this.saveAll(options.scope);\n if (decision === 'discard') return this.discardAll(options.scope);\n return false;\n } catch {\n return false;\n }\n };\n\n const pending = run().finally(() => {\n if (this.#pendingPrompts.get(promptKey) === pending) this.#pendingPrompts.delete(promptKey);\n });\n this.#pendingPrompts.set(promptKey, pending);\n return pending;\n }\n\n saveAll(scope?: unknown): Promise<boolean> {\n return this.#runAll('save', scope);\n }\n\n resetAll(scope?: unknown): Promise<boolean> {\n return this.#runAll('reset', scope);\n }\n\n discardAll(scope?: unknown): Promise<boolean> {\n return this.#runAll('discard', scope);\n }\n\n async #runAll(action: 'save' | 'reset' | 'discard', scope?: unknown): Promise<boolean> {\n for (const entry of this.#dirtyEntries(scope)) {\n if (!(await this.#runEntryAction(entry, action))) return false;\n }\n return true;\n }\n\n async #runEntryAction(entry: RegistryEntry, action: 'save' | 'reset' | 'discard'): Promise<boolean> {\n if (entry.destroyed()) return true;\n try {\n const callback = entry.watcher[action];\n const result = callback ? await Promise.resolve(callback()) : undefined;\n if (result === false) return false;\n // A callback owns its underlying dirty source (for example FormGroup\n // marks itself pristine). Only synthesize pristine state when there is\n // no callback capable of updating that source.\n entry.dirtyOverride.set(callback ? undefined : false);\n return true;\n } catch {\n return false;\n }\n }\n\n #dirtyEntries(scope?: unknown): RegistryEntry[] {\n return this.#entries().filter(entry => (scope === undefined || Object.is(entry.watcher.scope, scope)) && entry.dirty());\n }\n\n #destroyEntry(entry: RegistryEntry): void {\n if (entry.destroyed()) return;\n entry.destroyed.set(true);\n this.#runCleanup(entry.watcher);\n this.#entries.update(entries => entries.filter(candidate => candidate !== entry));\n }\n\n #runCleanup(watcher: SdUnsavedChangesWatcher): void {\n try {\n watcher.cleanup?.();\n } catch {\n // Cleanup must never prevent registry teardown.\n }\n }\n}\n\nfunction readDirty(source: SdUnsavedChangesWatcher['isDirty']): boolean {\n if (typeof source === 'boolean') return source;\n if (isSignal(source)) return !!source();\n return !!source();\n}\n","import { signal } from '@angular/core';\nimport { FormGroup } from '@angular/forms';\nimport { CanDeactivateFn } from '@angular/router';\nimport { SdUnsavedChangesConfirmOptions, SdUnsavedChangesMaybeAsync, SdUnsavedChangesRegistration } from './unsaved-changes.model';\nimport { SdUnsavedChangesService } from './unsaved-changes.service';\nimport { inject } from '@angular/core';\n\nexport interface SdUnsavedChangesFormOptions<TValue> {\n readonly id: string;\n readonly scope?: unknown;\n readonly message?: string;\n readonly save?: (value: TValue) => SdUnsavedChangesMaybeAsync<void | boolean>;\n readonly reset?: (form: FormGroup) => SdUnsavedChangesMaybeAsync<void | boolean>;\n readonly discard?: (form: FormGroup) => SdUnsavedChangesMaybeAsync<void | boolean>;\n}\n\nexport function registerSdUnsavedChangesForm<TValue extends Record<string, unknown>>(\n service: SdUnsavedChangesService,\n form: FormGroup,\n options: SdUnsavedChangesFormOptions<TValue>\n): SdUnsavedChangesRegistration {\n let snapshot = cloneValue(form.getRawValue()) as TValue;\n const dirty = signal(form.dirty);\n const subscription = form.events.subscribe(() => dirty.set(form.dirty));\n const resetToSnapshot = (): void => {\n form.reset(cloneValue(snapshot));\n form.markAsPristine();\n dirty.set(false);\n };\n const registration = service.register({\n id: options.id,\n scope: options.scope,\n message: options.message,\n isDirty: dirty,\n save: async () => {\n const result = options.save ? await Promise.resolve(options.save(form.getRawValue() as TValue)) : undefined;\n if (result === false) return false;\n snapshot = cloneValue(form.getRawValue()) as TValue;\n form.markAsPristine();\n dirty.set(false);\n return true;\n },\n reset: async () => {\n const result = options.reset ? await Promise.resolve(options.reset(form)) : undefined;\n if (result === false) return false;\n if (!options.reset) resetToSnapshot();\n else {\n form.markAsPristine();\n dirty.set(false);\n }\n return true;\n },\n discard: async () => {\n const result = options.discard ? await Promise.resolve(options.discard(form)) : undefined;\n if (result === false) return false;\n if (!options.discard) resetToSnapshot();\n else {\n form.markAsPristine();\n dirty.set(false);\n }\n return true;\n },\n cleanup: () => subscription.unsubscribe(),\n });\n return registration;\n}\n\nexport function createSdUnsavedChangesCloseGuard(\n service: SdUnsavedChangesService,\n options: Omit<SdUnsavedChangesConfirmOptions, 'reason'> = {}\n): () => Promise<boolean> {\n return () => service.confirmLeave({ ...options, reason: 'close' });\n}\n\nexport const sdUnsavedChangesGuard: CanDeactivateFn<unknown> = () => inject(SdUnsavedChangesService).confirmLeave({ reason: 'navigation' });\n\nfunction cloneValue<T>(value: T): T {\n if (value instanceof Date) return new Date(value.getTime()) as T;\n if (Array.isArray(value)) return value.map(item => cloneValue(item)) as T;\n if (value && typeof value === 'object') {\n return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cloneValue(item)])) as T;\n }\n return value;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAWa,yBAAyB,GAAG,IAAI,cAAc,CAAgC,2BAA2B,EAAE;IACtH,OAAO,EAAE,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,WAA4C;AAC7E,CAAA;MAEY,uCAAuC,GAAG,IAAI,cAAc,CACvE,yCAAyC,EACzC;IACE,OAAO,EAAE,MAAK;AACZ,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACnD,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;QAChC,OAAO;AACL,YAAA,OAAO,EAAE,CAAC,OAAsC,KAA8B;gBAC5E,IAAI,CAAC,SAAS,EAAE,OAAO;AAAE,oBAAA,OAAO,QAAQ;AACxC,gBAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC;AACjF,gBAAA,OAAO,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,QAAQ;YAC1D,CAAC;SACF;IACH,CAAC;AACF,CAAA;;MCVU,uBAAuB,CAAA;AACzB,IAAA,QAAQ,GAAG,MAAM,CAAC,uCAAuC,CAAC;AAC1D,IAAA,OAAO,GAAG,MAAM,CAAC,yBAAyB,CAAC;AAC3C,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AAC3B,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,QAAQ,GAAG,MAAM,CAA2B,EAAE,CAAC;AAC/C,IAAA,eAAe,GAAG,IAAI,GAAG,EAA6B;IAEtD,aAAa,GAAG,QAAQ,CAAC,MAAM,IAA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-changes.tokens.ts","../../../projects/sdcorejs-angular/services/unsaved-changes/src/unsaved-changes.service.ts","../../../projects/sdcorejs-angular/services/unsaved-changes/src/unsaved-changes.adapters.ts","../../../projects/sdcorejs-angular/services/unsaved-changes/sdcorejs-angular-services-unsaved-changes.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { InjectionToken, inject } from '@angular/core';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdUnsavedChangesConfirmationAdapter, SdUnsavedChangesDecision, SdUnsavedChangesPromptContext } from './unsaved-changes.model';\n\nexport interface SdUnsavedChangesWindow {\n addEventListener(type: 'beforeunload', listener: (event: BeforeUnloadEvent) => void): void;\n removeEventListener(type: 'beforeunload', listener: (event: BeforeUnloadEvent) => void): void;\n confirm?(message?: string): boolean;\n}\n\nexport const SD_UNSAVED_CHANGES_WINDOW = new InjectionToken<SdUnsavedChangesWindow | null>('SD_UNSAVED_CHANGES_WINDOW', {\n factory: () => inject(DOCUMENT).defaultView as SdUnsavedChangesWindow | null,\n});\n\nexport const SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER = new InjectionToken<SdUnsavedChangesConfirmationAdapter>(\n 'SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER',\n {\n factory: () => {\n const windowRef = inject(SD_UNSAVED_CHANGES_WINDOW);\n const i18n = inject(I18nService);\n return {\n confirm: (context: SdUnsavedChangesPromptContext): SdUnsavedChangesDecision => {\n if (!windowRef?.confirm) return 'cancel';\n const message = context.message || i18n.t('core.service.unsaved-changes.message');\n return windowRef.confirm(message) ? 'discard' : 'cancel';\n },\n };\n },\n }\n);\n","import { DestroyRef, Injectable, computed, effect, inject, isSignal, signal } from '@angular/core';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport {\n SdUnsavedChangesConfirmOptions,\n SdUnsavedChangesDecision,\n SdUnsavedChangesRegistration,\n SdUnsavedChangesWatcher,\n} from './unsaved-changes.model';\nimport { SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER, SD_UNSAVED_CHANGES_WINDOW } from './unsaved-changes.tokens';\n\ninterface RegistryEntry {\n readonly watcher: SdUnsavedChangesWatcher;\n readonly dirtyOverride: ReturnType<typeof signal<boolean | undefined>>;\n readonly destroyed: ReturnType<typeof signal<boolean>>;\n readonly dirty: ReturnType<typeof computed<boolean>>;\n readonly ref: SdUnsavedChangesRegistration;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class SdUnsavedChangesService {\n readonly #adapter = inject(SD_UNSAVED_CHANGES_CONFIRMATION_ADAPTER);\n readonly #window = inject(SD_UNSAVED_CHANGES_WINDOW);\n readonly #i18n = inject(I18nService);\n readonly #destroyRef = inject(DestroyRef);\n readonly #entries = signal<readonly RegistryEntry[]>([]);\n readonly #pendingPrompts = new Map<unknown, Promise<boolean>>();\n\n readonly registrations = computed(() => this.#entries().map(entry => entry.ref));\n readonly dirty = computed(() => this.#dirtyEntries().length > 0);\n\n constructor() {\n effect(onCleanup => {\n if (!this.#window || !this.dirty()) return;\n const listener = (event: BeforeUnloadEvent): void => {\n const message = this.#dirtyEntries()[0]?.watcher.message ?? this.#i18n.t('core.service.unsaved-changes.message');\n event.preventDefault();\n event.returnValue = message;\n };\n this.#window.addEventListener('beforeunload', listener);\n onCleanup(() => this.#window?.removeEventListener('beforeunload', listener));\n });\n\n this.#destroyRef.onDestroy(() => {\n for (const entry of this.#entries()) {\n if (entry.destroyed()) continue;\n entry.destroyed.set(true);\n this.#runCleanup(entry.watcher);\n }\n this.#entries.set([]);\n this.#pendingPrompts.clear();\n });\n }\n\n register(watcher: SdUnsavedChangesWatcher): SdUnsavedChangesRegistration {\n const existing = this.#entries().find(entry => entry.watcher.id === watcher.id && Object.is(entry.watcher.scope, watcher.scope));\n if (existing) {\n if (existing.watcher !== watcher) this.#runCleanup(watcher);\n return existing.ref;\n }\n\n const dirtyOverride = signal<boolean | undefined>(undefined);\n const destroyed = signal(false);\n const dirty = computed(() => !destroyed() && (dirtyOverride() ?? readDirty(watcher.isDirty)));\n const entry = {} as RegistryEntry;\n const ref: SdUnsavedChangesRegistration = {\n id: watcher.id,\n scope: watcher.scope,\n message: watcher.message,\n destroyed: destroyed.asReadonly(),\n dirty,\n markDirty: () => dirtyOverride.set(true),\n markPristine: () => dirtyOverride.set(false),\n save: () => this.#runEntryAction(entry, 'save'),\n reset: () => this.#runEntryAction(entry, 'reset'),\n discard: () => this.#runEntryAction(entry, 'discard'),\n destroy: () => this.#destroyEntry(entry),\n };\n Object.assign(entry, { watcher, dirtyOverride, destroyed, dirty, ref });\n this.#entries.update(entries => [...entries, entry]);\n return ref;\n }\n\n hasChanges(scope?: unknown): boolean {\n return this.#dirtyEntries(scope).length > 0;\n }\n\n confirmLeave(options: SdUnsavedChangesConfirmOptions = {}): Promise<boolean> {\n if (!this.hasChanges(options.scope)) return Promise.resolve(true);\n const promptKey = options.scope;\n const existingPrompt = this.#pendingPrompts.get(promptKey);\n if (existingPrompt) return existingPrompt;\n\n const watchers = this.#dirtyEntries(options.scope).map(entry => entry.ref);\n const message = watchers.find(watcher => watcher.message)?.message ?? this.#i18n.t('core.service.unsaved-changes.message');\n const adapter = options.adapter ?? this.#adapter;\n const run = async (): Promise<boolean> => {\n try {\n const rawDecision = await Promise.resolve(\n adapter.confirm({ reason: options.reason ?? 'manual', scope: options.scope, message, watchers })\n );\n const decision: SdUnsavedChangesDecision = typeof rawDecision === 'boolean' ? (rawDecision ? 'discard' : 'cancel') : rawDecision;\n if (decision === 'save') return this.saveAll(options.scope);\n if (decision === 'discard') return this.discardAll(options.scope);\n return false;\n } catch {\n return false;\n }\n };\n\n const pending = run().finally(() => {\n if (this.#pendingPrompts.get(promptKey) === pending) this.#pendingPrompts.delete(promptKey);\n });\n this.#pendingPrompts.set(promptKey, pending);\n return pending;\n }\n\n saveAll(scope?: unknown): Promise<boolean> {\n return this.#runAll('save', scope);\n }\n\n resetAll(scope?: unknown): Promise<boolean> {\n return this.#runAll('reset', scope);\n }\n\n discardAll(scope?: unknown): Promise<boolean> {\n return this.#runAll('discard', scope);\n }\n\n async #runAll(action: 'save' | 'reset' | 'discard', scope?: unknown): Promise<boolean> {\n for (const entry of this.#dirtyEntries(scope)) {\n if (!(await this.#runEntryAction(entry, action))) return false;\n }\n return true;\n }\n\n async #runEntryAction(entry: RegistryEntry, action: 'save' | 'reset' | 'discard'): Promise<boolean> {\n if (entry.destroyed()) return true;\n try {\n const callback = entry.watcher[action];\n const result = callback ? await Promise.resolve(callback()) : undefined;\n if (result === false) return false;\n // A callback owns its underlying dirty source (for example FormGroup\n // marks itself pristine). Only synthesize pristine state when there is\n // no callback capable of updating that source.\n entry.dirtyOverride.set(callback ? undefined : false);\n return true;\n } catch {\n return false;\n }\n }\n\n #dirtyEntries(scope?: unknown): RegistryEntry[] {\n return this.#entries().filter(entry => (scope === undefined || Object.is(entry.watcher.scope, scope)) && entry.dirty());\n }\n\n #destroyEntry(entry: RegistryEntry): void {\n if (entry.destroyed()) return;\n entry.destroyed.set(true);\n this.#runCleanup(entry.watcher);\n this.#entries.update(entries => entries.filter(candidate => candidate !== entry));\n }\n\n #runCleanup(watcher: SdUnsavedChangesWatcher): void {\n try {\n watcher.cleanup?.();\n } catch {\n // Cleanup must never prevent registry teardown.\n }\n }\n}\n\nfunction readDirty(source: SdUnsavedChangesWatcher['isDirty']): boolean {\n if (typeof source === 'boolean') return source;\n if (isSignal(source)) return !!source();\n return !!source();\n}\n","import { signal } from '@angular/core';\nimport { FormGroup, PristineChangeEvent, type AbstractControl, type ControlEvent } from '@angular/forms';\nimport { CanDeactivateFn } from '@angular/router';\nimport { SdUnsavedChangesConfirmOptions, SdUnsavedChangesMaybeAsync, SdUnsavedChangesRegistration } from './unsaved-changes.model';\nimport { SdUnsavedChangesService } from './unsaved-changes.service';\nimport { inject } from '@angular/core';\n\nexport interface SdUnsavedChangesFormOptions<TValue> {\n readonly id: string;\n readonly scope?: unknown;\n readonly message?: string;\n readonly save?: (value: TValue) => SdUnsavedChangesMaybeAsync<void | boolean>;\n readonly reset?: (form: FormGroup) => SdUnsavedChangesMaybeAsync<void | boolean>;\n readonly discard?: (form: FormGroup) => SdUnsavedChangesMaybeAsync<void | boolean>;\n /**\n * `'control'` (default): the form's own `dirty` flag. `'value'`: dirty only while the value differs from the\n * saved one, so a value typed back to what it was is no change, whether or not the field marks its control dirty.\n * In `'value'` mode each control's saved value is the one it holds once it has joined the form (an `<sd-*>`\n * field registers and writes its model after this call), and it is taken again when the form or the control is\n * marked pristine, on `save()`, `reset()`, `discard()` and on `markPristine()` of the registration. A page that\n * loads another record into the same form calls `markPristine()` once the record is in.\n */\n readonly dirty?: 'control' | 'value';\n}\n\nexport function registerSdUnsavedChangesForm<TValue extends Record<string, unknown>>(\n service: SdUnsavedChangesService,\n form: FormGroup,\n options: SdUnsavedChangesFormOptions<TValue>\n): SdUnsavedChangesRegistration {\n let snapshot = cloneValue(form.getRawValue()) as TValue;\n const valueMode = options.dirty === 'value';\n // why: `<sd-*>` fields join the form in an effect after this call and write their model with `emitEvent: false`;\n // some of them write a user edit without marking the control dirty, or mark it only after the value. The saved\n // value of a control is therefore not tied to its dirty flag: it is read once the task that added the control\n // ends (its model is in by then), and again whenever the form or the control is marked pristine.\n const pending = new Set<string>();\n let settleQueued = false;\n const keyOf = (control: AbstractControl): string | undefined => {\n let current: AbstractControl | null = control;\n while (current && current.parent !== form) current = current.parent;\n return current ? Object.entries(form.controls).find(([, child]) => child === current)?.[0] : undefined;\n };\n const takeBaseline = (keys: Iterable<string>): void => {\n if (!valueMode) return;\n const value = form.getRawValue() as Record<string, unknown>;\n const baseline = snapshot as Record<string, unknown>;\n for (const key of keys) {\n if (key in form.controls) baseline[key] = cloneValue(value[key]);\n pending.delete(key);\n }\n };\n const readFormDirty = (): boolean => {\n if (!valueMode) return form.dirty;\n const value = form.getRawValue() as Record<string, unknown>;\n const baseline = snapshot as Record<string, unknown>;\n return Object.keys(form.controls).some(key => !pending.has(key) && !sameValue(value[key], baseline[key]));\n };\n const dirty = signal(readFormDirty());\n const settle = (): void => {\n settleQueued = false;\n takeBaseline([...pending]);\n dirty.set(readFormDirty());\n };\n const trackControls = (event?: ControlEvent): void => {\n const baseline = snapshot as Record<string, unknown>;\n for (const key of Object.keys(baseline)) {\n if (!(key in form.controls)) delete baseline[key];\n }\n for (const key of Object.keys(form.controls)) {\n if (!(key in baseline) && !pending.has(key)) pending.add(key);\n }\n // `form.events` reports the form's own pristine state, with the control that changed it as source.\n if (event instanceof PristineChangeEvent) {\n const key = event.source === form ? undefined : keyOf(event.source);\n if (event.pristine) takeBaseline(event.source === form ? Object.keys(form.controls) : key === undefined ? [] : [key]);\n // A field that marks dirty before writing (as Angular's value accessors do) still holds the value before\n // the edit: a control that joined in this very task gets that value as its saved value.\n else if (key !== undefined && pending.has(key)) takeBaseline([key]);\n }\n if (pending.size && !settleQueued) {\n settleQueued = true;\n queueMicrotask(settle);\n }\n };\n if (valueMode) trackControls();\n const subscription = form.events.subscribe(event => {\n if (valueMode) trackControls(event);\n dirty.set(readFormDirty());\n });\n const resetToSnapshot = (): void => {\n form.reset(cloneValue(snapshot));\n form.markAsPristine();\n takeBaseline(Object.keys(form.controls));\n dirty.set(false);\n };\n const registration = service.register({\n id: options.id,\n scope: options.scope,\n message: options.message,\n isDirty: dirty,\n save: async () => {\n const result = options.save ? await Promise.resolve(options.save(form.getRawValue() as TValue)) : undefined;\n if (result === false) return false;\n snapshot = cloneValue(form.getRawValue()) as TValue;\n pending.clear();\n form.markAsPristine();\n dirty.set(false);\n return true;\n },\n reset: async () => {\n const result = options.reset ? await Promise.resolve(options.reset(form)) : undefined;\n if (result === false) return false;\n if (!options.reset) resetToSnapshot();\n else {\n form.markAsPristine();\n takeBaseline(Object.keys(form.controls));\n dirty.set(false);\n }\n return true;\n },\n discard: async () => {\n const result = options.discard ? await Promise.resolve(options.discard(form)) : undefined;\n if (result === false) return false;\n if (!options.discard) resetToSnapshot();\n else {\n form.markAsPristine();\n takeBaseline(Object.keys(form.controls));\n dirty.set(false);\n }\n return true;\n },\n cleanup: () => subscription.unsubscribe(),\n });\n if (!valueMode) return registration;\n // why: in value mode `markPristine()` means \"the current value is saved\": the form keeps reporting later edits.\n // The registry's own `markPristine()` pins the registration clean until a prompt resets it.\n return {\n ...registration,\n markPristine: () => {\n snapshot = cloneValue(form.getRawValue()) as TValue;\n pending.clear();\n form.markAsPristine();\n dirty.set(false);\n },\n };\n}\n\nexport function createSdUnsavedChangesCloseGuard(\n service: SdUnsavedChangesService,\n options: Omit<SdUnsavedChangesConfirmOptions, 'reason'> = {}\n): () => Promise<boolean> {\n return () => service.confirmLeave({ ...options, reason: 'close' });\n}\n\nexport const sdUnsavedChangesGuard: CanDeactivateFn<unknown> = () => inject(SdUnsavedChangesService).confirmLeave({ reason: 'navigation' });\n\nfunction cloneValue<T>(value: T): T {\n if (value instanceof Date) return new Date(value.getTime()) as T;\n if (Array.isArray(value)) return value.map(item => cloneValue(item)) as T;\n if (value && typeof value === 'object') {\n return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cloneValue(item)])) as T;\n }\n return value;\n}\n\nfunction sameValue(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();\n if (Array.isArray(a) && Array.isArray(b)) return a.length === b.length && a.every((item, index) => sameValue(item, b[index]));\n if (a && b && typeof a === 'object' && typeof b === 'object' && !Array.isArray(a) && !Array.isArray(b)) {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n return (\n aKeys.length === bKeys.length &&\n aKeys.every(key => sameValue((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key]))\n );\n }\n return false;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAWa,yBAAyB,GAAG,IAAI,cAAc,CAAgC,2BAA2B,EAAE;IACtH,OAAO,EAAE,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,WAA4C;AAC7E,CAAA;MAEY,uCAAuC,GAAG,IAAI,c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CAAC,IAAI,CAAC,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5B,QAAA,QACE,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAC7B,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,SAAS,CAAE,CAA6B,CAAC,GAAG,CAAC,EAAG,CAA6B,CAAC,GAAG,CAAC,CAAC,CAAC;IAE3G;AACA,IAAA,OAAO,KAAK;AACd;;ACnLA;;AAEG;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormControl, FormGroup
|
|
3
|
-
import {
|
|
4
|
-
import { MatChipInputEvent } from '@angular/material/chips';
|
|
1
|
+
import { ElementRef, TemplateRef } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { MatChipGrid, MatChipInputEvent } from '@angular/material/chips';
|
|
5
4
|
import { ErrorStateMatcher } from '@angular/material/core';
|
|
6
5
|
import { FloatLabelType, MatFormFieldAppearance } from '@angular/material/form-field';
|
|
7
6
|
import { SdLabelDefDirective, SdViewDefDirective } from '@sdcorejs/angular/forms/directives';
|
|
@@ -9,13 +8,10 @@ import { SdFormControl, SdViewed, SdViewedInput } from '@sdcorejs/angular/forms/
|
|
|
9
8
|
import type { SdLabelPlacement } from '@sdcorejs/angular/forms/models';
|
|
10
9
|
import { Size } from '@sdcorejs/utils/models';
|
|
11
10
|
import * as i0 from "@angular/core";
|
|
12
|
-
declare class
|
|
13
|
-
private formControl;
|
|
14
|
-
constructor(formControl: FormControl);
|
|
15
|
-
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare class SdChip implements AfterViewInit, OnDestroy {
|
|
11
|
+
export declare class SdChip {
|
|
18
12
|
#private;
|
|
13
|
+
/** why: id ổn định của lỗi (`<mat-error>` hoặc chữ ẩn của `hideInlineError`) để ô nhập trỏ `aria-describedby` sang (A8). */
|
|
14
|
+
readonly errorId: string;
|
|
19
15
|
autoIdInput: import("@angular/core").InputSignalWithTransform<string | undefined, string | null | undefined>;
|
|
20
16
|
autoId: import("@angular/core").Signal<string | undefined>;
|
|
21
17
|
readonly dataDisabled: import("@angular/core").Signal<"true" | "false">;
|
|
@@ -45,9 +41,31 @@ export declare class SdChip implements AfterViewInit, OnDestroy {
|
|
|
45
41
|
removable: import("@angular/core").InputSignalWithTransform<boolean | ((item: any) => boolean), boolean | ((item: any) => boolean) | null | undefined>;
|
|
46
42
|
hideInlineError: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
47
43
|
required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
44
|
+
/** Fewest chips; > 0 adds `Validators.minLength`. Replaces `min`. */
|
|
45
|
+
minCount: import("@angular/core").InputSignalWithTransform<number | undefined, number | null | undefined>;
|
|
46
|
+
/** Most chips; > 0 adds `Validators.maxLength` (for a model set from outside) and stops adding once reached. Replaces `max`. */
|
|
47
|
+
maxCount: import("@angular/core").InputSignalWithTransform<number | undefined, number | null | undefined>;
|
|
48
|
+
/** @deprecated Use `minCount`; `minCount` wins when both are set. */
|
|
48
49
|
min: import("@angular/core").InputSignalWithTransform<number, number | null | undefined>;
|
|
50
|
+
/** @deprecated Use `maxCount`; `maxCount` wins when both are set. */
|
|
49
51
|
max: import("@angular/core").InputSignalWithTransform<number, number | null | undefined>;
|
|
52
|
+
/** `false` keeps the field read-only for typing: the input stays (mat-chip-grid needs it) but is read-only and out of the Tab order. */
|
|
50
53
|
addable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
54
|
+
/** Leaving the field turns the typed text into a chip. `false` drops the text instead, as before. */
|
|
55
|
+
addOnBlur: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
56
|
+
/** Keys that commit the typed text (`KeyboardEvent.key`). A paste also splits on these characters, new lines and tabs. */
|
|
57
|
+
separators: import("@angular/core").InputSignalWithTransform<readonly string[], readonly string[] | null | undefined>;
|
|
58
|
+
/** Normalises typed or pasted text before it is compared and stored; `null` or `''` drops it. Default: trim. */
|
|
59
|
+
chipTransform: import("@angular/core").InputSignalWithTransform<(raw: string) => string | number | null, ((raw: string) => string | number | null) | null | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Checks a normalised value: an i18n key (or the message itself) when it is refused, else `null`. A refused value does
|
|
62
|
+
* not become a chip; its text stays in the input and the message shows under the field.
|
|
63
|
+
*/
|
|
64
|
+
chipValidator: import("@angular/core").InputSignal<((value: string | number) => string | null) | null | undefined>;
|
|
65
|
+
/** Shows a button that removes every chip `removable` allows. Off by default, like `clearable` of `<sd-date>`. */
|
|
66
|
+
clearable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
67
|
+
/** Chips shown while the field is not focused; the rest fold into “+N”. `null` shows them all. `2` suits `<sd-table>` cells. */
|
|
68
|
+
maxVisible: import("@angular/core").InputSignal<number | null | undefined>;
|
|
51
69
|
disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
52
70
|
/** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */
|
|
53
71
|
viewed: import("@angular/core").InputSignalWithTransform<SdViewed, SdViewedInput>;
|
|
@@ -57,30 +75,128 @@ export declare class SdChip implements AfterViewInit, OnDestroy {
|
|
|
57
75
|
model: import("@angular/core").ModelSignal<(string | number)[] | undefined>;
|
|
58
76
|
sdChange: import("@angular/core").OutputEmitterRef<any[]>;
|
|
59
77
|
input: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
78
|
+
readonly chipGrid: import("@angular/core").Signal<MatChipGrid | undefined>;
|
|
79
|
+
private readonly chipTextElements;
|
|
60
80
|
sdViewDef: import("@angular/core").Signal<SdViewDefDirective<any, any> | undefined>;
|
|
61
81
|
sdLabelDef: import("@angular/core").Signal<SdLabelDefDirective | undefined>;
|
|
62
82
|
sdLabelTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
63
83
|
sdValueTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
64
|
-
|
|
65
|
-
readonly
|
|
66
|
-
|
|
84
|
+
/** The field is being edited: the `sdViewDef` face gives way to the field. A signal, so OnPush redraws without `detectChanges()` (D1). */
|
|
85
|
+
readonly isFocused: import("@angular/core").WritableSignal<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Control of `mat-chip-grid` only. why: the grid is a ControlValueAccessor that writes the text of the rendered chips
|
|
88
|
+
* into its control on blur, after a timeout (numbers became strings, a form reset was undone). It still needs an
|
|
89
|
+
* ngControl to work out its error state on every check, so it gets this one; nothing reads its value.
|
|
90
|
+
*/
|
|
91
|
+
readonly gridControl: FormControl<unknown>;
|
|
92
|
+
/** `minCount`, else the deprecated `min`. */
|
|
93
|
+
readonly effectiveMinCount: import("@angular/core").Signal<number>;
|
|
94
|
+
/** `maxCount`, else the deprecated `max`. */
|
|
95
|
+
readonly effectiveMaxCount: import("@angular/core").Signal<number>;
|
|
96
|
+
/** why: phím tách do `separators` + onInputKeydown xử lý, nên Material không nhận phím nào. */
|
|
97
|
+
readonly noSeparatorKeys: number[];
|
|
98
|
+
/**
|
|
99
|
+
* Items rendered as chips: every value except `null`, `undefined` and `''`, so `0` shows (A2). Display only: the
|
|
100
|
+
* model is never rewritten. why: exact duplicates are dropped too, because the chips are tracked by value.
|
|
101
|
+
*/
|
|
102
|
+
readonly chips: import("@angular/core").Signal<(string | number)[]>;
|
|
103
|
+
/** Message of a typed or pasted value that `chipValidator` refused; it shows under the field until the text changes (B4). */
|
|
104
|
+
readonly inputError: import("@angular/core").WritableSignal<string | null>;
|
|
105
|
+
/** Last polite announcement; a new id re-renders the text so a repeated message is read again. */
|
|
106
|
+
readonly liveMessage: import("@angular/core").WritableSignal<{
|
|
107
|
+
id: number;
|
|
108
|
+
text: string;
|
|
109
|
+
} | null>;
|
|
110
|
+
/** Chip that the typed value duplicates, highlighted for 1.4s (B3). */
|
|
111
|
+
readonly duplicateChip: import("@angular/core").WritableSignal<string | number | null>;
|
|
112
|
+
/** Text of the chips that the 240px limit cuts; only they get a tooltip (B7). */
|
|
113
|
+
readonly truncatedChips: import("@angular/core").WritableSignal<ReadonlySet<string>>;
|
|
114
|
+
/** `maxCount` reached: typing and pasting add nothing more (B3). */
|
|
115
|
+
readonly full: import("@angular/core").Signal<boolean>;
|
|
116
|
+
/** Chips on screen: all while the field has focus, else at most `maxVisible` (B7). */
|
|
117
|
+
readonly visibleChips: import("@angular/core").Signal<(string | number)[]>;
|
|
118
|
+
/** Chips folded into “+N”. */
|
|
119
|
+
readonly hiddenCount: import("@angular/core").Signal<number>;
|
|
120
|
+
/** At least one chip may be removed, so the clear button has something to do (B6). */
|
|
121
|
+
readonly hasRemovable: import("@angular/core").Signal<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Placeholder: “Đã đủ …” once full, else the input, else “Nhập rồi nhấn Enter” — never the label (B5). None when not
|
|
124
|
+
* addable, or while chips are folded into “+N”: nobody types then, and the input only fills the rest of the line (C1).
|
|
125
|
+
*/
|
|
126
|
+
readonly effectivePlaceholder: import("@angular/core").Signal<string | null>;
|
|
127
|
+
readonly clearLabel: import("@angular/core").Signal<string>;
|
|
128
|
+
/** Tooltip of the lock on a chip that `removable` keeps (C3). */
|
|
129
|
+
readonly lockedLabel: import("@angular/core").Signal<string>;
|
|
130
|
+
/** Sizes of the chip ✕ / lock and of the clear-button icon for the current `size` (C1). */
|
|
131
|
+
readonly iconSizes: import("@angular/core").Signal<{
|
|
132
|
+
readonly chip: "12px";
|
|
133
|
+
readonly clear: "16px";
|
|
134
|
+
} | {
|
|
135
|
+
readonly chip: "14px";
|
|
136
|
+
readonly clear: "18px";
|
|
137
|
+
} | {
|
|
138
|
+
readonly chip: "16px";
|
|
139
|
+
readonly clear: "20px";
|
|
140
|
+
}>;
|
|
141
|
+
readonly moreLabel: import("@angular/core").Signal<string>;
|
|
67
142
|
constructor();
|
|
68
143
|
get formControl(): SdFormControl;
|
|
69
144
|
get inputControl(): FormControl<any>;
|
|
70
145
|
readonly errorMessage: import("@angular/core").Signal<string | undefined>;
|
|
71
|
-
get matcher():
|
|
72
|
-
|
|
73
|
-
|
|
146
|
+
get matcher(): ErrorStateMatcher;
|
|
147
|
+
/**
|
|
148
|
+
* The one place that decides whether the error shows (A5): the `ErrorStateMatcher` of the chip grid and the input,
|
|
149
|
+
* `<mat-error>`, the `hideInlineError` icon and `aria-invalid` all read it. Invalid and touched, or the parent form
|
|
150
|
+
* was submitted; a field that is only dirty shows nothing.
|
|
151
|
+
*/
|
|
152
|
+
isErrorShown(): boolean;
|
|
153
|
+
/** Text under the field: the `chipValidator` message of the typed value first, else the form error. */
|
|
154
|
+
readonly errorText: import("@angular/core").Signal<string | undefined>;
|
|
155
|
+
/** Whether `item` may be removed, per `removable`; applied on every removal path (A1). */
|
|
156
|
+
isRemovable(item: string | number): boolean;
|
|
157
|
+
/** Accessible name of the ✕ button of a chip (A6). */
|
|
158
|
+
removeLabel(item: string | number): string;
|
|
159
|
+
/** Accessible name of a chip that `removable` keeps: its text plus “, Không xoá được” (C3). A removable chip keeps its text. */
|
|
160
|
+
chipLabel(item: string | number): string | null;
|
|
161
|
+
/** Text of a chip, also its key for `truncatedChips`. */
|
|
162
|
+
chipText(item: string | number): string;
|
|
163
|
+
/** A separator key (`separators`) commits the typed text; the key itself is not typed (B2 / separators). */
|
|
164
|
+
onInputKeydown(event: KeyboardEvent): void;
|
|
165
|
+
/** The refused-value message goes as soon as the text changes (B4). */
|
|
166
|
+
onInputText(): void;
|
|
167
|
+
/**
|
|
168
|
+
* A paste that holds a separator, a new line or a tab becomes several chips in one change (B2). Duplicates are
|
|
169
|
+
* skipped, refused values and values past `maxCount` stay in the input, and the result is announced. A paste with
|
|
170
|
+
* no separator is left to the browser.
|
|
171
|
+
*/
|
|
172
|
+
onPaste(event: ClipboardEvent): void;
|
|
173
|
+
/** Backspace / Delete on a chip that `removable` keeps says why nothing happened (A1, B3). */
|
|
174
|
+
onChipKeydown(event: KeyboardEvent, item: string | number): void;
|
|
175
|
+
/** “+N” moves focus to the input, where every chip shows (B7). */
|
|
176
|
+
onMoreClick(event: Event): void;
|
|
177
|
+
/** Focus entering the input or a chip unfolds “+N”; focus on the “+N” button itself does not (B7). */
|
|
178
|
+
onFocusIn(event: FocusEvent): void;
|
|
179
|
+
/**
|
|
180
|
+
* Marks the field touched once focus leaves it; moving between the input and the chips does not count.
|
|
181
|
+
* why: `mat-chip-grid` is no longer bound to the control. As a ControlValueAccessor it wrote the text of the rendered
|
|
182
|
+
* chips back into the control on blur (numbers became strings, a form reset was undone), so the component marks
|
|
183
|
+
* touched itself, like the grid did.
|
|
184
|
+
*/
|
|
185
|
+
onFocusOut(event: FocusEvent): void;
|
|
74
186
|
onAdd: (event: MatChipInputEvent) => void;
|
|
75
187
|
onClickChip: (event: Event, item: any) => void;
|
|
76
188
|
onRemove: (item: any) => void;
|
|
77
|
-
onSelect: (event: MatAutocompleteSelectedEvent) => void;
|
|
78
189
|
onFocus: () => void;
|
|
79
190
|
onBlur: () => void;
|
|
80
191
|
onClick: () => void;
|
|
192
|
+
/**
|
|
193
|
+
* why: khi `sdViewDef` đang hiển thị thì bên trong không còn phần tử nào focus được, nên phần tử view là lối vào
|
|
194
|
+
* duy nhất để chuyển sang chế độ sửa. Bàn phím phải mở được y hệt chuột → Enter/Space chạy chung handler;
|
|
195
|
+
* preventDefault chặn Space cuộn trang (A7).
|
|
196
|
+
*/
|
|
197
|
+
onViewKeydown: (event: Event) => void;
|
|
81
198
|
focus: () => void;
|
|
82
199
|
onClear: ($event?: any) => void;
|
|
83
200
|
static ɵfac: i0.ɵɵFactoryDeclaration<SdChip, never>;
|
|
84
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SdChip, "sd-chip", never, { "autoIdInput": { "alias": "autoId"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "labelPlacement": { "alias": "labelPlacement"; "required": false; "isSignal": true; }; "floatLabel": { "alias": "floatLabel"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "removable": { "alias": "removable"; "required": false; "isSignal": true; }; "hideInlineError": { "alias": "hideInlineError"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "addable": { "alias": "addable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "viewed": { "alias": "viewed"; "required": false; "isSignal": true; }; "hyperlink": { "alias": "hyperlink"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; }, { "model": "modelChange"; "sdChange": "sdChange"; }, ["sdViewDef", "sdLabelDef", "sdLabelTemplate", "sdValueTemplate"], never, true, never>;
|
|
201
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdChip, "sd-chip", never, { "autoIdInput": { "alias": "autoId"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "labelPlacement": { "alias": "labelPlacement"; "required": false; "isSignal": true; }; "floatLabel": { "alias": "floatLabel"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "removable": { "alias": "removable"; "required": false; "isSignal": true; }; "hideInlineError": { "alias": "hideInlineError"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "minCount": { "alias": "minCount"; "required": false; "isSignal": true; }; "maxCount": { "alias": "maxCount"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "addable": { "alias": "addable"; "required": false; "isSignal": true; }; "addOnBlur": { "alias": "addOnBlur"; "required": false; "isSignal": true; }; "separators": { "alias": "separators"; "required": false; "isSignal": true; }; "chipTransform": { "alias": "chipTransform"; "required": false; "isSignal": true; }; "chipValidator": { "alias": "chipValidator"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "maxVisible": { "alias": "maxVisible"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "viewed": { "alias": "viewed"; "required": false; "isSignal": true; }; "hyperlink": { "alias": "hyperlink"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; }, { "model": "modelChange"; "sdChange": "sdChange"; }, ["sdViewDef", "sdLabelDef", "sdLabelTemplate", "sdValueTemplate"], never, true, never>;
|
|
85
202
|
}
|
|
86
|
-
export {};
|
package/i18n/src/en.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare const EN_MESSAGES: {
|
|
|
32
32
|
readonly 'core.component.table.mobile.reorder': "Drag to reorder row";
|
|
33
33
|
readonly 'core.component.table.mobile.details': "Details";
|
|
34
34
|
readonly 'core.component.table.mobile.summary': "Summary";
|
|
35
|
+
readonly 'core.common.back': "Back";
|
|
35
36
|
readonly 'core.common.cancel': "Cancel";
|
|
36
37
|
readonly 'core.common.close': "Close";
|
|
37
38
|
readonly 'core.common.reload': "Reload page";
|
|
@@ -136,6 +137,15 @@ export declare const EN_MESSAGES: {
|
|
|
136
137
|
readonly 'core.form.chip.required': "Please enter information";
|
|
137
138
|
readonly 'core.form.chip.minlength': "Please enter at least {min} values";
|
|
138
139
|
readonly 'core.form.chip.maxlength': "Please enter at most {max} values";
|
|
140
|
+
readonly 'core.form.chip.remove': "Remove {value}";
|
|
141
|
+
readonly 'core.form.chip.placeholder': "Type, then press Enter";
|
|
142
|
+
readonly 'core.form.chip.locked': "Cannot be removed";
|
|
143
|
+
readonly 'core.form.chip.duplicate': "“{value}” is already added";
|
|
144
|
+
readonly 'core.form.chip.full': "All {max} values are added";
|
|
145
|
+
readonly 'core.form.chip.added': "Added {count}";
|
|
146
|
+
readonly 'core.form.chip.skipped': "skipped {count} duplicates";
|
|
147
|
+
readonly 'core.form.chip.more': "Show {count} more";
|
|
148
|
+
readonly 'core.form.chip.clear': "Remove all";
|
|
139
149
|
readonly 'core.form.chip-calendar.required': "Please enter information";
|
|
140
150
|
readonly 'core.form.chip-calendar.minlength': "Please enter at least {min} values";
|
|
141
151
|
readonly 'core.form.chip-calendar.maxlength': "Please enter at most {max} values";
|
|
@@ -494,6 +504,8 @@ export declare const EN_MESSAGES: {
|
|
|
494
504
|
readonly 'core.component.table.selector-action.default-msg': "items selected";
|
|
495
505
|
readonly 'core.component.tab-router.too-many-tabs': "You have opened too many tabs.";
|
|
496
506
|
readonly 'core.component.tab-router.close-tab': "Close tab";
|
|
507
|
+
readonly 'core.component.tab-router.close-others': "Close other tabs";
|
|
508
|
+
readonly 'core.component.tab-router.unsaved': "Unsaved changes";
|
|
497
509
|
readonly 'core.component.tab-router.open-tabs': "{count} open tabs";
|
|
498
510
|
readonly 'core.component.tab-router.tab-list': "Tab list";
|
|
499
511
|
readonly 'core.component.upload-file.upload': "Upload file";
|
|
@@ -542,6 +554,12 @@ export declare const EN_MESSAGES: {
|
|
|
542
554
|
readonly 'core.module.layout.forbidden.title': "Access denied";
|
|
543
555
|
readonly 'core.module.layout.forbidden.message': "You don't have permission to access this page. Please contact your administrator or go back to the home page";
|
|
544
556
|
readonly 'core.module.layout.forbidden.back-home': "Back to home";
|
|
557
|
+
readonly 'core.module.layout.page.actions': "Page actions";
|
|
558
|
+
readonly 'core.module.layout.page.toc': "Contents";
|
|
559
|
+
readonly 'core.module.layout.page.leave.title': "Leave this page without saving?";
|
|
560
|
+
readonly 'core.module.layout.page.leave.message': "Unsaved changes will be lost.";
|
|
561
|
+
readonly 'core.module.layout.page.leave.stay': "Stay";
|
|
562
|
+
readonly 'core.module.layout.page.leave.leave': "Leave";
|
|
545
563
|
readonly 'core.module.layout.not-found.title': "404 - Page not found";
|
|
546
564
|
readonly 'core.module.layout.not-found.message': "The page you're looking for doesn't exist or has been removed. Please check the URL or go back to the home page to continue.";
|
|
547
565
|
readonly 'core.module.layout.not-found.back': "Go back";
|
|
@@ -870,11 +888,35 @@ export declare const EN_MESSAGES: {
|
|
|
870
888
|
readonly 'core.form.select.search': "Search";
|
|
871
889
|
readonly 'core.form.search-field.clear': "Clear search";
|
|
872
890
|
readonly 'core.component.table.loading': "Loading table data";
|
|
891
|
+
readonly 'core.component.table.loaded': "Loaded {count} rows";
|
|
892
|
+
readonly 'core.component.table.loaded-one': "Loaded 1 row";
|
|
893
|
+
readonly 'core.component.table.tree-toggle': "Toggle child rows";
|
|
873
894
|
readonly 'core.component.upload-file.loading': "Uploading file";
|
|
874
895
|
readonly 'core.component.import-excel.loading': "Loading data";
|
|
875
896
|
readonly 'core.component.upload-file.remove': "Remove file";
|
|
876
897
|
readonly 'core.component.upload-file.zoom': "Zoom image";
|
|
877
898
|
readonly 'core.component.upload-file.view-all': "View all images";
|
|
899
|
+
readonly 'core.component.upload-file.viewer.download': "Download";
|
|
900
|
+
readonly 'core.component.upload-file.viewer.open-new-tab': "Open in new tab";
|
|
901
|
+
readonly 'core.component.upload-file.viewer.zoom-in': "Zoom in";
|
|
902
|
+
readonly 'core.component.upload-file.viewer.zoom-out': "Zoom out";
|
|
903
|
+
readonly 'core.component.upload-file.viewer.fit': "Fit to window";
|
|
904
|
+
readonly 'core.component.upload-file.viewer.rotate': "Rotate";
|
|
905
|
+
readonly 'core.component.upload-file.viewer.prev': "Previous file";
|
|
906
|
+
readonly 'core.component.upload-file.viewer.next': "Next file";
|
|
907
|
+
readonly 'core.component.upload-file.viewer.load-error': "Could not load the file";
|
|
908
|
+
readonly 'core.component.upload-file.viewer.load-error-hint': "Try again or download it to open in another app.";
|
|
909
|
+
readonly 'core.component.upload-file.viewer.no-preview': "No preview available";
|
|
910
|
+
readonly 'core.component.upload-file.viewer.loading': "Loading…";
|
|
911
|
+
readonly 'core.component.upload-file.viewer.position': "File {index} of {total}";
|
|
912
|
+
readonly 'core.component.upload-file.retry': "Retry";
|
|
913
|
+
readonly 'core.component.upload-file.add-image': "Add image";
|
|
914
|
+
readonly 'core.component.upload-file.upload-tile': "Upload";
|
|
915
|
+
readonly 'core.component.upload-file.drop-hint': "Drag files here or";
|
|
916
|
+
readonly 'core.component.upload-file.choose-file': "choose a file";
|
|
917
|
+
readonly 'core.component.upload-file.drop-to-upload': "Drop to upload";
|
|
918
|
+
readonly 'core.component.upload-file.remove-named': "Remove {name}";
|
|
919
|
+
readonly 'core.component.upload-file.no-files': "No files";
|
|
878
920
|
readonly 'core.component.form-builder.canvas': "Form design canvas";
|
|
879
921
|
readonly 'core.component.form-builder.toolbar': "Form builder toolbar";
|
|
880
922
|
readonly 'core.component.form-builder.mode': "Mode";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './page/page.component';
|
|
2
|
+
export * from './page/page-form-leave.guard';
|
|
3
|
+
export * from './page-list/page-list.component';
|
|
2
4
|
export * from './layout-main/layout-main.component';
|
|
3
5
|
export * from './sidebar-mobile-v1/main.component';
|
|
4
6
|
export * from './sidebar-mobile-v1/components/sidebar/sidebar.component';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CanDeactivateFn } from '@angular/router';
|
|
2
|
+
/**
|
|
3
|
+
* Guard rời trang của `sd-page-form`: còn thay đổi chưa lưu (watcher của `SdUnsavedChangesService`, thường đăng ký
|
|
4
|
+
* bằng `registerSdUnsavedChangesForm(..., { dirty: 'value' })`) thì hỏi bằng dialog xác nhận của Core.
|
|
5
|
+
*
|
|
6
|
+
* why: adapter của service là của cả app (mặc định `window.confirm`); guard này truyền adapter riêng cho lần hỏi
|
|
7
|
+
* này nên app đang dùng `sdUnsavedChangesGuard` không đổi hành vi.
|
|
8
|
+
*/
|
|
9
|
+
export declare const sdPageFormLeaveGuard: CanDeactivateFn<unknown>;
|