@sdcorejs/angular 22.3.2 → 22.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/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 +398 -78
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +460 -16
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +932 -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 +437 -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 +18 -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-BrJfOTWy.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BrJfOTWy.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-DQYXx2nr.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-DQYXx2nr.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-Cjg3Dfq1.mjs → sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-Cjg3Dfq1.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DpXg2yI7.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DpXg2yI7.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +289 -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-Cfmr0L_5.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs +134 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs +119 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs +469 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.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-B0nhFd_M.mjs +67 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs +152 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs +479 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs +175 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs +92 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs +533 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs +64 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs +92 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs +242 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs +179 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs +72 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs +541 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs +647 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs +120 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs +73 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.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-GSlXwL2Z.mjs +49 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs +301 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs +166 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs +413 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs +325 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs +146 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs +135 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs +129 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs +360 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs +101 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.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/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/package.json +5 -1
- package/types/sdcorejs-angular-components-badge.d.ts +19 -1
- package/types/sdcorejs-angular-components-section.d.ts +13 -1
- package/types/sdcorejs-angular-components-splitter.d.ts +1 -1
- package/types/sdcorejs-angular-components-tab-router.d.ts +47 -5
- package/types/sdcorejs-angular-components-table.d.ts +127 -13
- package/types/sdcorejs-angular-components-upload-file.d.ts +181 -21
- package/types/sdcorejs-angular-forms-chip.d.ts +136 -26
- package/types/sdcorejs-angular-i18n.d.ts +42 -0
- package/types/sdcorejs-angular-modules-layout.d.ts +89 -6
- package/types/sdcorejs-angular-modules-pattern.d.ts +50 -0
- package/types/sdcorejs-angular-services-unsaved-changes.d.ts +11 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, linkedSignal, untracked } from '@angular/core';
|
|
2
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
3
|
+
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
|
4
|
+
import { map } from 'rxjs';
|
|
5
|
+
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
6
|
+
import { SdTab, SdTabGroup } from '@sdcorejs/angular/components/tab';
|
|
7
|
+
import { SdPageComponent } from '@sdcorejs/angular/modules/layout';
|
|
8
|
+
import { SdPermissionDirective } from '@sdcorejs/angular/modules/permission';
|
|
9
|
+
import { DebtsViewComponent } from '../../components/debts-view/debts-view.component';
|
|
10
|
+
import { DocumentsViewComponent } from '../../components/documents-view/documents-view.component';
|
|
11
|
+
import { GeneralInformationViewComponent } from '../../components/general-information-view/general-information-view.component';
|
|
12
|
+
import { OrdersViewComponent } from '../../components/orders-view/orders-view.component';
|
|
13
|
+
import { customerStatusBadge, customerTypeName, type CustomerDto } from '../../services/customer.model';
|
|
14
|
+
|
|
15
|
+
const TABS = [
|
|
16
|
+
{ key: 'info', label: 'Thông tin' },
|
|
17
|
+
{ key: 'orders', label: 'Đơn hàng' },
|
|
18
|
+
{ key: 'debts', label: 'Công nợ' },
|
|
19
|
+
{ key: 'documents', label: 'Tài liệu' },
|
|
20
|
+
] as const;
|
|
21
|
+
type TabKey = (typeof TABS)[number]['key'];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Hồ sơ 360° (`:id/360`): thông tin chung và các quan hệ của khách hàng theo tab. Tab ghi trên URL (`?tab=`);
|
|
25
|
+
* mở tab nào mới tải tab đó, mỗi tab tự có trạng thái đang tải, rỗng và lỗi.
|
|
26
|
+
*/
|
|
27
|
+
@Component({
|
|
28
|
+
selector: 'profile',
|
|
29
|
+
standalone: true,
|
|
30
|
+
imports: [
|
|
31
|
+
RouterLink,
|
|
32
|
+
SdPageComponent,
|
|
33
|
+
SdButton,
|
|
34
|
+
SdTabGroup,
|
|
35
|
+
SdTab,
|
|
36
|
+
SdPermissionDirective,
|
|
37
|
+
GeneralInformationViewComponent,
|
|
38
|
+
OrdersViewComponent,
|
|
39
|
+
DebtsViewComponent,
|
|
40
|
+
DocumentsViewComponent,
|
|
41
|
+
],
|
|
42
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
43
|
+
template: `
|
|
44
|
+
@let customer = entity();
|
|
45
|
+
<sd-page-detail
|
|
46
|
+
[title]="'Hồ sơ khách hàng #' + customer.code"
|
|
47
|
+
[description]="customer.name + ' · ' + typeName()"
|
|
48
|
+
[badges]="badges()"
|
|
49
|
+
[backLink]="['../..']">
|
|
50
|
+
<sd-button
|
|
51
|
+
headerRight
|
|
52
|
+
*sdPermission="'PATTERN_CUSTOMER_U_UPDATE'"
|
|
53
|
+
title="Cập nhật khách hàng"
|
|
54
|
+
prefixIcon="edit"
|
|
55
|
+
type="fill"
|
|
56
|
+
color="primary"
|
|
57
|
+
autoId="customer-profile-update"
|
|
58
|
+
[routerLink]="['../update']" />
|
|
59
|
+
<sd-tab-group sdSubheader [selectedIndex]="tabIndex()" (selectedIndexChange)="selectTab($event)">
|
|
60
|
+
@for (tab of tabs; track tab.key) {
|
|
61
|
+
<sd-tab [label]="tab.label" />
|
|
62
|
+
}
|
|
63
|
+
</sd-tab-group>
|
|
64
|
+
<div class="py-16">
|
|
65
|
+
@for (tab of tabs; track tab.key; let index = $index) {
|
|
66
|
+
@if (opened().has(tab.key)) {
|
|
67
|
+
<div [hidden]="tabIndex() !== index" [attr.data-customer-tab]="tab.key">
|
|
68
|
+
@switch (tab.key) {
|
|
69
|
+
@case ('info') {
|
|
70
|
+
<general-information-view [customer]="customer" />
|
|
71
|
+
}
|
|
72
|
+
@case ('orders') {
|
|
73
|
+
<orders-view [customerId]="customer.id" />
|
|
74
|
+
}
|
|
75
|
+
@case ('debts') {
|
|
76
|
+
<debts-view [customerId]="customer.id" />
|
|
77
|
+
}
|
|
78
|
+
@case ('documents') {
|
|
79
|
+
<documents-view [customerId]="customer.id" />
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</div>
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</div>
|
|
86
|
+
</sd-page-detail>
|
|
87
|
+
`,
|
|
88
|
+
})
|
|
89
|
+
export class ProfileComponent {
|
|
90
|
+
readonly #router = inject(Router);
|
|
91
|
+
readonly #route = inject(ActivatedRoute);
|
|
92
|
+
protected readonly tabs = TABS;
|
|
93
|
+
protected readonly entity = toSignal(this.#route.data.pipe(map(data => data['entity'] as CustomerDto)), { requireSync: true });
|
|
94
|
+
protected readonly badges = computed(() => [customerStatusBadge(this.entity().status)]);
|
|
95
|
+
protected readonly typeName = computed(() => customerTypeName(this.entity().type));
|
|
96
|
+
readonly #tabParam = toSignal(this.#route.queryParamMap.pipe(map(params => params.get('tab'))), { requireSync: true });
|
|
97
|
+
protected readonly tabIndex = computed(() =>
|
|
98
|
+
Math.max(
|
|
99
|
+
0,
|
|
100
|
+
TABS.findIndex(tab => tab.key === this.#tabParam())
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
/** Tab đã mở ít nhất một lần: giữ lại khi chuyển tab, không tải lại. Đổi khách hàng thì bắt đầu lại. */
|
|
104
|
+
protected readonly opened = linkedSignal<CustomerDto, ReadonlySet<TabKey>>({
|
|
105
|
+
source: this.entity,
|
|
106
|
+
// untracked: đổi tab không được đặt lại các tab đã mở; chỉ đổi khách hàng mới bắt đầu lại.
|
|
107
|
+
computation: () => new Set<TabKey>([TABS[untracked(this.tabIndex)].key]),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
protected selectTab(index: number): void {
|
|
111
|
+
const key = TABS[index]?.key ?? 'info';
|
|
112
|
+
this.opened.update(opened => new Set([...opened, key]));
|
|
113
|
+
void this.#router.navigate([], {
|
|
114
|
+
relativeTo: this.#route,
|
|
115
|
+
queryParams: { tab: key === 'info' ? null : key },
|
|
116
|
+
queryParamsHandling: 'merge',
|
|
117
|
+
replaceUrl: true,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { inject, Pipe, type PipeTransform } from '@angular/core';
|
|
2
|
+
import { of, type Observable } from 'rxjs';
|
|
3
|
+
import { CustomerService } from '../services/customer.service';
|
|
4
|
+
import type { CustomerDto } from '../services/customer.model';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Relation khách hàng theo ID: `@let customer = order.customerId | customerDetail | async;`.
|
|
8
|
+
* CustomerService cache và chia sẻ request theo ID; nơi dùng pipe phải có CustomerService trong injector.
|
|
9
|
+
*/
|
|
10
|
+
@Pipe({ name: 'customerDetail', standalone: true })
|
|
11
|
+
export class CustomerDetailPipe implements PipeTransform {
|
|
12
|
+
readonly #customerService = inject(CustomerService);
|
|
13
|
+
|
|
14
|
+
transform(id: CustomerDto['id'] | null | undefined): Observable<CustomerDto | null> {
|
|
15
|
+
if (id === null || id === undefined || id === '') return of(null);
|
|
16
|
+
return this.#customerService.cachedDetail(id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Routes } from '@angular/router';
|
|
2
|
+
import { sdPageFormLeaveGuard } from '@sdcorejs/angular/modules/layout';
|
|
3
|
+
import { SdPermissionGuard } from '@sdcorejs/angular/modules/permission';
|
|
4
|
+
import { entityResolver } from './entity.resolver';
|
|
5
|
+
import { CustomerService } from './services/customer.service';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Chi tiết, tạo và cập nhật mở trong drawer (route con của danh sách); hồ sơ 360° là trang thay chỗ danh sách
|
|
9
|
+
* (`data.detail: 'page'`). Đóng drawer hay quay lại đều giữ bộ lọc, trang và vị trí cuộn của danh sách.
|
|
10
|
+
*/
|
|
11
|
+
export const routes: Routes = [
|
|
12
|
+
{
|
|
13
|
+
path: '',
|
|
14
|
+
providers: [CustomerService],
|
|
15
|
+
canActivateChild: [SdPermissionGuard],
|
|
16
|
+
children: [
|
|
17
|
+
{
|
|
18
|
+
path: '',
|
|
19
|
+
title: 'Khách hàng',
|
|
20
|
+
data: { permission: 'PATTERN_CUSTOMER_R_LIST' },
|
|
21
|
+
loadComponent: () => import('./pages/list/list.component').then(module => module.ListComponent),
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
path: 'create',
|
|
25
|
+
data: { permission: 'PATTERN_CUSTOMER_C_CREATE' },
|
|
26
|
+
canDeactivate: [sdPageFormLeaveGuard],
|
|
27
|
+
loadComponent: () =>
|
|
28
|
+
import('./components/create-side-drawer/create-side-drawer.component').then(module => module.CreateSideDrawerComponent),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
path: ':id/detail',
|
|
32
|
+
data: { permission: 'PATTERN_CUSTOMER_R_DETAIL' },
|
|
33
|
+
resolve: { entity: entityResolver },
|
|
34
|
+
runGuardsAndResolvers: 'paramsChange',
|
|
35
|
+
loadComponent: () =>
|
|
36
|
+
import('./components/detail-side-drawer/detail-side-drawer.component').then(module => module.DetailSideDrawerComponent),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
path: ':id/update',
|
|
40
|
+
data: { permission: 'PATTERN_CUSTOMER_U_UPDATE' },
|
|
41
|
+
resolve: { entity: entityResolver },
|
|
42
|
+
runGuardsAndResolvers: 'paramsChange',
|
|
43
|
+
canDeactivate: [sdPageFormLeaveGuard],
|
|
44
|
+
loadComponent: () =>
|
|
45
|
+
import('./components/update-side-drawer/update-side-drawer.component').then(module => module.UpdateSideDrawerComponent),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
path: ':id/360',
|
|
49
|
+
title: 'Hồ sơ khách hàng',
|
|
50
|
+
data: { permission: 'PATTERN_CUSTOMER_R_DETAIL', detail: 'page' },
|
|
51
|
+
resolve: { entity: entityResolver },
|
|
52
|
+
runGuardsAndResolvers: 'paramsChange',
|
|
53
|
+
loadComponent: () => import('./pages/profile/profile.component').then(module => module.ProfileComponent),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { SdBadgeData } from '@sdcorejs/angular/components/badge';
|
|
2
|
+
import type { PagingReq, PagingRes } from '@sdcorejs/utils/models';
|
|
3
|
+
|
|
4
|
+
export type CustomerType = 'individual' | 'business';
|
|
5
|
+
export type CustomerTier = 'standard' | 'vip';
|
|
6
|
+
export type CustomerStatus = 'active' | 'inactive';
|
|
7
|
+
|
|
8
|
+
export const CUSTOMER_TYPE_OPTIONS = [
|
|
9
|
+
{ id: 'individual', name: 'Cá nhân' },
|
|
10
|
+
{ id: 'business', name: 'Doanh nghiệp' },
|
|
11
|
+
] satisfies { id: CustomerType; name: string }[];
|
|
12
|
+
|
|
13
|
+
export const CUSTOMER_STATUS_OPTIONS = [
|
|
14
|
+
{ id: 'active', name: 'Đang hoạt động', color: 'success' },
|
|
15
|
+
{ id: 'inactive', name: 'Ngừng hoạt động', color: 'secondary' },
|
|
16
|
+
] satisfies { id: CustomerStatus; name: string; color: SdBadgeData['color'] }[];
|
|
17
|
+
|
|
18
|
+
/** Nhóm khách của score card; `null` là tất cả. */
|
|
19
|
+
export type CustomerSegment = 'individual' | 'business' | 'vip';
|
|
20
|
+
|
|
21
|
+
export interface CustomerDto {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly code: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly type: CustomerType;
|
|
26
|
+
readonly tier: CustomerTier;
|
|
27
|
+
readonly email: string;
|
|
28
|
+
readonly phone: string;
|
|
29
|
+
readonly address: string;
|
|
30
|
+
readonly taxCode: string | null;
|
|
31
|
+
readonly status: CustomerStatus;
|
|
32
|
+
/** Công nợ hiện tại (₫). */
|
|
33
|
+
readonly debt: number;
|
|
34
|
+
readonly createdAt: string;
|
|
35
|
+
readonly note: string | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type CustomerListReq = PagingReq<CustomerDto>;
|
|
39
|
+
export type CustomerListRes = PagingRes<CustomerDto>;
|
|
40
|
+
|
|
41
|
+
/** Số khách theo nhóm, cùng bộ lọc với danh sách (trừ nhóm đang chọn). */
|
|
42
|
+
export type CustomerCounts = Record<'all' | CustomerSegment, number>;
|
|
43
|
+
|
|
44
|
+
export interface CustomerSaveReq {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly type: CustomerType;
|
|
47
|
+
readonly tier: CustomerTier;
|
|
48
|
+
readonly email: string;
|
|
49
|
+
readonly phone: string;
|
|
50
|
+
readonly address: string;
|
|
51
|
+
readonly taxCode: string | null;
|
|
52
|
+
readonly status: CustomerStatus;
|
|
53
|
+
readonly note: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Dòng của tab Đơn hàng trong hồ sơ 360°. */
|
|
57
|
+
export interface CustomerOrderDto {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly code: string;
|
|
60
|
+
readonly createdAt: string;
|
|
61
|
+
readonly total: number;
|
|
62
|
+
readonly status: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Dòng của tab Công nợ. */
|
|
66
|
+
export interface CustomerDebtDto {
|
|
67
|
+
readonly id: string;
|
|
68
|
+
readonly orderCode: string;
|
|
69
|
+
readonly dueDate: string;
|
|
70
|
+
readonly amount: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Dòng của tab Tài liệu. */
|
|
74
|
+
export interface CustomerDocumentDto {
|
|
75
|
+
readonly id: string;
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly size: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function customerStatusBadge(status: CustomerStatus): SdBadgeData {
|
|
81
|
+
const option = CUSTOMER_STATUS_OPTIONS.find(item => item.id === status);
|
|
82
|
+
return { type: 'round', title: option?.name ?? status, color: option?.color };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function customerTypeName(type: CustomerType): string {
|
|
86
|
+
return CUSTOMER_TYPE_OPTIONS.find(item => item.id === type)?.name ?? type;
|
|
87
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { HttpParams } from '@angular/common/http';
|
|
2
|
+
import { Injectable, signal } from '@angular/core';
|
|
3
|
+
import { shareReplay, tap, type Observable } from 'rxjs';
|
|
4
|
+
import type { Filter, PagingRes } from '@sdcorejs/utils/models';
|
|
5
|
+
import { BaseApiService } from '../../../services/base-api.service';
|
|
6
|
+
import type {
|
|
7
|
+
CustomerCounts,
|
|
8
|
+
CustomerDebtDto,
|
|
9
|
+
CustomerDocumentDto,
|
|
10
|
+
CustomerDto,
|
|
11
|
+
CustomerListReq,
|
|
12
|
+
CustomerListRes,
|
|
13
|
+
CustomerOrderDto,
|
|
14
|
+
CustomerSaveReq,
|
|
15
|
+
} from './customer.model';
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class CustomerService extends BaseApiService {
|
|
19
|
+
readonly #details = new Map<string, Observable<CustomerDto>>();
|
|
20
|
+
readonly #changes = signal(0);
|
|
21
|
+
/** Tăng sau mỗi lần tạo, cập nhật hoặc xoá thành công: danh sách chỉ tải lại khi có thay đổi. */
|
|
22
|
+
readonly changes = this.#changes.asReadonly();
|
|
23
|
+
|
|
24
|
+
list(req: CustomerListReq): Observable<CustomerListRes> {
|
|
25
|
+
return this.http.get<CustomerListRes>(this.apiUrl('customers'), { params: this.buildPagingReq(req) });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Số khách theo nhóm cho score card, theo cùng bộ lọc của danh sách. */
|
|
29
|
+
counts(filters: Filter<CustomerDto>[]): Observable<CustomerCounts> {
|
|
30
|
+
return this.http.get<CustomerCounts>(this.apiUrl('customers', 'counts'), {
|
|
31
|
+
params: new HttpParams().set('filters', JSON.stringify(filters)),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
detail(id: string): Observable<CustomerDto> {
|
|
36
|
+
return this.http.get<CustomerDto>(this.apiUrl('customers', id));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** `detail(id)` có cache, cho relation (`customerDetail`) và giá trị đã chọn của `customer-select`. */
|
|
40
|
+
cachedDetail(id: string): Observable<CustomerDto> {
|
|
41
|
+
let detail = this.#details.get(id);
|
|
42
|
+
if (!detail) {
|
|
43
|
+
detail = this.detail(id).pipe(shareReplay({ bufferSize: 1, refCount: false }));
|
|
44
|
+
this.#details.set(id, detail);
|
|
45
|
+
// Lỗi tra cứu không được cache: lần gọi sau hỏi lại.
|
|
46
|
+
detail.subscribe({ error: () => this.#details.delete(id) });
|
|
47
|
+
}
|
|
48
|
+
return detail;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
create(req: CustomerSaveReq): Observable<CustomerDto> {
|
|
52
|
+
return this.http.post<CustomerDto>(this.apiUrl('customers'), req).pipe(tap(() => this.#changed()));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
update(id: string, req: CustomerSaveReq): Observable<CustomerDto> {
|
|
56
|
+
return this.http.put<CustomerDto>(this.apiUrl('customers', id), req).pipe(tap(() => this.#changed(id)));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
delete(id: string): Observable<void> {
|
|
60
|
+
return this.http.delete<void>(this.apiUrl('customers', id)).pipe(tap(() => this.#changed(id)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
orders(id: string): Observable<PagingRes<CustomerOrderDto>> {
|
|
64
|
+
return this.http.get<PagingRes<CustomerOrderDto>>(this.apiUrl('customers', id, 'orders'));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
debts(id: string): Observable<PagingRes<CustomerDebtDto>> {
|
|
68
|
+
return this.http.get<PagingRes<CustomerDebtDto>>(this.apiUrl('customers', id, 'debts'));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
documents(id: string): Observable<PagingRes<CustomerDocumentDto>> {
|
|
72
|
+
return this.http.get<PagingRes<CustomerDocumentDto>>(this.apiUrl('customers', id, 'documents'));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#changed(id?: string): void {
|
|
76
|
+
if (id) this.#details.delete(id);
|
|
77
|
+
this.#changes.update(count => count + 1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';
|
|
2
|
+
import { SdSelect } from '@sdcorejs/angular/forms/select';
|
|
3
|
+
import { IMPORT_FIELDS, type ImportField, type ImportMapping } from '../../services/import.model';
|
|
4
|
+
|
|
5
|
+
/** Bước "Nhận diện & ánh xạ": chọn cột của nguồn cho từng field; mã và tên là bắt buộc. */
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'mapping-form',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [SdSelect],
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
|
+
template: `
|
|
12
|
+
<div class="d-flex flex-column gap-8">
|
|
13
|
+
@for (item of fields; track item.field) {
|
|
14
|
+
<sd-select
|
|
15
|
+
[label]="item.label"
|
|
16
|
+
[items]="columns()"
|
|
17
|
+
valueField="value"
|
|
18
|
+
displayField="value"
|
|
19
|
+
[required]="item.required"
|
|
20
|
+
[autoId]="'import-map-' + item.field"
|
|
21
|
+
[model]="mapping()[item.field]"
|
|
22
|
+
[inlineError]="
|
|
23
|
+
item.required && showErrors() && !mapping()[item.field] ? 'Chọn cột cho ' + item.label.toLowerCase() + '.' : undefined
|
|
24
|
+
"
|
|
25
|
+
(modelChange)="change(item.field, $event)" />
|
|
26
|
+
}
|
|
27
|
+
</div>
|
|
28
|
+
`,
|
|
29
|
+
})
|
|
30
|
+
export class MappingFormComponent {
|
|
31
|
+
readonly sourceColumns = input.required<readonly string[]>();
|
|
32
|
+
readonly mapping = input.required<ImportMapping>();
|
|
33
|
+
readonly showErrors = input(false);
|
|
34
|
+
readonly mappingChange = output<ImportMapping>();
|
|
35
|
+
protected readonly fields = IMPORT_FIELDS;
|
|
36
|
+
protected readonly columns = computed(() => this.sourceColumns().map(value => ({ value })));
|
|
37
|
+
|
|
38
|
+
protected change(field: ImportField, value: unknown): void {
|
|
39
|
+
this.mappingChange.emit({ ...this.mapping(), [field]: typeof value === 'string' && value ? value : null });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
2
|
+
import { SdTable, type SdTableOption } from '@sdcorejs/angular/components/table';
|
|
3
|
+
import type { ImportPreviewRowDto } from '../../services/import.model';
|
|
4
|
+
|
|
5
|
+
const RESULTS = [
|
|
6
|
+
{ id: 'new', name: 'Thêm mới', color: 'success' },
|
|
7
|
+
{ id: 'duplicate', name: 'Trùng mã', color: 'warning' },
|
|
8
|
+
{ id: 'invalid', name: 'Lỗi', color: 'error' },
|
|
9
|
+
] as const;
|
|
10
|
+
|
|
11
|
+
/** Bước "Xem trước & xung đột": từng dòng với kết quả kiểm tra của API. */
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'preview-view',
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [SdTable],
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
template: `<sd-table autoId="import-preview" [option]="option()" />`,
|
|
18
|
+
})
|
|
19
|
+
export class PreviewViewComponent {
|
|
20
|
+
readonly rows = input.required<readonly ImportPreviewRowDto[]>();
|
|
21
|
+
protected readonly option = computed<SdTableOption<ImportPreviewRowDto>>(() => {
|
|
22
|
+
const rows = [...this.rows()];
|
|
23
|
+
return {
|
|
24
|
+
type: 'local',
|
|
25
|
+
items: () => rows,
|
|
26
|
+
paginate: { pageSize: 50 },
|
|
27
|
+
filter: { hideInlineFilter: 'auto' },
|
|
28
|
+
columns: [
|
|
29
|
+
{ field: 'code', title: 'Mã', type: 'string', width: '110px' },
|
|
30
|
+
{ field: 'name', title: 'Tên sản phẩm', type: 'string', minWidth: '180px' },
|
|
31
|
+
{ field: 'price', title: 'Giá bán (₫)', type: 'number', width: '120px', align: 'right' },
|
|
32
|
+
{
|
|
33
|
+
field: 'result',
|
|
34
|
+
title: 'Kết quả',
|
|
35
|
+
type: 'values',
|
|
36
|
+
width: '130px',
|
|
37
|
+
option: { items: [...RESULTS], valueField: 'id', displayField: 'name' },
|
|
38
|
+
useBadge: result => ({ type: 'round', color: RESULTS.find(item => item.id === result)?.color }),
|
|
39
|
+
},
|
|
40
|
+
{ field: 'message', title: 'Ghi chú', type: 'string', minWidth: '160px' },
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|