@sdcorejs/angular 20.3.4 → 20.3.6
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 +78 -1
- package/assets/THEME.md +45 -3
- package/assets/scss/core/_popover-panel.scss +90 -0
- package/assets/scss/core/form.scss +5 -2
- package/assets/scss/core/utilities/_grid.scss +15 -0
- package/assets/scss/core/utilities/_sizing.scss +4 -0
- package/assets/scss/themes/_component-tokens.scss +9 -4
- package/assets/scss/themes/_semantic.scss +6 -5
- package/components/anchor/index.d.ts +6 -1
- package/components/button/index.d.ts +7 -1
- package/components/calendar/index.d.ts +1092 -0
- package/components/card/index.d.ts +247 -9
- package/components/index.d.ts +3 -1
- package/components/kanban/index.d.ts +191 -74
- package/components/modal/index.d.ts +15 -1
- package/components/query-bar/index.d.ts +204 -38
- package/components/quick-action/index.d.ts +65 -1
- package/components/scheduler/index.d.ts +544 -0
- package/components/tab/index.d.ts +6 -1
- package/components/table/index.d.ts +338 -31
- package/components/timeline/index.d.ts +216 -0
- package/components/tree/index.d.ts +119 -6
- package/directives/index.d.ts +4 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +62 -3
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +14 -6
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-calendar.mjs +2481 -0
- package/fesm2022/sdcorejs-angular-components-calendar.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs +486 -23
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +4 -18
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +7 -7
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +833 -154
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +69 -14
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +1477 -365
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +68 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs +1934 -0
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs.map +1 -0
- 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-tab-router.mjs +126 -26
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +31 -2
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +5967 -3690
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-timeline.mjs +473 -0
- package/fesm2022/sdcorejs-angular-components-timeline.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-tree.mjs +597 -36
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +2 -4
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +3 -1
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +109 -22
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +140 -42
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +70 -21
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +4 -3
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +23 -4
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +812 -52
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-w7iVesRB.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-w7iVesRB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-DwGr3EVD.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-DwGr3EVD.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs → sdcorejs-angular-modules-generic-generic-list.page-QqBNS185.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-QqBNS185.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-_WrprZ_o.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-_WrprZ_o.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +17 -8
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-okZVmcd5.mjs → sdcorejs-angular-modules-pattern-base-api.service-B2HMyv8F.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-okZVmcd5.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-B2HMyv8F.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-LPUj7MqG.mjs → sdcorejs-angular-modules-pattern-create.component-CNtkbnRK.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-LPUj7MqG.mjs.map → sdcorejs-angular-modules-pattern-create.component-CNtkbnRK.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-2-dyjvCH.mjs → sdcorejs-angular-modules-pattern-create.component-DlNyY3e7.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-2-dyjvCH.mjs.map → sdcorejs-angular-modules-pattern-create.component-DlNyY3e7.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-BCoG3bVV.mjs → sdcorejs-angular-modules-pattern-create.component-DxV_0Ckg.mjs} +11 -7
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DxV_0Ckg.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-Caua6Xto.mjs → sdcorejs-angular-modules-pattern-customer.service-DS0cFc3u.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-Caua6Xto.mjs.map → sdcorejs-angular-modules-pattern-customer.service-DS0cFc3u.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-_c_4slgf.mjs → sdcorejs-angular-modules-pattern-detail.component-B_1ppVNA.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-_c_4slgf.mjs.map → sdcorejs-angular-modules-pattern-detail.component-B_1ppVNA.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-B2Y0PbbC.mjs → sdcorejs-angular-modules-pattern-detail.component-CFvwPHFx.mjs} +58 -55
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CFvwPHFx.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-C_HziBQN.mjs → sdcorejs-angular-modules-pattern-flow.component-Ba4xO_tF.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-C_HziBQN.mjs.map → sdcorejs-angular-modules-pattern-flow.component-Ba4xO_tF.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-B2dNqckm.mjs → sdcorejs-angular-modules-pattern-index.component-DvwY0K3t.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-B2dNqckm.mjs.map → sdcorejs-angular-modules-pattern-index.component-DvwY0K3t.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-Dq8Q8Vfm.mjs → sdcorejs-angular-modules-pattern-lines-table-form.component-BSAQaAgH.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-Dq8Q8Vfm.mjs.map → sdcorejs-angular-modules-pattern-lines-table-form.component-BSAQaAgH.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BIv2k6NI.mjs +506 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BIv2k6NI.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CeX57FPi.mjs → sdcorejs-angular-modules-pattern-list.component-BYyL5Q5n.mjs} +30 -39
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BYyL5Q5n.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CZRTnqNx.mjs +501 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CZRTnqNx.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-DS8A17mM.mjs → sdcorejs-angular-modules-pattern-list.component-DF7CvaVG.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-DS8A17mM.mjs.map → sdcorejs-angular-modules-pattern-list.component-DF7CvaVG.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Bs9hhMr7.mjs → sdcorejs-angular-modules-pattern-list.component-nMyLso8Z.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Bs9hhMr7.mjs.map → sdcorejs-angular-modules-pattern-list.component-nMyLso8Z.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-Dfil91qL.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-CS7VK5Ol.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-Dfil91qL.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-CS7VK5Ol.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs → sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs} +4 -22
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs → sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs} +26 -27
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-PaIGZ1ve.mjs → sdcorejs-angular-modules-pattern-product.service-KKWwzMEG.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-PaIGZ1ve.mjs.map → sdcorejs-angular-modules-pattern-product.service-KKWwzMEG.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-B8j8cieu.mjs → sdcorejs-angular-modules-pattern-profile.component-XDuLwzEl.mjs} +25 -15
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-XDuLwzEl.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-0Vh73aXL.mjs → sdcorejs-angular-modules-pattern-routes--ScZNg7A.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-0Vh73aXL.mjs.map → sdcorejs-angular-modules-pattern-routes--ScZNg7A.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-Cw9uJySU.mjs → sdcorejs-angular-modules-pattern-routes-Bka6PaRB.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-Cw9uJySU.mjs.map → sdcorejs-angular-modules-pattern-routes-Bka6PaRB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-nrxSHE-O.mjs → sdcorejs-angular-modules-pattern-routes-CCwFQAdd.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-nrxSHE-O.mjs.map → sdcorejs-angular-modules-pattern-routes-CCwFQAdd.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFT9DyKj.mjs → sdcorejs-angular-modules-pattern-routes-CKryLRCh.mjs} +8 -8
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFT9DyKj.mjs.map → sdcorejs-angular-modules-pattern-routes-CKryLRCh.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFLETqYK.mjs → sdcorejs-angular-modules-pattern-routes-Dr72yGSt.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFLETqYK.mjs.map → sdcorejs-angular-modules-pattern-routes-Dr72yGSt.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BoB2usST.mjs → sdcorejs-angular-modules-pattern-routes-P9WvwSEW.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BoB2usST.mjs.map → sdcorejs-angular-modules-pattern-routes-P9WvwSEW.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-_EDJ1-63.mjs +65 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-_EDJ1-63.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-n4kpjO0y.mjs +56 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-n4kpjO0y.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-CJ6hUHjk.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-DHhmKKVI.mjs} +12 -12
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-CJ6hUHjk.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-DHhmKKVI.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-C_AFK_9X.mjs → sdcorejs-angular-modules-pattern-shell.component-DxNC-ixx.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-C_AFK_9X.mjs.map → sdcorejs-angular-modules-pattern-shell.component-DxNC-ixx.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-TWYHj6in.mjs +480 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-TWYHj6in.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-B7H9pp-R.mjs → sdcorejs-angular-modules-pattern-update.component-BcBxBqWB.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-B7H9pp-R.mjs.map → sdcorejs-angular-modules-pattern-update.component-BcBxBqWB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-Dhfba-qx.mjs → sdcorejs-angular-modules-pattern-update.component-BntTyV55.mjs} +9 -6
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BntTyV55.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-hRTu79uE.mjs → sdcorejs-angular-modules-pattern-update.component-CJjZWZuz.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-hRTu79uE.mjs.map → sdcorejs-angular-modules-pattern-update.component-CJjZWZuz.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +171 -158
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +34 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-query-params.mjs +226 -0
- package/fesm2022/sdcorejs-angular-services-query-params.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +24 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/forms/date/index.d.ts +2 -0
- package/forms/directives/index.d.ts +1 -1
- package/i18n/index.d.ts +159 -9
- package/modules/layout/index.d.ts +2 -1
- package/modules/pattern/README.md +5 -4
- package/modules/pattern/docs/detail.md +18 -9
- package/modules/pattern/docs/drawer.md +185 -83
- package/modules/pattern/docs/header-actions.md +1 -1
- package/modules/pattern/docs/list.md +3 -3
- package/modules/pattern/docs/states.md +1 -1
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +12 -16
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +58 -29
- package/modules/pattern/features/category/pages/list/list.component.html +11 -3
- package/modules/pattern/features/category/pages/list/list.component.ts +36 -10
- package/modules/pattern/features/category/routes.ts +5 -22
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +7 -11
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +70 -27
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +9 -53
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +53 -19
- package/modules/pattern/features/customer/entity.resolver.ts +1 -1
- package/modules/pattern/features/customer/pages/list/list.component.html +18 -3
- package/modules/pattern/features/customer/pages/list/list.component.ts +43 -16
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +17 -8
- package/modules/pattern/features/customer/routes.ts +6 -27
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +37 -56
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +14 -76
- package/modules/pattern/features/order/pages/create/create.component.ts +7 -3
- package/modules/pattern/features/order/pages/detail/detail.component.ts +1 -1
- package/modules/pattern/features/order/pages/update/update.component.ts +5 -2
- package/package.json +17 -5
- package/services/confirm/index.d.ts +22 -81
- package/services/excel/index.d.ts +59 -0
- package/services/query-params/index.d.ts +67 -0
- package/utilities/extensions/index.d.ts +10 -1
- package/components/history/index.d.ts +0 -23
- package/fesm2022/sdcorejs-angular-components-history.mjs +0 -54
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CB4F9cBe.mjs +0 -144
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CB4F9cBe.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CowdEzyv.mjs +0 -145
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CowdEzyv.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BCoG3bVV.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +0 -18
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-Bu6E63bN.mjs +0 -148
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-Bu6E63bN.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-B2Y0PbbC.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs +0 -87
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs +0 -232
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs +0 -70
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B3-th1z4.mjs +0 -164
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B3-th1z4.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CRttQEXa.mjs +0 -118
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CRttQEXa.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CeX57FPi.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-B8j8cieu.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CZusLcS3.mjs +0 -74
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CZusLcS3.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Cq4BqjE9.mjs +0 -99
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Cq4BqjE9.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-C74EEboR.mjs +0 -143
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-C74EEboR.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Dj9lvkCP.mjs +0 -132
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Dj9lvkCP.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Dhfba-qx.mjs.map +0 -1
- package/modules/pattern/features/category/entity.resolver.ts +0 -27
|
@@ -1,7 +1,7 @@
|
|
|
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 { inject, TemplateRef, Directive, ElementRef, input, booleanAttribute, output, contentChild, computed, signal, effect, isSignal, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { inject, TemplateRef, Directive, ElementRef, Injector, input, booleanAttribute, output, model, contentChild, computed, signal, viewChildren, effect, isSignal, untracked, DestroyRef, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
5
|
import * as i2 from '@angular/material/checkbox';
|
|
6
6
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
7
7
|
import * as i4 from '@angular/material/radio';
|
|
@@ -9,10 +9,31 @@ import { MatRadioModule } from '@angular/material/radio';
|
|
|
9
9
|
import * as i3 from '@angular/material/progress-spinner';
|
|
10
10
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
11
11
|
import { SdButton, SdButtonItem } from '@sdcorejs/angular/components/button';
|
|
12
|
-
import {
|
|
12
|
+
import { SdHighlight } from '@sdcorejs/angular/components/highlight';
|
|
13
|
+
import { ɵSdSelectionBar as _SdSelectionBar } from '@sdcorejs/angular/components/quick-action';
|
|
13
14
|
import { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';
|
|
14
15
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Thay nội dung mặc định khi cây không có hàng nào để hiện: cây rỗng (`searching: false`) hoặc
|
|
19
|
+
* không có mục khớp chữ đang tìm (`searching: true`, `text` là chữ đó).
|
|
20
|
+
*/
|
|
21
|
+
class SdTreeEmptyDefDirective {
|
|
22
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
templateRef = inject(TemplateRef);
|
|
26
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdTreeEmptyDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.25", type: SdTreeEmptyDefDirective, isStandalone: true, selector: "[sdTreeEmptyDef]", ngImport: i0 });
|
|
28
|
+
}
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdTreeEmptyDefDirective, decorators: [{
|
|
30
|
+
type: Directive,
|
|
31
|
+
args: [{
|
|
32
|
+
selector: '[sdTreeEmptyDef]',
|
|
33
|
+
standalone: true,
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
|
|
16
37
|
// why: Angular cannot infer a projected directive generic from the parent
|
|
17
38
|
// `sd-tree` option when this directive has no generic input of its own. `any`
|
|
18
39
|
// preserves the documented strictTemplates syntax; the Tree models still
|
|
@@ -33,6 +54,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
33
54
|
}]
|
|
34
55
|
}] });
|
|
35
56
|
|
|
57
|
+
// Q4: cùng thời gian chờ với ô tìm của sd-kanban. `filter()` thường được gọi theo từng phím gõ.
|
|
58
|
+
const SEARCH_DEBOUNCE_MS = 300;
|
|
36
59
|
const DEFAULT_STATIC_TREE = { loadType: 'static' };
|
|
37
60
|
const EMPTY_TREE_ITEMS = [];
|
|
38
61
|
/** Shared empty lookup — chế độ không cascade khỏi phải dựng Map mới mỗi lần recompute. */
|
|
@@ -40,6 +63,7 @@ const EMPTY_DESCENDANT_COUNTS = new Map();
|
|
|
40
63
|
class SdTree {
|
|
41
64
|
#host = inject(ElementRef);
|
|
42
65
|
#i18n = inject(I18nService);
|
|
66
|
+
#injector = inject(Injector);
|
|
43
67
|
autoIdInput = input(undefined, ...(ngDevMode ? [{ debugName: "autoIdInput", alias: 'autoId' }] : [{ alias: 'autoId' }]));
|
|
44
68
|
option = input(undefined, ...(ngDevMode ? [{ debugName: "option" }] : []));
|
|
45
69
|
/** Migration bridge. New usage should put the data source in `option.items`. */
|
|
@@ -57,7 +81,20 @@ class SdTree {
|
|
|
57
81
|
expandChange = output();
|
|
58
82
|
collapseChange = output();
|
|
59
83
|
loadError = output();
|
|
84
|
+
/**
|
|
85
|
+
* Id của nút đang mở (chế độ `navigation`). Là model trên component, không nằm trong `[option]`, để gắn hai
|
|
86
|
+
* chiều với URL.
|
|
87
|
+
*/
|
|
88
|
+
activeId = model(null, ...(ngDevMode ? [{ debugName: "activeId" }] : []));
|
|
89
|
+
/** Phát mỗi lần người dùng mở một nút, kể cả nút đang mở. */
|
|
90
|
+
activeChange = output();
|
|
91
|
+
/**
|
|
92
|
+
* Trạng thái mở. Có giá trị: là nguồn của trạng thái mở (hai chiều), `expanded` và `defaultExpanded` không còn
|
|
93
|
+
* áp dụng. `undefined`: cây tự quản lý như cũ. Đổi `items` không reset.
|
|
94
|
+
*/
|
|
95
|
+
expandedIds = model(...(ngDevMode ? [undefined, { debugName: "expandedIds" }] : []));
|
|
60
96
|
itemDef = contentChild((SdTreeItemDefDirective), ...(ngDevMode ? [{ debugName: "itemDef" }] : []));
|
|
97
|
+
emptyDef = contentChild(SdTreeEmptyDefDirective, ...(ngDevMode ? [{ debugName: "emptyDef" }] : []));
|
|
61
98
|
resolvedItemsSource = computed(() => {
|
|
62
99
|
return this.option()?.items ?? this.items() ?? EMPTY_TREE_ITEMS;
|
|
63
100
|
}, ...(ngDevMode ? [{ debugName: "resolvedItemsSource" }] : []));
|
|
@@ -66,6 +103,7 @@ class SdTree {
|
|
|
66
103
|
resolvedCommands = computed(() => this.option()?.commands ?? this.commands() ?? [], ...(ngDevMode ? [{ debugName: "resolvedCommands" }] : []));
|
|
67
104
|
resolvedSelectable = computed(() => this.option()?.selectable ?? this.selectable(), ...(ngDevMode ? [{ debugName: "resolvedSelectable" }] : []));
|
|
68
105
|
resolvedShowLines = computed(() => this.option()?.showLines ?? this.showLines(), ...(ngDevMode ? [{ debugName: "resolvedShowLines" }] : []));
|
|
106
|
+
navigation = computed(() => this.option()?.navigation === true, ...(ngDevMode ? [{ debugName: "navigation" }] : []));
|
|
69
107
|
autoId = computed(() => {
|
|
70
108
|
const scope = this.option()?.autoId ?? this.autoIdInput();
|
|
71
109
|
return scope ? `components-tree-${scope}` : undefined;
|
|
@@ -82,15 +120,50 @@ class SdTree {
|
|
|
82
120
|
#selectedIds = signal(new Set(), ...(ngDevMode ? [{ debugName: "#selectedIds" }] : []));
|
|
83
121
|
#filterText = signal('', ...(ngDevMode ? [{ debugName: "#filterText" }] : []));
|
|
84
122
|
#reloadTick = signal(0, ...(ngDevMode ? [{ debugName: "#reloadTick" }] : []));
|
|
123
|
+
#search = signal(null, ...(ngDevMode ? [{ debugName: "#search" }] : []));
|
|
124
|
+
/** Nút người dùng đã đóng trong kết quả tìm. Tách khỏi trạng thái mở thật để xoá chữ là cây về như cũ. */
|
|
125
|
+
#searchCollapsed = signal(new Set(), ...(ngDevMode ? [{ debugName: "#searchCollapsed" }] : []));
|
|
126
|
+
/** Đang chờ debounce hoặc chờ `onSearch` trả về. */
|
|
127
|
+
searchPending = signal(false, ...(ngDevMode ? [{ debugName: "searchPending" }] : []));
|
|
128
|
+
#serverSearch = computed(() => {
|
|
129
|
+
const tree = this.resolvedTree();
|
|
130
|
+
return tree.loadType === 'lazy' && !!tree.onSearch;
|
|
131
|
+
}, ...(ngDevMode ? [{ debugName: "#serverSearch" }] : []));
|
|
132
|
+
/** Chữ cần tô trong nhãn: chữ đang lọc (static) hoặc chữ của kết quả đang hiện (server). */
|
|
133
|
+
highlightTerm = computed(() => (this.#serverSearch() ? (this.#search()?.text ?? '') : this.#filterText().trim()), ...(ngDevMode ? [{ debugName: "highlightTerm" }] : []));
|
|
134
|
+
#expandedIdSet = computed(() => {
|
|
135
|
+
const ids = this.expandedIds();
|
|
136
|
+
return ids === undefined ? undefined : new Set(ids);
|
|
137
|
+
}, ...(ngDevMode ? [{ debugName: "#expandedIdSet" }] : []));
|
|
85
138
|
rootLoading = signal(false, ...(ngDevMode ? [{ debugName: "rootLoading" }] : []));
|
|
86
139
|
rootError = signal(null, ...(ngDevMode ? [{ debugName: "rootError" }] : []));
|
|
87
140
|
activeNodeId = signal(null, ...(ngDevMode ? [{ debugName: "activeNodeId" }] : []));
|
|
141
|
+
buttons = viewChildren(SdButton, ...(ngDevMode ? [{ debugName: "buttons" }] : []));
|
|
142
|
+
/** Hàng đã mở menu ⋯ bằng bàn phím; menu đóng thì focus quay về đây. */
|
|
143
|
+
#keyboardMenuRow = null;
|
|
88
144
|
#rootLoadId = 0;
|
|
89
145
|
#lastSource;
|
|
90
146
|
#lastSourceValue;
|
|
91
147
|
#lastReloadTick = -1;
|
|
92
148
|
#treeGeneration = 0;
|
|
93
149
|
#lazyLoadIds = new Map();
|
|
150
|
+
/** Lần tải con đang chạy theo id, để `reveal`, `expand` và `expandedIds` không gọi `onExpandChildren` hai lần. */
|
|
151
|
+
#lazyLoads = new Map();
|
|
152
|
+
#revealController = null;
|
|
153
|
+
#searchController = null;
|
|
154
|
+
/**
|
|
155
|
+
* Data của các nút từng có trong kết quả tìm, để nút được tick ở đó vẫn là lựa chọn sau khi xoá chữ tìm. Chỉ giữ
|
|
156
|
+
* nút đang được chọn: dọn mỗi lần kết quả tìm được thay, bị xoá, và khi cây tải lại (`#pruneSearchSeen`).
|
|
157
|
+
*/
|
|
158
|
+
#searchSeen = new Map();
|
|
159
|
+
#searchSeenTick = signal(0, ...(ngDevMode ? [{ debugName: "#searchSeenTick" }] : []));
|
|
160
|
+
#searchTimer;
|
|
161
|
+
/** Nút `reveal` đang chờ hàng của nó được render để cuộn tới. */
|
|
162
|
+
#pendingScrollId = null;
|
|
163
|
+
/** Id do người dùng vừa mở: lần đổi `activeId` này không cần `reveal`. */
|
|
164
|
+
#userActiveId = null;
|
|
165
|
+
/** Id đã `reveal` xong: tải lại `items` không cuộn lại lần nữa. */
|
|
166
|
+
#revealedId = null;
|
|
94
167
|
normalizedFilterText = computed(() => normalizeText(this.#filterText()), ...(ngDevMode ? [{ debugName: "normalizedFilterText" }] : []));
|
|
95
168
|
selectionVisible = computed(() => this.resolvedSelectable() && this.resolvedSelector()?.visible === true, ...(ngDevMode ? [{ debugName: "selectionVisible" }] : []));
|
|
96
169
|
/**
|
|
@@ -103,9 +176,44 @@ class SdTree {
|
|
|
103
176
|
const selectedItems = this.option()?.selectedItems ?? this.selectedItemsInput();
|
|
104
177
|
return selectedItems ? this.#idsFromSelectedItems(selectedItems) : this.#selectedIds();
|
|
105
178
|
}, ...(ngDevMode ? [{ debugName: "selectedIdSet" }] : []));
|
|
106
|
-
|
|
179
|
+
/** Cây thật (đã tải). Vẫn được dựng khi đang hiện kết quả tìm, vì lựa chọn không được phụ thuộc vào thứ đang hiện. */
|
|
180
|
+
#loadedNodes = computed(() => this.#buildNodes(this.#rootItems(), 0, null), ...(ngDevMode ? [{ debugName: "#loadedNodes" }] : []));
|
|
181
|
+
rootNodes = computed(() => {
|
|
182
|
+
const search = this.#search();
|
|
183
|
+
return search ? this.#buildSearchNodes(search, search.roots, 0, null) : this.#loadedNodes();
|
|
184
|
+
}, ...(ngDevMode ? [{ debugName: "rootNodes" }] : []));
|
|
185
|
+
/**
|
|
186
|
+
* Mọi nút mà lựa chọn có thể trỏ tới: nút đã tải, nút trong kết quả tìm đang hiện, và nút từng xuất hiện trong
|
|
187
|
+
* kết quả tìm (`#searchSeen`).
|
|
188
|
+
*
|
|
189
|
+
* why: lựa chọn từng được tính trên `rootNodes()`, tức trên cây KẾT QUẢ khi đang tìm. Tick một nút trong kết
|
|
190
|
+
* quả sẽ phát `selectedItemsChange` thiếu các nút đã chọn nằm ngoài kết quả, và consumer hai chiều ghi đè mất
|
|
191
|
+
* chúng. Ngược lại, nút chỉ có trong kết quả sẽ rơi khỏi lựa chọn ngay khi xoá chữ tìm.
|
|
192
|
+
*/
|
|
193
|
+
#selectableNodes = computed(() => {
|
|
194
|
+
const loaded = this.#flattenAll(this.#loadedNodes());
|
|
195
|
+
const search = this.#search();
|
|
196
|
+
this.#searchSeenTick();
|
|
197
|
+
if (!search && !this.#searchSeen.size)
|
|
198
|
+
return loaded;
|
|
199
|
+
const result = [...loaded];
|
|
200
|
+
const ids = new Set(loaded.map(node => node.id));
|
|
201
|
+
const add = (id, data) => {
|
|
202
|
+
if (ids.has(id))
|
|
203
|
+
return;
|
|
204
|
+
ids.add(id);
|
|
205
|
+
result.push({ id, data });
|
|
206
|
+
};
|
|
207
|
+
if (search)
|
|
208
|
+
for (const node of this.#flattenAll(this.rootNodes()))
|
|
209
|
+
add(node.id, node.data);
|
|
210
|
+
for (const [id, data] of this.#searchSeen)
|
|
211
|
+
add(id, data);
|
|
212
|
+
return result;
|
|
213
|
+
}, ...(ngDevMode ? [{ debugName: "#selectableNodes" }] : []));
|
|
107
214
|
visibleNodes = computed(() => {
|
|
108
|
-
|
|
215
|
+
// Tìm trên server: kết quả đã là cây cần hiện, không lọc lại các nút đã tải.
|
|
216
|
+
const filterText = this.#serverSearch() ? '' : this.normalizedFilterText();
|
|
109
217
|
const result = [];
|
|
110
218
|
const walk = (nodes) => {
|
|
111
219
|
for (const node of nodes) {
|
|
@@ -122,6 +230,13 @@ class SdTree {
|
|
|
122
230
|
walk(this.rootNodes());
|
|
123
231
|
return result;
|
|
124
232
|
}, ...(ngDevMode ? [{ debugName: "visibleNodes" }] : []));
|
|
233
|
+
/** Không có hàng nào để hiện: cây rỗng, hoặc không có mục khớp chữ đang tìm. `null` khi cây có hàng. */
|
|
234
|
+
emptyState = computed(() => {
|
|
235
|
+
if (this.visibleNodes().length)
|
|
236
|
+
return null;
|
|
237
|
+
const text = this.#serverSearch() ? (this.#search()?.text ?? '') : this.#filterText();
|
|
238
|
+
return { searching: !!text.trim(), text: text.trim() };
|
|
239
|
+
}, ...(ngDevMode ? [{ debugName: "emptyState" }] : []));
|
|
125
240
|
selectedItems = computed(() => this.#selectedItemsFromIds(this.selectedIdSet()), ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
|
|
126
241
|
/** Use visible siblings so filtering and collapsed/lazy branches leave no dangling connectors. */
|
|
127
242
|
treeLines = computed(() => {
|
|
@@ -163,22 +278,38 @@ class SdTree {
|
|
|
163
278
|
return !hidden;
|
|
164
279
|
});
|
|
165
280
|
}, ...(ngDevMode ? [{ debugName: "visibleSelectionActions" }] : []));
|
|
281
|
+
/** @deprecated Dùng `visibleSelectionActions()`; thanh chọn dùng chung tự dựng autoId. Sẽ bỏ ở một bản breaking. */
|
|
166
282
|
selectionActionViews = computed(() => {
|
|
167
283
|
return this.visibleSelectionActions().map((action, index) => ({
|
|
168
284
|
action,
|
|
169
285
|
autoId: this.#selectionActionAutoId(index),
|
|
170
286
|
}));
|
|
171
287
|
}, ...(ngDevMode ? [{ debugName: "selectionActionViews" }] : []));
|
|
288
|
+
/** `selector.actions` (đã bỏ lệnh ẩn) theo shape của thanh chọn dùng chung; index khớp `visibleSelectionActions`. */
|
|
289
|
+
selectionBarActions = computed(() => this.visibleSelectionActions().map(action => ({
|
|
290
|
+
variant: 'normal',
|
|
291
|
+
icon: action.icon,
|
|
292
|
+
fontSet: action.fontSet,
|
|
293
|
+
tooltip: action.tooltip,
|
|
294
|
+
title: action.title,
|
|
295
|
+
color: action.color,
|
|
296
|
+
type: action.type,
|
|
297
|
+
click: () => this.onSelectionAction(action),
|
|
298
|
+
})), ...(ngDevMode ? [{ debugName: "selectionBarActions" }] : []));
|
|
299
|
+
/**
|
|
300
|
+
* @deprecated Nút xoá chọn thuộc thanh chọn dùng chung, autoId do thanh dựng từ `autoId()` của cây. Sẽ bỏ ở một bản
|
|
301
|
+
* breaking.
|
|
302
|
+
*/
|
|
172
303
|
clearSelectionAutoId = computed(() => {
|
|
173
304
|
const base = this.autoId();
|
|
174
305
|
return base ? `${base}-clear-selection` : null;
|
|
175
306
|
}, ...(ngDevMode ? [{ debugName: "clearSelectionAutoId" }] : []));
|
|
176
307
|
/**
|
|
177
|
-
* why: chọn node mà selector KHÔNG khai action nào thì thanh
|
|
178
|
-
*
|
|
179
|
-
*
|
|
308
|
+
* why: chọn node mà selector KHÔNG khai action nào thì thanh chọn chỉ còn message + nút ✕, tức nói lại
|
|
309
|
+
* đúng thứ checkbox đã nói. Đó cũng là lý do `<sd-tree-select>` — vốn chỉ chọn rồi bấm "Áp dụng" ở
|
|
310
|
+
* footer modal, không có action nào — không có thanh này.
|
|
180
311
|
*/
|
|
181
|
-
selectionQuickActionOpened = computed(() => this.selectedCount() > 0 && this.
|
|
312
|
+
selectionQuickActionOpened = computed(() => this.selectedCount() > 0 && this.visibleSelectionActions().length > 0, ...(ngDevMode ? [{ debugName: "selectionQuickActionOpened" }] : []));
|
|
182
313
|
/**
|
|
183
314
|
* Template-facing row model. Expensive/variable values are resolved once per
|
|
184
315
|
* signal recomputation so the HTML does not call helper methods for every CD pass.
|
|
@@ -191,11 +322,28 @@ class SdTree {
|
|
|
191
322
|
const nodes = this.visibleNodes();
|
|
192
323
|
const requestedActiveId = this.activeNodeId();
|
|
193
324
|
const activeId = nodes.some(node => node.id === requestedActiveId) ? requestedActiveId : nodes[0]?.id;
|
|
325
|
+
const navigation = this.navigation();
|
|
326
|
+
const openId = navigation ? this.activeId() : null;
|
|
327
|
+
const selectionVisible = this.selectionVisible();
|
|
328
|
+
const numberFormat = new Intl.NumberFormat(this.#i18n.locale());
|
|
329
|
+
const matched = this.#search()?.matched;
|
|
194
330
|
// why: đếm 1 lượt bottom-up cho CẢ cây rồi tra theo id. Bản cũ gọi `#flattenAll(node.children)`
|
|
195
331
|
// cho TỪNG node hiển thị ngay trong map này → O(n²) kèm một mảng mới mỗi node mỗi lần
|
|
196
332
|
// recompute. Chỉ cascade 'descendants' mới cần số liệu này nên các chế độ khác bỏ qua hẳn.
|
|
197
333
|
const selectedDescendants = selector?.cascade === 'descendants' ? this.#countSelectedDescendants(this.rootNodes(), selectedIds) : EMPTY_DESCENDANT_COUNTS;
|
|
198
|
-
return nodes.map(node =>
|
|
334
|
+
return nodes.map(node => {
|
|
335
|
+
const view = this.#toViewNode(node, selectedIds, selectedItems, selector, commands, node.id === activeId, selectedDescendants);
|
|
336
|
+
const count = formatCount(node.treeItem.count, numberFormat);
|
|
337
|
+
view.active = navigation && node.id === openId;
|
|
338
|
+
// Q2: khi điều hướng, checkbox tự thể hiện lựa chọn; nền hàng chỉ dành cho nút đang mở.
|
|
339
|
+
view.highlighted = navigation ? view.active : view.selected;
|
|
340
|
+
// Q3: `aria-selected` là nút đang mở; lựa chọn của checkbox đi qua `aria-checked`.
|
|
341
|
+
view.ariaSelected = navigation ? view.active : selectionVisible ? view.selected : null;
|
|
342
|
+
view.muted = !!matched && !matched.has(node.id);
|
|
343
|
+
view.count = count;
|
|
344
|
+
view.ariaLabel = count === null ? null : `${node.label}, ${count}`;
|
|
345
|
+
return view;
|
|
346
|
+
});
|
|
199
347
|
}, ...(ngDevMode ? [{ debugName: "visibleViewNodes" }] : []));
|
|
200
348
|
trackByNode = (_index, node) => node.id;
|
|
201
349
|
constructor() {
|
|
@@ -218,12 +366,81 @@ class SdTree {
|
|
|
218
366
|
this.#loadRootItems(source);
|
|
219
367
|
});
|
|
220
368
|
});
|
|
369
|
+
// R2: `activeId` đổi từ ngoài (URL, nút khác trên trang) thì tự mở tới nút đó.
|
|
370
|
+
effect(() => {
|
|
371
|
+
const id = this.activeId();
|
|
372
|
+
const navigation = this.navigation();
|
|
373
|
+
const loading = this.rootLoading();
|
|
374
|
+
// Đang hiện kết quả tìm thì cây thật không ở trên màn hình; xoá chữ tìm xong effect chạy lại và mở tới nút.
|
|
375
|
+
const searching = !!this.#search();
|
|
376
|
+
this.#rootItems();
|
|
377
|
+
untracked(() => {
|
|
378
|
+
if (id !== this.#revealedId)
|
|
379
|
+
this.#revealedId = null;
|
|
380
|
+
if (id === this.#userActiveId)
|
|
381
|
+
return;
|
|
382
|
+
if (!navigation || id === null || loading || searching || id === this.#revealedId)
|
|
383
|
+
return;
|
|
384
|
+
this.#userActiveId = null;
|
|
385
|
+
void this.reveal(id).then(revealed => {
|
|
386
|
+
if (revealed && this.activeId() === id)
|
|
387
|
+
this.#revealedId = id;
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
inject(DestroyRef).onDestroy(() => {
|
|
392
|
+
this.#cancelSearch();
|
|
393
|
+
this.#revealController?.abort();
|
|
394
|
+
});
|
|
395
|
+
// R7: lazy + `expandedIds` từ ngoài: nút được khai là đang mở thì phải có con để hiện.
|
|
396
|
+
effect(() => {
|
|
397
|
+
const expanded = this.#expandedIdSet();
|
|
398
|
+
if (!expanded || this.resolvedTree().loadType !== 'lazy' || this.#search())
|
|
399
|
+
return;
|
|
400
|
+
const loaded = this.#lazyChildren();
|
|
401
|
+
const pending = this.#flattenAll(this.rootNodes()).filter(node => expanded.has(node.id) && !loaded[node.id] && node.treeItem.hasChildren !== false);
|
|
402
|
+
untracked(() => {
|
|
403
|
+
for (const node of pending) {
|
|
404
|
+
if (!node.loadError)
|
|
405
|
+
void this.#ensureLazyChildren(node);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
effect(() => {
|
|
410
|
+
const opened = this.buttons().some(button => button.popover.opened());
|
|
411
|
+
untracked(() => {
|
|
412
|
+
const row = this.#keyboardMenuRow;
|
|
413
|
+
if (opened || !row)
|
|
414
|
+
return;
|
|
415
|
+
this.#keyboardMenuRow = null;
|
|
416
|
+
// Action Popover trả focus về nút ⋯; menu mở từ hàng thì hàng mới là nơi người dùng đang đứng.
|
|
417
|
+
if (row.isConnected && row.contains(document.activeElement))
|
|
418
|
+
row.focus();
|
|
419
|
+
});
|
|
420
|
+
});
|
|
221
421
|
}
|
|
222
422
|
reload() {
|
|
223
423
|
this.#reloadTick.update(value => value + 1);
|
|
224
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Lọc cây theo chữ. Lazy có `tree.onSearch`: tìm trên server (debounce, huỷ lần trước) và hiện kết quả thay cây;
|
|
427
|
+
* còn lại: lọc ngay trên các nút đã tải. Chữ rỗng trả cây về trạng thái trước khi tìm.
|
|
428
|
+
*/
|
|
225
429
|
filter(searchText) {
|
|
226
|
-
|
|
430
|
+
const text = searchText ?? '';
|
|
431
|
+
this.#filterText.set(text);
|
|
432
|
+
const tree = this.resolvedTree();
|
|
433
|
+
const onSearch = tree.loadType === 'lazy' ? tree.onSearch : undefined;
|
|
434
|
+
this.#cancelSearch();
|
|
435
|
+
// Thiếu `onSearch` mà vẫn còn kết quả đang hiện (option vừa đổi): trả cây về, rồi lọc tại chỗ như thường.
|
|
436
|
+
if (!onSearch || !text.trim()) {
|
|
437
|
+
this.#search.set(null);
|
|
438
|
+
this.#searchCollapsed.set(new Set());
|
|
439
|
+
this.#pruneSearchSeen();
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
this.searchPending.set(true);
|
|
443
|
+
this.#searchTimer = setTimeout(() => void this.#runSearch(text, onSearch), SEARCH_DEBOUNCE_MS);
|
|
227
444
|
}
|
|
228
445
|
isSelected(node) {
|
|
229
446
|
return this.selectedIdSet().has(node.id);
|
|
@@ -253,21 +470,76 @@ class SdTree {
|
|
|
253
470
|
const currentNode = this.#findNode(node.id) ?? node;
|
|
254
471
|
if (!currentNode.hasChildren || currentNode.isLoading)
|
|
255
472
|
return;
|
|
256
|
-
if (currentNode.isExpanded)
|
|
257
|
-
this.#
|
|
258
|
-
|
|
259
|
-
this
|
|
260
|
-
|
|
261
|
-
|
|
473
|
+
if (currentNode.isExpanded)
|
|
474
|
+
this.#collapseNode(currentNode);
|
|
475
|
+
else
|
|
476
|
+
await this.#expandNode(currentNode);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Mở các nút cha của `id` rồi cuộn tới nút trong vùng cuộn gần nhất của cây; không lấy focus.
|
|
480
|
+
* Static tìm trong `items`; lazy dùng `tree.onResolvePath` khi nút chưa được tải.
|
|
481
|
+
* Trả `false` khi không tìm thấy, bị một lần `reveal` mới hơn huỷ, hoặc lỗi tải.
|
|
482
|
+
*/
|
|
483
|
+
async reveal(id) {
|
|
484
|
+
this.#revealController?.abort();
|
|
485
|
+
const controller = new AbortController();
|
|
486
|
+
this.#revealController = controller;
|
|
487
|
+
const { signal } = controller;
|
|
488
|
+
let path = this.#ancestorIds(id);
|
|
489
|
+
if (!path) {
|
|
490
|
+
const tree = this.resolvedTree();
|
|
491
|
+
if (tree.loadType !== 'lazy' || !tree.onResolvePath)
|
|
492
|
+
return false;
|
|
493
|
+
try {
|
|
494
|
+
path = [...(await tree.onResolvePath(id, signal))];
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
if (!signal.aborted)
|
|
498
|
+
this.loadError.emit({ error });
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
262
501
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
502
|
+
for (const ancestorId of path) {
|
|
503
|
+
if (signal.aborted)
|
|
504
|
+
return false;
|
|
505
|
+
const ancestor = this.#findNode(ancestorId);
|
|
506
|
+
if (!ancestor || !(await this.#expandNode(ancestor, signal)))
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
if (signal.aborted || !this.#findNode(id))
|
|
510
|
+
return false;
|
|
511
|
+
this.activeNodeId.set(id);
|
|
512
|
+
this.#pendingScrollId = id;
|
|
513
|
+
this.#scrollWhenRendered(id);
|
|
514
|
+
return true;
|
|
515
|
+
}
|
|
516
|
+
/** Mở một nút theo id. Trả `false` khi không tìm thấy, nút là lá, hoặc tải con bị lỗi. */
|
|
517
|
+
async expand(id) {
|
|
518
|
+
const node = this.#findNode(id);
|
|
519
|
+
return node ? this.#expandNode(node) : false;
|
|
520
|
+
}
|
|
521
|
+
/** Đóng một nút theo id. */
|
|
522
|
+
collapse(id) {
|
|
523
|
+
const node = this.#findNode(id);
|
|
524
|
+
if (node?.isExpanded)
|
|
525
|
+
this.#collapseNode(node);
|
|
526
|
+
}
|
|
527
|
+
/** Lazy: bỏ cache con của nút, gọi lại `onExpandChildren`, giữ trạng thái mở. Static: không làm gì. */
|
|
528
|
+
async reloadNode(id) {
|
|
529
|
+
if (this.resolvedTree().loadType !== 'lazy')
|
|
266
530
|
return;
|
|
267
|
-
this.#
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
531
|
+
const node = this.#findNode(id);
|
|
532
|
+
if (node)
|
|
533
|
+
await this.#ensureLazyChildren(node, true);
|
|
534
|
+
}
|
|
535
|
+
/** Đặt roving tabindex và focus vào một nút đang hiển thị. Trả `false` khi nút không hiển thị. */
|
|
536
|
+
focusNode(id) {
|
|
537
|
+
const row = this.#rowElement(id);
|
|
538
|
+
if (!row)
|
|
539
|
+
return false;
|
|
540
|
+
this.activeNodeId.set(id);
|
|
541
|
+
row.focus();
|
|
542
|
+
return true;
|
|
271
543
|
}
|
|
272
544
|
toggleSelection(node, event) {
|
|
273
545
|
event?.stopPropagation();
|
|
@@ -283,7 +555,9 @@ class SdTree {
|
|
|
283
555
|
}
|
|
284
556
|
else if (selector?.cascade === 'descendants') {
|
|
285
557
|
this.#setNodeAndDescendants(node, shouldSelect, selectedIds);
|
|
286
|
-
|
|
558
|
+
// Trong kết quả tìm, nút cha chỉ có các con khớp: không suy ra "đã chọn hết con" từ cây đó.
|
|
559
|
+
if (!this.#search())
|
|
560
|
+
this.#reconcileAncestors(node.parent, selectedIds);
|
|
287
561
|
}
|
|
288
562
|
else if (shouldSelect) {
|
|
289
563
|
selectedIds.add(node.id);
|
|
@@ -319,6 +593,10 @@ class SdTree {
|
|
|
319
593
|
});
|
|
320
594
|
void this.toggle(node);
|
|
321
595
|
}
|
|
596
|
+
/**
|
|
597
|
+
* @deprecated Trạng thái lỗi gốc không còn hiện `error.message` (thông điệp của exception không dành cho
|
|
598
|
+
* người dùng cuối); UI dùng `core.component.tree.load-error`. Đọc lỗi gốc qua `rootError()` hoặc `loadError`.
|
|
599
|
+
*/
|
|
322
600
|
errorMessage(error) {
|
|
323
601
|
if (error instanceof Error)
|
|
324
602
|
return error.message;
|
|
@@ -329,6 +607,15 @@ class SdTree {
|
|
|
329
607
|
onRowFocus(node) {
|
|
330
608
|
this.activeNodeId.set(node.id);
|
|
331
609
|
}
|
|
610
|
+
/** Chế độ điều hướng: bấm vào hàng (trừ chevron, checkbox/radio, ⋯) mở nút. */
|
|
611
|
+
onRowClick(node, event) {
|
|
612
|
+
if (!this.navigation())
|
|
613
|
+
return;
|
|
614
|
+
const target = event.target;
|
|
615
|
+
if (target?.closest?.('.sd-tree__toggle, .sd-tree__checkbox, .sd-tree__radio, .sd-tree__command-trigger'))
|
|
616
|
+
return;
|
|
617
|
+
this.#activate(node);
|
|
618
|
+
}
|
|
332
619
|
onRowKeydown(node, event) {
|
|
333
620
|
if (event.target !== event.currentTarget)
|
|
334
621
|
return;
|
|
@@ -362,23 +649,61 @@ class SdTree {
|
|
|
362
649
|
else if (nodes[index + 1]?.parent?.id === node.id)
|
|
363
650
|
this.#focusVisibleNode(index + 1);
|
|
364
651
|
return;
|
|
365
|
-
case 'ArrowLeft':
|
|
366
|
-
|
|
652
|
+
case 'ArrowLeft': {
|
|
653
|
+
// why: lá cũng có `isExpanded` (vd. `defaultExpanded: true` áp cho mọi mức), nên phải xét `hasChildren`;
|
|
654
|
+
// thiếu điều kiện này ← trên lá gọi `toggle` (không làm gì) thay vì về nút cha.
|
|
655
|
+
const open = node.hasChildren && node.isExpanded;
|
|
656
|
+
if (!open && !node.parent)
|
|
367
657
|
return;
|
|
368
658
|
event.preventDefault();
|
|
369
|
-
if (
|
|
659
|
+
if (open)
|
|
370
660
|
void this.toggle(node);
|
|
371
661
|
else
|
|
372
662
|
this.#focusVisibleNode(nodes.findIndex(item => item.id === node.parent?.id));
|
|
373
663
|
return;
|
|
664
|
+
}
|
|
665
|
+
case 'F10':
|
|
666
|
+
case 'ContextMenu':
|
|
667
|
+
// R4: Shift+F10 hoặc phím ContextMenu mở menu ⋯ của hàng đang focus.
|
|
668
|
+
if (!this.navigation() || (event.key === 'F10' && !event.shiftKey))
|
|
669
|
+
return;
|
|
670
|
+
if (this.#openRowMenu(event.currentTarget))
|
|
671
|
+
event.preventDefault();
|
|
672
|
+
return;
|
|
374
673
|
case 'Enter':
|
|
375
674
|
case ' ':
|
|
675
|
+
if (this.navigation() && event.key === 'Enter') {
|
|
676
|
+
event.preventDefault();
|
|
677
|
+
this.#activate(node);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
376
680
|
if (!this.selectionVisible())
|
|
377
681
|
return;
|
|
378
682
|
event.preventDefault();
|
|
379
683
|
this.toggleSelection(node);
|
|
380
684
|
}
|
|
381
685
|
}
|
|
686
|
+
#activate(node) {
|
|
687
|
+
const current = this.#findNode(node.id) ?? node;
|
|
688
|
+
// Người dùng đã tự chọn nút: bỏ lần `reveal` đang chạy để nó không cuộn cây đi chỗ khác.
|
|
689
|
+
this.#revealController?.abort();
|
|
690
|
+
this.#pendingScrollId = null;
|
|
691
|
+
this.#userActiveId = current.id;
|
|
692
|
+
this.activeNodeId.set(current.id);
|
|
693
|
+
this.activeId.set(current.id);
|
|
694
|
+
const event = { item: current.data, node: current };
|
|
695
|
+
this.option()?.onActivate?.(event);
|
|
696
|
+
this.activeChange.emit(event);
|
|
697
|
+
}
|
|
698
|
+
#openRowMenu(row) {
|
|
699
|
+
const trigger = row.querySelector('.sd-tree__command-trigger button');
|
|
700
|
+
if (!trigger || trigger.disabled)
|
|
701
|
+
return false;
|
|
702
|
+
this.#keyboardMenuRow = row;
|
|
703
|
+
if (trigger.getAttribute('aria-expanded') !== 'true')
|
|
704
|
+
trigger.click();
|
|
705
|
+
return true;
|
|
706
|
+
}
|
|
382
707
|
createContext(node) {
|
|
383
708
|
return this.#createContext(node, this.isSelected(node));
|
|
384
709
|
}
|
|
@@ -451,8 +776,11 @@ class SdTree {
|
|
|
451
776
|
return source;
|
|
452
777
|
}
|
|
453
778
|
#setRootItems(items) {
|
|
779
|
+
// Trước khi thay cây: lựa chọn còn được tính trên cây cũ, nên nút đang chọn từ kết quả tìm vẫn được giữ.
|
|
780
|
+
this.#pruneSearchSeen();
|
|
454
781
|
this.#treeGeneration += 1;
|
|
455
782
|
this.#lazyLoadIds.clear();
|
|
783
|
+
this.#lazyLoads.clear();
|
|
456
784
|
this.#rootItems.set([...(items ?? [])]);
|
|
457
785
|
this.#lazyChildren.set({});
|
|
458
786
|
this.#loadingState.set({});
|
|
@@ -465,6 +793,13 @@ class SdTree {
|
|
|
465
793
|
...node,
|
|
466
794
|
icon: this.#iconOf(node),
|
|
467
795
|
selected,
|
|
796
|
+
active: false,
|
|
797
|
+
highlighted: selected,
|
|
798
|
+
ariaSelected: null,
|
|
799
|
+
ariaLabel: null,
|
|
800
|
+
count: null,
|
|
801
|
+
menuLabel: this.#i18n.t('core.component.tree.open-menu', { label: node.label }),
|
|
802
|
+
muted: false,
|
|
468
803
|
selectionDisabled,
|
|
469
804
|
selectionIndeterminate: this.#isSelectionIndeterminate(node, selectedIds, selector, selectedDescendants),
|
|
470
805
|
toggleDisabled: !node.hasChildren || node.isLoading,
|
|
@@ -555,6 +890,9 @@ class SdTree {
|
|
|
555
890
|
// `visibleNodes` + `visibleViewNodes` map lại từ đầu. Consumer nào đọc các field này bên
|
|
556
891
|
// trong computed/template vẫn nhận đúng dependency signal, nên phản ứng không đổi.
|
|
557
892
|
get isExpanded() {
|
|
893
|
+
const controlled = tree.#expandedIdSet();
|
|
894
|
+
if (controlled)
|
|
895
|
+
return controlled.has(item.id);
|
|
558
896
|
return tree.#expandedState()[item.id] ?? item.expanded ?? tree.#defaultExpanded(level);
|
|
559
897
|
},
|
|
560
898
|
get isLoading() {
|
|
@@ -568,6 +906,79 @@ class SdTree {
|
|
|
568
906
|
return node;
|
|
569
907
|
});
|
|
570
908
|
}
|
|
909
|
+
#cancelSearch() {
|
|
910
|
+
clearTimeout(this.#searchTimer);
|
|
911
|
+
this.#searchTimer = undefined;
|
|
912
|
+
this.#searchController?.abort();
|
|
913
|
+
this.#searchController = null;
|
|
914
|
+
this.searchPending.set(false);
|
|
915
|
+
}
|
|
916
|
+
async #runSearch(text, onSearch) {
|
|
917
|
+
const controller = new AbortController();
|
|
918
|
+
this.#searchController = controller;
|
|
919
|
+
try {
|
|
920
|
+
const results = await onSearch(text, controller.signal);
|
|
921
|
+
if (controller.signal.aborted)
|
|
922
|
+
return;
|
|
923
|
+
this.#searchCollapsed.set(new Set());
|
|
924
|
+
this.#pruneSearchSeen();
|
|
925
|
+
for (const { path } of results)
|
|
926
|
+
for (const item of path)
|
|
927
|
+
this.#searchSeen.set(item.id, item.data);
|
|
928
|
+
this.#searchSeenTick.update(value => value + 1);
|
|
929
|
+
this.#search.set(mergeSearchPaths(text, results));
|
|
930
|
+
}
|
|
931
|
+
catch (error) {
|
|
932
|
+
if (!controller.signal.aborted)
|
|
933
|
+
this.loadError.emit({ error });
|
|
934
|
+
}
|
|
935
|
+
finally {
|
|
936
|
+
if (this.#searchController === controller)
|
|
937
|
+
this.searchPending.set(false);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Bỏ khỏi `#searchSeen` các nút không còn được chọn. Gọi trước khi kết quả tìm đang hiện bị thay hoặc xoá, và trước
|
|
942
|
+
* khi cây tải lại: lúc đó nút không chọn chỉ còn là data cũ, giữ lại thì Map lớn dần suốt đời component.
|
|
943
|
+
*/
|
|
944
|
+
#pruneSearchSeen() {
|
|
945
|
+
if (!this.#searchSeen.size)
|
|
946
|
+
return;
|
|
947
|
+
const selected = untracked(() => this.selectedIdSet());
|
|
948
|
+
let removed = false;
|
|
949
|
+
for (const id of [...this.#searchSeen.keys()]) {
|
|
950
|
+
if (selected.has(id))
|
|
951
|
+
continue;
|
|
952
|
+
this.#searchSeen.delete(id);
|
|
953
|
+
removed = true;
|
|
954
|
+
}
|
|
955
|
+
if (removed)
|
|
956
|
+
this.#searchSeenTick.update(value => value + 1);
|
|
957
|
+
}
|
|
958
|
+
/** Cây kết quả tìm: con lấy từ các đường đi đã gộp, mở hết trừ nút người dùng tự đóng, không tải lazy. */
|
|
959
|
+
#buildSearchNodes(search, items, level, parent) {
|
|
960
|
+
const tree = this;
|
|
961
|
+
return items.map(item => {
|
|
962
|
+
const children = search.children.get(item.id) ?? [];
|
|
963
|
+
const node = {
|
|
964
|
+
treeItem: item,
|
|
965
|
+
data: item.data,
|
|
966
|
+
id: item.id,
|
|
967
|
+
label: item.label,
|
|
968
|
+
level,
|
|
969
|
+
parent,
|
|
970
|
+
children: [],
|
|
971
|
+
hasChildren: children.length > 0,
|
|
972
|
+
get isExpanded() {
|
|
973
|
+
return !tree.#searchCollapsed().has(item.id);
|
|
974
|
+
},
|
|
975
|
+
isLoading: false,
|
|
976
|
+
loadError: undefined,
|
|
977
|
+
};
|
|
978
|
+
node.children = this.#buildSearchNodes(search, children, level + 1, node);
|
|
979
|
+
return node;
|
|
980
|
+
});
|
|
981
|
+
}
|
|
571
982
|
#childrenOf(item) {
|
|
572
983
|
const option = this.resolvedTree();
|
|
573
984
|
// Static items own their `children`; lazy items keep loaded children in component state.
|
|
@@ -603,9 +1014,120 @@ class SdTree {
|
|
|
603
1014
|
return undefined;
|
|
604
1015
|
return node.isExpanded ? 'folder_open' : 'folder';
|
|
605
1016
|
}
|
|
606
|
-
async #
|
|
1017
|
+
async #expandNode(node, signal) {
|
|
1018
|
+
if (!node.hasChildren)
|
|
1019
|
+
return false;
|
|
1020
|
+
const generation = this.#treeGeneration;
|
|
1021
|
+
await this.#ensureLazyChildren(node);
|
|
1022
|
+
// `reveal` bị huỷ trong lúc chờ tải: con đã vào cache, nhưng không mở nút và không phát sự kiện. Cây tải lại
|
|
1023
|
+
// (`reload()`, đổi `items`) trong lúc chờ: con vừa tải thuộc cây cũ và đã bị bỏ, mở nút mới thì nó mở mà rỗng.
|
|
1024
|
+
if (signal?.aborted || generation !== this.#treeGeneration)
|
|
1025
|
+
return false;
|
|
1026
|
+
const next = this.#findNode(node.id);
|
|
1027
|
+
if (!next || !next.hasChildren || next.loadError)
|
|
1028
|
+
return false;
|
|
1029
|
+
if (next.isExpanded)
|
|
1030
|
+
return true;
|
|
1031
|
+
this.#setExpanded(next.id, true);
|
|
1032
|
+
const toggleEvent = { item: next.data, expanded: true, node: { ...next, isExpanded: true } };
|
|
1033
|
+
this.option()?.onExpand?.(toggleEvent);
|
|
1034
|
+
this.expandChange.emit(toggleEvent);
|
|
1035
|
+
return true;
|
|
1036
|
+
}
|
|
1037
|
+
#collapseNode(node) {
|
|
1038
|
+
this.#setExpanded(node.id, false);
|
|
1039
|
+
const toggleEvent = { item: node.data, expanded: false, node: { ...node, isExpanded: false } };
|
|
1040
|
+
this.option()?.onCollapse?.(toggleEvent);
|
|
1041
|
+
this.collapseChange.emit(toggleEvent);
|
|
1042
|
+
}
|
|
1043
|
+
#setExpanded(id, expanded) {
|
|
1044
|
+
if (this.#search()) {
|
|
1045
|
+
this.#searchCollapsed.update(collapsed => {
|
|
1046
|
+
const next = new Set(collapsed);
|
|
1047
|
+
if (expanded)
|
|
1048
|
+
next.delete(id);
|
|
1049
|
+
else
|
|
1050
|
+
next.add(id);
|
|
1051
|
+
return next;
|
|
1052
|
+
});
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
const controlled = this.expandedIds();
|
|
1056
|
+
if (controlled === undefined) {
|
|
1057
|
+
this.#expandedState.update(state => ({ ...state, [id]: expanded }));
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
const rest = controlled.filter(value => value !== id);
|
|
1061
|
+
this.expandedIds.set(expanded ? [...rest, id] : rest);
|
|
1062
|
+
}
|
|
1063
|
+
/** Id các nút cha của một nút ĐÃ có trong cây (từ gốc tới cha trực tiếp); `undefined` khi nút chưa có. */
|
|
1064
|
+
#ancestorIds(id) {
|
|
1065
|
+
const node = this.#findNode(id);
|
|
1066
|
+
if (!node)
|
|
1067
|
+
return undefined;
|
|
1068
|
+
const path = [];
|
|
1069
|
+
for (let current = node.parent; current; current = current.parent)
|
|
1070
|
+
path.unshift(current.id);
|
|
1071
|
+
return path;
|
|
1072
|
+
}
|
|
1073
|
+
#rowElement(id) {
|
|
1074
|
+
const rows = this.#host.nativeElement.querySelectorAll('[role="treeitem"]');
|
|
1075
|
+
return Array.from(rows).find(row => row.getAttribute('data-tree-node') === id);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Các nút cha vừa mở chưa chắc đã có trong DOM ở lần render đầu (cây con lazy, view chưa refresh), nên thử lại
|
|
1079
|
+
* vài lần render rồi thôi.
|
|
1080
|
+
*/
|
|
1081
|
+
#scrollWhenRendered(id, attempt = 0) {
|
|
1082
|
+
afterNextRender(() => {
|
|
1083
|
+
if (this.#pendingScrollId !== id)
|
|
1084
|
+
return;
|
|
1085
|
+
const row = this.#rowElement(id);
|
|
1086
|
+
if (row) {
|
|
1087
|
+
this.#pendingScrollId = null;
|
|
1088
|
+
this.#scrollToRow(row);
|
|
1089
|
+
}
|
|
1090
|
+
else if (attempt < 5 && this.visibleNodes().some(node => node.id === id)) {
|
|
1091
|
+
this.#scrollWhenRendered(id, attempt + 1);
|
|
1092
|
+
}
|
|
1093
|
+
else {
|
|
1094
|
+
this.#pendingScrollId = null;
|
|
1095
|
+
}
|
|
1096
|
+
}, { injector: this.#injector });
|
|
1097
|
+
}
|
|
1098
|
+
/** Cuộn bằng `scrollTop` của vùng cuộn gần nhất: `scrollIntoView` sẽ cuộn luôn cả trang. */
|
|
1099
|
+
#scrollToRow(row) {
|
|
1100
|
+
const scroller = scrollParent(this.#host.nativeElement);
|
|
1101
|
+
if (!scroller)
|
|
1102
|
+
return;
|
|
1103
|
+
const box = scroller.getBoundingClientRect();
|
|
1104
|
+
const rect = row.getBoundingClientRect();
|
|
1105
|
+
// Thanh chọn dính đáy vùng cuộn và đè lên các hàng ở đó: mép dưới nhìn thấy được là mép trên của thanh.
|
|
1106
|
+
const bar = this.#host.nativeElement.querySelector(':scope > .sd-tree__selection-bar');
|
|
1107
|
+
const bottom = box.bottom - (bar?.offsetHeight ?? 0);
|
|
1108
|
+
if (rect.top < box.top)
|
|
1109
|
+
scroller.scrollTop -= box.top - rect.top;
|
|
1110
|
+
else if (rect.bottom > bottom)
|
|
1111
|
+
scroller.scrollTop += rect.bottom - bottom;
|
|
1112
|
+
}
|
|
1113
|
+
#ensureLazyChildren(node, force = false) {
|
|
1114
|
+
if (this.resolvedTree().loadType !== 'lazy')
|
|
1115
|
+
return Promise.resolve();
|
|
1116
|
+
if (!force && (node.children.length > 0 || this.#lazyChildren()[node.id]))
|
|
1117
|
+
return Promise.resolve();
|
|
1118
|
+
const running = this.#lazyLoads.get(node.id);
|
|
1119
|
+
if (running && !force)
|
|
1120
|
+
return running;
|
|
1121
|
+
const load = this.#loadLazyChildren(node).finally(() => {
|
|
1122
|
+
if (this.#lazyLoads.get(node.id) === load)
|
|
1123
|
+
this.#lazyLoads.delete(node.id);
|
|
1124
|
+
});
|
|
1125
|
+
this.#lazyLoads.set(node.id, load);
|
|
1126
|
+
return load;
|
|
1127
|
+
}
|
|
1128
|
+
async #loadLazyChildren(node) {
|
|
607
1129
|
const option = this.resolvedTree();
|
|
608
|
-
if (option.loadType !== 'lazy'
|
|
1130
|
+
if (option.loadType !== 'lazy')
|
|
609
1131
|
return;
|
|
610
1132
|
const generation = this.#treeGeneration;
|
|
611
1133
|
const loadId = (this.#lazyLoadIds.get(node.id) ?? 0) + 1;
|
|
@@ -705,7 +1227,7 @@ class SdTree {
|
|
|
705
1227
|
return result;
|
|
706
1228
|
}
|
|
707
1229
|
#selectedItemsFromIds(selectedIds) {
|
|
708
|
-
return this.#
|
|
1230
|
+
return this.#selectableNodes()
|
|
709
1231
|
.filter(node => selectedIds.has(node.id))
|
|
710
1232
|
.map(node => node.data);
|
|
711
1233
|
}
|
|
@@ -713,7 +1235,7 @@ class SdTree {
|
|
|
713
1235
|
const selectedRefs = new Set(selectedItems);
|
|
714
1236
|
const selectedDataIds = new Set(selectedItems.map(item => this.#dataId(item)).filter((id) => !!id));
|
|
715
1237
|
const result = new Set();
|
|
716
|
-
for (const node of this.#
|
|
1238
|
+
for (const node of this.#selectableNodes()) {
|
|
717
1239
|
const dataId = this.#dataId(node.data);
|
|
718
1240
|
if (selectedRefs.has(node.data) || (dataId && selectedDataIds.has(dataId))) {
|
|
719
1241
|
result.add(node.id);
|
|
@@ -738,7 +1260,7 @@ class SdTree {
|
|
|
738
1260
|
return typeof resolver === 'function' ? resolver(item) : !!resolver;
|
|
739
1261
|
}
|
|
740
1262
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
741
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdTree, isStandalone: true, selector: "sd-tree", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, tree: { classPropertyName: "tree", publicName: "tree", isSignal: true, isRequired: false, transformFunction: null }, selectedItemsInput: { classPropertyName: "selectedItemsInput", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null }, commands: { classPropertyName: "commands", publicName: "commands", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, showLines: { classPropertyName: "showLines", publicName: "showLines", isSignal: true, isRequired: false, transformFunction: null }, selector: { classPropertyName: "selector", publicName: "selector", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedItemsChange: "selectedItemsChange", selectChange: "selectChange", expandChange: "expandChange", collapseChange: "collapseChange", loadError: "loadError" }, host: { properties: { "attr.data-autoid": "autoId()" } }, queries: [{ propertyName: "itemDef", first: true, predicate: (SdTreeItemDefDirective), descendants: true, isSignal: true }], ngImport: i0, template: "@let _resolvedItemTemplate = resolvedItemTemplate();\n@let _selectionVisible = selectionVisible();\n@let _selectionSingle = selectionSingle();\n@let _selectionMessage = selectionMessage();\n@let _selectionActionViews = selectionActionViews();\n@let _selectionQuickActionOpened = selectionQuickActionOpened();\n@let _rootError = rootError();\n@let _treeLines = treeLines();\n\n@if (rootLoading()) {\n <div class=\"sd-tree__root-loading\" role=\"status\" aria-live=\"polite\">\n <mat-progress-spinner diameter=\"24\" mode=\"indeterminate\" />\n </div>\n} @else if (_rootError) {\n <div class=\"sd-tree__root-error\" role=\"alert\">\n <span>{{ errorMessage(_rootError) }}</span>\n <button type=\"button\" data-tree-retry (click)=\"retry()\">{{ 'core.component.tree.retry' | sdTranslate }}</button>\n </div>\n} @else {\n <div class=\"sd-tree\" role=\"tree\" [attr.aria-busy]=\"rootLoading()\" [style.--sd-tree-indent-size]=\"indentSize() + 'px'\">\n @for (node of visibleViewNodes(); track node.id) {\n @let _lines = _treeLines.get(node.id);\n <!-- why: `[tabIndex]` l\u00E0 property DOM (camelCase) \u2014 n\u00F3 set \u0111\u00FAng gi\u00E1 tr\u1ECB nh\u01B0ng KH\u00D4NG sinh\n attribute `tabindex` trong markup, n\u00EAn m\u1ECDi th\u1EE9 \u0111\u1ECDc markup (lint a11y, snapshot test,\n devtools inspect) \u0111\u1EC1u th\u1EA5y row l\u00E0 kh\u00F4ng focusable. \u0110\u1ED5i sang `[attr.tabindex]`. -->\n <div\n class=\"sd-tree__row\"\n role=\"treeitem\"\n [attr.tabindex]=\"node.tabIndex\"\n [class.sd-tree__row--selected]=\"node.selected\"\n [class.sd-tree__row--parent]=\"node.hasChildren\"\n [style.--sd-tree-level]=\"node.level\"\n [attr.aria-level]=\"node.level + 1\"\n [attr.aria-expanded]=\"node.ariaExpanded\"\n [attr.aria-selected]=\"_selectionVisible ? node.selected : null\"\n [attr.aria-checked]=\"_selectionVisible ? (node.selectionIndeterminate ? 'mixed' : node.selected) : null\"\n [attr.data-autoid]=\"node.autoIds.row\"\n (focus)=\"onRowFocus(node)\"\n (keydown)=\"onRowKeydown(node, $event)\">\n @if (_lines) {\n <span class=\"sd-tree__lines\" aria-hidden=\"true\">\n @for (line of _lines.segments; track line.level) {\n <span\n class=\"sd-tree__line\"\n [class.sd-tree__line--branch]=\"line.branch\"\n [class.sd-tree__line--last]=\"line.last\"\n [style.--sd-tree-line-level]=\"line.level\"></span>\n }\n @if (_lines.children) {\n <span class=\"sd-tree__line sd-tree__line--children\" [style.--sd-tree-line-level]=\"node.level\"></span>\n }\n </span>\n }\n <div class=\"sd-tree__main\">\n <button\n type=\"button\"\n class=\"sd-tree__toggle\"\n [class.sd-tree__toggle--placeholder]=\"!node.hasChildren\"\n [disabled]=\"node.toggleDisabled\"\n [attr.aria-label]=\"node.toggleLabel\"\n [attr.data-autoid]=\"node.autoIds.toggle\"\n [attr.data-tree-node-retry]=\"node.loadError ? node.id : null\"\n (click)=\"toggle(node, $event)\">\n @if (node.isLoading) {\n <mat-progress-spinner diameter=\"16\" mode=\"indeterminate\" />\n } @else if (node.loadError) {\n <sd-icon name=\"refresh\"></sd-icon>\n } @else if (node.hasChildren) {\n <sd-icon [name]=\"node.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n }\n </button>\n\n <!-- why: `selector.single` cho ph\u00E9p \u0111\u00FAng M\u1ED8T node, m\u00E0 checkbox l\u1EA1i l\u00E0 k\u00FD hi\u1EC7u c\u1EE7a\n \"ch\u1ECDn nhi\u1EC1u\" \u2014 ng\u01B0\u1EDDi d\u00F9ng tick node th\u1EE9 hai r\u1ED3i m\u1EDBi ph\u00E1t hi\u1EC7n node \u0111\u1EA7u t\u1EF1 b\u1ECF. Radio\n n\u00F3i tr\u01B0\u1EDBc \u0111i\u1EC1u \u0111\u00F3. Kh\u00F4ng gom v\u00E0o <mat-radio-group>: group chi\u1EBFm Arrow Up/Down cho\n vi\u1EC7c chuy\u1EC3n l\u1EF1a ch\u1ECDn, trong khi h\u00E0ng c\u00E2y \u0111\u00E3 d\u00F9ng \u0111\u00FAng hai ph\u00EDm \u0111\u00F3 \u0111\u1EC3 \u0111i\u1EC1u h\u01B0\u1EDBng. -->\n @if (_selectionVisible) {\n @if (_selectionSingle) {\n <mat-radio-button\n class=\"sd-tree__radio\"\n [checked]=\"node.selected\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n } @else {\n <mat-checkbox\n class=\"sd-tree__checkbox\"\n [checked]=\"node.selected\"\n [indeterminate]=\"node.selectionIndeterminate\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n }\n }\n\n @if (node.icon) {\n <sd-icon\n class=\"sd-tree__item-icon\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [attr.data-autoid]=\"node.autoIds.icon\"\n [name]=\"node.icon\"></sd-icon>\n }\n\n <div class=\"sd-tree__content\" [class.sd-tree__content--custom]=\"_resolvedItemTemplate\" [attr.data-autoid]=\"node.autoIds.label\">\n @if (_resolvedItemTemplate) {\n <ng-container *ngTemplateOutlet=\"_resolvedItemTemplate; context: node.context\" />\n } @else {\n <span class=\"sd-tree__label\">{{ node.label }}</span>\n }\n </div>\n </div>\n\n @if (node.commands.length) {\n <sd-button\n class=\"sd-tree__command-trigger\"\n type=\"text\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [tooltip]=\"node.label\"\n [attr.data-autoid]=\"node.autoIds.command\">\n @for (command of node.commands; track command.key) {\n <sd-button-item\n [disabled]=\"command.disabled\"\n [autoId]=\"command.autoId\"\n [prefixIcon]=\"command.icon\"\n [color]=\"command.color\"\n [fontSet]=\"command.fontSet\"\n (click)=\"command.command.click(node.data)\"\n >{{ command.title }}</sd-button-item\n >\n }\n </sd-button>\n }\n </div>\n }\n </div>\n}\n\n<sd-quick-action [opened]=\"_selectionQuickActionOpened\">\n <div class=\"d-flex align-items-center\" sdMessage>\n <div class=\"c-bg-length\">\n <span class=\"c-length sd-tree__qa-count\">{{ selectedCount() }}</span>\n </div>\n <div class=\"c-message\">\n {{ _selectionMessage }}\n </div>\n </div>\n\n <div class=\"d-flex align-items-center mr-8 sd-tree__qa-actions\" sdAction>\n @for (actionView of _selectionActionViews; track $index) {\n <sd-button\n [autoId]=\"actionView.autoId\"\n class=\"ml-4\"\n [tooltip]=\"actionView.action.tooltip\"\n [prefixIcon]=\"actionView.action.icon\"\n [color]=\"actionView.action.color || 'primary'\"\n [type]=\"actionView.action.type || 'light'\"\n [fontSet]=\"actionView.action.fontSet\"\n [title]=\"actionView.action.title\"\n (click)=\"onSelectionAction(actionView.action)\" />\n }\n <sd-button\n [autoId]=\"clearSelectionAutoId()\"\n class=\"ml-4\"\n prefixIcon=\"close\"\n color=\"secondary\"\n type=\"outline\"\n width=\"35px\"\n (click)=\"clearSelection()\" />\n </div>\n</sd-quick-action>\n", styles: [":host{--sd-tree-row-height: 44px;--sd-tree-control-size: 28px;--sd-tree-checkbox-size: 16px;--sd-tree-indent-size: 20px;--sd-tree-selected-bg: color-mix(in srgb, var(--sd-primary, #005cbb) 12%, var(--sd-tree-selected-mix, #ffffff));--sd-tree-hover-bg: rgba(15, 23, 42, .04);display:block}.sd-tree{display:flex;flex-direction:column;width:100%}.sd-tree__row{position:relative;display:flex;align-items:flex-start;min-height:var(--sd-tree-row-height);box-sizing:border-box;padding:8px 4px 8px calc(4px + var(--sd-tree-level) * var(--sd-tree-indent-size));color:var(--sd-tree-text, #102047);border-radius:0}.sd-tree__row:hover{background:var(--sd-tree-hover-bg)}.sd-tree__row:focus-visible{z-index:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-tree__row--selected{background:var(--sd-tree-selected-bg)}.sd-tree__lines{position:absolute;inset:0;pointer-events:none;color:var(--sd-border, #dce1e9)}.sd-tree__line{position:absolute;left:calc(4px + var(--sd-tree-line-level) * var(--sd-tree-indent-size) + var(--sd-tree-control-size) / 2);top:0;bottom:0;border-left:1px solid currentcolor}.sd-tree__line--branch:after{content:\"\";position:absolute;top:calc(8px + var(--sd-tree-control-size) / 2);width:max(0px,var(--sd-tree-indent-size) - 8px);border-top:1px solid currentcolor}.sd-tree__line--last{bottom:auto;height:calc(8px + var(--sd-tree-control-size) / 2)}.sd-tree__line--children{top:calc(8px + var(--sd-tree-control-size) / 2 + 8px)}.sd-tree__main{display:flex;align-items:flex-start;min-width:0;flex:1 1 auto}.sd-tree__toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);padding:0;color:var(--sd-tree-muted, #5f6f89);background:transparent;border:0;border-radius:var(--sd-radius-4, 4px);cursor:pointer}.sd-tree__toggle:disabled{cursor:default}.sd-tree__toggle--placeholder{visibility:hidden}.sd-tree__toggle sd-icon{width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__checkbox{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-checkbox-state-layer-size: var(--sd-tree-control-size);--mdc-checkbox-selected-checkmark-color: var(--sd-text-on-solid, #ffffff);--mdc-checkbox-selected-focus-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-hover-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-pressed-icon-color: var(--sd-primary, #005cbb)}.sd-tree__checkbox ::ng-deep .mdc-checkbox{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__checkbox ::ng-deep .mdc-checkbox .mdc-checkbox__background{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-radio-state-layer-size: var(--sd-tree-control-size);--mdc-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-focus-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-hover-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-pressed-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-checked-state-layer-color: var(--sd-primary, #005cbb) !important}.sd-tree__radio ::ng-deep .mdc-radio{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__background,.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__native-control{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio ::ng-deep .mdc-form-field>label{display:none}.sd-tree__item-icon{flex:0 0 auto;width:20px;height:20px;min-height:var(--sd-tree-control-size);margin:0 8px 0 0;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__content{display:-webkit-box;min-width:0;min-height:var(--sd-tree-control-size);padding:4px 0;overflow:hidden;overflow-wrap:anywhere;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:var(--sd-line-height-20, 20px)}.sd-tree__content--custom{display:block;max-height:none;-webkit-line-clamp:unset}.sd-tree__label{font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400)}.sd-tree__row--parent .sd-tree__label{font-weight:var(--sd-font-weight-semibold, 600)}.sd-tree__command-trigger{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;align-self:flex-start;width:24px;height:var(--sd-tree-control-size);padding:0;margin-left:8px;line-height:var(--sd-line-height-24, 24px);opacity:0;transition:opacity var(--sd-duration-fast, .12s) ease}.sd-tree__row:hover .sd-tree__command-trigger,.sd-tree__command-trigger:focus-within,.sd-tree__command-trigger:has(button[aria-expanded=true]){opacity:1}:host ::ng-deep .sd-tree__command-trigger button.c-button{height:var(--sd-tree-control-size);max-width:24px;padding:0!important}:host ::ng-deep .sd-tree__command-trigger button.c-button .mat-mdc-button-touch-target{width:100%;height:100%}.c-bg-length{display:flex;flex-direction:column;align-items:flex-start;position:static;width:auto;min-width:48px;height:48px;padding:12px 8px;background:var(--sd-primary);border-radius:8px 0 0 8px}.c-bg-length .c-length{position:static;width:auto;min-width:32px;height:24px;color:var(--sd-text-on-solid, #ffffff);font-family:Roboto,sans-serif;font-size:var(--sd-font-size-16, 16px);font-style:normal;font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-24, 24px);text-align:center}.c-message{position:static;min-width:200px;height:20px;margin:0 0 0 8px;color:var(--sd-tree-strong-text, #000000);font-family:Roboto,sans-serif;font-size:var(--sd-font-size-14, 14px);font-style:normal;font-weight:400;line-height:var(--sd-line-height-20, 20px)}.sd-tree__qa-actions{align-items:center;gap:4px;margin-right:8px}.sd-tree__root-loading,.sd-tree__root-error{display:flex;align-items:center;justify-content:center;gap:8px;min-height:120px;padding:16px}.sd-tree__root-error{flex-direction:column;color:var(--sd-error, #d92d20)}.sd-tree__root-error button{min-height:36px;padding:6px 12px;border:1px solid currentcolor;border-radius:var(--sd-radius-6, 6px);background:transparent;color:inherit;font:inherit;cursor:pointer}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "component", type: i4.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { 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: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "tooltip", "autoId"], outputs: ["click"] }, { kind: "component", type: SdQuickAction, selector: "sd-quick-action", inputs: ["opened", "contained"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1263
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdTree, isStandalone: true, selector: "sd-tree", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, tree: { classPropertyName: "tree", publicName: "tree", isSignal: true, isRequired: false, transformFunction: null }, selectedItemsInput: { classPropertyName: "selectedItemsInput", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null }, commands: { classPropertyName: "commands", publicName: "commands", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, showLines: { classPropertyName: "showLines", publicName: "showLines", isSignal: true, isRequired: false, transformFunction: null }, selector: { classPropertyName: "selector", publicName: "selector", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedItemsChange: "selectedItemsChange", selectChange: "selectChange", expandChange: "expandChange", collapseChange: "collapseChange", loadError: "loadError", activeId: "activeIdChange", activeChange: "activeChange", expandedIds: "expandedIdsChange" }, host: { properties: { "attr.data-autoid": "autoId()" } }, queries: [{ propertyName: "itemDef", first: true, predicate: (SdTreeItemDefDirective), descendants: true, isSignal: true }, { propertyName: "emptyDef", first: true, predicate: SdTreeEmptyDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "buttons", predicate: SdButton, descendants: true, isSignal: true }], ngImport: i0, template: "@let _resolvedItemTemplate = resolvedItemTemplate();\n@let _selectionVisible = selectionVisible();\n@let _selectionSingle = selectionSingle();\n@let _selectionMessage = selectionMessage();\n@let _selectionQuickActionOpened = selectionQuickActionOpened();\n@let _rootError = rootError();\n@let _emptyState = emptyState();\n@let _emptyDef = emptyDef();\n@let _treeLines = treeLines();\n@let _highlightTerm = highlightTerm();\n\n@if (rootLoading()) {\n <div class=\"sd-tree__root-loading\" role=\"status\" aria-live=\"polite\">\n <mat-progress-spinner diameter=\"24\" mode=\"indeterminate\" />\n </div>\n} @else if (_rootError) {\n <!-- why: th\u00F4ng \u0111i\u1EC7p c\u1EE7a exception (stack, t\u00EAn b\u1EA3ng, URL n\u1ED9i b\u1ED9) kh\u00F4ng d\u00E0nh cho ng\u01B0\u1EDDi d\u00F9ng cu\u1ED1i; l\u1ED7i g\u1ED1c v\u1EABn\n t\u1EDBi consumer qua `loadError` v\u00E0 `rootError()`. -->\n <div class=\"sd-tree__root-error\" role=\"alert\">\n <sd-icon class=\"sd-tree__root-error-icon\" name=\"error\" aria-hidden=\"true\"></sd-icon>\n <span class=\"sd-tree__root-error-text\">{{ 'core.component.tree.load-error' | sdTranslate }}</span>\n <sd-button data-tree-retry type=\"outline\" size=\"sm\" [title]=\"'core.component.tree.retry' | sdTranslate\" (click)=\"retry()\" />\n </div>\n} @else if (_emptyState) {\n <!-- why: kh\u1ED1i n\u00E0y thay ch\u1ED7 `role=\"tree\"`, n\u00EAn n\u00F3 ph\u1EA3i t\u1EF1 \u0111\u1ECDc \u0111\u01B0\u1EE3c (status) v\u00E0 t\u1EF1 mang `aria-busy` c\u1EE7a l\u1EA7n t\u00ECm tr\u00EAn\n server \u0111ang ch\u1EDD \u2014 n\u1EBFu kh\u00F4ng, ch\u1EEF \"kh\u00F4ng kh\u1EDBp\" c\u0169 \u0111\u01B0\u1EE3c \u0111\u1ECDc nh\u01B0 k\u1EBFt qu\u1EA3 c\u1EE7a l\u1EA7n g\u00F5 m\u1EDBi. -->\n <div class=\"sd-tree__root-empty\" role=\"status\" [attr.aria-busy]=\"searchPending() || null\">\n @if (_emptyDef) {\n <ng-container *ngTemplateOutlet=\"_emptyDef.templateRef; context: _emptyState\" />\n } @else if (_emptyState.searching) {\n {{ 'core.component.tree.no-match' | sdTranslate: { text: _emptyState.text } }}\n } @else {\n {{ 'core.component.tree.empty' | sdTranslate }}\n }\n </div>\n} @else {\n <div class=\"sd-tree\" role=\"tree\" [attr.aria-busy]=\"rootLoading() || searchPending()\" [style.--sd-tree-indent-size]=\"indentSize() + 'px'\">\n @for (node of visibleViewNodes(); track node.id) {\n @let _lines = _treeLines.get(node.id);\n <!-- why: `[tabIndex]` l\u00E0 property DOM (camelCase) \u2014 n\u00F3 set \u0111\u00FAng gi\u00E1 tr\u1ECB nh\u01B0ng KH\u00D4NG sinh\n attribute `tabindex` trong markup, n\u00EAn m\u1ECDi th\u1EE9 \u0111\u1ECDc markup (lint a11y, snapshot test,\n devtools inspect) \u0111\u1EC1u th\u1EA5y row l\u00E0 kh\u00F4ng focusable. \u0110\u1ED5i sang `[attr.tabindex]`. -->\n <div\n class=\"sd-tree__row\"\n role=\"treeitem\"\n [attr.tabindex]=\"node.tabIndex\"\n [class.sd-tree__row--selected]=\"node.highlighted && !node.active\"\n [class.sd-tree__row--active]=\"node.active\"\n [class.sd-tree__row--parent]=\"node.hasChildren\"\n [class.sd-tree__row--context]=\"node.muted\"\n [style.--sd-tree-level]=\"node.level\"\n [attr.aria-level]=\"node.level + 1\"\n [attr.aria-expanded]=\"node.ariaExpanded\"\n [attr.aria-selected]=\"node.ariaSelected\"\n [attr.aria-label]=\"node.ariaLabel\"\n [attr.aria-checked]=\"_selectionVisible ? (node.selectionIndeterminate ? 'mixed' : node.selected) : null\"\n [attr.data-autoid]=\"node.autoIds.row\"\n [attr.data-tree-node]=\"node.id\"\n (click)=\"onRowClick(node, $event)\"\n (focus)=\"onRowFocus(node)\"\n (keydown)=\"onRowKeydown(node, $event)\">\n @if (_lines) {\n <span class=\"sd-tree__lines\" aria-hidden=\"true\">\n @for (line of _lines.segments; track line.level) {\n <span\n class=\"sd-tree__line\"\n [class.sd-tree__line--branch]=\"line.branch\"\n [class.sd-tree__line--last]=\"line.last\"\n [style.--sd-tree-line-level]=\"line.level\"></span>\n }\n @if (_lines.children) {\n <span class=\"sd-tree__line sd-tree__line--children\" [style.--sd-tree-line-level]=\"node.level\"></span>\n }\n </span>\n }\n <div class=\"sd-tree__main\">\n <button\n type=\"button\"\n class=\"sd-tree__toggle\"\n [class.sd-tree__toggle--placeholder]=\"!node.hasChildren\"\n [disabled]=\"node.toggleDisabled\"\n [attr.aria-label]=\"node.toggleLabel\"\n [attr.data-autoid]=\"node.autoIds.toggle\"\n [attr.data-tree-node-retry]=\"node.loadError ? node.id : null\"\n (click)=\"toggle(node, $event)\">\n @if (node.isLoading) {\n <mat-progress-spinner diameter=\"16\" mode=\"indeterminate\" />\n } @else if (node.loadError) {\n <sd-icon name=\"refresh\"></sd-icon>\n } @else if (node.hasChildren) {\n <sd-icon [name]=\"node.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n }\n </button>\n\n <!-- why: `selector.single` cho ph\u00E9p \u0111\u00FAng M\u1ED8T node, m\u00E0 checkbox l\u1EA1i l\u00E0 k\u00FD hi\u1EC7u c\u1EE7a\n \"ch\u1ECDn nhi\u1EC1u\" \u2014 ng\u01B0\u1EDDi d\u00F9ng tick node th\u1EE9 hai r\u1ED3i m\u1EDBi ph\u00E1t hi\u1EC7n node \u0111\u1EA7u t\u1EF1 b\u1ECF. Radio\n n\u00F3i tr\u01B0\u1EDBc \u0111i\u1EC1u \u0111\u00F3. Kh\u00F4ng gom v\u00E0o <mat-radio-group>: group chi\u1EBFm Arrow Up/Down cho\n vi\u1EC7c chuy\u1EC3n l\u1EF1a ch\u1ECDn, trong khi h\u00E0ng c\u00E2y \u0111\u00E3 d\u00F9ng \u0111\u00FAng hai ph\u00EDm \u0111\u00F3 \u0111\u1EC3 \u0111i\u1EC1u h\u01B0\u1EDBng. -->\n @if (_selectionVisible) {\n @if (_selectionSingle) {\n <mat-radio-button\n class=\"sd-tree__radio\"\n [checked]=\"node.selected\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n } @else {\n <mat-checkbox\n class=\"sd-tree__checkbox\"\n [checked]=\"node.selected\"\n [indeterminate]=\"node.selectionIndeterminate\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n }\n }\n\n @if (node.icon) {\n <sd-icon\n class=\"sd-tree__item-icon\"\n [color]=\"node.highlighted ? 'primary' : undefined\"\n [attr.data-autoid]=\"node.autoIds.icon\"\n [name]=\"node.icon\"></sd-icon>\n }\n\n <div class=\"sd-tree__content\" [class.sd-tree__content--custom]=\"_resolvedItemTemplate\" [attr.data-autoid]=\"node.autoIds.label\">\n @if (_resolvedItemTemplate) {\n <ng-container *ngTemplateOutlet=\"_resolvedItemTemplate; context: node.context\" />\n } @else {\n @if (_highlightTerm) {\n <span class=\"sd-tree__label\"><sd-highlight [text]=\"node.label\" [term]=\"_highlightTerm\" /></span>\n } @else {\n <span class=\"sd-tree__label\">{{ node.label }}</span>\n }\n }\n </div>\n </div>\n\n @if (node.count !== null) {\n <span class=\"sd-tree__count\">{{ node.count }}</span>\n }\n\n @if (node.commands.length) {\n <sd-button\n class=\"sd-tree__command-trigger\"\n type=\"text\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [tooltip]=\"node.menuLabel\"\n [attr.data-autoid]=\"node.autoIds.command\">\n @for (command of node.commands; track command.key) {\n <sd-button-item\n [disabled]=\"command.disabled\"\n [autoId]=\"command.autoId\"\n [prefixIcon]=\"command.icon\"\n [color]=\"command.color\"\n [fontSet]=\"command.fontSet\"\n (click)=\"command.command.click(node.data)\"\n >{{ command.title }}</sd-button-item\n >\n }\n </sd-button>\n }\n </div>\n }\n </div>\n}\n\n<!-- SB: thanh ch\u1ECDn nhi\u1EC1u d\u00F9ng chung v\u1EDBi sd-table, n\u1EB1m trong host sau c\u00E1c h\u00E0ng v\u00E0 d\u00EDnh \u0111\u00E1y v\u00F9ng cu\u1ED9n g\u1EA7n nh\u1EA5t.\n V\u00EC thanh n\u1EB1m trong lu\u1ED3ng, host t\u1EF1 cao th\u00EAm \u0111\u00FAng b\u1EB1ng thanh khi n\u00F3 m\u1EDF: h\u00E0ng cu\u1ED1i kh\u00F4ng b\u1ECB che. -->\n<sd-selection-bar\n class=\"sd-tree__selection-bar\"\n [opened]=\"_selectionQuickActionOpened\"\n [message]=\"_selectionMessage\"\n [actions]=\"selectionBarActions()\"\n [autoId]=\"autoId()\"\n actionAutoIdPrefix=\"selection-action\"\n (action)=\"$event.click()\"\n (clear)=\"clearSelection()\" />\n", styles: [":host{--sd-tree-row-height: 44px;--sd-tree-control-size: 28px;--sd-tree-checkbox-size: 16px;--sd-tree-indent-size: 20px;--sd-tree-selected-bg: color-mix(in srgb, var(--sd-primary, #005cbb) 12%, var(--sd-tree-selected-mix, #ffffff));--sd-tree-hover-bg: rgba(15, 23, 42, .04);display:block}.sd-tree{display:flex;flex-direction:column;width:100%}.sd-tree__row{position:relative;display:flex;align-items:flex-start;min-height:var(--sd-tree-row-height);box-sizing:border-box;padding-block:8px;padding-inline:calc(4px + var(--sd-tree-level) * var(--sd-tree-indent-size)) 4px;color:var(--sd-tree-text, #102047);border-radius:0}.sd-tree__row:hover{background:var(--sd-tree-hover-bg)}.sd-tree__row:focus-visible{z-index:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-tree__row--selected,.sd-tree__row--active{background:var(--sd-tree-selected-bg)}.sd-tree__lines{position:absolute;inset:0;pointer-events:none;color:var(--sd-border, #dce1e9)}.sd-tree__line{position:absolute;inset-inline-start:calc(4px + var(--sd-tree-line-level) * var(--sd-tree-indent-size) + var(--sd-tree-control-size) / 2);top:0;bottom:0;border-inline-start:1px solid currentcolor}.sd-tree__line--branch:after{content:\"\";position:absolute;top:calc(8px + var(--sd-tree-control-size) / 2);width:max(0px,var(--sd-tree-indent-size) - 8px);border-top:1px solid currentcolor}.sd-tree__line--last{bottom:auto;height:calc(8px + var(--sd-tree-control-size) / 2)}.sd-tree__line--children{top:calc(8px + var(--sd-tree-control-size) / 2 + 8px)}.sd-tree__main{display:flex;align-items:flex-start;min-width:0;flex:1 1 auto}.sd-tree__toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);padding:0;color:var(--sd-tree-muted, #5f6f89);background:transparent;border:0;border-radius:var(--sd-radius-4, 4px);cursor:pointer}.sd-tree__toggle:disabled{cursor:default}.sd-tree__toggle--placeholder{visibility:hidden}.sd-tree__toggle sd-icon{width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__checkbox{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-checkbox-state-layer-size: var(--sd-tree-control-size);--mdc-checkbox-selected-checkmark-color: var(--sd-text-on-solid, #ffffff);--mdc-checkbox-selected-focus-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-hover-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-pressed-icon-color: var(--sd-primary, #005cbb)}.sd-tree__checkbox ::ng-deep .mdc-checkbox{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__checkbox ::ng-deep .mdc-checkbox .mdc-checkbox__background{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-radio-state-layer-size: var(--sd-tree-control-size);--mdc-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-focus-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-hover-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-pressed-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-checked-state-layer-color: var(--sd-primary, #005cbb) !important}.sd-tree__radio ::ng-deep .mdc-radio{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__background,.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__native-control{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio ::ng-deep .mdc-form-field>label{display:none}.sd-tree__item-icon{flex:0 0 auto;width:20px;height:20px;min-height:var(--sd-tree-control-size);margin:0 8px 0 0;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__content{display:-webkit-box;min-width:0;min-height:var(--sd-tree-control-size);padding:4px 0;overflow:hidden;overflow-wrap:anywhere;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:var(--sd-line-height-20, 20px)}.sd-tree__content--custom{display:block;max-height:none;-webkit-line-clamp:unset}.sd-tree__label{font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400)}.sd-tree__label{--sd-highlight-bg: var(--sd-warning-light);--sd-highlight-color: currentcolor}.sd-tree__row--context .sd-tree__label{color:var(--sd-tree-muted, #5f6f89)}.sd-tree__row--parent .sd-tree__label{font-weight:var(--sd-font-weight-semibold, 600)}.sd-tree__count{flex:0 0 auto;padding-block:6px 0;padding-inline:8px 0;color:var(--sd-tree-muted, #5f6f89);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-variant-numeric:tabular-nums;white-space:nowrap}.sd-tree__command-trigger{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;align-self:flex-start;width:24px;height:var(--sd-tree-control-size);padding:0;margin-inline-start:8px;line-height:var(--sd-line-height-24, 24px);opacity:0;transition:opacity var(--sd-duration-fast, .12s) ease}.sd-tree__row:hover .sd-tree__command-trigger,.sd-tree__row:focus-within .sd-tree__command-trigger,.sd-tree__row--active .sd-tree__command-trigger,.sd-tree__command-trigger:focus-within,.sd-tree__command-trigger:has(button[aria-expanded=true]){opacity:1}@media(pointer:coarse){.sd-tree__command-trigger{opacity:1}}:host ::ng-deep .sd-tree__command-trigger button.c-button{height:var(--sd-tree-control-size);max-width:24px;padding:0!important}:host ::ng-deep .sd-tree__command-trigger button.c-button .mat-mdc-button-touch-target{width:100%;height:100%}.sd-tree__selection-bar{display:flow-root;position:sticky;bottom:0;z-index:2;padding-inline:8px;background:var(--sd-surface)}.sd-tree__root-loading,.sd-tree__root-error,.sd-tree__root-empty{display:flex;align-items:center;justify-content:center;gap:8px;min-height:120px;padding:16px;box-sizing:border-box}.sd-tree__root-error{flex-direction:column;color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:center}.sd-tree__root-error-icon{width:24px;height:24px;color:var(--sd-error, #d92d20);font-size:var(--sd-font-size-24, 24px);line-height:var(--sd-line-height-24, 24px)}.sd-tree__root-empty{color:var(--sd-tree-muted, #5f6f89);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:center;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "component", type: i4.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { 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: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "checked", "tooltip", "autoId"], outputs: ["click"] }, { kind: "component", type: SdHighlight, selector: "sd-highlight", inputs: ["text", "term"] }, { kind: "component", type: _SdSelectionBar, selector: "sd-selection-bar", inputs: ["opened", "message", "actions", "autoId", "actionAutoIdPrefix"], outputs: ["action", "clear"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
742
1264
|
}
|
|
743
1265
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdTree, decorators: [{
|
|
744
1266
|
type: Component,
|
|
@@ -750,12 +1272,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
750
1272
|
MatRadioModule,
|
|
751
1273
|
SdButton,
|
|
752
1274
|
SdButtonItem,
|
|
753
|
-
|
|
1275
|
+
SdHighlight,
|
|
1276
|
+
_SdSelectionBar,
|
|
754
1277
|
SdTranslatePipe,
|
|
755
1278
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
756
1279
|
'[attr.data-autoid]': 'autoId()',
|
|
757
|
-
}, template: "@let _resolvedItemTemplate = resolvedItemTemplate();\n@let _selectionVisible = selectionVisible();\n@let _selectionSingle = selectionSingle();\n@let _selectionMessage = selectionMessage();\n@let _selectionActionViews = selectionActionViews();\n@let _selectionQuickActionOpened = selectionQuickActionOpened();\n@let _rootError = rootError();\n@let _treeLines = treeLines();\n\n@if (rootLoading()) {\n <div class=\"sd-tree__root-loading\" role=\"status\" aria-live=\"polite\">\n <mat-progress-spinner diameter=\"24\" mode=\"indeterminate\" />\n </div>\n} @else if (_rootError) {\n <div class=\"sd-tree__root-error\" role=\"alert\">\n <span>{{ errorMessage(_rootError) }}</span>\n <button type=\"button\" data-tree-retry (click)=\"retry()\">{{ 'core.component.tree.retry' | sdTranslate }}</button>\n </div>\n} @else {\n <div class=\"sd-tree\" role=\"tree\" [attr.aria-busy]=\"rootLoading()\" [style.--sd-tree-indent-size]=\"indentSize() + 'px'\">\n @for (node of visibleViewNodes(); track node.id) {\n @let _lines = _treeLines.get(node.id);\n <!-- why: `[tabIndex]` l\u00E0 property DOM (camelCase) \u2014 n\u00F3 set \u0111\u00FAng gi\u00E1 tr\u1ECB nh\u01B0ng KH\u00D4NG sinh\n attribute `tabindex` trong markup, n\u00EAn m\u1ECDi th\u1EE9 \u0111\u1ECDc markup (lint a11y, snapshot test,\n devtools inspect) \u0111\u1EC1u th\u1EA5y row l\u00E0 kh\u00F4ng focusable. \u0110\u1ED5i sang `[attr.tabindex]`. -->\n <div\n class=\"sd-tree__row\"\n role=\"treeitem\"\n [attr.tabindex]=\"node.tabIndex\"\n [class.sd-tree__row--selected]=\"node.selected\"\n [class.sd-tree__row--parent]=\"node.hasChildren\"\n [style.--sd-tree-level]=\"node.level\"\n [attr.aria-level]=\"node.level + 1\"\n [attr.aria-expanded]=\"node.ariaExpanded\"\n [attr.aria-selected]=\"_selectionVisible ? node.selected : null\"\n [attr.aria-checked]=\"_selectionVisible ? (node.selectionIndeterminate ? 'mixed' : node.selected) : null\"\n [attr.data-autoid]=\"node.autoIds.row\"\n (focus)=\"onRowFocus(node)\"\n (keydown)=\"onRowKeydown(node, $event)\">\n @if (_lines) {\n <span class=\"sd-tree__lines\" aria-hidden=\"true\">\n @for (line of _lines.segments; track line.level) {\n <span\n class=\"sd-tree__line\"\n [class.sd-tree__line--branch]=\"line.branch\"\n [class.sd-tree__line--last]=\"line.last\"\n [style.--sd-tree-line-level]=\"line.level\"></span>\n }\n @if (_lines.children) {\n <span class=\"sd-tree__line sd-tree__line--children\" [style.--sd-tree-line-level]=\"node.level\"></span>\n }\n </span>\n }\n <div class=\"sd-tree__main\">\n <button\n type=\"button\"\n class=\"sd-tree__toggle\"\n [class.sd-tree__toggle--placeholder]=\"!node.hasChildren\"\n [disabled]=\"node.toggleDisabled\"\n [attr.aria-label]=\"node.toggleLabel\"\n [attr.data-autoid]=\"node.autoIds.toggle\"\n [attr.data-tree-node-retry]=\"node.loadError ? node.id : null\"\n (click)=\"toggle(node, $event)\">\n @if (node.isLoading) {\n <mat-progress-spinner diameter=\"16\" mode=\"indeterminate\" />\n } @else if (node.loadError) {\n <sd-icon name=\"refresh\"></sd-icon>\n } @else if (node.hasChildren) {\n <sd-icon [name]=\"node.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n }\n </button>\n\n <!-- why: `selector.single` cho ph\u00E9p \u0111\u00FAng M\u1ED8T node, m\u00E0 checkbox l\u1EA1i l\u00E0 k\u00FD hi\u1EC7u c\u1EE7a\n \"ch\u1ECDn nhi\u1EC1u\" \u2014 ng\u01B0\u1EDDi d\u00F9ng tick node th\u1EE9 hai r\u1ED3i m\u1EDBi ph\u00E1t hi\u1EC7n node \u0111\u1EA7u t\u1EF1 b\u1ECF. Radio\n n\u00F3i tr\u01B0\u1EDBc \u0111i\u1EC1u \u0111\u00F3. Kh\u00F4ng gom v\u00E0o <mat-radio-group>: group chi\u1EBFm Arrow Up/Down cho\n vi\u1EC7c chuy\u1EC3n l\u1EF1a ch\u1ECDn, trong khi h\u00E0ng c\u00E2y \u0111\u00E3 d\u00F9ng \u0111\u00FAng hai ph\u00EDm \u0111\u00F3 \u0111\u1EC3 \u0111i\u1EC1u h\u01B0\u1EDBng. -->\n @if (_selectionVisible) {\n @if (_selectionSingle) {\n <mat-radio-button\n class=\"sd-tree__radio\"\n [checked]=\"node.selected\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n } @else {\n <mat-checkbox\n class=\"sd-tree__checkbox\"\n [checked]=\"node.selected\"\n [indeterminate]=\"node.selectionIndeterminate\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n }\n }\n\n @if (node.icon) {\n <sd-icon\n class=\"sd-tree__item-icon\"\n [color]=\"node.selected ? 'primary' : undefined\"\n [attr.data-autoid]=\"node.autoIds.icon\"\n [name]=\"node.icon\"></sd-icon>\n }\n\n <div class=\"sd-tree__content\" [class.sd-tree__content--custom]=\"_resolvedItemTemplate\" [attr.data-autoid]=\"node.autoIds.label\">\n @if (_resolvedItemTemplate) {\n <ng-container *ngTemplateOutlet=\"_resolvedItemTemplate; context: node.context\" />\n } @else {\n <span class=\"sd-tree__label\">{{ node.label }}</span>\n }\n </div>\n </div>\n\n @if (node.commands.length) {\n <sd-button\n class=\"sd-tree__command-trigger\"\n type=\"text\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [tooltip]=\"node.label\"\n [attr.data-autoid]=\"node.autoIds.command\">\n @for (command of node.commands; track command.key) {\n <sd-button-item\n [disabled]=\"command.disabled\"\n [autoId]=\"command.autoId\"\n [prefixIcon]=\"command.icon\"\n [color]=\"command.color\"\n [fontSet]=\"command.fontSet\"\n (click)=\"command.command.click(node.data)\"\n >{{ command.title }}</sd-button-item\n >\n }\n </sd-button>\n }\n </div>\n }\n </div>\n}\n\n<sd-quick-action [opened]=\"_selectionQuickActionOpened\">\n <div class=\"d-flex align-items-center\" sdMessage>\n <div class=\"c-bg-length\">\n <span class=\"c-length sd-tree__qa-count\">{{ selectedCount() }}</span>\n </div>\n <div class=\"c-message\">\n {{ _selectionMessage }}\n </div>\n </div>\n\n <div class=\"d-flex align-items-center mr-8 sd-tree__qa-actions\" sdAction>\n @for (actionView of _selectionActionViews; track $index) {\n <sd-button\n [autoId]=\"actionView.autoId\"\n class=\"ml-4\"\n [tooltip]=\"actionView.action.tooltip\"\n [prefixIcon]=\"actionView.action.icon\"\n [color]=\"actionView.action.color || 'primary'\"\n [type]=\"actionView.action.type || 'light'\"\n [fontSet]=\"actionView.action.fontSet\"\n [title]=\"actionView.action.title\"\n (click)=\"onSelectionAction(actionView.action)\" />\n }\n <sd-button\n [autoId]=\"clearSelectionAutoId()\"\n class=\"ml-4\"\n prefixIcon=\"close\"\n color=\"secondary\"\n type=\"outline\"\n width=\"35px\"\n (click)=\"clearSelection()\" />\n </div>\n</sd-quick-action>\n", styles: [":host{--sd-tree-row-height: 44px;--sd-tree-control-size: 28px;--sd-tree-checkbox-size: 16px;--sd-tree-indent-size: 20px;--sd-tree-selected-bg: color-mix(in srgb, var(--sd-primary, #005cbb) 12%, var(--sd-tree-selected-mix, #ffffff));--sd-tree-hover-bg: rgba(15, 23, 42, .04);display:block}.sd-tree{display:flex;flex-direction:column;width:100%}.sd-tree__row{position:relative;display:flex;align-items:flex-start;min-height:var(--sd-tree-row-height);box-sizing:border-box;padding:8px 4px 8px calc(4px + var(--sd-tree-level) * var(--sd-tree-indent-size));color:var(--sd-tree-text, #102047);border-radius:0}.sd-tree__row:hover{background:var(--sd-tree-hover-bg)}.sd-tree__row:focus-visible{z-index:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-tree__row--selected{background:var(--sd-tree-selected-bg)}.sd-tree__lines{position:absolute;inset:0;pointer-events:none;color:var(--sd-border, #dce1e9)}.sd-tree__line{position:absolute;left:calc(4px + var(--sd-tree-line-level) * var(--sd-tree-indent-size) + var(--sd-tree-control-size) / 2);top:0;bottom:0;border-left:1px solid currentcolor}.sd-tree__line--branch:after{content:\"\";position:absolute;top:calc(8px + var(--sd-tree-control-size) / 2);width:max(0px,var(--sd-tree-indent-size) - 8px);border-top:1px solid currentcolor}.sd-tree__line--last{bottom:auto;height:calc(8px + var(--sd-tree-control-size) / 2)}.sd-tree__line--children{top:calc(8px + var(--sd-tree-control-size) / 2 + 8px)}.sd-tree__main{display:flex;align-items:flex-start;min-width:0;flex:1 1 auto}.sd-tree__toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);padding:0;color:var(--sd-tree-muted, #5f6f89);background:transparent;border:0;border-radius:var(--sd-radius-4, 4px);cursor:pointer}.sd-tree__toggle:disabled{cursor:default}.sd-tree__toggle--placeholder{visibility:hidden}.sd-tree__toggle sd-icon{width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__checkbox{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-checkbox-state-layer-size: var(--sd-tree-control-size);--mdc-checkbox-selected-checkmark-color: var(--sd-text-on-solid, #ffffff);--mdc-checkbox-selected-focus-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-hover-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-pressed-icon-color: var(--sd-primary, #005cbb)}.sd-tree__checkbox ::ng-deep .mdc-checkbox{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__checkbox ::ng-deep .mdc-checkbox .mdc-checkbox__background{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-radio-state-layer-size: var(--sd-tree-control-size);--mdc-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-focus-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-hover-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-pressed-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-checked-state-layer-color: var(--sd-primary, #005cbb) !important}.sd-tree__radio ::ng-deep .mdc-radio{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__background,.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__native-control{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio ::ng-deep .mdc-form-field>label{display:none}.sd-tree__item-icon{flex:0 0 auto;width:20px;height:20px;min-height:var(--sd-tree-control-size);margin:0 8px 0 0;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__content{display:-webkit-box;min-width:0;min-height:var(--sd-tree-control-size);padding:4px 0;overflow:hidden;overflow-wrap:anywhere;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:var(--sd-line-height-20, 20px)}.sd-tree__content--custom{display:block;max-height:none;-webkit-line-clamp:unset}.sd-tree__label{font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400)}.sd-tree__row--parent .sd-tree__label{font-weight:var(--sd-font-weight-semibold, 600)}.sd-tree__command-trigger{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;align-self:flex-start;width:24px;height:var(--sd-tree-control-size);padding:0;margin-left:8px;line-height:var(--sd-line-height-24, 24px);opacity:0;transition:opacity var(--sd-duration-fast, .12s) ease}.sd-tree__row:hover .sd-tree__command-trigger,.sd-tree__command-trigger:focus-within,.sd-tree__command-trigger:has(button[aria-expanded=true]){opacity:1}:host ::ng-deep .sd-tree__command-trigger button.c-button{height:var(--sd-tree-control-size);max-width:24px;padding:0!important}:host ::ng-deep .sd-tree__command-trigger button.c-button .mat-mdc-button-touch-target{width:100%;height:100%}.c-bg-length{display:flex;flex-direction:column;align-items:flex-start;position:static;width:auto;min-width:48px;height:48px;padding:12px 8px;background:var(--sd-primary);border-radius:8px 0 0 8px}.c-bg-length .c-length{position:static;width:auto;min-width:32px;height:24px;color:var(--sd-text-on-solid, #ffffff);font-family:Roboto,sans-serif;font-size:var(--sd-font-size-16, 16px);font-style:normal;font-weight:var(--sd-font-weight-medium, 500);line-height:var(--sd-line-height-24, 24px);text-align:center}.c-message{position:static;min-width:200px;height:20px;margin:0 0 0 8px;color:var(--sd-tree-strong-text, #000000);font-family:Roboto,sans-serif;font-size:var(--sd-font-size-14, 14px);font-style:normal;font-weight:400;line-height:var(--sd-line-height-20, 20px)}.sd-tree__qa-actions{align-items:center;gap:4px;margin-right:8px}.sd-tree__root-loading,.sd-tree__root-error{display:flex;align-items:center;justify-content:center;gap:8px;min-height:120px;padding:16px}.sd-tree__root-error{flex-direction:column;color:var(--sd-error, #d92d20)}.sd-tree__root-error button{min-height:36px;padding:6px 12px;border:1px solid currentcolor;border-radius:var(--sd-radius-6, 6px);background:transparent;color:inherit;font:inherit;cursor:pointer}\n"] }]
|
|
758
|
-
}], ctorParameters: () => [], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], tree: [{ type: i0.Input, args: [{ isSignal: true, alias: "tree", required: false }] }], selectedItemsInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: false }] }], commands: [{ type: i0.Input, args: [{ isSignal: true, alias: "commands", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], showLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLines", required: false }] }], selector: [{ type: i0.Input, args: [{ isSignal: true, alias: "selector", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], selectedItemsChange: [{ type: i0.Output, args: ["selectedItemsChange"] }], selectChange: [{ type: i0.Output, args: ["selectChange"] }], expandChange: [{ type: i0.Output, args: ["expandChange"] }], collapseChange: [{ type: i0.Output, args: ["collapseChange"] }], loadError: [{ type: i0.Output, args: ["loadError"] }], itemDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTreeItemDefDirective), { isSignal: true }] }] } });
|
|
1280
|
+
}, template: "@let _resolvedItemTemplate = resolvedItemTemplate();\n@let _selectionVisible = selectionVisible();\n@let _selectionSingle = selectionSingle();\n@let _selectionMessage = selectionMessage();\n@let _selectionQuickActionOpened = selectionQuickActionOpened();\n@let _rootError = rootError();\n@let _emptyState = emptyState();\n@let _emptyDef = emptyDef();\n@let _treeLines = treeLines();\n@let _highlightTerm = highlightTerm();\n\n@if (rootLoading()) {\n <div class=\"sd-tree__root-loading\" role=\"status\" aria-live=\"polite\">\n <mat-progress-spinner diameter=\"24\" mode=\"indeterminate\" />\n </div>\n} @else if (_rootError) {\n <!-- why: th\u00F4ng \u0111i\u1EC7p c\u1EE7a exception (stack, t\u00EAn b\u1EA3ng, URL n\u1ED9i b\u1ED9) kh\u00F4ng d\u00E0nh cho ng\u01B0\u1EDDi d\u00F9ng cu\u1ED1i; l\u1ED7i g\u1ED1c v\u1EABn\n t\u1EDBi consumer qua `loadError` v\u00E0 `rootError()`. -->\n <div class=\"sd-tree__root-error\" role=\"alert\">\n <sd-icon class=\"sd-tree__root-error-icon\" name=\"error\" aria-hidden=\"true\"></sd-icon>\n <span class=\"sd-tree__root-error-text\">{{ 'core.component.tree.load-error' | sdTranslate }}</span>\n <sd-button data-tree-retry type=\"outline\" size=\"sm\" [title]=\"'core.component.tree.retry' | sdTranslate\" (click)=\"retry()\" />\n </div>\n} @else if (_emptyState) {\n <!-- why: kh\u1ED1i n\u00E0y thay ch\u1ED7 `role=\"tree\"`, n\u00EAn n\u00F3 ph\u1EA3i t\u1EF1 \u0111\u1ECDc \u0111\u01B0\u1EE3c (status) v\u00E0 t\u1EF1 mang `aria-busy` c\u1EE7a l\u1EA7n t\u00ECm tr\u00EAn\n server \u0111ang ch\u1EDD \u2014 n\u1EBFu kh\u00F4ng, ch\u1EEF \"kh\u00F4ng kh\u1EDBp\" c\u0169 \u0111\u01B0\u1EE3c \u0111\u1ECDc nh\u01B0 k\u1EBFt qu\u1EA3 c\u1EE7a l\u1EA7n g\u00F5 m\u1EDBi. -->\n <div class=\"sd-tree__root-empty\" role=\"status\" [attr.aria-busy]=\"searchPending() || null\">\n @if (_emptyDef) {\n <ng-container *ngTemplateOutlet=\"_emptyDef.templateRef; context: _emptyState\" />\n } @else if (_emptyState.searching) {\n {{ 'core.component.tree.no-match' | sdTranslate: { text: _emptyState.text } }}\n } @else {\n {{ 'core.component.tree.empty' | sdTranslate }}\n }\n </div>\n} @else {\n <div class=\"sd-tree\" role=\"tree\" [attr.aria-busy]=\"rootLoading() || searchPending()\" [style.--sd-tree-indent-size]=\"indentSize() + 'px'\">\n @for (node of visibleViewNodes(); track node.id) {\n @let _lines = _treeLines.get(node.id);\n <!-- why: `[tabIndex]` l\u00E0 property DOM (camelCase) \u2014 n\u00F3 set \u0111\u00FAng gi\u00E1 tr\u1ECB nh\u01B0ng KH\u00D4NG sinh\n attribute `tabindex` trong markup, n\u00EAn m\u1ECDi th\u1EE9 \u0111\u1ECDc markup (lint a11y, snapshot test,\n devtools inspect) \u0111\u1EC1u th\u1EA5y row l\u00E0 kh\u00F4ng focusable. \u0110\u1ED5i sang `[attr.tabindex]`. -->\n <div\n class=\"sd-tree__row\"\n role=\"treeitem\"\n [attr.tabindex]=\"node.tabIndex\"\n [class.sd-tree__row--selected]=\"node.highlighted && !node.active\"\n [class.sd-tree__row--active]=\"node.active\"\n [class.sd-tree__row--parent]=\"node.hasChildren\"\n [class.sd-tree__row--context]=\"node.muted\"\n [style.--sd-tree-level]=\"node.level\"\n [attr.aria-level]=\"node.level + 1\"\n [attr.aria-expanded]=\"node.ariaExpanded\"\n [attr.aria-selected]=\"node.ariaSelected\"\n [attr.aria-label]=\"node.ariaLabel\"\n [attr.aria-checked]=\"_selectionVisible ? (node.selectionIndeterminate ? 'mixed' : node.selected) : null\"\n [attr.data-autoid]=\"node.autoIds.row\"\n [attr.data-tree-node]=\"node.id\"\n (click)=\"onRowClick(node, $event)\"\n (focus)=\"onRowFocus(node)\"\n (keydown)=\"onRowKeydown(node, $event)\">\n @if (_lines) {\n <span class=\"sd-tree__lines\" aria-hidden=\"true\">\n @for (line of _lines.segments; track line.level) {\n <span\n class=\"sd-tree__line\"\n [class.sd-tree__line--branch]=\"line.branch\"\n [class.sd-tree__line--last]=\"line.last\"\n [style.--sd-tree-line-level]=\"line.level\"></span>\n }\n @if (_lines.children) {\n <span class=\"sd-tree__line sd-tree__line--children\" [style.--sd-tree-line-level]=\"node.level\"></span>\n }\n </span>\n }\n <div class=\"sd-tree__main\">\n <button\n type=\"button\"\n class=\"sd-tree__toggle\"\n [class.sd-tree__toggle--placeholder]=\"!node.hasChildren\"\n [disabled]=\"node.toggleDisabled\"\n [attr.aria-label]=\"node.toggleLabel\"\n [attr.data-autoid]=\"node.autoIds.toggle\"\n [attr.data-tree-node-retry]=\"node.loadError ? node.id : null\"\n (click)=\"toggle(node, $event)\">\n @if (node.isLoading) {\n <mat-progress-spinner diameter=\"16\" mode=\"indeterminate\" />\n } @else if (node.loadError) {\n <sd-icon name=\"refresh\"></sd-icon>\n } @else if (node.hasChildren) {\n <sd-icon [name]=\"node.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n }\n </button>\n\n <!-- why: `selector.single` cho ph\u00E9p \u0111\u00FAng M\u1ED8T node, m\u00E0 checkbox l\u1EA1i l\u00E0 k\u00FD hi\u1EC7u c\u1EE7a\n \"ch\u1ECDn nhi\u1EC1u\" \u2014 ng\u01B0\u1EDDi d\u00F9ng tick node th\u1EE9 hai r\u1ED3i m\u1EDBi ph\u00E1t hi\u1EC7n node \u0111\u1EA7u t\u1EF1 b\u1ECF. Radio\n n\u00F3i tr\u01B0\u1EDBc \u0111i\u1EC1u \u0111\u00F3. Kh\u00F4ng gom v\u00E0o <mat-radio-group>: group chi\u1EBFm Arrow Up/Down cho\n vi\u1EC7c chuy\u1EC3n l\u1EF1a ch\u1ECDn, trong khi h\u00E0ng c\u00E2y \u0111\u00E3 d\u00F9ng \u0111\u00FAng hai ph\u00EDm \u0111\u00F3 \u0111\u1EC3 \u0111i\u1EC1u h\u01B0\u1EDBng. -->\n @if (_selectionVisible) {\n @if (_selectionSingle) {\n <mat-radio-button\n class=\"sd-tree__radio\"\n [checked]=\"node.selected\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n } @else {\n <mat-checkbox\n class=\"sd-tree__checkbox\"\n [checked]=\"node.selected\"\n [indeterminate]=\"node.selectionIndeterminate\"\n [disabled]=\"node.selectionDisabled\"\n [attr.data-autoid]=\"node.autoIds.checkbox\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"toggleSelection(node)\" />\n }\n }\n\n @if (node.icon) {\n <sd-icon\n class=\"sd-tree__item-icon\"\n [color]=\"node.highlighted ? 'primary' : undefined\"\n [attr.data-autoid]=\"node.autoIds.icon\"\n [name]=\"node.icon\"></sd-icon>\n }\n\n <div class=\"sd-tree__content\" [class.sd-tree__content--custom]=\"_resolvedItemTemplate\" [attr.data-autoid]=\"node.autoIds.label\">\n @if (_resolvedItemTemplate) {\n <ng-container *ngTemplateOutlet=\"_resolvedItemTemplate; context: node.context\" />\n } @else {\n @if (_highlightTerm) {\n <span class=\"sd-tree__label\"><sd-highlight [text]=\"node.label\" [term]=\"_highlightTerm\" /></span>\n } @else {\n <span class=\"sd-tree__label\">{{ node.label }}</span>\n }\n }\n </div>\n </div>\n\n @if (node.count !== null) {\n <span class=\"sd-tree__count\">{{ node.count }}</span>\n }\n\n @if (node.commands.length) {\n <sd-button\n class=\"sd-tree__command-trigger\"\n type=\"text\"\n size=\"sm\"\n prefixIcon=\"more_vert\"\n [tooltip]=\"node.menuLabel\"\n [attr.data-autoid]=\"node.autoIds.command\">\n @for (command of node.commands; track command.key) {\n <sd-button-item\n [disabled]=\"command.disabled\"\n [autoId]=\"command.autoId\"\n [prefixIcon]=\"command.icon\"\n [color]=\"command.color\"\n [fontSet]=\"command.fontSet\"\n (click)=\"command.command.click(node.data)\"\n >{{ command.title }}</sd-button-item\n >\n }\n </sd-button>\n }\n </div>\n }\n </div>\n}\n\n<!-- SB: thanh ch\u1ECDn nhi\u1EC1u d\u00F9ng chung v\u1EDBi sd-table, n\u1EB1m trong host sau c\u00E1c h\u00E0ng v\u00E0 d\u00EDnh \u0111\u00E1y v\u00F9ng cu\u1ED9n g\u1EA7n nh\u1EA5t.\n V\u00EC thanh n\u1EB1m trong lu\u1ED3ng, host t\u1EF1 cao th\u00EAm \u0111\u00FAng b\u1EB1ng thanh khi n\u00F3 m\u1EDF: h\u00E0ng cu\u1ED1i kh\u00F4ng b\u1ECB che. -->\n<sd-selection-bar\n class=\"sd-tree__selection-bar\"\n [opened]=\"_selectionQuickActionOpened\"\n [message]=\"_selectionMessage\"\n [actions]=\"selectionBarActions()\"\n [autoId]=\"autoId()\"\n actionAutoIdPrefix=\"selection-action\"\n (action)=\"$event.click()\"\n (clear)=\"clearSelection()\" />\n", styles: [":host{--sd-tree-row-height: 44px;--sd-tree-control-size: 28px;--sd-tree-checkbox-size: 16px;--sd-tree-indent-size: 20px;--sd-tree-selected-bg: color-mix(in srgb, var(--sd-primary, #005cbb) 12%, var(--sd-tree-selected-mix, #ffffff));--sd-tree-hover-bg: rgba(15, 23, 42, .04);display:block}.sd-tree{display:flex;flex-direction:column;width:100%}.sd-tree__row{position:relative;display:flex;align-items:flex-start;min-height:var(--sd-tree-row-height);box-sizing:border-box;padding-block:8px;padding-inline:calc(4px + var(--sd-tree-level) * var(--sd-tree-indent-size)) 4px;color:var(--sd-tree-text, #102047);border-radius:0}.sd-tree__row:hover{background:var(--sd-tree-hover-bg)}.sd-tree__row:focus-visible{z-index:1;outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.sd-tree__row--selected,.sd-tree__row--active{background:var(--sd-tree-selected-bg)}.sd-tree__lines{position:absolute;inset:0;pointer-events:none;color:var(--sd-border, #dce1e9)}.sd-tree__line{position:absolute;inset-inline-start:calc(4px + var(--sd-tree-line-level) * var(--sd-tree-indent-size) + var(--sd-tree-control-size) / 2);top:0;bottom:0;border-inline-start:1px solid currentcolor}.sd-tree__line--branch:after{content:\"\";position:absolute;top:calc(8px + var(--sd-tree-control-size) / 2);width:max(0px,var(--sd-tree-indent-size) - 8px);border-top:1px solid currentcolor}.sd-tree__line--last{bottom:auto;height:calc(8px + var(--sd-tree-control-size) / 2)}.sd-tree__line--children{top:calc(8px + var(--sd-tree-control-size) / 2 + 8px)}.sd-tree__main{display:flex;align-items:flex-start;min-width:0;flex:1 1 auto}.sd-tree__toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);padding:0;color:var(--sd-tree-muted, #5f6f89);background:transparent;border:0;border-radius:var(--sd-radius-4, 4px);cursor:pointer}.sd-tree__toggle:disabled{cursor:default}.sd-tree__toggle--placeholder{visibility:hidden}.sd-tree__toggle sd-icon{width:20px;height:20px;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__checkbox{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-checkbox-state-layer-size: var(--sd-tree-control-size);--mdc-checkbox-selected-checkmark-color: var(--sd-text-on-solid, #ffffff);--mdc-checkbox-selected-focus-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-hover-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-icon-color: var(--sd-primary, #005cbb);--mdc-checkbox-selected-pressed-icon-color: var(--sd-primary, #005cbb)}.sd-tree__checkbox ::ng-deep .mdc-checkbox{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__checkbox ::ng-deep .mdc-checkbox .mdc-checkbox__background{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio{display:inline-flex;align-items:center;justify-content:center;flex:0 0 var(--sd-tree-control-size);width:var(--sd-tree-control-size);height:var(--sd-tree-control-size);margin:0 4px 0 0;--mdc-radio-state-layer-size: var(--sd-tree-control-size);--mdc-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-focus-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-hover-icon-color: var(--sd-primary, #005cbb) !important;--mdc-radio-selected-pressed-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-selected-icon-color: var(--sd-primary, #005cbb) !important;--mat-radio-checked-state-layer-color: var(--sd-primary, #005cbb) !important}.sd-tree__radio ::ng-deep .mdc-radio{flex:0 0 var(--sd-tree-checkbox-size);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size);padding:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2)}.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__background,.sd-tree__radio ::ng-deep .mdc-radio .mdc-radio__native-control{top:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);left:calc((var(--sd-tree-control-size) - var(--sd-tree-checkbox-size)) / 2);width:var(--sd-tree-checkbox-size);height:var(--sd-tree-checkbox-size)}.sd-tree__radio ::ng-deep .mdc-form-field>label{display:none}.sd-tree__item-icon{flex:0 0 auto;width:20px;height:20px;min-height:var(--sd-tree-control-size);margin:0 8px 0 0;font-size:var(--sd-font-size-20, 20px);line-height:var(--sd-line-height-20, 20px)}.sd-tree__content{display:-webkit-box;min-width:0;min-height:var(--sd-tree-control-size);padding:4px 0;overflow:hidden;overflow-wrap:anywhere;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:var(--sd-line-height-20, 20px)}.sd-tree__content--custom{display:block;max-height:none;-webkit-line-clamp:unset}.sd-tree__label{font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400)}.sd-tree__label{--sd-highlight-bg: var(--sd-warning-light);--sd-highlight-color: currentcolor}.sd-tree__row--context .sd-tree__label{color:var(--sd-tree-muted, #5f6f89)}.sd-tree__row--parent .sd-tree__label{font-weight:var(--sd-font-weight-semibold, 600)}.sd-tree__count{flex:0 0 auto;padding-block:6px 0;padding-inline:8px 0;color:var(--sd-tree-muted, #5f6f89);font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);font-variant-numeric:tabular-nums;white-space:nowrap}.sd-tree__command-trigger{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;align-self:flex-start;width:24px;height:var(--sd-tree-control-size);padding:0;margin-inline-start:8px;line-height:var(--sd-line-height-24, 24px);opacity:0;transition:opacity var(--sd-duration-fast, .12s) ease}.sd-tree__row:hover .sd-tree__command-trigger,.sd-tree__row:focus-within .sd-tree__command-trigger,.sd-tree__row--active .sd-tree__command-trigger,.sd-tree__command-trigger:focus-within,.sd-tree__command-trigger:has(button[aria-expanded=true]){opacity:1}@media(pointer:coarse){.sd-tree__command-trigger{opacity:1}}:host ::ng-deep .sd-tree__command-trigger button.c-button{height:var(--sd-tree-control-size);max-width:24px;padding:0!important}:host ::ng-deep .sd-tree__command-trigger button.c-button .mat-mdc-button-touch-target{width:100%;height:100%}.sd-tree__selection-bar{display:flow-root;position:sticky;bottom:0;z-index:2;padding-inline:8px;background:var(--sd-surface)}.sd-tree__root-loading,.sd-tree__root-error,.sd-tree__root-empty{display:flex;align-items:center;justify-content:center;gap:8px;min-height:120px;padding:16px;box-sizing:border-box}.sd-tree__root-error{flex-direction:column;color:var(--sd-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:center}.sd-tree__root-error-icon{width:24px;height:24px;color:var(--sd-error, #d92d20);font-size:var(--sd-font-size-24, 24px);line-height:var(--sd-line-height-24, 24px)}.sd-tree__root-empty{color:var(--sd-tree-muted, #5f6f89);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:center;overflow-wrap:anywhere}\n"] }]
|
|
1281
|
+
}], ctorParameters: () => [], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], tree: [{ type: i0.Input, args: [{ isSignal: true, alias: "tree", required: false }] }], selectedItemsInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: false }] }], commands: [{ type: i0.Input, args: [{ isSignal: true, alias: "commands", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], showLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLines", required: false }] }], selector: [{ type: i0.Input, args: [{ isSignal: true, alias: "selector", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], selectedItemsChange: [{ type: i0.Output, args: ["selectedItemsChange"] }], selectChange: [{ type: i0.Output, args: ["selectChange"] }], expandChange: [{ type: i0.Output, args: ["expandChange"] }], collapseChange: [{ type: i0.Output, args: ["collapseChange"] }], loadError: [{ type: i0.Output, args: ["loadError"] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }, { type: i0.Output, args: ["activeIdChange"] }], activeChange: [{ type: i0.Output, args: ["activeChange"] }], expandedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIds", required: false }] }, { type: i0.Output, args: ["expandedIdsChange"] }], itemDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTreeItemDefDirective), { isSignal: true }] }], emptyDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTreeEmptyDefDirective), { isSignal: true }] }], buttons: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => SdButton), { isSignal: true }] }] } });
|
|
759
1282
|
function normalizeText(value) {
|
|
760
1283
|
return value
|
|
761
1284
|
.normalize('NFD')
|
|
@@ -764,6 +1287,44 @@ function normalizeText(value) {
|
|
|
764
1287
|
.toLowerCase()
|
|
765
1288
|
.trim();
|
|
766
1289
|
}
|
|
1290
|
+
function formatCount(value, format) {
|
|
1291
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0)
|
|
1292
|
+
return null;
|
|
1293
|
+
return format.format(Math.floor(value));
|
|
1294
|
+
}
|
|
1295
|
+
function mergeSearchPaths(text, results) {
|
|
1296
|
+
const search = { text, roots: [], children: new Map(), matched: new Set() };
|
|
1297
|
+
const seen = new Set();
|
|
1298
|
+
for (const { path } of results) {
|
|
1299
|
+
path.forEach((item, index) => {
|
|
1300
|
+
if (index === path.length - 1)
|
|
1301
|
+
search.matched.add(item.id);
|
|
1302
|
+
if (seen.has(item.id))
|
|
1303
|
+
return;
|
|
1304
|
+
seen.add(item.id);
|
|
1305
|
+
if (index === 0) {
|
|
1306
|
+
search.roots.push(item);
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
const parentId = path[index - 1].id;
|
|
1310
|
+
const siblings = search.children.get(parentId);
|
|
1311
|
+
if (siblings)
|
|
1312
|
+
siblings.push(item);
|
|
1313
|
+
else
|
|
1314
|
+
search.children.set(parentId, [item]);
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
return search;
|
|
1318
|
+
}
|
|
1319
|
+
/** Vùng cuộn gần nhất, tính cả chính host (consumer có thể đặt `overflow` thẳng lên `sd-tree`). */
|
|
1320
|
+
function scrollParent(element) {
|
|
1321
|
+
for (let current = element; current; current = current.parentElement) {
|
|
1322
|
+
const overflow = getComputedStyle(current).overflowY;
|
|
1323
|
+
if (overflow === 'auto' || overflow === 'scroll')
|
|
1324
|
+
return current;
|
|
1325
|
+
}
|
|
1326
|
+
return null;
|
|
1327
|
+
}
|
|
767
1328
|
function sanitizeId(value) {
|
|
768
1329
|
return value.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
769
1330
|
}
|
|
@@ -775,5 +1336,5 @@ function isPromiseLike(value) {
|
|
|
775
1336
|
* Generated bundle index. Do not edit.
|
|
776
1337
|
*/
|
|
777
1338
|
|
|
778
|
-
export { SdTree, SdTreeItemDefDirective };
|
|
1339
|
+
export { SdTree, SdTreeEmptyDefDirective, SdTreeItemDefDirective };
|
|
779
1340
|
//# sourceMappingURL=sdcorejs-angular-components-tree.mjs.map
|