@sdcorejs/angular 22.3.4 → 22.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/fesm2022/sdcorejs-angular-components-anchor.mjs +64 -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 +2565 -0
- package/fesm2022/sdcorejs-angular-components-calendar.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs +521 -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 +849 -157
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +66 -14
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +1528 -375
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +78 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs +2006 -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 +6215 -3830
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-timeline.mjs +501 -0
- package/fesm2022/sdcorejs-angular-components-timeline.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-tree.mjs +613 -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 +110 -22
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +142 -43
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +71 -22
- 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-SJIWI1dX.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-j_thIw4L.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-SJIWI1dX.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-j_thIw4L.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-DLsJ_8NR.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-BPhMLVbv.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-DLsJ_8NR.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs → sdcorejs-angular-modules-generic-generic-list.page-CkYR7Y-b.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-aGhowe9Y.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-CkYR7Y-b.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-Ddytu3Gb.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-N8_oGpqD.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-Ddytu3Gb.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-C2o5xPVB.mjs → sdcorejs-angular-modules-pattern-base-api.service-vMdkWmw-.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-C2o5xPVB.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-vMdkWmw-.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-RBvVv88D.mjs → sdcorejs-angular-modules-pattern-create.component--cdb_2ub.mjs} +11 -7
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component--cdb_2ub.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CxicczH7.mjs → sdcorejs-angular-modules-pattern-create.component-BmKRynOI.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CxicczH7.mjs.map → sdcorejs-angular-modules-pattern-create.component-BmKRynOI.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-D3MzNJ3F.mjs → sdcorejs-angular-modules-pattern-create.component-DoilYt0j.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-D3MzNJ3F.mjs.map → sdcorejs-angular-modules-pattern-create.component-DoilYt0j.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-3hWkJClX.mjs → sdcorejs-angular-modules-pattern-customer.service-DpPC-tV2.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-3hWkJClX.mjs.map → sdcorejs-angular-modules-pattern-customer.service-DpPC-tV2.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CcpYULut.mjs → sdcorejs-angular-modules-pattern-detail.component-Bh_rvQnq.mjs} +61 -55
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Bh_rvQnq.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CEhbU12j.mjs → sdcorejs-angular-modules-pattern-detail.component-Dk1bomUT.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-CEhbU12j.mjs.map → sdcorejs-angular-modules-pattern-detail.component-Dk1bomUT.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-G5lHfG81.mjs → sdcorejs-angular-modules-pattern-flow.component-BarNCjsh.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-G5lHfG81.mjs.map → sdcorejs-angular-modules-pattern-flow.component-BarNCjsh.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-CosbQK0W.mjs → sdcorejs-angular-modules-pattern-index.component--rIi-QIQ.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-CosbQK0W.mjs.map → sdcorejs-angular-modules-pattern-index.component--rIi-QIQ.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-DmmVKrgM.mjs → sdcorejs-angular-modules-pattern-lines-table-form.component-G9Li--QF.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-DmmVKrgM.mjs.map → sdcorejs-angular-modules-pattern-lines-table-form.component-G9Li--QF.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-2AZxTu9a.mjs +522 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-2AZxTu9a.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CDM4V05g.mjs +520 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CDM4V05g.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-C_pVqRcC.mjs → sdcorejs-angular-modules-pattern-list.component-DS9DROp-.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-C_pVqRcC.mjs.map → sdcorejs-angular-modules-pattern-list.component-DS9DROp-.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CNVqk3JC.mjs → sdcorejs-angular-modules-pattern-list.component-DbF9z3da.mjs} +30 -39
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DbF9z3da.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-EaNDEtCn.mjs → sdcorejs-angular-modules-pattern-list.component-DlF3i6ai.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-EaNDEtCn.mjs.map → sdcorejs-angular-modules-pattern-list.component-DlF3i6ai.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-CFljqhjv.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-BpECki9p.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-CFljqhjv.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-BpECki9p.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-DitXmlr1.mjs → sdcorejs-angular-modules-pattern-product.service-DEAQ4oro.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-DitXmlr1.mjs.map → sdcorejs-angular-modules-pattern-product.service-DEAQ4oro.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-Dxw7Ix9d.mjs → sdcorejs-angular-modules-pattern-profile.component-D-dJk5vb.mjs} +27 -14
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-D-dJk5vb.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BxXgJVsW.mjs → sdcorejs-angular-modules-pattern-routes-Brr61WQo.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BxXgJVsW.mjs.map → sdcorejs-angular-modules-pattern-routes-Brr61WQo.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CWixJ2If.mjs → sdcorejs-angular-modules-pattern-routes-CPVcXcfq.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CWixJ2If.mjs.map → sdcorejs-angular-modules-pattern-routes-CPVcXcfq.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-w4VY9P_H.mjs → sdcorejs-angular-modules-pattern-routes-CWCtuZ4z.mjs} +8 -8
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-w4VY9P_H.mjs.map → sdcorejs-angular-modules-pattern-routes-CWCtuZ4z.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BOiWZHqg.mjs → sdcorejs-angular-modules-pattern-routes-CfXmYmCp.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BOiWZHqg.mjs.map → sdcorejs-angular-modules-pattern-routes-CfXmYmCp.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CuDWVZ4I.mjs +56 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CuDWVZ4I.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CJ-RAMa5.mjs → sdcorejs-angular-modules-pattern-routes-D8W_NHEH.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CJ-RAMa5.mjs.map → sdcorejs-angular-modules-pattern-routes-D8W_NHEH.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Db0ceW1C.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Db0ceW1C.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C43Q4Wtq.mjs → sdcorejs-angular-modules-pattern-routes-DdmOGRpF.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-C43Q4Wtq.mjs.map → sdcorejs-angular-modules-pattern-routes-DdmOGRpF.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BQCWgQsr.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-JWx3RaLo.mjs} +12 -12
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BQCWgQsr.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-JWx3RaLo.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BOjJteMd.mjs → sdcorejs-angular-modules-pattern-shell.component-DMJpUhpn.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BOjJteMd.mjs.map → sdcorejs-angular-modules-pattern-shell.component-DMJpUhpn.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BHDd7D8y.mjs +498 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BHDd7D8y.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-lGwicZKW.mjs → sdcorejs-angular-modules-pattern-update.component-Bx2zgc86.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-lGwicZKW.mjs.map → sdcorejs-angular-modules-pattern-update.component-Bx2zgc86.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CS3jlV-R.mjs → sdcorejs-angular-modules-pattern-update.component-Cb29tp1H.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CS3jlV-R.mjs.map → sdcorejs-angular-modules-pattern-update.component-Cb29tp1H.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-CUgQPcR4.mjs → sdcorejs-angular-modules-pattern-update.component-e5BaHrDk.mjs} +9 -6
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-e5BaHrDk.mjs.map +1 -0
- 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 +227 -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/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/types/sdcorejs-angular-components-anchor.d.ts +6 -1
- package/types/sdcorejs-angular-components-button.d.ts +7 -1
- package/types/sdcorejs-angular-components-calendar.d.ts +1092 -0
- package/types/sdcorejs-angular-components-card.d.ts +247 -9
- package/types/sdcorejs-angular-components-kanban.d.ts +191 -74
- package/types/sdcorejs-angular-components-modal.d.ts +15 -1
- package/types/sdcorejs-angular-components-query-bar.d.ts +204 -38
- package/types/sdcorejs-angular-components-quick-action.d.ts +65 -1
- package/types/sdcorejs-angular-components-scheduler.d.ts +544 -0
- package/types/sdcorejs-angular-components-tab.d.ts +6 -1
- package/types/sdcorejs-angular-components-table.d.ts +338 -31
- package/types/sdcorejs-angular-components-timeline.d.ts +216 -0
- package/types/sdcorejs-angular-components-tree.d.ts +119 -6
- package/types/sdcorejs-angular-components.d.ts +3 -1
- package/types/sdcorejs-angular-directives.d.ts +4 -2
- package/types/sdcorejs-angular-forms-date.d.ts +2 -0
- package/types/sdcorejs-angular-forms-directives.d.ts +1 -1
- package/types/sdcorejs-angular-i18n.d.ts +159 -9
- package/types/sdcorejs-angular-modules-layout.d.ts +2 -1
- package/types/sdcorejs-angular-services-confirm.d.ts +22 -81
- package/types/sdcorejs-angular-services-excel.d.ts +59 -0
- package/types/sdcorejs-angular-services-query-params.d.ts +67 -0
- package/types/sdcorejs-angular-utilities-extensions.d.ts +10 -1
- 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-CRc9T7rb.mjs +0 -146
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CRc9T7rb.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-Cz-MjRG0.mjs +0 -148
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-Cz-MjRG0.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-RBvVv88D.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-DzDAX3B7.mjs +0 -152
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-DzDAX3B7.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CcpYULut.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs +0 -92
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D8-WXUAE.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs +0 -242
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DHTxzjRN.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs +0 -72
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-CTgHdGeQ.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BjehcQEk.mjs +0 -172
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BjehcQEk.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CNVqk3JC.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-jB3E20UF.mjs +0 -120
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-jB3E20UF.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-Dxw7Ix9d.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BWZxOMhB.mjs +0 -74
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-BWZxOMhB.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CophQH_L.mjs +0 -100
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CophQH_L.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BT2PzXTG.mjs +0 -135
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BT2PzXTG.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-qmGn2tCI.mjs +0 -146
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-qmGn2tCI.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CUgQPcR4.mjs.map +0 -1
- package/modules/pattern/features/category/entity.resolver.ts +0 -27
- package/types/sdcorejs-angular-components-history.d.ts +0 -23
|
@@ -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: "22.1.5", ngImport: i0, type: SdTreeEmptyDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdTreeEmptyDefDirective, isStandalone: true, selector: "[sdTreeEmptyDef]", ngImport: i0 });
|
|
28
|
+
}
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", 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: "22.1.5", ngImpor
|
|
|
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" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
44
68
|
option = input(undefined, /* @ts-ignore */
|
|
45
69
|
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
@@ -63,8 +87,24 @@ class SdTree {
|
|
|
63
87
|
expandChange = output();
|
|
64
88
|
collapseChange = output();
|
|
65
89
|
loadError = output();
|
|
90
|
+
/**
|
|
91
|
+
* Id của nút đang mở (chế độ `navigation`). Là model trên component, không nằm trong `[option]`, để gắn hai
|
|
92
|
+
* chiều với URL.
|
|
93
|
+
*/
|
|
94
|
+
activeId = model(null, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
96
|
+
/** Phát mỗi lần người dùng mở một nút, kể cả nút đang mở. */
|
|
97
|
+
activeChange = output();
|
|
98
|
+
/**
|
|
99
|
+
* 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
|
|
100
|
+
* áp dụng. `undefined`: cây tự quản lý như cũ. Đổi `items` không reset.
|
|
101
|
+
*/
|
|
102
|
+
expandedIds = model(/* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [undefined, { debugName: "expandedIds" }] : /* istanbul ignore next */ []));
|
|
66
104
|
itemDef = contentChild((SdTreeItemDefDirective), /* @ts-ignore */
|
|
67
105
|
...(ngDevMode ? [{ debugName: "itemDef" }] : /* istanbul ignore next */ []));
|
|
106
|
+
emptyDef = contentChild(SdTreeEmptyDefDirective, /* @ts-ignore */
|
|
107
|
+
...(ngDevMode ? [{ debugName: "emptyDef" }] : /* istanbul ignore next */ []));
|
|
68
108
|
resolvedItemsSource = computed(() => {
|
|
69
109
|
return this.option()?.items ?? this.items() ?? EMPTY_TREE_ITEMS;
|
|
70
110
|
}, /* @ts-ignore */
|
|
@@ -79,6 +119,8 @@ class SdTree {
|
|
|
79
119
|
...(ngDevMode ? [{ debugName: "resolvedSelectable" }] : /* istanbul ignore next */ []));
|
|
80
120
|
resolvedShowLines = computed(() => this.option()?.showLines ?? this.showLines(), /* @ts-ignore */
|
|
81
121
|
...(ngDevMode ? [{ debugName: "resolvedShowLines" }] : /* istanbul ignore next */ []));
|
|
122
|
+
navigation = computed(() => this.option()?.navigation === true, /* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [{ debugName: "navigation" }] : /* istanbul ignore next */ []));
|
|
82
124
|
autoId = computed(() => {
|
|
83
125
|
const scope = this.option()?.autoId ?? this.autoIdInput();
|
|
84
126
|
return scope ? `components-tree-${scope}` : undefined;
|
|
@@ -106,18 +148,61 @@ class SdTree {
|
|
|
106
148
|
...(ngDevMode ? [{ debugName: "#filterText" }] : /* istanbul ignore next */ []));
|
|
107
149
|
#reloadTick = signal(0, /* @ts-ignore */
|
|
108
150
|
...(ngDevMode ? [{ debugName: "#reloadTick" }] : /* istanbul ignore next */ []));
|
|
151
|
+
#search = signal(null, /* @ts-ignore */
|
|
152
|
+
...(ngDevMode ? [{ debugName: "#search" }] : /* istanbul ignore next */ []));
|
|
153
|
+
/** 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ũ. */
|
|
154
|
+
#searchCollapsed = signal(new Set(), /* @ts-ignore */
|
|
155
|
+
...(ngDevMode ? [{ debugName: "#searchCollapsed" }] : /* istanbul ignore next */ []));
|
|
156
|
+
/** Đang chờ debounce hoặc chờ `onSearch` trả về. */
|
|
157
|
+
searchPending = signal(false, /* @ts-ignore */
|
|
158
|
+
...(ngDevMode ? [{ debugName: "searchPending" }] : /* istanbul ignore next */ []));
|
|
159
|
+
#serverSearch = computed(() => {
|
|
160
|
+
const tree = this.resolvedTree();
|
|
161
|
+
return tree.loadType === 'lazy' && !!tree.onSearch;
|
|
162
|
+
}, /* @ts-ignore */
|
|
163
|
+
...(ngDevMode ? [{ debugName: "#serverSearch" }] : /* istanbul ignore next */ []));
|
|
164
|
+
/** Chữ cần tô trong nhãn: chữ đang lọc (static) hoặc chữ của kết quả đang hiện (server). */
|
|
165
|
+
highlightTerm = computed(() => (this.#serverSearch() ? (this.#search()?.text ?? '') : this.#filterText().trim()), /* @ts-ignore */
|
|
166
|
+
...(ngDevMode ? [{ debugName: "highlightTerm" }] : /* istanbul ignore next */ []));
|
|
167
|
+
#expandedIdSet = computed(() => {
|
|
168
|
+
const ids = this.expandedIds();
|
|
169
|
+
return ids === undefined ? undefined : new Set(ids);
|
|
170
|
+
}, /* @ts-ignore */
|
|
171
|
+
...(ngDevMode ? [{ debugName: "#expandedIdSet" }] : /* istanbul ignore next */ []));
|
|
109
172
|
rootLoading = signal(false, /* @ts-ignore */
|
|
110
173
|
...(ngDevMode ? [{ debugName: "rootLoading" }] : /* istanbul ignore next */ []));
|
|
111
174
|
rootError = signal(null, /* @ts-ignore */
|
|
112
175
|
...(ngDevMode ? [{ debugName: "rootError" }] : /* istanbul ignore next */ []));
|
|
113
176
|
activeNodeId = signal(null, /* @ts-ignore */
|
|
114
177
|
...(ngDevMode ? [{ debugName: "activeNodeId" }] : /* istanbul ignore next */ []));
|
|
178
|
+
buttons = viewChildren(SdButton, /* @ts-ignore */
|
|
179
|
+
...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
|
|
180
|
+
/** Hàng đã mở menu ⋯ bằng bàn phím; menu đóng thì focus quay về đây. */
|
|
181
|
+
#keyboardMenuRow = null;
|
|
115
182
|
#rootLoadId = 0;
|
|
116
183
|
#lastSource;
|
|
117
184
|
#lastSourceValue;
|
|
118
185
|
#lastReloadTick = -1;
|
|
119
186
|
#treeGeneration = 0;
|
|
120
187
|
#lazyLoadIds = new Map();
|
|
188
|
+
/** Lần tải con đang chạy theo id, để `reveal`, `expand` và `expandedIds` không gọi `onExpandChildren` hai lần. */
|
|
189
|
+
#lazyLoads = new Map();
|
|
190
|
+
#revealController = null;
|
|
191
|
+
#searchController = null;
|
|
192
|
+
/**
|
|
193
|
+
* 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ữ
|
|
194
|
+
* 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`).
|
|
195
|
+
*/
|
|
196
|
+
#searchSeen = new Map();
|
|
197
|
+
#searchSeenTick = signal(0, /* @ts-ignore */
|
|
198
|
+
...(ngDevMode ? [{ debugName: "#searchSeenTick" }] : /* istanbul ignore next */ []));
|
|
199
|
+
#searchTimer;
|
|
200
|
+
/** Nút `reveal` đang chờ hàng của nó được render để cuộn tới. */
|
|
201
|
+
#pendingScrollId = null;
|
|
202
|
+
/** Id do người dùng vừa mở: lần đổi `activeId` này không cần `reveal`. */
|
|
203
|
+
#userActiveId = null;
|
|
204
|
+
/** Id đã `reveal` xong: tải lại `items` không cuộn lại lần nữa. */
|
|
205
|
+
#revealedId = null;
|
|
121
206
|
normalizedFilterText = computed(() => normalizeText(this.#filterText()), /* @ts-ignore */
|
|
122
207
|
...(ngDevMode ? [{ debugName: "normalizedFilterText" }] : /* istanbul ignore next */ []));
|
|
123
208
|
selectionVisible = computed(() => this.resolvedSelectable() && this.resolvedSelector()?.visible === true, /* @ts-ignore */
|
|
@@ -134,10 +219,47 @@ class SdTree {
|
|
|
134
219
|
return selectedItems ? this.#idsFromSelectedItems(selectedItems) : this.#selectedIds();
|
|
135
220
|
}, /* @ts-ignore */
|
|
136
221
|
...(ngDevMode ? [{ debugName: "selectedIdSet" }] : /* istanbul ignore next */ []));
|
|
137
|
-
|
|
222
|
+
/** 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. */
|
|
223
|
+
#loadedNodes = computed(() => this.#buildNodes(this.#rootItems(), 0, null), /* @ts-ignore */
|
|
224
|
+
...(ngDevMode ? [{ debugName: "#loadedNodes" }] : /* istanbul ignore next */ []));
|
|
225
|
+
rootNodes = computed(() => {
|
|
226
|
+
const search = this.#search();
|
|
227
|
+
return search ? this.#buildSearchNodes(search, search.roots, 0, null) : this.#loadedNodes();
|
|
228
|
+
}, /* @ts-ignore */
|
|
138
229
|
...(ngDevMode ? [{ debugName: "rootNodes" }] : /* istanbul ignore next */ []));
|
|
230
|
+
/**
|
|
231
|
+
* 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
|
|
232
|
+
* kết quả tìm (`#searchSeen`).
|
|
233
|
+
*
|
|
234
|
+
* 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
|
|
235
|
+
* 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
|
|
236
|
+
* 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.
|
|
237
|
+
*/
|
|
238
|
+
#selectableNodes = computed(() => {
|
|
239
|
+
const loaded = this.#flattenAll(this.#loadedNodes());
|
|
240
|
+
const search = this.#search();
|
|
241
|
+
this.#searchSeenTick();
|
|
242
|
+
if (!search && !this.#searchSeen.size)
|
|
243
|
+
return loaded;
|
|
244
|
+
const result = [...loaded];
|
|
245
|
+
const ids = new Set(loaded.map(node => node.id));
|
|
246
|
+
const add = (id, data) => {
|
|
247
|
+
if (ids.has(id))
|
|
248
|
+
return;
|
|
249
|
+
ids.add(id);
|
|
250
|
+
result.push({ id, data });
|
|
251
|
+
};
|
|
252
|
+
if (search)
|
|
253
|
+
for (const node of this.#flattenAll(this.rootNodes()))
|
|
254
|
+
add(node.id, node.data);
|
|
255
|
+
for (const [id, data] of this.#searchSeen)
|
|
256
|
+
add(id, data);
|
|
257
|
+
return result;
|
|
258
|
+
}, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "#selectableNodes" }] : /* istanbul ignore next */ []));
|
|
139
260
|
visibleNodes = computed(() => {
|
|
140
|
-
|
|
261
|
+
// 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.
|
|
262
|
+
const filterText = this.#serverSearch() ? '' : this.normalizedFilterText();
|
|
141
263
|
const result = [];
|
|
142
264
|
const walk = (nodes) => {
|
|
143
265
|
for (const node of nodes) {
|
|
@@ -155,6 +277,14 @@ class SdTree {
|
|
|
155
277
|
return result;
|
|
156
278
|
}, /* @ts-ignore */
|
|
157
279
|
...(ngDevMode ? [{ debugName: "visibleNodes" }] : /* istanbul ignore next */ []));
|
|
280
|
+
/** 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. */
|
|
281
|
+
emptyState = computed(() => {
|
|
282
|
+
if (this.visibleNodes().length)
|
|
283
|
+
return null;
|
|
284
|
+
const text = this.#serverSearch() ? (this.#search()?.text ?? '') : this.#filterText();
|
|
285
|
+
return { searching: !!text.trim(), text: text.trim() };
|
|
286
|
+
}, /* @ts-ignore */
|
|
287
|
+
...(ngDevMode ? [{ debugName: "emptyState" }] : /* istanbul ignore next */ []));
|
|
158
288
|
selectedItems = computed(() => this.#selectedItemsFromIds(this.selectedIdSet()), /* @ts-ignore */
|
|
159
289
|
...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
|
|
160
290
|
/** Use visible siblings so filtering and collapsed/lazy branches leave no dangling connectors. */
|
|
@@ -201,6 +331,7 @@ class SdTree {
|
|
|
201
331
|
});
|
|
202
332
|
}, /* @ts-ignore */
|
|
203
333
|
...(ngDevMode ? [{ debugName: "visibleSelectionActions" }] : /* istanbul ignore next */ []));
|
|
334
|
+
/** @deprecated Dùng `visibleSelectionActions()`; thanh chọn dùng chung tự dựng autoId. Sẽ bỏ ở một bản breaking. */
|
|
204
335
|
selectionActionViews = computed(() => {
|
|
205
336
|
return this.visibleSelectionActions().map((action, index) => ({
|
|
206
337
|
action,
|
|
@@ -208,17 +339,33 @@ class SdTree {
|
|
|
208
339
|
}));
|
|
209
340
|
}, /* @ts-ignore */
|
|
210
341
|
...(ngDevMode ? [{ debugName: "selectionActionViews" }] : /* istanbul ignore next */ []));
|
|
342
|
+
/** `selector.actions` (đã bỏ lệnh ẩn) theo shape của thanh chọn dùng chung; index khớp `visibleSelectionActions`. */
|
|
343
|
+
selectionBarActions = computed(() => this.visibleSelectionActions().map(action => ({
|
|
344
|
+
variant: 'normal',
|
|
345
|
+
icon: action.icon,
|
|
346
|
+
fontSet: action.fontSet,
|
|
347
|
+
tooltip: action.tooltip,
|
|
348
|
+
title: action.title,
|
|
349
|
+
color: action.color,
|
|
350
|
+
type: action.type,
|
|
351
|
+
click: () => this.onSelectionAction(action),
|
|
352
|
+
})), /* @ts-ignore */
|
|
353
|
+
...(ngDevMode ? [{ debugName: "selectionBarActions" }] : /* istanbul ignore next */ []));
|
|
354
|
+
/**
|
|
355
|
+
* @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
|
|
356
|
+
* breaking.
|
|
357
|
+
*/
|
|
211
358
|
clearSelectionAutoId = computed(() => {
|
|
212
359
|
const base = this.autoId();
|
|
213
360
|
return base ? `${base}-clear-selection` : null;
|
|
214
361
|
}, /* @ts-ignore */
|
|
215
362
|
...(ngDevMode ? [{ debugName: "clearSelectionAutoId" }] : /* istanbul ignore next */ []));
|
|
216
363
|
/**
|
|
217
|
-
* why: chọn node mà selector KHÔNG khai action nào thì thanh
|
|
218
|
-
*
|
|
219
|
-
*
|
|
364
|
+
* 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
|
|
365
|
+
* đú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" ở
|
|
366
|
+
* footer modal, không có action nào — không có thanh này.
|
|
220
367
|
*/
|
|
221
|
-
selectionQuickActionOpened = computed(() => this.selectedCount() > 0 && this.
|
|
368
|
+
selectionQuickActionOpened = computed(() => this.selectedCount() > 0 && this.visibleSelectionActions().length > 0, /* @ts-ignore */
|
|
222
369
|
...(ngDevMode ? [{ debugName: "selectionQuickActionOpened" }] : /* istanbul ignore next */ []));
|
|
223
370
|
/**
|
|
224
371
|
* Template-facing row model. Expensive/variable values are resolved once per
|
|
@@ -232,11 +379,28 @@ class SdTree {
|
|
|
232
379
|
const nodes = this.visibleNodes();
|
|
233
380
|
const requestedActiveId = this.activeNodeId();
|
|
234
381
|
const activeId = nodes.some(node => node.id === requestedActiveId) ? requestedActiveId : nodes[0]?.id;
|
|
382
|
+
const navigation = this.navigation();
|
|
383
|
+
const openId = navigation ? this.activeId() : null;
|
|
384
|
+
const selectionVisible = this.selectionVisible();
|
|
385
|
+
const numberFormat = new Intl.NumberFormat(this.#i18n.locale());
|
|
386
|
+
const matched = this.#search()?.matched;
|
|
235
387
|
// why: đếm 1 lượt bottom-up cho CẢ cây rồi tra theo id. Bản cũ gọi `#flattenAll(node.children)`
|
|
236
388
|
// 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
|
|
237
389
|
// recompute. Chỉ cascade 'descendants' mới cần số liệu này nên các chế độ khác bỏ qua hẳn.
|
|
238
390
|
const selectedDescendants = selector?.cascade === 'descendants' ? this.#countSelectedDescendants(this.rootNodes(), selectedIds) : EMPTY_DESCENDANT_COUNTS;
|
|
239
|
-
return nodes.map(node =>
|
|
391
|
+
return nodes.map(node => {
|
|
392
|
+
const view = this.#toViewNode(node, selectedIds, selectedItems, selector, commands, node.id === activeId, selectedDescendants);
|
|
393
|
+
const count = formatCount(node.treeItem.count, numberFormat);
|
|
394
|
+
view.active = navigation && node.id === openId;
|
|
395
|
+
// 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ở.
|
|
396
|
+
view.highlighted = navigation ? view.active : view.selected;
|
|
397
|
+
// Q3: `aria-selected` là nút đang mở; lựa chọn của checkbox đi qua `aria-checked`.
|
|
398
|
+
view.ariaSelected = navigation ? view.active : selectionVisible ? view.selected : null;
|
|
399
|
+
view.muted = !!matched && !matched.has(node.id);
|
|
400
|
+
view.count = count;
|
|
401
|
+
view.ariaLabel = count === null ? null : `${node.label}, ${count}`;
|
|
402
|
+
return view;
|
|
403
|
+
});
|
|
240
404
|
}, /* @ts-ignore */
|
|
241
405
|
...(ngDevMode ? [{ debugName: "visibleViewNodes" }] : /* istanbul ignore next */ []));
|
|
242
406
|
trackByNode = (_index, node) => node.id;
|
|
@@ -260,12 +424,81 @@ class SdTree {
|
|
|
260
424
|
this.#loadRootItems(source);
|
|
261
425
|
});
|
|
262
426
|
});
|
|
427
|
+
// R2: `activeId` đổi từ ngoài (URL, nút khác trên trang) thì tự mở tới nút đó.
|
|
428
|
+
effect(() => {
|
|
429
|
+
const id = this.activeId();
|
|
430
|
+
const navigation = this.navigation();
|
|
431
|
+
const loading = this.rootLoading();
|
|
432
|
+
// Đ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.
|
|
433
|
+
const searching = !!this.#search();
|
|
434
|
+
this.#rootItems();
|
|
435
|
+
untracked(() => {
|
|
436
|
+
if (id !== this.#revealedId)
|
|
437
|
+
this.#revealedId = null;
|
|
438
|
+
if (id === this.#userActiveId)
|
|
439
|
+
return;
|
|
440
|
+
if (!navigation || id === null || loading || searching || id === this.#revealedId)
|
|
441
|
+
return;
|
|
442
|
+
this.#userActiveId = null;
|
|
443
|
+
void this.reveal(id).then(revealed => {
|
|
444
|
+
if (revealed && this.activeId() === id)
|
|
445
|
+
this.#revealedId = id;
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
inject(DestroyRef).onDestroy(() => {
|
|
450
|
+
this.#cancelSearch();
|
|
451
|
+
this.#revealController?.abort();
|
|
452
|
+
});
|
|
453
|
+
// R7: lazy + `expandedIds` từ ngoài: nút được khai là đang mở thì phải có con để hiện.
|
|
454
|
+
effect(() => {
|
|
455
|
+
const expanded = this.#expandedIdSet();
|
|
456
|
+
if (!expanded || this.resolvedTree().loadType !== 'lazy' || this.#search())
|
|
457
|
+
return;
|
|
458
|
+
const loaded = this.#lazyChildren();
|
|
459
|
+
const pending = this.#flattenAll(this.rootNodes()).filter(node => expanded.has(node.id) && !loaded[node.id] && node.treeItem.hasChildren !== false);
|
|
460
|
+
untracked(() => {
|
|
461
|
+
for (const node of pending) {
|
|
462
|
+
if (!node.loadError)
|
|
463
|
+
void this.#ensureLazyChildren(node);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
effect(() => {
|
|
468
|
+
const opened = this.buttons().some(button => button.popover.opened());
|
|
469
|
+
untracked(() => {
|
|
470
|
+
const row = this.#keyboardMenuRow;
|
|
471
|
+
if (opened || !row)
|
|
472
|
+
return;
|
|
473
|
+
this.#keyboardMenuRow = null;
|
|
474
|
+
// 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.
|
|
475
|
+
if (row.isConnected && row.contains(document.activeElement))
|
|
476
|
+
row.focus();
|
|
477
|
+
});
|
|
478
|
+
});
|
|
263
479
|
}
|
|
264
480
|
reload() {
|
|
265
481
|
this.#reloadTick.update(value => value + 1);
|
|
266
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* 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;
|
|
485
|
+
* 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.
|
|
486
|
+
*/
|
|
267
487
|
filter(searchText) {
|
|
268
|
-
|
|
488
|
+
const text = searchText ?? '';
|
|
489
|
+
this.#filterText.set(text);
|
|
490
|
+
const tree = this.resolvedTree();
|
|
491
|
+
const onSearch = tree.loadType === 'lazy' ? tree.onSearch : undefined;
|
|
492
|
+
this.#cancelSearch();
|
|
493
|
+
// 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.
|
|
494
|
+
if (!onSearch || !text.trim()) {
|
|
495
|
+
this.#search.set(null);
|
|
496
|
+
this.#searchCollapsed.set(new Set());
|
|
497
|
+
this.#pruneSearchSeen();
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
this.searchPending.set(true);
|
|
501
|
+
this.#searchTimer = setTimeout(() => void this.#runSearch(text, onSearch), SEARCH_DEBOUNCE_MS);
|
|
269
502
|
}
|
|
270
503
|
isSelected(node) {
|
|
271
504
|
return this.selectedIdSet().has(node.id);
|
|
@@ -295,21 +528,76 @@ class SdTree {
|
|
|
295
528
|
const currentNode = this.#findNode(node.id) ?? node;
|
|
296
529
|
if (!currentNode.hasChildren || currentNode.isLoading)
|
|
297
530
|
return;
|
|
298
|
-
if (currentNode.isExpanded)
|
|
299
|
-
this.#
|
|
300
|
-
|
|
301
|
-
this
|
|
302
|
-
|
|
303
|
-
|
|
531
|
+
if (currentNode.isExpanded)
|
|
532
|
+
this.#collapseNode(currentNode);
|
|
533
|
+
else
|
|
534
|
+
await this.#expandNode(currentNode);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* 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.
|
|
538
|
+
* Static tìm trong `items`; lazy dùng `tree.onResolvePath` khi nút chưa được tải.
|
|
539
|
+
* 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.
|
|
540
|
+
*/
|
|
541
|
+
async reveal(id) {
|
|
542
|
+
this.#revealController?.abort();
|
|
543
|
+
const controller = new AbortController();
|
|
544
|
+
this.#revealController = controller;
|
|
545
|
+
const { signal } = controller;
|
|
546
|
+
let path = this.#ancestorIds(id);
|
|
547
|
+
if (!path) {
|
|
548
|
+
const tree = this.resolvedTree();
|
|
549
|
+
if (tree.loadType !== 'lazy' || !tree.onResolvePath)
|
|
550
|
+
return false;
|
|
551
|
+
try {
|
|
552
|
+
path = [...(await tree.onResolvePath(id, signal))];
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
if (!signal.aborted)
|
|
556
|
+
this.loadError.emit({ error });
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
for (const ancestorId of path) {
|
|
561
|
+
if (signal.aborted)
|
|
562
|
+
return false;
|
|
563
|
+
const ancestor = this.#findNode(ancestorId);
|
|
564
|
+
if (!ancestor || !(await this.#expandNode(ancestor, signal)))
|
|
565
|
+
return false;
|
|
304
566
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
567
|
+
if (signal.aborted || !this.#findNode(id))
|
|
568
|
+
return false;
|
|
569
|
+
this.activeNodeId.set(id);
|
|
570
|
+
this.#pendingScrollId = id;
|
|
571
|
+
this.#scrollWhenRendered(id);
|
|
572
|
+
return true;
|
|
573
|
+
}
|
|
574
|
+
/** 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. */
|
|
575
|
+
async expand(id) {
|
|
576
|
+
const node = this.#findNode(id);
|
|
577
|
+
return node ? this.#expandNode(node) : false;
|
|
578
|
+
}
|
|
579
|
+
/** Đóng một nút theo id. */
|
|
580
|
+
collapse(id) {
|
|
581
|
+
const node = this.#findNode(id);
|
|
582
|
+
if (node?.isExpanded)
|
|
583
|
+
this.#collapseNode(node);
|
|
584
|
+
}
|
|
585
|
+
/** 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ì. */
|
|
586
|
+
async reloadNode(id) {
|
|
587
|
+
if (this.resolvedTree().loadType !== 'lazy')
|
|
308
588
|
return;
|
|
309
|
-
this.#
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
589
|
+
const node = this.#findNode(id);
|
|
590
|
+
if (node)
|
|
591
|
+
await this.#ensureLazyChildren(node, true);
|
|
592
|
+
}
|
|
593
|
+
/** Đặ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ị. */
|
|
594
|
+
focusNode(id) {
|
|
595
|
+
const row = this.#rowElement(id);
|
|
596
|
+
if (!row)
|
|
597
|
+
return false;
|
|
598
|
+
this.activeNodeId.set(id);
|
|
599
|
+
row.focus();
|
|
600
|
+
return true;
|
|
313
601
|
}
|
|
314
602
|
toggleSelection(node, event) {
|
|
315
603
|
event?.stopPropagation();
|
|
@@ -325,7 +613,9 @@ class SdTree {
|
|
|
325
613
|
}
|
|
326
614
|
else if (selector?.cascade === 'descendants') {
|
|
327
615
|
this.#setNodeAndDescendants(node, shouldSelect, selectedIds);
|
|
328
|
-
|
|
616
|
+
// 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 đó.
|
|
617
|
+
if (!this.#search())
|
|
618
|
+
this.#reconcileAncestors(node.parent, selectedIds);
|
|
329
619
|
}
|
|
330
620
|
else if (shouldSelect) {
|
|
331
621
|
selectedIds.add(node.id);
|
|
@@ -361,6 +651,10 @@ class SdTree {
|
|
|
361
651
|
});
|
|
362
652
|
void this.toggle(node);
|
|
363
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* @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
|
|
656
|
+
* người dùng cuối); UI dùng `core.component.tree.load-error`. Đọc lỗi gốc qua `rootError()` hoặc `loadError`.
|
|
657
|
+
*/
|
|
364
658
|
errorMessage(error) {
|
|
365
659
|
if (error instanceof Error)
|
|
366
660
|
return error.message;
|
|
@@ -371,6 +665,15 @@ class SdTree {
|
|
|
371
665
|
onRowFocus(node) {
|
|
372
666
|
this.activeNodeId.set(node.id);
|
|
373
667
|
}
|
|
668
|
+
/** Chế độ điều hướng: bấm vào hàng (trừ chevron, checkbox/radio, ⋯) mở nút. */
|
|
669
|
+
onRowClick(node, event) {
|
|
670
|
+
if (!this.navigation())
|
|
671
|
+
return;
|
|
672
|
+
const target = event.target;
|
|
673
|
+
if (target?.closest?.('.sd-tree__toggle, .sd-tree__checkbox, .sd-tree__radio, .sd-tree__command-trigger'))
|
|
674
|
+
return;
|
|
675
|
+
this.#activate(node);
|
|
676
|
+
}
|
|
374
677
|
onRowKeydown(node, event) {
|
|
375
678
|
if (event.target !== event.currentTarget)
|
|
376
679
|
return;
|
|
@@ -404,23 +707,61 @@ class SdTree {
|
|
|
404
707
|
else if (nodes[index + 1]?.parent?.id === node.id)
|
|
405
708
|
this.#focusVisibleNode(index + 1);
|
|
406
709
|
return;
|
|
407
|
-
case 'ArrowLeft':
|
|
408
|
-
|
|
710
|
+
case 'ArrowLeft': {
|
|
711
|
+
// why: lá cũng có `isExpanded` (vd. `defaultExpanded: true` áp cho mọi mức), nên phải xét `hasChildren`;
|
|
712
|
+
// 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.
|
|
713
|
+
const open = node.hasChildren && node.isExpanded;
|
|
714
|
+
if (!open && !node.parent)
|
|
409
715
|
return;
|
|
410
716
|
event.preventDefault();
|
|
411
|
-
if (
|
|
717
|
+
if (open)
|
|
412
718
|
void this.toggle(node);
|
|
413
719
|
else
|
|
414
720
|
this.#focusVisibleNode(nodes.findIndex(item => item.id === node.parent?.id));
|
|
415
721
|
return;
|
|
722
|
+
}
|
|
723
|
+
case 'F10':
|
|
724
|
+
case 'ContextMenu':
|
|
725
|
+
// R4: Shift+F10 hoặc phím ContextMenu mở menu ⋯ của hàng đang focus.
|
|
726
|
+
if (!this.navigation() || (event.key === 'F10' && !event.shiftKey))
|
|
727
|
+
return;
|
|
728
|
+
if (this.#openRowMenu(event.currentTarget))
|
|
729
|
+
event.preventDefault();
|
|
730
|
+
return;
|
|
416
731
|
case 'Enter':
|
|
417
732
|
case ' ':
|
|
733
|
+
if (this.navigation() && event.key === 'Enter') {
|
|
734
|
+
event.preventDefault();
|
|
735
|
+
this.#activate(node);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
418
738
|
if (!this.selectionVisible())
|
|
419
739
|
return;
|
|
420
740
|
event.preventDefault();
|
|
421
741
|
this.toggleSelection(node);
|
|
422
742
|
}
|
|
423
743
|
}
|
|
744
|
+
#activate(node) {
|
|
745
|
+
const current = this.#findNode(node.id) ?? node;
|
|
746
|
+
// 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.
|
|
747
|
+
this.#revealController?.abort();
|
|
748
|
+
this.#pendingScrollId = null;
|
|
749
|
+
this.#userActiveId = current.id;
|
|
750
|
+
this.activeNodeId.set(current.id);
|
|
751
|
+
this.activeId.set(current.id);
|
|
752
|
+
const event = { item: current.data, node: current };
|
|
753
|
+
this.option()?.onActivate?.(event);
|
|
754
|
+
this.activeChange.emit(event);
|
|
755
|
+
}
|
|
756
|
+
#openRowMenu(row) {
|
|
757
|
+
const trigger = row.querySelector('.sd-tree__command-trigger button');
|
|
758
|
+
if (!trigger || trigger.disabled)
|
|
759
|
+
return false;
|
|
760
|
+
this.#keyboardMenuRow = row;
|
|
761
|
+
if (trigger.getAttribute('aria-expanded') !== 'true')
|
|
762
|
+
trigger.click();
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
424
765
|
createContext(node) {
|
|
425
766
|
return this.#createContext(node, this.isSelected(node));
|
|
426
767
|
}
|
|
@@ -493,8 +834,11 @@ class SdTree {
|
|
|
493
834
|
return source;
|
|
494
835
|
}
|
|
495
836
|
#setRootItems(items) {
|
|
837
|
+
// 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ữ.
|
|
838
|
+
this.#pruneSearchSeen();
|
|
496
839
|
this.#treeGeneration += 1;
|
|
497
840
|
this.#lazyLoadIds.clear();
|
|
841
|
+
this.#lazyLoads.clear();
|
|
498
842
|
this.#rootItems.set([...(items ?? [])]);
|
|
499
843
|
this.#lazyChildren.set({});
|
|
500
844
|
this.#loadingState.set({});
|
|
@@ -507,6 +851,13 @@ class SdTree {
|
|
|
507
851
|
...node,
|
|
508
852
|
icon: this.#iconOf(node),
|
|
509
853
|
selected,
|
|
854
|
+
active: false,
|
|
855
|
+
highlighted: selected,
|
|
856
|
+
ariaSelected: null,
|
|
857
|
+
ariaLabel: null,
|
|
858
|
+
count: null,
|
|
859
|
+
menuLabel: this.#i18n.t('core.component.tree.open-menu', { label: node.label }),
|
|
860
|
+
muted: false,
|
|
510
861
|
selectionDisabled,
|
|
511
862
|
selectionIndeterminate: this.#isSelectionIndeterminate(node, selectedIds, selector, selectedDescendants),
|
|
512
863
|
toggleDisabled: !node.hasChildren || node.isLoading,
|
|
@@ -597,6 +948,9 @@ class SdTree {
|
|
|
597
948
|
// `visibleNodes` + `visibleViewNodes` map lại từ đầu. Consumer nào đọc các field này bên
|
|
598
949
|
// trong computed/template vẫn nhận đúng dependency signal, nên phản ứng không đổi.
|
|
599
950
|
get isExpanded() {
|
|
951
|
+
const controlled = tree.#expandedIdSet();
|
|
952
|
+
if (controlled)
|
|
953
|
+
return controlled.has(item.id);
|
|
600
954
|
return tree.#expandedState()[item.id] ?? item.expanded ?? tree.#defaultExpanded(level);
|
|
601
955
|
},
|
|
602
956
|
get isLoading() {
|
|
@@ -610,6 +964,79 @@ class SdTree {
|
|
|
610
964
|
return node;
|
|
611
965
|
});
|
|
612
966
|
}
|
|
967
|
+
#cancelSearch() {
|
|
968
|
+
clearTimeout(this.#searchTimer);
|
|
969
|
+
this.#searchTimer = undefined;
|
|
970
|
+
this.#searchController?.abort();
|
|
971
|
+
this.#searchController = null;
|
|
972
|
+
this.searchPending.set(false);
|
|
973
|
+
}
|
|
974
|
+
async #runSearch(text, onSearch) {
|
|
975
|
+
const controller = new AbortController();
|
|
976
|
+
this.#searchController = controller;
|
|
977
|
+
try {
|
|
978
|
+
const results = await onSearch(text, controller.signal);
|
|
979
|
+
if (controller.signal.aborted)
|
|
980
|
+
return;
|
|
981
|
+
this.#searchCollapsed.set(new Set());
|
|
982
|
+
this.#pruneSearchSeen();
|
|
983
|
+
for (const { path } of results)
|
|
984
|
+
for (const item of path)
|
|
985
|
+
this.#searchSeen.set(item.id, item.data);
|
|
986
|
+
this.#searchSeenTick.update(value => value + 1);
|
|
987
|
+
this.#search.set(mergeSearchPaths(text, results));
|
|
988
|
+
}
|
|
989
|
+
catch (error) {
|
|
990
|
+
if (!controller.signal.aborted)
|
|
991
|
+
this.loadError.emit({ error });
|
|
992
|
+
}
|
|
993
|
+
finally {
|
|
994
|
+
if (this.#searchController === controller)
|
|
995
|
+
this.searchPending.set(false);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* 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
|
|
1000
|
+
* 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.
|
|
1001
|
+
*/
|
|
1002
|
+
#pruneSearchSeen() {
|
|
1003
|
+
if (!this.#searchSeen.size)
|
|
1004
|
+
return;
|
|
1005
|
+
const selected = untracked(() => this.selectedIdSet());
|
|
1006
|
+
let removed = false;
|
|
1007
|
+
for (const id of [...this.#searchSeen.keys()]) {
|
|
1008
|
+
if (selected.has(id))
|
|
1009
|
+
continue;
|
|
1010
|
+
this.#searchSeen.delete(id);
|
|
1011
|
+
removed = true;
|
|
1012
|
+
}
|
|
1013
|
+
if (removed)
|
|
1014
|
+
this.#searchSeenTick.update(value => value + 1);
|
|
1015
|
+
}
|
|
1016
|
+
/** 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. */
|
|
1017
|
+
#buildSearchNodes(search, items, level, parent) {
|
|
1018
|
+
const tree = this;
|
|
1019
|
+
return items.map(item => {
|
|
1020
|
+
const children = search.children.get(item.id) ?? [];
|
|
1021
|
+
const node = {
|
|
1022
|
+
treeItem: item,
|
|
1023
|
+
data: item.data,
|
|
1024
|
+
id: item.id,
|
|
1025
|
+
label: item.label,
|
|
1026
|
+
level,
|
|
1027
|
+
parent,
|
|
1028
|
+
children: [],
|
|
1029
|
+
hasChildren: children.length > 0,
|
|
1030
|
+
get isExpanded() {
|
|
1031
|
+
return !tree.#searchCollapsed().has(item.id);
|
|
1032
|
+
},
|
|
1033
|
+
isLoading: false,
|
|
1034
|
+
loadError: undefined,
|
|
1035
|
+
};
|
|
1036
|
+
node.children = this.#buildSearchNodes(search, children, level + 1, node);
|
|
1037
|
+
return node;
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
613
1040
|
#childrenOf(item) {
|
|
614
1041
|
const option = this.resolvedTree();
|
|
615
1042
|
// Static items own their `children`; lazy items keep loaded children in component state.
|
|
@@ -645,9 +1072,120 @@ class SdTree {
|
|
|
645
1072
|
return undefined;
|
|
646
1073
|
return node.isExpanded ? 'folder_open' : 'folder';
|
|
647
1074
|
}
|
|
648
|
-
async #
|
|
1075
|
+
async #expandNode(node, signal) {
|
|
1076
|
+
if (!node.hasChildren)
|
|
1077
|
+
return false;
|
|
1078
|
+
const generation = this.#treeGeneration;
|
|
1079
|
+
await this.#ensureLazyChildren(node);
|
|
1080
|
+
// `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
|
|
1081
|
+
// (`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.
|
|
1082
|
+
if (signal?.aborted || generation !== this.#treeGeneration)
|
|
1083
|
+
return false;
|
|
1084
|
+
const next = this.#findNode(node.id);
|
|
1085
|
+
if (!next || !next.hasChildren || next.loadError)
|
|
1086
|
+
return false;
|
|
1087
|
+
if (next.isExpanded)
|
|
1088
|
+
return true;
|
|
1089
|
+
this.#setExpanded(next.id, true);
|
|
1090
|
+
const toggleEvent = { item: next.data, expanded: true, node: { ...next, isExpanded: true } };
|
|
1091
|
+
this.option()?.onExpand?.(toggleEvent);
|
|
1092
|
+
this.expandChange.emit(toggleEvent);
|
|
1093
|
+
return true;
|
|
1094
|
+
}
|
|
1095
|
+
#collapseNode(node) {
|
|
1096
|
+
this.#setExpanded(node.id, false);
|
|
1097
|
+
const toggleEvent = { item: node.data, expanded: false, node: { ...node, isExpanded: false } };
|
|
1098
|
+
this.option()?.onCollapse?.(toggleEvent);
|
|
1099
|
+
this.collapseChange.emit(toggleEvent);
|
|
1100
|
+
}
|
|
1101
|
+
#setExpanded(id, expanded) {
|
|
1102
|
+
if (this.#search()) {
|
|
1103
|
+
this.#searchCollapsed.update(collapsed => {
|
|
1104
|
+
const next = new Set(collapsed);
|
|
1105
|
+
if (expanded)
|
|
1106
|
+
next.delete(id);
|
|
1107
|
+
else
|
|
1108
|
+
next.add(id);
|
|
1109
|
+
return next;
|
|
1110
|
+
});
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
const controlled = this.expandedIds();
|
|
1114
|
+
if (controlled === undefined) {
|
|
1115
|
+
this.#expandedState.update(state => ({ ...state, [id]: expanded }));
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
const rest = controlled.filter(value => value !== id);
|
|
1119
|
+
this.expandedIds.set(expanded ? [...rest, id] : rest);
|
|
1120
|
+
}
|
|
1121
|
+
/** 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ó. */
|
|
1122
|
+
#ancestorIds(id) {
|
|
1123
|
+
const node = this.#findNode(id);
|
|
1124
|
+
if (!node)
|
|
1125
|
+
return undefined;
|
|
1126
|
+
const path = [];
|
|
1127
|
+
for (let current = node.parent; current; current = current.parent)
|
|
1128
|
+
path.unshift(current.id);
|
|
1129
|
+
return path;
|
|
1130
|
+
}
|
|
1131
|
+
#rowElement(id) {
|
|
1132
|
+
const rows = this.#host.nativeElement.querySelectorAll('[role="treeitem"]');
|
|
1133
|
+
return Array.from(rows).find(row => row.getAttribute('data-tree-node') === id);
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* 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
|
|
1137
|
+
* vài lần render rồi thôi.
|
|
1138
|
+
*/
|
|
1139
|
+
#scrollWhenRendered(id, attempt = 0) {
|
|
1140
|
+
afterNextRender(() => {
|
|
1141
|
+
if (this.#pendingScrollId !== id)
|
|
1142
|
+
return;
|
|
1143
|
+
const row = this.#rowElement(id);
|
|
1144
|
+
if (row) {
|
|
1145
|
+
this.#pendingScrollId = null;
|
|
1146
|
+
this.#scrollToRow(row);
|
|
1147
|
+
}
|
|
1148
|
+
else if (attempt < 5 && this.visibleNodes().some(node => node.id === id)) {
|
|
1149
|
+
this.#scrollWhenRendered(id, attempt + 1);
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
this.#pendingScrollId = null;
|
|
1153
|
+
}
|
|
1154
|
+
}, { injector: this.#injector });
|
|
1155
|
+
}
|
|
1156
|
+
/** Cuộn bằng `scrollTop` của vùng cuộn gần nhất: `scrollIntoView` sẽ cuộn luôn cả trang. */
|
|
1157
|
+
#scrollToRow(row) {
|
|
1158
|
+
const scroller = scrollParent(this.#host.nativeElement);
|
|
1159
|
+
if (!scroller)
|
|
1160
|
+
return;
|
|
1161
|
+
const box = scroller.getBoundingClientRect();
|
|
1162
|
+
const rect = row.getBoundingClientRect();
|
|
1163
|
+
// 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.
|
|
1164
|
+
const bar = this.#host.nativeElement.querySelector(':scope > .sd-tree__selection-bar');
|
|
1165
|
+
const bottom = box.bottom - (bar?.offsetHeight ?? 0);
|
|
1166
|
+
if (rect.top < box.top)
|
|
1167
|
+
scroller.scrollTop -= box.top - rect.top;
|
|
1168
|
+
else if (rect.bottom > bottom)
|
|
1169
|
+
scroller.scrollTop += rect.bottom - bottom;
|
|
1170
|
+
}
|
|
1171
|
+
#ensureLazyChildren(node, force = false) {
|
|
1172
|
+
if (this.resolvedTree().loadType !== 'lazy')
|
|
1173
|
+
return Promise.resolve();
|
|
1174
|
+
if (!force && (node.children.length > 0 || this.#lazyChildren()[node.id]))
|
|
1175
|
+
return Promise.resolve();
|
|
1176
|
+
const running = this.#lazyLoads.get(node.id);
|
|
1177
|
+
if (running && !force)
|
|
1178
|
+
return running;
|
|
1179
|
+
const load = this.#loadLazyChildren(node).finally(() => {
|
|
1180
|
+
if (this.#lazyLoads.get(node.id) === load)
|
|
1181
|
+
this.#lazyLoads.delete(node.id);
|
|
1182
|
+
});
|
|
1183
|
+
this.#lazyLoads.set(node.id, load);
|
|
1184
|
+
return load;
|
|
1185
|
+
}
|
|
1186
|
+
async #loadLazyChildren(node) {
|
|
649
1187
|
const option = this.resolvedTree();
|
|
650
|
-
if (option.loadType !== 'lazy'
|
|
1188
|
+
if (option.loadType !== 'lazy')
|
|
651
1189
|
return;
|
|
652
1190
|
const generation = this.#treeGeneration;
|
|
653
1191
|
const loadId = (this.#lazyLoadIds.get(node.id) ?? 0) + 1;
|
|
@@ -747,7 +1285,7 @@ class SdTree {
|
|
|
747
1285
|
return result;
|
|
748
1286
|
}
|
|
749
1287
|
#selectedItemsFromIds(selectedIds) {
|
|
750
|
-
return this.#
|
|
1288
|
+
return this.#selectableNodes()
|
|
751
1289
|
.filter(node => selectedIds.has(node.id))
|
|
752
1290
|
.map(node => node.data);
|
|
753
1291
|
}
|
|
@@ -755,7 +1293,7 @@ class SdTree {
|
|
|
755
1293
|
const selectedRefs = new Set(selectedItems);
|
|
756
1294
|
const selectedDataIds = new Set(selectedItems.map(item => this.#dataId(item)).filter((id) => !!id));
|
|
757
1295
|
const result = new Set();
|
|
758
|
-
for (const node of this.#
|
|
1296
|
+
for (const node of this.#selectableNodes()) {
|
|
759
1297
|
const dataId = this.#dataId(node.data);
|
|
760
1298
|
if (selectedRefs.has(node.data) || (dataId && selectedDataIds.has(dataId))) {
|
|
761
1299
|
result.add(node.id);
|
|
@@ -780,7 +1318,7 @@ class SdTree {
|
|
|
780
1318
|
return typeof resolver === 'function' ? resolver(item) : !!resolver;
|
|
781
1319
|
}
|
|
782
1320
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
783
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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 });
|
|
1321
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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 });
|
|
784
1322
|
}
|
|
785
1323
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTree, decorators: [{
|
|
786
1324
|
type: Component,
|
|
@@ -792,12 +1330,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
792
1330
|
MatRadioModule,
|
|
793
1331
|
SdButton,
|
|
794
1332
|
SdButtonItem,
|
|
795
|
-
|
|
1333
|
+
SdHighlight,
|
|
1334
|
+
_SdSelectionBar,
|
|
796
1335
|
SdTranslatePipe,
|
|
797
1336
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
798
1337
|
'[attr.data-autoid]': 'autoId()',
|
|
799
|
-
}, 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"] }]
|
|
800
|
-
}], 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 }] }] } });
|
|
1338
|
+
}, 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"] }]
|
|
1339
|
+
}], 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 }] }] } });
|
|
801
1340
|
function normalizeText(value) {
|
|
802
1341
|
return value
|
|
803
1342
|
.normalize('NFD')
|
|
@@ -806,6 +1345,44 @@ function normalizeText(value) {
|
|
|
806
1345
|
.toLowerCase()
|
|
807
1346
|
.trim();
|
|
808
1347
|
}
|
|
1348
|
+
function formatCount(value, format) {
|
|
1349
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0)
|
|
1350
|
+
return null;
|
|
1351
|
+
return format.format(Math.floor(value));
|
|
1352
|
+
}
|
|
1353
|
+
function mergeSearchPaths(text, results) {
|
|
1354
|
+
const search = { text, roots: [], children: new Map(), matched: new Set() };
|
|
1355
|
+
const seen = new Set();
|
|
1356
|
+
for (const { path } of results) {
|
|
1357
|
+
path.forEach((item, index) => {
|
|
1358
|
+
if (index === path.length - 1)
|
|
1359
|
+
search.matched.add(item.id);
|
|
1360
|
+
if (seen.has(item.id))
|
|
1361
|
+
return;
|
|
1362
|
+
seen.add(item.id);
|
|
1363
|
+
if (index === 0) {
|
|
1364
|
+
search.roots.push(item);
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
const parentId = path[index - 1].id;
|
|
1368
|
+
const siblings = search.children.get(parentId);
|
|
1369
|
+
if (siblings)
|
|
1370
|
+
siblings.push(item);
|
|
1371
|
+
else
|
|
1372
|
+
search.children.set(parentId, [item]);
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
return search;
|
|
1376
|
+
}
|
|
1377
|
+
/** 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`). */
|
|
1378
|
+
function scrollParent(element) {
|
|
1379
|
+
for (let current = element; current; current = current.parentElement) {
|
|
1380
|
+
const overflow = getComputedStyle(current).overflowY;
|
|
1381
|
+
if (overflow === 'auto' || overflow === 'scroll')
|
|
1382
|
+
return current;
|
|
1383
|
+
}
|
|
1384
|
+
return null;
|
|
1385
|
+
}
|
|
809
1386
|
function sanitizeId(value) {
|
|
810
1387
|
return value.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
811
1388
|
}
|
|
@@ -817,5 +1394,5 @@ function isPromiseLike(value) {
|
|
|
817
1394
|
* Generated bundle index. Do not edit.
|
|
818
1395
|
*/
|
|
819
1396
|
|
|
820
|
-
export { SdTree, SdTreeItemDefDirective };
|
|
1397
|
+
export { SdTree, SdTreeEmptyDefDirective, SdTreeItemDefDirective };
|
|
821
1398
|
//# sourceMappingURL=sdcorejs-angular-components-tree.mjs.map
|