@sdcorejs/angular 19.3.3 → 19.3.5
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/components/modal/src/modal.component.d.ts +6 -1
- package/components/query-bar/index.d.ts +1 -0
- package/components/query-bar/src/components/actions-bar/actions-bar.component.d.ts +6 -1
- package/components/query-bar/src/components/field-picker/field-picker.component.d.ts +21 -0
- package/components/query-bar/src/components/inline-chip/inline-chip.component.d.ts +7 -1
- package/components/query-bar/src/components/inline-value-chip/inline-value-chip.component.d.ts +7 -1
- package/components/query-bar/src/components/popover-chip/popover-chip.component.d.ts +16 -2
- package/components/query-bar/src/query-bar-chip-text.d.ts +27 -0
- package/components/query-bar/src/query-bar.component.d.ts +66 -8
- package/components/query-bar/src/query-bar.model.d.ts +44 -1
- package/components/table/src/components/config/config-width.util.d.ts +9 -0
- package/components/table/src/components/config/config.component.d.ts +126 -11
- package/components/table/src/components/filter/column-filter/column-filter.component.d.ts +5 -0
- package/components/table/src/components/filter/mobile-filter/mobile-field-sheet.component.d.ts +35 -0
- package/components/table/src/components/filter/mobile-filter/mobile-filter-field.component.d.ts +64 -0
- package/components/table/src/components/filter/mobile-filter/mobile-filter-summary.d.ts +11 -0
- package/components/table/src/components/filter/mobile-filter/mobile-filter.component.d.ts +47 -15
- package/components/table/src/components/mobile-cards/mobile-card-data.component.d.ts +45 -0
- package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +13 -1
- package/components/table/src/components/mobile-sheet/mobile-sheet.d.ts +35 -0
- package/components/table/src/components/mobile-sort/mobile-sort-sheet.component.d.ts +36 -0
- package/components/table/src/components/mobile-toolbar/mobile-filter-chips.component.d.ts +49 -0
- package/components/table/src/components/mobile-toolbar/mobile-tools-sheet.component.d.ts +48 -0
- package/components/table/src/components/mobile-toolbar/pull-refresh.component.d.ts +21 -0
- package/components/table/src/configurations/table.configuration.d.ts +13 -0
- package/components/table/src/models/index.d.ts +1 -0
- package/components/table/src/models/table-mobile.model.d.ts +55 -0
- package/components/table/src/models/table-option.model.d.ts +11 -1
- package/components/table/src/services/column-leaf.util.d.ts +6 -0
- package/components/table/src/services/config-custom.util.d.ts +22 -0
- package/components/table/src/services/mobile/mobile-view.util.d.ts +77 -0
- package/components/table/src/services/table-export/table-export.service.d.ts +2 -0
- package/components/table/src/services/table-filter/table-filter.model.d.ts +35 -0
- package/components/table/src/services/table-filter/table-mobile-filter.util.d.ts +54 -0
- package/components/table/src/services/table-filter/table-query-bar.util.d.ts +130 -0
- package/components/table/src/table.component.d.ts +91 -4
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +45 -9
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +515 -77
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +6258 -3377
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +23 -4
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +330 -5
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +97 -11
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-CVEKaR8U.mjs → sdcorejs-angular-modules-pattern-base-api.service-DK33LxHm.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-CVEKaR8U.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-DK33LxHm.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create-side-drawer.component-CND3d2zl.mjs → sdcorejs-angular-modules-pattern-create-side-drawer.component-B1BUBiag.mjs} +18 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B1BUBiag.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create-side-drawer.component-BqHybMk0.mjs → sdcorejs-angular-modules-pattern-create-side-drawer.component-B27ZX8Co.mjs} +18 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B27ZX8Co.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CB_wJIP8.mjs → sdcorejs-angular-modules-pattern-create.component-Bi2tMFHf.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CB_wJIP8.mjs.map → sdcorejs-angular-modules-pattern-create.component-Bi2tMFHf.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-DlP4BrhU.mjs → sdcorejs-angular-modules-pattern-create.component-CPwGkrNk.mjs} +36 -12
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CPwGkrNk.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-BbDoQccI.mjs → sdcorejs-angular-modules-pattern-create.component-VCbA_FkZ.mjs} +19 -5
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-VCbA_FkZ.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-VAMePx_q.mjs → sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-VAMePx_q.mjs.map → sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail-side-drawer.component-BD79VR0c.mjs → sdcorejs-angular-modules-pattern-detail-side-drawer.component-CPhLTiyx.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail-side-drawer.component-BD79VR0c.mjs.map → sdcorejs-angular-modules-pattern-detail-side-drawer.component-CPhLTiyx.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-BhCjw6ZL.mjs → sdcorejs-angular-modules-pattern-detail.component-5kI7wGdX.mjs} +27 -10
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-5kI7wGdX.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-B1rFhbOc.mjs → sdcorejs-angular-modules-pattern-detail.component-CjAy-B9K.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-B1rFhbOc.mjs.map → sdcorejs-angular-modules-pattern-detail.component-CjAy-B9K.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-BeH-NYvE.mjs → sdcorejs-angular-modules-pattern-flow.component-DObN_wCR.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-BeH-NYvE.mjs.map → sdcorejs-angular-modules-pattern-flow.component-DObN_wCR.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-general-information-form.component-1bi0JZdf.mjs → sdcorejs-angular-modules-pattern-general-information-form.component-C_ST-ld5.mjs} +3 -3
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-C_ST-ld5.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-BAZLCVci.mjs → sdcorejs-angular-modules-pattern-index.component-TTrWCXIT.mjs} +4 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-TTrWCXIT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs +812 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-DTWHhNNl.mjs → sdcorejs-angular-modules-pattern-list.component-BY5gjtNS.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-DTWHhNNl.mjs.map → sdcorejs-angular-modules-pattern-list.component-BY5gjtNS.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-D643jEmo.mjs → sdcorejs-angular-modules-pattern-list.component-CJ38CJXg.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-D643jEmo.mjs.map → sdcorejs-angular-modules-pattern-list.component-CJ38CJXg.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Cex41xzy.mjs → sdcorejs-angular-modules-pattern-list.component-CdgPtSjJ.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Cex41xzy.mjs.map → sdcorejs-angular-modules-pattern-list.component-CdgPtSjJ.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-qH-YO6wP.mjs → sdcorejs-angular-modules-pattern-list.component-DKIwrluh.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-qH-YO6wP.mjs.map → sdcorejs-angular-modules-pattern-list.component-DKIwrluh.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-YJUJsrIZ.mjs → sdcorejs-angular-modules-pattern-list.component-W9vY7HrT.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-YJUJsrIZ.mjs.map → sdcorejs-angular-modules-pattern-list.component-W9vY7HrT.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-S0Vuy6Oc.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-CI0H_5a4.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-S0Vuy6Oc.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-CI0H_5a4.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs → sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs} +9 -2
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs → sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs} +21 -19
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-Ba73HPGG.mjs → sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-Ba73HPGG.mjs.map → sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-CBlN7eEn.mjs → sdcorejs-angular-modules-pattern-profile.component-BEFVmSSj.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-CBlN7eEn.mjs.map → sdcorejs-angular-modules-pattern-profile.component-BEFVmSSj.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BvzFafUW.mjs → sdcorejs-angular-modules-pattern-routes-1kDb9T7_.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BvzFafUW.mjs.map → sdcorejs-angular-modules-pattern-routes-1kDb9T7_.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DTUxYZ6g.mjs → sdcorejs-angular-modules-pattern-routes-B-TJUSV_.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DTUxYZ6g.mjs.map → sdcorejs-angular-modules-pattern-routes-B-TJUSV_.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DwZWxmJf.mjs → sdcorejs-angular-modules-pattern-routes-B6z7KO0P.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DwZWxmJf.mjs.map → sdcorejs-angular-modules-pattern-routes-B6z7KO0P.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-ClQwnO4h.mjs → sdcorejs-angular-modules-pattern-routes-DS39vgzU.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-ClQwnO4h.mjs.map → sdcorejs-angular-modules-pattern-routes-DS39vgzU.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-ydOZduls.mjs → sdcorejs-angular-modules-pattern-routes-DVlcUUzh.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-ydOZduls.mjs.map → sdcorejs-angular-modules-pattern-routes-DVlcUUzh.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C3uWi8JZ.mjs → sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs} +9 -9
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C3uWi8JZ.mjs.map → sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C5ELCTEw.mjs → sdcorejs-angular-modules-pattern-routes-r9CTj-8C.mjs} +7 -7
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C5ELCTEw.mjs.map → sdcorejs-angular-modules-pattern-routes-r9CTj-8C.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DpCuYBlL.mjs → sdcorejs-angular-modules-pattern-routes-xI1XYRo6.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DpCuYBlL.mjs.map → sdcorejs-angular-modules-pattern-routes-xI1XYRo6.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-D3B5I9hg.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-nV5dVFx2.mjs} +12 -12
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-D3B5I9hg.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-nV5dVFx2.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BW-i6BHg.mjs → sdcorejs-angular-modules-pattern-shell.component-0rRaWsuo.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BW-i6BHg.mjs.map → sdcorejs-angular-modules-pattern-shell.component-0rRaWsuo.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update-side-drawer.component-DwcyKb4j.mjs → sdcorejs-angular-modules-pattern-update-side-drawer.component-6uH7sDEg.mjs} +4 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-6uH7sDEg.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update-side-drawer.component-By1mYFa_.mjs → sdcorejs-angular-modules-pattern-update-side-drawer.component-DglN2sS_.mjs} +4 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DglN2sS_.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CAtqPgIH.mjs → sdcorejs-angular-modules-pattern-update.component-BmsOgENL.mjs} +12 -10
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BmsOgENL.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-DjMChf6s.mjs → sdcorejs-angular-modules-pattern-update.component-DPZ_ucNB.mjs} +22 -12
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DPZ_ucNB.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-BBR8360C.mjs → sdcorejs-angular-modules-pattern-update.component-DkAcDmsZ.mjs} +5 -5
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DkAcDmsZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +11 -11
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-cache.mjs +7 -5
- package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +34 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-storage.mjs +6 -4
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/i18n/src/en.d.ts +66 -1
- package/modules/pattern/core/pattern-shell/catalog/pattern-catalog.d.ts +2 -0
- package/modules/pattern/docs/drawer.md +1 -1
- package/modules/pattern/docs/form.md +445 -148
- package/modules/pattern/docs/header-actions.md +14 -12
- package/modules/pattern/docs/select.md +9 -1
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +8 -1
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +1 -1
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +8 -1
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +1 -1
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +1 -1
- package/modules/pattern/features/order/components/lines-form/lines-form.component.d.ts +5 -19
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +124 -147
- package/modules/pattern/features/order/components/lines-form/order-lines.d.ts +35 -0
- package/modules/pattern/features/order/components/lines-form/order-lines.ts +101 -0
- package/modules/pattern/features/order/components/lines-table-form/lines-table-form.component.d.ts +34 -0
- package/modules/pattern/features/order/components/lines-table-form/lines-table-form.component.ts +196 -0
- package/modules/pattern/features/order/pages/create/create.component.d.ts +2 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +18 -4
- package/modules/pattern/features/order/pages/detail/detail.component.d.ts +2 -1
- package/modules/pattern/features/order/pages/detail/detail.component.ts +14 -12
- package/modules/pattern/features/order/pages/update/update.component.d.ts +2 -0
- package/modules/pattern/features/order/pages/update/update.component.ts +11 -4
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +1 -1
- package/modules/pattern/features/product/components/product-select/product-select.component.d.ts +7 -1
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +9 -1
- package/modules/pattern/features/product/pages/create/create.component.ts +8 -1
- package/modules/pattern/features/product/pages/update/update.component.ts +1 -1
- package/modules/pattern/features/settings/pages/update/update.component.ts +5 -4
- package/package.json +5 -5
- package/services/api/src/api-handler-registry.d.ts +3 -3
- package/services/api/src/api-route-configurations.d.ts +2 -2
- package/services/api/src/api.model.d.ts +2 -2
- package/services/cache/src/cache.model.d.ts +3 -1
- package/services/excel/src/lib/excel.model.d.ts +29 -0
- package/services/excel/src/lib/excel.service.d.ts +30 -0
- package/services/storage/src/storage.model.d.ts +2 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-BqHybMk0.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CND3d2zl.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BbDoQccI.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlP4BrhU.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BhCjw6ZL.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-1bi0JZdf.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-BAZLCVci.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-ikk0cK1M.mjs +0 -522
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-ikk0cK1M.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-By1mYFa_.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DwcyKb4j.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BBR8360C.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CAtqPgIH.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DjMChf6s.mjs.map +0 -1
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, input, booleanAttribute, model, ChangeDetectionStrategy, Component, signal, DestroyRef, effect, untracked, computed, Injector, viewChild, afterNextRender } from '@angular/core';
|
|
3
|
+
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
4
|
+
import { SdSelect } from '@sdcorejs/angular/forms/select';
|
|
5
|
+
import { firstValueFrom } from 'rxjs';
|
|
6
|
+
import { SdAvatar } from '@sdcorejs/angular/components/avatar';
|
|
7
|
+
import { SdItemDefDefDirective } from '@sdcorejs/angular/forms/directives';
|
|
8
|
+
import { C as CustomerService } from './sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs';
|
|
9
|
+
import { c as ORDER_PAYMENTS, d as ORDER_WAREHOUSES, a as ORDER_CHANNELS } from './sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs';
|
|
10
|
+
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
11
|
+
import { SdInputNumber } from '@sdcorejs/angular/forms/input-number';
|
|
12
|
+
import { SdFormatNumberPipe } from '@sdcorejs/angular/pipes';
|
|
13
|
+
import { SdTable, SdTableCellDefDirective, SdTableCommandHeaderDefDirective, SdTableTitleDefDirective } from '@sdcorejs/angular/components/table';
|
|
14
|
+
import { P as ProductService } from './sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs';
|
|
15
|
+
import { FormArray, FormGroup } from '@angular/forms';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Chọn khách hàng cho màn khác (đơn hàng). Lựa chọn mới chỉ gồm khách đang hoạt động; giá trị đã chọn tải theo ID
|
|
19
|
+
* (`VALUE`) nên khách đã ngừng vẫn hiện khi cập nhật. Option hai dòng có avatar: tên · mã · điện thoại.
|
|
20
|
+
*/
|
|
21
|
+
class CustomerSelectComponent {
|
|
22
|
+
#customerService = inject(CustomerService);
|
|
23
|
+
form = input();
|
|
24
|
+
name = input('customerId');
|
|
25
|
+
label = input('Khách hàng');
|
|
26
|
+
required = input(false, { transform: booleanAttribute });
|
|
27
|
+
autoId = input();
|
|
28
|
+
model = model();
|
|
29
|
+
search = async (req) => {
|
|
30
|
+
if (req.type === 'VALUE') {
|
|
31
|
+
const ids = (Array.isArray(req.value) ? req.value : [req.value]).filter((id) => !!id);
|
|
32
|
+
return Promise.all(ids.map(id => firstValueFrom(this.#customerService.cachedDetail(id))));
|
|
33
|
+
}
|
|
34
|
+
const filters = [{ field: 'status', operator: 'EQUAL', data: 'active' }];
|
|
35
|
+
if (req.searchText) {
|
|
36
|
+
filters.push({
|
|
37
|
+
operator: 'OR',
|
|
38
|
+
data: [
|
|
39
|
+
{ field: 'name', operator: 'CONTAIN', data: req.searchText },
|
|
40
|
+
{ field: 'code', operator: 'CONTAIN', data: req.searchText },
|
|
41
|
+
{ field: 'phone', operator: 'CONTAIN', data: req.searchText },
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const res = await firstValueFrom(this.#customerService.list({ pageNumber: 0, pageSize: 20, filters }));
|
|
46
|
+
return res.items;
|
|
47
|
+
};
|
|
48
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CustomerSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
49
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: CustomerSelectComponent, isStandalone: true, selector: "customer-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 }, autoId: { classPropertyName: "autoId", publicName: "autoId", 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
|
|
50
|
+
[label]="label()"
|
|
51
|
+
[name]="name()"
|
|
52
|
+
[form]="form()"
|
|
53
|
+
[(model)]="model"
|
|
54
|
+
[items]="search"
|
|
55
|
+
valueField="id"
|
|
56
|
+
displayField="name"
|
|
57
|
+
[required]="required()"
|
|
58
|
+
[autoId]="autoId()">
|
|
59
|
+
<ng-template sdItemDef let-item="item">
|
|
60
|
+
<div class="d-flex align-items-center gap-8">
|
|
61
|
+
<sd-avatar [src]="null" [name]="item.name" [size]="28" />
|
|
62
|
+
<div class="d-flex flex-column">
|
|
63
|
+
<span>{{ item.name }}</span>
|
|
64
|
+
<small class="text-secondary"
|
|
65
|
+
>{{ item.code }} · {{ item.phone }}{{ item.status === 'inactive' ? ' · Ngừng hoạt động' : '' }}</small
|
|
66
|
+
>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</ng-template>
|
|
70
|
+
</sd-select>`, 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"] }, { kind: "directive", type: SdItemDefDefDirective, selector: "[sdItemDef]" }, { kind: "component", type: SdAvatar, selector: "sd-avatar", inputs: ["src", "size", "name", "status", "statusLabel", "statusPulse", "tooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
71
|
+
}
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CustomerSelectComponent, decorators: [{
|
|
73
|
+
type: Component,
|
|
74
|
+
args: [{
|
|
75
|
+
selector: 'customer-select',
|
|
76
|
+
standalone: true,
|
|
77
|
+
imports: [SdSelect, SdItemDefDefDirective, SdAvatar],
|
|
78
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
79
|
+
template: `<sd-select
|
|
80
|
+
[label]="label()"
|
|
81
|
+
[name]="name()"
|
|
82
|
+
[form]="form()"
|
|
83
|
+
[(model)]="model"
|
|
84
|
+
[items]="search"
|
|
85
|
+
valueField="id"
|
|
86
|
+
displayField="name"
|
|
87
|
+
[required]="required()"
|
|
88
|
+
[autoId]="autoId()">
|
|
89
|
+
<ng-template sdItemDef let-item="item">
|
|
90
|
+
<div class="d-flex align-items-center gap-8">
|
|
91
|
+
<sd-avatar [src]="null" [name]="item.name" [size]="28" />
|
|
92
|
+
<div class="d-flex flex-column">
|
|
93
|
+
<span>{{ item.name }}</span>
|
|
94
|
+
<small class="text-secondary"
|
|
95
|
+
>{{ item.code }} · {{ item.phone }}{{ item.status === 'inactive' ? ' · Ngừng hoạt động' : '' }}</small
|
|
96
|
+
>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</ng-template>
|
|
100
|
+
</sd-select>`,
|
|
101
|
+
}]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
104
|
+
/** Giá trị form → request lưu. */
|
|
105
|
+
function orderSaveReq(form) {
|
|
106
|
+
const value = form.getRawValue();
|
|
107
|
+
const lines = (value.lines ?? []);
|
|
108
|
+
return {
|
|
109
|
+
customerId: value.customerId ?? '',
|
|
110
|
+
channel: value.channel ?? ORDER_CHANNELS[0],
|
|
111
|
+
warehouse: value.warehouse ?? ORDER_WAREHOUSES[0],
|
|
112
|
+
payment: value.payment ?? ORDER_PAYMENTS[0],
|
|
113
|
+
note: value.note || null,
|
|
114
|
+
lines: lines.map(line => ({
|
|
115
|
+
productId: line.productId ?? '',
|
|
116
|
+
quantity: Number(line.quantity ?? 0),
|
|
117
|
+
unitPrice: Number(line.unitPrice ?? 0),
|
|
118
|
+
})),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const options = (values) => values.map(value => ({ value }));
|
|
122
|
+
/** Nhóm "Thông tin chung" của đơn hàng. */
|
|
123
|
+
class GeneralInformationFormComponent {
|
|
124
|
+
form = input.required();
|
|
125
|
+
seed = input.required();
|
|
126
|
+
channels = options(ORDER_CHANNELS);
|
|
127
|
+
warehouses = options(ORDER_WAREHOUSES);
|
|
128
|
+
payments = options(ORDER_PAYMENTS);
|
|
129
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GeneralInformationFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", 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 } }, ngImport: i0, template: `
|
|
131
|
+
<sd-section title="Thông tin chung">
|
|
132
|
+
<div class="row px-16 pt-16 pb-8">
|
|
133
|
+
<div class="col-12 col-md-6">
|
|
134
|
+
<customer-select autoId="order-customer" [form]="form()" [model]="seed().customerId || null" required />
|
|
135
|
+
</div>
|
|
136
|
+
<div class="col-12 col-md-6">
|
|
137
|
+
<sd-select
|
|
138
|
+
label="Kênh bán"
|
|
139
|
+
name="channel"
|
|
140
|
+
[form]="form()"
|
|
141
|
+
[model]="seed().channel"
|
|
142
|
+
[items]="channels"
|
|
143
|
+
valueField="value"
|
|
144
|
+
displayField="value"
|
|
145
|
+
[clearable]="false"
|
|
146
|
+
required />
|
|
147
|
+
</div>
|
|
148
|
+
<div class="col-12 col-md-6">
|
|
149
|
+
<sd-select
|
|
150
|
+
label="Kho xuất"
|
|
151
|
+
name="warehouse"
|
|
152
|
+
[form]="form()"
|
|
153
|
+
[model]="seed().warehouse"
|
|
154
|
+
[items]="warehouses"
|
|
155
|
+
valueField="value"
|
|
156
|
+
displayField="value"
|
|
157
|
+
[clearable]="false"
|
|
158
|
+
required />
|
|
159
|
+
</div>
|
|
160
|
+
<div class="col-12 col-md-6">
|
|
161
|
+
<sd-select
|
|
162
|
+
label="Thanh toán"
|
|
163
|
+
name="payment"
|
|
164
|
+
[form]="form()"
|
|
165
|
+
[model]="seed().payment"
|
|
166
|
+
[items]="payments"
|
|
167
|
+
valueField="value"
|
|
168
|
+
displayField="value"
|
|
169
|
+
[clearable]="false"
|
|
170
|
+
required />
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</sd-section>
|
|
174
|
+
`, isInline: true, dependencies: [{ kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "iconShape", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { 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"] }, { kind: "component", type: CustomerSelectComponent, selector: "customer-select", inputs: ["form", "name", "label", "required", "autoId", "model"], outputs: ["modelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
175
|
+
}
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: GeneralInformationFormComponent, decorators: [{
|
|
177
|
+
type: Component,
|
|
178
|
+
args: [{
|
|
179
|
+
selector: 'general-information-form',
|
|
180
|
+
standalone: true,
|
|
181
|
+
imports: [SdSection, SdSelect, CustomerSelectComponent],
|
|
182
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
183
|
+
template: `
|
|
184
|
+
<sd-section title="Thông tin chung">
|
|
185
|
+
<div class="row px-16 pt-16 pb-8">
|
|
186
|
+
<div class="col-12 col-md-6">
|
|
187
|
+
<customer-select autoId="order-customer" [form]="form()" [model]="seed().customerId || null" required />
|
|
188
|
+
</div>
|
|
189
|
+
<div class="col-12 col-md-6">
|
|
190
|
+
<sd-select
|
|
191
|
+
label="Kênh bán"
|
|
192
|
+
name="channel"
|
|
193
|
+
[form]="form()"
|
|
194
|
+
[model]="seed().channel"
|
|
195
|
+
[items]="channels"
|
|
196
|
+
valueField="value"
|
|
197
|
+
displayField="value"
|
|
198
|
+
[clearable]="false"
|
|
199
|
+
required />
|
|
200
|
+
</div>
|
|
201
|
+
<div class="col-12 col-md-6">
|
|
202
|
+
<sd-select
|
|
203
|
+
label="Kho xuất"
|
|
204
|
+
name="warehouse"
|
|
205
|
+
[form]="form()"
|
|
206
|
+
[model]="seed().warehouse"
|
|
207
|
+
[items]="warehouses"
|
|
208
|
+
valueField="value"
|
|
209
|
+
displayField="value"
|
|
210
|
+
[clearable]="false"
|
|
211
|
+
required />
|
|
212
|
+
</div>
|
|
213
|
+
<div class="col-12 col-md-6">
|
|
214
|
+
<sd-select
|
|
215
|
+
label="Thanh toán"
|
|
216
|
+
name="payment"
|
|
217
|
+
[form]="form()"
|
|
218
|
+
[model]="seed().payment"
|
|
219
|
+
[items]="payments"
|
|
220
|
+
valueField="value"
|
|
221
|
+
displayField="value"
|
|
222
|
+
[clearable]="false"
|
|
223
|
+
required />
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
</sd-section>
|
|
227
|
+
`,
|
|
228
|
+
}]
|
|
229
|
+
}] });
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Chọn sản phẩm cho màn khác (dòng đơn hàng). Lựa chọn mới chỉ gồm sản phẩm đang hoạt động; giá trị đã chọn
|
|
233
|
+
* được tải theo ID (`VALUE`) nên sản phẩm đã ngừng vẫn hiển thị khi cập nhật. Option hai dòng: tên · mã · đơn vị.
|
|
234
|
+
* `size`, `hideInlineError` và `inlineError` chuyển thẳng xuống `sd-select`, để dùng được trong ô của bảng.
|
|
235
|
+
*/
|
|
236
|
+
class ProductSelectComponent {
|
|
237
|
+
#productService = inject(ProductService);
|
|
238
|
+
form = input();
|
|
239
|
+
name = input('productId');
|
|
240
|
+
label = input('Sản phẩm');
|
|
241
|
+
required = input(false, { transform: booleanAttribute });
|
|
242
|
+
size = input('md');
|
|
243
|
+
hideInlineError = input(false, { transform: booleanAttribute });
|
|
244
|
+
/** Lỗi của API cho field này (vd `lines.0.productId`). */
|
|
245
|
+
inlineError = input();
|
|
246
|
+
autoId = input();
|
|
247
|
+
model = model();
|
|
248
|
+
search = async (req) => {
|
|
249
|
+
if (req.type === 'VALUE') {
|
|
250
|
+
const ids = (Array.isArray(req.value) ? req.value : [req.value]).filter((id) => !!id);
|
|
251
|
+
return Promise.all(ids.map(id => firstValueFrom(this.#productService.cachedDetail(id))));
|
|
252
|
+
}
|
|
253
|
+
const filters = [{ field: 'status', operator: 'EQUAL', data: 'active' }];
|
|
254
|
+
if (req.searchText) {
|
|
255
|
+
filters.push({
|
|
256
|
+
operator: 'OR',
|
|
257
|
+
data: [
|
|
258
|
+
{ field: 'name', operator: 'CONTAIN', data: req.searchText },
|
|
259
|
+
{ field: 'code', operator: 'CONTAIN', data: req.searchText },
|
|
260
|
+
],
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
const res = await firstValueFrom(this.#productService.list({ pageNumber: 0, pageSize: 20, filters }));
|
|
264
|
+
return res.items;
|
|
265
|
+
};
|
|
266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ProductSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
267
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: ProductSelectComponent, isStandalone: true, selector: "product-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 }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", 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
|
|
268
|
+
[label]="label()"
|
|
269
|
+
[name]="name()"
|
|
270
|
+
[form]="form()"
|
|
271
|
+
[(model)]="model"
|
|
272
|
+
[items]="search"
|
|
273
|
+
valueField="id"
|
|
274
|
+
displayField="name"
|
|
275
|
+
[required]="required()"
|
|
276
|
+
[size]="size()"
|
|
277
|
+
[hideInlineError]="hideInlineError()"
|
|
278
|
+
[inlineError]="inlineError()"
|
|
279
|
+
[autoId]="autoId()">
|
|
280
|
+
<ng-template sdItemDef let-item="item">
|
|
281
|
+
<div class="d-flex flex-column">
|
|
282
|
+
<span>{{ item.name }}</span>
|
|
283
|
+
<small class="text-secondary">{{ item.code }} · {{ item.unit }}{{ item.status === 'inactive' ? ' · Ngừng hoạt động' : '' }}</small>
|
|
284
|
+
</div>
|
|
285
|
+
</ng-template>
|
|
286
|
+
</sd-select>`, 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"] }, { kind: "directive", type: SdItemDefDefDirective, selector: "[sdItemDef]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ProductSelectComponent, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{
|
|
291
|
+
selector: 'product-select',
|
|
292
|
+
standalone: true,
|
|
293
|
+
imports: [SdSelect, SdItemDefDefDirective],
|
|
294
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
295
|
+
template: `<sd-select
|
|
296
|
+
[label]="label()"
|
|
297
|
+
[name]="name()"
|
|
298
|
+
[form]="form()"
|
|
299
|
+
[(model)]="model"
|
|
300
|
+
[items]="search"
|
|
301
|
+
valueField="id"
|
|
302
|
+
displayField="name"
|
|
303
|
+
[required]="required()"
|
|
304
|
+
[size]="size()"
|
|
305
|
+
[hideInlineError]="hideInlineError()"
|
|
306
|
+
[inlineError]="inlineError()"
|
|
307
|
+
[autoId]="autoId()">
|
|
308
|
+
<ng-template sdItemDef let-item="item">
|
|
309
|
+
<div class="d-flex flex-column">
|
|
310
|
+
<span>{{ item.name }}</span>
|
|
311
|
+
<small class="text-secondary">{{ item.code }} · {{ item.unit }}{{ item.status === 'inactive' ? ' · Ngừng hoạt động' : '' }}</small>
|
|
312
|
+
</div>
|
|
313
|
+
</ng-template>
|
|
314
|
+
</sd-select>`,
|
|
315
|
+
}]
|
|
316
|
+
}] });
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Dòng hàng của form đơn: mỗi dòng là một FormGroup trong `form.lines` (FormArray). Thành tiền và tổng tính lại khi
|
|
320
|
+
* giá trị đổi. `lines-form` (bảng HTML) và `lines-table-form` (`sd-table`) dùng chung, chỉ khác phần hiển thị.
|
|
321
|
+
* Gọi trong injection context của component.
|
|
322
|
+
*
|
|
323
|
+
* `registerSdUnsavedChangesForm(..., { dirty: 'value' })` lấy giá trị của một control lúc nó vào form làm giá trị đã
|
|
324
|
+
* lưu, nên `form.lines` chỉ vào form khi field của các dòng đã đăng ký; vào sớm hơn thì form vừa mở đã bị coi là có
|
|
325
|
+
* thay đổi. `<table>` vẽ dòng ngay trong lượt change detection đó (`attach: 'now'`); `sd-table` vẽ dòng sau lần đọc
|
|
326
|
+
* đầu, nên `lines-table-form` dùng `attach: 'manual'` rồi gọi `attach()` khi bảng đã vẽ.
|
|
327
|
+
*/
|
|
328
|
+
function orderLines(form, seed, options = { attach: 'now' }) {
|
|
329
|
+
const productService = inject(ProductService);
|
|
330
|
+
const array = new FormArray([]);
|
|
331
|
+
const version = signal(0);
|
|
332
|
+
const rows = signal([]);
|
|
333
|
+
let nextKey = 0;
|
|
334
|
+
const attach = () => {
|
|
335
|
+
if (form().get('lines') !== array)
|
|
336
|
+
form().setControl('lines', array);
|
|
337
|
+
};
|
|
338
|
+
const push = (line) => {
|
|
339
|
+
const group = new FormGroup({});
|
|
340
|
+
array.push(group);
|
|
341
|
+
rows.update(items => [...items, { key: nextKey++, group, seed: line }]);
|
|
342
|
+
};
|
|
343
|
+
const load = (lines) => {
|
|
344
|
+
// why: gỡ ra rồi gắn lại, để giá trị đã lưu của `lines` là các dòng mới chứ không phải dòng của đơn trước.
|
|
345
|
+
if (form().get('lines') === array)
|
|
346
|
+
form().removeControl('lines');
|
|
347
|
+
array.clear();
|
|
348
|
+
rows.set([]);
|
|
349
|
+
(lines.length ? lines : [{ productId: '', quantity: 1, unitPrice: 0 }]).forEach(push);
|
|
350
|
+
if (options.attach === 'now')
|
|
351
|
+
attach();
|
|
352
|
+
};
|
|
353
|
+
const subscription = array.valueChanges.subscribe(() => version.update(value => value + 1));
|
|
354
|
+
inject(DestroyRef).onDestroy(() => subscription.unsubscribe());
|
|
355
|
+
// why: trang cập nhật được dùng lại khi chỉ đổi `:id`; dòng hàng phải theo đơn mới, không giữ dòng của đơn trước.
|
|
356
|
+
effect(() => {
|
|
357
|
+
const lines = seed();
|
|
358
|
+
untracked(() => load(lines));
|
|
359
|
+
});
|
|
360
|
+
const amounts = computed(() => {
|
|
361
|
+
version();
|
|
362
|
+
return rows().map(row => Number(row.group.get('quantity')?.value ?? row.seed.quantity) * Number(row.group.get('unitPrice')?.value ?? row.seed.unitPrice));
|
|
363
|
+
});
|
|
364
|
+
return {
|
|
365
|
+
rows: rows.asReadonly(),
|
|
366
|
+
amounts,
|
|
367
|
+
total: computed(() => amounts().reduce((sum, amount) => sum + amount, 0)),
|
|
368
|
+
add: () => push({ productId: '', quantity: 1, unitPrice: 0 }),
|
|
369
|
+
remove: row => {
|
|
370
|
+
const index = rows().indexOf(row);
|
|
371
|
+
if (index < 0)
|
|
372
|
+
return;
|
|
373
|
+
// why: đánh dấu đã sửa TRƯỚC khi gỡ, để dirty theo giá trị so với danh sách dòng lúc trước.
|
|
374
|
+
array.markAsDirty();
|
|
375
|
+
array.removeAt(index);
|
|
376
|
+
rows.update(items => items.filter(item => item !== row));
|
|
377
|
+
},
|
|
378
|
+
pick: async (row, productId) => {
|
|
379
|
+
if (!productId)
|
|
380
|
+
return;
|
|
381
|
+
const product = await firstValueFrom(productService.cachedDetail(productId));
|
|
382
|
+
row.group.get('unitPrice')?.setValue(product.price);
|
|
383
|
+
},
|
|
384
|
+
attach,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Bảng dòng hàng nhập trực tiếp, dựng bằng `<table>`: mỗi dòng là một FormGroup trong `form.lines` (FormArray, do
|
|
390
|
+
* `orderLines()` quản lý), các field Core tự đăng ký vào dòng. Chọn sản phẩm điền đơn giá; thành tiền và tổng tự
|
|
391
|
+
* tính. Field trong ô dùng `size="sm"` và `hideInlineError`: lỗi, kể cả lỗi API theo dòng (`lines.<i>.<field>`), là
|
|
392
|
+
* icon kèm tooltip ngay trên ô đó, dòng không cao thêm. Cùng bảng dựng bằng `sd-table`: `lines-table-form`.
|
|
393
|
+
*/
|
|
394
|
+
class LinesFormComponent {
|
|
395
|
+
form = input.required();
|
|
396
|
+
/** Dòng ban đầu (cập nhật) hoặc một dòng trống (tạo mới). */
|
|
397
|
+
seed = input.required();
|
|
398
|
+
/** Lỗi theo field do API trả về, khoá dạng `lines.<index>.<field>`. */
|
|
399
|
+
errors = input({});
|
|
400
|
+
lines = orderLines(this.form, this.seed);
|
|
401
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LinesFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
402
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: LinesFormComponent, isStandalone: true, selector: "lines-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 } }, ngImport: i0, template: `
|
|
403
|
+
<sd-section title="Dòng hàng">
|
|
404
|
+
<div sdHeaderRight>
|
|
405
|
+
<sd-button title="Thêm dòng" prefixIcon="add" type="text" autoId="order-line-add" (click)="lines.add()" />
|
|
406
|
+
</div>
|
|
407
|
+
<div class="lines-scroll">
|
|
408
|
+
<table class="lines">
|
|
409
|
+
<colgroup>
|
|
410
|
+
<col />
|
|
411
|
+
<col class="lines__quantity" />
|
|
412
|
+
<col class="lines__money" />
|
|
413
|
+
<col class="lines__money" />
|
|
414
|
+
<col class="lines__action" />
|
|
415
|
+
</colgroup>
|
|
416
|
+
<thead>
|
|
417
|
+
<tr>
|
|
418
|
+
<th scope="col">Sản phẩm <span class="text-error" aria-hidden="true">*</span></th>
|
|
419
|
+
<th scope="col" class="lines__number">Số lượng <span class="text-error" aria-hidden="true">*</span></th>
|
|
420
|
+
<th scope="col" class="lines__number">Đơn giá (₫) <span class="text-error" aria-hidden="true">*</span></th>
|
|
421
|
+
<th scope="col" class="lines__number">Thành tiền (₫)</th>
|
|
422
|
+
<th scope="col" class="lines__action"><span class="sd-visually-hidden">Xoá dòng</span></th>
|
|
423
|
+
</tr>
|
|
424
|
+
</thead>
|
|
425
|
+
<tbody>
|
|
426
|
+
@for (row of lines.rows(); track row.key; let index = $index) {
|
|
427
|
+
<tr [attr.data-line]="index">
|
|
428
|
+
<td>
|
|
429
|
+
<product-select
|
|
430
|
+
size="sm"
|
|
431
|
+
hideInlineError
|
|
432
|
+
[label]="undefined"
|
|
433
|
+
[form]="row.group"
|
|
434
|
+
[model]="row.seed.productId || null"
|
|
435
|
+
[inlineError]="errors()['lines.' + index + '.productId']"
|
|
436
|
+
[autoId]="'order-line-' + index + '-product'"
|
|
437
|
+
(modelChange)="lines.pick(row, $event)"
|
|
438
|
+
required />
|
|
439
|
+
</td>
|
|
440
|
+
<td class="lines__number">
|
|
441
|
+
<sd-input-number
|
|
442
|
+
name="quantity"
|
|
443
|
+
size="sm"
|
|
444
|
+
hideInlineError
|
|
445
|
+
type="positive"
|
|
446
|
+
[precision]="0"
|
|
447
|
+
[form]="row.group"
|
|
448
|
+
[model]="row.seed.quantity"
|
|
449
|
+
[inlineError]="errors()['lines.' + index + '.quantity']"
|
|
450
|
+
[autoId]="'order-line-' + index + '-quantity'"
|
|
451
|
+
required />
|
|
452
|
+
</td>
|
|
453
|
+
<td class="lines__number">
|
|
454
|
+
<sd-input-number
|
|
455
|
+
name="unitPrice"
|
|
456
|
+
size="sm"
|
|
457
|
+
hideInlineError
|
|
458
|
+
type="positive"
|
|
459
|
+
[precision]="0"
|
|
460
|
+
[form]="row.group"
|
|
461
|
+
[model]="row.seed.unitPrice"
|
|
462
|
+
[inlineError]="errors()['lines.' + index + '.unitPrice']"
|
|
463
|
+
[autoId]="'order-line-' + index + '-unit-price'"
|
|
464
|
+
required />
|
|
465
|
+
</td>
|
|
466
|
+
<td class="lines__number" [attr.data-autoid]="'order-line-' + index + '-amount'">
|
|
467
|
+
{{ lines.amounts()[index] | sdFormatNumber: 0 }}
|
|
468
|
+
</td>
|
|
469
|
+
<td class="lines__action">
|
|
470
|
+
<sd-button
|
|
471
|
+
prefixIcon="delete"
|
|
472
|
+
type="text"
|
|
473
|
+
color="error"
|
|
474
|
+
tooltip="Xoá dòng"
|
|
475
|
+
[autoId]="'order-line-' + index + '-remove'"
|
|
476
|
+
[disabled]="lines.rows().length === 1"
|
|
477
|
+
(click)="lines.remove(row)" />
|
|
478
|
+
</td>
|
|
479
|
+
</tr>
|
|
480
|
+
}
|
|
481
|
+
</tbody>
|
|
482
|
+
<tfoot>
|
|
483
|
+
<tr>
|
|
484
|
+
<th scope="row" colspan="3" class="lines__number">Tổng tiền (₫)</th>
|
|
485
|
+
<td class="lines__number lines__total" data-autoid="order-total">{{ lines.total() | sdFormatNumber: 0 }}</td>
|
|
486
|
+
<td class="lines__action"></td>
|
|
487
|
+
</tr>
|
|
488
|
+
</tfoot>
|
|
489
|
+
</table>
|
|
490
|
+
</div>
|
|
491
|
+
</sd-section>
|
|
492
|
+
`, isInline: true, styles: [".lines-scroll{overflow-x:auto}.lines{width:100%;min-width:544px;border-collapse:collapse;table-layout:fixed}.lines__quantity{width:88px}.lines__money{width:120px}.lines__action{width:48px}.lines th,.lines td{padding:8px;text-align:left;vertical-align:middle}.lines th:first-child,.lines td:first-child{padding-left:16px}.lines th:last-child,.lines td:last-child{padding-right:16px}.lines thead th{color:var(--sd-text-secondary);font-size:12px;font-weight:500;border-bottom:1px solid var(--sd-border)}.lines tbody tr:first-child td{padding-top:12px}.lines tbody tr:last-child td{padding-bottom:12px}.lines__number{text-align:right!important}.lines tfoot th,.lines tfoot td{padding-top:12px;padding-bottom:12px;border-top:1px solid var(--sd-border)}.lines__total{font-weight:500}\n"], dependencies: [{ kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "iconShape", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "inputmode", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "pipe", type: SdFormatNumberPipe, name: "sdFormatNumber" }, { kind: "component", type: ProductSelectComponent, selector: "product-select", inputs: ["form", "name", "label", "required", "size", "hideInlineError", "inlineError", "autoId", "model"], outputs: ["modelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
493
|
+
}
|
|
494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LinesFormComponent, decorators: [{
|
|
495
|
+
type: Component,
|
|
496
|
+
args: [{ selector: 'lines-form', standalone: true, imports: [SdSection, SdButton, SdInputNumber, SdFormatNumberPipe, ProductSelectComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
497
|
+
<sd-section title="Dòng hàng">
|
|
498
|
+
<div sdHeaderRight>
|
|
499
|
+
<sd-button title="Thêm dòng" prefixIcon="add" type="text" autoId="order-line-add" (click)="lines.add()" />
|
|
500
|
+
</div>
|
|
501
|
+
<div class="lines-scroll">
|
|
502
|
+
<table class="lines">
|
|
503
|
+
<colgroup>
|
|
504
|
+
<col />
|
|
505
|
+
<col class="lines__quantity" />
|
|
506
|
+
<col class="lines__money" />
|
|
507
|
+
<col class="lines__money" />
|
|
508
|
+
<col class="lines__action" />
|
|
509
|
+
</colgroup>
|
|
510
|
+
<thead>
|
|
511
|
+
<tr>
|
|
512
|
+
<th scope="col">Sản phẩm <span class="text-error" aria-hidden="true">*</span></th>
|
|
513
|
+
<th scope="col" class="lines__number">Số lượng <span class="text-error" aria-hidden="true">*</span></th>
|
|
514
|
+
<th scope="col" class="lines__number">Đơn giá (₫) <span class="text-error" aria-hidden="true">*</span></th>
|
|
515
|
+
<th scope="col" class="lines__number">Thành tiền (₫)</th>
|
|
516
|
+
<th scope="col" class="lines__action"><span class="sd-visually-hidden">Xoá dòng</span></th>
|
|
517
|
+
</tr>
|
|
518
|
+
</thead>
|
|
519
|
+
<tbody>
|
|
520
|
+
@for (row of lines.rows(); track row.key; let index = $index) {
|
|
521
|
+
<tr [attr.data-line]="index">
|
|
522
|
+
<td>
|
|
523
|
+
<product-select
|
|
524
|
+
size="sm"
|
|
525
|
+
hideInlineError
|
|
526
|
+
[label]="undefined"
|
|
527
|
+
[form]="row.group"
|
|
528
|
+
[model]="row.seed.productId || null"
|
|
529
|
+
[inlineError]="errors()['lines.' + index + '.productId']"
|
|
530
|
+
[autoId]="'order-line-' + index + '-product'"
|
|
531
|
+
(modelChange)="lines.pick(row, $event)"
|
|
532
|
+
required />
|
|
533
|
+
</td>
|
|
534
|
+
<td class="lines__number">
|
|
535
|
+
<sd-input-number
|
|
536
|
+
name="quantity"
|
|
537
|
+
size="sm"
|
|
538
|
+
hideInlineError
|
|
539
|
+
type="positive"
|
|
540
|
+
[precision]="0"
|
|
541
|
+
[form]="row.group"
|
|
542
|
+
[model]="row.seed.quantity"
|
|
543
|
+
[inlineError]="errors()['lines.' + index + '.quantity']"
|
|
544
|
+
[autoId]="'order-line-' + index + '-quantity'"
|
|
545
|
+
required />
|
|
546
|
+
</td>
|
|
547
|
+
<td class="lines__number">
|
|
548
|
+
<sd-input-number
|
|
549
|
+
name="unitPrice"
|
|
550
|
+
size="sm"
|
|
551
|
+
hideInlineError
|
|
552
|
+
type="positive"
|
|
553
|
+
[precision]="0"
|
|
554
|
+
[form]="row.group"
|
|
555
|
+
[model]="row.seed.unitPrice"
|
|
556
|
+
[inlineError]="errors()['lines.' + index + '.unitPrice']"
|
|
557
|
+
[autoId]="'order-line-' + index + '-unit-price'"
|
|
558
|
+
required />
|
|
559
|
+
</td>
|
|
560
|
+
<td class="lines__number" [attr.data-autoid]="'order-line-' + index + '-amount'">
|
|
561
|
+
{{ lines.amounts()[index] | sdFormatNumber: 0 }}
|
|
562
|
+
</td>
|
|
563
|
+
<td class="lines__action">
|
|
564
|
+
<sd-button
|
|
565
|
+
prefixIcon="delete"
|
|
566
|
+
type="text"
|
|
567
|
+
color="error"
|
|
568
|
+
tooltip="Xoá dòng"
|
|
569
|
+
[autoId]="'order-line-' + index + '-remove'"
|
|
570
|
+
[disabled]="lines.rows().length === 1"
|
|
571
|
+
(click)="lines.remove(row)" />
|
|
572
|
+
</td>
|
|
573
|
+
</tr>
|
|
574
|
+
}
|
|
575
|
+
</tbody>
|
|
576
|
+
<tfoot>
|
|
577
|
+
<tr>
|
|
578
|
+
<th scope="row" colspan="3" class="lines__number">Tổng tiền (₫)</th>
|
|
579
|
+
<td class="lines__number lines__total" data-autoid="order-total">{{ lines.total() | sdFormatNumber: 0 }}</td>
|
|
580
|
+
<td class="lines__action"></td>
|
|
581
|
+
</tr>
|
|
582
|
+
</tfoot>
|
|
583
|
+
</table>
|
|
584
|
+
</div>
|
|
585
|
+
</sd-section>
|
|
586
|
+
`, styles: [".lines-scroll{overflow-x:auto}.lines{width:100%;min-width:544px;border-collapse:collapse;table-layout:fixed}.lines__quantity{width:88px}.lines__money{width:120px}.lines__action{width:48px}.lines th,.lines td{padding:8px;text-align:left;vertical-align:middle}.lines th:first-child,.lines td:first-child{padding-left:16px}.lines th:last-child,.lines td:last-child{padding-right:16px}.lines thead th{color:var(--sd-text-secondary);font-size:12px;font-weight:500;border-bottom:1px solid var(--sd-border)}.lines tbody tr:first-child td{padding-top:12px}.lines tbody tr:last-child td{padding-bottom:12px}.lines__number{text-align:right!important}.lines tfoot th,.lines tfoot td{padding-top:12px;padding-bottom:12px;border-top:1px solid var(--sd-border)}.lines__total{font-weight:500}\n"] }]
|
|
587
|
+
}] });
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Dòng hàng nhập trực tiếp, dựng bằng `sd-table` thay cho `<table>` của `lines-form`; trạng thái dòng vẫn là
|
|
591
|
+
* `orderLines()`. Bảng local, không phân trang, không lọc. Nút thêm dòng nằm ở header cột command
|
|
592
|
+
* (`sdTableCommandHeaderDef`), ngay trên nút xoá của từng dòng; field trong ô dùng `size="sm"` và `hideInlineError`,
|
|
593
|
+
* cột bắt buộc có `*` ở title; số dòng và tổng tiền ở dưới bảng. Dòng đổi thì `reload()` bảng; `rowKey` giữ view
|
|
594
|
+
* của các dòng còn lại nên giá trị đang nhập không mất. `form.lines` chỉ vào form khi bảng đã vẽ dòng (`attach`).
|
|
595
|
+
*/
|
|
596
|
+
class LinesTableFormComponent {
|
|
597
|
+
form = input.required();
|
|
598
|
+
/** Dòng ban đầu (cập nhật) hoặc một dòng trống (tạo mới). */
|
|
599
|
+
seed = input.required();
|
|
600
|
+
/** Lỗi theo field do API trả về, khoá dạng `lines.<index>.<field>`. */
|
|
601
|
+
errors = input({});
|
|
602
|
+
#injector = inject(Injector);
|
|
603
|
+
table = viewChild((SdTable));
|
|
604
|
+
lines = orderLines(this.form, this.seed, { attach: 'manual' });
|
|
605
|
+
option = {
|
|
606
|
+
type: 'local',
|
|
607
|
+
items: () => [...this.lines.rows()],
|
|
608
|
+
rowKey: 'key',
|
|
609
|
+
filter: { disabled: true },
|
|
610
|
+
paginate: { hidden: true, pageSize: 200 },
|
|
611
|
+
reload: {
|
|
612
|
+
visible: false,
|
|
613
|
+
// why: sd-table vẽ dòng sau lần đọc; field trong ô đăng ký xong thì mới gắn `form.lines` (xem `orderLines`).
|
|
614
|
+
onReload: () => {
|
|
615
|
+
afterNextRender(() => this.lines.attach(), { injector: this.#injector });
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
config: { visible: false },
|
|
619
|
+
columns: [
|
|
620
|
+
{ field: 'productId', title: 'Sản phẩm', type: 'string', minWidth: '180px' },
|
|
621
|
+
{ field: 'quantity', title: 'Số lượng', type: 'number', width: '88px' },
|
|
622
|
+
{ field: 'unitPrice', title: 'Đơn giá (₫)', type: 'number', width: '120px' },
|
|
623
|
+
{ field: 'amount', title: 'Thành tiền (₫)', type: 'number', width: '120px', align: 'right' },
|
|
624
|
+
],
|
|
625
|
+
command: {
|
|
626
|
+
commands: [
|
|
627
|
+
{
|
|
628
|
+
title: 'Xoá dòng',
|
|
629
|
+
icon: 'delete',
|
|
630
|
+
color: 'error',
|
|
631
|
+
disabled: () => this.lines.rows().length === 1,
|
|
632
|
+
click: row => this.lines.remove(row),
|
|
633
|
+
},
|
|
634
|
+
],
|
|
635
|
+
},
|
|
636
|
+
};
|
|
637
|
+
constructor() {
|
|
638
|
+
// why: bảng local chỉ đọc `items` khi tải; thêm, xoá dòng hay nạp đơn khác đều phải `reload()` để vẽ lại. Gọi sau
|
|
639
|
+
// lượt render, khi `option` của bảng đã được gán.
|
|
640
|
+
effect(() => {
|
|
641
|
+
this.lines.rows();
|
|
642
|
+
untracked(() => afterNextRender(() => void this.table()?.reload(), { injector: this.#injector }));
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LinesTableFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
646
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.21", type: LinesTableFormComponent, isStandalone: true, selector: "lines-table-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 } }, viewQueries: [{ propertyName: "table", first: true, predicate: (SdTable), descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
647
|
+
<sd-section title="Dòng hàng">
|
|
648
|
+
<sd-table autoId="order-lines" [option]="option">
|
|
649
|
+
<ng-template sdTableCommandHeaderDef>
|
|
650
|
+
<sd-button
|
|
651
|
+
tooltip="Thêm dòng"
|
|
652
|
+
prefixIcon="add"
|
|
653
|
+
size="sm"
|
|
654
|
+
type="light"
|
|
655
|
+
color="primary"
|
|
656
|
+
autoId="order-line-add"
|
|
657
|
+
(click)="lines.add()" />
|
|
658
|
+
</ng-template>
|
|
659
|
+
<ng-template sdTableTitleDef="productId">Sản phẩm <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
660
|
+
<ng-template sdTableTitleDef="quantity">Số lượng <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
661
|
+
<ng-template sdTableTitleDef="unitPrice">Đơn giá (₫) <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
662
|
+
<ng-template sdTableCellDef="productId" let-row="item">
|
|
663
|
+
@let index = lines.rows().indexOf(row);
|
|
664
|
+
<product-select
|
|
665
|
+
class="lines-table__input"
|
|
666
|
+
size="sm"
|
|
667
|
+
hideInlineError
|
|
668
|
+
[label]="undefined"
|
|
669
|
+
[form]="row.group"
|
|
670
|
+
[model]="row.seed.productId || null"
|
|
671
|
+
[inlineError]="errors()['lines.' + index + '.productId']"
|
|
672
|
+
[autoId]="'order-line-' + index + '-product'"
|
|
673
|
+
(modelChange)="lines.pick(row, $event)"
|
|
674
|
+
required />
|
|
675
|
+
</ng-template>
|
|
676
|
+
<ng-template sdTableCellDef="quantity" let-row="item">
|
|
677
|
+
@let index = lines.rows().indexOf(row);
|
|
678
|
+
<sd-input-number
|
|
679
|
+
class="lines-table__input"
|
|
680
|
+
name="quantity"
|
|
681
|
+
size="sm"
|
|
682
|
+
hideInlineError
|
|
683
|
+
type="positive"
|
|
684
|
+
[precision]="0"
|
|
685
|
+
[form]="row.group"
|
|
686
|
+
[model]="row.seed.quantity"
|
|
687
|
+
[inlineError]="errors()['lines.' + index + '.quantity']"
|
|
688
|
+
[autoId]="'order-line-' + index + '-quantity'"
|
|
689
|
+
required />
|
|
690
|
+
</ng-template>
|
|
691
|
+
<ng-template sdTableCellDef="unitPrice" let-row="item">
|
|
692
|
+
@let index = lines.rows().indexOf(row);
|
|
693
|
+
<sd-input-number
|
|
694
|
+
class="lines-table__input"
|
|
695
|
+
name="unitPrice"
|
|
696
|
+
size="sm"
|
|
697
|
+
hideInlineError
|
|
698
|
+
type="positive"
|
|
699
|
+
[precision]="0"
|
|
700
|
+
[form]="row.group"
|
|
701
|
+
[model]="row.seed.unitPrice"
|
|
702
|
+
[inlineError]="errors()['lines.' + index + '.unitPrice']"
|
|
703
|
+
[autoId]="'order-line-' + index + '-unit-price'"
|
|
704
|
+
required />
|
|
705
|
+
</ng-template>
|
|
706
|
+
<ng-template sdTableCellDef="amount" let-row="item">
|
|
707
|
+
@let index = lines.rows().indexOf(row);
|
|
708
|
+
<strong class="lines-table__amount" [attr.data-autoid]="'order-line-' + index + '-amount'">
|
|
709
|
+
{{ lines.amounts()[index] | sdFormatNumber: 0 }}
|
|
710
|
+
</strong>
|
|
711
|
+
</ng-template>
|
|
712
|
+
</sd-table>
|
|
713
|
+
<div class="lines-table__summary">
|
|
714
|
+
<span>{{ lines.rows().length }} dòng hàng</span>
|
|
715
|
+
<strong
|
|
716
|
+
>Tổng tiền: <span data-autoid="order-total">{{ lines.total() | sdFormatNumber: 0 }}</span> ₫</strong
|
|
717
|
+
>
|
|
718
|
+
</div>
|
|
719
|
+
</sd-section>
|
|
720
|
+
`, isInline: true, styles: [".lines-table__input{display:block;padding-block:6px}.lines-table__amount{display:block;text-align:right;font-variant-numeric:tabular-nums}.lines-table__summary{display:flex;justify-content:space-between;gap:8px;padding:12px 16px;color:var(--sd-text-secondary)}.lines-table__summary strong{color:var(--sd-text)}\n"], dependencies: [{ kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "iconShape", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdTable, selector: "sd-table", inputs: ["autoId", "option", "hideReadError"], outputs: ["sdReadStateChange"] }, { kind: "directive", type: SdTableCellDefDirective, selector: "[sdTableCellDef]", inputs: ["sdTableCellDef"] }, { kind: "directive", type: SdTableCommandHeaderDefDirective, selector: "[sdTableCommandHeaderDef]" }, { kind: "directive", type: SdTableTitleDefDirective, selector: "[sdTableTitleDef]", inputs: ["sdTableTitleDef"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "inputmode", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "pipe", type: SdFormatNumberPipe, name: "sdFormatNumber" }, { kind: "component", type: ProductSelectComponent, selector: "product-select", inputs: ["form", "name", "label", "required", "size", "hideInlineError", "inlineError", "autoId", "model"], outputs: ["modelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
721
|
+
}
|
|
722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: LinesTableFormComponent, decorators: [{
|
|
723
|
+
type: Component,
|
|
724
|
+
args: [{ selector: 'lines-table-form', standalone: true, imports: [
|
|
725
|
+
SdSection,
|
|
726
|
+
SdButton,
|
|
727
|
+
SdTable,
|
|
728
|
+
SdTableCellDefDirective,
|
|
729
|
+
SdTableCommandHeaderDefDirective,
|
|
730
|
+
SdTableTitleDefDirective,
|
|
731
|
+
SdInputNumber,
|
|
732
|
+
SdFormatNumberPipe,
|
|
733
|
+
ProductSelectComponent,
|
|
734
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
735
|
+
<sd-section title="Dòng hàng">
|
|
736
|
+
<sd-table autoId="order-lines" [option]="option">
|
|
737
|
+
<ng-template sdTableCommandHeaderDef>
|
|
738
|
+
<sd-button
|
|
739
|
+
tooltip="Thêm dòng"
|
|
740
|
+
prefixIcon="add"
|
|
741
|
+
size="sm"
|
|
742
|
+
type="light"
|
|
743
|
+
color="primary"
|
|
744
|
+
autoId="order-line-add"
|
|
745
|
+
(click)="lines.add()" />
|
|
746
|
+
</ng-template>
|
|
747
|
+
<ng-template sdTableTitleDef="productId">Sản phẩm <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
748
|
+
<ng-template sdTableTitleDef="quantity">Số lượng <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
749
|
+
<ng-template sdTableTitleDef="unitPrice">Đơn giá (₫) <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
750
|
+
<ng-template sdTableCellDef="productId" let-row="item">
|
|
751
|
+
@let index = lines.rows().indexOf(row);
|
|
752
|
+
<product-select
|
|
753
|
+
class="lines-table__input"
|
|
754
|
+
size="sm"
|
|
755
|
+
hideInlineError
|
|
756
|
+
[label]="undefined"
|
|
757
|
+
[form]="row.group"
|
|
758
|
+
[model]="row.seed.productId || null"
|
|
759
|
+
[inlineError]="errors()['lines.' + index + '.productId']"
|
|
760
|
+
[autoId]="'order-line-' + index + '-product'"
|
|
761
|
+
(modelChange)="lines.pick(row, $event)"
|
|
762
|
+
required />
|
|
763
|
+
</ng-template>
|
|
764
|
+
<ng-template sdTableCellDef="quantity" let-row="item">
|
|
765
|
+
@let index = lines.rows().indexOf(row);
|
|
766
|
+
<sd-input-number
|
|
767
|
+
class="lines-table__input"
|
|
768
|
+
name="quantity"
|
|
769
|
+
size="sm"
|
|
770
|
+
hideInlineError
|
|
771
|
+
type="positive"
|
|
772
|
+
[precision]="0"
|
|
773
|
+
[form]="row.group"
|
|
774
|
+
[model]="row.seed.quantity"
|
|
775
|
+
[inlineError]="errors()['lines.' + index + '.quantity']"
|
|
776
|
+
[autoId]="'order-line-' + index + '-quantity'"
|
|
777
|
+
required />
|
|
778
|
+
</ng-template>
|
|
779
|
+
<ng-template sdTableCellDef="unitPrice" let-row="item">
|
|
780
|
+
@let index = lines.rows().indexOf(row);
|
|
781
|
+
<sd-input-number
|
|
782
|
+
class="lines-table__input"
|
|
783
|
+
name="unitPrice"
|
|
784
|
+
size="sm"
|
|
785
|
+
hideInlineError
|
|
786
|
+
type="positive"
|
|
787
|
+
[precision]="0"
|
|
788
|
+
[form]="row.group"
|
|
789
|
+
[model]="row.seed.unitPrice"
|
|
790
|
+
[inlineError]="errors()['lines.' + index + '.unitPrice']"
|
|
791
|
+
[autoId]="'order-line-' + index + '-unit-price'"
|
|
792
|
+
required />
|
|
793
|
+
</ng-template>
|
|
794
|
+
<ng-template sdTableCellDef="amount" let-row="item">
|
|
795
|
+
@let index = lines.rows().indexOf(row);
|
|
796
|
+
<strong class="lines-table__amount" [attr.data-autoid]="'order-line-' + index + '-amount'">
|
|
797
|
+
{{ lines.amounts()[index] | sdFormatNumber: 0 }}
|
|
798
|
+
</strong>
|
|
799
|
+
</ng-template>
|
|
800
|
+
</sd-table>
|
|
801
|
+
<div class="lines-table__summary">
|
|
802
|
+
<span>{{ lines.rows().length }} dòng hàng</span>
|
|
803
|
+
<strong
|
|
804
|
+
>Tổng tiền: <span data-autoid="order-total">{{ lines.total() | sdFormatNumber: 0 }}</span> ₫</strong
|
|
805
|
+
>
|
|
806
|
+
</div>
|
|
807
|
+
</sd-section>
|
|
808
|
+
`, styles: [".lines-table__input{display:block;padding-block:6px}.lines-table__amount{display:block;text-align:right;font-variant-numeric:tabular-nums}.lines-table__summary{display:flex;justify-content:space-between;gap:8px;padding:12px 16px;color:var(--sd-text-secondary)}.lines-table__summary strong{color:var(--sd-text)}\n"] }]
|
|
809
|
+
}], ctorParameters: () => [] });
|
|
810
|
+
|
|
811
|
+
export { GeneralInformationFormComponent as G, LinesFormComponent as L, LinesTableFormComponent as a, orderSaveReq as o };
|
|
812
|
+
//# sourceMappingURL=sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs.map
|