@sdcorejs/angular 20.3.2 → 20.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 +19 -1
- package/components/section/index.d.ts +13 -1
- package/components/splitter/index.d.ts +1 -1
- package/components/tab-router/index.d.ts +47 -5
- package/components/table/index.d.ts +127 -13
- package/components/upload-file/index.d.ts +181 -21
- 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 +393 -78
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +444 -16
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +887 -174
- 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 +422 -122
- 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-DnbDCdcz.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-DnbDCdcz.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-EBHM4kx2.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-EBHM4kx2.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BtHe8YIW.mjs → sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BtHe8YIW.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-eFshU7ew.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-eFshU7ew.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +266 -11
- 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-BubUwgBK.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-BubUwgBK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C9WQdsEi.mjs +131 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C9WQdsEi.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-s7ZXoakT.mjs +130 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-s7ZXoakT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BxfQux1Q.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BxfQux1Q.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-D4GrcahQ.mjs +460 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-D4GrcahQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlYVJqHo.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlYVJqHo.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-Bfx6_CmA.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-Bfx6_CmA.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-3PUIy1Vi.mjs +148 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-3PUIy1Vi.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CbYMo3D1.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CbYMo3D1.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-awjgX7ph.mjs +90 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-awjgX7ph.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-c__NdSt3.mjs +467 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-c__NdSt3.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-Bjvq6wJz.mjs +514 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-Bjvq6wJz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs +61 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs +87 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-pqT7lnS6.mjs +170 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-pqT7lnS6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs +70 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DZXPZuM4.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DZXPZuM4.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BjMOON6K.mjs +522 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BjMOON6K.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bf9QWXBp.mjs +115 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bf9QWXBp.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CuDjsIzi.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CuDjsIzi.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkVrMSPZ.mjs +164 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkVrMSPZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkxheDVz.mjs +629 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkxheDVz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-E8rkFCkK.mjs +71 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-E8rkFCkK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DgmM-wTI.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DgmM-wTI.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-C3coYwmZ.mjs +48 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-C3coYwmZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-YsWsrKWJ.mjs +297 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-YsWsrKWJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-9ujH01cX.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-9ujH01cX.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BfpsCkim.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BfpsCkim.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C7b5dRrJ.mjs +165 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C7b5dRrJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CGeqkySv.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CGeqkySv.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DoBxGoRE.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DoBxGoRE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-dBuQqYkO.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-dBuQqYkO.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-quSIwMOx.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-quSIwMOx.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-rR-MpQFh.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-rR-MpQFh.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-LQNpFSmN.mjs +406 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-LQNpFSmN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-CcmrUIvP.mjs +317 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-CcmrUIvP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Cq72tG9h.mjs +143 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Cq72tG9h.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-xFbutFLY.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-xFbutFLY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CsfGgGJb.mjs +128 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CsfGgGJb.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DYPI_CRD.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DYPI_CRD.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lHmdUXWT.mjs +357 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lHmdUXWT.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/index.d.ts +136 -26
- package/i18n/index.d.ts +42 -0
- package/modules/layout/index.d.ts +89 -6
- package/modules/pattern/README.md +76 -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.ts +21 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -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.ts +30 -0
- package/modules/pattern/features/approval/services/approval.model.ts +38 -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.ts +123 -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.ts +134 -0
- package/modules/pattern/features/category/entity.resolver.ts +27 -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.ts +42 -0
- package/modules/pattern/features/category/services/category.model.ts +39 -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.ts +131 -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.ts +30 -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.ts +106 -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.ts +140 -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.ts +35 -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.ts +127 -0
- package/modules/pattern/features/customer/entity.resolver.ts +21 -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.ts +120 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
- package/modules/pattern/features/customer/routes.ts +59 -0
- package/modules/pattern/features/customer/services/customer.model.ts +87 -0
- package/modules/pattern/features/customer/services/customer.service.ts +79 -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.ts +44 -0
- package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
- package/modules/pattern/features/import/routes.ts +19 -0
- package/modules/pattern/features/import/services/import.model.ts +82 -0
- package/modules/pattern/features/import/services/import.service.ts +18 -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.ts +46 -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.ts +205 -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.ts +128 -0
- package/modules/pattern/features/order/entity.resolver.ts +37 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
- package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -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.ts +119 -0
- package/modules/pattern/features/order/routes.ts +54 -0
- package/modules/pattern/features/order/services/order.model.ts +109 -0
- package/modules/pattern/features/order/services/order.service.ts +63 -0
- package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
- package/modules/pattern/features/partner/routes.ts +20 -0
- package/modules/pattern/features/partner/services/partner.model.ts +30 -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.ts +88 -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.ts +30 -0
- package/modules/pattern/features/product/entity.resolver.ts +21 -0
- package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
- package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -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.ts +86 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
- package/modules/pattern/features/product/routes.ts +48 -0
- package/modules/pattern/features/product/services/product.model.ts +38 -0
- package/modules/pattern/features/product/services/product.service.ts +48 -0
- package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
- package/modules/pattern/features/settings/routes.ts +24 -0
- package/modules/pattern/features/settings/services/settings.model.ts +18 -0
- package/modules/pattern/features/settings/services/settings.service.ts +15 -0
- package/modules/pattern/features/settings/settings.resolver.ts +8 -0
- package/modules/pattern/index.d.ts +50 -0
- package/package.json +5 -1
- package/services/unsaved-changes/index.d.ts +11 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { signal, inject, DestroyRef, computed } from '@angular/core';
|
|
2
|
+
import { b as apiFieldErrors } from './sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native controls of the Core form fields in an error state: Angular marks `ng-invalid` where the control is bound to
|
|
6
|
+
* the field's own control; `sd-input-number` binds a display control instead and reports the error with `aria-invalid`.
|
|
7
|
+
*/
|
|
8
|
+
const INVALID_CONTROL = 'input.ng-invalid, textarea.ng-invalid, mat-select.ng-invalid, input[aria-invalid="true"]';
|
|
9
|
+
/**
|
|
10
|
+
* Focuses the first invalid field inside `host`, in DOM order, and scrolls it into view.
|
|
11
|
+
* Call it after the view rendered the validation state (for example in `afterNextRender`).
|
|
12
|
+
*/
|
|
13
|
+
function focusFirstInvalid(host) {
|
|
14
|
+
const field = host.querySelector(INVALID_CONTROL);
|
|
15
|
+
if (!field)
|
|
16
|
+
return false;
|
|
17
|
+
field.scrollIntoView({ block: 'center' });
|
|
18
|
+
field.focus();
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** `lines.2.quantity` → value of that control. */
|
|
23
|
+
const valueAt = (value, path) => path
|
|
24
|
+
.split('.')
|
|
25
|
+
.reduce((current, key) => (current && typeof current === 'object' ? current[key] : undefined), value);
|
|
26
|
+
const sameValue = (left, right) => Object.is(left, right) || JSON.stringify(left) === JSON.stringify(right);
|
|
27
|
+
/**
|
|
28
|
+
* Field errors of a save that the API rejected (`errors: [{ field, message }]`, a field path such as `lines.2.quantity`
|
|
29
|
+
* for a row). A field keeps its error until the user changes its value, so the next save is not blocked by an answer that no longer applies.
|
|
30
|
+
* Call it in an injection context (a field initializer of the page or drawer).
|
|
31
|
+
*/
|
|
32
|
+
function formApiErrors(form) {
|
|
33
|
+
const failure = signal(null, ...(ngDevMode ? [{ debugName: "failure" }] : []));
|
|
34
|
+
// why: Core fields write their model with `emitEvent: false`; until the user edits, `valueChanges` has not seen
|
|
35
|
+
// those values. `set()` reads the value again, so the error of a save made without edits still shows.
|
|
36
|
+
const value = signal(form.getRawValue(), ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
37
|
+
const subscription = form.valueChanges.subscribe(() => value.set(form.getRawValue()));
|
|
38
|
+
inject(DestroyRef).onDestroy(() => subscription.unsubscribe());
|
|
39
|
+
const errors = computed(() => {
|
|
40
|
+
const current = failure();
|
|
41
|
+
if (!current)
|
|
42
|
+
return {};
|
|
43
|
+
const now = value();
|
|
44
|
+
return Object.fromEntries(Object.entries(current.errors).filter(([field]) => sameValue(valueAt(now, field), valueAt(current.value, field))));
|
|
45
|
+
}, ...(ngDevMode ? [{ debugName: "errors" }] : []));
|
|
46
|
+
return {
|
|
47
|
+
errors,
|
|
48
|
+
set: error => {
|
|
49
|
+
// A field the form does not show (`parentId` of a drawer opened under a parent) is left to the message of the caller.
|
|
50
|
+
const fields = Object.fromEntries(Object.entries(apiFieldErrors(error)).filter(([field]) => !!form.get(field)));
|
|
51
|
+
const current = form.getRawValue();
|
|
52
|
+
value.set(current);
|
|
53
|
+
failure.set({ errors: fields, value: current });
|
|
54
|
+
return Object.keys(fields).length > 0;
|
|
55
|
+
},
|
|
56
|
+
clear: () => failure.set(null),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { focusFirstInvalid as a, formApiErrors as f };
|
|
61
|
+
//# sourceMappingURL=sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs","sources":["../../../projects/sdcorejs-angular/modules/pattern/utils/focus-first-invalid.ts","../../../projects/sdcorejs-angular/modules/pattern/utils/form-api-errors.ts"],"sourcesContent":["/**\n * Native controls of the Core form fields in an error state: Angular marks `ng-invalid` where the control is bound to\n * the field's own control; `sd-input-number` binds a display control instead and reports the error with `aria-invalid`.\n */\nconst INVALID_CONTROL = 'input.ng-invalid, textarea.ng-invalid, mat-select.ng-invalid, input[aria-invalid=\"true\"]';\n\n/**\n * Focuses the first invalid field inside `host`, in DOM order, and scrolls it into view.\n * Call it after the view rendered the validation state (for example in `afterNextRender`).\n */\nexport function focusFirstInvalid(host: HTMLElement): boolean {\n const field = host.querySelector<HTMLElement>(INVALID_CONTROL);\n if (!field) return false;\n field.scrollIntoView({ block: 'center' });\n field.focus();\n return true;\n}\n","import { computed, DestroyRef, inject, signal, type Signal } from '@angular/core';\nimport type { FormGroup } from '@angular/forms';\nimport { apiFieldErrors } from './api-error';\n\n/** `lines.2.quantity` → value of that control. */\nconst valueAt = (value: unknown, path: string): unknown =>\n path\n .split('.')\n .reduce<unknown>(\n (current, key) => (current && typeof current === 'object' ? (current as Record<string, unknown>)[key] : undefined),\n value\n );\n\nconst sameValue = (left: unknown, right: unknown): boolean => Object.is(left, right) || JSON.stringify(left) === JSON.stringify(right);\n\n/** Field errors of the last failed save, shown on the fields through `[inlineError]`. */\nexport interface FormApiErrors {\n /** Field → message, without the fields the user changed since the failure. */\n readonly errors: Signal<Readonly<Record<string, string>>>;\n /** Keeps the field errors of `error`; returns whether one of them is on a field of the form. */\n set(error: unknown): boolean;\n clear(): void;\n}\n\n/**\n * Field errors of a save that the API rejected (`errors: [{ field, message }]`, a field path such as `lines.2.quantity`\n * for a row). A field keeps its error until the user changes its value, so the next save is not blocked by an answer that no longer applies.\n * Call it in an injection context (a field initializer of the page or drawer).\n */\nexport function formApiErrors(form: FormGroup): FormApiErrors {\n const failure = signal<{ errors: Record<string, string>; value: Record<string, unknown> } | null>(null);\n // why: Core fields write their model with `emitEvent: false`; until the user edits, `valueChanges` has not seen\n // those values. `set()` reads the value again, so the error of a save made without edits still shows.\n const value = signal(form.getRawValue() as Record<string, unknown>);\n const subscription = form.valueChanges.subscribe(() => value.set(form.getRawValue() as Record<string, unknown>));\n inject(DestroyRef).onDestroy(() => subscription.unsubscribe());\n const errors = computed(() => {\n const current = failure();\n if (!current) return {};\n const now = value();\n return Object.fromEntries(\n Object.entries(current.errors).filter(([field]) => sameValue(valueAt(now, field), valueAt(current.value, field)))\n );\n });\n return {\n errors,\n set: error => {\n // A field the form does not show (`parentId` of a drawer opened under a parent) is left to the message of the caller.\n const fields = Object.fromEntries(Object.entries(apiFieldErrors(error)).filter(([field]) => !!form.get(field)));\n const current = form.getRawValue() as Record<string, unknown>;\n value.set(current);\n failure.set({ errors: fields, value: current });\n return Object.keys(fields).length > 0;\n },\n clear: () => failure.set(null),\n };\n}\n"],"names":[],"mappings":";;;AAAA;;;AAGG;AACH,MAAM,eAAe,GAAG,0FAA0F;AAElH;;;AAGG;AACG,SAAU,iBAAiB,CAAC,IAAiB,EAAA;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAc,eAAe,CAAC;AAC9D,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,KAAK;IACxB,KAAK,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACzC,KAAK,CAAC,KAAK,EAAE;AACb,IAAA,OAAO,IAAI;AACb;;ACZA;AACA,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,IAAY,KAC3C;KACG,KAAK,CAAC,GAAG;AACT,KAAA,MAAM,CACL,CAAC,OAAO,EAAE,GAAG,MAAM,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,GAAI,OAAmC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,EAClH,KAAK,CACN;AAEL,MAAM,SAAS,GAAG,CAAC,IAA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CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/G,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAA6B;AAC7D,YAAA,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;AAClB,YAAA,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;QACvC,CAAC;QACD,KAAK,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;KAC/B;AACH;;;;"}
|
package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
4
|
+
import { SdView } from '@sdcorejs/angular/components/view';
|
|
5
|
+
import { SdInput } from '@sdcorejs/angular/forms/input';
|
|
6
|
+
import { SdSwitch } from '@sdcorejs/angular/forms/switch';
|
|
7
|
+
|
|
8
|
+
/** Giá trị form → request lưu; danh mục cha do drawer quyết định, không sửa trong form. */
|
|
9
|
+
function categorySaveReq(form, parentId, code) {
|
|
10
|
+
const value = form.getRawValue();
|
|
11
|
+
return { code: code ?? value.code ?? '', name: value.name ?? '', parentId, status: value.active === false ? 'inactive' : 'active' };
|
|
12
|
+
}
|
|
13
|
+
/** Form danh mục một nhóm, dùng chung cho drawer tạo và cập nhật. */
|
|
14
|
+
class GeneralInformationFormComponent {
|
|
15
|
+
form = input.required(...(ngDevMode ? [{ debugName: "form" }] : []));
|
|
16
|
+
seed = input.required(...(ngDevMode ? [{ debugName: "seed" }] : []));
|
|
17
|
+
parentName = input(null, ...(ngDevMode ? [{ debugName: "parentName" }] : []));
|
|
18
|
+
editing = input(false, ...(ngDevMode ? [{ debugName: "editing" }] : []));
|
|
19
|
+
errors = input({}, ...(ngDevMode ? [{ debugName: "errors" }] : []));
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GeneralInformationFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.25", type: GeneralInformationFormComponent, isStandalone: true, selector: "general-information-form", inputs: { form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, seed: { classPropertyName: "seed", publicName: "seed", isSignal: true, isRequired: true, transformFunction: null }, parentName: { classPropertyName: "parentName", publicName: "parentName", isSignal: true, isRequired: false, transformFunction: null }, editing: { classPropertyName: "editing", publicName: "editing", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
22
|
+
<sd-section title="Thông tin chung">
|
|
23
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
24
|
+
<sd-view label="Danh mục cha" [display]="parentName()" />
|
|
25
|
+
<sd-input
|
|
26
|
+
label="Mã danh mục"
|
|
27
|
+
name="code"
|
|
28
|
+
autoId="category-code"
|
|
29
|
+
[form]="form()"
|
|
30
|
+
[model]="seed().code"
|
|
31
|
+
[disabled]="editing()"
|
|
32
|
+
[inlineError]="errors()['code']"
|
|
33
|
+
maxlength="30"
|
|
34
|
+
required />
|
|
35
|
+
<sd-input
|
|
36
|
+
label="Tên danh mục"
|
|
37
|
+
name="name"
|
|
38
|
+
autoId="category-name"
|
|
39
|
+
[form]="form()"
|
|
40
|
+
[model]="seed().name"
|
|
41
|
+
[inlineError]="errors()['name']"
|
|
42
|
+
maxlength="100"
|
|
43
|
+
required />
|
|
44
|
+
<sd-switch label="Đang dùng" name="active" [form]="form()" [model]="seed().status !== 'inactive'" />
|
|
45
|
+
</div>
|
|
46
|
+
</sd-section>
|
|
47
|
+
`, isInline: true, dependencies: [{ kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "iconShape", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSwitch, selector: "sd-switch", inputs: ["autoId", "name", "form", "label", "size", "color", "disabled", "viewed", "hideInlineError", "required", "model"], outputs: ["modelChange", "sdChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GeneralInformationFormComponent, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{
|
|
52
|
+
selector: 'general-information-form',
|
|
53
|
+
standalone: true,
|
|
54
|
+
imports: [SdSection, SdView, SdInput, SdSwitch],
|
|
55
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
56
|
+
template: `
|
|
57
|
+
<sd-section title="Thông tin chung">
|
|
58
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
59
|
+
<sd-view label="Danh mục cha" [display]="parentName()" />
|
|
60
|
+
<sd-input
|
|
61
|
+
label="Mã danh mục"
|
|
62
|
+
name="code"
|
|
63
|
+
autoId="category-code"
|
|
64
|
+
[form]="form()"
|
|
65
|
+
[model]="seed().code"
|
|
66
|
+
[disabled]="editing()"
|
|
67
|
+
[inlineError]="errors()['code']"
|
|
68
|
+
maxlength="30"
|
|
69
|
+
required />
|
|
70
|
+
<sd-input
|
|
71
|
+
label="Tên danh mục"
|
|
72
|
+
name="name"
|
|
73
|
+
autoId="category-name"
|
|
74
|
+
[form]="form()"
|
|
75
|
+
[model]="seed().name"
|
|
76
|
+
[inlineError]="errors()['name']"
|
|
77
|
+
maxlength="100"
|
|
78
|
+
required />
|
|
79
|
+
<sd-switch label="Đang dùng" name="active" [form]="form()" [model]="seed().status !== 'inactive'" />
|
|
80
|
+
</div>
|
|
81
|
+
</sd-section>
|
|
82
|
+
`,
|
|
83
|
+
}]
|
|
84
|
+
}], propDecorators: { form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: true }] }], seed: [{ type: i0.Input, args: [{ isSignal: true, alias: "seed", required: true }] }], parentName: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentName", required: false }] }], editing: [{ type: i0.Input, args: [{ isSignal: true, alias: "editing", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }] } });
|
|
85
|
+
|
|
86
|
+
export { GeneralInformationFormComponent as G, categorySaveReq as c };
|
|
87
|
+
//# sourceMappingURL=sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs","sources":["../../../projects/sdcorejs-angular/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport type { FormControl, FormGroup } from '@angular/forms';\nimport { SdSection } from '@sdcorejs/angular/components/section';\nimport { SdView } from '@sdcorejs/angular/components/view';\nimport { SdInput } from '@sdcorejs/angular/forms/input';\nimport { SdSwitch } from '@sdcorejs/angular/forms/switch';\nimport type { CategorySaveReq } from '../../services/category.model';\n\nexport type CategoryForm = FormGroup<{\n code?: FormControl<string>;\n name?: FormControl<string>;\n active?: FormControl<boolean>;\n}>;\n\n/** Giá trị form → request lưu; danh mục cha do drawer quyết định, không sửa trong form. */\nexport function categorySaveReq(form: CategoryForm, parentId: string | null, code?: string): CategorySaveReq {\n const value = form.getRawValue();\n return { code: code ?? value.code ?? '', name: value.name ?? '', parentId, status: value.active === false ? 'inactive' : 'active' };\n}\n\n/** Form danh mục một nhóm, dùng chung cho drawer tạo và cập nhật. */\n@Component({\n selector: 'general-information-form',\n standalone: true,\n imports: [SdSection, SdView, SdInput, SdSwitch],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <sd-section title=\"Thông tin chung\">\n <div class=\"d-flex flex-column gap-8 p-16\">\n <sd-view label=\"Danh mục cha\" [display]=\"parentName()\" />\n <sd-input\n label=\"Mã danh mục\"\n name=\"code\"\n autoId=\"category-code\"\n [form]=\"form()\"\n [model]=\"seed().code\"\n [disabled]=\"editing()\"\n [inlineError]=\"errors()['code']\"\n maxlength=\"30\"\n required />\n <sd-input\n label=\"Tên danh mục\"\n name=\"name\"\n autoId=\"category-name\"\n [form]=\"form()\"\n [model]=\"seed().name\"\n [inlineError]=\"errors()['name']\"\n maxlength=\"100\"\n required />\n <sd-switch label=\"Đang dùng\" name=\"active\" [form]=\"form()\" [model]=\"seed().status !== 'inactive'\" />\n </div>\n </sd-section>\n `,\n})\nexport class GeneralInformationFormComponent {\n readonly form = input.required<CategoryForm>();\n readonly seed = input.required<CategorySaveReq>();\n readonly parentName = input<string | null>(null);\n readonly editing = input(false);\n readonly errors = input<Readonly<Record<string, string>>>({});\n}\n"],"names":[],"mappings":";;;;;;;AAcA;SACgB,eAAe,CAAC,IAAkB,EAAE,QAAuB,EAAE,IAAa,EAAA;AACxF,IAAA,MAA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A,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FA8BnC,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAjC3C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,0BAA0B;AACpC,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;oBAC/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BT,EAAA,CAAA;AACF,iBAAA;;;;;"}
|
package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, model, ChangeDetectionStrategy, Component, linkedSignal } from '@angular/core';
|
|
3
|
+
import { SdInform } from '@sdcorejs/angular/components/inform';
|
|
4
|
+
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
5
|
+
import { SdInput } from '@sdcorejs/angular/forms/input';
|
|
6
|
+
import { SdSwitch } from '@sdcorejs/angular/forms/switch';
|
|
7
|
+
import { SdTextarea } from '@sdcorejs/angular/forms/textarea';
|
|
8
|
+
import { SdSelect } from '@sdcorejs/angular/forms/select';
|
|
9
|
+
import { C as CUSTOMER_TYPE_OPTIONS } from './sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs';
|
|
10
|
+
|
|
11
|
+
/** Dropdown loại khách hàng. */
|
|
12
|
+
class CustomerTypeSelectComponent {
|
|
13
|
+
form = input(...(ngDevMode ? [undefined, { debugName: "form" }] : []));
|
|
14
|
+
name = input('type', ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
15
|
+
label = input('Loại khách hàng', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
16
|
+
required = input(true, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
17
|
+
model = model(...(ngDevMode ? [undefined, { debugName: "model" }] : []));
|
|
18
|
+
options = CUSTOMER_TYPE_OPTIONS;
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: CustomerTypeSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.25", type: CustomerTypeSelectComponent, isStandalone: true, selector: "customer-type-select", inputs: { form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange" }, ngImport: i0, template: `<sd-select
|
|
21
|
+
[label]="label()"
|
|
22
|
+
[name]="name()"
|
|
23
|
+
[form]="form()"
|
|
24
|
+
[(model)]="model"
|
|
25
|
+
[items]="options"
|
|
26
|
+
valueField="id"
|
|
27
|
+
displayField="name"
|
|
28
|
+
[required]="required()"
|
|
29
|
+
[clearable]="false" />`, isInline: true, dependencies: [{ kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: CustomerTypeSelectComponent, decorators: [{
|
|
32
|
+
type: Component,
|
|
33
|
+
args: [{
|
|
34
|
+
selector: 'customer-type-select',
|
|
35
|
+
standalone: true,
|
|
36
|
+
imports: [SdSelect],
|
|
37
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
38
|
+
template: `<sd-select
|
|
39
|
+
[label]="label()"
|
|
40
|
+
[name]="name()"
|
|
41
|
+
[form]="form()"
|
|
42
|
+
[(model)]="model"
|
|
43
|
+
[items]="options"
|
|
44
|
+
valueField="id"
|
|
45
|
+
displayField="name"
|
|
46
|
+
[required]="required()"
|
|
47
|
+
[clearable]="false" />`,
|
|
48
|
+
}]
|
|
49
|
+
}], propDecorators: { form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }] } });
|
|
50
|
+
|
|
51
|
+
const GROUP_FIELDS = {
|
|
52
|
+
general: ['name', 'type', 'taxCode', 'vip'],
|
|
53
|
+
contact: ['email', 'phone', 'address'],
|
|
54
|
+
other: ['active', 'note'],
|
|
55
|
+
};
|
|
56
|
+
/** Nhóm có field không hợp lệ: field còn lỗi validate hoặc lỗi do API trả về. */
|
|
57
|
+
function invalidCustomerGroups(form, apiErrors) {
|
|
58
|
+
return Object.keys(GROUP_FIELDS).filter(group => GROUP_FIELDS[group].some(field => form.get(field)?.invalid || !!apiErrors[field]));
|
|
59
|
+
}
|
|
60
|
+
/** Giá trị form → request lưu. */
|
|
61
|
+
function customerSaveReq(form) {
|
|
62
|
+
const value = form.getRawValue();
|
|
63
|
+
const type = value.type ?? 'individual';
|
|
64
|
+
const tier = value.vip ? 'vip' : 'standard';
|
|
65
|
+
const status = value.active === false ? 'inactive' : 'active';
|
|
66
|
+
return {
|
|
67
|
+
name: value.name ?? '',
|
|
68
|
+
type,
|
|
69
|
+
tier,
|
|
70
|
+
email: value.email ?? '',
|
|
71
|
+
phone: value.phone ?? '',
|
|
72
|
+
address: value.address ?? '',
|
|
73
|
+
taxCode: type === 'business' ? (value.taxCode ?? null) : null,
|
|
74
|
+
status,
|
|
75
|
+
note: value.note || null,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** Form khách hàng ba nhóm, dùng chung cho drawer tạo mới và cập nhật. */
|
|
79
|
+
class GeneralInformationFormComponent {
|
|
80
|
+
form = input.required(...(ngDevMode ? [{ debugName: "form" }] : []));
|
|
81
|
+
seed = input.required(...(ngDevMode ? [{ debugName: "seed" }] : []));
|
|
82
|
+
/** Lỗi theo field do API trả về. */
|
|
83
|
+
errors = input({}, ...(ngDevMode ? [{ debugName: "errors" }] : []));
|
|
84
|
+
invalidGroups = input([], ...(ngDevMode ? [{ debugName: "invalidGroups" }] : []));
|
|
85
|
+
/** Loại khách đang chọn: doanh nghiệp mới có mã số thuế. */
|
|
86
|
+
type = linkedSignal(() => this.seed().type, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
87
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GeneralInformationFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
88
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: GeneralInformationFormComponent, isStandalone: true, selector: "general-information-form", inputs: { form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, seed: { classPropertyName: "seed", publicName: "seed", isSignal: true, isRequired: true, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, invalidGroups: { classPropertyName: "invalidGroups", publicName: "invalidGroups", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
89
|
+
@let invalid = invalidGroups();
|
|
90
|
+
<div class="d-flex flex-column gap-16">
|
|
91
|
+
<sd-section title="Thông tin chung">
|
|
92
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
93
|
+
@if (invalid.includes('general')) {
|
|
94
|
+
<sd-inform warning description="Kiểm tra tên và loại khách hàng." autoId="customer-general-warning" />
|
|
95
|
+
}
|
|
96
|
+
<sd-input
|
|
97
|
+
label="Tên khách hàng"
|
|
98
|
+
name="name"
|
|
99
|
+
autoId="customer-name"
|
|
100
|
+
[form]="form()"
|
|
101
|
+
[model]="seed().name"
|
|
102
|
+
[inlineError]="errors()['name']"
|
|
103
|
+
maxlength="120"
|
|
104
|
+
required />
|
|
105
|
+
<customer-type-select [form]="form()" [model]="seed().type" (modelChange)="type.set($event ?? 'individual')" />
|
|
106
|
+
@if (type() === 'business') {
|
|
107
|
+
<sd-input
|
|
108
|
+
label="Mã số thuế"
|
|
109
|
+
name="taxCode"
|
|
110
|
+
autoId="customer-tax-code"
|
|
111
|
+
[form]="form()"
|
|
112
|
+
[model]="seed().taxCode"
|
|
113
|
+
[inlineError]="errors()['taxCode']"
|
|
114
|
+
maxlength="14"
|
|
115
|
+
required />
|
|
116
|
+
}
|
|
117
|
+
<sd-switch label="Khách VIP" name="vip" [form]="form()" [model]="seed().tier === 'vip'" />
|
|
118
|
+
</div>
|
|
119
|
+
</sd-section>
|
|
120
|
+
<sd-section title="Liên hệ">
|
|
121
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
122
|
+
@if (invalid.includes('contact')) {
|
|
123
|
+
<sd-inform warning description="Kiểm tra email và số điện thoại." autoId="customer-contact-warning" />
|
|
124
|
+
}
|
|
125
|
+
<sd-input
|
|
126
|
+
label="Email"
|
|
127
|
+
name="email"
|
|
128
|
+
autoId="customer-email"
|
|
129
|
+
[form]="form()"
|
|
130
|
+
[model]="seed().email"
|
|
131
|
+
[inlineError]="errors()['email']"
|
|
132
|
+
pattern="EMAIL"
|
|
133
|
+
required />
|
|
134
|
+
<sd-input
|
|
135
|
+
label="Điện thoại"
|
|
136
|
+
name="phone"
|
|
137
|
+
autoId="customer-phone"
|
|
138
|
+
[form]="form()"
|
|
139
|
+
[model]="seed().phone"
|
|
140
|
+
[inlineError]="errors()['phone']"
|
|
141
|
+
maxlength="15"
|
|
142
|
+
required />
|
|
143
|
+
<sd-input label="Địa chỉ" name="address" autoId="customer-address" [form]="form()" [model]="seed().address" maxlength="200" />
|
|
144
|
+
</div>
|
|
145
|
+
</sd-section>
|
|
146
|
+
<sd-section title="Khác">
|
|
147
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
148
|
+
<sd-switch label="Đang hoạt động" name="active" [form]="form()" [model]="seed().status !== 'inactive'" />
|
|
149
|
+
<sd-textarea label="Ghi chú" name="note" [form]="form()" [model]="seed().note" maxlength="500" />
|
|
150
|
+
</div>
|
|
151
|
+
</sd-section>
|
|
152
|
+
</div>
|
|
153
|
+
`, isInline: true, dependencies: [{ kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "iconShape", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdTextarea, selector: "sd-textarea", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "rows", "hideInlineError", "required", "disabled", "viewed", "autoHeight", "maxlength", "minlength", "pattern", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdSwitch, selector: "sd-switch", inputs: ["autoId", "name", "form", "label", "size", "color", "disabled", "viewed", "hideInlineError", "required", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdInform, selector: "sd-inform", inputs: ["type", "color", "primary", "secondary", "info", "success", "warning", "error", "title", "description", "icon", "hideIcon", "iconShape", "fontSet", "closable", "actionLabel", "lineClamp", "autoId"], outputs: ["sdClosed", "sdAction"] }, { kind: "component", type: CustomerTypeSelectComponent, selector: "customer-type-select", inputs: ["form", "name", "label", "required", "model"], outputs: ["modelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
154
|
+
}
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: GeneralInformationFormComponent, decorators: [{
|
|
156
|
+
type: Component,
|
|
157
|
+
args: [{
|
|
158
|
+
selector: 'general-information-form',
|
|
159
|
+
standalone: true,
|
|
160
|
+
imports: [SdSection, SdInput, SdTextarea, SdSwitch, SdInform, CustomerTypeSelectComponent],
|
|
161
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
162
|
+
template: `
|
|
163
|
+
@let invalid = invalidGroups();
|
|
164
|
+
<div class="d-flex flex-column gap-16">
|
|
165
|
+
<sd-section title="Thông tin chung">
|
|
166
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
167
|
+
@if (invalid.includes('general')) {
|
|
168
|
+
<sd-inform warning description="Kiểm tra tên và loại khách hàng." autoId="customer-general-warning" />
|
|
169
|
+
}
|
|
170
|
+
<sd-input
|
|
171
|
+
label="Tên khách hàng"
|
|
172
|
+
name="name"
|
|
173
|
+
autoId="customer-name"
|
|
174
|
+
[form]="form()"
|
|
175
|
+
[model]="seed().name"
|
|
176
|
+
[inlineError]="errors()['name']"
|
|
177
|
+
maxlength="120"
|
|
178
|
+
required />
|
|
179
|
+
<customer-type-select [form]="form()" [model]="seed().type" (modelChange)="type.set($event ?? 'individual')" />
|
|
180
|
+
@if (type() === 'business') {
|
|
181
|
+
<sd-input
|
|
182
|
+
label="Mã số thuế"
|
|
183
|
+
name="taxCode"
|
|
184
|
+
autoId="customer-tax-code"
|
|
185
|
+
[form]="form()"
|
|
186
|
+
[model]="seed().taxCode"
|
|
187
|
+
[inlineError]="errors()['taxCode']"
|
|
188
|
+
maxlength="14"
|
|
189
|
+
required />
|
|
190
|
+
}
|
|
191
|
+
<sd-switch label="Khách VIP" name="vip" [form]="form()" [model]="seed().tier === 'vip'" />
|
|
192
|
+
</div>
|
|
193
|
+
</sd-section>
|
|
194
|
+
<sd-section title="Liên hệ">
|
|
195
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
196
|
+
@if (invalid.includes('contact')) {
|
|
197
|
+
<sd-inform warning description="Kiểm tra email và số điện thoại." autoId="customer-contact-warning" />
|
|
198
|
+
}
|
|
199
|
+
<sd-input
|
|
200
|
+
label="Email"
|
|
201
|
+
name="email"
|
|
202
|
+
autoId="customer-email"
|
|
203
|
+
[form]="form()"
|
|
204
|
+
[model]="seed().email"
|
|
205
|
+
[inlineError]="errors()['email']"
|
|
206
|
+
pattern="EMAIL"
|
|
207
|
+
required />
|
|
208
|
+
<sd-input
|
|
209
|
+
label="Điện thoại"
|
|
210
|
+
name="phone"
|
|
211
|
+
autoId="customer-phone"
|
|
212
|
+
[form]="form()"
|
|
213
|
+
[model]="seed().phone"
|
|
214
|
+
[inlineError]="errors()['phone']"
|
|
215
|
+
maxlength="15"
|
|
216
|
+
required />
|
|
217
|
+
<sd-input label="Địa chỉ" name="address" autoId="customer-address" [form]="form()" [model]="seed().address" maxlength="200" />
|
|
218
|
+
</div>
|
|
219
|
+
</sd-section>
|
|
220
|
+
<sd-section title="Khác">
|
|
221
|
+
<div class="d-flex flex-column gap-8 p-16">
|
|
222
|
+
<sd-switch label="Đang hoạt động" name="active" [form]="form()" [model]="seed().status !== 'inactive'" />
|
|
223
|
+
<sd-textarea label="Ghi chú" name="note" [form]="form()" [model]="seed().note" maxlength="500" />
|
|
224
|
+
</div>
|
|
225
|
+
</sd-section>
|
|
226
|
+
</div>
|
|
227
|
+
`,
|
|
228
|
+
}]
|
|
229
|
+
}], propDecorators: { form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: true }] }], seed: [{ type: i0.Input, args: [{ isSignal: true, alias: "seed", required: true }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], invalidGroups: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalidGroups", required: false }] }] } });
|
|
230
|
+
|
|
231
|
+
export { GeneralInformationFormComponent as G, customerSaveReq as c, invalidCustomerGroups as i };
|
|
232
|
+
//# sourceMappingURL=sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs","sources":["../../../projects/sdcorejs-angular/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts","../../../projects/sdcorejs-angular/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, model } from '@angular/core';\nimport type { FormGroup } from '@angular/forms';\nimport { SdSelect } from '@sdcorejs/angular/forms/select';\nimport { CUSTOMER_TYPE_OPTIONS, type CustomerType } from '../../services/customer.model';\n\n/** Dropdown loại khách hàng. */\n@Component({\n selector: 'customer-type-select',\n standalone: true,\n imports: [SdSelect],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `<sd-select\n [label]=\"label()\"\n [name]=\"name()\"\n [form]=\"form()\"\n [(model)]=\"model\"\n [items]=\"options\"\n valueField=\"id\"\n displayField=\"name\"\n [required]=\"required()\"\n [clearable]=\"false\" />`,\n})\nexport class CustomerTypeSelectComponent {\n readonly form = input<FormGroup>();\n readonly name = input('type');\n readonly label = input('Loại khách hàng');\n readonly required = input(true);\n readonly model = model<CustomerType | null | undefined>();\n protected readonly options = CUSTOMER_TYPE_OPTIONS;\n}\n","import { ChangeDetectionStrategy, Component, input, linkedSignal } from '@angular/core';\nimport type { FormControl, FormGroup } from '@angular/forms';\nimport { SdInform } from '@sdcorejs/angular/components/inform';\nimport { SdSection } from '@sdcorejs/angular/components/section';\nimport { SdInput } from '@sdcorejs/angular/forms/input';\nimport { SdSwitch } from '@sdcorejs/angular/forms/switch';\nimport { SdTextarea } from '@sdcorejs/angular/forms/textarea';\nimport type { CustomerSaveReq, CustomerStatus, CustomerTier, CustomerType } from '../../services/customer.model';\nimport { CustomerTypeSelectComponent } from '../customer-type-select/customer-type-select.component';\n\n/** Các field Core tự đăng ký control qua `[form]` + `name`. */\nexport type CustomerForm = FormGroup<{\n name?: FormControl<string>;\n type?: FormControl<CustomerType>;\n taxCode?: FormControl<string | null>;\n vip?: FormControl<boolean>;\n email?: FormControl<string>;\n phone?: FormControl<string>;\n address?: FormControl<string>;\n active?: FormControl<boolean>;\n note?: FormControl<string | null>;\n}>;\n\n/** Ba nhóm của form; nhóm còn lỗi sau khi bấm Lưu hiện `sd-inform` cảnh báo ngay trong nhóm. */\nexport type CustomerFormGroup = 'general' | 'contact' | 'other';\n\nconst GROUP_FIELDS: Readonly<Record<CustomerFormGroup, readonly string[]>> = {\n general: ['name', 'type', 'taxCode', 'vip'],\n contact: ['email', 'phone', 'address'],\n other: ['active', 'note'],\n};\n\n/** Nhóm có field không hợp lệ: field còn lỗi validate hoặc lỗi do API trả về. */\nexport function invalidCustomerGroups(form: CustomerForm, apiErrors: Readonly<Record<string, string>>): CustomerFormGroup[] {\n return (Object.keys(GROUP_FIELDS) as CustomerFormGroup[]).filter(group =>\n GROUP_FIELDS[group].some(field => form.get(field)?.invalid || !!apiErrors[field])\n );\n}\n\n/** Giá trị form → request lưu. */\nexport function customerSaveReq(form: CustomerForm): CustomerSaveReq {\n const value = form.getRawValue();\n const type: CustomerType = value.type ?? 'individual';\n const tier: CustomerTier = value.vip ? 'vip' : 'standard';\n const status: CustomerStatus = value.active === false ? 'inactive' : 'active';\n return {\n name: value.name ?? '',\n type,\n tier,\n email: value.email ?? '',\n phone: value.phone ?? '',\n address: value.address ?? '',\n taxCode: type === 'business' ? (value.taxCode ?? null) : null,\n status,\n note: value.note || null,\n };\n}\n\n/** Form khách hàng ba nhóm, dùng chung cho drawer tạo mới và cập nhật. */\n@Component({\n selector: 'general-information-form',\n standalone: true,\n imports: [SdSection, SdInput, SdTextarea, SdSwitch, SdInform, CustomerTypeSelectComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @let invalid = invalidGroups();\n <div class=\"d-flex flex-column gap-16\">\n <sd-section title=\"Thông tin chung\">\n <div class=\"d-flex flex-column gap-8 p-16\">\n @if (invalid.includes('general')) {\n <sd-inform warning description=\"Kiểm tra tên và loại khách hàng.\" autoId=\"customer-general-warning\" />\n }\n <sd-input\n label=\"Tên khách hàng\"\n name=\"name\"\n autoId=\"customer-name\"\n [form]=\"form()\"\n [model]=\"seed().name\"\n [inlineError]=\"errors()['name']\"\n maxlength=\"120\"\n required />\n <customer-type-select [form]=\"form()\" [model]=\"seed().type\" (modelChange)=\"type.set($event ?? 'individual')\" />\n @if (type() === 'business') {\n <sd-input\n label=\"Mã số thuế\"\n name=\"taxCode\"\n autoId=\"customer-tax-code\"\n [form]=\"form()\"\n [model]=\"seed().taxCode\"\n [inlineError]=\"errors()['taxCode']\"\n maxlength=\"14\"\n required />\n }\n <sd-switch label=\"Khách VIP\" name=\"vip\" [form]=\"form()\" [model]=\"seed().tier === 'vip'\" />\n </div>\n </sd-section>\n <sd-section title=\"Liên hệ\">\n <div class=\"d-flex flex-column gap-8 p-16\">\n @if (invalid.includes('contact')) {\n <sd-inform warning description=\"Kiểm tra email và số điện thoại.\" autoId=\"customer-contact-warning\" />\n }\n <sd-input\n label=\"Email\"\n name=\"email\"\n autoId=\"customer-email\"\n [form]=\"form()\"\n [model]=\"seed().email\"\n [inlineError]=\"errors()['email']\"\n pattern=\"EMAIL\"\n required />\n <sd-input\n label=\"Điện thoại\"\n name=\"phone\"\n autoId=\"customer-phone\"\n [form]=\"form()\"\n [model]=\"seed().phone\"\n [inlineError]=\"errors()['phone']\"\n maxlength=\"15\"\n required />\n <sd-input label=\"Địa chỉ\" name=\"address\" autoId=\"customer-address\" [form]=\"form()\" [model]=\"seed().address\" maxlength=\"200\" />\n </div>\n </sd-section>\n <sd-section title=\"Khác\">\n <div class=\"d-flex flex-column gap-8 p-16\">\n <sd-switch label=\"Đang hoạt động\" name=\"active\" [form]=\"form()\" [model]=\"seed().status !== 'inactive'\" />\n <sd-textarea label=\"Ghi chú\" name=\"note\" [form]=\"form()\" [model]=\"seed().note\" maxlength=\"500\" />\n </div>\n </sd-section>\n </div>\n `,\n})\nexport class GeneralInformationFormComponent {\n readonly form = input.required<CustomerForm>();\n readonly seed = input.required<CustomerSaveReq>();\n /** Lỗi theo field do API trả về. */\n readonly errors = input<Readonly<Record<string, string>>>({});\n readonly invalidGroups = input<readonly CustomerFormGroup[]>([]);\n /** Loại khách đang chọn: doanh nghiệp mới có mã số thuế. */\n protected readonly type = linkedSignal(() => this.seed().type);\n}\n"],"names":[],"mappings":";;;;;;;;;;AAKA;MAiBa,2BAA2B,CAAA;IAC7B,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAa;AACzB,IAAA,IAAI,GAAG,KAAK,CAAC,MAAM,gDAAC;AACpB,IAAA,KAAK,GAAG,KAAK,CAAC,iBAAiB,iDAAC;AAChC,IAAA,QAAQ,GAAG,KAAK,CAAC,IAAI,oDAAC;IACtB,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAmC;IACtC,OAAO,GAAG,qBAAqB;wGANvC,2BAA2B,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