@sdcorejs/angular 22.3.1 → 22.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/STYLE-GUIDE.md +25 -5
- package/assets/THEME.md +289 -5
- package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
- package/assets/scss/ckeditor5.scss +2 -88
- package/assets/scss/core/_control.scss +39 -0
- package/assets/scss/core/form.scss +444 -45
- package/assets/scss/core/view.scss +24 -0
- package/assets/scss/editor-content.scss +173 -0
- package/assets/scss/sd-core.scss +1 -0
- package/assets/scss/themes/_component-tokens.scss +123 -32
- package/assets/scss/themes/_material-tokens.scss +112 -0
- package/assets/scss/themes/_presets.scss +25 -0
- package/assets/scss/themes/_scales.scss +10 -0
- package/assets/scss/themes/_semantic.scss +13 -0
- package/assets/scss/themes/default.scss +8 -2
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +166 -11
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +590 -24
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +35 -3
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1906 -0
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-editor.mjs +461 -757
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +69 -37
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2195 -1182
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +12 -2
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +182 -284
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -316
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +274 -44
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +17 -5
- 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 +574 -95
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1034 -119
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +932 -174
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-window.mjs +498 -0
- package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +20 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +483 -126
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +437 -122
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +86 -13
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +81 -18
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +79 -16
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +90 -2
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +63 -6
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +60 -7
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +5 -4
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +95 -33
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +16 -3
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1745 -22
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs +509 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs +294 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs +1556 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +2178 -38
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs +134 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs +119 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs +469 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs +67 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs +152 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs +479 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs +175 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs +92 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs +533 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs +64 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs +92 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs +242 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs +179 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs +72 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs +541 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs +647 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs +120 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs +73 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs +49 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs +301 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs +166 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs +413 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs +325 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs +146 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs +135 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs +129 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs +360 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs +101 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
- package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services.mjs +1 -0
- package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
- package/modules/pattern/README.md +76 -0
- package/modules/pattern/docs/detail.md +237 -0
- package/modules/pattern/docs/drawer.md +484 -0
- package/modules/pattern/docs/flow.md +631 -0
- package/modules/pattern/docs/form.md +518 -0
- package/modules/pattern/docs/header-actions.md +342 -0
- package/modules/pattern/docs/list.md +247 -0
- package/modules/pattern/docs/relation.md +180 -0
- package/modules/pattern/docs/select.md +206 -0
- package/modules/pattern/docs/split.md +350 -0
- package/modules/pattern/docs/states.md +168 -0
- package/modules/pattern/features/approval/entity.resolver.ts +21 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
- package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
- package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
- package/modules/pattern/features/approval/routes.ts +30 -0
- package/modules/pattern/features/approval/services/approval.model.ts +38 -0
- package/modules/pattern/features/approval/services/approval.service.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
- package/modules/pattern/features/category/entity.resolver.ts +27 -0
- package/modules/pattern/features/category/pages/list/list.component.html +20 -0
- package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
- package/modules/pattern/features/category/routes.ts +42 -0
- package/modules/pattern/features/category/services/category.model.ts +39 -0
- package/modules/pattern/features/category/services/category.service.ts +36 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
- package/modules/pattern/features/customer/entity.resolver.ts +21 -0
- package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
- package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
- package/modules/pattern/features/customer/routes.ts +59 -0
- package/modules/pattern/features/customer/services/customer.model.ts +87 -0
- package/modules/pattern/features/customer/services/customer.service.ts +79 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
- package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
- package/modules/pattern/features/import/routes.ts +19 -0
- package/modules/pattern/features/import/services/import.model.ts +82 -0
- package/modules/pattern/features/import/services/import.service.ts +18 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
- package/modules/pattern/features/order/entity.resolver.ts +37 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
- package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
- package/modules/pattern/features/order/pages/list/list.component.html +38 -0
- package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
- package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
- package/modules/pattern/features/order/routes.ts +54 -0
- package/modules/pattern/features/order/services/order.model.ts +109 -0
- package/modules/pattern/features/order/services/order.service.ts +63 -0
- package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
- package/modules/pattern/features/partner/routes.ts +20 -0
- package/modules/pattern/features/partner/services/partner.model.ts +30 -0
- package/modules/pattern/features/partner/services/partner.service.ts +17 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
- package/modules/pattern/features/product/entity.resolver.ts +21 -0
- package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
- package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
- package/modules/pattern/features/product/pages/list/list.component.html +30 -0
- package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
- package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
- package/modules/pattern/features/product/routes.ts +48 -0
- package/modules/pattern/features/product/services/product.model.ts +38 -0
- package/modules/pattern/features/product/services/product.service.ts +48 -0
- package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
- package/modules/pattern/features/settings/routes.ts +24 -0
- package/modules/pattern/features/settings/services/settings.model.ts +18 -0
- package/modules/pattern/features/settings/services/settings.service.ts +15 -0
- package/modules/pattern/features/settings/settings.resolver.ts +8 -0
- package/package.json +44 -7
- package/types/sdcorejs-angular-components-avatar.d.ts +67 -2
- package/types/sdcorejs-angular-components-badge.d.ts +206 -6
- package/types/sdcorejs-angular-components-button.d.ts +20 -1
- package/types/sdcorejs-angular-components-ckeditor-styles.d.ts +3 -18
- package/types/sdcorejs-angular-components-editor-engine.d.ts +246 -0
- package/types/sdcorejs-angular-components-editor.d.ts +20 -17
- package/types/sdcorejs-angular-components-file-explorer.d.ts +4 -2
- package/types/sdcorejs-angular-components-form-generic.d.ts +246 -35
- package/types/sdcorejs-angular-components-mini-editor.d.ts +33 -70
- package/types/sdcorejs-angular-components-modal-resizable.d.ts +1 -124
- package/types/sdcorejs-angular-components-operator.d.ts +137 -8
- package/types/sdcorejs-angular-components-section.d.ts +13 -1
- package/types/sdcorejs-angular-components-splitter.d.ts +1 -1
- package/types/sdcorejs-angular-components-tab-router.d.ts +74 -19
- package/types/sdcorejs-angular-components-table.d.ts +210 -18
- package/types/sdcorejs-angular-components-upload-file.d.ts +181 -21
- package/types/sdcorejs-angular-components-window.d.ts +81 -0
- package/types/sdcorejs-angular-components.d.ts +1 -0
- package/types/sdcorejs-angular-configurations.d.ts +8 -1
- package/types/sdcorejs-angular-forms-autocomplete.d.ts +5 -0
- package/types/sdcorejs-angular-forms-chip-calendar.d.ts +163 -18
- package/types/sdcorejs-angular-forms-chip.d.ts +136 -26
- package/types/sdcorejs-angular-forms-date-range.d.ts +24 -2
- package/types/sdcorejs-angular-forms-date.d.ts +23 -2
- package/types/sdcorejs-angular-forms-directives.d.ts +47 -2
- package/types/sdcorejs-angular-forms-input-number.d.ts +23 -2
- package/types/sdcorejs-angular-forms-input.d.ts +23 -2
- package/types/sdcorejs-angular-forms-models.d.ts +38 -3
- package/types/sdcorejs-angular-forms-select.d.ts +32 -2
- package/types/sdcorejs-angular-i18n.d.ts +344 -2
- package/types/sdcorejs-angular-modules-generic.d.ts +316 -0
- package/types/sdcorejs-angular-modules-icon.d.ts +37 -6
- package/types/sdcorejs-angular-modules-layout.d.ts +622 -89
- package/types/sdcorejs-angular-modules-pattern.d.ts +50 -0
- package/types/sdcorejs-angular-modules.d.ts +1 -0
- package/types/sdcorejs-angular-pipes.d.ts +2 -0
- package/types/sdcorejs-angular-services-date-time.d.ts +57 -0
- package/types/sdcorejs-angular-services-storage.d.ts +8 -1
- package/types/sdcorejs-angular-services-unsaved-changes.d.ts +11 -0
- package/types/sdcorejs-angular-services.d.ts +1 -0
- package/types/sdcorejs-angular-utilities-read-state.d.ts +2 -0
- package/types/sdcorejs-angular-utilities-theme.d.ts +1 -1
|
@@ -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" } : /* istanbul ignore next */ {}), alias: 'autoId',
|
|
@@ -120,9 +116,33 @@ class SdChip {
|
|
|
120
116
|
removable = input(true, { ...(ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {}), transform: (v) => v ?? true });
|
|
121
117
|
hideInlineError = input(false, { ...(ngDevMode ? { debugName: "hideInlineError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
122
118
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
119
|
+
/** Fewest chips; > 0 adds `Validators.minLength`. Replaces `min`. */
|
|
120
|
+
minCount = input(undefined, { ...(ngDevMode ? { debugName: "minCount" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
121
|
+
/** Most chips; > 0 adds `Validators.maxLength` (for a model set from outside) and stops adding once reached. Replaces `max`. */
|
|
122
|
+
maxCount = input(undefined, { ...(ngDevMode ? { debugName: "maxCount" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
123
|
+
/** @deprecated Use `minCount`; `minCount` wins when both are set. */
|
|
123
124
|
min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: (v) => v ?? 0 });
|
|
125
|
+
/** @deprecated Use `maxCount`; `maxCount` wins when both are set. */
|
|
124
126
|
max = input(0, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: (v) => v ?? 0 });
|
|
127
|
+
/** `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. */
|
|
125
128
|
addable = input(true, { ...(ngDevMode ? { debugName: "addable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
129
|
+
/** Leaving the field turns the typed text into a chip. `false` drops the text instead, as before. */
|
|
130
|
+
addOnBlur = input(true, { ...(ngDevMode ? { debugName: "addOnBlur" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
131
|
+
/** Keys that commit the typed text (`KeyboardEvent.key`). A paste also splits on these characters, new lines and tabs. */
|
|
132
|
+
separators = input(DEFAULT_SEPARATORS, { ...(ngDevMode ? { debugName: "separators" } : /* istanbul ignore next */ {}), transform: (v) => v ?? DEFAULT_SEPARATORS });
|
|
133
|
+
/** Normalises typed or pasted text before it is compared and stored; `null` or `''` drops it. Default: trim. */
|
|
134
|
+
chipTransform = input(trimChip, { ...(ngDevMode ? { debugName: "chipTransform" } : /* istanbul ignore next */ {}), transform: (v) => v ?? trimChip });
|
|
135
|
+
/**
|
|
136
|
+
* Checks a normalised value: an i18n key (or the message itself) when it is refused, else `null`. A refused value does
|
|
137
|
+
* not become a chip; its text stays in the input and the message shows under the field.
|
|
138
|
+
*/
|
|
139
|
+
chipValidator = input(null, /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "chipValidator" }] : /* istanbul ignore next */ []));
|
|
141
|
+
/** Shows a button that removes every chip `removable` allows. Off by default, like `clearable` of `<sd-date>`. */
|
|
142
|
+
clearable = input(false, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
143
|
+
/** Chips shown while the field is not focused; the rest fold into “+N”. `null` shows them all. `2` suits `<sd-table>` cells. */
|
|
144
|
+
maxVisible = input(null, /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "maxVisible" }] : /* istanbul ignore next */ []));
|
|
126
146
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
127
147
|
/** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */
|
|
128
148
|
viewed = input(false, { ...(ngDevMode ? { debugName: "viewed" } : /* istanbul ignore next */ {}), transform: sdViewedTransform });
|
|
@@ -139,6 +159,11 @@ class SdChip {
|
|
|
139
159
|
// Template properties
|
|
140
160
|
input = viewChild('input', /* @ts-ignore */
|
|
141
161
|
...(ngDevMode ? [{ debugName: "input" }] : /* istanbul ignore next */ []));
|
|
162
|
+
chipGrid = viewChild(MatChipGrid, /* @ts-ignore */
|
|
163
|
+
...(ngDevMode ? [{ debugName: "chipGrid" }] : /* istanbul ignore next */ []));
|
|
164
|
+
// why: query signal không đặt được trên field ES private (#).
|
|
165
|
+
chipTextElements = viewChildren('chipTextEl', /* @ts-ignore */
|
|
166
|
+
...(ngDevMode ? [{ debugName: "chipTextElements" }] : /* istanbul ignore next */ []));
|
|
142
167
|
sdViewDef = contentChild(SdViewDefDirective, /* @ts-ignore */
|
|
143
168
|
...(ngDevMode ? [{ debugName: "sdViewDef" }] : /* istanbul ignore next */ []));
|
|
144
169
|
sdLabelDef = contentChild(SdLabelDefDirective, /* @ts-ignore */
|
|
@@ -149,17 +174,31 @@ class SdChip {
|
|
|
149
174
|
...(ngDevMode ? [{ debugName: "sdValueTemplate" }] : /* istanbul ignore next */ []));
|
|
150
175
|
// Local states
|
|
151
176
|
#isBlurring = false;
|
|
152
|
-
|
|
177
|
+
/** The field is being edited: the `sdViewDef` face gives way to the field. A signal, so OnPush redraws without `detectChanges()` (D1). */
|
|
178
|
+
isFocused = signal(false, /* @ts-ignore */
|
|
179
|
+
...(ngDevMode ? [{ debugName: "isFocused" }] : /* istanbul ignore next */ []));
|
|
153
180
|
#inputControl = new FormControl();
|
|
154
181
|
#formControl = new SdFormControl();
|
|
182
|
+
/**
|
|
183
|
+
* Control of `mat-chip-grid` only. why: the grid is a ControlValueAccessor that writes the text of the rendered chips
|
|
184
|
+
* into its control on blur, after a timeout (numbers became strings, a form reset was undone). It still needs an
|
|
185
|
+
* ngControl to work out its error state on every check, so it gets this one; nothing reads its value.
|
|
186
|
+
*/
|
|
187
|
+
gridControl = new FormControl(null);
|
|
155
188
|
// why: `min`/`max` chỉ là validator do CHÍNH component sở hữu; `required` đi qua option riêng
|
|
156
189
|
// của connector. Connector add/remove đúng phần này (addValidators/removeValidators) nên
|
|
157
190
|
// validator do consumer tự gắn vào `formControl` public KHÔNG bị xoá — trước đây
|
|
158
191
|
// `clearValidators()` + `setValidators()` thổi bay tất cả mỗi lần input đổi.
|
|
192
|
+
/** `minCount`, else the deprecated `min`. */
|
|
193
|
+
effectiveMinCount = computed(() => this.minCount() ?? this.min() ?? 0, /* @ts-ignore */
|
|
194
|
+
...(ngDevMode ? [{ debugName: "effectiveMinCount" }] : /* istanbul ignore next */ []));
|
|
195
|
+
/** `maxCount`, else the deprecated `max`. */
|
|
196
|
+
effectiveMaxCount = computed(() => this.maxCount() ?? this.max() ?? 0, /* @ts-ignore */
|
|
197
|
+
...(ngDevMode ? [{ debugName: "effectiveMaxCount" }] : /* istanbul ignore next */ []));
|
|
159
198
|
#validators = computed(() => {
|
|
160
199
|
const validators = [];
|
|
161
|
-
const min = this.
|
|
162
|
-
const max = this.
|
|
200
|
+
const min = this.effectiveMinCount();
|
|
201
|
+
const max = this.effectiveMaxCount();
|
|
163
202
|
if (min > 0)
|
|
164
203
|
validators.push(Validators.minLength(min));
|
|
165
204
|
if (max > 0)
|
|
@@ -175,15 +214,87 @@ class SdChip {
|
|
|
175
214
|
required: this.required,
|
|
176
215
|
});
|
|
177
216
|
#matcher;
|
|
178
|
-
|
|
179
|
-
|
|
217
|
+
/** why: phím tách do `separators` + onInputKeydown xử lý, nên Material không nhận phím nào. */
|
|
218
|
+
noSeparatorKeys = [];
|
|
219
|
+
/**
|
|
220
|
+
* Items rendered as chips: every value except `null`, `undefined` and `''`, so `0` shows (A2). Display only: the
|
|
221
|
+
* model is never rewritten. why: exact duplicates are dropped too, because the chips are tracked by value.
|
|
222
|
+
*/
|
|
223
|
+
chips = computed(() => {
|
|
224
|
+
const value = this.#state().value;
|
|
225
|
+
return Array.isArray(value) ? [...new Set(value.filter(isChipItem))] : [];
|
|
226
|
+
}, /* @ts-ignore */
|
|
227
|
+
...(ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []));
|
|
228
|
+
/** Focus is in the input or on a chip; “+N” only folds chips while it is not (B7). */
|
|
229
|
+
#focusWithin = signal(false, /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "#focusWithin" }] : /* istanbul ignore next */ []));
|
|
231
|
+
/** Message of a typed or pasted value that `chipValidator` refused; it shows under the field until the text changes (B4). */
|
|
232
|
+
inputError = signal(null, /* @ts-ignore */
|
|
233
|
+
...(ngDevMode ? [{ debugName: "inputError" }] : /* istanbul ignore next */ []));
|
|
234
|
+
/** Last polite announcement; a new id re-renders the text so a repeated message is read again. */
|
|
235
|
+
liveMessage = signal(null, /* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [{ debugName: "liveMessage" }] : /* istanbul ignore next */ []));
|
|
237
|
+
#liveId = 0;
|
|
238
|
+
/** Chip that the typed value duplicates, highlighted for 1.4s (B3). */
|
|
239
|
+
duplicateChip = signal(null, /* @ts-ignore */
|
|
240
|
+
...(ngDevMode ? [{ debugName: "duplicateChip" }] : /* istanbul ignore next */ []));
|
|
241
|
+
/** Text of the chips that the 240px limit cuts; only they get a tooltip (B7). */
|
|
242
|
+
truncatedChips = signal(new Set(), /* @ts-ignore */
|
|
243
|
+
...(ngDevMode ? [{ debugName: "truncatedChips" }] : /* istanbul ignore next */ []));
|
|
244
|
+
#warnedDeprecated = false;
|
|
245
|
+
/** `maxCount` reached: typing and pasting add nothing more (B3). */
|
|
246
|
+
full = computed(() => {
|
|
247
|
+
const max = this.effectiveMaxCount();
|
|
248
|
+
return max > 0 && this.chips().length >= max;
|
|
249
|
+
}, /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "full" }] : /* istanbul ignore next */ []));
|
|
251
|
+
/** Chips on screen: all while the field has focus, else at most `maxVisible` (B7). */
|
|
252
|
+
visibleChips = computed(() => {
|
|
253
|
+
const chips = this.chips();
|
|
254
|
+
const max = this.maxVisible();
|
|
255
|
+
if (this.#focusWithin() || max === null || max === undefined || max < 0 || chips.length <= max)
|
|
256
|
+
return chips;
|
|
257
|
+
return chips.slice(0, max);
|
|
258
|
+
}, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "visibleChips" }] : /* istanbul ignore next */ []));
|
|
260
|
+
/** Chips folded into “+N”. */
|
|
261
|
+
hiddenCount = computed(() => this.chips().length - this.visibleChips().length, /* @ts-ignore */
|
|
262
|
+
...(ngDevMode ? [{ debugName: "hiddenCount" }] : /* istanbul ignore next */ []));
|
|
263
|
+
/** At least one chip may be removed, so the clear button has something to do (B6). */
|
|
264
|
+
hasRemovable = computed(() => {
|
|
265
|
+
void this.removable();
|
|
266
|
+
return this.chips().some(chip => this.isRemovable(chip));
|
|
267
|
+
}, /* @ts-ignore */
|
|
268
|
+
...(ngDevMode ? [{ debugName: "hasRemovable" }] : /* istanbul ignore next */ []));
|
|
269
|
+
/**
|
|
270
|
+
* Placeholder: “Đã đủ …” once full, else the input, else “Nhập rồi nhấn Enter” — never the label (B5). None when not
|
|
271
|
+
* addable, or while chips are folded into “+N”: nobody types then, and the input only fills the rest of the line (C1).
|
|
272
|
+
*/
|
|
273
|
+
effectivePlaceholder = computed(() => {
|
|
274
|
+
if (!this.addable() || this.hiddenCount() > 0)
|
|
275
|
+
return null;
|
|
276
|
+
if (this.full())
|
|
277
|
+
return this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() });
|
|
278
|
+
return this.placeholder() || this.#i18n.t('core.form.chip.placeholder');
|
|
279
|
+
}, /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []));
|
|
281
|
+
clearLabel = computed(() => this.#i18n.t('core.form.chip.clear'), /* @ts-ignore */
|
|
282
|
+
...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
283
|
+
/** Tooltip of the lock on a chip that `removable` keeps (C3). */
|
|
284
|
+
lockedLabel = computed(() => this.#i18n.t('core.form.chip.locked'), /* @ts-ignore */
|
|
285
|
+
...(ngDevMode ? [{ debugName: "lockedLabel" }] : /* istanbul ignore next */ []));
|
|
286
|
+
/** Sizes of the chip ✕ / lock and of the clear-button icon for the current `size` (C1). */
|
|
287
|
+
iconSizes = computed(() => CHIP_ICONS[this.size() === 'sm' || this.size() === 'lg' ? this.size() : 'md'], /* @ts-ignore */
|
|
288
|
+
...(ngDevMode ? [{ debugName: "iconSizes" }] : /* istanbul ignore next */ []));
|
|
289
|
+
moreLabel = computed(() => this.#i18n.t('core.form.chip.more', { count: this.hiddenCount() }), /* @ts-ignore */
|
|
290
|
+
...(ngDevMode ? [{ debugName: "moreLabel" }] : /* istanbul ignore next */ []));
|
|
180
291
|
constructor() {
|
|
181
292
|
// Update model
|
|
182
293
|
effect(() => {
|
|
183
294
|
const values = this.model();
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
295
|
+
// why: `null` / `undefined` từ cha phải xoá chip và đưa control về `[]`; trước đây control giữ mảng cũ và
|
|
296
|
+
// vẫn gửi nó đi khi submit (A4).
|
|
297
|
+
this.#formControl.setValue(Array.isArray(values) ? values : []);
|
|
187
298
|
});
|
|
188
299
|
// Handle disabled state
|
|
189
300
|
effect(() => {
|
|
@@ -191,19 +302,43 @@ class SdChip {
|
|
|
191
302
|
if (isDisabled) {
|
|
192
303
|
this.#formControl.disable();
|
|
193
304
|
this.#inputControl.disable();
|
|
305
|
+
this.gridControl.disable();
|
|
194
306
|
}
|
|
195
307
|
else {
|
|
196
308
|
this.#formControl.enable();
|
|
197
309
|
this.#inputControl.enable();
|
|
310
|
+
this.gridControl.enable();
|
|
198
311
|
}
|
|
199
312
|
});
|
|
313
|
+
// why: `[required]` trên mat-chip-grid khớp selector `[required][formControl]` của RequiredValidator, nên
|
|
314
|
+
// `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
|
|
315
|
+
// tính của grid: mat-form-field vẫn hiện dấu * và ô nhập vẫn có aria-required.
|
|
316
|
+
effect(() => {
|
|
317
|
+
const grid = this.chipGrid();
|
|
318
|
+
if (grid)
|
|
319
|
+
grid.required = this.required();
|
|
320
|
+
});
|
|
200
321
|
effect(() => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
322
|
+
if ((this.min() > 0 || this.max() > 0) && !this.#warnedDeprecated && isDevMode()) {
|
|
323
|
+
this.#warnedDeprecated = true;
|
|
324
|
+
console.warn('[sd-chip] `min` / `max` are deprecated; use `minCount` / `maxCount`.');
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
// 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ẽ.
|
|
328
|
+
afterRenderEffect(() => {
|
|
329
|
+
const cut = new Set();
|
|
330
|
+
for (const { nativeElement } of this.chipTextElements()) {
|
|
331
|
+
if (nativeElement.scrollWidth > nativeElement.clientWidth)
|
|
332
|
+
cut.add(nativeElement.dataset['chip'] ?? '');
|
|
204
333
|
}
|
|
334
|
+
const current = untracked(this.truncatedChips);
|
|
335
|
+
if (cut.size !== current.size || [...cut].some(text => !current.has(text)))
|
|
336
|
+
this.truncatedChips.set(cut);
|
|
205
337
|
});
|
|
206
|
-
|
|
338
|
+
// why: `submitted` của form cha không phải signal; submit phải vẽ lại lỗi dưới OnPush.
|
|
339
|
+
this.#parentForm?.ngSubmit.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
340
|
+
this.#formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
341
|
+
this.#matcher = { isErrorState: (_control, form) => !!this.inputError() || this.#errorGate(form) };
|
|
207
342
|
}
|
|
208
343
|
get formControl() {
|
|
209
344
|
return this.#formControl;
|
|
@@ -220,8 +355,8 @@ class SdChip {
|
|
|
220
355
|
errorMessage = computed(() => {
|
|
221
356
|
void this.#state();
|
|
222
357
|
void this.required();
|
|
223
|
-
const min = this.
|
|
224
|
-
const max = this.
|
|
358
|
+
const min = this.effectiveMinCount();
|
|
359
|
+
const max = this.effectiveMaxCount();
|
|
225
360
|
const errors = this.#formControl.errors;
|
|
226
361
|
if (!errors)
|
|
227
362
|
return undefined;
|
|
@@ -237,32 +372,220 @@ class SdChip {
|
|
|
237
372
|
get matcher() {
|
|
238
373
|
return this.#matcher;
|
|
239
374
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
375
|
+
/**
|
|
376
|
+
* The one place that decides whether the error shows (A5): the `ErrorStateMatcher` of the chip grid and the input,
|
|
377
|
+
* `<mat-error>`, the `hideInlineError` icon and `aria-invalid` all read it. Invalid and touched, or the parent form
|
|
378
|
+
* was submitted; a field that is only dirty shows nothing.
|
|
379
|
+
*/
|
|
380
|
+
isErrorShown() {
|
|
381
|
+
return !!this.inputError() || (!!this.errorMessage() && this.#errorGate());
|
|
382
|
+
}
|
|
383
|
+
/** Text under the field: the `chipValidator` message of the typed value first, else the form error. */
|
|
384
|
+
errorText = computed(() => this.inputError() ?? this.errorMessage(), /* @ts-ignore */
|
|
385
|
+
...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
386
|
+
#errorGate(form) {
|
|
387
|
+
const control = this.#formControl;
|
|
388
|
+
return control.invalid && (control.touched || !!(form ?? this.#parentForm)?.submitted);
|
|
244
389
|
}
|
|
245
|
-
|
|
246
|
-
|
|
390
|
+
/** Whether `item` may be removed, per `removable`; applied on every removal path (A1). */
|
|
391
|
+
isRemovable(item) {
|
|
392
|
+
const removable = this.removable();
|
|
393
|
+
return typeof removable === 'function' ? !!removable(item) : removable;
|
|
247
394
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
395
|
+
/** Accessible name of the ✕ button of a chip (A6). */
|
|
396
|
+
removeLabel(item) {
|
|
397
|
+
return this.#i18n.t('core.form.chip.remove', { value: String(item) });
|
|
398
|
+
}
|
|
399
|
+
/** Accessible name of a chip that `removable` keeps: its text plus “, Không xoá được” (C3). A removable chip keeps its text. */
|
|
400
|
+
chipLabel(item) {
|
|
401
|
+
return this.isRemovable(item) ? null : `${String(item)}, ${this.lockedLabel()}`;
|
|
402
|
+
}
|
|
403
|
+
/** Text of a chip, also its key for `truncatedChips`. */
|
|
404
|
+
chipText(item) {
|
|
405
|
+
return String(item);
|
|
406
|
+
}
|
|
407
|
+
/** A separator key (`separators`) commits the typed text; the key itself is not typed (B2 / separators). */
|
|
408
|
+
onInputKeydown(event) {
|
|
409
|
+
if (event.isComposing || !this.separators().includes(event.key))
|
|
410
|
+
return;
|
|
411
|
+
event.preventDefault();
|
|
412
|
+
this.#commitText(this.input()?.nativeElement.value ?? '');
|
|
413
|
+
}
|
|
414
|
+
/** The refused-value message goes as soon as the text changes (B4). */
|
|
415
|
+
onInputText() {
|
|
416
|
+
if (this.inputError())
|
|
417
|
+
this.inputError.set(null);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* A paste that holds a separator, a new line or a tab becomes several chips in one change (B2). Duplicates are
|
|
421
|
+
* skipped, refused values and values past `maxCount` stay in the input, and the result is announced. A paste with
|
|
422
|
+
* no separator is left to the browser.
|
|
423
|
+
*/
|
|
424
|
+
onPaste(event) {
|
|
425
|
+
if (!this.addable())
|
|
426
|
+
return;
|
|
427
|
+
const text = event.clipboardData?.getData('text') ?? '';
|
|
428
|
+
const chars = new Set(['\n', '\r', '\t']);
|
|
429
|
+
for (const key of this.separators()) {
|
|
430
|
+
const char = separatorChar(key);
|
|
431
|
+
if (char)
|
|
432
|
+
chars.add(char);
|
|
433
|
+
}
|
|
434
|
+
const parts = text.split(new RegExp(`[${[...chars].map(char => char.replace(/[\\\]^-]/g, '\\$&')).join('')}]`));
|
|
435
|
+
if (parts.length < 2)
|
|
436
|
+
return;
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
const next = [...this.#currentValues()];
|
|
439
|
+
const max = this.effectiveMaxCount();
|
|
440
|
+
const kept = [];
|
|
441
|
+
let added = 0;
|
|
442
|
+
let skipped = 0;
|
|
443
|
+
let overflow = false;
|
|
444
|
+
let error = null;
|
|
445
|
+
for (const raw of parts) {
|
|
446
|
+
const value = this.#normalise(raw);
|
|
447
|
+
if (value === null)
|
|
448
|
+
continue;
|
|
449
|
+
if (next.some(item => String(item) === String(value))) {
|
|
450
|
+
skipped++;
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
const refused = this.#refusal(value);
|
|
454
|
+
if (refused || (max > 0 && next.length >= max)) {
|
|
455
|
+
if (refused)
|
|
456
|
+
error ??= refused;
|
|
457
|
+
else
|
|
458
|
+
overflow = true;
|
|
459
|
+
kept.push(raw.trim());
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
next.push(value);
|
|
463
|
+
added++;
|
|
260
464
|
}
|
|
465
|
+
if (added)
|
|
466
|
+
this.#commit(next);
|
|
467
|
+
this.#setInputText(kept.join(', '));
|
|
468
|
+
this.inputError.set(error);
|
|
469
|
+
const notes = [this.#i18n.t('core.form.chip.added', { count: added })];
|
|
470
|
+
if (skipped)
|
|
471
|
+
notes.push(this.#i18n.t('core.form.chip.skipped', { count: skipped }));
|
|
472
|
+
if (overflow)
|
|
473
|
+
notes.push(this.#i18n.t('core.form.chip.full', { max }));
|
|
474
|
+
this.#announce(notes.join(' · '));
|
|
475
|
+
}
|
|
476
|
+
/** Backspace / Delete on a chip that `removable` keeps says why nothing happened (A1, B3). */
|
|
477
|
+
onChipKeydown(event, item) {
|
|
478
|
+
if ((event.key === 'Backspace' || event.key === 'Delete') && !this.isRemovable(item)) {
|
|
479
|
+
this.#announce(this.#i18n.t('core.form.chip.locked'));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
/** “+N” moves focus to the input, where every chip shows (B7). */
|
|
483
|
+
onMoreClick(event) {
|
|
484
|
+
event.stopPropagation();
|
|
485
|
+
this.#focus();
|
|
486
|
+
}
|
|
487
|
+
/** Focus entering the input or a chip unfolds “+N”; focus on the “+N” button itself does not (B7). */
|
|
488
|
+
onFocusIn(event) {
|
|
489
|
+
const target = event.target;
|
|
490
|
+
if (target?.classList.contains('sd-chip__more'))
|
|
491
|
+
return;
|
|
492
|
+
this.#focusWithin.set(true);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Marks the field touched once focus leaves it; moving between the input and the chips does not count.
|
|
496
|
+
* why: `mat-chip-grid` is no longer bound to the control. As a ControlValueAccessor it wrote the text of the rendered
|
|
497
|
+
* chips back into the control on blur (numbers became strings, a form reset was undone), so the component marks
|
|
498
|
+
* touched itself, like the grid did.
|
|
499
|
+
*/
|
|
500
|
+
onFocusOut(event) {
|
|
501
|
+
const next = event.relatedTarget;
|
|
502
|
+
if (next && this.#host.contains(next))
|
|
503
|
+
return;
|
|
504
|
+
this.#focusWithin.set(false);
|
|
505
|
+
this.#formConnector.markAsTouched();
|
|
506
|
+
this.#ref.markForCheck();
|
|
507
|
+
}
|
|
508
|
+
#add = (event) => this.#commitText(event.value ?? '');
|
|
509
|
+
/**
|
|
510
|
+
* Typed text → chip (a separator key, blur, or `onAdd`): normalise, then a duplicate flashes the chip it repeats, a full
|
|
511
|
+
* field says so, a refused value stays in the input with its message, and anything else is added in one change.
|
|
512
|
+
*/
|
|
513
|
+
#commitText(raw) {
|
|
514
|
+
if (!this.addable())
|
|
515
|
+
return;
|
|
516
|
+
const value = this.#normalise(String(raw));
|
|
517
|
+
if (value === null) {
|
|
518
|
+
this.#setInputText('');
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const values = this.#currentValues();
|
|
522
|
+
// why: so trùng theo chuỗi — model `[1]` và chữ "1" vừa gõ là một chip (A3).
|
|
523
|
+
const existing = values.find(item => String(item) === String(value));
|
|
524
|
+
if (existing !== undefined) {
|
|
525
|
+
this.#flashDuplicate(existing);
|
|
526
|
+
this.#announce(this.#i18n.t('core.form.chip.duplicate', { value: String(value) }));
|
|
527
|
+
this.#setInputText('');
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
if (this.full()) {
|
|
531
|
+
this.#announce(this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() }));
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const refused = this.#refusal(value);
|
|
535
|
+
if (refused) {
|
|
536
|
+
this.inputError.set(refused);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
// 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
|
|
540
|
+
// 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
|
|
541
|
+
// `modelChange`, làm `[(model)]` lệch âm thầm.
|
|
542
|
+
this.#commit([...values, value]);
|
|
543
|
+
this.#setInputText('');
|
|
544
|
+
}
|
|
545
|
+
/** `chipTransform` of the text; `null`, `undefined` or `''` means nothing to add. */
|
|
546
|
+
#normalise(raw) {
|
|
547
|
+
const value = this.chipTransform()(raw);
|
|
548
|
+
return value === null || value === undefined || value === '' ? null : value;
|
|
549
|
+
}
|
|
550
|
+
/** Message of `chipValidator` for `value`, translated when it is a key, else `null`. */
|
|
551
|
+
#refusal(value) {
|
|
552
|
+
const result = this.chipValidator()?.(value) ?? null;
|
|
553
|
+
if (!result)
|
|
554
|
+
return null;
|
|
555
|
+
// 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.
|
|
556
|
+
return result in this.#i18n.messages() ? this.#i18n.t(result) : result;
|
|
557
|
+
}
|
|
558
|
+
#currentValues() {
|
|
559
|
+
const value = this.#formControl.value;
|
|
560
|
+
return Array.isArray(value) ? value : [];
|
|
561
|
+
}
|
|
562
|
+
/** Every user change ends here: one new array, written once to the control, the model and `sdChange`. */
|
|
563
|
+
#commit(next) {
|
|
564
|
+
this.inputError.set(null);
|
|
565
|
+
// 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;
|
|
566
|
+
// ô gõ là inputControl nên control của chip không tự dirty.
|
|
567
|
+
this.#formControl.markAsDirty();
|
|
568
|
+
this.#formControl.setValue(next);
|
|
569
|
+
this.model.set(next);
|
|
570
|
+
this.sdChange.emit(next);
|
|
571
|
+
this.#ref.markForCheck();
|
|
572
|
+
}
|
|
573
|
+
#setInputText(text) {
|
|
261
574
|
const inputEl = this.input();
|
|
262
575
|
if (inputEl)
|
|
263
|
-
inputEl.nativeElement.value =
|
|
264
|
-
this.#inputControl.setValue(
|
|
265
|
-
}
|
|
576
|
+
inputEl.nativeElement.value = text;
|
|
577
|
+
this.#inputControl.setValue(text);
|
|
578
|
+
}
|
|
579
|
+
#announce(text) {
|
|
580
|
+
this.liveMessage.set({ id: ++this.#liveId, text });
|
|
581
|
+
}
|
|
582
|
+
#flashDuplicate(item) {
|
|
583
|
+
this.duplicateChip.set(item);
|
|
584
|
+
this.#timers.schedule(() => {
|
|
585
|
+
if (this.duplicateChip() === item)
|
|
586
|
+
this.duplicateChip.set(null);
|
|
587
|
+
}, DUPLICATE_FLASH_MS);
|
|
588
|
+
}
|
|
266
589
|
#clickChip = ($event, item) => {
|
|
267
590
|
$event.stopPropagation();
|
|
268
591
|
$event.stopImmediatePropagation();
|
|
@@ -272,9 +595,11 @@ class SdChip {
|
|
|
272
595
|
};
|
|
273
596
|
#remove = (item) => {
|
|
274
597
|
const values = this.#formControl.value ?? [];
|
|
275
|
-
|
|
598
|
+
// why: `removable` áp cho mọi đường xoá, kể cả Backspace / Delete trên chip mà Material vẫn phát `(removed)` (A1).
|
|
599
|
+
if ((typeof item === 'string' || typeof item === 'number') && this.isRemovable(item)) {
|
|
276
600
|
// why: `filter` đã trả mảng mới nên reference đổi → `model.set` phát `modelChange`.
|
|
277
601
|
const next = values.filter(value => item !== value);
|
|
602
|
+
this.#formControl.markAsDirty();
|
|
278
603
|
this.#formControl.setValue(next);
|
|
279
604
|
this.model.set(next);
|
|
280
605
|
this.sdChange.emit(next);
|
|
@@ -282,83 +607,74 @@ class SdChip {
|
|
|
282
607
|
this.#inputControl.setValue('');
|
|
283
608
|
this.#focus();
|
|
284
609
|
};
|
|
285
|
-
|
|
286
|
-
const item = event.option.value;
|
|
287
|
-
const values = this.#formControl.value ?? [];
|
|
288
|
-
if (item) {
|
|
289
|
-
if (typeof item === 'string' || typeof item === 'number') {
|
|
290
|
-
if (!values.includes(item)) {
|
|
291
|
-
// why: giống #add — mảng mới, không `push` lên mảng của consumer.
|
|
292
|
-
const next = [...values, item];
|
|
293
|
-
this.#formControl.setValue(next);
|
|
294
|
-
this.model.set(next);
|
|
295
|
-
this.sdChange.emit(next);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
const inputEl = this.input();
|
|
299
|
-
if (inputEl)
|
|
300
|
-
inputEl.nativeElement.value = '';
|
|
301
|
-
this.#inputControl.setValue('', {
|
|
302
|
-
emitEvent: false,
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
};
|
|
610
|
+
// why: focus không còn xoá chữ đang gõ (B1).
|
|
306
611
|
#onFocus = () => {
|
|
307
|
-
this.isFocused
|
|
612
|
+
this.isFocused.set(true);
|
|
308
613
|
this.#isBlurring = false;
|
|
309
|
-
this.#inputControl.setValue('');
|
|
310
614
|
};
|
|
311
615
|
#onBlur = () => {
|
|
312
616
|
this.#isBlurring = true;
|
|
313
|
-
// why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle
|
|
314
|
-
//
|
|
617
|
+
// why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle theo DestroyRef. Chữ đang gõ
|
|
618
|
+
// thành chip qua `matChipInputAddOnBlur`; chỉ khi `[addOnBlur]="false"` mới bỏ chữ như trước (B1).
|
|
315
619
|
this.#timers.schedule(() => {
|
|
316
620
|
if (this.#isBlurring) {
|
|
317
|
-
this.isFocused
|
|
318
|
-
this
|
|
319
|
-
|
|
320
|
-
});
|
|
321
|
-
this.#ref.detectChanges();
|
|
621
|
+
this.isFocused.set(false);
|
|
622
|
+
if (!this.addOnBlur())
|
|
623
|
+
this.#setInputText('');
|
|
322
624
|
}
|
|
323
625
|
}, 150);
|
|
324
626
|
};
|
|
325
627
|
#onClick = () => {
|
|
326
628
|
if (this.sdViewDef()?.templateRef) {
|
|
327
|
-
if (!this.#formControl.disabled && !this.isFocused) {
|
|
629
|
+
if (!this.#formControl.disabled && !this.isFocused()) {
|
|
328
630
|
this.#focus();
|
|
329
631
|
}
|
|
330
632
|
}
|
|
331
633
|
};
|
|
332
634
|
#focus = () => {
|
|
333
|
-
this.isFocused
|
|
635
|
+
this.isFocused.set(true);
|
|
334
636
|
this.#isBlurring = false;
|
|
335
637
|
// why: vẫn 100ms như cũ — chỉ scope handle theo DestroyRef.
|
|
336
638
|
this.#timers.schedule(() => {
|
|
337
|
-
if (this.isFocused) {
|
|
639
|
+
if (this.isFocused()) {
|
|
338
640
|
this.input()?.nativeElement?.focus();
|
|
339
641
|
}
|
|
340
642
|
}, 100);
|
|
341
643
|
};
|
|
644
|
+
/** Removes every chip `removable` allows; locked chips stay. One change, none when nothing goes (B6). */
|
|
342
645
|
#clear = ($event) => {
|
|
343
646
|
$event?.stopPropagation();
|
|
344
|
-
this.#
|
|
345
|
-
this
|
|
346
|
-
this
|
|
347
|
-
|
|
348
|
-
|
|
647
|
+
this.#setInputText('');
|
|
648
|
+
this.inputError.set(null);
|
|
649
|
+
const values = this.#currentValues();
|
|
650
|
+
const kept = values.filter(value => !this.isRemovable(value));
|
|
651
|
+
if (kept.length !== values.length)
|
|
652
|
+
this.#commit(kept);
|
|
653
|
+
// 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.
|
|
654
|
+
if ($event)
|
|
655
|
+
this.#focus();
|
|
656
|
+
this.#ref.markForCheck();
|
|
349
657
|
};
|
|
350
658
|
// Public method to expose private methods for template
|
|
351
659
|
onAdd = (event) => this.#add(event);
|
|
352
660
|
onClickChip = (event, item) => this.#clickChip(event, item);
|
|
353
661
|
onRemove = (item) => this.#remove(item);
|
|
354
|
-
onSelect = (event) => this.#select(event);
|
|
355
662
|
onFocus = () => this.#onFocus();
|
|
356
663
|
onBlur = () => this.#onBlur();
|
|
357
664
|
onClick = () => this.#onClick();
|
|
665
|
+
/**
|
|
666
|
+
* 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
|
|
667
|
+
* 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;
|
|
668
|
+
* preventDefault chặn Space cuộn trang (A7).
|
|
669
|
+
*/
|
|
670
|
+
onViewKeydown = (event) => {
|
|
671
|
+
event.preventDefault();
|
|
672
|
+
this.#onClick();
|
|
673
|
+
};
|
|
358
674
|
focus = () => this.#focus();
|
|
359
675
|
onClear = ($event) => this.#clear($event);
|
|
360
676
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
361
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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();\n@let _appearance = appearance();\n@let _required = required();\n@let _isViewed = isViewed();\n@let _hideInlineError = hideInlineError();\n@let _sdViewDef = sdViewDef();\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\n@let _errorMessage = errorMessage();\n@let _size = size();\n@let _removable = removable();\n@let _labelTop = labelPlacement() === 'top';\n\n@if (_isViewed) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"_labelTemplate\"\n [value]=\"formControl.value\"\n [display]=\"formControl.value\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"_valueTemplate\">\n </sd-view>\n} @else {\n @if ((!_appearance || _labelTop) && _labelTemplate) {\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\n }\n @if ((!_appearance || _labelTop) && _label && !_labelTemplate) {\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\n }\n\n <div\n class=\"d-flex align-items-center\"\n [class.sd-view]=\"!!_sdViewDef?.templateRef\"\n [class.c-focused]=\"isFocused\"\n [class.c-disabled]=\"formControl.disabled\"\n (keydown.enter)=\"onClick()\"\n tabindex=\"0\"\n (click)=\"onClick()\">\n @if (_sdViewDef?.templateRef && !isFocused) {\n <ng-container *ngTemplateOutlet=\"_sdViewDef!.templateRef; context: { value: formControl.value }\"></ng-container>\n } @else {\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [class.sd-label-top]=\"_labelTop\"\n [appearance]=\"_appearance\"\n [floatLabel]=\"floatLabel()\">\n @if (_appearance && _label && !_labelTop) {\n <mat-label>{{ _label }}</mat-label>\n }\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"_size === 'md'\" [class.sd-sm]=\"_size === 'sm'\">\n @for (item of formControl.value; track $index) {\n @if (item) {\n <mat-chip-row\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [removable]=\"_removable\"\n (removed)=\"onRemove(item)\"\n [disabled]=\"inputControl.disabled\"\n (click)=\"onClickChip($event, item)\">\n <span>{{ item }}</span>\n @if (!inputControl.disabled && item | sdRemovableChip: _removable) {\n <sd-icon matChipRemove name=\"cancel\"></sd-icon>\n }\n </mat-chip-row>\n }\n }\n <input\n class=\"sd-chip-input\"\n [formControl]=\"inputControl\"\n [id]=\"inputId\"\n [placeholder]=\"placeholder() || (_labelTop ? '' : _label)\"\n [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n (matChipInputTokenEnd)=\"onAdd($event)\"\n autocomplete=\"off\"\n [errorStateMatcher]=\"matcher\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n [required]=\"_required\"\n matInput\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-count]=\"dataCount()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n #input />\n </mat-chip-grid>\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n @if (_hideInlineError && _errorMessage && formControl.touched) {\n <span class=\"sd-visually-hidden\" matSuffix>{{ _errorMessage }}</span>\n\n }\n\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\n <mat-error>{{ _errorMessage }}</mat-error>\n }\n </mat-form-field>\n }\n </div>\n}\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]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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 });
|
|
677
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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();\n@let _appearance = appearance();\n@let _required = required();\n@let _isViewed = isViewed();\n@let _hideInlineError = hideInlineError();\n@let _sdViewDef = sdViewDef();\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\n@let _errorMessage = errorText();\n@let _size = size();\n@let _labelTop = labelPlacement() === 'top';\n@let _icons = iconSizes();\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\n@let _errorVisible = isErrorShown();\n@let _viewTemplate = _sdViewDef?.templateRef;\n\n@if (_isViewed) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"_labelTemplate\"\n [value]=\"formControl.value\"\n [display]=\"formControl.value\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"_valueTemplate\">\n </sd-view>\n} @else {\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\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\n @if (_labelTop && _labelTemplate) {\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\n }\n @if (_labelTop && _label && !_labelTemplate) {\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\n }\n\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\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\" +\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\n <div\n class=\"d-flex align-items-center\"\n [class.sd-view]=\"!!_viewTemplate\"\n [class.c-focused]=\"isFocused()\"\n [class.c-disabled]=\"formControl.disabled\">\n @if (_viewTemplate && !isFocused()) {\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. -->\n <div\n class=\"sd-chip__view-trigger\"\n role=\"button\"\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\n (click)=\"onClick()\"\n (keydown.enter)=\"onViewKeydown($event)\"\n (keydown.space)=\"onViewKeydown($event)\">\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\n </div>\n } @else {\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\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\n <mat-form-field\n class=\"sd-chip-field\"\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.sd-lg]=\"_size === 'lg'\"\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [class.sd-label-top]=\"_labelTop\"\n [appearance]=\"_appearance\"\n [floatLabel]=\"floatLabel()\">\n @if (_label && !_labelTop) {\n <mat-label>{{ _label }}</mat-label>\n }\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\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\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\n `chipGrid`. -->\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\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).\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\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\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\n @for (item of visibleChips(); track item) {\n @let _removable = isRemovable(item);\n @let _text = chipText(item);\n <mat-chip-row\n class=\"sd-chip__chip\"\n [class.sd-chip__chip--locked]=\"!_removable\"\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\n [removable]=\"_removable\"\n [aria-label]=\"chipLabel(item)\"\n (removed)=\"onRemove(item)\"\n (keydown)=\"onChipKeydown($event, item)\"\n [disabled]=\"inputControl.disabled\"\n (click)=\"onClickChip($event, item)\">\n <span\n #chipTextEl\n class=\"sd-chip__chip-text\"\n [attr.data-chip]=\"_text\"\n [matTooltip]=\"_text\"\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\n >{{ item }}</span\n >\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]). -->\n @if (!inputControl.disabled && _removable) {\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\n }\n @if (!inputControl.disabled && !_removable) {\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\n }\n </mat-chip-row>\n }\n @if (hiddenCount() > 0) {\n <button\n type=\"button\"\n class=\"sd-chip__more\"\n [attr.aria-label]=\"moreLabel()\"\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\n (click)=\"onMoreClick($event)\">\n +{{ hiddenCount() }}\n </button>\n }\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),\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\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. -->\n <input\n class=\"sd-chip-input\"\n [formControl]=\"inputControl\"\n [id]=\"inputId\"\n [placeholder]=\"effectivePlaceholder()\"\n [readonly]=\"!addable()\"\n [attr.tabindex]=\"addable() ? null : -1\"\n [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\n [matChipInputAddOnBlur]=\"addOnBlur()\"\n (matChipInputTokenEnd)=\"onAdd($event)\"\n (keydown)=\"onInputKeydown($event)\"\n (input)=\"onInputText()\"\n (paste)=\"onPaste($event)\"\n autocomplete=\"off\"\n [errorStateMatcher]=\"matcher\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n [required]=\"_required\"\n matInput\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-count]=\"dataCount()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\n #input />\n </mat-chip-grid>\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\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\n mat-form-field t\u1EF1 n\u1ED1i. -->\n @if (_hideInlineError && _errorVisible) {\n <span matSuffix class=\"sd-chip__error-suffix\">\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\n </span>\n }\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\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). -->\n @if (clearable() && !formControl.disabled && !_required) {\n @let _canClear = hasRemovable();\n <button\n type=\"button\"\n matSuffix\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\n [class.sd-hover]=\"_canClear\"\n [class.sd-chip__clear--empty]=\"!_canClear\"\n [attr.aria-label]=\"clearLabel()\"\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\n (click)=\"onClear($event)\">\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\n </button>\n }\n\n @if (!_hideInlineError && _errorVisible) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n @if (effectiveMaxCount() > 0) {\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\n {{ chips().length }}/{{ effectiveMaxCount() }}\n </mat-hint>\n }\n </mat-form-field>\n }\n </div>\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\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. -->\n @let _live = liveMessage();\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\n @for (message of _live ? [_live] : []; track message.id) {\n <span>{{ message.text }}</span>\n }\n </span>\n}\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]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[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 });
|
|
362
678
|
}
|
|
363
679
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdChip, decorators: [{
|
|
364
680
|
type: Component,
|
|
@@ -366,6 +682,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
366
682
|
'[class.sd-has-label]': '!!label()',
|
|
367
683
|
'[class.sd-viewed]': 'isViewed()',
|
|
368
684
|
'[class.sd-label-top]': "labelPlacement() === 'top'",
|
|
685
|
+
'(focusin)': 'onFocusIn($event)',
|
|
686
|
+
'(focusout)': 'onFocusOut($event)',
|
|
369
687
|
}, imports: [
|
|
370
688
|
SdIcon,
|
|
371
689
|
CommonModule,
|
|
@@ -374,18 +692,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
374
692
|
MatInputModule,
|
|
375
693
|
MatTooltipModule,
|
|
376
694
|
MatFormFieldModule,
|
|
377
|
-
MatAutocompleteModule,
|
|
378
|
-
MatProgressSpinnerModule,
|
|
379
695
|
MatChipsModule,
|
|
380
696
|
SdLabel,
|
|
381
697
|
SdView,
|
|
382
|
-
SdRemovableChipPipe,
|
|
383
|
-
|
|
384
|
-
}], 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 }] }] } });
|
|
698
|
+
], template: "@let _label = label();\n@let _appearance = appearance();\n@let _required = required();\n@let _isViewed = isViewed();\n@let _hideInlineError = hideInlineError();\n@let _sdViewDef = sdViewDef();\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\n@let _errorMessage = errorText();\n@let _size = size();\n@let _labelTop = labelPlacement() === 'top';\n@let _icons = iconSizes();\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\n@let _errorVisible = isErrorShown();\n@let _viewTemplate = _sdViewDef?.templateRef;\n\n@if (_isViewed) {\n <sd-view\n [label]=\"_label\"\n [labelTemplate]=\"_labelTemplate\"\n [value]=\"formControl.value\"\n [display]=\"formControl.value\"\n [hyperlink]=\"hyperlink()\"\n [valueTemplate]=\"_valueTemplate\">\n </sd-view>\n} @else {\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\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\n @if (_labelTop && _labelTemplate) {\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\n }\n @if (_labelTop && _label && !_labelTemplate) {\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\n }\n\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\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\" +\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\n <div\n class=\"d-flex align-items-center\"\n [class.sd-view]=\"!!_viewTemplate\"\n [class.c-focused]=\"isFocused()\"\n [class.c-disabled]=\"formControl.disabled\">\n @if (_viewTemplate && !isFocused()) {\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. -->\n <div\n class=\"sd-chip__view-trigger\"\n role=\"button\"\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\n (click)=\"onClick()\"\n (keydown.enter)=\"onViewKeydown($event)\"\n (keydown.space)=\"onViewKeydown($event)\">\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\n </div>\n } @else {\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\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\n <mat-form-field\n class=\"sd-chip-field\"\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.sd-lg]=\"_size === 'lg'\"\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [class.sd-label-top]=\"_labelTop\"\n [appearance]=\"_appearance\"\n [floatLabel]=\"floatLabel()\">\n @if (_label && !_labelTop) {\n <mat-label>{{ _label }}</mat-label>\n }\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\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\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\n `chipGrid`. -->\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\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).\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\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\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\n @for (item of visibleChips(); track item) {\n @let _removable = isRemovable(item);\n @let _text = chipText(item);\n <mat-chip-row\n class=\"sd-chip__chip\"\n [class.sd-chip__chip--locked]=\"!_removable\"\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\n [removable]=\"_removable\"\n [aria-label]=\"chipLabel(item)\"\n (removed)=\"onRemove(item)\"\n (keydown)=\"onChipKeydown($event, item)\"\n [disabled]=\"inputControl.disabled\"\n (click)=\"onClickChip($event, item)\">\n <span\n #chipTextEl\n class=\"sd-chip__chip-text\"\n [attr.data-chip]=\"_text\"\n [matTooltip]=\"_text\"\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\n >{{ item }}</span\n >\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]). -->\n @if (!inputControl.disabled && _removable) {\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\n }\n @if (!inputControl.disabled && !_removable) {\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\n }\n </mat-chip-row>\n }\n @if (hiddenCount() > 0) {\n <button\n type=\"button\"\n class=\"sd-chip__more\"\n [attr.aria-label]=\"moreLabel()\"\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\n (click)=\"onMoreClick($event)\">\n +{{ hiddenCount() }}\n </button>\n }\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),\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\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. -->\n <input\n class=\"sd-chip-input\"\n [formControl]=\"inputControl\"\n [id]=\"inputId\"\n [placeholder]=\"effectivePlaceholder()\"\n [readonly]=\"!addable()\"\n [attr.tabindex]=\"addable() ? null : -1\"\n [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\n [matChipInputAddOnBlur]=\"addOnBlur()\"\n (matChipInputTokenEnd)=\"onAdd($event)\"\n (keydown)=\"onInputKeydown($event)\"\n (input)=\"onInputText()\"\n (paste)=\"onPaste($event)\"\n autocomplete=\"off\"\n [errorStateMatcher]=\"matcher\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n [required]=\"_required\"\n matInput\n [attr.data-autoId]=\"autoId()\"\n [attr.data-disabled]=\"dataDisabled()\"\n [attr.data-empty]=\"dataEmpty()\"\n [attr.data-value]=\"dataValue()\"\n [attr.data-count]=\"dataCount()\"\n [attr.data-required]=\"dataRequired()\"\n [attr.data-error-message]=\"dataErrorMessage()\"\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\n #input />\n </mat-chip-grid>\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\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\n mat-form-field t\u1EF1 n\u1ED1i. -->\n @if (_hideInlineError && _errorVisible) {\n <span matSuffix class=\"sd-chip__error-suffix\">\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\n </span>\n }\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\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). -->\n @if (clearable() && !formControl.disabled && !_required) {\n @let _canClear = hasRemovable();\n <button\n type=\"button\"\n matSuffix\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\n [class.sd-hover]=\"_canClear\"\n [class.sd-chip__clear--empty]=\"!_canClear\"\n [attr.aria-label]=\"clearLabel()\"\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\n (click)=\"onClear($event)\">\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\n </button>\n }\n\n @if (!_hideInlineError && _errorVisible) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n }\n @if (effectiveMaxCount() > 0) {\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\n {{ chips().length }}/{{ effectiveMaxCount() }}\n </mat-hint>\n }\n </mat-form-field>\n }\n </div>\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\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. -->\n @let _live = liveMessage();\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\n @for (message of _live ? [_live] : []; track message.id) {\n <span>{{ message.text }}</span>\n }\n </span>\n}\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"] }]
|
|
699
|
+
}], 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 }] }] } });
|
|
385
700
|
|
|
386
701
|
/**
|
|
387
702
|
* Generated bundle index. Do not edit.
|
|
388
703
|
*/
|
|
389
704
|
|
|
390
|
-
export { SdChip
|
|
705
|
+
export { SdChip };
|
|
391
706
|
//# sourceMappingURL=sdcorejs-angular-forms-chip.mjs.map
|