@sdcorejs/angular 20.3.2 → 20.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/THEME.md +58 -6
- package/assets/scss/core/form.scss +291 -3
- package/assets/scss/themes/_component-tokens.scss +35 -6
- package/components/badge/index.d.ts +19 -1
- package/components/section/index.d.ts +13 -1
- package/components/splitter/index.d.ts +1 -1
- package/components/tab-router/index.d.ts +47 -5
- package/components/table/index.d.ts +127 -13
- package/components/upload-file/index.d.ts +181 -21
- package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +15 -3
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +393 -78
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +444 -16
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +887 -174
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +7 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +5 -2
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +422 -122
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +17 -2
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +26 -20
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +14 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +210 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-DnbDCdcz.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-DnbDCdcz.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-EBHM4kx2.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-EBHM4kx2.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BtHe8YIW.mjs → sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BtHe8YIW.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-eFshU7ew.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-eFshU7ew.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +266 -11
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-BubUwgBK.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-BubUwgBK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C9WQdsEi.mjs +131 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C9WQdsEi.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-s7ZXoakT.mjs +130 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-s7ZXoakT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BxfQux1Q.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BxfQux1Q.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-D4GrcahQ.mjs +460 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-D4GrcahQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlYVJqHo.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DlYVJqHo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-Bfx6_CmA.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-Bfx6_CmA.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-3PUIy1Vi.mjs +148 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-3PUIy1Vi.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CbYMo3D1.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CbYMo3D1.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-awjgX7ph.mjs +90 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-awjgX7ph.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-c__NdSt3.mjs +467 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-c__NdSt3.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-Bjvq6wJz.mjs +514 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-Bjvq6wJz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs +61 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-FwmYVkag.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs +87 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-pqT7lnS6.mjs +170 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-pqT7lnS6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs +70 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DZXPZuM4.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DZXPZuM4.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BjMOON6K.mjs +522 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BjMOON6K.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bf9QWXBp.mjs +115 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bf9QWXBp.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CuDjsIzi.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CuDjsIzi.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkVrMSPZ.mjs +164 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkVrMSPZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkxheDVz.mjs +629 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DkxheDVz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-E8rkFCkK.mjs +71 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-E8rkFCkK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DgmM-wTI.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DgmM-wTI.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-C3coYwmZ.mjs +48 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-C3coYwmZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-YsWsrKWJ.mjs +297 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-YsWsrKWJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-9ujH01cX.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-9ujH01cX.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BfpsCkim.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BfpsCkim.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C7b5dRrJ.mjs +165 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-C7b5dRrJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CGeqkySv.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CGeqkySv.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DoBxGoRE.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DoBxGoRE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-dBuQqYkO.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-dBuQqYkO.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-quSIwMOx.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-quSIwMOx.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-rR-MpQFh.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-rR-MpQFh.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-LQNpFSmN.mjs +406 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-LQNpFSmN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-CcmrUIvP.mjs +317 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-CcmrUIvP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Cq72tG9h.mjs +143 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Cq72tG9h.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-xFbutFLY.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-xFbutFLY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CsfGgGJb.mjs +128 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CsfGgGJb.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DYPI_CRD.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DYPI_CRD.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lHmdUXWT.mjs +357 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lHmdUXWT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/forms/chip/index.d.ts +136 -26
- package/i18n/index.d.ts +42 -0
- package/modules/layout/index.d.ts +89 -6
- package/modules/pattern/README.md +76 -0
- package/modules/pattern/docs/detail.md +237 -0
- package/modules/pattern/docs/drawer.md +484 -0
- package/modules/pattern/docs/flow.md +631 -0
- package/modules/pattern/docs/form.md +518 -0
- package/modules/pattern/docs/header-actions.md +342 -0
- package/modules/pattern/docs/list.md +247 -0
- package/modules/pattern/docs/relation.md +180 -0
- package/modules/pattern/docs/select.md +206 -0
- package/modules/pattern/docs/split.md +350 -0
- package/modules/pattern/docs/states.md +168 -0
- package/modules/pattern/features/approval/entity.resolver.ts +21 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
- package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
- package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
- package/modules/pattern/features/approval/routes.ts +30 -0
- package/modules/pattern/features/approval/services/approval.model.ts +38 -0
- package/modules/pattern/features/approval/services/approval.service.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
- package/modules/pattern/features/category/entity.resolver.ts +27 -0
- package/modules/pattern/features/category/pages/list/list.component.html +20 -0
- package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
- package/modules/pattern/features/category/routes.ts +42 -0
- package/modules/pattern/features/category/services/category.model.ts +39 -0
- package/modules/pattern/features/category/services/category.service.ts +36 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
- package/modules/pattern/features/customer/entity.resolver.ts +21 -0
- package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
- package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
- package/modules/pattern/features/customer/routes.ts +59 -0
- package/modules/pattern/features/customer/services/customer.model.ts +87 -0
- package/modules/pattern/features/customer/services/customer.service.ts +79 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
- package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
- package/modules/pattern/features/import/routes.ts +19 -0
- package/modules/pattern/features/import/services/import.model.ts +82 -0
- package/modules/pattern/features/import/services/import.service.ts +18 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
- package/modules/pattern/features/order/entity.resolver.ts +37 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
- package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
- package/modules/pattern/features/order/pages/list/list.component.html +38 -0
- package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
- package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
- package/modules/pattern/features/order/routes.ts +54 -0
- package/modules/pattern/features/order/services/order.model.ts +109 -0
- package/modules/pattern/features/order/services/order.service.ts +63 -0
- package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
- package/modules/pattern/features/partner/routes.ts +20 -0
- package/modules/pattern/features/partner/services/partner.model.ts +30 -0
- package/modules/pattern/features/partner/services/partner.service.ts +17 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
- package/modules/pattern/features/product/entity.resolver.ts +21 -0
- package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
- package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
- package/modules/pattern/features/product/pages/list/list.component.html +30 -0
- package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
- package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
- package/modules/pattern/features/product/routes.ts +48 -0
- package/modules/pattern/features/product/services/product.model.ts +38 -0
- package/modules/pattern/features/product/services/product.service.ts +48 -0
- package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
- package/modules/pattern/features/settings/routes.ts +24 -0
- package/modules/pattern/features/settings/services/settings.model.ts +18 -0
- package/modules/pattern/features/settings/services/settings.service.ts +15 -0
- package/modules/pattern/features/settings/settings.resolver.ts +8 -0
- package/modules/pattern/index.d.ts +50 -0
- package/package.json +5 -1
- package/services/unsaved-changes/index.d.ts +11 -0
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, viewChild, contentChild, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
4
1
|
import * as i1 from '@angular/common';
|
|
5
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, ChangeDetectorRef, ElementRef, DestroyRef, input, computed, booleanAttribute, model, output, viewChild, viewChildren, contentChild, signal, effect, isDevMode, afterRenderEffect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { Utilities } from '@sdcorejs/utils/fns';
|
|
7
7
|
import * as i2 from '@angular/forms';
|
|
8
|
-
import { NgForm, FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
8
|
+
import { FormGroupDirective, NgForm, FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
10
9
|
import * as i5 from '@angular/material/chips';
|
|
11
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
10
|
+
import { MatChipGrid, MatChipsModule } from '@angular/material/chips';
|
|
12
11
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
13
12
|
import * as i3 from '@angular/material/input';
|
|
14
13
|
import { MatInputModule } from '@angular/material/input';
|
|
15
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
16
14
|
import * as i4 from '@angular/material/tooltip';
|
|
17
15
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
18
16
|
import { SdView } from '@sdcorejs/angular/components/view';
|
|
@@ -21,45 +19,43 @@ import { SdLabel } from '@sdcorejs/angular/forms/label';
|
|
|
21
19
|
import { ɵsdTimerScope as _sdTimerScope, sdFormControlState, sdViewedTransform, sdViewedInline, SdFormControl, ɵsdFormControlConnector as _sdFormControlConnector } from '@sdcorejs/angular/forms/models';
|
|
22
20
|
import { I18nService } from '@sdcorejs/angular/i18n';
|
|
23
21
|
import { sdIsEmpty, sdSerializeDataValue } from '@sdcorejs/angular/utilities/data-state';
|
|
24
|
-
import { Subscription } from 'rxjs';
|
|
25
22
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
constructor(formControl) {
|
|
48
|
-
this.formControl = formControl;
|
|
49
|
-
}
|
|
50
|
-
isErrorState(control, form) {
|
|
51
|
-
const isSubmitted = form && form.submitted;
|
|
52
|
-
return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
24
|
+
/** Items that never become a chip; `0` and `false` still do (A2). */
|
|
25
|
+
const isChipItem = (item) => item !== null && item !== undefined && item !== '';
|
|
26
|
+
/** Keys that commit the typed text by default (`KeyboardEvent.key`). */
|
|
27
|
+
const DEFAULT_SEPARATORS = ['Enter', ','];
|
|
28
|
+
/** Default `chipTransform`: the text without surrounding spaces. */
|
|
29
|
+
const trimChip = (raw) => raw.trim();
|
|
30
|
+
/** Character a separator key stands for in pasted text; key names other than Enter / Tab have none. */
|
|
31
|
+
const separatorChar = (key) => (key === 'Enter' ? '\n' : key === 'Tab' ? '\t' : key.length === 1 ? key : null);
|
|
32
|
+
/** Duplicate highlight (B3), the same 1.4s as the review. */
|
|
33
|
+
const DUPLICATE_FLASH_MS = 1400;
|
|
34
|
+
/**
|
|
35
|
+
* Icon sizes by field size: chip ✕ / lock and the clear button (C1). why: the chip icons are one step below the handoff
|
|
36
|
+
* table (14 / 16 / 18px), as on `<sd-chip-calendar>` (chosen 2026-10-23: 16px looked heavy in a 24px chip), so both chip
|
|
37
|
+
* fields look the same.
|
|
38
|
+
*/
|
|
39
|
+
const CHIP_ICONS = {
|
|
40
|
+
sm: { chip: '12px', clear: '16px' },
|
|
41
|
+
md: { chip: '14px', clear: '18px' },
|
|
42
|
+
lg: { chip: '16px', clear: '20px' },
|
|
43
|
+
};
|
|
55
44
|
class SdChip {
|
|
56
45
|
#ref = inject(ChangeDetectorRef);
|
|
57
46
|
#i18n = inject(I18nService);
|
|
58
|
-
// why:
|
|
59
|
-
//
|
|
60
|
-
|
|
47
|
+
// why: lỗi phải hiện khi form cha đã submit dù field chưa chạm (A5). NgForm / FormGroupDirective tổ tiên
|
|
48
|
+
// giữ cờ `submitted`; MatInput cũng lấy đúng hai directive này cho ErrorStateMatcher.
|
|
49
|
+
#parentForm = inject(FormGroupDirective, { optional: true }) ?? inject(NgForm, { optional: true });
|
|
50
|
+
#host = inject(ElementRef).nativeElement;
|
|
51
|
+
/** why: id ổn định của lỗi (`<mat-error>` hoặc chữ ẩn của `hideInlineError`) để ô nhập trỏ `aria-describedby` sang (A8). */
|
|
52
|
+
errorId = `sd-chip-error-${Utilities.generateUuid()}`;
|
|
53
|
+
// why: blur hoãn 150ms, focus 100ms. Gỡ chip / đổi route trong khoảng đó thì timer chạy trên view đã destroy (từng
|
|
54
|
+
// gọi detectChanges() → ViewDestroyedError, giờ vẫn focus một ô nhập đã tháo). Scope handle theo DestroyRef để timer
|
|
55
|
+
// bị clear cùng lúc view tháo.
|
|
61
56
|
#timers = _sdTimerScope();
|
|
62
|
-
#
|
|
57
|
+
#destroyRef = inject(DestroyRef);
|
|
58
|
+
/** Control name when `name` is not set. */
|
|
63
59
|
#name = Utilities.generateUuid();
|
|
64
60
|
// Signals - inputs (accept null|undefined at boundary, transform to canonical)
|
|
65
61
|
autoIdInput = input(undefined, ...(ngDevMode ? [{ debugName: "autoIdInput", alias: 'autoId',
|
|
@@ -141,13 +137,43 @@ class SdChip {
|
|
|
141
137
|
}]));
|
|
142
138
|
hideInlineError = input(false, ...(ngDevMode ? [{ debugName: "hideInlineError", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
143
139
|
required = input(false, ...(ngDevMode ? [{ debugName: "required", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
140
|
+
/** Fewest chips; > 0 adds `Validators.minLength`. Replaces `min`. */
|
|
141
|
+
minCount = input(undefined, ...(ngDevMode ? [{ debugName: "minCount", transform: (v) => v ?? undefined }] : [{
|
|
142
|
+
transform: (v) => v ?? undefined,
|
|
143
|
+
}]));
|
|
144
|
+
/** Most chips; > 0 adds `Validators.maxLength` (for a model set from outside) and stops adding once reached. Replaces `max`. */
|
|
145
|
+
maxCount = input(undefined, ...(ngDevMode ? [{ debugName: "maxCount", transform: (v) => v ?? undefined }] : [{
|
|
146
|
+
transform: (v) => v ?? undefined,
|
|
147
|
+
}]));
|
|
148
|
+
/** @deprecated Use `minCount`; `minCount` wins when both are set. */
|
|
144
149
|
min = input(0, ...(ngDevMode ? [{ debugName: "min", transform: (v) => v ?? 0 }] : [{
|
|
145
150
|
transform: (v) => v ?? 0,
|
|
146
151
|
}]));
|
|
152
|
+
/** @deprecated Use `maxCount`; `maxCount` wins when both are set. */
|
|
147
153
|
max = input(0, ...(ngDevMode ? [{ debugName: "max", transform: (v) => v ?? 0 }] : [{
|
|
148
154
|
transform: (v) => v ?? 0,
|
|
149
155
|
}]));
|
|
156
|
+
/** `false` keeps the field read-only for typing: the input stays (mat-chip-grid needs it) but is read-only and out of the Tab order. */
|
|
150
157
|
addable = input(true, ...(ngDevMode ? [{ debugName: "addable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
158
|
+
/** Leaving the field turns the typed text into a chip. `false` drops the text instead, as before. */
|
|
159
|
+
addOnBlur = input(true, ...(ngDevMode ? [{ debugName: "addOnBlur", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
160
|
+
/** Keys that commit the typed text (`KeyboardEvent.key`). A paste also splits on these characters, new lines and tabs. */
|
|
161
|
+
separators = input(DEFAULT_SEPARATORS, ...(ngDevMode ? [{ debugName: "separators", transform: (v) => v ?? DEFAULT_SEPARATORS }] : [{
|
|
162
|
+
transform: (v) => v ?? DEFAULT_SEPARATORS,
|
|
163
|
+
}]));
|
|
164
|
+
/** Normalises typed or pasted text before it is compared and stored; `null` or `''` drops it. Default: trim. */
|
|
165
|
+
chipTransform = input(trimChip, ...(ngDevMode ? [{ debugName: "chipTransform", transform: (v) => v ?? trimChip }] : [{
|
|
166
|
+
transform: (v) => v ?? trimChip,
|
|
167
|
+
}]));
|
|
168
|
+
/**
|
|
169
|
+
* Checks a normalised value: an i18n key (or the message itself) when it is refused, else `null`. A refused value does
|
|
170
|
+
* not become a chip; its text stays in the input and the message shows under the field.
|
|
171
|
+
*/
|
|
172
|
+
chipValidator = input(null, ...(ngDevMode ? [{ debugName: "chipValidator" }] : []));
|
|
173
|
+
/** Shows a button that removes every chip `removable` allows. Off by default, like `clearable` of `<sd-date>`. */
|
|
174
|
+
clearable = input(false, ...(ngDevMode ? [{ debugName: "clearable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
175
|
+
/** Chips shown while the field is not focused; the rest fold into “+N”. `null` shows them all. `2` suits `<sd-table>` cells. */
|
|
176
|
+
maxVisible = input(null, ...(ngDevMode ? [{ debugName: "maxVisible" }] : []));
|
|
151
177
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
152
178
|
/** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */
|
|
153
179
|
viewed = input(false, ...(ngDevMode ? [{ debugName: "viewed", transform: sdViewedTransform }] : [{ transform: sdViewedTransform }]));
|
|
@@ -164,23 +190,37 @@ class SdChip {
|
|
|
164
190
|
sdChange = output();
|
|
165
191
|
// Template properties
|
|
166
192
|
input = viewChild('input', ...(ngDevMode ? [{ debugName: "input" }] : []));
|
|
193
|
+
chipGrid = viewChild(MatChipGrid, ...(ngDevMode ? [{ debugName: "chipGrid" }] : []));
|
|
194
|
+
// why: query signal không đặt được trên field ES private (#).
|
|
195
|
+
chipTextElements = viewChildren('chipTextEl', ...(ngDevMode ? [{ debugName: "chipTextElements" }] : []));
|
|
167
196
|
sdViewDef = contentChild(SdViewDefDirective, ...(ngDevMode ? [{ debugName: "sdViewDef" }] : []));
|
|
168
197
|
sdLabelDef = contentChild(SdLabelDefDirective, ...(ngDevMode ? [{ debugName: "sdLabelDef" }] : []));
|
|
169
198
|
sdLabelTemplate = contentChild('sdLabel', ...(ngDevMode ? [{ debugName: "sdLabelTemplate" }] : []));
|
|
170
199
|
sdValueTemplate = contentChild('sdValue', ...(ngDevMode ? [{ debugName: "sdValueTemplate" }] : []));
|
|
171
200
|
// Local states
|
|
172
201
|
#isBlurring = false;
|
|
173
|
-
|
|
202
|
+
/** The field is being edited: the `sdViewDef` face gives way to the field. A signal, so OnPush redraws without `detectChanges()` (D1). */
|
|
203
|
+
isFocused = signal(false, ...(ngDevMode ? [{ debugName: "isFocused" }] : []));
|
|
174
204
|
#inputControl = new FormControl();
|
|
175
205
|
#formControl = new SdFormControl();
|
|
206
|
+
/**
|
|
207
|
+
* Control of `mat-chip-grid` only. why: the grid is a ControlValueAccessor that writes the text of the rendered chips
|
|
208
|
+
* into its control on blur, after a timeout (numbers became strings, a form reset was undone). It still needs an
|
|
209
|
+
* ngControl to work out its error state on every check, so it gets this one; nothing reads its value.
|
|
210
|
+
*/
|
|
211
|
+
gridControl = new FormControl(null);
|
|
176
212
|
// why: `min`/`max` chỉ là validator do CHÍNH component sở hữu; `required` đi qua option riêng
|
|
177
213
|
// của connector. Connector add/remove đúng phần này (addValidators/removeValidators) nên
|
|
178
214
|
// validator do consumer tự gắn vào `formControl` public KHÔNG bị xoá — trước đây
|
|
179
215
|
// `clearValidators()` + `setValidators()` thổi bay tất cả mỗi lần input đổi.
|
|
216
|
+
/** `minCount`, else the deprecated `min`. */
|
|
217
|
+
effectiveMinCount = computed(() => this.minCount() ?? this.min() ?? 0, ...(ngDevMode ? [{ debugName: "effectiveMinCount" }] : []));
|
|
218
|
+
/** `maxCount`, else the deprecated `max`. */
|
|
219
|
+
effectiveMaxCount = computed(() => this.maxCount() ?? this.max() ?? 0, ...(ngDevMode ? [{ debugName: "effectiveMaxCount" }] : []));
|
|
180
220
|
#validators = computed(() => {
|
|
181
221
|
const validators = [];
|
|
182
|
-
const min = this.
|
|
183
|
-
const max = this.
|
|
222
|
+
const min = this.effectiveMinCount();
|
|
223
|
+
const max = this.effectiveMaxCount();
|
|
184
224
|
if (min > 0)
|
|
185
225
|
validators.push(Validators.minLength(min));
|
|
186
226
|
if (max > 0)
|
|
@@ -195,15 +235,72 @@ class SdChip {
|
|
|
195
235
|
required: this.required,
|
|
196
236
|
});
|
|
197
237
|
#matcher;
|
|
198
|
-
|
|
199
|
-
|
|
238
|
+
/** why: phím tách do `separators` + onInputKeydown xử lý, nên Material không nhận phím nào. */
|
|
239
|
+
noSeparatorKeys = [];
|
|
240
|
+
/**
|
|
241
|
+
* Items rendered as chips: every value except `null`, `undefined` and `''`, so `0` shows (A2). Display only: the
|
|
242
|
+
* model is never rewritten. why: exact duplicates are dropped too, because the chips are tracked by value.
|
|
243
|
+
*/
|
|
244
|
+
chips = computed(() => {
|
|
245
|
+
const value = this.#state().value;
|
|
246
|
+
return Array.isArray(value) ? [...new Set(value.filter(isChipItem))] : [];
|
|
247
|
+
}, ...(ngDevMode ? [{ debugName: "chips" }] : []));
|
|
248
|
+
/** Focus is in the input or on a chip; “+N” only folds chips while it is not (B7). */
|
|
249
|
+
#focusWithin = signal(false, ...(ngDevMode ? [{ debugName: "#focusWithin" }] : []));
|
|
250
|
+
/** Message of a typed or pasted value that `chipValidator` refused; it shows under the field until the text changes (B4). */
|
|
251
|
+
inputError = signal(null, ...(ngDevMode ? [{ debugName: "inputError" }] : []));
|
|
252
|
+
/** Last polite announcement; a new id re-renders the text so a repeated message is read again. */
|
|
253
|
+
liveMessage = signal(null, ...(ngDevMode ? [{ debugName: "liveMessage" }] : []));
|
|
254
|
+
#liveId = 0;
|
|
255
|
+
/** Chip that the typed value duplicates, highlighted for 1.4s (B3). */
|
|
256
|
+
duplicateChip = signal(null, ...(ngDevMode ? [{ debugName: "duplicateChip" }] : []));
|
|
257
|
+
/** Text of the chips that the 240px limit cuts; only they get a tooltip (B7). */
|
|
258
|
+
truncatedChips = signal(new Set(), ...(ngDevMode ? [{ debugName: "truncatedChips" }] : []));
|
|
259
|
+
#warnedDeprecated = false;
|
|
260
|
+
/** `maxCount` reached: typing and pasting add nothing more (B3). */
|
|
261
|
+
full = computed(() => {
|
|
262
|
+
const max = this.effectiveMaxCount();
|
|
263
|
+
return max > 0 && this.chips().length >= max;
|
|
264
|
+
}, ...(ngDevMode ? [{ debugName: "full" }] : []));
|
|
265
|
+
/** Chips on screen: all while the field has focus, else at most `maxVisible` (B7). */
|
|
266
|
+
visibleChips = computed(() => {
|
|
267
|
+
const chips = this.chips();
|
|
268
|
+
const max = this.maxVisible();
|
|
269
|
+
if (this.#focusWithin() || max === null || max === undefined || max < 0 || chips.length <= max)
|
|
270
|
+
return chips;
|
|
271
|
+
return chips.slice(0, max);
|
|
272
|
+
}, ...(ngDevMode ? [{ debugName: "visibleChips" }] : []));
|
|
273
|
+
/** Chips folded into “+N”. */
|
|
274
|
+
hiddenCount = computed(() => this.chips().length - this.visibleChips().length, ...(ngDevMode ? [{ debugName: "hiddenCount" }] : []));
|
|
275
|
+
/** At least one chip may be removed, so the clear button has something to do (B6). */
|
|
276
|
+
hasRemovable = computed(() => {
|
|
277
|
+
void this.removable();
|
|
278
|
+
return this.chips().some(chip => this.isRemovable(chip));
|
|
279
|
+
}, ...(ngDevMode ? [{ debugName: "hasRemovable" }] : []));
|
|
280
|
+
/**
|
|
281
|
+
* Placeholder: “Đã đủ …” once full, else the input, else “Nhập rồi nhấn Enter” — never the label (B5). None when not
|
|
282
|
+
* addable, or while chips are folded into “+N”: nobody types then, and the input only fills the rest of the line (C1).
|
|
283
|
+
*/
|
|
284
|
+
effectivePlaceholder = computed(() => {
|
|
285
|
+
if (!this.addable() || this.hiddenCount() > 0)
|
|
286
|
+
return null;
|
|
287
|
+
if (this.full())
|
|
288
|
+
return this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() });
|
|
289
|
+
return this.placeholder() || this.#i18n.t('core.form.chip.placeholder');
|
|
290
|
+
}, ...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : []));
|
|
291
|
+
clearLabel = computed(() => this.#i18n.t('core.form.chip.clear'), ...(ngDevMode ? [{ debugName: "clearLabel" }] : []));
|
|
292
|
+
/** Tooltip of the lock on a chip that `removable` keeps (C3). */
|
|
293
|
+
lockedLabel = computed(() => this.#i18n.t('core.form.chip.locked'), ...(ngDevMode ? [{ debugName: "lockedLabel" }] : []));
|
|
294
|
+
/** Sizes of the chip ✕ / lock and of the clear-button icon for the current `size` (C1). */
|
|
295
|
+
iconSizes = computed(() => CHIP_ICONS[this.size() === 'sm' || this.size() === 'lg' ? this.size() : 'md'], ...(ngDevMode ? [{ debugName: "iconSizes" }] : []));
|
|
296
|
+
moreLabel = computed(() => this.#i18n.t('core.form.chip.more', { count: this.hiddenCount() }), ...(ngDevMode ? [{ debugName: "moreLabel" }] : []));
|
|
200
297
|
constructor() {
|
|
201
298
|
// Update model
|
|
202
299
|
effect(() => {
|
|
203
300
|
const values = this.model();
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
301
|
+
// why: `null` / `undefined` từ cha phải xoá chip và đưa control về `[]`; trước đây control giữ mảng cũ và
|
|
302
|
+
// vẫn gửi nó đi khi submit (A4).
|
|
303
|
+
this.#formControl.setValue(Array.isArray(values) ? values : []);
|
|
207
304
|
});
|
|
208
305
|
// Handle disabled state
|
|
209
306
|
effect(() => {
|
|
@@ -211,19 +308,43 @@ class SdChip {
|
|
|
211
308
|
if (isDisabled) {
|
|
212
309
|
this.#formControl.disable();
|
|
213
310
|
this.#inputControl.disable();
|
|
311
|
+
this.gridControl.disable();
|
|
214
312
|
}
|
|
215
313
|
else {
|
|
216
314
|
this.#formControl.enable();
|
|
217
315
|
this.#inputControl.enable();
|
|
316
|
+
this.gridControl.enable();
|
|
218
317
|
}
|
|
219
318
|
});
|
|
319
|
+
// why: `[required]` trên mat-chip-grid khớp selector `[required][formControl]` của RequiredValidator, nên
|
|
320
|
+
// `gridControl` sẽ invalid khi rỗng và MatChipInput gắn aria-invalid="true" lúc field chưa chạm. Gán thẳng thuộc
|
|
321
|
+
// tính của grid: mat-form-field vẫn hiện dấu * và ô nhập vẫn có aria-required.
|
|
220
322
|
effect(() => {
|
|
221
|
-
const
|
|
222
|
-
if (
|
|
223
|
-
|
|
323
|
+
const grid = this.chipGrid();
|
|
324
|
+
if (grid)
|
|
325
|
+
grid.required = this.required();
|
|
326
|
+
});
|
|
327
|
+
effect(() => {
|
|
328
|
+
if ((this.min() > 0 || this.max() > 0) && !this.#warnedDeprecated && isDevMode()) {
|
|
329
|
+
this.#warnedDeprecated = true;
|
|
330
|
+
console.warn('[sd-chip] `min` / `max` are deprecated; use `minCount` / `maxCount`.');
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
// why: chữ chip dừng ở 240px rồi cắt "…" (B7); chỉ chip thật sự bị cắt mới cần tooltip, và chỉ đo được sau khi vẽ.
|
|
334
|
+
afterRenderEffect(() => {
|
|
335
|
+
const cut = new Set();
|
|
336
|
+
for (const { nativeElement } of this.chipTextElements()) {
|
|
337
|
+
if (nativeElement.scrollWidth > nativeElement.clientWidth)
|
|
338
|
+
cut.add(nativeElement.dataset['chip'] ?? '');
|
|
224
339
|
}
|
|
340
|
+
const current = untracked(this.truncatedChips);
|
|
341
|
+
if (cut.size !== current.size || [...cut].some(text => !current.has(text)))
|
|
342
|
+
this.truncatedChips.set(cut);
|
|
225
343
|
});
|
|
226
|
-
|
|
344
|
+
// why: `submitted` của form cha không phải signal; submit phải vẽ lại lỗi dưới OnPush.
|
|
345
|
+
this.#parentForm?.ngSubmit.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
346
|
+
this.#formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
347
|
+
this.#matcher = { isErrorState: (_control, form) => !!this.inputError() || this.#errorGate(form) };
|
|
227
348
|
}
|
|
228
349
|
get formControl() {
|
|
229
350
|
return this.#formControl;
|
|
@@ -240,8 +361,8 @@ class SdChip {
|
|
|
240
361
|
errorMessage = computed(() => {
|
|
241
362
|
void this.#state();
|
|
242
363
|
void this.required();
|
|
243
|
-
const min = this.
|
|
244
|
-
const max = this.
|
|
364
|
+
const min = this.effectiveMinCount();
|
|
365
|
+
const max = this.effectiveMaxCount();
|
|
245
366
|
const errors = this.#formControl.errors;
|
|
246
367
|
if (!errors)
|
|
247
368
|
return undefined;
|
|
@@ -256,32 +377,219 @@ class SdChip {
|
|
|
256
377
|
get matcher() {
|
|
257
378
|
return this.#matcher;
|
|
258
379
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
380
|
+
/**
|
|
381
|
+
* The one place that decides whether the error shows (A5): the `ErrorStateMatcher` of the chip grid and the input,
|
|
382
|
+
* `<mat-error>`, the `hideInlineError` icon and `aria-invalid` all read it. Invalid and touched, or the parent form
|
|
383
|
+
* was submitted; a field that is only dirty shows nothing.
|
|
384
|
+
*/
|
|
385
|
+
isErrorShown() {
|
|
386
|
+
return !!this.inputError() || (!!this.errorMessage() && this.#errorGate());
|
|
263
387
|
}
|
|
264
|
-
|
|
265
|
-
|
|
388
|
+
/** Text under the field: the `chipValidator` message of the typed value first, else the form error. */
|
|
389
|
+
errorText = computed(() => this.inputError() ?? this.errorMessage(), ...(ngDevMode ? [{ debugName: "errorText" }] : []));
|
|
390
|
+
#errorGate(form) {
|
|
391
|
+
const control = this.#formControl;
|
|
392
|
+
return control.invalid && (control.touched || !!(form ?? this.#parentForm)?.submitted);
|
|
266
393
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
394
|
+
/** Whether `item` may be removed, per `removable`; applied on every removal path (A1). */
|
|
395
|
+
isRemovable(item) {
|
|
396
|
+
const removable = this.removable();
|
|
397
|
+
return typeof removable === 'function' ? !!removable(item) : removable;
|
|
398
|
+
}
|
|
399
|
+
/** Accessible name of the ✕ button of a chip (A6). */
|
|
400
|
+
removeLabel(item) {
|
|
401
|
+
return this.#i18n.t('core.form.chip.remove', { value: String(item) });
|
|
402
|
+
}
|
|
403
|
+
/** Accessible name of a chip that `removable` keeps: its text plus “, Không xoá được” (C3). A removable chip keeps its text. */
|
|
404
|
+
chipLabel(item) {
|
|
405
|
+
return this.isRemovable(item) ? null : `${String(item)}, ${this.lockedLabel()}`;
|
|
406
|
+
}
|
|
407
|
+
/** Text of a chip, also its key for `truncatedChips`. */
|
|
408
|
+
chipText(item) {
|
|
409
|
+
return String(item);
|
|
410
|
+
}
|
|
411
|
+
/** A separator key (`separators`) commits the typed text; the key itself is not typed (B2 / separators). */
|
|
412
|
+
onInputKeydown(event) {
|
|
413
|
+
if (event.isComposing || !this.separators().includes(event.key))
|
|
414
|
+
return;
|
|
415
|
+
event.preventDefault();
|
|
416
|
+
this.#commitText(this.input()?.nativeElement.value ?? '');
|
|
417
|
+
}
|
|
418
|
+
/** The refused-value message goes as soon as the text changes (B4). */
|
|
419
|
+
onInputText() {
|
|
420
|
+
if (this.inputError())
|
|
421
|
+
this.inputError.set(null);
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* A paste that holds a separator, a new line or a tab becomes several chips in one change (B2). Duplicates are
|
|
425
|
+
* skipped, refused values and values past `maxCount` stay in the input, and the result is announced. A paste with
|
|
426
|
+
* no separator is left to the browser.
|
|
427
|
+
*/
|
|
428
|
+
onPaste(event) {
|
|
429
|
+
if (!this.addable())
|
|
430
|
+
return;
|
|
431
|
+
const text = event.clipboardData?.getData('text') ?? '';
|
|
432
|
+
const chars = new Set(['\n', '\r', '\t']);
|
|
433
|
+
for (const key of this.separators()) {
|
|
434
|
+
const char = separatorChar(key);
|
|
435
|
+
if (char)
|
|
436
|
+
chars.add(char);
|
|
437
|
+
}
|
|
438
|
+
const parts = text.split(new RegExp(`[${[...chars].map(char => char.replace(/[\\\]^-]/g, '\\$&')).join('')}]`));
|
|
439
|
+
if (parts.length < 2)
|
|
440
|
+
return;
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
const next = [...this.#currentValues()];
|
|
443
|
+
const max = this.effectiveMaxCount();
|
|
444
|
+
const kept = [];
|
|
445
|
+
let added = 0;
|
|
446
|
+
let skipped = 0;
|
|
447
|
+
let overflow = false;
|
|
448
|
+
let error = null;
|
|
449
|
+
for (const raw of parts) {
|
|
450
|
+
const value = this.#normalise(raw);
|
|
451
|
+
if (value === null)
|
|
452
|
+
continue;
|
|
453
|
+
if (next.some(item => String(item) === String(value))) {
|
|
454
|
+
skipped++;
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
const refused = this.#refusal(value);
|
|
458
|
+
if (refused || (max > 0 && next.length >= max)) {
|
|
459
|
+
if (refused)
|
|
460
|
+
error ??= refused;
|
|
461
|
+
else
|
|
462
|
+
overflow = true;
|
|
463
|
+
kept.push(raw.trim());
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
next.push(value);
|
|
467
|
+
added++;
|
|
279
468
|
}
|
|
469
|
+
if (added)
|
|
470
|
+
this.#commit(next);
|
|
471
|
+
this.#setInputText(kept.join(', '));
|
|
472
|
+
this.inputError.set(error);
|
|
473
|
+
const notes = [this.#i18n.t('core.form.chip.added', { count: added })];
|
|
474
|
+
if (skipped)
|
|
475
|
+
notes.push(this.#i18n.t('core.form.chip.skipped', { count: skipped }));
|
|
476
|
+
if (overflow)
|
|
477
|
+
notes.push(this.#i18n.t('core.form.chip.full', { max }));
|
|
478
|
+
this.#announce(notes.join(' · '));
|
|
479
|
+
}
|
|
480
|
+
/** Backspace / Delete on a chip that `removable` keeps says why nothing happened (A1, B3). */
|
|
481
|
+
onChipKeydown(event, item) {
|
|
482
|
+
if ((event.key === 'Backspace' || event.key === 'Delete') && !this.isRemovable(item)) {
|
|
483
|
+
this.#announce(this.#i18n.t('core.form.chip.locked'));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
/** “+N” moves focus to the input, where every chip shows (B7). */
|
|
487
|
+
onMoreClick(event) {
|
|
488
|
+
event.stopPropagation();
|
|
489
|
+
this.#focus();
|
|
490
|
+
}
|
|
491
|
+
/** Focus entering the input or a chip unfolds “+N”; focus on the “+N” button itself does not (B7). */
|
|
492
|
+
onFocusIn(event) {
|
|
493
|
+
const target = event.target;
|
|
494
|
+
if (target?.classList.contains('sd-chip__more'))
|
|
495
|
+
return;
|
|
496
|
+
this.#focusWithin.set(true);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Marks the field touched once focus leaves it; moving between the input and the chips does not count.
|
|
500
|
+
* why: `mat-chip-grid` is no longer bound to the control. As a ControlValueAccessor it wrote the text of the rendered
|
|
501
|
+
* chips back into the control on blur (numbers became strings, a form reset was undone), so the component marks
|
|
502
|
+
* touched itself, like the grid did.
|
|
503
|
+
*/
|
|
504
|
+
onFocusOut(event) {
|
|
505
|
+
const next = event.relatedTarget;
|
|
506
|
+
if (next && this.#host.contains(next))
|
|
507
|
+
return;
|
|
508
|
+
this.#focusWithin.set(false);
|
|
509
|
+
this.#formConnector.markAsTouched();
|
|
510
|
+
this.#ref.markForCheck();
|
|
511
|
+
}
|
|
512
|
+
#add = (event) => this.#commitText(event.value ?? '');
|
|
513
|
+
/**
|
|
514
|
+
* Typed text → chip (a separator key, blur, or `onAdd`): normalise, then a duplicate flashes the chip it repeats, a full
|
|
515
|
+
* field says so, a refused value stays in the input with its message, and anything else is added in one change.
|
|
516
|
+
*/
|
|
517
|
+
#commitText(raw) {
|
|
518
|
+
if (!this.addable())
|
|
519
|
+
return;
|
|
520
|
+
const value = this.#normalise(String(raw));
|
|
521
|
+
if (value === null) {
|
|
522
|
+
this.#setInputText('');
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const values = this.#currentValues();
|
|
526
|
+
// why: so trùng theo chuỗi — model `[1]` và chữ "1" vừa gõ là một chip (A3).
|
|
527
|
+
const existing = values.find(item => String(item) === String(value));
|
|
528
|
+
if (existing !== undefined) {
|
|
529
|
+
this.#flashDuplicate(existing);
|
|
530
|
+
this.#announce(this.#i18n.t('core.form.chip.duplicate', { value: String(value) }));
|
|
531
|
+
this.#setInputText('');
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (this.full()) {
|
|
535
|
+
this.#announce(this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() }));
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const refused = this.#refusal(value);
|
|
539
|
+
if (refused) {
|
|
540
|
+
this.inputError.set(refused);
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
// why: PHẢI tạo mảng MỚI. `values` chính là mảng của consumer (model đi thẳng vào formControl), nên `push` vừa sửa
|
|
544
|
+
// trộm mảng của họ, vừa giữ nguyên reference — `model()` dùng equality Object.is nên `model.set(sameRef)` KHÔNG phát
|
|
545
|
+
// `modelChange`, làm `[(model)]` lệch âm thầm.
|
|
546
|
+
this.#commit([...values, value]);
|
|
547
|
+
this.#setInputText('');
|
|
548
|
+
}
|
|
549
|
+
/** `chipTransform` of the text; `null`, `undefined` or `''` means nothing to add. */
|
|
550
|
+
#normalise(raw) {
|
|
551
|
+
const value = this.chipTransform()(raw);
|
|
552
|
+
return value === null || value === undefined || value === '' ? null : value;
|
|
553
|
+
}
|
|
554
|
+
/** Message of `chipValidator` for `value`, translated when it is a key, else `null`. */
|
|
555
|
+
#refusal(value) {
|
|
556
|
+
const result = this.chipValidator()?.(value) ?? null;
|
|
557
|
+
if (!result)
|
|
558
|
+
return null;
|
|
559
|
+
// why: I18nService.t trả lại chính chuỗi kèm cảnh báo khi không có key; app hay trả thẳng câu thông báo.
|
|
560
|
+
return result in this.#i18n.messages() ? this.#i18n.t(result) : result;
|
|
561
|
+
}
|
|
562
|
+
#currentValues() {
|
|
563
|
+
const value = this.#formControl.value;
|
|
564
|
+
return Array.isArray(value) ? value : [];
|
|
565
|
+
}
|
|
566
|
+
/** Every user change ends here: one new array, written once to the control, the model and `sdChange`. */
|
|
567
|
+
#commit(next) {
|
|
568
|
+
this.inputError.set(null);
|
|
569
|
+
// why: người dùng sửa thì control của form phải dirty trước khi nhận giá trị, như value accessor của Angular;
|
|
570
|
+
// ô gõ là inputControl nên control của chip không tự dirty.
|
|
571
|
+
this.#formControl.markAsDirty();
|
|
572
|
+
this.#formControl.setValue(next);
|
|
573
|
+
this.model.set(next);
|
|
574
|
+
this.sdChange.emit(next);
|
|
575
|
+
this.#ref.markForCheck();
|
|
576
|
+
}
|
|
577
|
+
#setInputText(text) {
|
|
280
578
|
const inputEl = this.input();
|
|
281
579
|
if (inputEl)
|
|
282
|
-
inputEl.nativeElement.value =
|
|
283
|
-
this.#inputControl.setValue(
|
|
284
|
-
}
|
|
580
|
+
inputEl.nativeElement.value = text;
|
|
581
|
+
this.#inputControl.setValue(text);
|
|
582
|
+
}
|
|
583
|
+
#announce(text) {
|
|
584
|
+
this.liveMessage.set({ id: ++this.#liveId, text });
|
|
585
|
+
}
|
|
586
|
+
#flashDuplicate(item) {
|
|
587
|
+
this.duplicateChip.set(item);
|
|
588
|
+
this.#timers.schedule(() => {
|
|
589
|
+
if (this.duplicateChip() === item)
|
|
590
|
+
this.duplicateChip.set(null);
|
|
591
|
+
}, DUPLICATE_FLASH_MS);
|
|
592
|
+
}
|
|
285
593
|
#clickChip = ($event, item) => {
|
|
286
594
|
$event.stopPropagation();
|
|
287
595
|
$event.stopImmediatePropagation();
|
|
@@ -291,9 +599,11 @@ class SdChip {
|
|
|
291
599
|
};
|
|
292
600
|
#remove = (item) => {
|
|
293
601
|
const values = this.#formControl.value ?? [];
|
|
294
|
-
|
|
602
|
+
// why: `removable` áp cho mọi đường xoá, kể cả Backspace / Delete trên chip mà Material vẫn phát `(removed)` (A1).
|
|
603
|
+
if ((typeof item === 'string' || typeof item === 'number') && this.isRemovable(item)) {
|
|
295
604
|
// why: `filter` đã trả mảng mới nên reference đổi → `model.set` phát `modelChange`.
|
|
296
605
|
const next = values.filter(value => item !== value);
|
|
606
|
+
this.#formControl.markAsDirty();
|
|
297
607
|
this.#formControl.setValue(next);
|
|
298
608
|
this.model.set(next);
|
|
299
609
|
this.sdChange.emit(next);
|
|
@@ -301,83 +611,74 @@ class SdChip {
|
|
|
301
611
|
this.#inputControl.setValue('');
|
|
302
612
|
this.#focus();
|
|
303
613
|
};
|
|
304
|
-
|
|
305
|
-
const item = event.option.value;
|
|
306
|
-
const values = this.#formControl.value ?? [];
|
|
307
|
-
if (item) {
|
|
308
|
-
if (typeof item === 'string' || typeof item === 'number') {
|
|
309
|
-
if (!values.includes(item)) {
|
|
310
|
-
// why: giống #add — mảng mới, không `push` lên mảng của consumer.
|
|
311
|
-
const next = [...values, item];
|
|
312
|
-
this.#formControl.setValue(next);
|
|
313
|
-
this.model.set(next);
|
|
314
|
-
this.sdChange.emit(next);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
const inputEl = this.input();
|
|
318
|
-
if (inputEl)
|
|
319
|
-
inputEl.nativeElement.value = '';
|
|
320
|
-
this.#inputControl.setValue('', {
|
|
321
|
-
emitEvent: false,
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
};
|
|
614
|
+
// why: focus không còn xoá chữ đang gõ (B1).
|
|
325
615
|
#onFocus = () => {
|
|
326
|
-
this.isFocused
|
|
616
|
+
this.isFocused.set(true);
|
|
327
617
|
this.#isBlurring = false;
|
|
328
|
-
this.#inputControl.setValue('');
|
|
329
618
|
};
|
|
330
619
|
#onBlur = () => {
|
|
331
620
|
this.#isBlurring = true;
|
|
332
|
-
// why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle
|
|
333
|
-
//
|
|
621
|
+
// why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle theo DestroyRef. Chữ đang gõ
|
|
622
|
+
// thành chip qua `matChipInputAddOnBlur`; chỉ khi `[addOnBlur]="false"` mới bỏ chữ như trước (B1).
|
|
334
623
|
this.#timers.schedule(() => {
|
|
335
624
|
if (this.#isBlurring) {
|
|
336
|
-
this.isFocused
|
|
337
|
-
this
|
|
338
|
-
|
|
339
|
-
});
|
|
340
|
-
this.#ref.detectChanges();
|
|
625
|
+
this.isFocused.set(false);
|
|
626
|
+
if (!this.addOnBlur())
|
|
627
|
+
this.#setInputText('');
|
|
341
628
|
}
|
|
342
629
|
}, 150);
|
|
343
630
|
};
|
|
344
631
|
#onClick = () => {
|
|
345
632
|
if (this.sdViewDef()?.templateRef) {
|
|
346
|
-
if (!this.#formControl.disabled && !this.isFocused) {
|
|
633
|
+
if (!this.#formControl.disabled && !this.isFocused()) {
|
|
347
634
|
this.#focus();
|
|
348
635
|
}
|
|
349
636
|
}
|
|
350
637
|
};
|
|
351
638
|
#focus = () => {
|
|
352
|
-
this.isFocused
|
|
639
|
+
this.isFocused.set(true);
|
|
353
640
|
this.#isBlurring = false;
|
|
354
641
|
// why: vẫn 100ms như cũ — chỉ scope handle theo DestroyRef.
|
|
355
642
|
this.#timers.schedule(() => {
|
|
356
|
-
if (this.isFocused) {
|
|
643
|
+
if (this.isFocused()) {
|
|
357
644
|
this.input()?.nativeElement?.focus();
|
|
358
645
|
}
|
|
359
646
|
}, 100);
|
|
360
647
|
};
|
|
648
|
+
/** Removes every chip `removable` allows; locked chips stay. One change, none when nothing goes (B6). */
|
|
361
649
|
#clear = ($event) => {
|
|
362
650
|
$event?.stopPropagation();
|
|
363
|
-
this.#
|
|
364
|
-
this
|
|
365
|
-
this
|
|
366
|
-
|
|
367
|
-
|
|
651
|
+
this.#setInputText('');
|
|
652
|
+
this.inputError.set(null);
|
|
653
|
+
const values = this.#currentValues();
|
|
654
|
+
const kept = values.filter(value => !this.isRemovable(value));
|
|
655
|
+
if (kept.length !== values.length)
|
|
656
|
+
this.#commit(kept);
|
|
657
|
+
// why: nút vừa bấm ẩn đi (visibility) khi không còn chip nào bỏ được, nên focus trên nó sẽ mất; đưa về ô nhập.
|
|
658
|
+
if ($event)
|
|
659
|
+
this.#focus();
|
|
660
|
+
this.#ref.markForCheck();
|
|
368
661
|
};
|
|
369
662
|
// Public method to expose private methods for template
|
|
370
663
|
onAdd = (event) => this.#add(event);
|
|
371
664
|
onClickChip = (event, item) => this.#clickChip(event, item);
|
|
372
665
|
onRemove = (item) => this.#remove(item);
|
|
373
|
-
onSelect = (event) => this.#select(event);
|
|
374
666
|
onFocus = () => this.#onFocus();
|
|
375
667
|
onBlur = () => this.#onBlur();
|
|
376
668
|
onClick = () => this.#onClick();
|
|
669
|
+
/**
|
|
670
|
+
* why: khi `sdViewDef` đang hiển thị thì bên trong không còn phần tử nào focus được, nên phần tử view là lối vào
|
|
671
|
+
* duy nhất để chuyển sang chế độ sửa. Bàn phím phải mở được y hệt chuột → Enter/Space chạy chung handler;
|
|
672
|
+
* preventDefault chặn Space cuộn trang (A7).
|
|
673
|
+
*/
|
|
674
|
+
onViewKeydown = (event) => {
|
|
675
|
+
event.preventDefault();
|
|
676
|
+
this.#onClick();
|
|
677
|
+
};
|
|
377
678
|
focus = () => this.#focus();
|
|
378
679
|
onClear = ($event) => this.#clear($event);
|
|
379
680
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
380
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed()", "class.sd-label-top": "labelPlacement() === 'top'" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorMessage();\r\n@let _size = size();\r\n@let _removable = removable();\r\n@let _labelTop = labelPlacement() === 'top';\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if ((!_appearance || _labelTop) && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if ((!_appearance || _labelTop) && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (keydown.enter)=\"onClick()\"\r\n tabindex=\"0\"\r\n (click)=\"onClick()\">\r\n @if (_sdViewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_sdViewDef!.templateRef; context: { value: formControl.value }\"></ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"_size === 'md'\" [class.sd-sm]=\"_size === 'sm'\">\r\n @for (item of formControl.value; track $index) {\r\n @if (item) {\r\n <mat-chip-row\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [removable]=\"_removable\"\r\n (removed)=\"onRemove(item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span>{{ item }}</span>\r\n @if (!inputControl.disabled && item | sdRemovableChip: _removable) {\r\n <sd-icon matChipRemove name=\"cancel\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n }\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"placeholder() || (_labelTop ? '' : _label)\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n #input />\r\n </mat-chip-grid>\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <span class=\"sd-visually-hidden\" matSuffix>{{ _errorMessage }}</span>\r\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip-input{margin-top:0!important}:host ::ng-deep .mat-mdc-form-field.no-padding-wrapper .mat-mdc-text-field-wrapper{padding-bottom:0}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip{padding:7px 10px;min-height:26px}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip .mat-mdc-chip-trailing-icon{padding:7px 7px 7px 10px}:host ::ng-deep .mat-mdc-chip-row.sd-sm{--mdc-chip-label-text-size: 12px;--mdc-chip-container-height: 20px}:host ::ng-deep .mat-mdc-chip-set.sd-md{margin-top:10px}:host ::ng-deep .mat-mdc-chip-set.sd-sm{margin-top:2px}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg, #ebecf0)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i5.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }, { kind: "pipe", type: SdRemovableChipPipe, name: "sdRemovableChip" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
681
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, minCount: { classPropertyName: "minCount", publicName: "minCount", isSignal: true, isRequired: false, transformFunction: null }, maxCount: { classPropertyName: "maxCount", publicName: "maxCount", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, addOnBlur: { classPropertyName: "addOnBlur", publicName: "addOnBlur", isSignal: true, isRequired: false, transformFunction: null }, separators: { classPropertyName: "separators", publicName: "separators", isSignal: true, isRequired: false, transformFunction: null }, chipTransform: { classPropertyName: "chipTransform", publicName: "chipTransform", isSignal: true, isRequired: false, transformFunction: null }, chipValidator: { classPropertyName: "chipValidator", publicName: "chipValidator", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { listeners: { "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)" }, properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed()", "class.sd-label-top": "labelPlacement() === 'top'" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "chipGrid", first: true, predicate: MatChipGrid, descendants: true, isSignal: true }, { propertyName: "chipTextElements", predicate: ["chipTextEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorText();\r\n@let _size = size();\r\n@let _labelTop = labelPlacement() === 'top';\r\n@let _icons = iconSizes();\r\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\r\n@let _errorVisible = isErrorShown();\r\n@let _viewTemplate = _sdViewDef?.templateRef;\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n <!-- why: nh\u00E3n r\u1EDDi (`labelPlacement=\"top\"`) l\u00E0 ch\u1ED7 duy nh\u1EA5t d\u00F9ng `#sdLabel` / `sdLabelDef` khi s\u1EEDa, nh\u01B0 sd-date v\u00E0\r\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\r\n @if (_labelTop && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (_labelTop && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout: kh\u00F4ng role, kh\u00F4ng t\u00EAn, kh\u00F4ng n\u1EB1m trong th\u1EE9 t\u1EF1 Tab (A7). Khi sdViewDef \u0111ang hi\u1EC3n th\u1ECB\r\n th\u00EC b\u00EAn trong kh\u00F4ng c\u00F3 ph\u1EA7n t\u1EED focus \u0111\u01B0\u1EE3c n\u00E0o, n\u00EAn ch\u00EDnh ph\u1EA7n t\u1EED view nh\u1EADn role=\"button\" + tabindex=\"0\" +\r\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_viewTemplate\"\r\n [class.c-focused]=\"isFocused()\"\r\n [class.c-disabled]=\"formControl.disabled\">\r\n @if (_viewTemplate && !isFocused()) {\r\n <!-- why: KH\u00D4NG \u0111\u1EB7t aria-label \u2014 n\u1ED9i dung sdViewDef ch\u00EDnh l\u00E0 nh\u00E3n nh\u00ECn th\u1EA5y \u0111\u01B0\u1EE3c. -->\r\n <div\r\n class=\"sd-chip__view-trigger\"\r\n role=\"button\"\r\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\r\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\r\n (click)=\"onClick()\"\r\n (keydown.enter)=\"onViewKeydown($event)\"\r\n (keydown.space)=\"onViewKeydown($event)\">\r\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\r\n </div>\r\n } @else {\r\n <!-- why: `.sd-chip-field` nh\u1EADn mixin sd-chip-row() c\u1EE7a core/form.scss \u2014 thang chip, chip kho\u00E1, \u201C+N\u201D, n\u00FAt b\u1ECF h\u1EBFt d\u00F9ng\r\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\r\n <mat-form-field\r\n class=\"sd-chip-field\"\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.sd-lg]=\"_size === 'lg'\"\r\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\r\n c\u00E1c chip \u0111ang render v\u00E0o control (s\u1ED1 th\u00E0nh chu\u1ED7i, reset b\u1ECB \u0111\u00E8 l\u1EA1i). V\u1EABn c\u1EA7n m\u1ED9t ngControl \u0111\u1EC3 grid t\u1EF1 t\u00EDnh\r\n errorState m\u1ED7i l\u1EA7n check; matcher c\u1EE7a sd-chip quy\u1EBFt \u0111\u1ECBnh vi\u1EC1n \u0111\u1ECF (A5). `required` g\u00E1n trong component, xem\r\n `chipGrid`. -->\r\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\r\n <!-- why: chips() gi\u1EEF c\u1EA3 0 v\u00E0 track theo gi\u00E1 tr\u1ECB, n\u00EAn xo\u00E1 m\u1ED9t chip kh\u00F4ng d\u1EF1ng l\u1EA1i c\u00E1c chip sau n\u00F3 (A2).\r\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\r\n xo\u00E1 chip kho\u00E1 (A1). Khi kh\u00F4ng focus ch\u1EC9 hi\u1EC7n `maxVisible` chip, ph\u1EA7n d\u01B0 g\u1ED9p v\u00E0o \u201C+N\u201D (B7). Chip kho\u00E1 c\u00F3 n\u1EC1n\r\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\r\n @for (item of visibleChips(); track item) {\r\n @let _removable = isRemovable(item);\r\n @let _text = chipText(item);\r\n <mat-chip-row\r\n class=\"sd-chip__chip\"\r\n [class.sd-chip__chip--locked]=\"!_removable\"\r\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\r\n [removable]=\"_removable\"\r\n [aria-label]=\"chipLabel(item)\"\r\n (removed)=\"onRemove(item)\"\r\n (keydown)=\"onChipKeydown($event, item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span\r\n #chipTextEl\r\n class=\"sd-chip__chip-text\"\r\n [attr.data-chip]=\"_text\"\r\n [matTooltip]=\"_text\"\r\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\r\n >{{ item }}</span\r\n >\r\n <!-- why: m\u1ED7i kh\u1ED1i @if m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c, \u0111\u1EC3 \u2715 \u0111\u01B0\u1EE3c chi\u1EBFu v\u00E0o \u00F4 trailing c\u1EE7a mat-chip-row ([matChipRemove]). -->\r\n @if (!inputControl.disabled && _removable) {\r\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\r\n }\r\n @if (!inputControl.disabled && !_removable) {\r\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n @if (hiddenCount() > 0) {\r\n <button\r\n type=\"button\"\r\n class=\"sd-chip__more\"\r\n [attr.aria-label]=\"moreLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\r\n (click)=\"onMoreClick($event)\">\r\n +{{ hiddenCount() }}\r\n </button>\r\n }\r\n <!-- why: ph\u00EDm t\u00E1ch so theo `KeyboardEvent.key` trong onInputKeydown (keyCode c\u1EE7a `;` kh\u00E1c nhau theo b\u1ED1 c\u1EE5c b\u00E0n ph\u00EDm),\r\n n\u00EAn Material kh\u00F4ng nh\u1EADn ph\u00EDm n\u00E0o; n\u00F3 ch\u1EC9 c\u00F2n ph\u00E1t matChipInputTokenEnd khi blur (`addOnBlur`). `addable` false\r\n v\u1EABn gi\u1EEF \u00F4 nh\u1EADp v\u00EC mat-chip-grid c\u1EA7n matChipInputFor, nh\u01B0ng ch\u1EC9 \u0111\u1ECDc v\u00E0 ra kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"effectivePlaceholder()\"\r\n [readonly]=\"!addable()\"\r\n [attr.tabindex]=\"addable() ? null : -1\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\r\n [matChipInputAddOnBlur]=\"addOnBlur()\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n (keydown)=\"onInputKeydown($event)\"\r\n (input)=\"onInputText()\"\r\n (paste)=\"onPaste($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\r\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\r\n #input />\r\n </mat-chip-grid>\r\n <!-- why: icon v\u00E0 ch\u1EEF l\u1ED7i \u1EA9n chung m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c matSuffix, n\u00EAn m\u1ED9t kh\u1ED1i @if \u0111\u1EE7 cho c\u1EA3 hai v\u00E0 v\u1EABn \u0111\u01B0\u1EE3c chi\u1EBFu\r\n v\u00E0o v\u00F9ng suffix. Ch\u1EEF \u1EA9n c\u00F3 id \u0111\u1EC3 \u00F4 nh\u1EADp tr\u1ECF aria-describedby sang (A8); v\u1EDBi <mat-error> th\u00EC\r\n mat-form-field t\u1EF1 n\u1ED1i. -->\r\n @if (_hideInlineError && _errorVisible) {\r\n <span matSuffix class=\"sd-chip__error-suffix\">\r\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\r\n </span>\r\n }\r\n <!-- why: n\u00FAt b\u1ECF h\u1EBFt nh\u01B0 `.sd-clear-btn` c\u1EE7a sd-date (hi\u1EC7n khi hover / focus-within). Lu\u00F4n gi\u1EEF ch\u1ED7: khi kh\u00F4ng c\u00F2n chip\r\n n\u00E0o b\u1ECF \u0111\u01B0\u1EE3c th\u00EC ch\u1EC9 \u1EA9n b\u1EB1ng visibility, kh\u00F4ng g\u1EE1 kh\u1ECFi DOM, \u0111\u1EC3 field kh\u00F4ng nh\u1EA3y (B6). -->\r\n @if (clearable() && !formControl.disabled && !_required) {\r\n @let _canClear = hasRemovable();\r\n <button\r\n type=\"button\"\r\n matSuffix\r\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\r\n [class.sd-hover]=\"_canClear\"\r\n [class.sd-chip__clear--empty]=\"!_canClear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\r\n (click)=\"onClear($event)\">\r\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\r\n </button>\r\n }\r\n\r\n @if (!_hideInlineError && _errorVisible) {\r\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\r\n }\r\n @if (effectiveMaxCount() > 0) {\r\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\r\n {{ chips().length }}/{{ effectiveMaxCount() }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- why: v\u00F9ng live lu\u00F4n c\u00F3 m\u1EB7t \u0111\u1EC3 screen reader \u0111\u1ECDc \u201C\u0111\u00E3 c\u00F3\u201D, \u201C\u0111\u00E3 \u0111\u1EE7\u201D, k\u1EBFt qu\u1EA3 d\u00E1n v\u00E0 \u201Ckh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D ngay khi ch\u00FAng\r\n xu\u1EA5t hi\u1EC7n (B2, B3); id m\u1EDBi d\u1EF1ng l\u1EA1i ch\u1EEF \u0111\u1EC3 c\u00E2u l\u1EB7p l\u1EA1i v\u1EABn \u0111\u01B0\u1EE3c \u0111\u1ECDc. -->\r\n @let _live = liveMessage();\r\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\r\n @for (message of _live ? [_live] : []; track message.id) {\r\n <span>{{ message.text }}</span>\r\n }\r\n </span>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip__chip-text{display:block;min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg)}.sd-chip__view-trigger{display:flex;align-items:center;width:100%;cursor:pointer}.sd-chip__view-trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-chip__view-trigger[aria-disabled=true]{cursor:default}.sd-chip__error-suffix{display:inline-flex;align-items:center}.sd-chip__clear--empty{visibility:hidden}@media(pointer:coarse){.sd-chip__clear.sd-hover{visibility:visible}}.sd-chip__counter--full{color:var(--sd-warning)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i5.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
381
682
|
}
|
|
382
683
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdChip, decorators: [{
|
|
383
684
|
type: Component,
|
|
@@ -385,6 +686,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
385
686
|
'[class.sd-has-label]': '!!label()',
|
|
386
687
|
'[class.sd-viewed]': 'isViewed()',
|
|
387
688
|
'[class.sd-label-top]': "labelPlacement() === 'top'",
|
|
689
|
+
'(focusin)': 'onFocusIn($event)',
|
|
690
|
+
'(focusout)': 'onFocusOut($event)',
|
|
388
691
|
}, imports: [
|
|
389
692
|
SdIcon,
|
|
390
693
|
CommonModule,
|
|
@@ -393,18 +696,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
393
696
|
MatInputModule,
|
|
394
697
|
MatTooltipModule,
|
|
395
698
|
MatFormFieldModule,
|
|
396
|
-
MatAutocompleteModule,
|
|
397
|
-
MatProgressSpinnerModule,
|
|
398
699
|
MatChipsModule,
|
|
399
700
|
SdLabel,
|
|
400
701
|
SdView,
|
|
401
|
-
SdRemovableChipPipe,
|
|
402
|
-
|
|
403
|
-
}], ctorParameters: () => [], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], labelPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPlacement", required: false }] }], floatLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatLabel", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], addable: [{ type: i0.Input, args: [{ isSignal: true, alias: "addable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], viewed: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewed", required: false }] }], hyperlink: [{ type: i0.Input, args: [{ isSignal: true, alias: "hyperlink", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], input: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], sdViewDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdViewDefDirective), { isSignal: true }] }], sdLabelDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdLabelDefDirective), { isSignal: true }] }], sdLabelTemplate: [{ type: i0.ContentChild, args: ['sdLabel', { isSignal: true }] }], sdValueTemplate: [{ type: i0.ContentChild, args: ['sdValue', { isSignal: true }] }] } });
|
|
702
|
+
], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorText();\r\n@let _size = size();\r\n@let _labelTop = labelPlacement() === 'top';\r\n@let _icons = iconSizes();\r\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\r\n@let _errorVisible = isErrorShown();\r\n@let _viewTemplate = _sdViewDef?.templateRef;\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n <!-- why: nh\u00E3n r\u1EDDi (`labelPlacement=\"top\"`) l\u00E0 ch\u1ED7 duy nh\u1EA5t d\u00F9ng `#sdLabel` / `sdLabelDef` khi s\u1EEDa, nh\u01B0 sd-date v\u00E0\r\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\r\n @if (_labelTop && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (_labelTop && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout: kh\u00F4ng role, kh\u00F4ng t\u00EAn, kh\u00F4ng n\u1EB1m trong th\u1EE9 t\u1EF1 Tab (A7). Khi sdViewDef \u0111ang hi\u1EC3n th\u1ECB\r\n th\u00EC b\u00EAn trong kh\u00F4ng c\u00F3 ph\u1EA7n t\u1EED focus \u0111\u01B0\u1EE3c n\u00E0o, n\u00EAn ch\u00EDnh ph\u1EA7n t\u1EED view nh\u1EADn role=\"button\" + tabindex=\"0\" +\r\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_viewTemplate\"\r\n [class.c-focused]=\"isFocused()\"\r\n [class.c-disabled]=\"formControl.disabled\">\r\n @if (_viewTemplate && !isFocused()) {\r\n <!-- why: KH\u00D4NG \u0111\u1EB7t aria-label \u2014 n\u1ED9i dung sdViewDef ch\u00EDnh l\u00E0 nh\u00E3n nh\u00ECn th\u1EA5y \u0111\u01B0\u1EE3c. -->\r\n <div\r\n class=\"sd-chip__view-trigger\"\r\n role=\"button\"\r\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\r\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\r\n (click)=\"onClick()\"\r\n (keydown.enter)=\"onViewKeydown($event)\"\r\n (keydown.space)=\"onViewKeydown($event)\">\r\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\r\n </div>\r\n } @else {\r\n <!-- why: `.sd-chip-field` nh\u1EADn mixin sd-chip-row() c\u1EE7a core/form.scss \u2014 thang chip, chip kho\u00E1, \u201C+N\u201D, n\u00FAt b\u1ECF h\u1EBFt d\u00F9ng\r\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\r\n <mat-form-field\r\n class=\"sd-chip-field\"\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.sd-lg]=\"_size === 'lg'\"\r\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\r\n c\u00E1c chip \u0111ang render v\u00E0o control (s\u1ED1 th\u00E0nh chu\u1ED7i, reset b\u1ECB \u0111\u00E8 l\u1EA1i). V\u1EABn c\u1EA7n m\u1ED9t ngControl \u0111\u1EC3 grid t\u1EF1 t\u00EDnh\r\n errorState m\u1ED7i l\u1EA7n check; matcher c\u1EE7a sd-chip quy\u1EBFt \u0111\u1ECBnh vi\u1EC1n \u0111\u1ECF (A5). `required` g\u00E1n trong component, xem\r\n `chipGrid`. -->\r\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\r\n <!-- why: chips() gi\u1EEF c\u1EA3 0 v\u00E0 track theo gi\u00E1 tr\u1ECB, n\u00EAn xo\u00E1 m\u1ED9t chip kh\u00F4ng d\u1EF1ng l\u1EA1i c\u00E1c chip sau n\u00F3 (A2).\r\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\r\n xo\u00E1 chip kho\u00E1 (A1). Khi kh\u00F4ng focus ch\u1EC9 hi\u1EC7n `maxVisible` chip, ph\u1EA7n d\u01B0 g\u1ED9p v\u00E0o \u201C+N\u201D (B7). Chip kho\u00E1 c\u00F3 n\u1EC1n\r\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\r\n @for (item of visibleChips(); track item) {\r\n @let _removable = isRemovable(item);\r\n @let _text = chipText(item);\r\n <mat-chip-row\r\n class=\"sd-chip__chip\"\r\n [class.sd-chip__chip--locked]=\"!_removable\"\r\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\r\n [removable]=\"_removable\"\r\n [aria-label]=\"chipLabel(item)\"\r\n (removed)=\"onRemove(item)\"\r\n (keydown)=\"onChipKeydown($event, item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span\r\n #chipTextEl\r\n class=\"sd-chip__chip-text\"\r\n [attr.data-chip]=\"_text\"\r\n [matTooltip]=\"_text\"\r\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\r\n >{{ item }}</span\r\n >\r\n <!-- why: m\u1ED7i kh\u1ED1i @if m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c, \u0111\u1EC3 \u2715 \u0111\u01B0\u1EE3c chi\u1EBFu v\u00E0o \u00F4 trailing c\u1EE7a mat-chip-row ([matChipRemove]). -->\r\n @if (!inputControl.disabled && _removable) {\r\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\r\n }\r\n @if (!inputControl.disabled && !_removable) {\r\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n @if (hiddenCount() > 0) {\r\n <button\r\n type=\"button\"\r\n class=\"sd-chip__more\"\r\n [attr.aria-label]=\"moreLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\r\n (click)=\"onMoreClick($event)\">\r\n +{{ hiddenCount() }}\r\n </button>\r\n }\r\n <!-- why: ph\u00EDm t\u00E1ch so theo `KeyboardEvent.key` trong onInputKeydown (keyCode c\u1EE7a `;` kh\u00E1c nhau theo b\u1ED1 c\u1EE5c b\u00E0n ph\u00EDm),\r\n n\u00EAn Material kh\u00F4ng nh\u1EADn ph\u00EDm n\u00E0o; n\u00F3 ch\u1EC9 c\u00F2n ph\u00E1t matChipInputTokenEnd khi blur (`addOnBlur`). `addable` false\r\n v\u1EABn gi\u1EEF \u00F4 nh\u1EADp v\u00EC mat-chip-grid c\u1EA7n matChipInputFor, nh\u01B0ng ch\u1EC9 \u0111\u1ECDc v\u00E0 ra kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"effectivePlaceholder()\"\r\n [readonly]=\"!addable()\"\r\n [attr.tabindex]=\"addable() ? null : -1\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\r\n [matChipInputAddOnBlur]=\"addOnBlur()\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n (keydown)=\"onInputKeydown($event)\"\r\n (input)=\"onInputText()\"\r\n (paste)=\"onPaste($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\r\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\r\n #input />\r\n </mat-chip-grid>\r\n <!-- why: icon v\u00E0 ch\u1EEF l\u1ED7i \u1EA9n chung m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c matSuffix, n\u00EAn m\u1ED9t kh\u1ED1i @if \u0111\u1EE7 cho c\u1EA3 hai v\u00E0 v\u1EABn \u0111\u01B0\u1EE3c chi\u1EBFu\r\n v\u00E0o v\u00F9ng suffix. Ch\u1EEF \u1EA9n c\u00F3 id \u0111\u1EC3 \u00F4 nh\u1EADp tr\u1ECF aria-describedby sang (A8); v\u1EDBi <mat-error> th\u00EC\r\n mat-form-field t\u1EF1 n\u1ED1i. -->\r\n @if (_hideInlineError && _errorVisible) {\r\n <span matSuffix class=\"sd-chip__error-suffix\">\r\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\r\n </span>\r\n }\r\n <!-- why: n\u00FAt b\u1ECF h\u1EBFt nh\u01B0 `.sd-clear-btn` c\u1EE7a sd-date (hi\u1EC7n khi hover / focus-within). Lu\u00F4n gi\u1EEF ch\u1ED7: khi kh\u00F4ng c\u00F2n chip\r\n n\u00E0o b\u1ECF \u0111\u01B0\u1EE3c th\u00EC ch\u1EC9 \u1EA9n b\u1EB1ng visibility, kh\u00F4ng g\u1EE1 kh\u1ECFi DOM, \u0111\u1EC3 field kh\u00F4ng nh\u1EA3y (B6). -->\r\n @if (clearable() && !formControl.disabled && !_required) {\r\n @let _canClear = hasRemovable();\r\n <button\r\n type=\"button\"\r\n matSuffix\r\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\r\n [class.sd-hover]=\"_canClear\"\r\n [class.sd-chip__clear--empty]=\"!_canClear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\r\n (click)=\"onClear($event)\">\r\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\r\n </button>\r\n }\r\n\r\n @if (!_hideInlineError && _errorVisible) {\r\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\r\n }\r\n @if (effectiveMaxCount() > 0) {\r\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\r\n {{ chips().length }}/{{ effectiveMaxCount() }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- why: v\u00F9ng live lu\u00F4n c\u00F3 m\u1EB7t \u0111\u1EC3 screen reader \u0111\u1ECDc \u201C\u0111\u00E3 c\u00F3\u201D, \u201C\u0111\u00E3 \u0111\u1EE7\u201D, k\u1EBFt qu\u1EA3 d\u00E1n v\u00E0 \u201Ckh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D ngay khi ch\u00FAng\r\n xu\u1EA5t hi\u1EC7n (B2, B3); id m\u1EDBi d\u1EF1ng l\u1EA1i ch\u1EEF \u0111\u1EC3 c\u00E2u l\u1EB7p l\u1EA1i v\u1EABn \u0111\u01B0\u1EE3c \u0111\u1ECDc. -->\r\n @let _live = liveMessage();\r\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\r\n @for (message of _live ? [_live] : []; track message.id) {\r\n <span>{{ message.text }}</span>\r\n }\r\n </span>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip__chip-text{display:block;min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg)}.sd-chip__view-trigger{display:flex;align-items:center;width:100%;cursor:pointer}.sd-chip__view-trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-chip__view-trigger[aria-disabled=true]{cursor:default}.sd-chip__error-suffix{display:inline-flex;align-items:center}.sd-chip__clear--empty{visibility:hidden}@media(pointer:coarse){.sd-chip__clear.sd-hover{visibility:visible}}.sd-chip__counter--full{color:var(--sd-warning)}\n"] }]
|
|
703
|
+
}], ctorParameters: () => [], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], labelPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPlacement", required: false }] }], floatLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatLabel", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], minCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "minCount", required: false }] }], maxCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxCount", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], addable: [{ type: i0.Input, args: [{ isSignal: true, alias: "addable", required: false }] }], addOnBlur: [{ type: i0.Input, args: [{ isSignal: true, alias: "addOnBlur", required: false }] }], separators: [{ type: i0.Input, args: [{ isSignal: true, alias: "separators", required: false }] }], chipTransform: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipTransform", required: false }] }], chipValidator: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipValidator", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisible", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], viewed: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewed", required: false }] }], hyperlink: [{ type: i0.Input, args: [{ isSignal: true, alias: "hyperlink", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], input: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }], chipGrid: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatChipGrid), { isSignal: true }] }], chipTextElements: [{ type: i0.ViewChildren, args: ['chipTextEl', { isSignal: true }] }], sdViewDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdViewDefDirective), { isSignal: true }] }], sdLabelDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdLabelDefDirective), { isSignal: true }] }], sdLabelTemplate: [{ type: i0.ContentChild, args: ['sdLabel', { isSignal: true }] }], sdValueTemplate: [{ type: i0.ContentChild, args: ['sdValue', { isSignal: true }] }] } });
|
|
404
704
|
|
|
405
705
|
/**
|
|
406
706
|
* Generated bundle index. Do not edit.
|
|
407
707
|
*/
|
|
408
708
|
|
|
409
|
-
export { SdChip
|
|
709
|
+
export { SdChip };
|
|
410
710
|
//# sourceMappingURL=sdcorejs-angular-forms-chip.mjs.map
|