@sdcorejs/angular 21.3.1 → 21.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 +142 -11
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +542 -24
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +31 -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 +1872 -0
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-editor.mjs +457 -756
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +68 -37
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2118 -1159
- 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 +177 -283
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -308
- 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 +260 -43
- 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 +559 -94
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1001 -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 +887 -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 +484 -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 +457 -125
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +414 -122
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +79 -13
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +75 -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 +82 -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 +56 -6
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +54 -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 +87 -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-BR6jxyYd.mjs +478 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-BR6jxyYd.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BsEL-y-M.mjs +214 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BsEL-y-M.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-qTFKh4UG.mjs +277 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-qTFKh4UG.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-Cq0GFfo1.mjs +1556 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-Cq0GFfo1.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 +2055 -37
- 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-p8-V_Ol9.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-p8-V_Ol9.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-DTcpSsbe.mjs +130 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-DTcpSsbe.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-T2ox0oMZ.mjs +131 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-T2ox0oMZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DAjVXHXc.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DAjVXHXc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DkHR_ix2.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DkHR_ix2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DxWuy1ul.mjs +460 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DxWuy1ul.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-Cbs05A2j.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-Cbs05A2j.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-Bkk3_Lf0.mjs +148 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-Bkk3_Lf0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BIuEchUV.mjs +467 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-BIuEchUV.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CH21RSWx.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CH21RSWx.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CX4WWzER.mjs +90 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CX4WWzER.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-D1kpfcf_.mjs +514 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-D1kpfcf_.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DYyFPZUU.mjs +61 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DYyFPZUU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-B9vCzIT6.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-B9vCzIT6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BnROr-Wg.mjs +87 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BnROr-Wg.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-qs8Yoxn0.mjs +170 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-qs8Yoxn0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-Cbwdhc0Z.mjs +70 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-Cbwdhc0Z.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DYphTR6C.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-DYphTR6C.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-C692P-z0.mjs +522 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-C692P-z0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-5sLtmhG1.mjs +71 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-5sLtmhG1.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BIFg9bUW.mjs +629 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BIFg9bUW.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CZ1NoLIo.mjs +115 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CZ1NoLIo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CmZeYoF7.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CmZeYoF7.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Dy2Rkh8f.mjs +164 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Dy2Rkh8f.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-BdxQkZXW.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-BdxQkZXW.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-BpSTfkeT.mjs +48 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-BpSTfkeT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-D3QP1i9v.mjs +293 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-D3QP1i9v.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BA64XAgv.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BA64XAgv.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CWTlhZzo.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CWTlhZzo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ClRXOw9g.mjs +165 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ClRXOw9g.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DYT6cDVo.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DYT6cDVo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Dww3V1b9.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Dww3V1b9.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-HwJm344-.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-HwJm344-.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ZkBSRFv_.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-ZkBSRFv_.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-px1VU73r.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-px1VU73r.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BSDQaT9e.mjs +406 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BSDQaT9e.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-2EN7PuIE.mjs +317 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-2EN7PuIE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Crg1J2V5.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Crg1J2V5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-LIBiOZLn.mjs +143 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-LIBiOZLn.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-4Mm8-ehz.mjs +128 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-4Mm8-ehz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-ClEGOr5D.mjs +357 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-ClEGOr5D.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CoGA7wxY.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CoGA7wxY.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',
|
|
@@ -112,9 +108,31 @@ class SdChip {
|
|
|
112
108
|
removable = input(true, { ...(ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {}), transform: (v) => v ?? true });
|
|
113
109
|
hideInlineError = input(false, { ...(ngDevMode ? { debugName: "hideInlineError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
114
110
|
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
111
|
+
/** Fewest chips; > 0 adds `Validators.minLength`. Replaces `min`. */
|
|
112
|
+
minCount = input(undefined, { ...(ngDevMode ? { debugName: "minCount" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
113
|
+
/** Most chips; > 0 adds `Validators.maxLength` (for a model set from outside) and stops adding once reached. Replaces `max`. */
|
|
114
|
+
maxCount = input(undefined, { ...(ngDevMode ? { debugName: "maxCount" } : /* istanbul ignore next */ {}), transform: (v) => v ?? undefined });
|
|
115
|
+
/** @deprecated Use `minCount`; `minCount` wins when both are set. */
|
|
115
116
|
min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: (v) => v ?? 0 });
|
|
117
|
+
/** @deprecated Use `maxCount`; `maxCount` wins when both are set. */
|
|
116
118
|
max = input(0, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: (v) => v ?? 0 });
|
|
119
|
+
/** `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. */
|
|
117
120
|
addable = input(true, { ...(ngDevMode ? { debugName: "addable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
121
|
+
/** Leaving the field turns the typed text into a chip. `false` drops the text instead, as before. */
|
|
122
|
+
addOnBlur = input(true, { ...(ngDevMode ? { debugName: "addOnBlur" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
123
|
+
/** Keys that commit the typed text (`KeyboardEvent.key`). A paste also splits on these characters, new lines and tabs. */
|
|
124
|
+
separators = input(DEFAULT_SEPARATORS, { ...(ngDevMode ? { debugName: "separators" } : /* istanbul ignore next */ {}), transform: (v) => v ?? DEFAULT_SEPARATORS });
|
|
125
|
+
/** Normalises typed or pasted text before it is compared and stored; `null` or `''` drops it. Default: trim. */
|
|
126
|
+
chipTransform = input(trimChip, { ...(ngDevMode ? { debugName: "chipTransform" } : /* istanbul ignore next */ {}), transform: (v) => v ?? trimChip });
|
|
127
|
+
/**
|
|
128
|
+
* Checks a normalised value: an i18n key (or the message itself) when it is refused, else `null`. A refused value does
|
|
129
|
+
* not become a chip; its text stays in the input and the message shows under the field.
|
|
130
|
+
*/
|
|
131
|
+
chipValidator = input(null, ...(ngDevMode ? [{ debugName: "chipValidator" }] : /* istanbul ignore next */ []));
|
|
132
|
+
/** Shows a button that removes every chip `removable` allows. Off by default, like `clearable` of `<sd-date>`. */
|
|
133
|
+
clearable = input(false, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
134
|
+
/** Chips shown while the field is not focused; the rest fold into “+N”. `null` shows them all. `2` suits `<sd-table>` cells. */
|
|
135
|
+
maxVisible = input(null, ...(ngDevMode ? [{ debugName: "maxVisible" }] : /* istanbul ignore next */ []));
|
|
118
136
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
119
137
|
/** Display mode: `false` edit · `true` static view · `'inline'` interactive (disabled `'inline'` → static). */
|
|
120
138
|
viewed = input(false, { ...(ngDevMode ? { debugName: "viewed" } : /* istanbul ignore next */ {}), transform: sdViewedTransform });
|
|
@@ -129,23 +147,37 @@ class SdChip {
|
|
|
129
147
|
sdChange = output();
|
|
130
148
|
// Template properties
|
|
131
149
|
input = viewChild('input', ...(ngDevMode ? [{ debugName: "input" }] : /* istanbul ignore next */ []));
|
|
150
|
+
chipGrid = viewChild(MatChipGrid, ...(ngDevMode ? [{ debugName: "chipGrid" }] : /* istanbul ignore next */ []));
|
|
151
|
+
// why: query signal không đặt được trên field ES private (#).
|
|
152
|
+
chipTextElements = viewChildren('chipTextEl', ...(ngDevMode ? [{ debugName: "chipTextElements" }] : /* istanbul ignore next */ []));
|
|
132
153
|
sdViewDef = contentChild(SdViewDefDirective, ...(ngDevMode ? [{ debugName: "sdViewDef" }] : /* istanbul ignore next */ []));
|
|
133
154
|
sdLabelDef = contentChild(SdLabelDefDirective, ...(ngDevMode ? [{ debugName: "sdLabelDef" }] : /* istanbul ignore next */ []));
|
|
134
155
|
sdLabelTemplate = contentChild('sdLabel', ...(ngDevMode ? [{ debugName: "sdLabelTemplate" }] : /* istanbul ignore next */ []));
|
|
135
156
|
sdValueTemplate = contentChild('sdValue', ...(ngDevMode ? [{ debugName: "sdValueTemplate" }] : /* istanbul ignore next */ []));
|
|
136
157
|
// Local states
|
|
137
158
|
#isBlurring = false;
|
|
138
|
-
|
|
159
|
+
/** The field is being edited: the `sdViewDef` face gives way to the field. A signal, so OnPush redraws without `detectChanges()` (D1). */
|
|
160
|
+
isFocused = signal(false, ...(ngDevMode ? [{ debugName: "isFocused" }] : /* istanbul ignore next */ []));
|
|
139
161
|
#inputControl = new FormControl();
|
|
140
162
|
#formControl = new SdFormControl();
|
|
163
|
+
/**
|
|
164
|
+
* Control of `mat-chip-grid` only. why: the grid is a ControlValueAccessor that writes the text of the rendered chips
|
|
165
|
+
* into its control on blur, after a timeout (numbers became strings, a form reset was undone). It still needs an
|
|
166
|
+
* ngControl to work out its error state on every check, so it gets this one; nothing reads its value.
|
|
167
|
+
*/
|
|
168
|
+
gridControl = new FormControl(null);
|
|
141
169
|
// why: `min`/`max` chỉ là validator do CHÍNH component sở hữu; `required` đi qua option riêng
|
|
142
170
|
// của connector. Connector add/remove đúng phần này (addValidators/removeValidators) nên
|
|
143
171
|
// validator do consumer tự gắn vào `formControl` public KHÔNG bị xoá — trước đây
|
|
144
172
|
// `clearValidators()` + `setValidators()` thổi bay tất cả mỗi lần input đổi.
|
|
173
|
+
/** `minCount`, else the deprecated `min`. */
|
|
174
|
+
effectiveMinCount = computed(() => this.minCount() ?? this.min() ?? 0, ...(ngDevMode ? [{ debugName: "effectiveMinCount" }] : /* istanbul ignore next */ []));
|
|
175
|
+
/** `maxCount`, else the deprecated `max`. */
|
|
176
|
+
effectiveMaxCount = computed(() => this.maxCount() ?? this.max() ?? 0, ...(ngDevMode ? [{ debugName: "effectiveMaxCount" }] : /* istanbul ignore next */ []));
|
|
145
177
|
#validators = computed(() => {
|
|
146
178
|
const validators = [];
|
|
147
|
-
const min = this.
|
|
148
|
-
const max = this.
|
|
179
|
+
const min = this.effectiveMinCount();
|
|
180
|
+
const max = this.effectiveMaxCount();
|
|
149
181
|
if (min > 0)
|
|
150
182
|
validators.push(Validators.minLength(min));
|
|
151
183
|
if (max > 0)
|
|
@@ -160,15 +192,72 @@ class SdChip {
|
|
|
160
192
|
required: this.required,
|
|
161
193
|
});
|
|
162
194
|
#matcher;
|
|
163
|
-
|
|
164
|
-
|
|
195
|
+
/** why: phím tách do `separators` + onInputKeydown xử lý, nên Material không nhận phím nào. */
|
|
196
|
+
noSeparatorKeys = [];
|
|
197
|
+
/**
|
|
198
|
+
* Items rendered as chips: every value except `null`, `undefined` and `''`, so `0` shows (A2). Display only: the
|
|
199
|
+
* model is never rewritten. why: exact duplicates are dropped too, because the chips are tracked by value.
|
|
200
|
+
*/
|
|
201
|
+
chips = computed(() => {
|
|
202
|
+
const value = this.#state().value;
|
|
203
|
+
return Array.isArray(value) ? [...new Set(value.filter(isChipItem))] : [];
|
|
204
|
+
}, ...(ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []));
|
|
205
|
+
/** Focus is in the input or on a chip; “+N” only folds chips while it is not (B7). */
|
|
206
|
+
#focusWithin = signal(false, ...(ngDevMode ? [{ debugName: "#focusWithin" }] : /* istanbul ignore next */ []));
|
|
207
|
+
/** Message of a typed or pasted value that `chipValidator` refused; it shows under the field until the text changes (B4). */
|
|
208
|
+
inputError = signal(null, ...(ngDevMode ? [{ debugName: "inputError" }] : /* istanbul ignore next */ []));
|
|
209
|
+
/** Last polite announcement; a new id re-renders the text so a repeated message is read again. */
|
|
210
|
+
liveMessage = signal(null, ...(ngDevMode ? [{ debugName: "liveMessage" }] : /* istanbul ignore next */ []));
|
|
211
|
+
#liveId = 0;
|
|
212
|
+
/** Chip that the typed value duplicates, highlighted for 1.4s (B3). */
|
|
213
|
+
duplicateChip = signal(null, ...(ngDevMode ? [{ debugName: "duplicateChip" }] : /* istanbul ignore next */ []));
|
|
214
|
+
/** Text of the chips that the 240px limit cuts; only they get a tooltip (B7). */
|
|
215
|
+
truncatedChips = signal(new Set(), ...(ngDevMode ? [{ debugName: "truncatedChips" }] : /* istanbul ignore next */ []));
|
|
216
|
+
#warnedDeprecated = false;
|
|
217
|
+
/** `maxCount` reached: typing and pasting add nothing more (B3). */
|
|
218
|
+
full = computed(() => {
|
|
219
|
+
const max = this.effectiveMaxCount();
|
|
220
|
+
return max > 0 && this.chips().length >= max;
|
|
221
|
+
}, ...(ngDevMode ? [{ debugName: "full" }] : /* istanbul ignore next */ []));
|
|
222
|
+
/** Chips on screen: all while the field has focus, else at most `maxVisible` (B7). */
|
|
223
|
+
visibleChips = computed(() => {
|
|
224
|
+
const chips = this.chips();
|
|
225
|
+
const max = this.maxVisible();
|
|
226
|
+
if (this.#focusWithin() || max === null || max === undefined || max < 0 || chips.length <= max)
|
|
227
|
+
return chips;
|
|
228
|
+
return chips.slice(0, max);
|
|
229
|
+
}, ...(ngDevMode ? [{ debugName: "visibleChips" }] : /* istanbul ignore next */ []));
|
|
230
|
+
/** Chips folded into “+N”. */
|
|
231
|
+
hiddenCount = computed(() => this.chips().length - this.visibleChips().length, ...(ngDevMode ? [{ debugName: "hiddenCount" }] : /* istanbul ignore next */ []));
|
|
232
|
+
/** At least one chip may be removed, so the clear button has something to do (B6). */
|
|
233
|
+
hasRemovable = computed(() => {
|
|
234
|
+
void this.removable();
|
|
235
|
+
return this.chips().some(chip => this.isRemovable(chip));
|
|
236
|
+
}, ...(ngDevMode ? [{ debugName: "hasRemovable" }] : /* istanbul ignore next */ []));
|
|
237
|
+
/**
|
|
238
|
+
* Placeholder: “Đã đủ …” once full, else the input, else “Nhập rồi nhấn Enter” — never the label (B5). None when not
|
|
239
|
+
* addable, or while chips are folded into “+N”: nobody types then, and the input only fills the rest of the line (C1).
|
|
240
|
+
*/
|
|
241
|
+
effectivePlaceholder = computed(() => {
|
|
242
|
+
if (!this.addable() || this.hiddenCount() > 0)
|
|
243
|
+
return null;
|
|
244
|
+
if (this.full())
|
|
245
|
+
return this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() });
|
|
246
|
+
return this.placeholder() || this.#i18n.t('core.form.chip.placeholder');
|
|
247
|
+
}, ...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []));
|
|
248
|
+
clearLabel = computed(() => this.#i18n.t('core.form.chip.clear'), ...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
|
|
249
|
+
/** Tooltip of the lock on a chip that `removable` keeps (C3). */
|
|
250
|
+
lockedLabel = computed(() => this.#i18n.t('core.form.chip.locked'), ...(ngDevMode ? [{ debugName: "lockedLabel" }] : /* istanbul ignore next */ []));
|
|
251
|
+
/** Sizes of the chip ✕ / lock and of the clear-button icon for the current `size` (C1). */
|
|
252
|
+
iconSizes = computed(() => CHIP_ICONS[this.size() === 'sm' || this.size() === 'lg' ? this.size() : 'md'], ...(ngDevMode ? [{ debugName: "iconSizes" }] : /* istanbul ignore next */ []));
|
|
253
|
+
moreLabel = computed(() => this.#i18n.t('core.form.chip.more', { count: this.hiddenCount() }), ...(ngDevMode ? [{ debugName: "moreLabel" }] : /* istanbul ignore next */ []));
|
|
165
254
|
constructor() {
|
|
166
255
|
// Update model
|
|
167
256
|
effect(() => {
|
|
168
257
|
const values = this.model();
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
258
|
+
// why: `null` / `undefined` từ cha phải xoá chip và đưa control về `[]`; trước đây control giữ mảng cũ và
|
|
259
|
+
// vẫn gửi nó đi khi submit (A4).
|
|
260
|
+
this.#formControl.setValue(Array.isArray(values) ? values : []);
|
|
172
261
|
});
|
|
173
262
|
// Handle disabled state
|
|
174
263
|
effect(() => {
|
|
@@ -176,19 +265,43 @@ class SdChip {
|
|
|
176
265
|
if (isDisabled) {
|
|
177
266
|
this.#formControl.disable();
|
|
178
267
|
this.#inputControl.disable();
|
|
268
|
+
this.gridControl.disable();
|
|
179
269
|
}
|
|
180
270
|
else {
|
|
181
271
|
this.#formControl.enable();
|
|
182
272
|
this.#inputControl.enable();
|
|
273
|
+
this.gridControl.enable();
|
|
183
274
|
}
|
|
184
275
|
});
|
|
276
|
+
// why: `[required]` trên mat-chip-grid khớp selector `[required][formControl]` của RequiredValidator, nên
|
|
277
|
+
// `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
|
|
278
|
+
// tính của grid: mat-form-field vẫn hiện dấu * và ô nhập vẫn có aria-required.
|
|
185
279
|
effect(() => {
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
|
|
280
|
+
const grid = this.chipGrid();
|
|
281
|
+
if (grid)
|
|
282
|
+
grid.required = this.required();
|
|
283
|
+
});
|
|
284
|
+
effect(() => {
|
|
285
|
+
if ((this.min() > 0 || this.max() > 0) && !this.#warnedDeprecated && isDevMode()) {
|
|
286
|
+
this.#warnedDeprecated = true;
|
|
287
|
+
console.warn('[sd-chip] `min` / `max` are deprecated; use `minCount` / `maxCount`.');
|
|
189
288
|
}
|
|
190
289
|
});
|
|
191
|
-
|
|
290
|
+
// 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ẽ.
|
|
291
|
+
afterRenderEffect(() => {
|
|
292
|
+
const cut = new Set();
|
|
293
|
+
for (const { nativeElement } of this.chipTextElements()) {
|
|
294
|
+
if (nativeElement.scrollWidth > nativeElement.clientWidth)
|
|
295
|
+
cut.add(nativeElement.dataset['chip'] ?? '');
|
|
296
|
+
}
|
|
297
|
+
const current = untracked(this.truncatedChips);
|
|
298
|
+
if (cut.size !== current.size || [...cut].some(text => !current.has(text)))
|
|
299
|
+
this.truncatedChips.set(cut);
|
|
300
|
+
});
|
|
301
|
+
// why: `submitted` của form cha không phải signal; submit phải vẽ lại lỗi dưới OnPush.
|
|
302
|
+
this.#parentForm?.ngSubmit.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
303
|
+
this.#formControl.sdChanges.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => this.#ref.markForCheck());
|
|
304
|
+
this.#matcher = { isErrorState: (_control, form) => !!this.inputError() || this.#errorGate(form) };
|
|
192
305
|
}
|
|
193
306
|
get formControl() {
|
|
194
307
|
return this.#formControl;
|
|
@@ -205,8 +318,8 @@ class SdChip {
|
|
|
205
318
|
errorMessage = computed(() => {
|
|
206
319
|
void this.#state();
|
|
207
320
|
void this.required();
|
|
208
|
-
const min = this.
|
|
209
|
-
const max = this.
|
|
321
|
+
const min = this.effectiveMinCount();
|
|
322
|
+
const max = this.effectiveMaxCount();
|
|
210
323
|
const errors = this.#formControl.errors;
|
|
211
324
|
if (!errors)
|
|
212
325
|
return undefined;
|
|
@@ -221,32 +334,219 @@ class SdChip {
|
|
|
221
334
|
get matcher() {
|
|
222
335
|
return this.#matcher;
|
|
223
336
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
337
|
+
/**
|
|
338
|
+
* The one place that decides whether the error shows (A5): the `ErrorStateMatcher` of the chip grid and the input,
|
|
339
|
+
* `<mat-error>`, the `hideInlineError` icon and `aria-invalid` all read it. Invalid and touched, or the parent form
|
|
340
|
+
* was submitted; a field that is only dirty shows nothing.
|
|
341
|
+
*/
|
|
342
|
+
isErrorShown() {
|
|
343
|
+
return !!this.inputError() || (!!this.errorMessage() && this.#errorGate());
|
|
228
344
|
}
|
|
229
|
-
|
|
230
|
-
|
|
345
|
+
/** Text under the field: the `chipValidator` message of the typed value first, else the form error. */
|
|
346
|
+
errorText = computed(() => this.inputError() ?? this.errorMessage(), ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
347
|
+
#errorGate(form) {
|
|
348
|
+
const control = this.#formControl;
|
|
349
|
+
return control.invalid && (control.touched || !!(form ?? this.#parentForm)?.submitted);
|
|
231
350
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
351
|
+
/** Whether `item` may be removed, per `removable`; applied on every removal path (A1). */
|
|
352
|
+
isRemovable(item) {
|
|
353
|
+
const removable = this.removable();
|
|
354
|
+
return typeof removable === 'function' ? !!removable(item) : removable;
|
|
355
|
+
}
|
|
356
|
+
/** Accessible name of the ✕ button of a chip (A6). */
|
|
357
|
+
removeLabel(item) {
|
|
358
|
+
return this.#i18n.t('core.form.chip.remove', { value: String(item) });
|
|
359
|
+
}
|
|
360
|
+
/** Accessible name of a chip that `removable` keeps: its text plus “, Không xoá được” (C3). A removable chip keeps its text. */
|
|
361
|
+
chipLabel(item) {
|
|
362
|
+
return this.isRemovable(item) ? null : `${String(item)}, ${this.lockedLabel()}`;
|
|
363
|
+
}
|
|
364
|
+
/** Text of a chip, also its key for `truncatedChips`. */
|
|
365
|
+
chipText(item) {
|
|
366
|
+
return String(item);
|
|
367
|
+
}
|
|
368
|
+
/** A separator key (`separators`) commits the typed text; the key itself is not typed (B2 / separators). */
|
|
369
|
+
onInputKeydown(event) {
|
|
370
|
+
if (event.isComposing || !this.separators().includes(event.key))
|
|
371
|
+
return;
|
|
372
|
+
event.preventDefault();
|
|
373
|
+
this.#commitText(this.input()?.nativeElement.value ?? '');
|
|
374
|
+
}
|
|
375
|
+
/** The refused-value message goes as soon as the text changes (B4). */
|
|
376
|
+
onInputText() {
|
|
377
|
+
if (this.inputError())
|
|
378
|
+
this.inputError.set(null);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* A paste that holds a separator, a new line or a tab becomes several chips in one change (B2). Duplicates are
|
|
382
|
+
* skipped, refused values and values past `maxCount` stay in the input, and the result is announced. A paste with
|
|
383
|
+
* no separator is left to the browser.
|
|
384
|
+
*/
|
|
385
|
+
onPaste(event) {
|
|
386
|
+
if (!this.addable())
|
|
387
|
+
return;
|
|
388
|
+
const text = event.clipboardData?.getData('text') ?? '';
|
|
389
|
+
const chars = new Set(['\n', '\r', '\t']);
|
|
390
|
+
for (const key of this.separators()) {
|
|
391
|
+
const char = separatorChar(key);
|
|
392
|
+
if (char)
|
|
393
|
+
chars.add(char);
|
|
244
394
|
}
|
|
395
|
+
const parts = text.split(new RegExp(`[${[...chars].map(char => char.replace(/[\\\]^-]/g, '\\$&')).join('')}]`));
|
|
396
|
+
if (parts.length < 2)
|
|
397
|
+
return;
|
|
398
|
+
event.preventDefault();
|
|
399
|
+
const next = [...this.#currentValues()];
|
|
400
|
+
const max = this.effectiveMaxCount();
|
|
401
|
+
const kept = [];
|
|
402
|
+
let added = 0;
|
|
403
|
+
let skipped = 0;
|
|
404
|
+
let overflow = false;
|
|
405
|
+
let error = null;
|
|
406
|
+
for (const raw of parts) {
|
|
407
|
+
const value = this.#normalise(raw);
|
|
408
|
+
if (value === null)
|
|
409
|
+
continue;
|
|
410
|
+
if (next.some(item => String(item) === String(value))) {
|
|
411
|
+
skipped++;
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const refused = this.#refusal(value);
|
|
415
|
+
if (refused || (max > 0 && next.length >= max)) {
|
|
416
|
+
if (refused)
|
|
417
|
+
error ??= refused;
|
|
418
|
+
else
|
|
419
|
+
overflow = true;
|
|
420
|
+
kept.push(raw.trim());
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
next.push(value);
|
|
424
|
+
added++;
|
|
425
|
+
}
|
|
426
|
+
if (added)
|
|
427
|
+
this.#commit(next);
|
|
428
|
+
this.#setInputText(kept.join(', '));
|
|
429
|
+
this.inputError.set(error);
|
|
430
|
+
const notes = [this.#i18n.t('core.form.chip.added', { count: added })];
|
|
431
|
+
if (skipped)
|
|
432
|
+
notes.push(this.#i18n.t('core.form.chip.skipped', { count: skipped }));
|
|
433
|
+
if (overflow)
|
|
434
|
+
notes.push(this.#i18n.t('core.form.chip.full', { max }));
|
|
435
|
+
this.#announce(notes.join(' · '));
|
|
436
|
+
}
|
|
437
|
+
/** Backspace / Delete on a chip that `removable` keeps says why nothing happened (A1, B3). */
|
|
438
|
+
onChipKeydown(event, item) {
|
|
439
|
+
if ((event.key === 'Backspace' || event.key === 'Delete') && !this.isRemovable(item)) {
|
|
440
|
+
this.#announce(this.#i18n.t('core.form.chip.locked'));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/** “+N” moves focus to the input, where every chip shows (B7). */
|
|
444
|
+
onMoreClick(event) {
|
|
445
|
+
event.stopPropagation();
|
|
446
|
+
this.#focus();
|
|
447
|
+
}
|
|
448
|
+
/** Focus entering the input or a chip unfolds “+N”; focus on the “+N” button itself does not (B7). */
|
|
449
|
+
onFocusIn(event) {
|
|
450
|
+
const target = event.target;
|
|
451
|
+
if (target?.classList.contains('sd-chip__more'))
|
|
452
|
+
return;
|
|
453
|
+
this.#focusWithin.set(true);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Marks the field touched once focus leaves it; moving between the input and the chips does not count.
|
|
457
|
+
* why: `mat-chip-grid` is no longer bound to the control. As a ControlValueAccessor it wrote the text of the rendered
|
|
458
|
+
* chips back into the control on blur (numbers became strings, a form reset was undone), so the component marks
|
|
459
|
+
* touched itself, like the grid did.
|
|
460
|
+
*/
|
|
461
|
+
onFocusOut(event) {
|
|
462
|
+
const next = event.relatedTarget;
|
|
463
|
+
if (next && this.#host.contains(next))
|
|
464
|
+
return;
|
|
465
|
+
this.#focusWithin.set(false);
|
|
466
|
+
this.#formConnector.markAsTouched();
|
|
467
|
+
this.#ref.markForCheck();
|
|
468
|
+
}
|
|
469
|
+
#add = (event) => this.#commitText(event.value ?? '');
|
|
470
|
+
/**
|
|
471
|
+
* Typed text → chip (a separator key, blur, or `onAdd`): normalise, then a duplicate flashes the chip it repeats, a full
|
|
472
|
+
* field says so, a refused value stays in the input with its message, and anything else is added in one change.
|
|
473
|
+
*/
|
|
474
|
+
#commitText(raw) {
|
|
475
|
+
if (!this.addable())
|
|
476
|
+
return;
|
|
477
|
+
const value = this.#normalise(String(raw));
|
|
478
|
+
if (value === null) {
|
|
479
|
+
this.#setInputText('');
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const values = this.#currentValues();
|
|
483
|
+
// why: so trùng theo chuỗi — model `[1]` và chữ "1" vừa gõ là một chip (A3).
|
|
484
|
+
const existing = values.find(item => String(item) === String(value));
|
|
485
|
+
if (existing !== undefined) {
|
|
486
|
+
this.#flashDuplicate(existing);
|
|
487
|
+
this.#announce(this.#i18n.t('core.form.chip.duplicate', { value: String(value) }));
|
|
488
|
+
this.#setInputText('');
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (this.full()) {
|
|
492
|
+
this.#announce(this.#i18n.t('core.form.chip.full', { max: this.effectiveMaxCount() }));
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
const refused = this.#refusal(value);
|
|
496
|
+
if (refused) {
|
|
497
|
+
this.inputError.set(refused);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
// 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
|
|
501
|
+
// 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
|
|
502
|
+
// `modelChange`, làm `[(model)]` lệch âm thầm.
|
|
503
|
+
this.#commit([...values, value]);
|
|
504
|
+
this.#setInputText('');
|
|
505
|
+
}
|
|
506
|
+
/** `chipTransform` of the text; `null`, `undefined` or `''` means nothing to add. */
|
|
507
|
+
#normalise(raw) {
|
|
508
|
+
const value = this.chipTransform()(raw);
|
|
509
|
+
return value === null || value === undefined || value === '' ? null : value;
|
|
510
|
+
}
|
|
511
|
+
/** Message of `chipValidator` for `value`, translated when it is a key, else `null`. */
|
|
512
|
+
#refusal(value) {
|
|
513
|
+
const result = this.chipValidator()?.(value) ?? null;
|
|
514
|
+
if (!result)
|
|
515
|
+
return null;
|
|
516
|
+
// 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.
|
|
517
|
+
return result in this.#i18n.messages() ? this.#i18n.t(result) : result;
|
|
518
|
+
}
|
|
519
|
+
#currentValues() {
|
|
520
|
+
const value = this.#formControl.value;
|
|
521
|
+
return Array.isArray(value) ? value : [];
|
|
522
|
+
}
|
|
523
|
+
/** Every user change ends here: one new array, written once to the control, the model and `sdChange`. */
|
|
524
|
+
#commit(next) {
|
|
525
|
+
this.inputError.set(null);
|
|
526
|
+
// 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;
|
|
527
|
+
// ô gõ là inputControl nên control của chip không tự dirty.
|
|
528
|
+
this.#formControl.markAsDirty();
|
|
529
|
+
this.#formControl.setValue(next);
|
|
530
|
+
this.model.set(next);
|
|
531
|
+
this.sdChange.emit(next);
|
|
532
|
+
this.#ref.markForCheck();
|
|
533
|
+
}
|
|
534
|
+
#setInputText(text) {
|
|
245
535
|
const inputEl = this.input();
|
|
246
536
|
if (inputEl)
|
|
247
|
-
inputEl.nativeElement.value =
|
|
248
|
-
this.#inputControl.setValue(
|
|
249
|
-
}
|
|
537
|
+
inputEl.nativeElement.value = text;
|
|
538
|
+
this.#inputControl.setValue(text);
|
|
539
|
+
}
|
|
540
|
+
#announce(text) {
|
|
541
|
+
this.liveMessage.set({ id: ++this.#liveId, text });
|
|
542
|
+
}
|
|
543
|
+
#flashDuplicate(item) {
|
|
544
|
+
this.duplicateChip.set(item);
|
|
545
|
+
this.#timers.schedule(() => {
|
|
546
|
+
if (this.duplicateChip() === item)
|
|
547
|
+
this.duplicateChip.set(null);
|
|
548
|
+
}, DUPLICATE_FLASH_MS);
|
|
549
|
+
}
|
|
250
550
|
#clickChip = ($event, item) => {
|
|
251
551
|
$event.stopPropagation();
|
|
252
552
|
$event.stopImmediatePropagation();
|
|
@@ -256,9 +556,11 @@ class SdChip {
|
|
|
256
556
|
};
|
|
257
557
|
#remove = (item) => {
|
|
258
558
|
const values = this.#formControl.value ?? [];
|
|
259
|
-
|
|
559
|
+
// why: `removable` áp cho mọi đường xoá, kể cả Backspace / Delete trên chip mà Material vẫn phát `(removed)` (A1).
|
|
560
|
+
if ((typeof item === 'string' || typeof item === 'number') && this.isRemovable(item)) {
|
|
260
561
|
// why: `filter` đã trả mảng mới nên reference đổi → `model.set` phát `modelChange`.
|
|
261
562
|
const next = values.filter(value => item !== value);
|
|
563
|
+
this.#formControl.markAsDirty();
|
|
262
564
|
this.#formControl.setValue(next);
|
|
263
565
|
this.model.set(next);
|
|
264
566
|
this.sdChange.emit(next);
|
|
@@ -266,83 +568,74 @@ class SdChip {
|
|
|
266
568
|
this.#inputControl.setValue('');
|
|
267
569
|
this.#focus();
|
|
268
570
|
};
|
|
269
|
-
|
|
270
|
-
const item = event.option.value;
|
|
271
|
-
const values = this.#formControl.value ?? [];
|
|
272
|
-
if (item) {
|
|
273
|
-
if (typeof item === 'string' || typeof item === 'number') {
|
|
274
|
-
if (!values.includes(item)) {
|
|
275
|
-
// why: giống #add — mảng mới, không `push` lên mảng của consumer.
|
|
276
|
-
const next = [...values, item];
|
|
277
|
-
this.#formControl.setValue(next);
|
|
278
|
-
this.model.set(next);
|
|
279
|
-
this.sdChange.emit(next);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
const inputEl = this.input();
|
|
283
|
-
if (inputEl)
|
|
284
|
-
inputEl.nativeElement.value = '';
|
|
285
|
-
this.#inputControl.setValue('', {
|
|
286
|
-
emitEvent: false,
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
};
|
|
571
|
+
// why: focus không còn xoá chữ đang gõ (B1).
|
|
290
572
|
#onFocus = () => {
|
|
291
|
-
this.isFocused
|
|
573
|
+
this.isFocused.set(true);
|
|
292
574
|
this.#isBlurring = false;
|
|
293
|
-
this.#inputControl.setValue('');
|
|
294
575
|
};
|
|
295
576
|
#onBlur = () => {
|
|
296
577
|
this.#isBlurring = true;
|
|
297
|
-
// why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle
|
|
298
|
-
//
|
|
578
|
+
// why: vẫn 150ms như cũ (cửa sổ để click vào chip/option huỷ blur) — chỉ scope handle theo DestroyRef. Chữ đang gõ
|
|
579
|
+
// thành chip qua `matChipInputAddOnBlur`; chỉ khi `[addOnBlur]="false"` mới bỏ chữ như trước (B1).
|
|
299
580
|
this.#timers.schedule(() => {
|
|
300
581
|
if (this.#isBlurring) {
|
|
301
|
-
this.isFocused
|
|
302
|
-
this
|
|
303
|
-
|
|
304
|
-
});
|
|
305
|
-
this.#ref.detectChanges();
|
|
582
|
+
this.isFocused.set(false);
|
|
583
|
+
if (!this.addOnBlur())
|
|
584
|
+
this.#setInputText('');
|
|
306
585
|
}
|
|
307
586
|
}, 150);
|
|
308
587
|
};
|
|
309
588
|
#onClick = () => {
|
|
310
589
|
if (this.sdViewDef()?.templateRef) {
|
|
311
|
-
if (!this.#formControl.disabled && !this.isFocused) {
|
|
590
|
+
if (!this.#formControl.disabled && !this.isFocused()) {
|
|
312
591
|
this.#focus();
|
|
313
592
|
}
|
|
314
593
|
}
|
|
315
594
|
};
|
|
316
595
|
#focus = () => {
|
|
317
|
-
this.isFocused
|
|
596
|
+
this.isFocused.set(true);
|
|
318
597
|
this.#isBlurring = false;
|
|
319
598
|
// why: vẫn 100ms như cũ — chỉ scope handle theo DestroyRef.
|
|
320
599
|
this.#timers.schedule(() => {
|
|
321
|
-
if (this.isFocused) {
|
|
600
|
+
if (this.isFocused()) {
|
|
322
601
|
this.input()?.nativeElement?.focus();
|
|
323
602
|
}
|
|
324
603
|
}, 100);
|
|
325
604
|
};
|
|
605
|
+
/** Removes every chip `removable` allows; locked chips stay. One change, none when nothing goes (B6). */
|
|
326
606
|
#clear = ($event) => {
|
|
327
607
|
$event?.stopPropagation();
|
|
328
|
-
this.#
|
|
329
|
-
this
|
|
330
|
-
this
|
|
331
|
-
|
|
332
|
-
|
|
608
|
+
this.#setInputText('');
|
|
609
|
+
this.inputError.set(null);
|
|
610
|
+
const values = this.#currentValues();
|
|
611
|
+
const kept = values.filter(value => !this.isRemovable(value));
|
|
612
|
+
if (kept.length !== values.length)
|
|
613
|
+
this.#commit(kept);
|
|
614
|
+
// 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.
|
|
615
|
+
if ($event)
|
|
616
|
+
this.#focus();
|
|
617
|
+
this.#ref.markForCheck();
|
|
333
618
|
};
|
|
334
619
|
// Public method to expose private methods for template
|
|
335
620
|
onAdd = (event) => this.#add(event);
|
|
336
621
|
onClickChip = (event, item) => this.#clickChip(event, item);
|
|
337
622
|
onRemove = (item) => this.#remove(item);
|
|
338
|
-
onSelect = (event) => this.#select(event);
|
|
339
623
|
onFocus = () => this.#onFocus();
|
|
340
624
|
onBlur = () => this.#onBlur();
|
|
341
625
|
onClick = () => this.#onClick();
|
|
626
|
+
/**
|
|
627
|
+
* 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
|
|
628
|
+
* 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;
|
|
629
|
+
* preventDefault chặn Space cuộn trang (A7).
|
|
630
|
+
*/
|
|
631
|
+
onViewKeydown = (event) => {
|
|
632
|
+
event.preventDefault();
|
|
633
|
+
this.#onClick();
|
|
634
|
+
};
|
|
342
635
|
focus = () => this.#focus();
|
|
343
636
|
onClear = ($event) => this.#clear($event);
|
|
344
637
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SdChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
345
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed()", "class.sd-label-top": "labelPlacement() === 'top'" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorMessage();\r\n@let _size = size();\r\n@let _removable = removable();\r\n@let _labelTop = labelPlacement() === 'top';\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n @if ((!_appearance || _labelTop) && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if ((!_appearance || _labelTop) && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (keydown.enter)=\"onClick()\"\r\n tabindex=\"0\"\r\n (click)=\"onClick()\">\r\n @if (_sdViewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"_sdViewDef!.templateRef; context: { value: formControl.value }\"></ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_appearance && _label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <mat-chip-grid [formControl]=\"formControl\" #chipList [class.sd-md]=\"_size === 'md'\" [class.sd-sm]=\"_size === 'sm'\">\r\n @for (item of formControl.value; track $index) {\r\n @if (item) {\r\n <mat-chip-row\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [removable]=\"_removable\"\r\n (removed)=\"onRemove(item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span>{{ item }}</span>\r\n @if (!inputControl.disabled && item | sdRemovableChip: _removable) {\r\n <sd-icon matChipRemove name=\"cancel\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n }\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"placeholder() || (_labelTop ? '' : _label)\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n #input />\r\n </mat-chip-grid>\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\r\n @if (_hideInlineError && _errorMessage && formControl.touched) {\r\n <span class=\"sd-visually-hidden\" matSuffix>{{ _errorMessage }}</span>\r\r\n }\r\n\r\n @if (!_hideInlineError && _errorMessage && formControl.touched) {\r\n <mat-error>{{ _errorMessage }}</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip-input{margin-top:0!important}:host ::ng-deep .mat-mdc-form-field.no-padding-wrapper .mat-mdc-text-field-wrapper{padding-bottom:0}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip{padding:7px 10px;min-height:26px}:host ::ng-deep mat-form-field.c-md .mat-mdc-standard-chip .mat-mdc-chip-trailing-icon{padding:7px 7px 7px 10px}:host ::ng-deep .mat-mdc-chip-row.sd-sm{--mdc-chip-label-text-size: 12px;--mdc-chip-container-height: 20px}:host ::ng-deep .mat-mdc-chip-set.sd-md{margin-top:10px}:host ::ng-deep .mat-mdc-chip-set.sd-sm{margin-top:2px}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg, #ebecf0)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i5.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }, { kind: "pipe", type: SdRemovableChipPipe, name: "sdRemovableChip" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
638
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SdChip, isStandalone: true, selector: "sd-chip", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, minCount: { classPropertyName: "minCount", publicName: "minCount", isSignal: true, isRequired: false, transformFunction: null }, maxCount: { classPropertyName: "maxCount", publicName: "maxCount", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, addable: { classPropertyName: "addable", publicName: "addable", isSignal: true, isRequired: false, transformFunction: null }, addOnBlur: { classPropertyName: "addOnBlur", publicName: "addOnBlur", isSignal: true, isRequired: false, transformFunction: null }, separators: { classPropertyName: "separators", publicName: "separators", isSignal: true, isRequired: false, transformFunction: null }, chipTransform: { classPropertyName: "chipTransform", publicName: "chipTransform", isSignal: true, isRequired: false, transformFunction: null }, chipValidator: { classPropertyName: "chipValidator", publicName: "chipValidator", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", sdChange: "sdChange" }, host: { listeners: { "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)" }, properties: { "class.sd-has-label": "!!label()", "class.sd-viewed": "isViewed()", "class.sd-label-top": "labelPlacement() === 'top'" } }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }, { propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "chipGrid", first: true, predicate: MatChipGrid, descendants: true, isSignal: true }, { propertyName: "chipTextElements", predicate: ["chipTextEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorText();\r\n@let _size = size();\r\n@let _labelTop = labelPlacement() === 'top';\r\n@let _icons = iconSizes();\r\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\r\n@let _errorVisible = isErrorShown();\r\n@let _viewTemplate = _sdViewDef?.templateRef;\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n <!-- why: nh\u00E3n r\u1EDDi (`labelPlacement=\"top\"`) l\u00E0 ch\u1ED7 duy nh\u1EA5t d\u00F9ng `#sdLabel` / `sdLabelDef` khi s\u1EEDa, nh\u01B0 sd-date v\u00E0\r\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\r\n @if (_labelTop && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (_labelTop && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout: kh\u00F4ng role, kh\u00F4ng t\u00EAn, kh\u00F4ng n\u1EB1m trong th\u1EE9 t\u1EF1 Tab (A7). Khi sdViewDef \u0111ang hi\u1EC3n th\u1ECB\r\n th\u00EC b\u00EAn trong kh\u00F4ng c\u00F3 ph\u1EA7n t\u1EED focus \u0111\u01B0\u1EE3c n\u00E0o, n\u00EAn ch\u00EDnh ph\u1EA7n t\u1EED view nh\u1EADn role=\"button\" + tabindex=\"0\" +\r\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_viewTemplate\"\r\n [class.c-focused]=\"isFocused()\"\r\n [class.c-disabled]=\"formControl.disabled\">\r\n @if (_viewTemplate && !isFocused()) {\r\n <!-- why: KH\u00D4NG \u0111\u1EB7t aria-label \u2014 n\u1ED9i dung sdViewDef ch\u00EDnh l\u00E0 nh\u00E3n nh\u00ECn th\u1EA5y \u0111\u01B0\u1EE3c. -->\r\n <div\r\n class=\"sd-chip__view-trigger\"\r\n role=\"button\"\r\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\r\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\r\n (click)=\"onClick()\"\r\n (keydown.enter)=\"onViewKeydown($event)\"\r\n (keydown.space)=\"onViewKeydown($event)\">\r\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\r\n </div>\r\n } @else {\r\n <!-- why: `.sd-chip-field` nh\u1EADn mixin sd-chip-row() c\u1EE7a core/form.scss \u2014 thang chip, chip kho\u00E1, \u201C+N\u201D, n\u00FAt b\u1ECF h\u1EBFt d\u00F9ng\r\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\r\n <mat-form-field\r\n class=\"sd-chip-field\"\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.sd-lg]=\"_size === 'lg'\"\r\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\r\n c\u00E1c chip \u0111ang render v\u00E0o control (s\u1ED1 th\u00E0nh chu\u1ED7i, reset b\u1ECB \u0111\u00E8 l\u1EA1i). V\u1EABn c\u1EA7n m\u1ED9t ngControl \u0111\u1EC3 grid t\u1EF1 t\u00EDnh\r\n errorState m\u1ED7i l\u1EA7n check; matcher c\u1EE7a sd-chip quy\u1EBFt \u0111\u1ECBnh vi\u1EC1n \u0111\u1ECF (A5). `required` g\u00E1n trong component, xem\r\n `chipGrid`. -->\r\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\r\n <!-- why: chips() gi\u1EEF c\u1EA3 0 v\u00E0 track theo gi\u00E1 tr\u1ECB, n\u00EAn xo\u00E1 m\u1ED9t chip kh\u00F4ng d\u1EF1ng l\u1EA1i c\u00E1c chip sau n\u00F3 (A2).\r\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\r\n xo\u00E1 chip kho\u00E1 (A1). Khi kh\u00F4ng focus ch\u1EC9 hi\u1EC7n `maxVisible` chip, ph\u1EA7n d\u01B0 g\u1ED9p v\u00E0o \u201C+N\u201D (B7). Chip kho\u00E1 c\u00F3 n\u1EC1n\r\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\r\n @for (item of visibleChips(); track item) {\r\n @let _removable = isRemovable(item);\r\n @let _text = chipText(item);\r\n <mat-chip-row\r\n class=\"sd-chip__chip\"\r\n [class.sd-chip__chip--locked]=\"!_removable\"\r\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\r\n [removable]=\"_removable\"\r\n [aria-label]=\"chipLabel(item)\"\r\n (removed)=\"onRemove(item)\"\r\n (keydown)=\"onChipKeydown($event, item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span\r\n #chipTextEl\r\n class=\"sd-chip__chip-text\"\r\n [attr.data-chip]=\"_text\"\r\n [matTooltip]=\"_text\"\r\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\r\n >{{ item }}</span\r\n >\r\n <!-- why: m\u1ED7i kh\u1ED1i @if m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c, \u0111\u1EC3 \u2715 \u0111\u01B0\u1EE3c chi\u1EBFu v\u00E0o \u00F4 trailing c\u1EE7a mat-chip-row ([matChipRemove]). -->\r\n @if (!inputControl.disabled && _removable) {\r\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\r\n }\r\n @if (!inputControl.disabled && !_removable) {\r\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n @if (hiddenCount() > 0) {\r\n <button\r\n type=\"button\"\r\n class=\"sd-chip__more\"\r\n [attr.aria-label]=\"moreLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\r\n (click)=\"onMoreClick($event)\">\r\n +{{ hiddenCount() }}\r\n </button>\r\n }\r\n <!-- why: ph\u00EDm t\u00E1ch so theo `KeyboardEvent.key` trong onInputKeydown (keyCode c\u1EE7a `;` kh\u00E1c nhau theo b\u1ED1 c\u1EE5c b\u00E0n ph\u00EDm),\r\n n\u00EAn Material kh\u00F4ng nh\u1EADn ph\u00EDm n\u00E0o; n\u00F3 ch\u1EC9 c\u00F2n ph\u00E1t matChipInputTokenEnd khi blur (`addOnBlur`). `addable` false\r\n v\u1EABn gi\u1EEF \u00F4 nh\u1EADp v\u00EC mat-chip-grid c\u1EA7n matChipInputFor, nh\u01B0ng ch\u1EC9 \u0111\u1ECDc v\u00E0 ra kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"effectivePlaceholder()\"\r\n [readonly]=\"!addable()\"\r\n [attr.tabindex]=\"addable() ? null : -1\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\r\n [matChipInputAddOnBlur]=\"addOnBlur()\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n (keydown)=\"onInputKeydown($event)\"\r\n (input)=\"onInputText()\"\r\n (paste)=\"onPaste($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\r\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\r\n #input />\r\n </mat-chip-grid>\r\n <!-- why: icon v\u00E0 ch\u1EEF l\u1ED7i \u1EA9n chung m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c matSuffix, n\u00EAn m\u1ED9t kh\u1ED1i @if \u0111\u1EE7 cho c\u1EA3 hai v\u00E0 v\u1EABn \u0111\u01B0\u1EE3c chi\u1EBFu\r\n v\u00E0o v\u00F9ng suffix. Ch\u1EEF \u1EA9n c\u00F3 id \u0111\u1EC3 \u00F4 nh\u1EADp tr\u1ECF aria-describedby sang (A8); v\u1EDBi <mat-error> th\u00EC\r\n mat-form-field t\u1EF1 n\u1ED1i. -->\r\n @if (_hideInlineError && _errorVisible) {\r\n <span matSuffix class=\"sd-chip__error-suffix\">\r\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\r\n </span>\r\n }\r\n <!-- why: n\u00FAt b\u1ECF h\u1EBFt nh\u01B0 `.sd-clear-btn` c\u1EE7a sd-date (hi\u1EC7n khi hover / focus-within). Lu\u00F4n gi\u1EEF ch\u1ED7: khi kh\u00F4ng c\u00F2n chip\r\n n\u00E0o b\u1ECF \u0111\u01B0\u1EE3c th\u00EC ch\u1EC9 \u1EA9n b\u1EB1ng visibility, kh\u00F4ng g\u1EE1 kh\u1ECFi DOM, \u0111\u1EC3 field kh\u00F4ng nh\u1EA3y (B6). -->\r\n @if (clearable() && !formControl.disabled && !_required) {\r\n @let _canClear = hasRemovable();\r\n <button\r\n type=\"button\"\r\n matSuffix\r\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\r\n [class.sd-hover]=\"_canClear\"\r\n [class.sd-chip__clear--empty]=\"!_canClear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\r\n (click)=\"onClear($event)\">\r\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\r\n </button>\r\n }\r\n\r\n @if (!_hideInlineError && _errorVisible) {\r\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\r\n }\r\n @if (effectiveMaxCount() > 0) {\r\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\r\n {{ chips().length }}/{{ effectiveMaxCount() }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- why: v\u00F9ng live lu\u00F4n c\u00F3 m\u1EB7t \u0111\u1EC3 screen reader \u0111\u1ECDc \u201C\u0111\u00E3 c\u00F3\u201D, \u201C\u0111\u00E3 \u0111\u1EE7\u201D, k\u1EBFt qu\u1EA3 d\u00E1n v\u00E0 \u201Ckh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D ngay khi ch\u00FAng\r\n xu\u1EA5t hi\u1EC7n (B2, B3); id m\u1EDBi d\u1EF1ng l\u1EA1i ch\u1EEF \u0111\u1EC3 c\u00E2u l\u1EB7p l\u1EA1i v\u1EABn \u0111\u01B0\u1EE3c \u0111\u1ECDc. -->\r\n @let _live = liveMessage();\r\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\r\n @for (message of _live ? [_live] : []; track message.id) {\r\n <span>{{ message.text }}</span>\r\n }\r\n </span>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip__chip-text{display:block;min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg)}.sd-chip__view-trigger{display:flex;align-items:center;width:100%;cursor:pointer}.sd-chip__view-trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-chip__view-trigger[aria-disabled=true]{cursor:default}.sd-chip__error-suffix{display:inline-flex;align-items:center}.sd-chip__clear--empty{visibility:hidden}@media(pointer:coarse){.sd-chip__clear.sd-hover{visibility:visible}}.sd-chip__counter--full{color:var(--sd-warning)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i5.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i5.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i5.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText", "for", "labelId"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate", "selectedItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
346
639
|
}
|
|
347
640
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SdChip, decorators: [{
|
|
348
641
|
type: Component,
|
|
@@ -350,6 +643,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
350
643
|
'[class.sd-has-label]': '!!label()',
|
|
351
644
|
'[class.sd-viewed]': 'isViewed()',
|
|
352
645
|
'[class.sd-label-top]': "labelPlacement() === 'top'",
|
|
646
|
+
'(focusin)': 'onFocusIn($event)',
|
|
647
|
+
'(focusout)': 'onFocusOut($event)',
|
|
353
648
|
}, imports: [
|
|
354
649
|
SdIcon,
|
|
355
650
|
CommonModule,
|
|
@@ -358,18 +653,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
358
653
|
MatInputModule,
|
|
359
654
|
MatTooltipModule,
|
|
360
655
|
MatFormFieldModule,
|
|
361
|
-
MatAutocompleteModule,
|
|
362
|
-
MatProgressSpinnerModule,
|
|
363
656
|
MatChipsModule,
|
|
364
657
|
SdLabel,
|
|
365
658
|
SdView,
|
|
366
|
-
SdRemovableChipPipe,
|
|
367
|
-
|
|
368
|
-
}], 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 }] }] } });
|
|
659
|
+
], template: "@let _label = label();\r\n@let _appearance = appearance();\r\n@let _required = required();\r\n@let _isViewed = isViewed();\r\n@let _hideInlineError = hideInlineError();\r\n@let _sdViewDef = sdViewDef();\r\n@let _labelTemplate = (sdLabelTemplate() ?? sdLabelDef()?.templateRef) || undefined;\r\n@let _valueTemplate = (sdValueTemplate() ?? _sdViewDef?.templateRef) || undefined;\r\n@let _errorMessage = errorText();\r\n@let _size = size();\r\n@let _labelTop = labelPlacement() === 'top';\r\n@let _icons = iconSizes();\r\n<!-- why: m\u1ED9t c\u1ED5ng duy nh\u1EA5t cho <mat-error>, ch\u1EEF l\u1ED7i \u1EA9n v\u00E0 aria-invalid (A5). -->\r\n@let _errorVisible = isErrorShown();\r\n@let _viewTemplate = _sdViewDef?.templateRef;\r\n\r\n@if (_isViewed) {\r\n <sd-view\r\n [label]=\"_label\"\r\n [labelTemplate]=\"_labelTemplate\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"_valueTemplate\">\r\n </sd-view>\r\n} @else {\r\n <!-- why: nh\u00E3n r\u1EDDi (`labelPlacement=\"top\"`) l\u00E0 ch\u1ED7 duy nh\u1EA5t d\u00F9ng `#sdLabel` / `sdLabelDef` khi s\u1EEDa, nh\u01B0 sd-date v\u00E0\r\n sd-select; nh\u00E3n n\u1ED5i l\u00E0 <mat-label> ch\u1EEF (D1). -->\r\n @if (_labelTop && _labelTemplate) {\r\n <ng-container *ngTemplateOutlet=\"_labelTemplate\"></ng-container>\r\n }\r\n @if (_labelTop && _label && !_labelTemplate) {\r\n <sd-label [label]=\"_label\" [required]=\"_required\" [for]=\"_labelTop ? inputId : null\"></sd-label>\r\n }\r\n\r\n <!-- why: div ch\u1EC9 l\u00E0 h\u1ED9p layout: kh\u00F4ng role, kh\u00F4ng t\u00EAn, kh\u00F4ng n\u1EB1m trong th\u1EE9 t\u1EF1 Tab (A7). Khi sdViewDef \u0111ang hi\u1EC3n th\u1ECB\r\n th\u00EC b\u00EAn trong kh\u00F4ng c\u00F3 ph\u1EA7n t\u1EED focus \u0111\u01B0\u1EE3c n\u00E0o, n\u00EAn ch\u00EDnh ph\u1EA7n t\u1EED view nh\u1EADn role=\"button\" + tabindex=\"0\" +\r\n Enter/Space; disabled th\u00EC r\u00FAt kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!_viewTemplate\"\r\n [class.c-focused]=\"isFocused()\"\r\n [class.c-disabled]=\"formControl.disabled\">\r\n @if (_viewTemplate && !isFocused()) {\r\n <!-- why: KH\u00D4NG \u0111\u1EB7t aria-label \u2014 n\u1ED9i dung sdViewDef ch\u00EDnh l\u00E0 nh\u00E3n nh\u00ECn th\u1EA5y \u0111\u01B0\u1EE3c. -->\r\n <div\r\n class=\"sd-chip__view-trigger\"\r\n role=\"button\"\r\n [attr.tabindex]=\"formControl.disabled ? null : 0\"\r\n [attr.aria-disabled]=\"formControl.disabled ? 'true' : null\"\r\n (click)=\"onClick()\"\r\n (keydown.enter)=\"onViewKeydown($event)\"\r\n (keydown.space)=\"onViewKeydown($event)\">\r\n <ng-container *ngTemplateOutlet=\"_viewTemplate; context: { value: formControl.value }\"></ng-container>\r\n </div>\r\n } @else {\r\n <!-- why: `.sd-chip-field` nh\u1EADn mixin sd-chip-row() c\u1EE7a core/form.scss \u2014 thang chip, chip kho\u00E1, \u201C+N\u201D, n\u00FAt b\u1ECF h\u1EBFt d\u00F9ng\r\n chung v\u1EDBi sd-chip-calendar (C1, C2). -->\r\n <mat-form-field\r\n class=\"sd-chip-field\"\r\n [class.sd-md]=\"_size === 'md'\"\r\n [class.sd-sm]=\"_size === 'sm'\"\r\n [class.sd-lg]=\"_size === 'lg'\"\r\n [class.sd-chip-field--folded]=\"hiddenCount() > 0\"\r\n [class.hide-inline-error]=\"_hideInlineError\"\r\n [class.sd-label-top]=\"_labelTop\"\r\n [appearance]=\"_appearance\"\r\n [floatLabel]=\"floatLabel()\">\r\n @if (_label && !_labelTop) {\r\n <mat-label>{{ _label }}</mat-label>\r\n }\r\n <!-- why: grid n\u1ED1i `gridControl` ri\u00EAng, kh\u00F4ng ph\u1EA3i `formControl`: l\u00E0 ControlValueAccessor, khi blur n\u00F3 ghi text c\u1EE7a\r\n c\u00E1c chip \u0111ang render v\u00E0o control (s\u1ED1 th\u00E0nh chu\u1ED7i, reset b\u1ECB \u0111\u00E8 l\u1EA1i). V\u1EABn c\u1EA7n m\u1ED9t ngControl \u0111\u1EC3 grid t\u1EF1 t\u00EDnh\r\n errorState m\u1ED7i l\u1EA7n check; matcher c\u1EE7a sd-chip quy\u1EBFt \u0111\u1ECBnh vi\u1EC1n \u0111\u1ECF (A5). `required` g\u00E1n trong component, xem\r\n `chipGrid`. -->\r\n <mat-chip-grid [formControl]=\"gridControl\" #chipList [errorStateMatcher]=\"matcher\">\r\n <!-- why: chips() gi\u1EEF c\u1EA3 0 v\u00E0 track theo gi\u00E1 tr\u1ECB, n\u00EAn xo\u00E1 m\u1ED9t chip kh\u00F4ng d\u1EF1ng l\u1EA1i c\u00E1c chip sau n\u00F3 (A2).\r\n `[removable]` nh\u1EADn boolean c\u1EE7a t\u1EEBng chip: predicate truy\u1EC1n th\u1EB3ng lu\u00F4n truthy v\u00E0 Backspace / Delete v\u1EABn\r\n xo\u00E1 chip kho\u00E1 (A1). Khi kh\u00F4ng focus ch\u1EC9 hi\u1EC7n `maxVisible` chip, ph\u1EA7n d\u01B0 g\u1ED9p v\u00E0o \u201C+N\u201D (B7). Chip kho\u00E1 c\u00F3 n\u1EC1n\r\n ri\u00EAng, icon kho\u00E1 v\u00E0 t\u00EAn n\u1ED1i \u201C, kh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D (C3). -->\r\n @for (item of visibleChips(); track item) {\r\n @let _removable = isRemovable(item);\r\n @let _text = chipText(item);\r\n <mat-chip-row\r\n class=\"sd-chip__chip\"\r\n [class.sd-chip__chip--locked]=\"!_removable\"\r\n [class.sd-chip__chip--duplicate]=\"duplicateChip() === item\"\r\n [removable]=\"_removable\"\r\n [aria-label]=\"chipLabel(item)\"\r\n (removed)=\"onRemove(item)\"\r\n (keydown)=\"onChipKeydown($event, item)\"\r\n [disabled]=\"inputControl.disabled\"\r\n (click)=\"onClickChip($event, item)\">\r\n <span\r\n #chipTextEl\r\n class=\"sd-chip__chip-text\"\r\n [attr.data-chip]=\"_text\"\r\n [matTooltip]=\"_text\"\r\n [matTooltipDisabled]=\"!truncatedChips().has(_text)\"\r\n >{{ item }}</span\r\n >\r\n <!-- why: m\u1ED7i kh\u1ED1i @if m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c, \u0111\u1EC3 \u2715 \u0111\u01B0\u1EE3c chi\u1EBFu v\u00E0o \u00F4 trailing c\u1EE7a mat-chip-row ([matChipRemove]). -->\r\n @if (!inputControl.disabled && _removable) {\r\n <sd-icon matChipRemove name=\"close\" [size]=\"_icons.chip\" [ariaLabel]=\"removeLabel(item)\"></sd-icon>\r\n }\r\n @if (!inputControl.disabled && !_removable) {\r\n <sd-icon class=\"sd-chip__lock\" name=\"lock\" [size]=\"_icons.chip\" [matTooltip]=\"lockedLabel()\"></sd-icon>\r\n }\r\n </mat-chip-row>\r\n }\r\n @if (hiddenCount() > 0) {\r\n <button\r\n type=\"button\"\r\n class=\"sd-chip__more\"\r\n [attr.aria-label]=\"moreLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-more' : null\"\r\n (click)=\"onMoreClick($event)\">\r\n +{{ hiddenCount() }}\r\n </button>\r\n }\r\n <!-- why: ph\u00EDm t\u00E1ch so theo `KeyboardEvent.key` trong onInputKeydown (keyCode c\u1EE7a `;` kh\u00E1c nhau theo b\u1ED1 c\u1EE5c b\u00E0n ph\u00EDm),\r\n n\u00EAn Material kh\u00F4ng nh\u1EADn ph\u00EDm n\u00E0o; n\u00F3 ch\u1EC9 c\u00F2n ph\u00E1t matChipInputTokenEnd khi blur (`addOnBlur`). `addable` false\r\n v\u1EABn gi\u1EEF \u00F4 nh\u1EADp v\u00EC mat-chip-grid c\u1EA7n matChipInputFor, nh\u01B0ng ch\u1EC9 \u0111\u1ECDc v\u00E0 ra kh\u1ECFi th\u1EE9 t\u1EF1 Tab. -->\r\n <input\r\n class=\"sd-chip-input\"\r\n [formControl]=\"inputControl\"\r\n [id]=\"inputId\"\r\n [placeholder]=\"effectivePlaceholder()\"\r\n [readonly]=\"!addable()\"\r\n [attr.tabindex]=\"addable() ? null : -1\"\r\n [matChipInputFor]=\"chipList\"\r\n [matChipInputSeparatorKeyCodes]=\"noSeparatorKeys\"\r\n [matChipInputAddOnBlur]=\"addOnBlur()\"\r\n (matChipInputTokenEnd)=\"onAdd($event)\"\r\n (keydown)=\"onInputKeydown($event)\"\r\n (input)=\"onInputText()\"\r\n (paste)=\"onPaste($event)\"\r\n autocomplete=\"off\"\r\n [errorStateMatcher]=\"matcher\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [required]=\"_required\"\r\n matInput\r\n [attr.data-autoId]=\"autoId()\"\r\n [attr.data-disabled]=\"dataDisabled()\"\r\n [attr.data-empty]=\"dataEmpty()\"\r\n [attr.data-value]=\"dataValue()\"\r\n [attr.data-count]=\"dataCount()\"\r\n [attr.data-required]=\"dataRequired()\"\r\n [attr.data-error-message]=\"dataErrorMessage()\"\r\n [attr.aria-invalid]=\"_errorVisible ? 'true' : 'false'\"\r\n [attr.aria-describedby]=\"_hideInlineError && _errorVisible ? errorId : null\"\r\n #input />\r\n </mat-chip-grid>\r\n <!-- why: icon v\u00E0 ch\u1EEF l\u1ED7i \u1EA9n chung m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c matSuffix, n\u00EAn m\u1ED9t kh\u1ED1i @if \u0111\u1EE7 cho c\u1EA3 hai v\u00E0 v\u1EABn \u0111\u01B0\u1EE3c chi\u1EBFu\r\n v\u00E0o v\u00F9ng suffix. Ch\u1EEF \u1EA9n c\u00F3 id \u0111\u1EC3 \u00F4 nh\u1EADp tr\u1ECF aria-describedby sang (A8); v\u1EDBi <mat-error> th\u00EC\r\n mat-form-field t\u1EF1 n\u1ED1i. -->\r\n @if (_hideInlineError && _errorVisible) {\r\n <span matSuffix class=\"sd-chip__error-suffix\">\r\n <sd-icon class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\r\n <span class=\"sd-visually-hidden\" [id]=\"errorId\">{{ _errorMessage }}</span>\r\n </span>\r\n }\r\n <!-- why: n\u00FAt b\u1ECF h\u1EBFt nh\u01B0 `.sd-clear-btn` c\u1EE7a sd-date (hi\u1EC7n khi hover / focus-within). Lu\u00F4n gi\u1EEF ch\u1ED7: khi kh\u00F4ng c\u00F2n chip\r\n n\u00E0o b\u1ECF \u0111\u01B0\u1EE3c th\u00EC ch\u1EC9 \u1EA9n b\u1EB1ng visibility, kh\u00F4ng g\u1EE1 kh\u1ECFi DOM, \u0111\u1EC3 field kh\u00F4ng nh\u1EA3y (B6). -->\r\n @if (clearable() && !formControl.disabled && !_required) {\r\n @let _canClear = hasRemovable();\r\n <button\r\n type=\"button\"\r\n matSuffix\r\n class=\"sd-clear-btn sd-chip__clear sd-chip__suffix\"\r\n [class.sd-hover]=\"_canClear\"\r\n [class.sd-chip__clear--empty]=\"!_canClear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [attr.data-autoid]=\"autoId() ? autoId() + '-clear' : null\"\r\n (click)=\"onClear($event)\">\r\n <sd-icon name=\"close\" [size]=\"_icons.clear\"></sd-icon>\r\n </button>\r\n }\r\n\r\n @if (!_hideInlineError && _errorVisible) {\r\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\r\n }\r\n @if (effectiveMaxCount() > 0) {\r\n <mat-hint align=\"end\" class=\"sd-chip__counter\" [class.sd-chip__counter--full]=\"full()\">\r\n {{ chips().length }}/{{ effectiveMaxCount() }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- why: v\u00F9ng live lu\u00F4n c\u00F3 m\u1EB7t \u0111\u1EC3 screen reader \u0111\u1ECDc \u201C\u0111\u00E3 c\u00F3\u201D, \u201C\u0111\u00E3 \u0111\u1EE7\u201D, k\u1EBFt qu\u1EA3 d\u00E1n v\u00E0 \u201Ckh\u00F4ng xo\u00E1 \u0111\u01B0\u1EE3c\u201D ngay khi ch\u00FAng\r\n xu\u1EA5t hi\u1EC7n (B2, B3); id m\u1EDBi d\u1EF1ng l\u1EA1i ch\u1EEF \u0111\u1EC3 c\u00E2u l\u1EB7p l\u1EA1i v\u1EABn \u0111\u01B0\u1EE3c \u0111\u1ECDc. -->\r\n @let _live = liveMessage();\r\n <span class=\"sd-visually-hidden sd-chip__live\" aria-live=\"polite\">\r\n @for (message of _live ? [_live] : []; track message.id) {\r\n <span>{{ message.text }}</span>\r\n }\r\n </span>\r\n}\r\n", styles: [":host{display:block}:host(.sd-has-label){padding-top:4px}:host(.sd-label-top){padding-top:0}:host(.sd-viewed){padding-top:0}.sd-chip__chip-text{display:block;min-width:0;max-width:240px;overflow:hidden;text-overflow:ellipsis}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:var(--sd-chip-bg)}.sd-chip__view-trigger{display:flex;align-items:center;width:100%;cursor:pointer}.sd-chip__view-trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.sd-chip__view-trigger[aria-disabled=true]{cursor:default}.sd-chip__error-suffix{display:inline-flex;align-items:center}.sd-chip__clear--empty{visibility:hidden}@media(pointer:coarse){.sd-chip__clear.sd-hover{visibility:visible}}.sd-chip__counter--full{color:var(--sd-warning)}\n"] }]
|
|
660
|
+
}], 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 }] }] } });
|
|
369
661
|
|
|
370
662
|
/**
|
|
371
663
|
* Generated bundle index. Do not edit.
|
|
372
664
|
*/
|
|
373
665
|
|
|
374
|
-
export { SdChip
|
|
666
|
+
export { SdChip };
|
|
375
667
|
//# sourceMappingURL=sdcorejs-angular-forms-chip.mjs.map
|