@sdcorejs/angular 22.3.1 → 22.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/STYLE-GUIDE.md +25 -5
- package/assets/THEME.md +289 -5
- package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
- package/assets/scss/ckeditor5.scss +2 -88
- package/assets/scss/core/_control.scss +39 -0
- package/assets/scss/core/form.scss +444 -45
- package/assets/scss/core/view.scss +24 -0
- package/assets/scss/editor-content.scss +173 -0
- package/assets/scss/sd-core.scss +1 -0
- package/assets/scss/themes/_component-tokens.scss +123 -32
- package/assets/scss/themes/_material-tokens.scss +112 -0
- package/assets/scss/themes/_presets.scss +25 -0
- package/assets/scss/themes/_scales.scss +10 -0
- package/assets/scss/themes/_semantic.scss +13 -0
- package/assets/scss/themes/default.scss +8 -2
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +166 -11
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +590 -24
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +35 -3
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1906 -0
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-editor.mjs +461 -757
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +69 -37
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2195 -1182
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +12 -2
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +182 -284
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -316
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +274 -44
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +17 -5
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +574 -95
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1034 -119
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +932 -174
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-window.mjs +498 -0
- package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +20 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +483 -126
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +437 -122
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +86 -13
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +81 -18
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +79 -16
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +90 -2
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +63 -6
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +60 -7
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +5 -4
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +95 -33
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +16 -3
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1745 -22
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs +509 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs +294 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs +1556 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +2178 -38
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs +134 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs +119 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs +469 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs +67 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs +152 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs +479 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs +175 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs +92 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-yJ5fPyYU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs +533 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs +64 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-Ydotvlyc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs +92 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs +242 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs +179 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs +72 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs +541 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs +647 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs +120 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs +73 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs +186 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs +97 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs +49 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs +301 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs +166 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs +413 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs +325 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs +146 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs +135 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs +129 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs +360 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs +101 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
- package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services.mjs +1 -0
- package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
- package/modules/pattern/README.md +76 -0
- package/modules/pattern/docs/detail.md +237 -0
- package/modules/pattern/docs/drawer.md +484 -0
- package/modules/pattern/docs/flow.md +631 -0
- package/modules/pattern/docs/form.md +518 -0
- package/modules/pattern/docs/header-actions.md +342 -0
- package/modules/pattern/docs/list.md +247 -0
- package/modules/pattern/docs/relation.md +180 -0
- package/modules/pattern/docs/select.md +206 -0
- package/modules/pattern/docs/split.md +350 -0
- package/modules/pattern/docs/states.md +168 -0
- package/modules/pattern/features/approval/entity.resolver.ts +21 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
- package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
- package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
- package/modules/pattern/features/approval/routes.ts +30 -0
- package/modules/pattern/features/approval/services/approval.model.ts +38 -0
- package/modules/pattern/features/approval/services/approval.service.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +123 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
- package/modules/pattern/features/category/entity.resolver.ts +27 -0
- package/modules/pattern/features/category/pages/list/list.component.html +20 -0
- package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
- package/modules/pattern/features/category/routes.ts +42 -0
- package/modules/pattern/features/category/services/category.model.ts +39 -0
- package/modules/pattern/features/category/services/category.service.ts +36 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +131 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
- package/modules/pattern/features/customer/entity.resolver.ts +21 -0
- package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
- package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
- package/modules/pattern/features/customer/routes.ts +59 -0
- package/modules/pattern/features/customer/services/customer.model.ts +87 -0
- package/modules/pattern/features/customer/services/customer.service.ts +79 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
- package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
- package/modules/pattern/features/import/routes.ts +19 -0
- package/modules/pattern/features/import/services/import.model.ts +82 -0
- package/modules/pattern/features/import/services/import.service.ts +18 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +205 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
- package/modules/pattern/features/order/entity.resolver.ts +37 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +99 -0
- package/modules/pattern/features/order/pages/detail/detail.component.ts +222 -0
- package/modules/pattern/features/order/pages/list/list.component.html +38 -0
- package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
- package/modules/pattern/features/order/pages/update/update.component.ts +119 -0
- package/modules/pattern/features/order/routes.ts +54 -0
- package/modules/pattern/features/order/services/order.model.ts +109 -0
- package/modules/pattern/features/order/services/order.service.ts +63 -0
- package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
- package/modules/pattern/features/partner/routes.ts +20 -0
- package/modules/pattern/features/partner/services/partner.model.ts +30 -0
- package/modules/pattern/features/partner/services/partner.service.ts +17 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +65 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
- package/modules/pattern/features/product/entity.resolver.ts +21 -0
- package/modules/pattern/features/product/pages/create/create.component.ts +85 -0
- package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
- package/modules/pattern/features/product/pages/list/list.component.html +30 -0
- package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
- package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
- package/modules/pattern/features/product/routes.ts +48 -0
- package/modules/pattern/features/product/services/product.model.ts +38 -0
- package/modules/pattern/features/product/services/product.service.ts +48 -0
- package/modules/pattern/features/settings/pages/update/update.component.ts +227 -0
- package/modules/pattern/features/settings/routes.ts +24 -0
- package/modules/pattern/features/settings/services/settings.model.ts +18 -0
- package/modules/pattern/features/settings/services/settings.service.ts +15 -0
- package/modules/pattern/features/settings/settings.resolver.ts +8 -0
- package/package.json +44 -7
- package/types/sdcorejs-angular-components-avatar.d.ts +67 -2
- package/types/sdcorejs-angular-components-badge.d.ts +206 -6
- package/types/sdcorejs-angular-components-button.d.ts +20 -1
- package/types/sdcorejs-angular-components-ckeditor-styles.d.ts +3 -18
- package/types/sdcorejs-angular-components-editor-engine.d.ts +246 -0
- package/types/sdcorejs-angular-components-editor.d.ts +20 -17
- package/types/sdcorejs-angular-components-file-explorer.d.ts +4 -2
- package/types/sdcorejs-angular-components-form-generic.d.ts +246 -35
- package/types/sdcorejs-angular-components-mini-editor.d.ts +33 -70
- package/types/sdcorejs-angular-components-modal-resizable.d.ts +1 -124
- package/types/sdcorejs-angular-components-operator.d.ts +137 -8
- package/types/sdcorejs-angular-components-section.d.ts +13 -1
- package/types/sdcorejs-angular-components-splitter.d.ts +1 -1
- package/types/sdcorejs-angular-components-tab-router.d.ts +74 -19
- package/types/sdcorejs-angular-components-table.d.ts +210 -18
- package/types/sdcorejs-angular-components-upload-file.d.ts +181 -21
- package/types/sdcorejs-angular-components-window.d.ts +81 -0
- package/types/sdcorejs-angular-components.d.ts +1 -0
- package/types/sdcorejs-angular-configurations.d.ts +8 -1
- package/types/sdcorejs-angular-forms-autocomplete.d.ts +5 -0
- package/types/sdcorejs-angular-forms-chip-calendar.d.ts +163 -18
- package/types/sdcorejs-angular-forms-chip.d.ts +136 -26
- package/types/sdcorejs-angular-forms-date-range.d.ts +24 -2
- package/types/sdcorejs-angular-forms-date.d.ts +23 -2
- package/types/sdcorejs-angular-forms-directives.d.ts +47 -2
- package/types/sdcorejs-angular-forms-input-number.d.ts +23 -2
- package/types/sdcorejs-angular-forms-input.d.ts +23 -2
- package/types/sdcorejs-angular-forms-models.d.ts +38 -3
- package/types/sdcorejs-angular-forms-select.d.ts +32 -2
- package/types/sdcorejs-angular-i18n.d.ts +344 -2
- package/types/sdcorejs-angular-modules-generic.d.ts +316 -0
- package/types/sdcorejs-angular-modules-icon.d.ts +37 -6
- package/types/sdcorejs-angular-modules-layout.d.ts +622 -89
- package/types/sdcorejs-angular-modules-pattern.d.ts +50 -0
- package/types/sdcorejs-angular-modules.d.ts +1 -0
- package/types/sdcorejs-angular-pipes.d.ts +2 -0
- package/types/sdcorejs-angular-services-date-time.d.ts +57 -0
- package/types/sdcorejs-angular-services-storage.d.ts +8 -1
- package/types/sdcorejs-angular-services-unsaved-changes.d.ts +11 -0
- package/types/sdcorejs-angular-services.d.ts +1 -0
- package/types/sdcorejs-angular-utilities-read-state.d.ts +2 -0
- package/types/sdcorejs-angular-utilities-theme.d.ts +1 -1
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, booleanAttribute, EventEmitter, computed, Output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { input, booleanAttribute, EventEmitter, viewChild, signal, computed, Output, ChangeDetectionStrategy, Component, inject, effect, untracked, Directive, ElementRef, model, output } from '@angular/core';
|
|
5
|
+
import { SdTooltipDirective } from '@sdcorejs/angular/directives';
|
|
6
|
+
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
7
|
+
import * as i3 from '@angular/cdk/overlay';
|
|
8
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
9
|
+
import * as i1$1 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldControl, MatFormField, MatFormFieldModule } from '@angular/material/form-field';
|
|
5
11
|
import * as i2 from '@angular/material/tooltip';
|
|
6
12
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
7
|
-
import {
|
|
13
|
+
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
14
|
+
import { SdView } from '@sdcorejs/angular/components/view';
|
|
15
|
+
import { ɵSdSearchField as _SdSearchField, ɵSdSearchFieldInputDirective as _SdSearchFieldInputDirective } from '@sdcorejs/angular/forms/directives';
|
|
16
|
+
import { SdLabel } from '@sdcorejs/angular/forms/label';
|
|
17
|
+
import { SD_FORM_CONFIGURATION, ɵsdCoerceFormGroup as _sdCoerceFormGroup, sdViewedTransform, SdFormControl, sdFormControlState, ɵsdFormControlConnector as _sdFormControlConnector, HandleSdCustomValidator, SdInlineErrorValidator } from '@sdcorejs/angular/forms/models';
|
|
18
|
+
import { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';
|
|
19
|
+
import { Utilities } from '@sdcorejs/utils/fns';
|
|
20
|
+
import { Subject } from 'rxjs';
|
|
8
21
|
|
|
22
|
+
/** Số đếm lớn hơn giá trị này hiện "99+". */
|
|
23
|
+
const SD_BADGE_COUNT_MAX = 99;
|
|
9
24
|
class SdBadge {
|
|
25
|
+
/** Tên dùng làm accessible name dự phòng khi badge bấm được không có chữ và không có icon. */
|
|
10
26
|
defaultIcon = 'fiber_manual_record';
|
|
11
27
|
// ==========================================
|
|
12
28
|
// 1. SIGNAL INPUTS
|
|
@@ -22,6 +38,9 @@ class SdBadge {
|
|
|
22
38
|
fontSet = input(undefined, { ...(ngDevMode ? { debugName: "fontSet" } : /* istanbul ignore next */ {}), transform: value => value ?? undefined });
|
|
23
39
|
title = input(/* @ts-ignore */
|
|
24
40
|
...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Phần bên trái của type `pair` (nền secondary nhạt). Các type khác bỏ qua. */
|
|
42
|
+
label = input(/* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
25
44
|
description = input(/* @ts-ignore */
|
|
26
45
|
...(ngDevMode ? [undefined, { debugName: "description" }] : /* istanbul ignore next */ []));
|
|
27
46
|
tooltip = input(/* @ts-ignore */
|
|
@@ -29,6 +48,8 @@ class SdBadge {
|
|
|
29
48
|
icon = input(/* @ts-ignore */
|
|
30
49
|
...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
31
50
|
size = input('sm', { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), transform: value => value || 'sm' });
|
|
51
|
+
/** Vòng sáng nhấp nháy quanh chấm của type `dot` và của type `icon` không có icon. */
|
|
52
|
+
pulse = input(false, { ...(ngDevMode ? { debugName: "pulse" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
32
53
|
// ==========================================
|
|
33
54
|
// 2. OUTPUT
|
|
34
55
|
// ==========================================
|
|
@@ -52,7 +73,38 @@ class SdBadge {
|
|
|
52
73
|
this.onClick(event);
|
|
53
74
|
};
|
|
54
75
|
// ==========================================
|
|
55
|
-
// 3.
|
|
76
|
+
// 3. TOOLTIP
|
|
77
|
+
// ==========================================
|
|
78
|
+
titleRef = viewChild('titleEl', /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "titleRef" }] : /* istanbul ignore next */ []));
|
|
80
|
+
#truncated = signal(false, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "#truncated" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/**
|
|
83
|
+
* Đo lúc hover/focus xem chữ có bị cắt không; chỉ khi bị cắt (hoặc có `tooltip`) badge mới có tooltip.
|
|
84
|
+
*/
|
|
85
|
+
// why: đo theo sự kiện thay vì ResizeObserver — bảng có hàng trăm badge, phần lớn không bao giờ được rê chuột.
|
|
86
|
+
measureTruncation = () => {
|
|
87
|
+
const el = this.titleRef()?.nativeElement;
|
|
88
|
+
this.#truncated.set(!!el && el.scrollWidth > el.clientWidth);
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Chữ của tooltip: `tooltip` nếu có; type `dot` luôn dùng title (title không hiện ra); type khác dùng title đầy đủ
|
|
92
|
+
* khi chữ bị cắt; ngược lại rỗng (không tooltip).
|
|
93
|
+
*/
|
|
94
|
+
tooltipText = computed(() => {
|
|
95
|
+
const tooltip = this.tooltip()?.trim();
|
|
96
|
+
if (tooltip)
|
|
97
|
+
return tooltip;
|
|
98
|
+
const title = this.title();
|
|
99
|
+
if (title === undefined || title === null)
|
|
100
|
+
return '';
|
|
101
|
+
if (this.type() === 'dot')
|
|
102
|
+
return String(title);
|
|
103
|
+
return this.#truncated() ? String(title) : '';
|
|
104
|
+
}, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "tooltipText" }] : /* istanbul ignore next */ []));
|
|
106
|
+
// ==========================================
|
|
107
|
+
// 4. COMPUTED STATE
|
|
56
108
|
// ==========================================
|
|
57
109
|
effectiveColor = computed(() => {
|
|
58
110
|
if (this.primary())
|
|
@@ -71,7 +123,10 @@ class SdBadge {
|
|
|
71
123
|
}, /* @ts-ignore */
|
|
72
124
|
...(ngDevMode ? [{ debugName: "effectiveColor" }] : /* istanbul ignore next */ []));
|
|
73
125
|
accessibleName = computed(() => {
|
|
74
|
-
const
|
|
126
|
+
const type = this.type();
|
|
127
|
+
// why: pair đọc cả nhãn lẫn giá trị ("SLA 4 giờ"); dot chỉ có title; dot/pair bỏ qua description.
|
|
128
|
+
const texts = type === 'pair' ? [this.label(), this.title()] : type === 'dot' ? [this.title()] : [this.title(), this.description()];
|
|
129
|
+
const visibleText = texts
|
|
75
130
|
.filter(value => value !== undefined && value !== null && String(value).trim() !== '')
|
|
76
131
|
.map(value => String(value).trim())
|
|
77
132
|
.join(' ');
|
|
@@ -83,6 +138,18 @@ class SdBadge {
|
|
|
83
138
|
return (this.icon() || this.defaultIcon).replace(/[_-]+/g, ' ').trim();
|
|
84
139
|
}, /* @ts-ignore */
|
|
85
140
|
...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
141
|
+
/** `title` là số (kể cả 0) với type round/solid: số đếm hình tròn, chữ số đều bề rộng. Chuỗi "12" vẫn là chữ. */
|
|
142
|
+
isCount = computed(() => {
|
|
143
|
+
const title = this.title();
|
|
144
|
+
const type = this.type();
|
|
145
|
+
return (type === 'round' || type === 'solid') && typeof title === 'number' && Number.isFinite(title);
|
|
146
|
+
}, /* @ts-ignore */
|
|
147
|
+
...(ngDevMode ? [{ debugName: "isCount" }] : /* istanbul ignore next */ []));
|
|
148
|
+
/** Số đếm lớn hơn 99 thì cần đọc số thật cho screen reader, vì phần nhìn thấy chỉ là "99+". */
|
|
149
|
+
countOverflow = computed(() => this.isCount() && this.title() > SD_BADGE_COUNT_MAX, /* @ts-ignore */
|
|
150
|
+
...(ngDevMode ? [{ debugName: "countOverflow" }] : /* istanbul ignore next */ []));
|
|
151
|
+
displayTitle = computed(() => (this.countOverflow() ? `${SD_BADGE_COUNT_MAX}+` : this.title()), /* @ts-ignore */
|
|
152
|
+
...(ngDevMode ? [{ debugName: "displayTitle" }] : /* istanbul ignore next */ []));
|
|
86
153
|
baseColorClasses = computed(() => {
|
|
87
154
|
const c = this.effectiveColor();
|
|
88
155
|
return {
|
|
@@ -95,17 +162,7 @@ class SdBadge {
|
|
|
95
162
|
};
|
|
96
163
|
}, /* @ts-ignore */
|
|
97
164
|
...(ngDevMode ? [{ debugName: "baseColorClasses" }] : /* istanbul ignore next */ []));
|
|
98
|
-
iconColorClasses = computed(() =>
|
|
99
|
-
const c = this.effectiveColor();
|
|
100
|
-
return {
|
|
101
|
-
'c-primary': c === 'primary',
|
|
102
|
-
'c-secondary': c === 'secondary',
|
|
103
|
-
'c-info': c === 'info',
|
|
104
|
-
'c-success': c === 'success',
|
|
105
|
-
'c-warning': c === 'warning',
|
|
106
|
-
'c-error': c === 'error',
|
|
107
|
-
};
|
|
108
|
-
}, /* @ts-ignore */
|
|
165
|
+
iconColorClasses = computed(() => this.baseColorClasses(), /* @ts-ignore */
|
|
109
166
|
...(ngDevMode ? [{ debugName: "iconColorClasses" }] : /* istanbul ignore next */ []));
|
|
110
167
|
iconSizeAndFontClasses = computed(() => {
|
|
111
168
|
const s = this.size();
|
|
@@ -116,13 +173,16 @@ class SdBadge {
|
|
|
116
173
|
};
|
|
117
174
|
}, /* @ts-ignore */
|
|
118
175
|
...(ngDevMode ? [{ debugName: "iconSizeAndFontClasses" }] : /* istanbul ignore next */ []));
|
|
176
|
+
// why: type icon nằm trong dòng chữ nên to hơn một bậc so với round/tag (thiết kế đợt 3 · 1a).
|
|
119
177
|
iconCssSize = computed(() => {
|
|
120
178
|
const s = this.size();
|
|
179
|
+
if (this.type() === 'icon')
|
|
180
|
+
return s === 'sm' ? '16px' : '18px';
|
|
121
181
|
if (s === 'md')
|
|
122
|
-
return '
|
|
182
|
+
return '16px';
|
|
123
183
|
if (s === 'lg')
|
|
124
|
-
return '
|
|
125
|
-
return '
|
|
184
|
+
return '18px';
|
|
185
|
+
return '14px';
|
|
126
186
|
}, /* @ts-ignore */
|
|
127
187
|
...(ngDevMode ? [{ debugName: "iconCssSize" }] : /* istanbul ignore next */ []));
|
|
128
188
|
// why: keep container size classes separate from icon element size classes.
|
|
@@ -141,7 +201,7 @@ class SdBadge {
|
|
|
141
201
|
...this.baseColorClasses(),
|
|
142
202
|
}), /* @ts-ignore */
|
|
143
203
|
...(ngDevMode ? [{ debugName: "tagIconCombinedClasses" }] : /* istanbul ignore next */ []));
|
|
144
|
-
// GỘP CLASS CHO CONTAINER
|
|
204
|
+
// GỘP CLASS CHO CONTAINER (màu + size modifier), dùng cho cả ba type
|
|
145
205
|
containerCombinedClasses = computed(() => ({
|
|
146
206
|
...this.baseColorClasses(),
|
|
147
207
|
...this.containerSizeClasses(),
|
|
@@ -154,18 +214,524 @@ class SdBadge {
|
|
|
154
214
|
}), /* @ts-ignore */
|
|
155
215
|
...(ngDevMode ? [{ debugName: "iconCombinedClasses" }] : /* istanbul ignore next */ []));
|
|
156
216
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdBadge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
157
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdBadge, isStandalone: true, selector: "sd-badge", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, primary: { classPropertyName: "primary", publicName: "primary", isSignal: true, isRequired: false, transformFunction: null }, secondary: { classPropertyName: "secondary", publicName: "secondary", isSignal: true, isRequired: false, transformFunction: null }, success: { classPropertyName: "success", publicName: "success", isSignal: true, isRequired: false, transformFunction: null }, info: { classPropertyName: "info", publicName: "info", isSignal: true, isRequired: false, transformFunction: null }, warning: { classPropertyName: "warning", publicName: "warning", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, fontSet: { classPropertyName: "fontSet", publicName: "fontSet", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { click: "click" }, ngImport: i0, template: "@let _type = type();\n@let _tooltip = tooltip();\n@let _title = title();\n@let _description = description();\n@let _fontSet = fontSet();\n@let _iconCssSize = iconCssSize();\n@let _accessibleName = accessibleName();\n@let iconName = icon() || defaultIcon;\n@let isPointer = click.observed;\n@let _role = isPointer ? 'button' : null;\n@let _tabIndex = isPointer ? 0 : null;\n\n<!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi c\u1EA3 ba nh\u00E1nh. Badge mang n\u1ED9i dung th\u1EADt (title/description) n\u00EAn\n aria-hidden xo\u00E1 lu\u00F4n n\u1ED9i dung \u0111\u00F3 kh\u1ECFi accessibility tree; khi badge c\u00F2n clickable th\u00EC n\u00F3 v\u1EEBa\n nh\u1EADn focus v\u1EEBa kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC \u2014 t\u1EC7 h\u01A1n l\u00E0 kh\u00F4ng l\u00E0m g\u00EC. Nay role/tabindex/keydown ch\u1EC9 b\u1EADt\n khi th\u1EF1c s\u1EF1 c\u00F3 consumer l\u1EAFng nghe (click). -->\n@if (_type === 'round') {\n <div\n class=\"c-badge\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_tooltip || ''\"\n matTooltipClass=\"sd-multiline-tooltip\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge--has-icon]=\"!!icon()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (icon()) {\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"iconName\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n }\n <span class=\"c-badge-title\">{{ _title }}</span>\n </div>\n} @else if (_type === 'tag') {\n <div\n class=\"c-badge c-badge--tag\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_tooltip || ''\"\n matTooltipClass=\"sd-multiline-tooltip\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <div class=\"c-icon d-flex align-items-center\">\n @if (icon()) {\n <sd-icon\n class=\"c-material-icon mr-4\"\n [name]=\"iconName\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n }\n <div class=\"d-flex flex-column align-items-start\">\n <span class=\"T14R c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"T12R c-badge-description\">{{ _description }}</span>\n }\n </div>\n </div>\n </div>\n} @else {\n <div\n class=\"d-flex\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_tooltip || ''\"\n matTooltipClass=\"sd-multiline-tooltip\"\n [class.c-badge-icon]=\"_type === 'icon'\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <div class=\"c-icon d-flex align-items-center\">\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"iconName\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"iconCombinedClasses()\"></sd-icon>\n <div class=\"c-badge-copy\">\n <span class=\"T14R c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"T10R c-badge-description\">{{ _description }}</span>\n }\n </div>\n </div>\n </div>\n}\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}.c-badge{border-radius:20px;padding:2px 10px;display:inline-block;text-align:center;overflow-wrap:break-word}.c-badge.c-badge--has-icon{display:inline-flex;align-items:center;gap:4px}.c-badge .c-material-icon{display:inline-flex;align-items:center;justify-content:center;padding:0;line-height:1}.c-badge .c-material-icon.c-sm{font-size:16px;width:16px;height:16px}.c-badge .c-material-icon.c-md{font-size:18px;width:18px;height:18px}.c-badge .c-material-icon.c-lg{font-size:24px;width:24px;height:24px}.c-badge.c-badge--sm:not(.c-badge--tag){padding:2px 10px}.c-badge.c-badge--md:not(.c-badge--tag){padding:4px 12px}.c-badge.c-badge--lg:not(.c-badge--tag){padding:6px 16px}.c-badge.c-badge--sm .c-badge-title{font-size:14px}.c-badge.c-badge--md .c-badge-title{font-size:16px}.c-badge.c-badge--lg .c-badge-title{font-size:18px}.c-badge.c-badge--sm .c-badge-description{font-size:12px}.c-badge.c-badge--md .c-badge-description{font-size:13px}.c-badge.c-badge--lg .c-badge-description{font-size:14px}.c-badge.c-primary{background:var(--sd-primary-light);color:var(--sd-primary-dark)}.c-badge.c-primary.c-badge--tag{border:1px solid var(--sd-primary-dark)}.c-badge.c-secondary{background:var(--sd-secondary-light);color:var(--sd-secondary-dark)}.c-badge.c-secondary.c-badge--tag{border:1px solid var(--sd-secondary-dark)}.c-badge.c-info{background:var(--sd-info-light);color:var(--sd-info-dark)}.c-badge.c-info.c-badge--tag{border:1px solid var(--sd-info-dark)}.c-badge.c-warning{background:var(--sd-warning-light);color:var(--sd-warning-dark)}.c-badge.c-warning.c-badge--tag{border:1px solid var(--sd-warning-dark)}.c-badge.c-success{background:var(--sd-success-light);color:var(--sd-success-dark)}.c-badge.c-success.c-badge--tag{border:1px solid var(--sd-success-dark)}.c-badge.c-error{background:var(--sd-error-light);color:var(--sd-error-dark)}.c-badge.c-error.c-badge--tag{border:1px solid var(--sd-error-dark)}.c-badge.c-badge--tag{border-radius:var(--sd-radius-4, 4px);padding:1px 7px}.c-badge.c-badge--tag.c-badge--sm{padding:1px 7px}.c-badge.c-badge--tag.c-badge--md{padding:2px 10px}.c-badge.c-badge--tag.c-badge--lg{padding:4px 12px}.c-badge-icon{display:inline-flex;align-items:center;min-width:0;max-width:100%}.c-badge-icon .c-icon{display:flex;align-items:center;gap:4px;min-width:0;max-width:100%}.c-badge-icon .c-material-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:0;line-height:1}.c-badge-icon .c-material-icon.c-sm{width:16px;height:16px;font-size:16px}.c-badge-icon .c-material-icon.c-md{width:18px;height:18px;font-size:18px}.c-badge-icon .c-material-icon.c-lg{width:24px;height:24px;font-size:24px}.c-badge-icon .c-material-icon.c-primary{color:var(--sd-primary-dark)}.c-badge-icon .c-material-icon.c-secondary{color:var(--sd-secondary-dark)}.c-badge-icon .c-material-icon.c-info{color:var(--sd-info-dark)}.c-badge-icon .c-material-icon.c-success{color:var(--sd-success-dark)}.c-badge-icon .c-material-icon.c-error{color:var(--sd-error-dark)}.c-badge-icon .c-material-icon.c-warning{color:var(--sd-warning-dark)}.c-badge-icon .c-badge-copy{display:flex;flex-direction:column;justify-content:center;min-width:0;overflow-wrap:anywhere}.c-badge-icon .c-badge-title{line-height:var(--sd-line-height-20, 20px)}.c-badge-icon .c-badge-description{line-height:14px}.c-badge-description{color:var(--sd-text-secondary)}:host [role=button]:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px;border-radius:var(--sd-radius-4, 4px)}::ng-deep .sd-multiline-tooltip{white-space:pre-line}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
217
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdBadge, isStandalone: true, selector: "sd-badge", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, primary: { classPropertyName: "primary", publicName: "primary", isSignal: true, isRequired: false, transformFunction: null }, secondary: { classPropertyName: "secondary", publicName: "secondary", isSignal: true, isRequired: false, transformFunction: null }, success: { classPropertyName: "success", publicName: "success", isSignal: true, isRequired: false, transformFunction: null }, info: { classPropertyName: "info", publicName: "info", isSignal: true, isRequired: false, transformFunction: null }, warning: { classPropertyName: "warning", publicName: "warning", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, fontSet: { classPropertyName: "fontSet", publicName: "fontSet", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, pulse: { classPropertyName: "pulse", publicName: "pulse", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { click: "click" }, host: { listeners: { "mouseenter": "measureTruncation()", "focusin": "measureTruncation()" }, properties: { "attr.title": "null" } }, viewQueries: [{ propertyName: "titleRef", first: true, predicate: ["titleEl"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _type = type();\n@let _title = displayTitle();\n@let _description = description();\n@let _fontSet = fontSet();\n@let _iconCssSize = iconCssSize();\n@let _accessibleName = accessibleName();\n@let _icon = icon();\n@let _tooltipText = tooltipText();\n@let _countOverflow = countOverflow();\n@let _pulse = pulse();\n@let isPointer = click.observed;\n@let _role = isPointer ? 'button' : null;\n@let _tabIndex = isPointer ? 0 : null;\n\n<!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi m\u1ECDi nh\u00E1nh. Badge mang n\u1ED9i dung th\u1EADt (title/description) n\u00EAn\n aria-hidden xo\u00E1 lu\u00F4n n\u1ED9i dung \u0111\u00F3 kh\u1ECFi accessibility tree; khi badge c\u00F2n clickable th\u00EC n\u00F3 v\u1EEBa\n nh\u1EADn focus v\u1EEBa kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC \u2014 t\u1EC7 h\u01A1n l\u00E0 kh\u00F4ng l\u00E0m g\u00EC. Nay role/tabindex/keydown ch\u1EC9 b\u1EADt\n khi th\u1EF1c s\u1EF1 c\u00F3 consumer l\u1EAFng nghe (click).\n why: tooltip d\u00F9ng [sdTooltip] thay matTooltip \u2014 overlay ch\u1EC9 t\u1EA1o khi hi\u1EC7n, v\u00E0 ch\u1EC9 c\u00F3 n\u1ED9i dung khi c\u00F3\n `tooltip`, khi ch\u1EEF b\u1ECB c\u1EAFt (\u0111o l\u00FAc hover/focus tr\u00EAn host), ho\u1EB7c v\u1EDBi type dot (title kh\u00F4ng hi\u1EC7n ra). -->\n@if (_type === 'round' || _type === 'solid') {\n <div\n class=\"c-badge\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge--solid]=\"_type === 'solid'\"\n [class.c-badge--has-icon]=\"!!_icon\"\n [class.c-badge--count]=\"isCount()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (_icon) {\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"_icon\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n }\n <!-- why: \"99+\" ch\u1EC9 \u0111\u1EC3 nh\u00ECn; screen reader \u0111\u1ECDc s\u1ED1 th\u1EADt \u1EDF span \u1EA9n ngay sau. -->\n <span #titleEl class=\"c-badge-title\" [attr.aria-hidden]=\"_countOverflow ? 'true' : null\">{{ _title }}</span>\n @if (_countOverflow) {\n <span class=\"sd-visually-hidden\">{{ title() }}</span>\n }\n </div>\n} @else if (_type === 'tag') {\n <div\n class=\"c-badge c-badge--tag\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge--has-desc]=\"!!_description\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (_icon) {\n <span class=\"c-badge-lead\">\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"_icon\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n </span>\n }\n <span class=\"c-badge-copy\">\n <span #titleEl class=\"c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"c-badge-description\">{{ _description }}</span>\n }\n </span>\n </div>\n} @else if (_type === 'pair') {\n <!-- why: nh\u00E3n kh\u00F4ng co l\u1EA1i; qu\u00E1 d\u00E0i th\u00EC ch\u1EC9 ph\u1EA7n gi\u00E1 tr\u1ECB b\u1ECB c\u1EAFt. -->\n <div\n class=\"c-badge c-badge--pair\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (label(); as _label) {\n <span class=\"c-badge-pair-label\">{{ _label }}</span>\n }\n <span #titleEl class=\"c-badge-title\">{{ _title }}</span>\n </div>\n} @else if (_type === 'dot') {\n <!-- why: title kh\u00F4ng hi\u1EC7n ra n\u00EAn ch\u1EA5m t\u1EF1 mang t\u00EAn: role=\"img\" + aria-label khi ch\u1EC9 \u0111\u1EC3 xem, role=\"button\" khi b\u1EA5m\n \u0111\u01B0\u1EE3c. Tooltip lu\u00F4n l\u00E0 title. -->\n <span\n class=\"c-badge-dotonly\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"isPointer ? 'button' : 'img'\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"_accessibleName\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <span class=\"c-badge-dot\" [ngClass]=\"baseColorClasses()\" [class.c-badge-dot--pulse]=\"_pulse\"></span>\n </span>\n} @else {\n <div\n class=\"c-badge-icon\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge-icon--has-desc]=\"!!_description\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <!-- why: \u00F4 d\u1EABn \u0111\u1EA7u cao b\u1EB1ng line-height c\u1EE7a title n\u00EAn icon (ho\u1EB7c ch\u1EA5m) lu\u00F4n n\u1EB1m gi\u1EEFa D\u00D2NG \u0110\u1EA6U, k\u1EC3 c\u1EA3 khi c\u00F3\n description. Kh\u00F4ng c\u00F3 icon th\u00EC v\u1EBD ch\u1EA5m b\u1EB1ng CSS thay cho glyph fiber_manual_record. -->\n <span class=\"c-badge-lead\">\n @if (_icon) {\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"_icon\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"iconCombinedClasses()\"></sd-icon>\n } @else {\n <span class=\"c-badge-dot\" [ngClass]=\"baseColorClasses()\" [class.c-badge-dot--pulse]=\"_pulse\" aria-hidden=\"true\"></span>\n }\n </span>\n <span class=\"c-badge-copy\">\n <span #titleEl class=\"c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"c-badge-description\">{{ _description }}</span>\n }\n </span>\n </div>\n}\n\n<ng-template #tooltipContent>\n <span class=\"c-badge-tooltip\">{{ _tooltipText }}</span>\n</ng-template>\n", styles: [":host{display:inline-flex;vertical-align:middle;max-width:100%;min-width:0}.c-primary{--badge-tone: var(--sd-primary);--badge-tone-light: var(--sd-primary-light);--badge-tone-dark: var(--sd-primary-dark);--badge-tone-contrast: var(--sd-primary-contrast)}.c-secondary{--badge-tone: var(--sd-secondary);--badge-tone-light: var(--sd-secondary-light);--badge-tone-dark: var(--sd-secondary-dark);--badge-tone-contrast: var(--sd-secondary-contrast)}.c-info{--badge-tone: var(--sd-info);--badge-tone-light: var(--sd-info-light);--badge-tone-dark: var(--sd-info-dark);--badge-tone-contrast: var(--sd-info-contrast)}.c-success{--badge-tone: var(--sd-success);--badge-tone-light: var(--sd-success-light);--badge-tone-dark: var(--sd-success-dark);--badge-tone-contrast: var(--sd-success-contrast)}.c-warning{--badge-tone: var(--sd-warning);--badge-tone-light: var(--sd-warning-light);--badge-tone-dark: var(--sd-warning-dark);--badge-tone-contrast: var(--sd-warning-contrast)}.c-error{--badge-tone: var(--sd-error);--badge-tone-light: var(--sd-error-light);--badge-tone-dark: var(--sd-error-dark);--badge-tone-contrast: var(--sd-error-contrast)}.c-badge,.c-badge-icon{display:inline-flex;align-items:center;box-sizing:border-box;max-width:100%;min-width:0;vertical-align:middle}.c-badge-title,.c-badge-description{display:block;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.c-badge-copy{display:flex;flex-direction:column;min-width:0}.c-badge-lead{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}.c-material-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:0;line-height:1}.c-badge-description{font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-weight:400;color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.c-badge{height:var(--sd-badge-height-sm, 20px);gap:4px;padding:0 8px;border-radius:999px;background-color:var(--badge-tone-light);color:var(--badge-tone-dark);outline:1px solid transparent;outline-offset:-1px}.c-badge .c-badge-title{font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-weight:var(--sd-badge-font-weight, 500)}.c-badge .c-material-icon{width:14px;height:14px;font-size:14px}.c-badge.c-badge--has-icon{padding:0 8px 0 6px}.c-badge.c-badge--md{height:var(--sd-badge-height-md, 24px);padding:0 10px}.c-badge.c-badge--md .c-badge-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.c-badge.c-badge--md .c-material-icon{width:16px;height:16px;font-size:16px}.c-badge.c-badge--lg{height:var(--sd-badge-height-lg, 28px);gap:6px;padding:0 12px}.c-badge.c-badge--lg .c-badge-title{font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.c-badge.c-badge--lg .c-material-icon{width:18px;height:18px;font-size:18px}.c-badge.c-badge--count{justify-content:center;min-width:var(--sd-badge-height-sm, 20px);padding:0 6px}.c-badge.c-badge--count .c-badge-title{font-variant-numeric:tabular-nums;text-align:center}.c-badge.c-badge--count.c-badge--md{min-width:var(--sd-badge-height-md, 24px);padding:0 7px}.c-badge.c-badge--count.c-badge--lg{min-width:var(--sd-badge-height-lg, 28px);padding:0 8px}.c-badge.c-badge--tag{padding:0 6px;border:1px solid color-mix(in srgb,var(--badge-tone-dark) 22%,var(--badge-tone-light));border-radius:var(--sd-badge-radius-tag, 4px);outline:none}.c-badge.c-badge--tag.c-badge--md{padding:0 8px;border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--tag.c-badge--lg{padding:0 10px;border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--tag.c-badge--has-desc{align-items:flex-start;height:auto;padding:4px 8px;border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--tag.c-badge--has-desc .c-badge-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.c-badge.c-badge--tag.c-badge--has-desc .c-badge-lead{height:var(--sd-line-height-18, 18px)}.c-badge.c-badge--solid{background-color:var(--badge-tone);color:var(--badge-tone-contrast)}.c-badge.c-badge--pair{align-items:stretch;gap:0;padding:0;overflow:hidden;background-color:transparent;border-radius:var(--sd-badge-radius-tag, 4px)}.c-badge.c-badge--pair .c-badge-pair-label,.c-badge.c-badge--pair .c-badge-title{padding:0 6px;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-badge-height-sm, 20px)}.c-badge.c-badge--pair .c-badge-pair-label{flex:0 0 auto;white-space:nowrap;background-color:var(--sd-secondary-light);color:var(--sd-secondary-dark);font-weight:400}.c-badge.c-badge--pair .c-badge-title{background-color:var(--badge-tone-light);color:var(--badge-tone-dark)}.c-badge.c-badge--pair.c-badge--md{border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--pair.c-badge--md .c-badge-pair-label,.c-badge.c-badge--pair.c-badge--md .c-badge-title{padding:0 8px;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-badge-height-md, 24px)}.c-badge.c-badge--pair.c-badge--lg{border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--pair.c-badge--lg .c-badge-pair-label,.c-badge.c-badge--pair.c-badge--lg .c-badge-title{padding:0 10px;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-badge-height-lg, 28px)}.c-badge.c-badge--md:not(.c-badge--pair,.c-badge--has-desc) .c-badge-title{position:relative;top:1px}.c-badge-dotonly{position:relative;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;border-radius:50%}.c-badge-dotonly.pointer{cursor:pointer}.c-badge-dotonly.pointer:before{content:\"\";position:absolute;top:50%;left:50%;width:20px;height:20px;border-radius:50%;transform:translate(-50%,-50%)}.c-badge-icon{gap:6px;min-height:var(--sd-badge-height-sm, 20px);color:var(--sd-text, rgba(0, 0, 0, .87));border-radius:var(--sd-radius-4, 4px)}.c-badge-icon .c-badge-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);font-weight:400}.c-badge-icon .c-badge-lead{height:var(--sd-line-height-18, 18px)}.c-badge-icon .c-material-icon{width:16px;height:16px;font-size:16px;color:var(--badge-tone-dark)}.c-badge-icon.c-badge--md .c-badge-title,.c-badge-icon.c-badge--lg .c-badge-title{font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.c-badge-icon.c-badge--md .c-badge-lead,.c-badge-icon.c-badge--lg .c-badge-lead{height:var(--sd-line-height-20, 20px)}.c-badge-icon.c-badge--md .c-material-icon,.c-badge-icon.c-badge--lg .c-material-icon{width:18px;height:18px;font-size:18px}.c-badge-icon.c-badge--md{min-height:var(--sd-badge-height-md, 24px)}.c-badge-icon.c-badge--lg{min-height:var(--sd-badge-height-lg, 28px)}.c-badge-icon.c-badge-icon--has-desc{align-items:flex-start}.c-badge-dot{display:block;width:var(--sd-badge-dot-size, 8px);height:var(--sd-badge-dot-size, 8px);border-radius:50%;background-color:var(--badge-tone)}.c-badge-icon.c-badge--lg .c-badge-dot,.c-badge-dotonly.c-badge--lg .c-badge-dot{width:var(--sd-badge-dot-size, 10px);height:var(--sd-badge-dot-size, 10px)}.c-badge-dot--pulse{--badge-halo: color-mix(in srgb, var(--badge-tone) 28%, transparent);box-shadow:0 0 0 3px var(--badge-halo);animation:sd-badge-pulse 1.6s ease-in-out infinite}@keyframes sd-badge-pulse{0%,to{box-shadow:0 0 0 3px var(--badge-halo)}50%{box-shadow:0 0 0 3px transparent}}.c-badge.pointer{--badge-bg-hover: color-mix(in srgb, var(--badge-tone-dark) 6%, var(--badge-tone-light));--badge-bg-active: color-mix(in srgb, var(--badge-tone-dark) 10%, var(--badge-tone-light))}.c-badge-icon.pointer{--badge-bg-hover: color-mix(in srgb, var(--badge-tone-dark) 6%, transparent);--badge-bg-active: color-mix(in srgb, var(--badge-tone-dark) 10%, transparent)}.c-badge.c-badge--solid.pointer{--badge-bg-hover: color-mix(in srgb, var(--badge-tone-dark) 6%, var(--badge-tone));--badge-bg-active: color-mix(in srgb, var(--badge-tone-dark) 10%, var(--badge-tone))}.c-badge.c-badge--pair.pointer:hover .c-badge-pair-label{background-color:color-mix(in srgb,var(--sd-secondary-dark) 6%,var(--sd-secondary-light))}.c-badge.c-badge--pair.pointer:hover .c-badge-title{background-color:color-mix(in srgb,var(--badge-tone-dark) 6%,var(--badge-tone-light))}.c-badge.c-badge--pair.pointer:active .c-badge-pair-label{background-color:color-mix(in srgb,var(--sd-secondary-dark) 10%,var(--sd-secondary-light))}.c-badge.c-badge--pair.pointer:active .c-badge-title{background-color:color-mix(in srgb,var(--badge-tone-dark) 10%,var(--badge-tone-light))}.c-badge.pointer,.c-badge-icon.pointer{cursor:pointer;transition:background-color .12s ease}.c-badge.pointer:hover,.c-badge-icon.pointer:hover{background-color:var(--badge-bg-hover)}.c-badge.pointer:active,.c-badge-icon.pointer:active{background-color:var(--badge-bg-active)}.c-badge[role=button]:focus-visible,.c-badge-icon[role=button]:focus-visible,.c-badge-dotonly[role=button]:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}@media(prefers-reduced-motion:reduce){.c-badge.pointer,.c-badge-icon.pointer{transition:none}.c-badge-dot--pulse{animation:none;box-shadow:0 0 0 3px var(--badge-halo)}}@media(forced-colors:active){.c-badge-dot{forced-color-adjust:none;background-color:CanvasText}}.sd-visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.c-badge-tooltip{white-space:pre-line}::ng-deep .sd-multiline-tooltip{white-space:pre-line}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "directive", type: SdTooltipDirective, selector: "[sdTooltip]", inputs: ["sdTooltip", "sdTooltipPosition", "sdTooltipDelay", "sdTooltipColor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
158
218
|
}
|
|
159
219
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdBadge, decorators: [{
|
|
160
220
|
type: Component,
|
|
161
|
-
args: [{ selector: 'sd-badge', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, SdIcon, MatTooltipModule], template: "@let _type = type();\n@let _tooltip = tooltip();\n@let _title = title();\n@let _description = description();\n@let _fontSet = fontSet();\n@let _iconCssSize = iconCssSize();\n@let _accessibleName = accessibleName();\n@let iconName = icon() || defaultIcon;\n@let isPointer = click.observed;\n@let _role = isPointer ? 'button' : null;\n@let _tabIndex = isPointer ? 0 : null;\n\n<!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi c\u1EA3 ba nh\u00E1nh. Badge mang n\u1ED9i dung th\u1EADt (title/description) n\u00EAn\n aria-hidden xo\u00E1 lu\u00F4n n\u1ED9i dung \u0111\u00F3 kh\u1ECFi accessibility tree; khi badge c\u00F2n clickable th\u00EC n\u00F3 v\u1EEBa\n nh\u1EADn focus v\u1EEBa kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC \u2014 t\u1EC7 h\u01A1n l\u00E0 kh\u00F4ng l\u00E0m g\u00EC. Nay role/tabindex/keydown ch\u1EC9 b\u1EADt\n khi th\u1EF1c s\u1EF1 c\u00F3 consumer l\u1EAFng nghe (click). -->\n@if (_type === 'round') {\n <div\n class=\"c-badge\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_tooltip || ''\"\n matTooltipClass=\"sd-multiline-tooltip\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge--has-icon]=\"!!icon()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (icon()) {\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"iconName\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n }\n <span class=\"c-badge-title\">{{ _title }}</span>\n </div>\n} @else if (_type === 'tag') {\n <div\n class=\"c-badge c-badge--tag\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_tooltip || ''\"\n matTooltipClass=\"sd-multiline-tooltip\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <div class=\"c-icon d-flex align-items-center\">\n @if (icon()) {\n <sd-icon\n class=\"c-material-icon mr-4\"\n [name]=\"iconName\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n }\n <div class=\"d-flex flex-column align-items-start\">\n <span class=\"T14R c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"T12R c-badge-description\">{{ _description }}</span>\n }\n </div>\n </div>\n </div>\n} @else {\n <div\n class=\"d-flex\"\n matTooltipPosition=\"above\"\n [matTooltip]=\"_tooltip || ''\"\n matTooltipClass=\"sd-multiline-tooltip\"\n [class.c-badge-icon]=\"_type === 'icon'\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <div class=\"c-icon d-flex align-items-center\">\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"iconName\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"iconCombinedClasses()\"></sd-icon>\n <div class=\"c-badge-copy\">\n <span class=\"T14R c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"T10R c-badge-description\">{{ _description }}</span>\n }\n </div>\n </div>\n </div>\n}\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}.c-badge{border-radius:20px;padding:2px 10px;display:inline-block;text-align:center;overflow-wrap:break-word}.c-badge.c-badge--has-icon{display:inline-flex;align-items:center;gap:4px}.c-badge .c-material-icon{display:inline-flex;align-items:center;justify-content:center;padding:0;line-height:1}.c-badge .c-material-icon.c-sm{font-size:16px;width:16px;height:16px}.c-badge .c-material-icon.c-md{font-size:18px;width:18px;height:18px}.c-badge .c-material-icon.c-lg{font-size:24px;width:24px;height:24px}.c-badge.c-badge--sm:not(.c-badge--tag){padding:2px 10px}.c-badge.c-badge--md:not(.c-badge--tag){padding:4px 12px}.c-badge.c-badge--lg:not(.c-badge--tag){padding:6px 16px}.c-badge.c-badge--sm .c-badge-title{font-size:14px}.c-badge.c-badge--md .c-badge-title{font-size:16px}.c-badge.c-badge--lg .c-badge-title{font-size:18px}.c-badge.c-badge--sm .c-badge-description{font-size:12px}.c-badge.c-badge--md .c-badge-description{font-size:13px}.c-badge.c-badge--lg .c-badge-description{font-size:14px}.c-badge.c-primary{background:var(--sd-primary-light);color:var(--sd-primary-dark)}.c-badge.c-primary.c-badge--tag{border:1px solid var(--sd-primary-dark)}.c-badge.c-secondary{background:var(--sd-secondary-light);color:var(--sd-secondary-dark)}.c-badge.c-secondary.c-badge--tag{border:1px solid var(--sd-secondary-dark)}.c-badge.c-info{background:var(--sd-info-light);color:var(--sd-info-dark)}.c-badge.c-info.c-badge--tag{border:1px solid var(--sd-info-dark)}.c-badge.c-warning{background:var(--sd-warning-light);color:var(--sd-warning-dark)}.c-badge.c-warning.c-badge--tag{border:1px solid var(--sd-warning-dark)}.c-badge.c-success{background:var(--sd-success-light);color:var(--sd-success-dark)}.c-badge.c-success.c-badge--tag{border:1px solid var(--sd-success-dark)}.c-badge.c-error{background:var(--sd-error-light);color:var(--sd-error-dark)}.c-badge.c-error.c-badge--tag{border:1px solid var(--sd-error-dark)}.c-badge.c-badge--tag{border-radius:var(--sd-radius-4, 4px);padding:1px 7px}.c-badge.c-badge--tag.c-badge--sm{padding:1px 7px}.c-badge.c-badge--tag.c-badge--md{padding:2px 10px}.c-badge.c-badge--tag.c-badge--lg{padding:4px 12px}.c-badge-icon{display:inline-flex;align-items:center;min-width:0;max-width:100%}.c-badge-icon .c-icon{display:flex;align-items:center;gap:4px;min-width:0;max-width:100%}.c-badge-icon .c-material-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:0;line-height:1}.c-badge-icon .c-material-icon.c-sm{width:16px;height:16px;font-size:16px}.c-badge-icon .c-material-icon.c-md{width:18px;height:18px;font-size:18px}.c-badge-icon .c-material-icon.c-lg{width:24px;height:24px;font-size:24px}.c-badge-icon .c-material-icon.c-primary{color:var(--sd-primary-dark)}.c-badge-icon .c-material-icon.c-secondary{color:var(--sd-secondary-dark)}.c-badge-icon .c-material-icon.c-info{color:var(--sd-info-dark)}.c-badge-icon .c-material-icon.c-success{color:var(--sd-success-dark)}.c-badge-icon .c-material-icon.c-error{color:var(--sd-error-dark)}.c-badge-icon .c-material-icon.c-warning{color:var(--sd-warning-dark)}.c-badge-icon .c-badge-copy{display:flex;flex-direction:column;justify-content:center;min-width:0;overflow-wrap:anywhere}.c-badge-icon .c-badge-title{line-height:var(--sd-line-height-20, 20px)}.c-badge-icon .c-badge-description{line-height:14px}.c-badge-description{color:var(--sd-text-secondary)}:host [role=button]:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px;border-radius:var(--sd-radius-4, 4px)}::ng-deep .sd-multiline-tooltip{white-space:pre-line}\n"] }]
|
|
162
|
-
|
|
221
|
+
args: [{ selector: 'sd-badge', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, SdIcon, SdTooltipDirective], host: {
|
|
222
|
+
// why: `<sd-badge title="…">` để lại attribute title trên host, trình duyệt hiện tooltip riêng chồng lên
|
|
223
|
+
// tooltip của badge. Giá trị vẫn tới input `title`.
|
|
224
|
+
'[attr.title]': 'null',
|
|
225
|
+
'(mouseenter)': 'measureTruncation()',
|
|
226
|
+
'(focusin)': 'measureTruncation()',
|
|
227
|
+
}, template: "@let _type = type();\n@let _title = displayTitle();\n@let _description = description();\n@let _fontSet = fontSet();\n@let _iconCssSize = iconCssSize();\n@let _accessibleName = accessibleName();\n@let _icon = icon();\n@let _tooltipText = tooltipText();\n@let _countOverflow = countOverflow();\n@let _pulse = pulse();\n@let isPointer = click.observed;\n@let _role = isPointer ? 'button' : null;\n@let _tabIndex = isPointer ? 0 : null;\n\n<!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi m\u1ECDi nh\u00E1nh. Badge mang n\u1ED9i dung th\u1EADt (title/description) n\u00EAn\n aria-hidden xo\u00E1 lu\u00F4n n\u1ED9i dung \u0111\u00F3 kh\u1ECFi accessibility tree; khi badge c\u00F2n clickable th\u00EC n\u00F3 v\u1EEBa\n nh\u1EADn focus v\u1EEBa kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC \u2014 t\u1EC7 h\u01A1n l\u00E0 kh\u00F4ng l\u00E0m g\u00EC. Nay role/tabindex/keydown ch\u1EC9 b\u1EADt\n khi th\u1EF1c s\u1EF1 c\u00F3 consumer l\u1EAFng nghe (click).\n why: tooltip d\u00F9ng [sdTooltip] thay matTooltip \u2014 overlay ch\u1EC9 t\u1EA1o khi hi\u1EC7n, v\u00E0 ch\u1EC9 c\u00F3 n\u1ED9i dung khi c\u00F3\n `tooltip`, khi ch\u1EEF b\u1ECB c\u1EAFt (\u0111o l\u00FAc hover/focus tr\u00EAn host), ho\u1EB7c v\u1EDBi type dot (title kh\u00F4ng hi\u1EC7n ra). -->\n@if (_type === 'round' || _type === 'solid') {\n <div\n class=\"c-badge\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge--solid]=\"_type === 'solid'\"\n [class.c-badge--has-icon]=\"!!_icon\"\n [class.c-badge--count]=\"isCount()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (_icon) {\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"_icon\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n }\n <!-- why: \"99+\" ch\u1EC9 \u0111\u1EC3 nh\u00ECn; screen reader \u0111\u1ECDc s\u1ED1 th\u1EADt \u1EDF span \u1EA9n ngay sau. -->\n <span #titleEl class=\"c-badge-title\" [attr.aria-hidden]=\"_countOverflow ? 'true' : null\">{{ _title }}</span>\n @if (_countOverflow) {\n <span class=\"sd-visually-hidden\">{{ title() }}</span>\n }\n </div>\n} @else if (_type === 'tag') {\n <div\n class=\"c-badge c-badge--tag\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge--has-desc]=\"!!_description\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (_icon) {\n <span class=\"c-badge-lead\">\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"_icon\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"tagIconCombinedClasses()\"></sd-icon>\n </span>\n }\n <span class=\"c-badge-copy\">\n <span #titleEl class=\"c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"c-badge-description\">{{ _description }}</span>\n }\n </span>\n </div>\n} @else if (_type === 'pair') {\n <!-- why: nh\u00E3n kh\u00F4ng co l\u1EA1i; qu\u00E1 d\u00E0i th\u00EC ch\u1EC9 ph\u1EA7n gi\u00E1 tr\u1ECB b\u1ECB c\u1EAFt. -->\n <div\n class=\"c-badge c-badge--pair\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n @if (label(); as _label) {\n <span class=\"c-badge-pair-label\">{{ _label }}</span>\n }\n <span #titleEl class=\"c-badge-title\">{{ _title }}</span>\n </div>\n} @else if (_type === 'dot') {\n <!-- why: title kh\u00F4ng hi\u1EC7n ra n\u00EAn ch\u1EA5m t\u1EF1 mang t\u00EAn: role=\"img\" + aria-label khi ch\u1EC9 \u0111\u1EC3 xem, role=\"button\" khi b\u1EA5m\n \u0111\u01B0\u1EE3c. Tooltip lu\u00F4n l\u00E0 title. -->\n <span\n class=\"c-badge-dotonly\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"isPointer ? 'button' : 'img'\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"_accessibleName\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <span class=\"c-badge-dot\" [ngClass]=\"baseColorClasses()\" [class.c-badge-dot--pulse]=\"_pulse\"></span>\n </span>\n} @else {\n <div\n class=\"c-badge-icon\"\n sdTooltipPosition=\"top\"\n [sdTooltip]=\"_tooltipText ? tooltipContent : ''\"\n [ngClass]=\"containerCombinedClasses()\"\n [class.c-badge-icon--has-desc]=\"!!_description\"\n [class.pointer]=\"isPointer\"\n [attr.role]=\"_role\"\n [attr.tabindex]=\"_tabIndex\"\n [attr.aria-label]=\"isPointer ? _accessibleName : null\"\n (click)=\"onClick($event)\"\n (keydown.enter)=\"onActivateKey($event)\"\n (keydown.space)=\"onActivateKey($event)\">\n <!-- why: \u00F4 d\u1EABn \u0111\u1EA7u cao b\u1EB1ng line-height c\u1EE7a title n\u00EAn icon (ho\u1EB7c ch\u1EA5m) lu\u00F4n n\u1EB1m gi\u1EEFa D\u00D2NG \u0110\u1EA6U, k\u1EC3 c\u1EA3 khi c\u00F3\n description. Kh\u00F4ng c\u00F3 icon th\u00EC v\u1EBD ch\u1EA5m b\u1EB1ng CSS thay cho glyph fiber_manual_record. -->\n <span class=\"c-badge-lead\">\n @if (_icon) {\n <sd-icon\n class=\"c-material-icon\"\n [name]=\"_icon\"\n [fontSet]=\"_fontSet\"\n [size]=\"_iconCssSize\"\n [ngClass]=\"iconCombinedClasses()\"></sd-icon>\n } @else {\n <span class=\"c-badge-dot\" [ngClass]=\"baseColorClasses()\" [class.c-badge-dot--pulse]=\"_pulse\" aria-hidden=\"true\"></span>\n }\n </span>\n <span class=\"c-badge-copy\">\n <span #titleEl class=\"c-badge-title\">{{ _title }}</span>\n @if (_description) {\n <span class=\"c-badge-description\">{{ _description }}</span>\n }\n </span>\n </div>\n}\n\n<ng-template #tooltipContent>\n <span class=\"c-badge-tooltip\">{{ _tooltipText }}</span>\n</ng-template>\n", styles: [":host{display:inline-flex;vertical-align:middle;max-width:100%;min-width:0}.c-primary{--badge-tone: var(--sd-primary);--badge-tone-light: var(--sd-primary-light);--badge-tone-dark: var(--sd-primary-dark);--badge-tone-contrast: var(--sd-primary-contrast)}.c-secondary{--badge-tone: var(--sd-secondary);--badge-tone-light: var(--sd-secondary-light);--badge-tone-dark: var(--sd-secondary-dark);--badge-tone-contrast: var(--sd-secondary-contrast)}.c-info{--badge-tone: var(--sd-info);--badge-tone-light: var(--sd-info-light);--badge-tone-dark: var(--sd-info-dark);--badge-tone-contrast: var(--sd-info-contrast)}.c-success{--badge-tone: var(--sd-success);--badge-tone-light: var(--sd-success-light);--badge-tone-dark: var(--sd-success-dark);--badge-tone-contrast: var(--sd-success-contrast)}.c-warning{--badge-tone: var(--sd-warning);--badge-tone-light: var(--sd-warning-light);--badge-tone-dark: var(--sd-warning-dark);--badge-tone-contrast: var(--sd-warning-contrast)}.c-error{--badge-tone: var(--sd-error);--badge-tone-light: var(--sd-error-light);--badge-tone-dark: var(--sd-error-dark);--badge-tone-contrast: var(--sd-error-contrast)}.c-badge,.c-badge-icon{display:inline-flex;align-items:center;box-sizing:border-box;max-width:100%;min-width:0;vertical-align:middle}.c-badge-title,.c-badge-description{display:block;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.c-badge-copy{display:flex;flex-direction:column;min-width:0}.c-badge-lead{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}.c-material-icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:0;line-height:1}.c-badge-description{font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-weight:400;color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.c-badge{height:var(--sd-badge-height-sm, 20px);gap:4px;padding:0 8px;border-radius:999px;background-color:var(--badge-tone-light);color:var(--badge-tone-dark);outline:1px solid transparent;outline-offset:-1px}.c-badge .c-badge-title{font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-weight:var(--sd-badge-font-weight, 500)}.c-badge .c-material-icon{width:14px;height:14px;font-size:14px}.c-badge.c-badge--has-icon{padding:0 8px 0 6px}.c-badge.c-badge--md{height:var(--sd-badge-height-md, 24px);padding:0 10px}.c-badge.c-badge--md .c-badge-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.c-badge.c-badge--md .c-material-icon{width:16px;height:16px;font-size:16px}.c-badge.c-badge--lg{height:var(--sd-badge-height-lg, 28px);gap:6px;padding:0 12px}.c-badge.c-badge--lg .c-badge-title{font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.c-badge.c-badge--lg .c-material-icon{width:18px;height:18px;font-size:18px}.c-badge.c-badge--count{justify-content:center;min-width:var(--sd-badge-height-sm, 20px);padding:0 6px}.c-badge.c-badge--count .c-badge-title{font-variant-numeric:tabular-nums;text-align:center}.c-badge.c-badge--count.c-badge--md{min-width:var(--sd-badge-height-md, 24px);padding:0 7px}.c-badge.c-badge--count.c-badge--lg{min-width:var(--sd-badge-height-lg, 28px);padding:0 8px}.c-badge.c-badge--tag{padding:0 6px;border:1px solid color-mix(in srgb,var(--badge-tone-dark) 22%,var(--badge-tone-light));border-radius:var(--sd-badge-radius-tag, 4px);outline:none}.c-badge.c-badge--tag.c-badge--md{padding:0 8px;border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--tag.c-badge--lg{padding:0 10px;border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--tag.c-badge--has-desc{align-items:flex-start;height:auto;padding:4px 8px;border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--tag.c-badge--has-desc .c-badge-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.c-badge.c-badge--tag.c-badge--has-desc .c-badge-lead{height:var(--sd-line-height-18, 18px)}.c-badge.c-badge--solid{background-color:var(--badge-tone);color:var(--badge-tone-contrast)}.c-badge.c-badge--pair{align-items:stretch;gap:0;padding:0;overflow:hidden;background-color:transparent;border-radius:var(--sd-badge-radius-tag, 4px)}.c-badge.c-badge--pair .c-badge-pair-label,.c-badge.c-badge--pair .c-badge-title{padding:0 6px;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-badge-height-sm, 20px)}.c-badge.c-badge--pair .c-badge-pair-label{flex:0 0 auto;white-space:nowrap;background-color:var(--sd-secondary-light);color:var(--sd-secondary-dark);font-weight:400}.c-badge.c-badge--pair .c-badge-title{background-color:var(--badge-tone-light);color:var(--badge-tone-dark)}.c-badge.c-badge--pair.c-badge--md{border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--pair.c-badge--md .c-badge-pair-label,.c-badge.c-badge--pair.c-badge--md .c-badge-title{padding:0 8px;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-badge-height-md, 24px)}.c-badge.c-badge--pair.c-badge--lg{border-radius:calc(var(--sd-badge-radius-tag, 4px) + 2px)}.c-badge.c-badge--pair.c-badge--lg .c-badge-pair-label,.c-badge.c-badge--pair.c-badge--lg .c-badge-title{padding:0 10px;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-badge-height-lg, 28px)}.c-badge.c-badge--md:not(.c-badge--pair,.c-badge--has-desc) .c-badge-title{position:relative;top:1px}.c-badge-dotonly{position:relative;display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;border-radius:50%}.c-badge-dotonly.pointer{cursor:pointer}.c-badge-dotonly.pointer:before{content:\"\";position:absolute;top:50%;left:50%;width:20px;height:20px;border-radius:50%;transform:translate(-50%,-50%)}.c-badge-icon{gap:6px;min-height:var(--sd-badge-height-sm, 20px);color:var(--sd-text, rgba(0, 0, 0, .87));border-radius:var(--sd-radius-4, 4px)}.c-badge-icon .c-badge-title{font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);font-weight:400}.c-badge-icon .c-badge-lead{height:var(--sd-line-height-18, 18px)}.c-badge-icon .c-material-icon{width:16px;height:16px;font-size:16px;color:var(--badge-tone-dark)}.c-badge-icon.c-badge--md .c-badge-title,.c-badge-icon.c-badge--lg .c-badge-title{font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.c-badge-icon.c-badge--md .c-badge-lead,.c-badge-icon.c-badge--lg .c-badge-lead{height:var(--sd-line-height-20, 20px)}.c-badge-icon.c-badge--md .c-material-icon,.c-badge-icon.c-badge--lg .c-material-icon{width:18px;height:18px;font-size:18px}.c-badge-icon.c-badge--md{min-height:var(--sd-badge-height-md, 24px)}.c-badge-icon.c-badge--lg{min-height:var(--sd-badge-height-lg, 28px)}.c-badge-icon.c-badge-icon--has-desc{align-items:flex-start}.c-badge-dot{display:block;width:var(--sd-badge-dot-size, 8px);height:var(--sd-badge-dot-size, 8px);border-radius:50%;background-color:var(--badge-tone)}.c-badge-icon.c-badge--lg .c-badge-dot,.c-badge-dotonly.c-badge--lg .c-badge-dot{width:var(--sd-badge-dot-size, 10px);height:var(--sd-badge-dot-size, 10px)}.c-badge-dot--pulse{--badge-halo: color-mix(in srgb, var(--badge-tone) 28%, transparent);box-shadow:0 0 0 3px var(--badge-halo);animation:sd-badge-pulse 1.6s ease-in-out infinite}@keyframes sd-badge-pulse{0%,to{box-shadow:0 0 0 3px var(--badge-halo)}50%{box-shadow:0 0 0 3px transparent}}.c-badge.pointer{--badge-bg-hover: color-mix(in srgb, var(--badge-tone-dark) 6%, var(--badge-tone-light));--badge-bg-active: color-mix(in srgb, var(--badge-tone-dark) 10%, var(--badge-tone-light))}.c-badge-icon.pointer{--badge-bg-hover: color-mix(in srgb, var(--badge-tone-dark) 6%, transparent);--badge-bg-active: color-mix(in srgb, var(--badge-tone-dark) 10%, transparent)}.c-badge.c-badge--solid.pointer{--badge-bg-hover: color-mix(in srgb, var(--badge-tone-dark) 6%, var(--badge-tone));--badge-bg-active: color-mix(in srgb, var(--badge-tone-dark) 10%, var(--badge-tone))}.c-badge.c-badge--pair.pointer:hover .c-badge-pair-label{background-color:color-mix(in srgb,var(--sd-secondary-dark) 6%,var(--sd-secondary-light))}.c-badge.c-badge--pair.pointer:hover .c-badge-title{background-color:color-mix(in srgb,var(--badge-tone-dark) 6%,var(--badge-tone-light))}.c-badge.c-badge--pair.pointer:active .c-badge-pair-label{background-color:color-mix(in srgb,var(--sd-secondary-dark) 10%,var(--sd-secondary-light))}.c-badge.c-badge--pair.pointer:active .c-badge-title{background-color:color-mix(in srgb,var(--badge-tone-dark) 10%,var(--badge-tone-light))}.c-badge.pointer,.c-badge-icon.pointer{cursor:pointer;transition:background-color .12s ease}.c-badge.pointer:hover,.c-badge-icon.pointer:hover{background-color:var(--badge-bg-hover)}.c-badge.pointer:active,.c-badge-icon.pointer:active{background-color:var(--badge-bg-active)}.c-badge[role=button]:focus-visible,.c-badge-icon[role=button]:focus-visible,.c-badge-dotonly[role=button]:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}@media(prefers-reduced-motion:reduce){.c-badge.pointer,.c-badge-icon.pointer{transition:none}.c-badge-dot--pulse{animation:none;box-shadow:0 0 0 3px var(--badge-halo)}}@media(forced-colors:active){.c-badge-dot{forced-color-adjust:none;background-color:CanvasText}}.sd-visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.c-badge-tooltip{white-space:pre-line}::ng-deep .sd-multiline-tooltip{white-space:pre-line}\n"] }]
|
|
228
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], primary: [{ type: i0.Input, args: [{ isSignal: true, alias: "primary", required: false }] }], secondary: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondary", required: false }] }], success: [{ type: i0.Input, args: [{ isSignal: true, alias: "success", required: false }] }], info: [{ type: i0.Input, args: [{ isSignal: true, alias: "info", required: false }] }], warning: [{ type: i0.Input, args: [{ isSignal: true, alias: "warning", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], fontSet: [{ type: i0.Input, args: [{ isSignal: true, alias: "fontSet", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], pulse: [{ type: i0.Input, args: [{ isSignal: true, alias: "pulse", required: false }] }], click: [{
|
|
163
229
|
type: Output
|
|
164
|
-
}] } });
|
|
230
|
+
}], titleRef: [{ type: i0.ViewChild, args: ['titleEl', { isSignal: true }] }] } });
|
|
231
|
+
|
|
232
|
+
/** Sáu type của `sd-badge`, theo thứ tự hiện trong `sd-badge-picker`. */
|
|
233
|
+
const SD_BADGE_TYPE_OPTIONS = [
|
|
234
|
+
{ value: 'icon', labelKey: 'core.component.badge.type.icon', descriptionKey: 'core.component.badge.type.icon.description' },
|
|
235
|
+
{ value: 'round', labelKey: 'core.component.badge.type.round', descriptionKey: 'core.component.badge.type.round.description' },
|
|
236
|
+
{ value: 'tag', labelKey: 'core.component.badge.type.tag', descriptionKey: 'core.component.badge.type.tag.description' },
|
|
237
|
+
{ value: 'solid', labelKey: 'core.component.badge.type.solid', descriptionKey: 'core.component.badge.type.solid.description' },
|
|
238
|
+
{ value: 'dot', labelKey: 'core.component.badge.type.dot', descriptionKey: 'core.component.badge.type.dot.description' },
|
|
239
|
+
{ value: 'pair', labelKey: 'core.component.badge.type.pair', descriptionKey: 'core.component.badge.type.pair.description' },
|
|
240
|
+
];
|
|
241
|
+
/** Lưới icon mặc định của `sd-badge-picker` (23 icon, theo `badge.md` của thiết kế đợt 3). */
|
|
242
|
+
const SD_BADGE_ICON_PRESET = [
|
|
243
|
+
'check_circle',
|
|
244
|
+
'cancel',
|
|
245
|
+
'schedule',
|
|
246
|
+
'error',
|
|
247
|
+
'warning',
|
|
248
|
+
'info',
|
|
249
|
+
'sync',
|
|
250
|
+
'flag',
|
|
251
|
+
'star',
|
|
252
|
+
'bolt',
|
|
253
|
+
'lock',
|
|
254
|
+
'visibility',
|
|
255
|
+
'edit_note',
|
|
256
|
+
'label',
|
|
257
|
+
'sell',
|
|
258
|
+
'local_shipping',
|
|
259
|
+
'payments',
|
|
260
|
+
'inventory_2',
|
|
261
|
+
'person',
|
|
262
|
+
'group',
|
|
263
|
+
'task_alt',
|
|
264
|
+
'hourglass_empty',
|
|
265
|
+
'pause_circle',
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
const SD_BADGE_PICKER_TYPES = SD_BADGE_TYPE_OPTIONS.map(option => option.value);
|
|
269
|
+
const SD_BADGE_PICKER_COLORS = ['primary', 'secondary', 'info', 'success', 'warning', 'error'];
|
|
270
|
+
/** Bản nháp của lần mở đầu tiên khi chưa có giá trị. */
|
|
271
|
+
const SD_BADGE_PICKER_FIRST_DRAFT = { type: 'round', color: 'secondary', icon: null };
|
|
272
|
+
let nextBadgePickerId = 0;
|
|
273
|
+
/** `dot` và `pair` không có icon: panel ẩn phần icon, nhưng giá trị `icon` vẫn được giữ. */
|
|
274
|
+
function hasIcon(type) {
|
|
275
|
+
return type !== 'dot' && type !== 'pair';
|
|
276
|
+
}
|
|
277
|
+
function sameValue(left, right) {
|
|
278
|
+
if (!left || !right)
|
|
279
|
+
return !left && !right;
|
|
280
|
+
return left.type === right.type && left.color === right.color && (left.icon ?? null) === (right.icon ?? null);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Trigger của `sd-badge-picker` trong `mat-form-field`: cung cấp `MatFormFieldControl` để field có label nổi, viền,
|
|
284
|
+
* vòng focus, lỗi và cỡ y như `sd-select`.
|
|
285
|
+
*
|
|
286
|
+
* Nội bộ (`ɵ`): không nằm trong SemVer, ứng dụng không dùng trực tiếp.
|
|
287
|
+
*/
|
|
288
|
+
// why: không khai `implements MatFormFieldControl` — interface đó thêm member qua các major Material (19 → 22) mà nguồn
|
|
289
|
+
// v19 được dùng cho cả bốn line; mat-form-field chỉ đọc các thuộc tính dưới đây lúc chạy.
|
|
290
|
+
class ɵSdBadgePickerControlDirective {
|
|
291
|
+
#picker = inject(SdBadgePicker);
|
|
292
|
+
stateChanges = new Subject();
|
|
293
|
+
id = `sd-badge-picker-${++nextBadgePickerId}`;
|
|
294
|
+
ngControl = null;
|
|
295
|
+
controlType = 'sd-badge-picker';
|
|
296
|
+
autofilled = false;
|
|
297
|
+
/** Id của hint/lỗi mà mat-form-field nối vào; trigger đọc lại cho `aria-describedby`. */
|
|
298
|
+
describedBy = signal(null, /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
300
|
+
constructor() {
|
|
301
|
+
// why: mat-form-field là OnPush và đọc các getter dưới đây; báo cho nó mỗi khi một thứ field hiển thị đổi.
|
|
302
|
+
effect(() => {
|
|
303
|
+
this.#picker.value();
|
|
304
|
+
this.#picker.isOpen();
|
|
305
|
+
this.#picker.triggerFocused();
|
|
306
|
+
this.#picker.connectorState();
|
|
307
|
+
untracked(() => this.stateChanges.next());
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
get value() {
|
|
311
|
+
return this.#picker.value();
|
|
312
|
+
}
|
|
313
|
+
get placeholder() {
|
|
314
|
+
return this.#picker.effectivePlaceholder();
|
|
315
|
+
}
|
|
316
|
+
get focused() {
|
|
317
|
+
return this.#picker.triggerFocused() || this.#picker.isOpen();
|
|
318
|
+
}
|
|
319
|
+
get empty() {
|
|
320
|
+
return !this.#picker.value();
|
|
321
|
+
}
|
|
322
|
+
// why: theo thiết kế label chỉ nổi khi có giá trị hoặc panel đang mở — focus trigger thôi thì chưa nổi.
|
|
323
|
+
get shouldLabelFloat() {
|
|
324
|
+
return !this.empty || this.#picker.isOpen();
|
|
325
|
+
}
|
|
326
|
+
get required() {
|
|
327
|
+
return this.#picker.required();
|
|
328
|
+
}
|
|
329
|
+
get disabled() {
|
|
330
|
+
return this.#picker.connectorState().disabled;
|
|
331
|
+
}
|
|
332
|
+
get errorState() {
|
|
333
|
+
return !!this.#picker.visibleErrorMessage();
|
|
334
|
+
}
|
|
335
|
+
setDescribedByIds(ids) {
|
|
336
|
+
this.describedBy.set(ids.length ? ids.join(' ') : null);
|
|
337
|
+
}
|
|
338
|
+
onContainerClick() {
|
|
339
|
+
this.#picker.onContainerClick();
|
|
340
|
+
}
|
|
341
|
+
ngOnDestroy() {
|
|
342
|
+
this.stateChanges.complete();
|
|
343
|
+
}
|
|
344
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdBadgePickerControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
345
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: ɵSdBadgePickerControlDirective, isStandalone: true, selector: "[sdBadgePickerControl]", providers: [{ provide: MatFormFieldControl, useExisting: ɵSdBadgePickerControlDirective }], exportAs: ["sdBadgePickerControl"], ngImport: i0 });
|
|
346
|
+
}
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdBadgePickerControlDirective, decorators: [{
|
|
348
|
+
type: Directive,
|
|
349
|
+
args: [{
|
|
350
|
+
selector: '[sdBadgePickerControl]',
|
|
351
|
+
standalone: true,
|
|
352
|
+
exportAs: 'sdBadgePickerControl',
|
|
353
|
+
providers: [{ provide: MatFormFieldControl, useExisting: ɵSdBadgePickerControlDirective }],
|
|
354
|
+
}]
|
|
355
|
+
}], ctorParameters: () => [] });
|
|
356
|
+
class SdBadgePicker {
|
|
357
|
+
#i18n = inject(I18nService);
|
|
358
|
+
#formConfiguration = inject(SD_FORM_CONFIGURATION, { optional: true });
|
|
359
|
+
#host = inject(ElementRef).nativeElement;
|
|
360
|
+
// ==========================================
|
|
361
|
+
// 1. MODELS, INPUTS, OUTPUTS
|
|
362
|
+
// ==========================================
|
|
363
|
+
/** Type đã ghi. Ghi khi panel đóng; trống thì trigger hiện label/placeholder. */
|
|
364
|
+
type = model(undefined, /* @ts-ignore */
|
|
365
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
366
|
+
/** Màu đã ghi. Ghi khi panel đóng. */
|
|
367
|
+
color = model(undefined, /* @ts-ignore */
|
|
368
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
369
|
+
/** Icon đã ghi. Ghi khi panel đóng; `dot` và `pair` bỏ qua nhưng vẫn giữ giá trị. */
|
|
370
|
+
icon = model(null, /* @ts-ignore */
|
|
371
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
372
|
+
previewTitle = input(/* @ts-ignore */
|
|
373
|
+
...(ngDevMode ? [undefined, { debugName: "previewTitle" }] : /* istanbul ignore next */ []));
|
|
374
|
+
previewDescription = input(/* @ts-ignore */
|
|
375
|
+
...(ngDevMode ? [undefined, { debugName: "previewDescription" }] : /* istanbul ignore next */ []));
|
|
376
|
+
types = input(SD_BADGE_PICKER_TYPES, { ...(ngDevMode ? { debugName: "types" } : /* istanbul ignore next */ {}), transform: value => (value?.length ? value : SD_BADGE_PICKER_TYPES) });
|
|
377
|
+
colors = input(SD_BADGE_PICKER_COLORS, { ...(ngDevMode ? { debugName: "colors" } : /* istanbul ignore next */ {}), transform: value => (value?.length ? value : SD_BADGE_PICKER_COLORS) });
|
|
378
|
+
icons = input(SD_BADGE_ICON_PRESET, { ...(ngDevMode ? { debugName: "icons" } : /* istanbul ignore next */ {}), transform: value => value ?? SD_BADGE_ICON_PRESET });
|
|
379
|
+
form = input(undefined, { ...(ngDevMode ? { debugName: "form" } : /* istanbul ignore next */ {}), transform: _sdCoerceFormGroup });
|
|
380
|
+
name = input(Utilities.generateUuid(), /* @ts-ignore */
|
|
381
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
382
|
+
size = input('md', { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), transform: value => value || 'md' });
|
|
383
|
+
floatLabel = input('auto', { ...(ngDevMode ? { debugName: "floatLabel" } : /* istanbul ignore next */ {}), transform: value => value || 'auto' });
|
|
384
|
+
/** `'float'` (mặc định) hoặc `'top'` — nhãn tĩnh phía trên, helper text dưới control. */
|
|
385
|
+
labelPlacement = input('float', /* @ts-ignore */
|
|
386
|
+
...(ngDevMode ? [{ debugName: "labelPlacement" }] : /* istanbul ignore next */ []));
|
|
387
|
+
appearanceInput = input(undefined, { ...(ngDevMode ? { debugName: "appearanceInput" } : /* istanbul ignore next */ {}), alias: 'appearance' });
|
|
388
|
+
appearance = computed(() => this.appearanceInput() ?? this.#formConfiguration?.appearance ?? 'outline', /* @ts-ignore */
|
|
389
|
+
...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
390
|
+
label = input(/* @ts-ignore */
|
|
391
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
392
|
+
placeholder = input(/* @ts-ignore */
|
|
393
|
+
...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
394
|
+
helperText = input(/* @ts-ignore */
|
|
395
|
+
...(ngDevMode ? [undefined, { debugName: "helperText" }] : /* istanbul ignore next */ []));
|
|
396
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
397
|
+
validator = input(/* @ts-ignore */
|
|
398
|
+
...(ngDevMode ? [undefined, { debugName: "validator" }] : /* istanbul ignore next */ []));
|
|
399
|
+
inlineError = input(/* @ts-ignore */
|
|
400
|
+
...(ngDevMode ? [undefined, { debugName: "inlineError" }] : /* istanbul ignore next */ []));
|
|
401
|
+
hideInlineError = input(false, { ...(ngDevMode ? { debugName: "hideInlineError" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
402
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
403
|
+
viewed = input(false, { ...(ngDevMode ? { debugName: "viewed" } : /* istanbul ignore next */ {}), transform: sdViewedTransform });
|
|
404
|
+
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
405
|
+
autoId = computed(() => (this.autoIdInput() ? `components-badge-picker-${this.autoIdInput()}` : undefined), /* @ts-ignore */
|
|
406
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
407
|
+
/** Phát một lần khi panel đóng và giá trị đổi. Esc không phát. */
|
|
408
|
+
sdChange = output();
|
|
409
|
+
// ==========================================
|
|
410
|
+
// 2. VALUE & FORM
|
|
411
|
+
// ==========================================
|
|
412
|
+
/** `{ type, color, icon }` đã ghi, hoặc `null` khi chưa có type. */
|
|
413
|
+
value = computed(() => {
|
|
414
|
+
const type = this.type();
|
|
415
|
+
return type ? { type, color: this.color() ?? 'secondary', icon: this.icon() ?? null } : null;
|
|
416
|
+
}, /* @ts-ignore */
|
|
417
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
418
|
+
formControl = new SdFormControl();
|
|
419
|
+
#state = sdFormControlState(computed(() => this.formControl));
|
|
420
|
+
// why: required và inlineError đọc VÔ ĐIỀU KIỆN, cùng lý do như sd-select — connector cài/gỡ validator với
|
|
421
|
+
// emitEvent false nên `#state` không tick.
|
|
422
|
+
errorMessage = computed(() => {
|
|
423
|
+
void this.#state();
|
|
424
|
+
void this.required();
|
|
425
|
+
const inlineError = this.inlineError();
|
|
426
|
+
const errors = this.formControl.errors;
|
|
427
|
+
if (!errors)
|
|
428
|
+
return undefined;
|
|
429
|
+
if (errors['required'])
|
|
430
|
+
return this.#i18n.t('core.component.badge.picker.required');
|
|
431
|
+
if (errors['customValidator'])
|
|
432
|
+
return errors['customValidator'];
|
|
433
|
+
if (errors['inlineError'])
|
|
434
|
+
return inlineError;
|
|
435
|
+
return undefined;
|
|
436
|
+
}, /* @ts-ignore */
|
|
437
|
+
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
438
|
+
#connector = _sdFormControlConnector({
|
|
439
|
+
form: this.form,
|
|
440
|
+
name: this.name,
|
|
441
|
+
control: computed(() => this.formControl),
|
|
442
|
+
model: this.value,
|
|
443
|
+
writeModel: value => this.#writeModels(value),
|
|
444
|
+
modelEquals: sameValue,
|
|
445
|
+
controlEquals: sameValue,
|
|
446
|
+
validators: computed(() => (this.inlineError() ? [SdInlineErrorValidator] : null)),
|
|
447
|
+
asyncValidators: computed(() => {
|
|
448
|
+
const custom = this.validator();
|
|
449
|
+
return custom ? [HandleSdCustomValidator(custom)] : null;
|
|
450
|
+
}),
|
|
451
|
+
required: this.required,
|
|
452
|
+
disabled: this.disabled,
|
|
453
|
+
viewed: this.viewed,
|
|
454
|
+
validationError: this.errorMessage,
|
|
455
|
+
});
|
|
456
|
+
connectorState = this.#connector.state;
|
|
457
|
+
/** Message lỗi đã gate theo tương tác (`undefined` cho tới khi control touched/dirty). */
|
|
458
|
+
visibleErrorMessage = computed(() => this.connectorState().validationError, /* @ts-ignore */
|
|
459
|
+
...(ngDevMode ? [{ debugName: "visibleErrorMessage" }] : /* istanbul ignore next */ []));
|
|
460
|
+
errorId = `sd-badge-picker-error-${Utilities.generateUuid()}`;
|
|
461
|
+
hintId = `sd-badge-picker-hint-${Utilities.generateUuid()}`;
|
|
462
|
+
panelId = `sd-badge-picker-panel-${Utilities.generateUuid()}`;
|
|
463
|
+
typeGroupId = `${this.panelId}-type`;
|
|
464
|
+
colorGroupId = `${this.panelId}-color`;
|
|
465
|
+
iconGroupId = `${this.panelId}-icon`;
|
|
466
|
+
// ==========================================
|
|
467
|
+
// 3. DISPLAY
|
|
468
|
+
// ==========================================
|
|
469
|
+
effectivePlaceholder = computed(() => this.placeholder() || this.#i18n.t('core.component.badge.picker.placeholder'), /* @ts-ignore */
|
|
470
|
+
...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []));
|
|
471
|
+
effectivePreviewTitle = computed(() => this.previewTitle() || this.#i18n.t('core.component.badge.picker.preview-title'), /* @ts-ignore */
|
|
472
|
+
...(ngDevMode ? [{ debugName: "effectivePreviewTitle" }] : /* istanbul ignore next */ []));
|
|
473
|
+
/** Nhãn mẫu cho bản xem trước của `pair`. */
|
|
474
|
+
pairLabel = computed(() => this.#i18n.t('core.component.badge.picker.pair-label'), /* @ts-ignore */
|
|
475
|
+
...(ngDevMode ? [{ debugName: "pairLabel" }] : /* istanbul ignore next */ []));
|
|
476
|
+
/** Control lg (48px) dùng badge cỡ md, sm và md dùng cỡ sm. */
|
|
477
|
+
triggerBadgeSize = computed(() => (this.size() === 'lg' ? 'md' : 'sm'), /* @ts-ignore */
|
|
478
|
+
...(ngDevMode ? [{ debugName: "triggerBadgeSize" }] : /* istanbul ignore next */ []));
|
|
479
|
+
summary = computed(() => {
|
|
480
|
+
const value = this.value();
|
|
481
|
+
if (!value)
|
|
482
|
+
return '';
|
|
483
|
+
const parts = [this.typeLabel(value.type), this.colorLabel(value.color)];
|
|
484
|
+
if (hasIcon(value.type))
|
|
485
|
+
parts.push(value.icon || this.#i18n.t('core.component.badge.picker.no-icon'));
|
|
486
|
+
return parts.join(' · ');
|
|
487
|
+
}, /* @ts-ignore */
|
|
488
|
+
...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
|
|
489
|
+
// why: label chiếm chỗ của placeholder cho tới khi nó nổi lên (giá trị, panel mở, hoặc floatLabel always).
|
|
490
|
+
showPlaceholder = computed(() => !this.value() && (this.isOpen() || this.floatLabel() === 'always' || !this.label()), /* @ts-ignore */
|
|
491
|
+
...(ngDevMode ? [{ debugName: "showPlaceholder" }] : /* istanbul ignore next */ []));
|
|
492
|
+
typeLabel = (type) => this.#i18n.t(`core.component.badge.type.${type}`);
|
|
493
|
+
/** Câu gợi ý Esc ở chân panel, tách quanh `{key}` để phím Esc vẽ như nắp phím (review 2026-10-22). */
|
|
494
|
+
escHint = computed(() => this.#i18n.t('core.component.badge.picker.esc-hint').split('{key}'), /* @ts-ignore */
|
|
495
|
+
...(ngDevMode ? [{ debugName: "escHint" }] : /* istanbul ignore next */ []));
|
|
496
|
+
colorLabel = (color) => this.#i18n.t(`core.component.badge.color.${color}`);
|
|
497
|
+
/** Icon thực sự đưa vào `sd-badge` (type không có icon thì không truyền). */
|
|
498
|
+
iconOf = (value) => (hasIcon(value.type) ? value.icon : null);
|
|
499
|
+
// ==========================================
|
|
500
|
+
// 4. PANEL
|
|
501
|
+
// ==========================================
|
|
502
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
503
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
504
|
+
triggerFocused = signal(false, /* @ts-ignore */
|
|
505
|
+
...(ngDevMode ? [{ debugName: "triggerFocused" }] : /* istanbul ignore next */ []));
|
|
506
|
+
draft = signal(SD_BADGE_PICKER_FIRST_DRAFT, /* @ts-ignore */
|
|
507
|
+
...(ngDevMode ? [{ debugName: "draft" }] : /* istanbul ignore next */ []));
|
|
508
|
+
iconQuery = signal('', /* @ts-ignore */
|
|
509
|
+
...(ngDevMode ? [{ debugName: "iconQuery" }] : /* istanbul ignore next */ []));
|
|
510
|
+
#openedFrom = SD_BADGE_PICKER_FIRST_DRAFT;
|
|
511
|
+
field = viewChild(MatFormField, /* @ts-ignore */
|
|
512
|
+
...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
513
|
+
triggerRef = viewChild('trigger', /* @ts-ignore */
|
|
514
|
+
...(ngDevMode ? [{ debugName: "triggerRef" }] : /* istanbul ignore next */ []));
|
|
515
|
+
panelRef = viewChild('panel', /* @ts-ignore */
|
|
516
|
+
...(ngDevMode ? [{ debugName: "panelRef" }] : /* istanbul ignore next */ []));
|
|
517
|
+
overlayOrigin = computed(() => this.field()?.getConnectedOverlayOrigin(), /* @ts-ignore */
|
|
518
|
+
...(ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []));
|
|
519
|
+
positions = [
|
|
520
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 6 },
|
|
521
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -6 },
|
|
522
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 6 },
|
|
523
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -6 },
|
|
524
|
+
];
|
|
525
|
+
typeOptions = computed(() => {
|
|
526
|
+
const allowed = this.types();
|
|
527
|
+
return SD_BADGE_TYPE_OPTIONS.filter(option => allowed.includes(option.value)).map(option => ({
|
|
528
|
+
value: option.value,
|
|
529
|
+
label: this.#i18n.t(option.labelKey),
|
|
530
|
+
}));
|
|
531
|
+
}, /* @ts-ignore */
|
|
532
|
+
...(ngDevMode ? [{ debugName: "typeOptions" }] : /* istanbul ignore next */ []));
|
|
533
|
+
colorOptions = computed(() => this.colors().map(color => ({ value: color, label: this.colorLabel(color) })), /* @ts-ignore */
|
|
534
|
+
...(ngDevMode ? [{ debugName: "colorOptions" }] : /* istanbul ignore next */ []));
|
|
535
|
+
draftHasIcon = computed(() => hasIcon(this.draft().type), /* @ts-ignore */
|
|
536
|
+
...(ngDevMode ? [{ debugName: "draftHasIcon" }] : /* istanbul ignore next */ []));
|
|
537
|
+
filteredIcons = computed(() => {
|
|
538
|
+
const query = this.iconQuery().trim().toLowerCase().replace(/\s+/g, '_');
|
|
539
|
+
return this.icons().filter(name => !query || name.toLowerCase().includes(query));
|
|
540
|
+
}, /* @ts-ignore */
|
|
541
|
+
...(ngDevMode ? [{ debugName: "filteredIcons" }] : /* istanbul ignore next */ []));
|
|
542
|
+
/** Ô đang giữ tab stop của lưới icon: icon nháp nếu nó còn hiện sau khi lọc, ngược lại là ô "không icon". */
|
|
543
|
+
iconTabStop = computed(() => {
|
|
544
|
+
const icon = this.draft().icon;
|
|
545
|
+
return icon && this.filteredIcons().includes(icon) ? icon : null;
|
|
546
|
+
}, /* @ts-ignore */
|
|
547
|
+
...(ngDevMode ? [{ debugName: "iconTabStop" }] : /* istanbul ignore next */ []));
|
|
548
|
+
noneIconLabel = computed(() => this.#i18n.t(this.draft().type === 'icon' ? 'core.component.badge.picker.dot' : 'core.component.badge.picker.no-icon'), /* @ts-ignore */
|
|
549
|
+
...(ngDevMode ? [{ debugName: "noneIconLabel" }] : /* istanbul ignore next */ []));
|
|
550
|
+
/** Description chỉ hiện ở type icon và tag. */
|
|
551
|
+
previewDescriptionShown = computed(() => {
|
|
552
|
+
const type = this.draft().type;
|
|
553
|
+
return type === 'icon' || type === 'tag' ? this.previewDescription() || null : null;
|
|
554
|
+
}, /* @ts-ignore */
|
|
555
|
+
...(ngDevMode ? [{ debugName: "previewDescriptionShown" }] : /* istanbul ignore next */ []));
|
|
556
|
+
showDescriptionHint = computed(() => !!this.previewDescription() && !this.previewDescriptionShown(), /* @ts-ignore */
|
|
557
|
+
...(ngDevMode ? [{ debugName: "showDescriptionHint" }] : /* istanbul ignore next */ []));
|
|
558
|
+
setDraftType = (type) => this.draft.update(draft => ({ ...draft, type }));
|
|
559
|
+
setDraftColor = (color) => this.draft.update(draft => ({ ...draft, color }));
|
|
560
|
+
setDraftIcon = (icon) => this.draft.update(draft => ({ ...draft, icon }));
|
|
561
|
+
open() {
|
|
562
|
+
if (this.isOpen() || this.connectorState().disabled || this.connectorState().isViewed)
|
|
563
|
+
return;
|
|
564
|
+
const start = this.value() ?? SD_BADGE_PICKER_FIRST_DRAFT;
|
|
565
|
+
this.#openedFrom = start;
|
|
566
|
+
this.draft.set({ ...start });
|
|
567
|
+
this.iconQuery.set('');
|
|
568
|
+
this.isOpen.set(true);
|
|
569
|
+
}
|
|
570
|
+
/** Bấm trigger: mở, hoặc ghi rồi đóng nếu panel đang mở. */
|
|
571
|
+
toggle() {
|
|
572
|
+
if (this.isOpen())
|
|
573
|
+
this.#commit();
|
|
574
|
+
else
|
|
575
|
+
this.open();
|
|
576
|
+
}
|
|
577
|
+
onContainerClick() {
|
|
578
|
+
if (this.isOpen())
|
|
579
|
+
return;
|
|
580
|
+
this.triggerRef()?.nativeElement.focus();
|
|
581
|
+
this.open();
|
|
582
|
+
}
|
|
583
|
+
/** "Xong": ghi bản nháp rồi đưa focus về trigger. */
|
|
584
|
+
done() {
|
|
585
|
+
this.#commit();
|
|
586
|
+
this.#focusTrigger();
|
|
587
|
+
}
|
|
588
|
+
onTriggerKeydown(event) {
|
|
589
|
+
if (this.isOpen())
|
|
590
|
+
return;
|
|
591
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
592
|
+
// why: Space trên phần tử focus được sẽ cuộn trang nếu không chặn.
|
|
593
|
+
event.preventDefault();
|
|
594
|
+
this.open();
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
onAttach() {
|
|
598
|
+
// why: nội dung panel vừa gắn vào overlay; đợi một nhịp để nó có trong DOM rồi đưa focus vào type đang chọn.
|
|
599
|
+
setTimeout(() => this.panelRef()?.nativeElement.querySelector('[data-badge-picker-type][tabindex="0"]')?.focus());
|
|
600
|
+
}
|
|
601
|
+
onOutsideClick(event) {
|
|
602
|
+
// why: bấm vào chính field (trigger) đã có toggle() lo; ở đây chỉ xử lý bấm ra hẳn bên ngoài.
|
|
603
|
+
const target = event.target;
|
|
604
|
+
if (target && this.#host.contains(target))
|
|
605
|
+
return;
|
|
606
|
+
this.#commit();
|
|
607
|
+
}
|
|
608
|
+
onOverlayKeydown(event) {
|
|
609
|
+
if (event.key !== 'Escape' && event.key !== 'Esc')
|
|
610
|
+
return;
|
|
611
|
+
event.preventDefault();
|
|
612
|
+
this.#cancel();
|
|
613
|
+
this.#focusTrigger();
|
|
614
|
+
}
|
|
615
|
+
/** Tab ra khỏi phần tử cuối (hoặc Shift+Tab khỏi phần tử đầu) thì ghi bản nháp. */
|
|
616
|
+
onPanelKeydown(event) {
|
|
617
|
+
if (event.key !== 'Tab')
|
|
618
|
+
return;
|
|
619
|
+
const stops = this.#tabStops();
|
|
620
|
+
if (!stops.length)
|
|
621
|
+
return;
|
|
622
|
+
const active = document.activeElement;
|
|
623
|
+
if (!event.shiftKey && active === stops[stops.length - 1]) {
|
|
624
|
+
// why: KHÔNG preventDefault — focus về trigger ngay trong keydown nên hành động mặc định của Tab đi tiếp từ
|
|
625
|
+
// trigger tới control kế sau nó, đúng thứ tự trang.
|
|
626
|
+
this.#commit();
|
|
627
|
+
this.#focusTrigger();
|
|
628
|
+
}
|
|
629
|
+
else if (event.shiftKey && active === stops[0]) {
|
|
630
|
+
event.preventDefault();
|
|
631
|
+
this.#commit();
|
|
632
|
+
this.#focusTrigger();
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
/** Mũi tên di chuyển focus giữa các radio của một nhóm (theo lưới `columns` cột); Enter/Space mới chọn. */
|
|
636
|
+
onRadioKeydown(event, columns) {
|
|
637
|
+
const group = event.currentTarget.closest('[role="radiogroup"]');
|
|
638
|
+
const radios = Array.from(group?.querySelectorAll('[role="radio"]') ?? []);
|
|
639
|
+
const index = radios.indexOf(event.currentTarget);
|
|
640
|
+
if (index < 0)
|
|
641
|
+
return;
|
|
642
|
+
let next;
|
|
643
|
+
switch (event.key) {
|
|
644
|
+
case 'ArrowRight':
|
|
645
|
+
next = index + 1;
|
|
646
|
+
break;
|
|
647
|
+
case 'ArrowLeft':
|
|
648
|
+
next = index - 1;
|
|
649
|
+
break;
|
|
650
|
+
case 'ArrowDown':
|
|
651
|
+
next = index + columns;
|
|
652
|
+
break;
|
|
653
|
+
case 'ArrowUp':
|
|
654
|
+
next = index - columns;
|
|
655
|
+
break;
|
|
656
|
+
case 'Home':
|
|
657
|
+
next = 0;
|
|
658
|
+
break;
|
|
659
|
+
case 'End':
|
|
660
|
+
next = radios.length - 1;
|
|
661
|
+
break;
|
|
662
|
+
default:
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
event.preventDefault();
|
|
666
|
+
radios[Math.min(Math.max(next, 0), radios.length - 1)].focus();
|
|
667
|
+
}
|
|
668
|
+
onIconQuery(event) {
|
|
669
|
+
this.iconQuery.set(event.target.value);
|
|
670
|
+
}
|
|
671
|
+
#commit() {
|
|
672
|
+
if (!this.isOpen())
|
|
673
|
+
return;
|
|
674
|
+
const next = { ...this.draft() };
|
|
675
|
+
const changed = !sameValue(next, this.#openedFrom);
|
|
676
|
+
this.isOpen.set(false);
|
|
677
|
+
this.#connector.markAsTouched();
|
|
678
|
+
if (!changed)
|
|
679
|
+
return;
|
|
680
|
+
this.#writeModels(next);
|
|
681
|
+
// why: setValue CÓ phát event — form của consumer nhận valueChanges và async [validator] chạy lại; connector
|
|
682
|
+
// thấy model đã bằng giá trị mới nên không ghi ngược lại.
|
|
683
|
+
this.formControl.setValue(next);
|
|
684
|
+
this.#connector.markAsDirty();
|
|
685
|
+
this.sdChange.emit(next);
|
|
686
|
+
}
|
|
687
|
+
#cancel() {
|
|
688
|
+
if (!this.isOpen())
|
|
689
|
+
return;
|
|
690
|
+
this.isOpen.set(false);
|
|
691
|
+
this.#connector.markAsTouched();
|
|
692
|
+
}
|
|
693
|
+
#writeModels(value) {
|
|
694
|
+
this.type.set(value?.type);
|
|
695
|
+
this.color.set(value?.color);
|
|
696
|
+
this.icon.set(value?.icon ?? null);
|
|
697
|
+
}
|
|
698
|
+
#focusTrigger() {
|
|
699
|
+
this.triggerRef()?.nativeElement.focus();
|
|
700
|
+
}
|
|
701
|
+
#tabStops() {
|
|
702
|
+
const panel = this.panelRef()?.nativeElement;
|
|
703
|
+
if (!panel)
|
|
704
|
+
return [];
|
|
705
|
+
return Array.from(panel.querySelectorAll('button, input, [tabindex]')).filter(el => el.tabIndex >= 0 && !el.disabled && el.getAttribute('tabindex') !== '-1');
|
|
706
|
+
}
|
|
707
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdBadgePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
708
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdBadgePicker, isStandalone: true, selector: "sd-badge-picker", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, previewTitle: { classPropertyName: "previewTitle", publicName: "previewTitle", isSignal: true, isRequired: false, transformFunction: null }, previewDescription: { classPropertyName: "previewDescription", publicName: "previewDescription", isSignal: true, isRequired: false, transformFunction: null }, types: { classPropertyName: "types", publicName: "types", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, icons: { classPropertyName: "icons", publicName: "icons", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, floatLabel: { classPropertyName: "floatLabel", publicName: "floatLabel", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", 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 }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", 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 }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { type: "typeChange", color: "colorChange", icon: "iconChange", sdChange: "sdChange" }, host: { properties: { "class.sd-viewed": "connectorState().isViewed", "class.sd-label-top": "labelPlacement() === 'top'", "attr.data-disabled": "connectorState().disabled" } }, viewQueries: [{ propertyName: "field", first: true, predicate: MatFormField, descendants: true, isSignal: true }, { propertyName: "triggerRef", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "panelRef", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _value = value();\n@let _label = label();\n@let _helperText = helperText();\n@let _appearance = appearance();\n@let _size = size();\n@let _required = required();\n@let _open = isOpen();\n@let _state = connectorState();\n@let _disabled = _state.disabled;\n@let _errorMessage = visibleErrorMessage();\n@let _hideInlineError = hideInlineError();\n@let _labelTop = labelPlacement() === 'top';\n@let _autoId = autoId();\n@let _previewTitle = effectivePreviewTitle();\n@let _pairLabel = pairLabel();\n\n@if (_state.isViewed) {\n <!-- Ch\u1EC9 xem: nh\u00E3n v\u00E0 badge, kh\u00F4ng c\u00F3 \u00F4. -->\n <sd-view class=\"sd-badge-picker__view\" data-badge-picker-view [label]=\"_label\" [value]=\"_value\" [display]=\"summary()\" [valueTemplate]=\"viewValue\" />\n <ng-template #viewValue>\n @if (_value) {\n <sd-badge [type]=\"_value.type\" [color]=\"_value.color\" [icon]=\"iconOf(_value)\" [title]=\"_previewTitle\" [label]=\"_pairLabel\" />\n } @else {\n \u2014\n }\n </ng-template>\n} @else {\n @if (!_appearance || _labelTop) {\n @if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n }\n\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [class.sd-label-top]=\"_labelTop\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"floatLabel()\">\n @if (_appearance && _label && !_labelTop) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <!-- why: trigger l\u00E0 div role=\"combobox\" mang MatFormFieldControl (\u0275SdBadgePickerControl) ch\u1EE9 kh\u00F4ng ph\u1EA3i\n <input readonly> nh\u01B0 tree-select: n\u00F3 ph\u1EA3i ch\u1EE9a ch\u00EDnh sd-badge \u0111\u00E3 ch\u1ECDn v\u00E0 d\u00F2ng t\u00F3m t\u1EAFt. -->\n <div\n #trigger\n #control=\"sdBadgePickerControl\"\n sdBadgePickerControl\n data-badge-picker-trigger\n class=\"sd-badge-picker__trigger\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-expanded]=\"_open\"\n [attr.aria-controls]=\"_open ? panelId : null\"\n [attr.aria-label]=\"_label || effectivePlaceholder()\"\n [attr.aria-describedby]=\"control.describedBy()\"\n [attr.aria-invalid]=\"_errorMessage ? 'true' : null\"\n [attr.aria-required]=\"_required ? 'true' : null\"\n [attr.aria-disabled]=\"_disabled ? 'true' : null\"\n [attr.data-autoid]=\"_autoId\"\n (click)=\"toggle()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (focus)=\"triggerFocused.set(true)\"\n (blur)=\"triggerFocused.set(false)\">\n @if (_value) {\n <sd-badge\n [type]=\"_value.type\"\n [color]=\"_value.color\"\n [icon]=\"iconOf(_value)\"\n [title]=\"_previewTitle\"\n [label]=\"_pairLabel\"\n [size]=\"triggerBadgeSize()\" />\n @if (_size !== 'sm') {\n <span class=\"sd-badge-picker__summary\">{{ summary() }}</span>\n }\n } @else if (showPlaceholder()) {\n <span class=\"sd-badge-picker__placeholder\">{{ effectivePlaceholder() }}</span>\n }\n </div>\n\n @if (_hideInlineError && _errorMessage) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n <sd-icon matSuffix class=\"sd-suffix-icon cursor-pointer\" [name]=\"_open ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n\n @if (!_hideInlineError && _errorMessage) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n } @else if (_labelTop && _helperText) {\n <mat-hint [id]=\"hintId\">{{ _helperText }}</mat-hint>\n }\n </mat-form-field>\n}\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"_open\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n cdkConnectedOverlayPanelClass=\"sd-badge-picker-pane\"\n (attach)=\"onAttach()\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\">\n @let _draft = draft();\n <div\n #panel\n class=\"sd-badge-picker-panel\"\n role=\"dialog\"\n [id]=\"panelId\"\n [attr.aria-label]=\"_label || effectivePlaceholder()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-panel' : null\"\n (keydown)=\"onPanelKeydown($event)\">\n <div class=\"sd-badge-picker-panel__preview\">\n <span class=\"sd-badge-picker-panel__eyebrow\">{{ 'core.component.badge.picker.preview' | sdTranslate }}</span>\n <div class=\"sd-badge-picker-panel__preview-badge\">\n <sd-badge\n [type]=\"_draft.type\"\n [color]=\"_draft.color\"\n [icon]=\"iconOf(_draft)\"\n [title]=\"_previewTitle\"\n [label]=\"_pairLabel\"\n [description]=\"previewDescriptionShown()\" />\n @if (showDescriptionHint()) {\n <span class=\"sd-badge-picker-panel__hint\">{{ 'core.component.badge.picker.description-hint' | sdTranslate }}</span>\n }\n </div>\n </div>\n\n <div class=\"sd-badge-picker-panel__body\">\n <!-- why: m\u1ED7i nh\u00F3m l\u00E0 m\u1ED9t radiogroup v\u1EDBi m\u1ED9t tab stop (radio \u0111ang ch\u1ECDn); m\u0169i t\u00EAn ch\u1EC9 di chuy\u1EC3n focus,\n Enter/Space (click c\u1EE7a <button>) m\u1EDBi ch\u1ECDn \u2014 nh\u01B0 thi\u1EBFt k\u1EBF. -->\n <section class=\"sd-badge-picker-panel__group\">\n <span class=\"sd-badge-picker-panel__eyebrow\" [id]=\"typeGroupId\">{{ 'core.component.badge.picker.type' | sdTranslate }}</span>\n <div class=\"sd-badge-picker-panel__types\" role=\"radiogroup\" [attr.aria-labelledby]=\"typeGroupId\">\n @for (option of typeOptions(); track option.value) {\n @let _checked = option.value === _draft.type;\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__type\"\n [attr.data-badge-picker-type]=\"option.value\"\n [attr.aria-checked]=\"_checked\"\n [attr.aria-label]=\"option.label\"\n [attr.tabindex]=\"_checked ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, 3)\"\n (click)=\"setDraftType(option.value)\">\n <span class=\"sd-badge-picker-panel__type-preview\" aria-hidden=\"true\">\n <sd-badge\n [type]=\"option.value\"\n [color]=\"_draft.color\"\n [icon]=\"iconOf({ type: option.value, color: _draft.color, icon: _draft.icon })\"\n [title]=\"_previewTitle\"\n [label]=\"_pairLabel\" />\n </span>\n <span class=\"sd-badge-picker-panel__type-name\">{{ option.label }}</span>\n </button>\n }\n </div>\n </section>\n\n <section class=\"sd-badge-picker-panel__group\">\n <div class=\"sd-badge-picker-panel__group-head\">\n <span class=\"sd-badge-picker-panel__eyebrow\" [id]=\"colorGroupId\">{{ 'core.component.badge.picker.color' | sdTranslate }}</span>\n <span class=\"sd-badge-picker-panel__color-name\">{{ colorLabel(_draft.color) }}</span>\n </div>\n <div class=\"sd-badge-picker-panel__swatches\" role=\"radiogroup\" [attr.aria-labelledby]=\"colorGroupId\">\n @for (option of colorOptions(); track option.value) {\n @let _checked = option.value === _draft.color;\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__swatch\"\n [style.background-color]=\"'var(--sd-' + option.value + ')'\"\n [attr.data-badge-picker-color]=\"option.value\"\n [attr.aria-checked]=\"_checked\"\n [attr.aria-label]=\"option.label\"\n [attr.tabindex]=\"_checked ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, colorOptions().length)\"\n (click)=\"setDraftColor(option.value)\"></button>\n }\n </div>\n </section>\n\n @if (draftHasIcon()) {\n @let _iconTabStop = iconTabStop();\n <section class=\"sd-badge-picker-panel__group\" data-badge-picker-icons>\n <span class=\"sd-badge-picker-panel__eyebrow\" [id]=\"iconGroupId\">{{ 'core.component.badge.picker.icon' | sdTranslate }}</span>\n <sd-search-field size=\"sm\">\n <input\n sdSearchFieldInput\n type=\"text\"\n autocomplete=\"off\"\n [value]=\"iconQuery()\"\n [placeholder]=\"'core.form.select.search' | sdTranslate\"\n [attr.aria-label]=\"'core.form.select.search' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onIconQuery($event)\" />\n </sd-search-field>\n <div class=\"sd-badge-picker-panel__icons\" role=\"radiogroup\" [attr.aria-labelledby]=\"iconGroupId\">\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__icon-cell sd-badge-picker-panel__icon-cell--none\"\n data-badge-picker-icon-none\n [attr.aria-checked]=\"!_draft.icon\"\n [attr.aria-label]=\"noneIconLabel()\"\n [attr.tabindex]=\"_iconTabStop === null ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, 8)\"\n (click)=\"setDraftIcon(null)\">\n <sd-icon [name]=\"_draft.type === 'icon' ? 'fiber_manual_record' : 'block'\" size=\"20px\" aria-hidden=\"true\" />\n </button>\n @for (name of filteredIcons(); track name) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__icon-cell\"\n [attr.data-badge-picker-icon]=\"name\"\n [attr.aria-checked]=\"name === _draft.icon\"\n [attr.aria-label]=\"name\"\n [attr.tabindex]=\"name === _iconTabStop ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, 8)\"\n (click)=\"setDraftIcon(name)\">\n <sd-icon [name]=\"name\" size=\"20px\" aria-hidden=\"true\" />\n </button>\n }\n </div>\n @if (!filteredIcons().length) {\n <p class=\"sd-badge-picker-panel__empty\">{{ 'core.component.badge.picker.no-icon-match' | sdTranslate }}</p>\n }\n </section>\n }\n </div>\n\n <div class=\"sd-badge-picker-panel__footer\">\n @let _escHint = escHint();\n <!-- Ph\u00EDm Esc v\u1EBD nh\u01B0 n\u1EAFp ph\u00EDm trong c\u00E2u \u0111\u00E3 d\u1ECBch (`{key}` c\u1EE7a i18n); catalog kh\u00F4ng c\u00F3 `{key}` th\u00EC ch\u1EC9 hi\u1EC7n ch\u1EEF. -->\n <span class=\"sd-badge-picker-panel__esc\"\n >{{ _escHint[0] }}@if (_escHint.length > 1) {<kbd class=\"sd-badge-picker-panel__kbd\">Esc</kbd>{{ _escHint[1] }}}</span\n >\n <sd-button\n data-badge-picker-done\n type=\"fill\"\n color=\"primary\"\n size=\"sm\"\n [autoId]=\"autoIdInput() ? autoIdInput() + '-done' : undefined\"\n [title]=\"'core.component.badge.picker.done' | sdTranslate\"\n (click)=\"done()\"></sd-button>\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:block;min-width:0}.sd-badge-picker__trigger{display:flex;align-items:center;gap:8px;min-width:0;min-height:20px;cursor:pointer;outline:none}.sd-badge-picker__trigger[aria-disabled=true]{cursor:default}.sd-badge-picker__trigger>sd-badge{flex:0 0 auto;max-width:100%}.mat-mdc-form-field.mat-form-field-appearance-outline.sd-sm .sd-badge-picker__trigger{margin-top:3px}.mat-mdc-form-field.mat-form-field-appearance-outline.sd-md .sd-badge-picker__trigger{margin-top:12px}.sd-badge-picker__summary{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker__placeholder{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel{display:flex;flex-direction:column;box-sizing:border-box;width:400px;max-width:calc(100vw - 32px);max-height:min(640px,100vh - 32px);overflow:hidden;color:var(--sd-text, rgba(0, 0, 0, .87));font-size:var(--sd-font-size-14, 14px);background-color:var(--sd-select-panel-bg, var(--sd-surface));border:1px solid color-mix(in srgb,var(--sd-border) 60%,var(--sd-surface));border-radius:var(--sd-panel-radius, 10px);box-shadow:var(--sd-shadow-md, none)}.sd-badge-picker-panel__eyebrow{font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-16, 16px);font-weight:var(--sd-font-weight-medium, 500);letter-spacing:.06em;text-transform:uppercase;color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__preview{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;min-height:56px;padding:12px 16px;background-color:color-mix(in srgb,var(--sd-surface-muted) 60%,var(--sd-surface));border-bottom:1px solid var(--sd-select-panel-divider, var(--sd-border))}.sd-badge-picker-panel__preview-badge{display:flex;flex-direction:column;align-items:flex-end;gap:4px;min-width:0}.sd-badge-picker-panel__hint{font-size:var(--sd-font-size-11, 11px);line-height:14px;color:var(--sd-text-secondary, rgba(0, 0, 0, .6));text-align:end}.sd-badge-picker-panel__body{display:flex;flex:1 1 auto;flex-direction:column;gap:16px;min-height:0;padding:14px 16px 16px;overflow:auto}.sd-badge-picker-panel__group{display:flex;flex-direction:column;gap:8px}.sd-badge-picker-panel__group-head{display:flex;align-items:baseline;gap:8px}.sd-badge-picker-panel__color-name{font-size:var(--sd-font-size-12, 12px);color:var(--sd-text, rgba(0, 0, 0, .87))}.sd-badge-picker-panel__types{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.sd-badge-picker-panel__type{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-width:0;height:60px;padding:0 8px;font:inherit;color:inherit;background-color:transparent;border:1px solid var(--sd-border, rgba(0, 0, 0, .12));border-radius:8px;cursor:pointer}.sd-badge-picker-panel__type:hover:not([aria-checked=true]){background-color:color-mix(in srgb,var(--sd-text) 4%,transparent)}.sd-badge-picker-panel__type[aria-checked=true]{border-color:var(--sd-primary);background-color:color-mix(in srgb,var(--sd-primary) 6%,transparent)}.sd-badge-picker-panel__type-preview{display:flex;justify-content:center;max-width:100%;min-width:0;pointer-events:none}.sd-badge-picker-panel__type-name{font-size:var(--sd-font-size-11, 11px);line-height:14px;color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__swatches{display:flex;flex-wrap:wrap;gap:12px;padding:4px}.sd-badge-picker-panel__swatch{width:24px;height:24px;padding:0;border:0;border-radius:50%;cursor:pointer}.sd-badge-picker-panel__swatch[aria-checked=true]{box-shadow:0 0 0 2px var(--sd-select-panel-bg, var(--sd-surface)),0 0 0 4px var(--sd-text)}.sd-badge-picker-panel__icons{display:grid;grid-template-columns:repeat(8,36px);justify-content:space-between;row-gap:4px}.sd-badge-picker-panel__icon-cell{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;color:var(--sd-text-secondary, rgba(0, 0, 0, .6));background-color:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer}.sd-badge-picker-panel__icon-cell--none{border-color:var(--sd-border, rgba(0, 0, 0, .12))}.sd-badge-picker-panel__icon-cell:hover:not([aria-checked=true]){background-color:color-mix(in srgb,var(--sd-text) 5%,transparent)}.sd-badge-picker-panel__icon-cell[aria-checked=true]{color:var(--sd-primary-dark);background-color:var(--sd-primary-light);border-color:var(--sd-primary)}.sd-badge-picker-panel__empty{margin:0;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__footer{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;min-height:52px;padding:0 12px 0 16px;border-top:1px solid var(--sd-select-panel-divider, var(--sd-border))}.sd-badge-picker-panel__esc{font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__kbd{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:22px;height:20px;margin:0 2px;padding:0 5px;border:1px solid var(--sd-border-strong);border-bottom-width:2px;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface-muted);color:var(--sd-text);font:var(--sd-font-weight-medium, 500) var(--sd-font-size-11, 11px)/1 ui-monospace,SFMono-Regular,Menlo,monospace;vertical-align:middle}.sd-badge-picker-panel__type:focus-visible,.sd-badge-picker-panel__swatch:focus-visible,.sd-badge-picker-panel__icon-cell:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}@media(forced-colors:active){.sd-badge-picker-panel__swatch{forced-color-adjust:none;border:1px solid CanvasText}.sd-badge-picker-panel__type[aria-checked=true],.sd-badge-picker-panel__icon-cell[aria-checked=true]{border:2px solid Highlight}}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "component", type: SdBadge, selector: "sd-badge", inputs: ["type", "color", "primary", "secondary", "success", "info", "warning", "error", "fontSet", "title", "label", "description", "tooltip", "icon", "size", "pulse"], outputs: ["click"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { 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: "directive", type: ɵSdBadgePickerControlDirective, selector: "[sdBadgePickerControl]", exportAs: ["sdBadgePickerControl"] }, { kind: "component", type: _SdSearchField, selector: "sd-search-field", inputs: ["size", "clearable", "clearLabel", "autoId"], outputs: ["cleared"] }, { kind: "directive", type: _SdSearchFieldInputDirective, selector: "input[sdSearchFieldInput]" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
709
|
+
}
|
|
710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdBadgePicker, decorators: [{
|
|
711
|
+
type: Component,
|
|
712
|
+
args: [{ selector: 'sd-badge-picker', standalone: true, imports: [
|
|
713
|
+
MatFormFieldModule,
|
|
714
|
+
MatTooltipModule,
|
|
715
|
+
OverlayModule,
|
|
716
|
+
SdBadge,
|
|
717
|
+
SdButton,
|
|
718
|
+
SdIcon,
|
|
719
|
+
SdLabel,
|
|
720
|
+
SdTranslatePipe,
|
|
721
|
+
SdView,
|
|
722
|
+
ɵSdBadgePickerControlDirective,
|
|
723
|
+
_SdSearchField,
|
|
724
|
+
_SdSearchFieldInputDirective,
|
|
725
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
726
|
+
'[class.sd-viewed]': 'connectorState().isViewed',
|
|
727
|
+
'[class.sd-label-top]': "labelPlacement() === 'top'",
|
|
728
|
+
'[attr.data-disabled]': 'connectorState().disabled',
|
|
729
|
+
}, template: "@let _value = value();\n@let _label = label();\n@let _helperText = helperText();\n@let _appearance = appearance();\n@let _size = size();\n@let _required = required();\n@let _open = isOpen();\n@let _state = connectorState();\n@let _disabled = _state.disabled;\n@let _errorMessage = visibleErrorMessage();\n@let _hideInlineError = hideInlineError();\n@let _labelTop = labelPlacement() === 'top';\n@let _autoId = autoId();\n@let _previewTitle = effectivePreviewTitle();\n@let _pairLabel = pairLabel();\n\n@if (_state.isViewed) {\n <!-- Ch\u1EC9 xem: nh\u00E3n v\u00E0 badge, kh\u00F4ng c\u00F3 \u00F4. -->\n <sd-view class=\"sd-badge-picker__view\" data-badge-picker-view [label]=\"_label\" [value]=\"_value\" [display]=\"summary()\" [valueTemplate]=\"viewValue\" />\n <ng-template #viewValue>\n @if (_value) {\n <sd-badge [type]=\"_value.type\" [color]=\"_value.color\" [icon]=\"iconOf(_value)\" [title]=\"_previewTitle\" [label]=\"_pairLabel\" />\n } @else {\n \u2014\n }\n </ng-template>\n} @else {\n @if (!_appearance || _labelTop) {\n @if (_label) {\n <sd-label [label]=\"_label\" [required]=\"_required\"></sd-label>\n }\n }\n\n <mat-form-field\n [class.sd-md]=\"_size === 'md'\"\n [class.sd-sm]=\"_size === 'sm'\"\n [class.hide-inline-error]=\"_hideInlineError\"\n [class.sd-label-top]=\"_labelTop\"\n [appearance]=\"_appearance!\"\n [floatLabel]=\"floatLabel()\">\n @if (_appearance && _label && !_labelTop) {\n <mat-label class=\"sd-form-field-label\">\n <span>{{ _label }}</span>\n @if (_helperText) {\n <sd-icon [matTooltip]=\"_helperText\" matTooltipPosition=\"below\" name=\"info\"></sd-icon>\n }\n </mat-label>\n }\n\n <!-- why: trigger l\u00E0 div role=\"combobox\" mang MatFormFieldControl (\u0275SdBadgePickerControl) ch\u1EE9 kh\u00F4ng ph\u1EA3i\n <input readonly> nh\u01B0 tree-select: n\u00F3 ph\u1EA3i ch\u1EE9a ch\u00EDnh sd-badge \u0111\u00E3 ch\u1ECDn v\u00E0 d\u00F2ng t\u00F3m t\u1EAFt. -->\n <div\n #trigger\n #control=\"sdBadgePickerControl\"\n sdBadgePickerControl\n data-badge-picker-trigger\n class=\"sd-badge-picker__trigger\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n [attr.tabindex]=\"_disabled ? -1 : 0\"\n [attr.aria-expanded]=\"_open\"\n [attr.aria-controls]=\"_open ? panelId : null\"\n [attr.aria-label]=\"_label || effectivePlaceholder()\"\n [attr.aria-describedby]=\"control.describedBy()\"\n [attr.aria-invalid]=\"_errorMessage ? 'true' : null\"\n [attr.aria-required]=\"_required ? 'true' : null\"\n [attr.aria-disabled]=\"_disabled ? 'true' : null\"\n [attr.data-autoid]=\"_autoId\"\n (click)=\"toggle()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (focus)=\"triggerFocused.set(true)\"\n (blur)=\"triggerFocused.set(false)\">\n @if (_value) {\n <sd-badge\n [type]=\"_value.type\"\n [color]=\"_value.color\"\n [icon]=\"iconOf(_value)\"\n [title]=\"_previewTitle\"\n [label]=\"_pairLabel\"\n [size]=\"triggerBadgeSize()\" />\n @if (_size !== 'sm') {\n <span class=\"sd-badge-picker__summary\">{{ summary() }}</span>\n }\n } @else if (showPlaceholder()) {\n <span class=\"sd-badge-picker__placeholder\">{{ effectivePlaceholder() }}</span>\n }\n </div>\n\n @if (_hideInlineError && _errorMessage) {\n <sd-icon matSuffix class=\"sd-error-icon\" [matTooltip]=\"_errorMessage\" matTooltipPosition=\"above\" name=\"error\"></sd-icon>\n }\n <sd-icon matSuffix class=\"sd-suffix-icon cursor-pointer\" [name]=\"_open ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></sd-icon>\n\n @if (!_hideInlineError && _errorMessage) {\n <mat-error [id]=\"errorId\">{{ _errorMessage }}</mat-error>\n } @else if (_labelTop && _helperText) {\n <mat-hint [id]=\"hintId\">{{ _helperText }}</mat-hint>\n }\n </mat-form-field>\n}\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"_open\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n cdkConnectedOverlayPanelClass=\"sd-badge-picker-pane\"\n (attach)=\"onAttach()\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\">\n @let _draft = draft();\n <div\n #panel\n class=\"sd-badge-picker-panel\"\n role=\"dialog\"\n [id]=\"panelId\"\n [attr.aria-label]=\"_label || effectivePlaceholder()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-panel' : null\"\n (keydown)=\"onPanelKeydown($event)\">\n <div class=\"sd-badge-picker-panel__preview\">\n <span class=\"sd-badge-picker-panel__eyebrow\">{{ 'core.component.badge.picker.preview' | sdTranslate }}</span>\n <div class=\"sd-badge-picker-panel__preview-badge\">\n <sd-badge\n [type]=\"_draft.type\"\n [color]=\"_draft.color\"\n [icon]=\"iconOf(_draft)\"\n [title]=\"_previewTitle\"\n [label]=\"_pairLabel\"\n [description]=\"previewDescriptionShown()\" />\n @if (showDescriptionHint()) {\n <span class=\"sd-badge-picker-panel__hint\">{{ 'core.component.badge.picker.description-hint' | sdTranslate }}</span>\n }\n </div>\n </div>\n\n <div class=\"sd-badge-picker-panel__body\">\n <!-- why: m\u1ED7i nh\u00F3m l\u00E0 m\u1ED9t radiogroup v\u1EDBi m\u1ED9t tab stop (radio \u0111ang ch\u1ECDn); m\u0169i t\u00EAn ch\u1EC9 di chuy\u1EC3n focus,\n Enter/Space (click c\u1EE7a <button>) m\u1EDBi ch\u1ECDn \u2014 nh\u01B0 thi\u1EBFt k\u1EBF. -->\n <section class=\"sd-badge-picker-panel__group\">\n <span class=\"sd-badge-picker-panel__eyebrow\" [id]=\"typeGroupId\">{{ 'core.component.badge.picker.type' | sdTranslate }}</span>\n <div class=\"sd-badge-picker-panel__types\" role=\"radiogroup\" [attr.aria-labelledby]=\"typeGroupId\">\n @for (option of typeOptions(); track option.value) {\n @let _checked = option.value === _draft.type;\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__type\"\n [attr.data-badge-picker-type]=\"option.value\"\n [attr.aria-checked]=\"_checked\"\n [attr.aria-label]=\"option.label\"\n [attr.tabindex]=\"_checked ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, 3)\"\n (click)=\"setDraftType(option.value)\">\n <span class=\"sd-badge-picker-panel__type-preview\" aria-hidden=\"true\">\n <sd-badge\n [type]=\"option.value\"\n [color]=\"_draft.color\"\n [icon]=\"iconOf({ type: option.value, color: _draft.color, icon: _draft.icon })\"\n [title]=\"_previewTitle\"\n [label]=\"_pairLabel\" />\n </span>\n <span class=\"sd-badge-picker-panel__type-name\">{{ option.label }}</span>\n </button>\n }\n </div>\n </section>\n\n <section class=\"sd-badge-picker-panel__group\">\n <div class=\"sd-badge-picker-panel__group-head\">\n <span class=\"sd-badge-picker-panel__eyebrow\" [id]=\"colorGroupId\">{{ 'core.component.badge.picker.color' | sdTranslate }}</span>\n <span class=\"sd-badge-picker-panel__color-name\">{{ colorLabel(_draft.color) }}</span>\n </div>\n <div class=\"sd-badge-picker-panel__swatches\" role=\"radiogroup\" [attr.aria-labelledby]=\"colorGroupId\">\n @for (option of colorOptions(); track option.value) {\n @let _checked = option.value === _draft.color;\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__swatch\"\n [style.background-color]=\"'var(--sd-' + option.value + ')'\"\n [attr.data-badge-picker-color]=\"option.value\"\n [attr.aria-checked]=\"_checked\"\n [attr.aria-label]=\"option.label\"\n [attr.tabindex]=\"_checked ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, colorOptions().length)\"\n (click)=\"setDraftColor(option.value)\"></button>\n }\n </div>\n </section>\n\n @if (draftHasIcon()) {\n @let _iconTabStop = iconTabStop();\n <section class=\"sd-badge-picker-panel__group\" data-badge-picker-icons>\n <span class=\"sd-badge-picker-panel__eyebrow\" [id]=\"iconGroupId\">{{ 'core.component.badge.picker.icon' | sdTranslate }}</span>\n <sd-search-field size=\"sm\">\n <input\n sdSearchFieldInput\n type=\"text\"\n autocomplete=\"off\"\n [value]=\"iconQuery()\"\n [placeholder]=\"'core.form.select.search' | sdTranslate\"\n [attr.aria-label]=\"'core.form.select.search' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onIconQuery($event)\" />\n </sd-search-field>\n <div class=\"sd-badge-picker-panel__icons\" role=\"radiogroup\" [attr.aria-labelledby]=\"iconGroupId\">\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__icon-cell sd-badge-picker-panel__icon-cell--none\"\n data-badge-picker-icon-none\n [attr.aria-checked]=\"!_draft.icon\"\n [attr.aria-label]=\"noneIconLabel()\"\n [attr.tabindex]=\"_iconTabStop === null ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, 8)\"\n (click)=\"setDraftIcon(null)\">\n <sd-icon [name]=\"_draft.type === 'icon' ? 'fiber_manual_record' : 'block'\" size=\"20px\" aria-hidden=\"true\" />\n </button>\n @for (name of filteredIcons(); track name) {\n <button\n type=\"button\"\n role=\"radio\"\n class=\"sd-badge-picker-panel__icon-cell\"\n [attr.data-badge-picker-icon]=\"name\"\n [attr.aria-checked]=\"name === _draft.icon\"\n [attr.aria-label]=\"name\"\n [attr.tabindex]=\"name === _iconTabStop ? 0 : -1\"\n (keydown)=\"onRadioKeydown($event, 8)\"\n (click)=\"setDraftIcon(name)\">\n <sd-icon [name]=\"name\" size=\"20px\" aria-hidden=\"true\" />\n </button>\n }\n </div>\n @if (!filteredIcons().length) {\n <p class=\"sd-badge-picker-panel__empty\">{{ 'core.component.badge.picker.no-icon-match' | sdTranslate }}</p>\n }\n </section>\n }\n </div>\n\n <div class=\"sd-badge-picker-panel__footer\">\n @let _escHint = escHint();\n <!-- Ph\u00EDm Esc v\u1EBD nh\u01B0 n\u1EAFp ph\u00EDm trong c\u00E2u \u0111\u00E3 d\u1ECBch (`{key}` c\u1EE7a i18n); catalog kh\u00F4ng c\u00F3 `{key}` th\u00EC ch\u1EC9 hi\u1EC7n ch\u1EEF. -->\n <span class=\"sd-badge-picker-panel__esc\"\n >{{ _escHint[0] }}@if (_escHint.length > 1) {<kbd class=\"sd-badge-picker-panel__kbd\">Esc</kbd>{{ _escHint[1] }}}</span\n >\n <sd-button\n data-badge-picker-done\n type=\"fill\"\n color=\"primary\"\n size=\"sm\"\n [autoId]=\"autoIdInput() ? autoIdInput() + '-done' : undefined\"\n [title]=\"'core.component.badge.picker.done' | sdTranslate\"\n (click)=\"done()\"></sd-button>\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:block;min-width:0}.sd-badge-picker__trigger{display:flex;align-items:center;gap:8px;min-width:0;min-height:20px;cursor:pointer;outline:none}.sd-badge-picker__trigger[aria-disabled=true]{cursor:default}.sd-badge-picker__trigger>sd-badge{flex:0 0 auto;max-width:100%}.mat-mdc-form-field.mat-form-field-appearance-outline.sd-sm .sd-badge-picker__trigger{margin-top:3px}.mat-mdc-form-field.mat-form-field-appearance-outline.sd-md .sd-badge-picker__trigger{margin-top:12px}.sd-badge-picker__summary{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker__placeholder{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel{display:flex;flex-direction:column;box-sizing:border-box;width:400px;max-width:calc(100vw - 32px);max-height:min(640px,100vh - 32px);overflow:hidden;color:var(--sd-text, rgba(0, 0, 0, .87));font-size:var(--sd-font-size-14, 14px);background-color:var(--sd-select-panel-bg, var(--sd-surface));border:1px solid color-mix(in srgb,var(--sd-border) 60%,var(--sd-surface));border-radius:var(--sd-panel-radius, 10px);box-shadow:var(--sd-shadow-md, none)}.sd-badge-picker-panel__eyebrow{font-size:var(--sd-font-size-11, 11px);line-height:var(--sd-line-height-16, 16px);font-weight:var(--sd-font-weight-medium, 500);letter-spacing:.06em;text-transform:uppercase;color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__preview{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;min-height:56px;padding:12px 16px;background-color:color-mix(in srgb,var(--sd-surface-muted) 60%,var(--sd-surface));border-bottom:1px solid var(--sd-select-panel-divider, var(--sd-border))}.sd-badge-picker-panel__preview-badge{display:flex;flex-direction:column;align-items:flex-end;gap:4px;min-width:0}.sd-badge-picker-panel__hint{font-size:var(--sd-font-size-11, 11px);line-height:14px;color:var(--sd-text-secondary, rgba(0, 0, 0, .6));text-align:end}.sd-badge-picker-panel__body{display:flex;flex:1 1 auto;flex-direction:column;gap:16px;min-height:0;padding:14px 16px 16px;overflow:auto}.sd-badge-picker-panel__group{display:flex;flex-direction:column;gap:8px}.sd-badge-picker-panel__group-head{display:flex;align-items:baseline;gap:8px}.sd-badge-picker-panel__color-name{font-size:var(--sd-font-size-12, 12px);color:var(--sd-text, rgba(0, 0, 0, .87))}.sd-badge-picker-panel__types{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.sd-badge-picker-panel__type{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-width:0;height:60px;padding:0 8px;font:inherit;color:inherit;background-color:transparent;border:1px solid var(--sd-border, rgba(0, 0, 0, .12));border-radius:8px;cursor:pointer}.sd-badge-picker-panel__type:hover:not([aria-checked=true]){background-color:color-mix(in srgb,var(--sd-text) 4%,transparent)}.sd-badge-picker-panel__type[aria-checked=true]{border-color:var(--sd-primary);background-color:color-mix(in srgb,var(--sd-primary) 6%,transparent)}.sd-badge-picker-panel__type-preview{display:flex;justify-content:center;max-width:100%;min-width:0;pointer-events:none}.sd-badge-picker-panel__type-name{font-size:var(--sd-font-size-11, 11px);line-height:14px;color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__swatches{display:flex;flex-wrap:wrap;gap:12px;padding:4px}.sd-badge-picker-panel__swatch{width:24px;height:24px;padding:0;border:0;border-radius:50%;cursor:pointer}.sd-badge-picker-panel__swatch[aria-checked=true]{box-shadow:0 0 0 2px var(--sd-select-panel-bg, var(--sd-surface)),0 0 0 4px var(--sd-text)}.sd-badge-picker-panel__icons{display:grid;grid-template-columns:repeat(8,36px);justify-content:space-between;row-gap:4px}.sd-badge-picker-panel__icon-cell{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;color:var(--sd-text-secondary, rgba(0, 0, 0, .6));background-color:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer}.sd-badge-picker-panel__icon-cell--none{border-color:var(--sd-border, rgba(0, 0, 0, .12))}.sd-badge-picker-panel__icon-cell:hover:not([aria-checked=true]){background-color:color-mix(in srgb,var(--sd-text) 5%,transparent)}.sd-badge-picker-panel__icon-cell[aria-checked=true]{color:var(--sd-primary-dark);background-color:var(--sd-primary-light);border-color:var(--sd-primary)}.sd-badge-picker-panel__empty{margin:0;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__footer{display:flex;flex:0 0 auto;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;min-height:52px;padding:0 12px 0 16px;border-top:1px solid var(--sd-select-panel-divider, var(--sd-border))}.sd-badge-picker-panel__esc{font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, rgba(0, 0, 0, .6))}.sd-badge-picker-panel__kbd{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:22px;height:20px;margin:0 2px;padding:0 5px;border:1px solid var(--sd-border-strong);border-bottom-width:2px;border-radius:var(--sd-radius-4, 4px);background:var(--sd-surface-muted);color:var(--sd-text);font:var(--sd-font-weight-medium, 500) var(--sd-font-size-11, 11px)/1 ui-monospace,SFMono-Regular,Menlo,monospace;vertical-align:middle}.sd-badge-picker-panel__type:focus-visible,.sd-badge-picker-panel__swatch:focus-visible,.sd-badge-picker-panel__icon-cell:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color);outline-offset:var(--sd-focus-ring-offset, 2px)}@media(forced-colors:active){.sd-badge-picker-panel__swatch{forced-color-adjust:none;border:1px solid CanvasText}.sd-badge-picker-panel__type[aria-checked=true],.sd-badge-picker-panel__icon-cell[aria-checked=true]{border:2px solid Highlight}}\n"] }]
|
|
730
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }, { type: i0.Output, args: ["typeChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }, { type: i0.Output, args: ["colorChange"] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }, { type: i0.Output, args: ["iconChange"] }], previewTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewTitle", required: false }] }], previewDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewDescription", required: false }] }], types: [{ type: i0.Input, args: [{ isSignal: true, alias: "types", required: false }] }], colors: [{ type: i0.Input, args: [{ isSignal: true, alias: "colors", required: false }] }], icons: [{ type: i0.Input, args: [{ isSignal: true, alias: "icons", required: false }] }], form: [{ type: i0.Input, args: [{ isSignal: true, alias: "form", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], floatLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatLabel", required: false }] }], labelPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPlacement", required: false }] }], appearanceInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], helperText: [{ type: i0.Input, args: [{ isSignal: true, alias: "helperText", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], inlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "inlineError", required: false }] }], hideInlineError: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideInlineError", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], viewed: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewed", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], sdChange: [{ type: i0.Output, args: ["sdChange"] }], field: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatFormField), { isSignal: true }] }], triggerRef: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelRef: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
|
|
165
731
|
|
|
166
732
|
/**
|
|
167
733
|
* Generated bundle index. Do not edit.
|
|
168
734
|
*/
|
|
169
735
|
|
|
170
|
-
export { SdBadge };
|
|
736
|
+
export { SD_BADGE_ICON_PRESET, SD_BADGE_TYPE_OPTIONS, SdBadge, SdBadgePicker, ɵSdBadgePickerControlDirective };
|
|
171
737
|
//# sourceMappingURL=sdcorejs-angular-components-badge.mjs.map
|