@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,18 +1,22 @@
|
|
|
1
|
-
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
1
|
+
import { DOCUMENT, CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject,
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import * as i1 from '@angular/material/menu';
|
|
7
|
-
import { MatMenuModule, MatMenu, MatMenuTrigger } from '@angular/material/menu';
|
|
8
|
-
import * as i2 from '@angular/material/tooltip';
|
|
3
|
+
import { Injectable, inject, TemplateRef, ViewContainerRef, Injector, input, computed, output, signal, DestroyRef, afterNextRender, Directive, ElementRef, effect, ChangeDetectorRef, booleanAttribute, viewChild, ChangeDetectionStrategy, Component, model, isSignal, linkedSignal, viewChildren, untracked } from '@angular/core';
|
|
4
|
+
import { ɵSdSearchField as _SdSearchField, ɵSdSearchFieldInputDirective as _SdSearchFieldInputDirective } from '@sdcorejs/angular/forms/directives';
|
|
5
|
+
import * as i1 from '@angular/material/tooltip';
|
|
9
6
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
10
7
|
import { I18nService } from '@sdcorejs/angular/i18n';
|
|
11
8
|
import { SdDateTimeService } from '@sdcorejs/angular/services/date-time';
|
|
12
9
|
import { Utilities } from '@sdcorejs/utils/fns';
|
|
13
|
-
import { isObservable, firstValueFrom } from 'rxjs';
|
|
14
10
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
15
11
|
import { SdConfirmService } from '@sdcorejs/angular/services/confirm';
|
|
12
|
+
import { SdNotifyService } from '@sdcorejs/angular/services/notify';
|
|
13
|
+
import { InteractivityChecker } from '@angular/cdk/a11y';
|
|
14
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
15
|
+
import { hasModifierKey } from '@angular/cdk/keycodes';
|
|
16
|
+
import { Overlay, OverlayContainer } from '@angular/cdk/overlay';
|
|
17
|
+
import { _getEventTarget } from '@angular/cdk/platform';
|
|
18
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
19
|
+
import { Subject, isObservable, firstValueFrom } from 'rxjs';
|
|
16
20
|
import { SdOperator } from '@sdcorejs/angular/components/operator';
|
|
17
21
|
import { SdDate } from '@sdcorejs/angular/forms/date';
|
|
18
22
|
import { SdDateRange } from '@sdcorejs/angular/forms/date-range';
|
|
@@ -21,51 +25,518 @@ import { SdInput } from '@sdcorejs/angular/forms/input';
|
|
|
21
25
|
import { SdInputNumber } from '@sdcorejs/angular/forms/input-number';
|
|
22
26
|
import { SdSelect } from '@sdcorejs/angular/forms/select';
|
|
23
27
|
import { SdInlineText } from '@sdcorejs/angular/forms/inline-text';
|
|
28
|
+
import { FormsModule } from '@angular/forms';
|
|
24
29
|
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
25
30
|
import { sdNormalizeSearchText } from '@sdcorejs/angular/utilities/extensions';
|
|
26
|
-
import { take } from 'rxjs/operators';
|
|
27
31
|
|
|
32
|
+
// why: thứ tự vị trí như Action Popover của sd-button (`components/button/src/action-popover.ts`) — dưới trước, thiếu
|
|
33
|
+
// chỗ thì lật lên, cách trigger 4px — nhưng mặc định canh trái (start); bộ lọc đã lưu canh phải như `xPosition="before"`.
|
|
34
|
+
const START_POSITIONS = [
|
|
35
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
36
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
37
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 4 },
|
|
38
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -4 },
|
|
39
|
+
];
|
|
40
|
+
const END_POSITIONS = [
|
|
41
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 4 },
|
|
42
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -4 },
|
|
43
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
44
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
45
|
+
];
|
|
46
|
+
let nextPanelId = 0;
|
|
47
|
+
const TABBABLE = 'a[href], button, input, select, textarea, [tabindex], [contenteditable="true"]';
|
|
48
|
+
// A layer stacked above the panel holding one of these is the popup of a control (sd-select panel, date picker,
|
|
49
|
+
// sd-operator menu): Escape belongs to it. A tooltip holds none of them.
|
|
50
|
+
const INTERACTIVE = `${TABBABLE}, [role="listbox"], [role="menu"], [role="dialog"], [role="grid"], [role="tree"]`;
|
|
51
|
+
const FIRST_OPTION = '[role="option"]:not([aria-disabled="true"]), [role="menuitem"]:not(:disabled):not([aria-disabled="true"])';
|
|
28
52
|
/**
|
|
29
|
-
*
|
|
53
|
+
* One open panel per query bar: opening a panel closes the other one first (handoff section 2.2, "Nhiều panel").
|
|
54
|
+
* Provided by `SdQueryBar`; a panel without a group only closes itself.
|
|
55
|
+
*/
|
|
56
|
+
class ɵSdQueryPanelGroup {
|
|
57
|
+
#open;
|
|
58
|
+
activate(panel) {
|
|
59
|
+
if (this.#open && this.#open !== panel)
|
|
60
|
+
this.#open.close('switch');
|
|
61
|
+
this.#open = panel;
|
|
62
|
+
}
|
|
63
|
+
release(panel) {
|
|
64
|
+
if (this.#open === panel)
|
|
65
|
+
this.#open = undefined;
|
|
66
|
+
}
|
|
67
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelGroup, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
68
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelGroup });
|
|
69
|
+
}
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelGroup, decorators: [{
|
|
71
|
+
type: Injectable
|
|
72
|
+
}] });
|
|
73
|
+
/**
|
|
74
|
+
* Content of a query bar panel, rendered in a CDK overlay next to its trigger: field picker (`listbox`), chip popover
|
|
75
|
+
* (`dialog`) and saved filters (`menu`). Replaces the Material menu the bar used before (handoff section 2.2).
|
|
30
76
|
*
|
|
31
|
-
*
|
|
32
|
-
* `
|
|
33
|
-
*
|
|
34
|
-
*
|
|
77
|
+
* The template has one root element carrying `sd-query-panel`, its modifier and its role; the panel gives it the `id`
|
|
78
|
+
* the trigger's `aria-controls` points to (unless `sdQueryPanelControls` names the element inside that has the role)
|
|
79
|
+
* and `tabindex="-1"`. A form panel marks the wrapper of its first value control
|
|
80
|
+
* with `data-sd-query-panel-initial`.
|
|
35
81
|
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
82
|
+
* Internal (`ɵ`): not part of SemVer.
|
|
83
|
+
*/
|
|
84
|
+
class ɵSdQueryPanelDirective {
|
|
85
|
+
id = `sd-query-panel-${nextPanelId++}`;
|
|
86
|
+
#template = inject(TemplateRef);
|
|
87
|
+
#views = inject(ViewContainerRef);
|
|
88
|
+
#overlay = inject(Overlay);
|
|
89
|
+
#container = inject(OverlayContainer);
|
|
90
|
+
#checker = inject(InteractivityChecker);
|
|
91
|
+
#injector = inject(Injector);
|
|
92
|
+
#document = inject(DOCUMENT);
|
|
93
|
+
#dir = inject(Directionality, { optional: true });
|
|
94
|
+
#group = inject(ɵSdQueryPanelGroup, { optional: true });
|
|
95
|
+
/** Popup type: `listbox` and `menu` are lists, `dialog` is a form. */
|
|
96
|
+
role = input.required({ ...(ngDevMode ? { debugName: "role" } : /* istanbul ignore next */ {}), alias: 'sdQueryPanel' });
|
|
97
|
+
/** Horizontal alignment with the trigger; flips when there is no room. */
|
|
98
|
+
align = input('start', { ...(ngDevMode ? { debugName: "align" } : /* istanbul ignore next */ {}), alias: 'sdQueryPanelAlign' });
|
|
99
|
+
/**
|
|
100
|
+
* Id of the element inside the panel that carries the popup role, when it is not the root (the field picker's listbox
|
|
101
|
+
* sits under its find box). The trigger's `aria-controls` points there.
|
|
102
|
+
*/
|
|
103
|
+
controls = input(undefined, { ...(ngDevMode ? { debugName: "controls" } : /* istanbul ignore next */ {}), alias: 'sdQueryPanelControls' });
|
|
104
|
+
/** Id the trigger's `aria-controls` names. */
|
|
105
|
+
controlledId = computed(() => this.controls() ?? this.id, /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "controlledId" }] : /* istanbul ignore next */ []));
|
|
107
|
+
/** The panel opened and took focus. */
|
|
108
|
+
opened = output();
|
|
109
|
+
/**
|
|
110
|
+
* The panel closed; `reason` says how. Not emitted for `detach`: the panel or its trigger is being destroyed, and
|
|
111
|
+
* outputs of a destroyed view must not fire (NG0953).
|
|
112
|
+
*/
|
|
113
|
+
closed = output();
|
|
114
|
+
#isOpen = signal(false, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "#isOpen" }] : /* istanbul ignore next */ []));
|
|
116
|
+
#origin = signal(undefined, /* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "#origin" }] : /* istanbul ignore next */ []));
|
|
118
|
+
/** Whether the panel is open. */
|
|
119
|
+
isOpen = this.#isOpen.asReadonly();
|
|
120
|
+
/** The trigger the panel is open for (kept until `closed` has been emitted). */
|
|
121
|
+
origin = this.#origin.asReadonly();
|
|
122
|
+
#kind = computed(() => (this.role() === 'dialog' ? 'form' : 'list'), /* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [{ debugName: "#kind" }] : /* istanbul ignore next */ []));
|
|
124
|
+
/** @internal Triggers listen here, so an opening made through `open()` still reaches the trigger it uses. */
|
|
125
|
+
ɵopening = new Subject();
|
|
126
|
+
/** @internal */
|
|
127
|
+
ɵclosing = new Subject();
|
|
128
|
+
#ref;
|
|
129
|
+
#root;
|
|
130
|
+
#returnFocusTo;
|
|
131
|
+
#teardown = [];
|
|
132
|
+
#destroyed = false;
|
|
133
|
+
constructor() {
|
|
134
|
+
inject(DestroyRef).onDestroy(() => {
|
|
135
|
+
// why: output của directive đã huỷ không được phát nữa (NG0953) — đóng im lặng.
|
|
136
|
+
this.#destroyed = true;
|
|
137
|
+
this.close('detach');
|
|
138
|
+
this.ɵopening.complete();
|
|
139
|
+
this.ɵclosing.complete();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** The panel's root element while open. */
|
|
143
|
+
element() {
|
|
144
|
+
return this.#root;
|
|
145
|
+
}
|
|
146
|
+
/** Opens the panel next to `origin`. Open for another trigger: closes for that one first (`switch`). */
|
|
147
|
+
open(origin, options = {}) {
|
|
148
|
+
if (this.#destroyed)
|
|
149
|
+
return;
|
|
150
|
+
if (this.#ref && this.#origin() === origin) {
|
|
151
|
+
this.#returnFocusTo = options.returnFocusTo ?? undefined;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.close('switch');
|
|
155
|
+
this.#group?.activate(this);
|
|
156
|
+
this.#returnFocusTo = options.returnFocusTo ?? undefined;
|
|
157
|
+
this.#origin.set(origin);
|
|
158
|
+
// why: phát trước khi gắn nội dung — chip popover seed field/giá trị ở đây, nên nội dung vẽ lần đầu và focus đầu
|
|
159
|
+
// tiên đã đúng field (không vẽ field cũ rồi đổi).
|
|
160
|
+
this.ɵopening.next(origin);
|
|
161
|
+
const ref = this.#overlay.create({
|
|
162
|
+
positionStrategy: this.#overlay
|
|
163
|
+
.position()
|
|
164
|
+
.flexibleConnectedTo(origin)
|
|
165
|
+
.withPositions(this.align() === 'end' ? END_POSITIONS : START_POSITIONS)
|
|
166
|
+
.withViewportMargin(8)
|
|
167
|
+
.withPush(true)
|
|
168
|
+
.withFlexibleDimensions(true),
|
|
169
|
+
scrollStrategy: this.#overlay.scrollStrategies.reposition(),
|
|
170
|
+
panelClass: 'sd-query-panel-pane',
|
|
171
|
+
maxWidth: 'calc(100vw - 16px)',
|
|
172
|
+
maxHeight: 'calc(100dvh - 16px)',
|
|
173
|
+
direction: this.#dir?.value,
|
|
174
|
+
});
|
|
175
|
+
this.#ref = ref;
|
|
176
|
+
this.#isOpen.set(true);
|
|
177
|
+
ref.attach(new TemplatePortal(this.#template, this.#views)).detectChanges();
|
|
178
|
+
ref.updatePosition();
|
|
179
|
+
this.#root = ref.overlayElement.querySelector('.sd-query-panel') ?? undefined;
|
|
180
|
+
if (this.#root) {
|
|
181
|
+
this.#root.id = this.id;
|
|
182
|
+
if (!this.#root.hasAttribute('tabindex'))
|
|
183
|
+
this.#root.tabIndex = -1;
|
|
184
|
+
}
|
|
185
|
+
this.#listen(ref, origin);
|
|
186
|
+
const keyboard = !!options.keyboard;
|
|
187
|
+
// why: nội dung chưa vẽ xong (binding của cha chưa chạy) thì thử lại sau lượt render kế tiếp.
|
|
188
|
+
if (options.focus !== false && !this.#focusInitial(keyboard)) {
|
|
189
|
+
afterNextRender(() => {
|
|
190
|
+
if (this.#ref === ref)
|
|
191
|
+
this.#focusInitial(keyboard, true);
|
|
192
|
+
}, { injector: this.#injector });
|
|
193
|
+
}
|
|
194
|
+
this.opened.emit();
|
|
195
|
+
}
|
|
196
|
+
/** Closes the panel. Focus returns to `returnFocusTo` or the trigger, except as described for each reason. */
|
|
197
|
+
close(reason = 'close') {
|
|
198
|
+
this.#close(reason);
|
|
199
|
+
}
|
|
200
|
+
#close(reason, focusMoved = false) {
|
|
201
|
+
const ref = this.#ref;
|
|
202
|
+
const origin = this.#origin();
|
|
203
|
+
if (!ref || !origin)
|
|
204
|
+
return;
|
|
205
|
+
const active = this.#document.activeElement;
|
|
206
|
+
// why: bấm ra ngoài vào một phần tử nhận focus thì focus đã ở đó — không kéo về; bấm vào chỗ trống thì focus còn
|
|
207
|
+
// trong panel (hoặc rơi về body) nên trả về trigger như Esc. `focusMoved`: focus đang chuyển sang phần tử khác.
|
|
208
|
+
const restore = reason === 'switch' || reason === 'detach' || focusMoved
|
|
209
|
+
? false
|
|
210
|
+
: reason === 'outside'
|
|
211
|
+
? !active || active === this.#document.body || ref.overlayElement.contains(active)
|
|
212
|
+
: true;
|
|
213
|
+
const returnTo = this.#returnFocusTo ?? origin;
|
|
214
|
+
this.#ref = undefined;
|
|
215
|
+
this.#root = undefined;
|
|
216
|
+
this.#returnFocusTo = undefined;
|
|
217
|
+
for (const stop of this.#teardown.splice(0))
|
|
218
|
+
stop();
|
|
219
|
+
ref.dispose();
|
|
220
|
+
this.#isOpen.set(false);
|
|
221
|
+
this.#group?.release(this);
|
|
222
|
+
if (restore && returnTo.isConnected && !returnTo.disabled)
|
|
223
|
+
returnTo.focus();
|
|
224
|
+
if (!this.#destroyed)
|
|
225
|
+
this.ɵclosing.next({ origin, reason });
|
|
226
|
+
if (!this.#destroyed && reason !== 'detach')
|
|
227
|
+
this.closed.emit(reason);
|
|
228
|
+
// why: một listener của `closed` có thể đã mở lại panel (cho trigger khác) — khi đó giữ origin mới.
|
|
229
|
+
if (!this.#ref)
|
|
230
|
+
this.#origin.set(undefined);
|
|
231
|
+
}
|
|
232
|
+
#listen(ref, origin) {
|
|
233
|
+
const outside = ref.outsidePointerEvents().subscribe(event => {
|
|
234
|
+
const target = _getEventTarget(event);
|
|
235
|
+
if (target && (origin.contains(target) || this.#returnFocusTo?.contains(target) || this.#inStackedLayer(target)))
|
|
236
|
+
return;
|
|
237
|
+
this.close('outside');
|
|
238
|
+
});
|
|
239
|
+
const pane = ref.overlayElement;
|
|
240
|
+
// why: Esc bắt ở hai nơi. Focus luôn ở trong panel nên keydown của pane nhận trước — tooltip của một nút khác (gắn sau
|
|
241
|
+
// panel, nằm trên cùng) không nuốt được Esc qua OverlayKeyboardDispatcher (R1 · N-1). keydownEvents() chỉ còn cho
|
|
242
|
+
// trường hợp focus ở ngoài pane (bấm vào chỗ trống); phím gõ trong popup của một control (menu của sd-operator, lịch
|
|
243
|
+
// của sd-date) là của popup đó.
|
|
244
|
+
const keys = ref.keydownEvents().subscribe(event => {
|
|
245
|
+
const target = _getEventTarget(event);
|
|
246
|
+
if (target && (pane.contains(target) || this.#inStackedLayer(target)))
|
|
247
|
+
return;
|
|
248
|
+
this.#escape(event);
|
|
249
|
+
});
|
|
250
|
+
const onKeydown = (event) => {
|
|
251
|
+
if (event.key === 'Escape')
|
|
252
|
+
this.#escape(event);
|
|
253
|
+
// why: nội dung đã dùng Tab (bộ lọc đã lưu: nút áp → nút xoá của cùng hàng) thì không đóng.
|
|
254
|
+
else if (event.key === 'Tab' && !event.defaultPrevented && this.#leavesByTab(event))
|
|
255
|
+
this.close('tab');
|
|
256
|
+
};
|
|
257
|
+
const onFocusOut = (event) => {
|
|
258
|
+
const next = event.relatedTarget;
|
|
259
|
+
// why: relatedTarget null = focus rơi về body hoặc cửa sổ mất focus — bấm ra ngoài đã có outsidePointerEvents.
|
|
260
|
+
if (!next || pane.contains(next) || origin.contains(next) || this.#returnFocusTo?.contains(next) || this.#inStackedLayer(next))
|
|
261
|
+
return;
|
|
262
|
+
this.#close('outside', true);
|
|
263
|
+
};
|
|
264
|
+
pane.addEventListener('keydown', onKeydown);
|
|
265
|
+
pane.addEventListener('focusout', onFocusOut);
|
|
266
|
+
this.#teardown.push(() => outside.unsubscribe(), () => keys.unsubscribe(), () => pane.removeEventListener('keydown', onKeydown), () => pane.removeEventListener('focusout', onFocusOut));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Escape closes the panel unless the popup of a control is open above it (an sd-select panel closes first).
|
|
270
|
+
* why: không dựa vào `defaultPrevented` — sd-input-number chặn mọi phím ngoài danh sách cho phép (cả Esc) bằng
|
|
271
|
+
* preventDefault, nên cờ đó không nói control đã dùng Esc; popup tương tác chồng lên trên mới nói được.
|
|
272
|
+
*/
|
|
273
|
+
#escape(event) {
|
|
274
|
+
if (event.key !== 'Escape' || !this.#ref || hasModifierKey(event) || this.#interactiveLayerAbove())
|
|
275
|
+
return;
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
this.close('escape');
|
|
278
|
+
}
|
|
279
|
+
/** An overlay layer stacked above this panel that a user can interact with (not a tooltip). */
|
|
280
|
+
#interactiveLayerAbove() {
|
|
281
|
+
const host = this.#ref?.hostElement;
|
|
282
|
+
if (!host)
|
|
283
|
+
return false;
|
|
284
|
+
return Array.from(this.#container.getContainerElement().children).some(layer => layer !== host && !!(host.compareDocumentPosition(layer) & Node.DOCUMENT_POSITION_FOLLOWING) && !!layer.querySelector(INTERACTIVE));
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Tab leaves a list at once (focus goes back to the trigger and the browser moves on from there, like the Action
|
|
288
|
+
* Popover). In a form it leaves from the last control, Shift+Tab from the first.
|
|
289
|
+
*/
|
|
290
|
+
#leavesByTab(event) {
|
|
291
|
+
if (this.#kind() === 'list')
|
|
292
|
+
return true;
|
|
293
|
+
const root = this.#root;
|
|
294
|
+
if (!root)
|
|
295
|
+
return true;
|
|
296
|
+
const tabbables = this.#tabbables(root);
|
|
297
|
+
const target = event.target;
|
|
298
|
+
if (!tabbables.length)
|
|
299
|
+
return true;
|
|
300
|
+
return event.shiftKey ? target === tabbables[0] || target === root : target === tabbables[tabbables.length - 1];
|
|
301
|
+
}
|
|
302
|
+
#focusInitial(keyboard, last = false) {
|
|
303
|
+
const root = this.#root;
|
|
304
|
+
if (!root)
|
|
305
|
+
return false;
|
|
306
|
+
let target;
|
|
307
|
+
if (this.#kind() === 'form') {
|
|
308
|
+
const marked = root.querySelector('[data-sd-query-panel-initial]');
|
|
309
|
+
target = marked ? this.#tabbables(marked)[0] : this.#tabbables(root)[0];
|
|
310
|
+
if (!target && !last)
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
target = root.querySelector('input:not([disabled])');
|
|
315
|
+
if (!target && keyboard)
|
|
316
|
+
target = root.querySelector(FIRST_OPTION);
|
|
317
|
+
}
|
|
318
|
+
(target ?? root).focus();
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
#tabbables(root) {
|
|
322
|
+
return Array.from(root.querySelectorAll(TABBABLE)).filter(element => this.#checker.isFocusable(element) && this.#checker.isTabbable(element));
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Whether `node` sits in an overlay layer stacked above this panel: the panel of an sd-select, a date picker, the menu
|
|
326
|
+
* of sd-operator. Clicks and focus there belong to a control of the panel, so they are not "outside". Layers below it
|
|
327
|
+
* (a dialog that hosts the bar) are outside.
|
|
328
|
+
*/
|
|
329
|
+
#inStackedLayer(node) {
|
|
330
|
+
const host = this.#ref?.hostElement;
|
|
331
|
+
const container = this.#container.getContainerElement();
|
|
332
|
+
if (!host || !container.contains(node) || host.contains(node))
|
|
333
|
+
return false;
|
|
334
|
+
let layer = node;
|
|
335
|
+
while (layer && layer.parentNode !== container)
|
|
336
|
+
layer = layer.parentNode;
|
|
337
|
+
return !!layer && !!(host.compareDocumentPosition(layer) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
338
|
+
}
|
|
339
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
340
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: ɵSdQueryPanelDirective, isStandalone: true, selector: "ng-template[sdQueryPanel]", inputs: { role: { classPropertyName: "role", publicName: "sdQueryPanel", isSignal: true, isRequired: true, transformFunction: null }, align: { classPropertyName: "align", publicName: "sdQueryPanelAlign", isSignal: true, isRequired: false, transformFunction: null }, controls: { classPropertyName: "controls", publicName: "sdQueryPanelControls", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed" }, exportAs: ["sdQueryPanel"], ngImport: i0 });
|
|
341
|
+
}
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelDirective, decorators: [{
|
|
343
|
+
type: Directive,
|
|
344
|
+
args: [{
|
|
345
|
+
selector: 'ng-template[sdQueryPanel]',
|
|
346
|
+
exportAs: 'sdQueryPanel',
|
|
347
|
+
standalone: true,
|
|
348
|
+
}]
|
|
349
|
+
}], ctorParameters: () => [], propDecorators: { role: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdQueryPanel", required: true }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdQueryPanelAlign", required: false }] }], controls: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdQueryPanelControls", required: false }] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
350
|
+
/**
|
|
351
|
+
* Button (or `div[role=button]`) that opens a `ɵSdQueryPanelDirective`: click, Enter, Space. Sets `aria-haspopup`,
|
|
352
|
+
* `aria-expanded` and `aria-controls`; a second activation closes the panel.
|
|
39
353
|
*
|
|
40
|
-
*
|
|
41
|
-
|
|
354
|
+
* Internal (`ɵ`): not part of SemVer.
|
|
355
|
+
*/
|
|
356
|
+
class ɵSdQueryPanelTriggerDirective {
|
|
357
|
+
#host = inject(ElementRef).nativeElement;
|
|
358
|
+
#pointer = false;
|
|
359
|
+
#destroyed = false;
|
|
360
|
+
panel = input(undefined, { ...(ngDevMode ? { debugName: "panel" } : /* istanbul ignore next */ {}), alias: 'sdQueryPanelTrigger' });
|
|
361
|
+
/** The panel is opening for this trigger — emitted before its content renders. */
|
|
362
|
+
panelOpened = output();
|
|
363
|
+
/** The panel closed for this trigger. */
|
|
364
|
+
panelClosed = output();
|
|
365
|
+
/** The panel is open for this trigger. */
|
|
366
|
+
expanded = computed(() => {
|
|
367
|
+
const panel = this.panel();
|
|
368
|
+
return !!panel && panel.isOpen() && panel.origin() === this.#host;
|
|
369
|
+
}, /* @ts-ignore */
|
|
370
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
371
|
+
constructor() {
|
|
372
|
+
effect(onCleanup => {
|
|
373
|
+
const panel = this.panel();
|
|
374
|
+
if (!panel)
|
|
375
|
+
return;
|
|
376
|
+
const opening = panel.ɵopening.subscribe(origin => {
|
|
377
|
+
if (origin === this.#host && !this.#destroyed)
|
|
378
|
+
this.panelOpened.emit();
|
|
379
|
+
});
|
|
380
|
+
const closing = panel.ɵclosing.subscribe(({ origin, reason }) => {
|
|
381
|
+
if (origin === this.#host && !this.#destroyed && reason !== 'detach')
|
|
382
|
+
this.panelClosed.emit(reason);
|
|
383
|
+
});
|
|
384
|
+
onCleanup(() => {
|
|
385
|
+
opening.unsubscribe();
|
|
386
|
+
closing.unsubscribe();
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
inject(DestroyRef).onDestroy(() => {
|
|
390
|
+
this.#destroyed = true;
|
|
391
|
+
if (this.expanded())
|
|
392
|
+
this.panel()?.close('detach');
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
/** Opens the panel for this trigger (no-op when already open). `returnFocusTo` gets focus back on close. */
|
|
396
|
+
openMenu(returnFocusTo) {
|
|
397
|
+
if (!this.expanded())
|
|
398
|
+
this.panel()?.open(this.#host, { keyboard: true, returnFocusTo });
|
|
399
|
+
}
|
|
400
|
+
/** Closes the panel when it is open for this trigger. */
|
|
401
|
+
closeMenu() {
|
|
402
|
+
if (this.expanded())
|
|
403
|
+
this.panel()?.close('close');
|
|
404
|
+
}
|
|
405
|
+
onPointerDown() {
|
|
406
|
+
this.#pointer = true;
|
|
407
|
+
}
|
|
408
|
+
onClick() {
|
|
409
|
+
// why: click do Enter / Space trên <button> không có pointerdown đi trước — mở bằng bàn phím.
|
|
410
|
+
const keyboard = !this.#pointer;
|
|
411
|
+
this.#pointer = false;
|
|
412
|
+
this.#toggle(keyboard);
|
|
413
|
+
}
|
|
414
|
+
onKeydown(event) {
|
|
415
|
+
// <button> đã tự biến Enter / Space thành click.
|
|
416
|
+
if (this.#host.tagName === 'BUTTON' || (event.key !== 'Enter' && event.key !== ' '))
|
|
417
|
+
return;
|
|
418
|
+
if (event.target !== this.#host)
|
|
419
|
+
return;
|
|
420
|
+
event.preventDefault();
|
|
421
|
+
this.#toggle(true);
|
|
422
|
+
}
|
|
423
|
+
#toggle(keyboard) {
|
|
424
|
+
const panel = this.panel();
|
|
425
|
+
if (!panel)
|
|
426
|
+
return;
|
|
427
|
+
if (this.expanded())
|
|
428
|
+
panel.close('close');
|
|
429
|
+
else
|
|
430
|
+
panel.open(this.#host, { keyboard });
|
|
431
|
+
}
|
|
432
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
433
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: ɵSdQueryPanelTriggerDirective, isStandalone: true, selector: "[sdQueryPanelTrigger]", inputs: { panel: { classPropertyName: "panel", publicName: "sdQueryPanelTrigger", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { panelOpened: "panelOpened", panelClosed: "panelClosed" }, host: { listeners: { "pointerdown": "onPointerDown()", "click": "onClick()", "keydown": "onKeydown($event)" }, properties: { "attr.aria-haspopup": "panel()?.role() ?? null", "attr.aria-expanded": "panel() ? expanded() : null", "attr.aria-controls": "expanded() ? panel()!.controlledId() : null" }, classAttribute: "sd-query-panel-trigger" }, exportAs: ["sdQueryPanelTrigger"], ngImport: i0 });
|
|
434
|
+
}
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ɵSdQueryPanelTriggerDirective, decorators: [{
|
|
436
|
+
type: Directive,
|
|
437
|
+
args: [{
|
|
438
|
+
selector: '[sdQueryPanelTrigger]',
|
|
439
|
+
exportAs: 'sdQueryPanelTrigger',
|
|
440
|
+
standalone: true,
|
|
441
|
+
host: {
|
|
442
|
+
class: 'sd-query-panel-trigger',
|
|
443
|
+
'[attr.aria-haspopup]': 'panel()?.role() ?? null',
|
|
444
|
+
'[attr.aria-expanded]': 'panel() ? expanded() : null',
|
|
445
|
+
'[attr.aria-controls]': 'expanded() ? panel()!.controlledId() : null',
|
|
446
|
+
'(pointerdown)': 'onPointerDown()',
|
|
447
|
+
'(click)': 'onClick()',
|
|
448
|
+
'(keydown)': 'onKeydown($event)',
|
|
449
|
+
},
|
|
450
|
+
}]
|
|
451
|
+
}], ctorParameters: () => [], propDecorators: { panel: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdQueryPanelTrigger", required: false }] }], panelOpened: [{ type: i0.Output, args: ["panelOpened"] }], panelClosed: [{ type: i0.Output, args: ["panelClosed"] }] } });
|
|
452
|
+
|
|
453
|
+
/** localStorage key of the saved filters of `key` — unchanged since the first release, so old lists still load. */
|
|
454
|
+
const ɵsdSavedFiltersStorageKey = (key) => `sd-query-bar:savedFilters:${key}`;
|
|
455
|
+
// why: chép từ `components/table/src/services/table-query-params/table-query-params.util.ts` (ISO_DATE + reviver).
|
|
456
|
+
// query-bar không được import components/table (sai chiều phụ thuộc) và @sdcorejs/utils chưa có helper tương đương.
|
|
457
|
+
// Chỉ đúng định dạng `Date#toJSON` mới đọc lại thành `Date`; chuỗi ngày người dùng gõ (`2026-11-09`) giữ là chuỗi.
|
|
458
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
|
459
|
+
const reviveDate = (_, value) => (typeof value === 'string' && ISO_DATE.test(value) ? new Date(value) : value);
|
|
460
|
+
const isSavedFilter = (value) => {
|
|
461
|
+
if (!value || typeof value !== 'object')
|
|
462
|
+
return false;
|
|
463
|
+
const { id, name, query } = value;
|
|
464
|
+
if (typeof id !== 'string' || !id || typeof name !== 'string' || !query || typeof query !== 'object')
|
|
465
|
+
return false;
|
|
466
|
+
return query.filters === undefined || Array.isArray(query.filters);
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* Parses the stored list. Dates written by `JSON.stringify` come back as `Date`. Entries without `id`, `name` or `query`
|
|
470
|
+
* are dropped one by one instead of losing the whole list.
|
|
471
|
+
*/
|
|
472
|
+
function ɵsdReadSavedFilters(raw) {
|
|
473
|
+
if (raw === null || raw === '')
|
|
474
|
+
return { filters: [], error: false };
|
|
475
|
+
let parsed;
|
|
476
|
+
try {
|
|
477
|
+
parsed = JSON.parse(raw, reviveDate);
|
|
478
|
+
}
|
|
479
|
+
catch {
|
|
480
|
+
return { filters: [], error: true };
|
|
481
|
+
}
|
|
482
|
+
return Array.isArray(parsed) ? { filters: parsed.filter(isSavedFilter), error: false } : { filters: [], error: true };
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
let nextHeadingId = 0;
|
|
486
|
+
/**
|
|
487
|
+
* Saved-filters dropdown for `sd-query-bar` (handoff section 5).
|
|
488
|
+
*
|
|
489
|
+
* Self-contained: persists the list to `localStorage` under `sd-query-bar:savedFilters:<key>` whenever the host passes
|
|
490
|
+
* a `[key]`. Without a key the trigger stays disabled.
|
|
491
|
+
*
|
|
492
|
+
* The host owns the live `[query]`: each save snapshots it into a new entry, each apply emits the chosen filter back via
|
|
493
|
+
* `(apply)` for the host to install into its own `filters` / `logic` / `search`. Deleting asks nothing: the toast offers
|
|
494
|
+
* Undo, which puts the filter back where it was.
|
|
42
495
|
*/
|
|
43
496
|
class SdQuerySavedFiltersMenu {
|
|
44
497
|
#i18n = inject(I18nService);
|
|
45
498
|
#confirm = inject(SdConfirmService);
|
|
499
|
+
#notify = inject(SdNotifyService);
|
|
500
|
+
#cdr = inject(ChangeDetectorRef);
|
|
46
501
|
tooltipLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.tooltip'), /* @ts-ignore */
|
|
47
502
|
...(ngDevMode ? [{ debugName: "tooltipLabel" }] : /* istanbul ignore next */ []));
|
|
48
503
|
tooltipDisabledLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.tooltip-disabled'), /* @ts-ignore */
|
|
49
504
|
...(ngDevMode ? [{ debugName: "tooltipDisabledLabel" }] : /* istanbul ignore next */ []));
|
|
50
|
-
|
|
51
|
-
...(ngDevMode ? [{ debugName: "
|
|
505
|
+
headingLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.heading'), /* @ts-ignore */
|
|
506
|
+
...(ngDevMode ? [{ debugName: "headingLabel" }] : /* istanbul ignore next */ []));
|
|
52
507
|
emptyLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.empty'), /* @ts-ignore */
|
|
53
508
|
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
509
|
+
readErrorLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.read-error'), /* @ts-ignore */
|
|
510
|
+
...(ngDevMode ? [{ debugName: "readErrorLabel" }] : /* istanbul ignore next */ []));
|
|
54
511
|
saveLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.save'), /* @ts-ignore */
|
|
55
512
|
...(ngDevMode ? [{ debugName: "saveLabel" }] : /* istanbul ignore next */ []));
|
|
513
|
+
headingId = `sd-query-saved-filters-heading-${nextHeadingId++}`;
|
|
56
514
|
/** Namespace key used to scope localStorage. `undefined` → menu disabled. */
|
|
57
515
|
key = input(undefined, /* @ts-ignore */
|
|
58
516
|
...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
59
517
|
/** Current query the host wants to snapshot when the user clicks "Save current". */
|
|
60
518
|
query = input({ filters: [], logic: 'AND' }, /* @ts-ignore */
|
|
61
519
|
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
520
|
+
/** `false` disables "Save current filter": no chip has a value and the search box is empty. */
|
|
521
|
+
canSave = input(true, { ...(ngDevMode ? { debugName: "canSave" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
522
|
+
/** Prefix of `data-autoid` (handoff section 12). */
|
|
523
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
524
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
62
525
|
/** Fired when the user picks a saved filter from the list. */
|
|
63
526
|
apply = output();
|
|
64
527
|
savedFilters = signal([], /* @ts-ignore */
|
|
65
528
|
...(ngDevMode ? [{ debugName: "savedFilters" }] : /* istanbul ignore next */ []));
|
|
529
|
+
/** The stored list could not be read (broken JSON, not an array, storage blocked). Saving replaces it. */
|
|
530
|
+
readError = signal(false, /* @ts-ignore */
|
|
531
|
+
...(ngDevMode ? [{ debugName: "readError" }] : /* istanbul ignore next */ []));
|
|
532
|
+
/** Delete buttons always shown at touch size (`pointer: coarse`), read when the panel opens. */
|
|
533
|
+
coarse = signal(false, /* @ts-ignore */
|
|
534
|
+
...(ngDevMode ? [{ debugName: "coarse" }] : /* istanbul ignore next */ []));
|
|
535
|
+
panel = viewChild.required('panel', /* @ts-ignore */
|
|
536
|
+
...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
|
|
66
537
|
#storageKey = computed(() => {
|
|
67
538
|
const k = this.key();
|
|
68
|
-
return k ?
|
|
539
|
+
return k ? ɵsdSavedFiltersStorageKey(k) : undefined;
|
|
69
540
|
}, /* @ts-ignore */
|
|
70
541
|
...(ngDevMode ? [{ debugName: "#storageKey" }] : /* istanbul ignore next */ []));
|
|
71
542
|
// why: reload whenever the namespace key changes (e.g. host switches user/context).
|
|
@@ -73,38 +544,40 @@ class SdQuerySavedFiltersMenu {
|
|
|
73
544
|
const storage = this.#storageKey();
|
|
74
545
|
if (!storage) {
|
|
75
546
|
this.savedFilters.set([]);
|
|
547
|
+
this.readError.set(false);
|
|
76
548
|
return;
|
|
77
549
|
}
|
|
550
|
+
let read;
|
|
78
551
|
try {
|
|
79
|
-
|
|
80
|
-
this.savedFilters.set(raw ? JSON.parse(raw) : []);
|
|
552
|
+
read = ɵsdReadSavedFilters(localStorage.getItem(storage));
|
|
81
553
|
}
|
|
82
554
|
catch {
|
|
83
|
-
|
|
555
|
+
// Storage bị chặn (SecurityError): như dữ liệu đọc không được.
|
|
556
|
+
read = { filters: [], error: true };
|
|
84
557
|
}
|
|
558
|
+
this.savedFilters.set(read.filters);
|
|
559
|
+
this.readError.set(read.error);
|
|
85
560
|
}, /* @ts-ignore */
|
|
86
561
|
...(ngDevMode ? [{ debugName: "#loadFilters" }] : /* istanbul ignore next */ []));
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
562
|
+
deleteLabel(name) {
|
|
563
|
+
return this.#i18n.t('core.component.query-bar.saved-filters.delete', { name });
|
|
564
|
+
}
|
|
565
|
+
autoIdOf(role) {
|
|
566
|
+
const base = this.autoId();
|
|
567
|
+
return base ? `${base}-${role}` : null;
|
|
568
|
+
}
|
|
569
|
+
/** Before the panel renders: touch devices show delete buttons without hover. */
|
|
570
|
+
onOpening() {
|
|
571
|
+
this.coarse.set(typeof window !== 'undefined' && !!window.matchMedia?.('(pointer: coarse)').matches);
|
|
97
572
|
}
|
|
98
573
|
/**
|
|
99
|
-
* Prompt for a name and append a snapshot of the current query as a new
|
|
100
|
-
* saved filter. Public so the parent toolbar can wire its external "save"
|
|
101
|
-
* button to this method without re-implementing persistence.
|
|
574
|
+
* Prompt for a name and append a snapshot of the current query as a new saved filter. The bar itself does not change.
|
|
102
575
|
*/
|
|
103
576
|
async promptSave() {
|
|
104
577
|
if (!this.#storageKey())
|
|
105
578
|
return;
|
|
106
|
-
// why: window.prompt chặn UI thread, không style/i18n được và bị vô hiệu trong vài
|
|
107
|
-
//
|
|
579
|
+
// why: window.prompt chặn UI thread, không style/i18n được và bị vô hiệu trong vài môi trường (iframe sandbox) —
|
|
580
|
+
// dialog withInput dùng chung hạ tầng confirm của lib.
|
|
108
581
|
let name;
|
|
109
582
|
try {
|
|
110
583
|
name = await this.#confirm.withInput(this.#i18n.t('core.component.query-bar.saved-filters.name-label'), {
|
|
@@ -122,28 +595,145 @@ class SdQuerySavedFiltersMenu {
|
|
|
122
595
|
name: name.trim(),
|
|
123
596
|
query: this.query(),
|
|
124
597
|
};
|
|
125
|
-
|
|
126
|
-
this.savedFilters.set(next);
|
|
127
|
-
this.#persist(next);
|
|
598
|
+
this.#write([...this.savedFilters(), filter]);
|
|
128
599
|
}
|
|
129
600
|
/** Apply a saved filter — host re-installs filters/logic/search via `(apply)`. */
|
|
130
601
|
pick(filter) {
|
|
602
|
+
this.panel().close('select');
|
|
131
603
|
this.apply.emit(filter);
|
|
132
604
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
605
|
+
onSave() {
|
|
606
|
+
this.panel().close('select');
|
|
607
|
+
void this.promptSave();
|
|
608
|
+
}
|
|
609
|
+
/** Deletes the filter at `index` at once; the toast offers Undo. */
|
|
610
|
+
remove(index) {
|
|
611
|
+
const list = this.savedFilters();
|
|
612
|
+
const removed = list[index];
|
|
613
|
+
if (!removed || !this.#write(list.filter((_, i) => i !== index)))
|
|
614
|
+
return;
|
|
615
|
+
const storage = this.#storageKey();
|
|
616
|
+
this.#notify.info(removed.name, {
|
|
617
|
+
title: this.#i18n.t('core.component.query-bar.saved-filters.deleted'),
|
|
618
|
+
actionLabel: this.#i18n.t('core.component.query-bar.saved-filters.undo'),
|
|
619
|
+
onAction: () => this.#restore(removed, index, storage),
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
/** Delete from the panel: focus moves to the next row, else to "Save current filter". */
|
|
623
|
+
removeAt(index) {
|
|
624
|
+
this.remove(index);
|
|
625
|
+
this.#cdr.detectChanges();
|
|
626
|
+
const root = this.panel().element();
|
|
627
|
+
if (!root)
|
|
628
|
+
return;
|
|
629
|
+
const next = this.#applyButtons(root)[index] ??
|
|
630
|
+
root.querySelector('.c-sf-save:not(:disabled)') ??
|
|
631
|
+
this.#applyButtons(root).at(-1);
|
|
632
|
+
(next ?? root).focus();
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Arrow keys move over the apply buttons and "Save current filter" only (handoff section 5.3); → or Tab reach the
|
|
636
|
+
* delete button of the row, ← or Shift+Tab come back; Delete removes the filter of an apply button.
|
|
637
|
+
*/
|
|
638
|
+
onKeydown(event) {
|
|
639
|
+
const root = this.panel().element();
|
|
640
|
+
const target = event.target;
|
|
641
|
+
if (!root)
|
|
642
|
+
return;
|
|
643
|
+
// why: nút xoá cũng là menuitem nhưng nằm ngoài vòng mũi tên — chọn theo class, không theo role.
|
|
644
|
+
const items = Array.from(root.querySelectorAll('.c-sf-apply:not(:disabled), .c-sf-save:not(:disabled)'));
|
|
645
|
+
const row = target.closest('.c-sf-row');
|
|
646
|
+
const index = row ? Array.from(root.querySelectorAll('.c-sf-row')).indexOf(row) : -1;
|
|
647
|
+
const onApply = target.classList.contains('c-sf-apply');
|
|
648
|
+
const onDelete = target.classList.contains('c-sf-del');
|
|
649
|
+
const current = onDelete
|
|
650
|
+
? items.indexOf(row.querySelector('.c-sf-apply'))
|
|
651
|
+
: items.indexOf(target);
|
|
652
|
+
const focusItem = (position) => {
|
|
653
|
+
if (items.length)
|
|
654
|
+
items[(position + items.length) % items.length].focus();
|
|
655
|
+
};
|
|
656
|
+
switch (event.key) {
|
|
657
|
+
case 'ArrowDown':
|
|
658
|
+
focusItem(current + 1);
|
|
659
|
+
break;
|
|
660
|
+
case 'ArrowUp':
|
|
661
|
+
focusItem(current < 0 ? -1 : current - 1);
|
|
662
|
+
break;
|
|
663
|
+
case 'Home':
|
|
664
|
+
focusItem(0);
|
|
665
|
+
break;
|
|
666
|
+
case 'End':
|
|
667
|
+
focusItem(-1);
|
|
668
|
+
break;
|
|
669
|
+
case 'ArrowRight':
|
|
670
|
+
if (!onApply)
|
|
671
|
+
return;
|
|
672
|
+
row.querySelector('.c-sf-del').focus();
|
|
673
|
+
break;
|
|
674
|
+
case 'ArrowLeft':
|
|
675
|
+
if (!onDelete)
|
|
676
|
+
return;
|
|
677
|
+
row.querySelector('.c-sf-apply').focus();
|
|
678
|
+
break;
|
|
679
|
+
case 'Tab':
|
|
680
|
+
// why: Tab ra khỏi panel thì panel tự đóng; chỉ giữ lại hai bước trong cùng một hàng.
|
|
681
|
+
if (onApply && !event.shiftKey)
|
|
682
|
+
row.querySelector('.c-sf-del').focus();
|
|
683
|
+
else if (onDelete && event.shiftKey)
|
|
684
|
+
row.querySelector('.c-sf-apply').focus();
|
|
685
|
+
else
|
|
686
|
+
return;
|
|
687
|
+
break;
|
|
688
|
+
case 'Delete':
|
|
689
|
+
if (!onApply)
|
|
690
|
+
return;
|
|
691
|
+
this.removeAt(index);
|
|
692
|
+
break;
|
|
693
|
+
default:
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
event.preventDefault();
|
|
697
|
+
}
|
|
698
|
+
#applyButtons(root) {
|
|
699
|
+
return Array.from(root.querySelectorAll('.c-sf-apply'));
|
|
700
|
+
}
|
|
701
|
+
/** Undo of a delete: back at its old index, clamped to the current length. */
|
|
702
|
+
#restore(filter, index, storage) {
|
|
703
|
+
const list = this.savedFilters();
|
|
704
|
+
if (storage !== this.#storageKey() || list.some(item => item.id === filter.id))
|
|
705
|
+
return;
|
|
706
|
+
const at = Math.min(index, list.length);
|
|
707
|
+
this.#write([...list.slice(0, at), filter, ...list.slice(at)]);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Shows `next` and writes it. A failing write (quota, blocked storage) puts the previous list back and shows an error
|
|
711
|
+
* toast without the exception text.
|
|
712
|
+
*/
|
|
713
|
+
#write(next) {
|
|
714
|
+
const storage = this.#storageKey();
|
|
715
|
+
if (!storage)
|
|
716
|
+
return false;
|
|
717
|
+
const previous = this.savedFilters();
|
|
137
718
|
this.savedFilters.set(next);
|
|
138
|
-
|
|
719
|
+
try {
|
|
720
|
+
localStorage.setItem(storage, JSON.stringify(next));
|
|
721
|
+
}
|
|
722
|
+
catch {
|
|
723
|
+
this.savedFilters.set(previous);
|
|
724
|
+
this.#notify.error(this.#i18n.t('core.component.query-bar.saved-filters.write-error'));
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
this.readError.set(false);
|
|
728
|
+
return true;
|
|
139
729
|
}
|
|
140
730
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQuerySavedFiltersMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
141
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQuerySavedFiltersMenu, isStandalone: true, selector: "sd-query-saved-filters-menu", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply" }, ngImport: i0, template: "<button\n type=\"button\"\n class=\"c-saved-filters\"\n [disabled]=\"!
|
|
731
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQuerySavedFiltersMenu, isStandalone: true, selector: "sd-query-saved-filters-menu", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, canSave: { classPropertyName: "canSave", publicName: "canSave", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _key = key();\n<button\n type=\"button\"\n class=\"c-saved-filters\"\n [disabled]=\"!_key\"\n [sdQueryPanelTrigger]=\"panel\"\n [matTooltip]=\"_key ? tooltipLabel() : tooltipDisabledLabel()\"\n [attr.aria-label]=\"tooltipLabel()\"\n [attr.data-autoid]=\"autoIdOf('saved-filters')\"\n (panelOpened)=\"onOpening()\">\n <sd-icon name=\"bookmark_border\"></sd-icon>\n</button>\n\n<!-- Panel theo khung Action Popover (handoff m\u1EE5c 5.2): ti\u00EAu \u0111\u1EC1, h\u00E0ng [n\u00FAt \u00E1p | n\u00FAt xo\u00E1], \u0111\u01B0\u1EDDng k\u1EBB, \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\".\n why: n\u00FAt xo\u00E1 l\u00E0 button th\u01B0\u1EDDng \u0111\u1EB7t C\u1EA0NH n\u00FAt \u00E1p (kh\u00F4ng l\u1ED3ng trong nhau, ngo\u00E0i v\u00F2ng m\u0169i t\u00EAn c\u1EE7a menu). -->\n<ng-template sdQueryPanel=\"menu\" sdQueryPanelAlign=\"end\" #panel=\"sdQueryPanel\">\n <div\n class=\"sd-query-panel sd-query-panel--list c-saved-filters-menu\"\n role=\"menu\"\n tabindex=\"-1\"\n [class.c-saved-filters-menu--coarse]=\"coarse()\"\n [attr.aria-labelledby]=\"headingId\"\n [attr.data-autoid]=\"autoIdOf('panel-saved-filters')\"\n (keydown)=\"onKeydown($event)\">\n <div class=\"c-sf-heading\" [id]=\"headingId\">{{ headingLabel() }}</div>\n @if (readError()) {\n <div class=\"c-sf-state c-sf-state--error\">\n <sd-icon name=\"error\" size=\"16px\" aria-hidden=\"true\"></sd-icon>\n <span>{{ readErrorLabel() }}</span>\n </div>\n }\n @for (f of savedFilters(); track f.id; let i = $index) {\n <div class=\"c-sf-row\" role=\"none\">\n <button\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n class=\"c-sf-apply\"\n [attr.data-autoid]=\"autoIdOf('saved-filter-' + i)\"\n (click)=\"pick(f)\">\n <sd-icon class=\"c-sf-lead\" name=\"filter_alt\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n <span class=\"c-sf-name\">{{ f.name }}</span>\n </button>\n <!-- why: menu ch\u1EC9 \u0111\u01B0\u1EE3c s\u1EDF h\u1EEFu menuitem (axe aria-required-children, PD sau R1 G-3) \u2014 n\u00FAt xo\u00E1 c\u0169ng l\u00E0 menuitem,\n v\u1EABn ngo\u00E0i v\u00F2ng m\u0169i t\u00EAn (\u2192 / Tab t\u1EDBi n\u00F3). -->\n <button\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n class=\"c-sf-del\"\n [attr.aria-label]=\"deleteLabel(f.name)\"\n [attr.data-autoid]=\"autoIdOf('saved-filter-' + i + '-delete')\"\n (click)=\"removeAt(i)\">\n <sd-icon name=\"delete\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n </button>\n </div>\n } @empty {\n @if (!readError()) {\n <div class=\"c-sf-state\">{{ emptyLabel() }}</div>\n }\n }\n <div class=\"c-sf-divider\" role=\"separator\"></div>\n <button\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n class=\"c-sf-save\"\n [disabled]=\"!_key || !canSave()\"\n [attr.data-autoid]=\"autoIdOf('saved-filters-save')\"\n (click)=\"onSave()\">\n <sd-icon name=\"bookmark_add\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n <span>{{ saveLabel() }}</span>\n </button>\n </div>\n</ng-template>\n", styles: [":host{display:inline-flex}.c-saved-filters{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:var(--sd-radius-6, 6px);background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368);cursor:pointer;padding:0}.c-saved-filters sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-saved-filters:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-saved-filters[disabled]{opacity:.5;cursor:not-allowed}.c-saved-filters-menu{box-sizing:border-box;min-width:min(160px,100vw - 16px);max-width:min(320px,100vw - 16px);max-height:min(360px,100dvh - 16px);overflow:auto;border:1px solid var(--sd-border, #dde0e5);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface, var(--sd-white, #fff));color:var(--sd-text, #1a1b1f);box-shadow:0 4px 12px #0f172a24,0 1px 3px #0f172a1a;padding:4px;min-width:min(220px,100vw - 16px)}.c-saved-filters-menu:focus{outline:none}.c-sf-heading{padding:4px 12px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555)}.c-sf-divider{border-top:1px solid var(--sd-border, #dde0e5);margin:4px 8px}.c-sf-row{display:flex;align-items:center;gap:2px;border-radius:var(--sd-radius-4, 4px)}.c-sf-row:hover,.c-sf-row:focus-within{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 8%,transparent)}.c-sf-apply{display:flex;flex:1 1 auto;align-items:center;gap:8px;box-sizing:border-box;min-width:0;min-height:40px;padding:8px 4px 8px 12px;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;cursor:pointer}.c-sf-apply:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}@media(pointer:coarse){.c-sf-apply{min-height:44px}}.c-sf-lead{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);color:var(--sd-action-accent, inherit)}.c-sf-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-sf-del{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;box-sizing:border-box;width:32px;height:32px;margin-right:4px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-text-secondary, #555);cursor:pointer;opacity:0}.c-sf-del sd-icon{width:18px;height:18px;font-size:var(--sd-font-size-18, 18px)}.c-sf-del:hover{background:color-mix(in srgb,var(--sd-error) 8%,transparent);color:var(--sd-error)}.c-sf-del:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-sf-row:hover .c-sf-del,.c-sf-row:focus-within .c-sf-del,.c-saved-filters-menu--coarse .c-sf-del{opacity:1}.c-saved-filters-menu--coarse .c-sf-del{width:40px;height:40px}.c-sf-save{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:40px;padding:8px 12px;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer}.c-sf-save:hover:not(:disabled),.c-sf-save:focus-visible{background:color-mix(in srgb,var(--sd-action-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.c-sf-save:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-sf-save:disabled{opacity:.45;cursor:default}@media(pointer:coarse){.c-sf-save{min-height:44px}}.c-sf-save sd-icon{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);color:var(--sd-action-accent, inherit);color:var(--sd-primary)}.c-sf-state{display:flex;align-items:center;gap:8px;padding:12px;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-text-secondary, #555)}.c-sf-state sd-icon{flex:0 0 16px;width:16px;height:16px;font-size:var(--sd-font-size-16, 16px);color:var(--sd-error)}.c-sf-state--error{color:var(--sd-text, #1a1b1f)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: ɵSdQueryPanelDirective, selector: "ng-template[sdQueryPanel]", inputs: ["sdQueryPanel", "sdQueryPanelAlign", "sdQueryPanelControls"], outputs: ["opened", "closed"], exportAs: ["sdQueryPanel"] }, { kind: "directive", type: ɵSdQueryPanelTriggerDirective, selector: "[sdQueryPanelTrigger]", inputs: ["sdQueryPanelTrigger"], outputs: ["panelOpened", "panelClosed"], exportAs: ["sdQueryPanelTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
142
732
|
}
|
|
143
733
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQuerySavedFiltersMenu, decorators: [{
|
|
144
734
|
type: Component,
|
|
145
|
-
args: [{ selector: 'sd-query-saved-filters-menu', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon,
|
|
146
|
-
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], apply: [{ type: i0.Output, args: ["apply"] }] } });
|
|
735
|
+
args: [{ selector: 'sd-query-saved-filters-menu', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatTooltipModule, ɵSdQueryPanelDirective, ɵSdQueryPanelTriggerDirective], template: "@let _key = key();\n<button\n type=\"button\"\n class=\"c-saved-filters\"\n [disabled]=\"!_key\"\n [sdQueryPanelTrigger]=\"panel\"\n [matTooltip]=\"_key ? tooltipLabel() : tooltipDisabledLabel()\"\n [attr.aria-label]=\"tooltipLabel()\"\n [attr.data-autoid]=\"autoIdOf('saved-filters')\"\n (panelOpened)=\"onOpening()\">\n <sd-icon name=\"bookmark_border\"></sd-icon>\n</button>\n\n<!-- Panel theo khung Action Popover (handoff m\u1EE5c 5.2): ti\u00EAu \u0111\u1EC1, h\u00E0ng [n\u00FAt \u00E1p | n\u00FAt xo\u00E1], \u0111\u01B0\u1EDDng k\u1EBB, \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\".\n why: n\u00FAt xo\u00E1 l\u00E0 button th\u01B0\u1EDDng \u0111\u1EB7t C\u1EA0NH n\u00FAt \u00E1p (kh\u00F4ng l\u1ED3ng trong nhau, ngo\u00E0i v\u00F2ng m\u0169i t\u00EAn c\u1EE7a menu). -->\n<ng-template sdQueryPanel=\"menu\" sdQueryPanelAlign=\"end\" #panel=\"sdQueryPanel\">\n <div\n class=\"sd-query-panel sd-query-panel--list c-saved-filters-menu\"\n role=\"menu\"\n tabindex=\"-1\"\n [class.c-saved-filters-menu--coarse]=\"coarse()\"\n [attr.aria-labelledby]=\"headingId\"\n [attr.data-autoid]=\"autoIdOf('panel-saved-filters')\"\n (keydown)=\"onKeydown($event)\">\n <div class=\"c-sf-heading\" [id]=\"headingId\">{{ headingLabel() }}</div>\n @if (readError()) {\n <div class=\"c-sf-state c-sf-state--error\">\n <sd-icon name=\"error\" size=\"16px\" aria-hidden=\"true\"></sd-icon>\n <span>{{ readErrorLabel() }}</span>\n </div>\n }\n @for (f of savedFilters(); track f.id; let i = $index) {\n <div class=\"c-sf-row\" role=\"none\">\n <button\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n class=\"c-sf-apply\"\n [attr.data-autoid]=\"autoIdOf('saved-filter-' + i)\"\n (click)=\"pick(f)\">\n <sd-icon class=\"c-sf-lead\" name=\"filter_alt\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n <span class=\"c-sf-name\">{{ f.name }}</span>\n </button>\n <!-- why: menu ch\u1EC9 \u0111\u01B0\u1EE3c s\u1EDF h\u1EEFu menuitem (axe aria-required-children, PD sau R1 G-3) \u2014 n\u00FAt xo\u00E1 c\u0169ng l\u00E0 menuitem,\n v\u1EABn ngo\u00E0i v\u00F2ng m\u0169i t\u00EAn (\u2192 / Tab t\u1EDBi n\u00F3). -->\n <button\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n class=\"c-sf-del\"\n [attr.aria-label]=\"deleteLabel(f.name)\"\n [attr.data-autoid]=\"autoIdOf('saved-filter-' + i + '-delete')\"\n (click)=\"removeAt(i)\">\n <sd-icon name=\"delete\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n </button>\n </div>\n } @empty {\n @if (!readError()) {\n <div class=\"c-sf-state\">{{ emptyLabel() }}</div>\n }\n }\n <div class=\"c-sf-divider\" role=\"separator\"></div>\n <button\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n class=\"c-sf-save\"\n [disabled]=\"!_key || !canSave()\"\n [attr.data-autoid]=\"autoIdOf('saved-filters-save')\"\n (click)=\"onSave()\">\n <sd-icon name=\"bookmark_add\" size=\"18px\" aria-hidden=\"true\"></sd-icon>\n <span>{{ saveLabel() }}</span>\n </button>\n </div>\n</ng-template>\n", styles: [":host{display:inline-flex}.c-saved-filters{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:var(--sd-radius-6, 6px);background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368);cursor:pointer;padding:0}.c-saved-filters sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-saved-filters:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-saved-filters[disabled]{opacity:.5;cursor:not-allowed}.c-saved-filters-menu{box-sizing:border-box;min-width:min(160px,100vw - 16px);max-width:min(320px,100vw - 16px);max-height:min(360px,100dvh - 16px);overflow:auto;border:1px solid var(--sd-border, #dde0e5);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface, var(--sd-white, #fff));color:var(--sd-text, #1a1b1f);box-shadow:0 4px 12px #0f172a24,0 1px 3px #0f172a1a;padding:4px;min-width:min(220px,100vw - 16px)}.c-saved-filters-menu:focus{outline:none}.c-sf-heading{padding:4px 12px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555)}.c-sf-divider{border-top:1px solid var(--sd-border, #dde0e5);margin:4px 8px}.c-sf-row{display:flex;align-items:center;gap:2px;border-radius:var(--sd-radius-4, 4px)}.c-sf-row:hover,.c-sf-row:focus-within{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 8%,transparent)}.c-sf-apply{display:flex;flex:1 1 auto;align-items:center;gap:8px;box-sizing:border-box;min-width:0;min-height:40px;padding:8px 4px 8px 12px;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;cursor:pointer}.c-sf-apply:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}@media(pointer:coarse){.c-sf-apply{min-height:44px}}.c-sf-lead{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);color:var(--sd-action-accent, inherit)}.c-sf-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-sf-del{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;box-sizing:border-box;width:32px;height:32px;margin-right:4px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-text-secondary, #555);cursor:pointer;opacity:0}.c-sf-del sd-icon{width:18px;height:18px;font-size:var(--sd-font-size-18, 18px)}.c-sf-del:hover{background:color-mix(in srgb,var(--sd-error) 8%,transparent);color:var(--sd-error)}.c-sf-del:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-sf-row:hover .c-sf-del,.c-sf-row:focus-within .c-sf-del,.c-saved-filters-menu--coarse .c-sf-del{opacity:1}.c-saved-filters-menu--coarse .c-sf-del{width:40px;height:40px}.c-sf-save{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:40px;padding:8px 12px;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer}.c-sf-save:hover:not(:disabled),.c-sf-save:focus-visible{background:color-mix(in srgb,var(--sd-action-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.c-sf-save:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-sf-save:disabled{opacity:.45;cursor:default}@media(pointer:coarse){.c-sf-save{min-height:44px}}.c-sf-save sd-icon{flex:0 0 18px;width:18px;height:18px;font-size:var(--sd-font-size-18, 18px);color:var(--sd-action-accent, inherit);color:var(--sd-primary)}.c-sf-state{display:flex;align-items:center;gap:8px;padding:12px;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-text-secondary, #555)}.c-sf-state sd-icon{flex:0 0 16px;width:16px;height:16px;font-size:var(--sd-font-size-16, 16px);color:var(--sd-error)}.c-sf-state--error{color:var(--sd-text, #1a1b1f)}\n"] }]
|
|
736
|
+
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], canSave: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSave", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], apply: [{ type: i0.Output, args: ["apply"] }], panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
|
|
147
737
|
|
|
148
738
|
/**
|
|
149
739
|
* Right-pinned toolbar for `sd-query-bar`: AND/OR connector toggle, clear-all,
|
|
@@ -151,7 +741,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
151
741
|
* Search trigger. Owns no business logic — just routes user intent back via
|
|
152
742
|
* outputs (`(logic)` model, `(clear)`, `(search)`, `(applyFilter)`).
|
|
153
743
|
*
|
|
154
|
-
* The "save current query" action lives INSIDE the saved-filters
|
|
744
|
+
* The "save current query" action lives INSIDE the saved-filters panel
|
|
155
745
|
* footer (one zone for both apply + save). The dropdown trigger sits
|
|
156
746
|
* immediately before Search so the user sees one filter-cluster on the right.
|
|
157
747
|
*/
|
|
@@ -169,6 +759,12 @@ class SdQueryActionsBar {
|
|
|
169
759
|
...(ngDevMode ? [{ debugName: "savedFiltersKey" }] : /* istanbul ignore next */ []));
|
|
170
760
|
query = input({ filters: [], logic: 'AND' }, /* @ts-ignore */
|
|
171
761
|
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
762
|
+
/** `false` disables "Save current filter" (nothing to save). */
|
|
763
|
+
canSaveFilter = input(true, /* @ts-ignore */
|
|
764
|
+
...(ngDevMode ? [{ debugName: "canSaveFilter" }] : /* istanbul ignore next */ []));
|
|
765
|
+
/** Prefix of `data-autoid` for the saved-filters controls. */
|
|
766
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
767
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
172
768
|
applyFilter = output();
|
|
173
769
|
// Clear-all —
|
|
174
770
|
showClearAll = input(true, { ...(ngDevMode ? { debugName: "showClearAll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
@@ -207,12 +803,12 @@ class SdQueryActionsBar {
|
|
|
207
803
|
this.logic.set(value);
|
|
208
804
|
}
|
|
209
805
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryActionsBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
210
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryActionsBar, isStandalone: true, selector: "sd-query-actions-bar", inputs: { showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, filtersCount: { classPropertyName: "filtersCount", publicName: "filtersCount", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, clearCount: { classPropertyName: "clearCount", publicName: "clearCount", isSignal: true, isRequired: false, transformFunction: null }, clearDisabled: { classPropertyName: "clearDisabled", publicName: "clearDisabled", isSignal: true, isRequired: false, transformFunction: null }, canSearch: { classPropertyName: "canSearch", publicName: "canSearch", isSignal: true, isRequired: false, transformFunction: null }, showSearchButton: { classPropertyName: "showSearchButton", publicName: "showSearchButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { logic: "logicChange", applyFilter: "applyFilter", clear: "clear", search: "search" }, ngImport: i0, template: "<!-- Vertical separator between the wrapping filter area (left) and the pinned toolbar. -->\n<span class=\"c-bar-divider\" aria-hidden=\"true\"></span>\n\n<div class=\"c-query-bar__actions\">\n <!-- AND / OR toggle -->\n @if (showLogicToggle() && filtersCount() >= 2) {\n <div class=\"c-logic-toggle\" role=\"group\" [attr.aria-label]=\"logicGroupLabel()\">\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'AND'\"\n (click)=\"setLogic('AND')\">\n AND\n </button>\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'OR'\"\n (click)=\"setLogic('OR')\">\n OR\n </button>\n </div>\n }\n\n @if (showClearAll() && filtersCount() > 0) {\n <button\n type=\"button\"\n class=\"c-clear-all\"\n [disabled]=\"clearDisabled()\"\n [matTooltip]=\"clearAllLabel()\"\n [attr.aria-label]=\"clearAllLabel()\"\n (click)=\"clear.emit()\">\n <sd-icon name=\"delete_sweep\"></sd-icon>\n </button>\n }\n\n <!-- why: saved-filters dropdown \u0111\u1EB7t s\u00E1t ngay tr\u01B0\u1EDBc Search \u2014 gom to\u00E0n b\u1ED9\n h\u00E0nh \u0111\u1ED9ng v\u1EC1 b\u1ED9 l\u1ECDc (apply view c\u0169 / l\u01B0u view hi\u1EC7n t\u1EA1i) c\u1EA1nh n\u00FAt submit,\n user th\u1EA5y 1 c\u1EE5m. Footer \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\" s\u1ED1ng trong
|
|
806
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryActionsBar, isStandalone: true, selector: "sd-query-actions-bar", inputs: { showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, filtersCount: { classPropertyName: "filtersCount", publicName: "filtersCount", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, canSaveFilter: { classPropertyName: "canSaveFilter", publicName: "canSaveFilter", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, clearCount: { classPropertyName: "clearCount", publicName: "clearCount", isSignal: true, isRequired: false, transformFunction: null }, clearDisabled: { classPropertyName: "clearDisabled", publicName: "clearDisabled", isSignal: true, isRequired: false, transformFunction: null }, canSearch: { classPropertyName: "canSearch", publicName: "canSearch", isSignal: true, isRequired: false, transformFunction: null }, showSearchButton: { classPropertyName: "showSearchButton", publicName: "showSearchButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { logic: "logicChange", applyFilter: "applyFilter", clear: "clear", search: "search" }, ngImport: i0, template: "<!-- Vertical separator between the wrapping filter area (left) and the pinned toolbar. -->\n<span class=\"c-bar-divider\" aria-hidden=\"true\"></span>\n\n<div class=\"c-query-bar__actions\">\n <!-- AND / OR toggle -->\n @if (showLogicToggle() && filtersCount() >= 2) {\n <div class=\"c-logic-toggle\" role=\"group\" [attr.aria-label]=\"logicGroupLabel()\">\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'AND'\"\n (click)=\"setLogic('AND')\">\n AND\n </button>\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'OR'\"\n (click)=\"setLogic('OR')\">\n OR\n </button>\n </div>\n }\n\n @if (showClearAll() && filtersCount() > 0) {\n <button\n type=\"button\"\n class=\"c-clear-all\"\n [disabled]=\"clearDisabled()\"\n [matTooltip]=\"clearAllLabel()\"\n [attr.aria-label]=\"clearAllLabel()\"\n (click)=\"clear.emit()\">\n <sd-icon name=\"delete_sweep\"></sd-icon>\n </button>\n }\n\n <!-- why: saved-filters dropdown \u0111\u1EB7t s\u00E1t ngay tr\u01B0\u1EDBc Search \u2014 gom to\u00E0n b\u1ED9\n h\u00E0nh \u0111\u1ED9ng v\u1EC1 b\u1ED9 l\u1ECDc (apply view c\u0169 / l\u01B0u view hi\u1EC7n t\u1EA1i) c\u1EA1nh n\u00FAt submit,\n user th\u1EA5y 1 c\u1EE5m. Footer \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\" s\u1ED1ng trong panel c\u1EE7a\n saved-filters-menu, kh\u00F4ng t\u00E1ch ra n\u00FAt ri\u00EAng n\u1EEFa. -->\n @if (showSavedFilters()) {\n <sd-query-saved-filters-menu\n [key]=\"savedFiltersKey()\"\n [query]=\"query()\"\n [canSave]=\"canSaveFilter()\"\n [autoId]=\"autoId()\"\n (apply)=\"applyFilter.emit($event)\" />\n }\n\n <!-- why: far-right \"submit at the end of the toolbar\" position; sole query trigger.\n Hidden when every chip edit applies on its own (bar applyOn: 'commit'). -->\n @if (showSearchButton()) {\n <button\n type=\"button\"\n class=\"c-search-trigger\"\n [disabled]=\"!canSearch()\"\n [matTooltip]=\"searchLabel()\"\n [attr.aria-label]=\"searchLabel()\"\n (click)=\"search.emit()\">\n <sd-icon name=\"search\"></sd-icon>\n </button>\n }\n</div>\n", styles: [":host{display:contents}.c-bar-divider{flex:0 0 auto;align-self:stretch;width:1px;min-height:28px;background:var(--sd-query-bar-border-soft, #e2e4e7)}.c-query-bar__actions{flex:0 0 auto;display:flex;align-items:center;gap:6px}.c-logic-toggle{display:inline-flex;align-items:center;padding:2px;background:var(--sd-query-bar-bg-soft, #f5f6f7);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:6px}:host-context(.c-density-compact) .c-logic-toggle{height:28px}:host-context(.c-density-comfortable) .c-logic-toggle{height:32px}.c-logic-toggle .c-logic-segment{height:100%;padding:0 10px;border:none;background:transparent;font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-semibold, 600);letter-spacing:.4px;color:var(--sd-query-bar-text-secondary, #5f6368);cursor:pointer;border-radius:4px}.c-logic-toggle .c-logic-segment.c-logic-active{background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-primary);box-shadow:0 1px 2px #00000014}.c-clear-all,.c-search-trigger{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368);cursor:pointer;padding:0}:host-context(.c-density-compact) .c-clear-all,:host-context(.c-density-compact) .c-search-trigger{width:28px;height:28px}:host-context(.c-density-comfortable) .c-clear-all,:host-context(.c-density-comfortable) .c-search-trigger{width:32px;height:32px}.c-clear-all sd-icon,.c-search-trigger sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-clear-all:hover:not([disabled]),.c-search-trigger:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-clear-all[disabled],.c-search-trigger[disabled]{opacity:.5;cursor:not-allowed}.c-clear-all:hover{border-color:var(--sd-query-bar-danger, #dc2626);color:var(--sd-query-bar-danger, #dc2626)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdQuerySavedFiltersMenu, selector: "sd-query-saved-filters-menu", inputs: ["key", "query", "canSave", "autoId"], outputs: ["apply"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
211
807
|
}
|
|
212
808
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryActionsBar, decorators: [{
|
|
213
809
|
type: Component,
|
|
214
|
-
args: [{ selector: 'sd-query-actions-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatTooltipModule, SdQuerySavedFiltersMenu], template: "<!-- Vertical separator between the wrapping filter area (left) and the pinned toolbar. -->\n<span class=\"c-bar-divider\" aria-hidden=\"true\"></span>\n\n<div class=\"c-query-bar__actions\">\n <!-- AND / OR toggle -->\n @if (showLogicToggle() && filtersCount() >= 2) {\n <div class=\"c-logic-toggle\" role=\"group\" [attr.aria-label]=\"logicGroupLabel()\">\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'AND'\"\n (click)=\"setLogic('AND')\">\n AND\n </button>\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'OR'\"\n (click)=\"setLogic('OR')\">\n OR\n </button>\n </div>\n }\n\n @if (showClearAll() && filtersCount() > 0) {\n <button\n type=\"button\"\n class=\"c-clear-all\"\n [disabled]=\"clearDisabled()\"\n [matTooltip]=\"clearAllLabel()\"\n [attr.aria-label]=\"clearAllLabel()\"\n (click)=\"clear.emit()\">\n <sd-icon name=\"delete_sweep\"></sd-icon>\n </button>\n }\n\n <!-- why: saved-filters dropdown \u0111\u1EB7t s\u00E1t ngay tr\u01B0\u1EDBc Search \u2014 gom to\u00E0n b\u1ED9\n h\u00E0nh \u0111\u1ED9ng v\u1EC1 b\u1ED9 l\u1ECDc (apply view c\u0169 / l\u01B0u view hi\u1EC7n t\u1EA1i) c\u1EA1nh n\u00FAt submit,\n user th\u1EA5y 1 c\u1EE5m. Footer \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\" s\u1ED1ng trong
|
|
215
|
-
}], propDecorators: { showLogicToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLogicToggle", required: false }] }], logic: [{ type: i0.Input, args: [{ isSignal: true, alias: "logic", required: false }] }, { type: i0.Output, args: ["logicChange"] }], filtersCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "filtersCount", required: false }] }], showSavedFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSavedFilters", required: false }] }], savedFiltersKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "savedFiltersKey", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], applyFilter: [{ type: i0.Output, args: ["applyFilter"] }], showClearAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearAll", required: false }] }], clearCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearCount", required: false }] }], clearDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearDisabled", required: false }] }], clear: [{ type: i0.Output, args: ["clear"] }], canSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSearch", required: false }] }], showSearchButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearchButton", required: false }] }], search: [{ type: i0.Output, args: ["search"] }] } });
|
|
810
|
+
args: [{ selector: 'sd-query-actions-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatTooltipModule, SdQuerySavedFiltersMenu], template: "<!-- Vertical separator between the wrapping filter area (left) and the pinned toolbar. -->\n<span class=\"c-bar-divider\" aria-hidden=\"true\"></span>\n\n<div class=\"c-query-bar__actions\">\n <!-- AND / OR toggle -->\n @if (showLogicToggle() && filtersCount() >= 2) {\n <div class=\"c-logic-toggle\" role=\"group\" [attr.aria-label]=\"logicGroupLabel()\">\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'AND'\"\n (click)=\"setLogic('AND')\">\n AND\n </button>\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'OR'\"\n (click)=\"setLogic('OR')\">\n OR\n </button>\n </div>\n }\n\n @if (showClearAll() && filtersCount() > 0) {\n <button\n type=\"button\"\n class=\"c-clear-all\"\n [disabled]=\"clearDisabled()\"\n [matTooltip]=\"clearAllLabel()\"\n [attr.aria-label]=\"clearAllLabel()\"\n (click)=\"clear.emit()\">\n <sd-icon name=\"delete_sweep\"></sd-icon>\n </button>\n }\n\n <!-- why: saved-filters dropdown \u0111\u1EB7t s\u00E1t ngay tr\u01B0\u1EDBc Search \u2014 gom to\u00E0n b\u1ED9\n h\u00E0nh \u0111\u1ED9ng v\u1EC1 b\u1ED9 l\u1ECDc (apply view c\u0169 / l\u01B0u view hi\u1EC7n t\u1EA1i) c\u1EA1nh n\u00FAt submit,\n user th\u1EA5y 1 c\u1EE5m. Footer \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\" s\u1ED1ng trong panel c\u1EE7a\n saved-filters-menu, kh\u00F4ng t\u00E1ch ra n\u00FAt ri\u00EAng n\u1EEFa. -->\n @if (showSavedFilters()) {\n <sd-query-saved-filters-menu\n [key]=\"savedFiltersKey()\"\n [query]=\"query()\"\n [canSave]=\"canSaveFilter()\"\n [autoId]=\"autoId()\"\n (apply)=\"applyFilter.emit($event)\" />\n }\n\n <!-- why: far-right \"submit at the end of the toolbar\" position; sole query trigger.\n Hidden when every chip edit applies on its own (bar applyOn: 'commit'). -->\n @if (showSearchButton()) {\n <button\n type=\"button\"\n class=\"c-search-trigger\"\n [disabled]=\"!canSearch()\"\n [matTooltip]=\"searchLabel()\"\n [attr.aria-label]=\"searchLabel()\"\n (click)=\"search.emit()\">\n <sd-icon name=\"search\"></sd-icon>\n </button>\n }\n</div>\n", styles: [":host{display:contents}.c-bar-divider{flex:0 0 auto;align-self:stretch;width:1px;min-height:28px;background:var(--sd-query-bar-border-soft, #e2e4e7)}.c-query-bar__actions{flex:0 0 auto;display:flex;align-items:center;gap:6px}.c-logic-toggle{display:inline-flex;align-items:center;padding:2px;background:var(--sd-query-bar-bg-soft, #f5f6f7);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:6px}:host-context(.c-density-compact) .c-logic-toggle{height:28px}:host-context(.c-density-comfortable) .c-logic-toggle{height:32px}.c-logic-toggle .c-logic-segment{height:100%;padding:0 10px;border:none;background:transparent;font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-semibold, 600);letter-spacing:.4px;color:var(--sd-query-bar-text-secondary, #5f6368);cursor:pointer;border-radius:4px}.c-logic-toggle .c-logic-segment.c-logic-active{background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-primary);box-shadow:0 1px 2px #00000014}.c-clear-all,.c-search-trigger{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368);cursor:pointer;padding:0}:host-context(.c-density-compact) .c-clear-all,:host-context(.c-density-compact) .c-search-trigger{width:28px;height:28px}:host-context(.c-density-comfortable) .c-clear-all,:host-context(.c-density-comfortable) .c-search-trigger{width:32px;height:32px}.c-clear-all sd-icon,.c-search-trigger sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-clear-all:hover:not([disabled]),.c-search-trigger:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-clear-all[disabled],.c-search-trigger[disabled]{opacity:.5;cursor:not-allowed}.c-clear-all:hover{border-color:var(--sd-query-bar-danger, #dc2626);color:var(--sd-query-bar-danger, #dc2626)}\n"] }]
|
|
811
|
+
}], propDecorators: { showLogicToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLogicToggle", required: false }] }], logic: [{ type: i0.Input, args: [{ isSignal: true, alias: "logic", required: false }] }, { type: i0.Output, args: ["logicChange"] }], filtersCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "filtersCount", required: false }] }], showSavedFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSavedFilters", required: false }] }], savedFiltersKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "savedFiltersKey", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], canSaveFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSaveFilter", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], applyFilter: [{ type: i0.Output, args: ["applyFilter"] }], showClearAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearAll", required: false }] }], clearCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearCount", required: false }] }], clearDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearDisabled", required: false }] }], clear: [{ type: i0.Output, args: ["clear"] }], canSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSearch", required: false }] }], showSearchButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearchButton", required: false }] }], search: [{ type: i0.Output, args: ["search"] }] } });
|
|
216
812
|
|
|
217
813
|
// ---------------------------------------------------------------------------
|
|
218
814
|
// Constants
|
|
@@ -285,10 +881,25 @@ const DEFAULT_OPERATOR_LIST_CACHE = new WeakMap();
|
|
|
285
881
|
* - `operators` is an array → that array (deduped against the type set is the caller's job)
|
|
286
882
|
* - otherwise (simple mode) → just the single default operator (no real choice)
|
|
287
883
|
*
|
|
884
|
+
* A `required` field never offers `NULL` / `NOT_NULL`: its value cannot be left out (handoff B3).
|
|
885
|
+
*
|
|
288
886
|
* The returned array is referentially stable for a given `field` object, so it is safe to call
|
|
289
887
|
* straight from a template binding.
|
|
290
888
|
*/
|
|
291
889
|
function sdQueryAllowedOperators(field) {
|
|
890
|
+
const operators = baseAllowedOperators(field);
|
|
891
|
+
if (!field.required || !operators.some(op => SD_QUERY_NO_DATA_OPERATORS.includes(op)))
|
|
892
|
+
return operators;
|
|
893
|
+
// why: lọc theo chính mảng gốc (hằng số, mảng của consumer hoặc mảng đã memo) để ref ổn định như nhánh không bắt buộc.
|
|
894
|
+
let required = REQUIRED_OPERATOR_LIST_CACHE.get(operators);
|
|
895
|
+
if (!required) {
|
|
896
|
+
required = operators.filter(op => !SD_QUERY_NO_DATA_OPERATORS.includes(op));
|
|
897
|
+
REQUIRED_OPERATOR_LIST_CACHE.set(operators, required);
|
|
898
|
+
}
|
|
899
|
+
return required;
|
|
900
|
+
}
|
|
901
|
+
const REQUIRED_OPERATOR_LIST_CACHE = new WeakMap();
|
|
902
|
+
function baseAllowedOperators(field) {
|
|
292
903
|
if (field.operators === true)
|
|
293
904
|
return SD_QUERY_OPERATORS_BY_TYPE[field.type];
|
|
294
905
|
if (Array.isArray(field.operators) && field.operators.length > 0)
|
|
@@ -344,6 +955,9 @@ class SdQueryInlineValueChip {
|
|
|
344
955
|
/** Pinned chip — no × segment. */
|
|
345
956
|
pinned = input(false, /* @ts-ignore */
|
|
346
957
|
...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
958
|
+
/** Required field: `aria-required`; a value, once set, cannot be emptied (handoff B3). */
|
|
959
|
+
required = input(false, /* @ts-ignore */
|
|
960
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
347
961
|
/** Required chip without a value — error look while not focused, `aria-invalid`. */
|
|
348
962
|
invalid = input(false, /* @ts-ignore */
|
|
349
963
|
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
@@ -383,6 +997,9 @@ class SdQueryInlineValueChip {
|
|
|
383
997
|
...(ngDevMode ? [{ debugName: "phFrom" }] : /* istanbul ignore next */ []));
|
|
384
998
|
phTo = computed(() => this.#i18n.t(this.isNumber() ? 'core.component.query-bar.placeholder.to-number' : 'core.component.query-bar.placeholder.to-text'), /* @ts-ignore */
|
|
385
999
|
...(ngDevMode ? [{ debugName: "phTo" }] : /* istanbul ignore next */ []));
|
|
1000
|
+
/** `aria-label` of the × — names the field, in the current language. */
|
|
1001
|
+
removeLabel = computed(() => this.#i18n.t('core.component.query-bar.remove-filter', { label: this.field().label }), /* @ts-ignore */
|
|
1002
|
+
...(ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []));
|
|
386
1003
|
hasValue = computed(() => {
|
|
387
1004
|
if (this.isNoData())
|
|
388
1005
|
return true;
|
|
@@ -439,6 +1056,8 @@ class SdQueryInlineValueChip {
|
|
|
439
1056
|
this.hasError.set(true);
|
|
440
1057
|
return;
|
|
441
1058
|
}
|
|
1059
|
+
if (this.#keepsRequired(parsed.value == null || parsed.value === ''))
|
|
1060
|
+
return;
|
|
442
1061
|
this.hasError.set(false);
|
|
443
1062
|
this.valueChange.emit(parsed.value);
|
|
444
1063
|
}
|
|
@@ -451,6 +1070,9 @@ class SdQueryInlineValueChip {
|
|
|
451
1070
|
this.hasError.set(true);
|
|
452
1071
|
return;
|
|
453
1072
|
}
|
|
1073
|
+
const blank = (value) => value == null || value === '';
|
|
1074
|
+
if (this.#keepsRequired(blank(from.value) && blank(to.value)))
|
|
1075
|
+
return;
|
|
454
1076
|
this.hasError.set(false);
|
|
455
1077
|
this.valueChange.emit({ from: from.value, to: to.value });
|
|
456
1078
|
}
|
|
@@ -469,6 +1091,16 @@ class SdQueryInlineValueChip {
|
|
|
469
1091
|
this.focused.set(false);
|
|
470
1092
|
ref?.blur();
|
|
471
1093
|
}
|
|
1094
|
+
/**
|
|
1095
|
+
* B3: emptying the value of a required chip that has one gives the previous value back instead of committing.
|
|
1096
|
+
* `true` when the commit was refused.
|
|
1097
|
+
*/
|
|
1098
|
+
#keepsRequired(empty) {
|
|
1099
|
+
if (!empty || !this.required() || !this.hasValue())
|
|
1100
|
+
return false;
|
|
1101
|
+
this.revertAndBlur();
|
|
1102
|
+
return true;
|
|
1103
|
+
}
|
|
472
1104
|
onRemove(ev) {
|
|
473
1105
|
ev.stopPropagation();
|
|
474
1106
|
this.remove.emit();
|
|
@@ -509,12 +1141,12 @@ class SdQueryInlineValueChip {
|
|
|
509
1141
|
return { ok: true, value: t };
|
|
510
1142
|
}
|
|
511
1143
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineValueChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
512
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineValueChip, isStandalone: true, selector: "sd-query-inline-value-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", remove: "remove" }, viewQueries: [{ propertyName: "firstInput", first: true, predicate: ["firstInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n Seamless string/number chip \u2014 the pill IS the input. One border, three flush\n segments: label \u00B7 input(s) \u00B7 \u00D7. State styling driven by [data-state]. The value\n field is the shared <sd-inline-text> primitive (chrome=\"seamless\") so width hugs\n content; the chip keeps the envelope + parse/commit logic.\n-->\n@let _state = state();\n@let _autoId = autoId();\n@let _isNoData = isNoData();\n@let _density = density();\n@let _operator = operator();\n\n<!-- why: v\u1ECF chip l\u00E0 m\u1ED9t NH\u00D3M control (nh\u00E3n + \u00F4 nh\u1EADp + n\u00FAt \u00D7), kh\u00F4ng ph\u1EA3i n\u00FAt \u2192 role=\"group\" +\n aria-label m\u00F4 t\u1EA3 \u0111\u00FAng c\u1EA5u tr\u00FAc v\u00E0 c\u0169ng cho bi\u1EBFt v\u00EC sao n\u00F3 KH\u00D4NG nh\u1EADn tabindex (tab \u0111i th\u1EB3ng\n v\u00E0o input b\u00EAn trong). `focusFromShell` \u0111\u00E3 t\u1EF1 lo\u1EA1i click tr\u00EAn input v\u00E0 tr\u00EAn n\u00FAt \u00D7 n\u00EAn g\u1EAFn th\u00EAm\n Enter d\u00F9ng chung handler l\u00E0 an to\u00E0n v\u00E0 ph\u1EA3n chi\u1EBFu \u0111\u00FAng h\u00E0nh vi click. -->\n<span\n class=\"c-seamless\"\n role=\"group\"\n [attr.aria-label]=\"field().label\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-state]=\"_state\"\n [class.c-seamless--compact]=\"_density === 'compact'\"\n [class.c-seamless--comfortable]=\"_density === 'comfortable'\"\n (click)=\"focusFromShell($event)\"\n (keydown.enter)=\"focusFromShell($event)\">\n\n <!-- Label segment: icon + field name (+ optional operator pill) -->\n <span class=\"c-seamless__label\">\n <sd-icon class=\"c-seamless__icon\" [name]=\"icon()\"></sd-icon>\n <span class=\"c-seamless__field\">{{ field().label }}</span>\n @if (showOperator() && !_isNoData) {\n <sd-operator class=\"c-seamless__op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-seamless__sep\">:</span>\n }\n </span>\n\n <!-- Input segment \u2014 seamless borderless primitive; hidden for NULL / NOT_NULL -->\n @if (!_isNoData) {\n <span class=\"c-seamless__input\">\n @if (isBetween()) {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draftFrom()\"\n (valueChange)=\"draftFrom.set($event)\"\n [placeholder]=\"phFrom()\"\n [autoId]=\"_autoId ? _autoId + '-from' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n <span class=\"c-seamless__dash\" aria-hidden=\"true\">\u2014</span>\n <sd-inline-text\n #secondInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [state]=\"_state\"\n [value]=\"draftTo()\"\n (valueChange)=\"draftTo.set($event)\"\n [placeholder]=\"phTo()\"\n [autoId]=\"_autoId ? _autoId + '-to' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"secondInput.blur()\"\n (keydownEscape)=\"revertAndBlur(secondInput)\" />\n } @else {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draft()\"\n (valueChange)=\"draft.set($event)\"\n [placeholder]=\"ph()\"\n [autoId]=\"_autoId ?? undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitSingle()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n }\n </span>\n }\n\n <!-- \u00D7 segment \u2014 pinned chips cannot be removed. -->\n @if (!pinned()) {\n <button type=\"button\" class=\"c-seamless__x\" aria-label=\"
|
|
1144
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineValueChip, isStandalone: true, selector: "sd-query-inline-value-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", remove: "remove" }, viewQueries: [{ propertyName: "firstInput", first: true, predicate: ["firstInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n Seamless string/number chip \u2014 the pill IS the input. One border, three flush\n segments: label \u00B7 input(s) \u00B7 \u00D7. State styling driven by [data-state]. The value\n field is the shared <sd-inline-text> primitive (chrome=\"seamless\") so width hugs\n content; the chip keeps the envelope + parse/commit logic.\n-->\n@let _state = state();\n@let _autoId = autoId();\n@let _isNoData = isNoData();\n@let _density = density();\n@let _operator = operator();\n\n<!-- why: v\u1ECF chip l\u00E0 m\u1ED9t NH\u00D3M control (nh\u00E3n + \u00F4 nh\u1EADp + n\u00FAt \u00D7), kh\u00F4ng ph\u1EA3i n\u00FAt \u2192 role=\"group\" +\n aria-label m\u00F4 t\u1EA3 \u0111\u00FAng c\u1EA5u tr\u00FAc v\u00E0 c\u0169ng cho bi\u1EBFt v\u00EC sao n\u00F3 KH\u00D4NG nh\u1EADn tabindex (tab \u0111i th\u1EB3ng\n v\u00E0o input b\u00EAn trong). `focusFromShell` \u0111\u00E3 t\u1EF1 lo\u1EA1i click tr\u00EAn input v\u00E0 tr\u00EAn n\u00FAt \u00D7 n\u00EAn g\u1EAFn th\u00EAm\n Enter d\u00F9ng chung handler l\u00E0 an to\u00E0n v\u00E0 ph\u1EA3n chi\u1EBFu \u0111\u00FAng h\u00E0nh vi click. -->\n<span\n class=\"c-seamless\"\n role=\"group\"\n [attr.aria-label]=\"field().label\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-state]=\"_state\"\n [class.c-seamless--compact]=\"_density === 'compact'\"\n [class.c-seamless--comfortable]=\"_density === 'comfortable'\"\n (click)=\"focusFromShell($event)\"\n (keydown.enter)=\"focusFromShell($event)\">\n\n <!-- Label segment: icon + field name (+ optional operator pill) -->\n <span class=\"c-seamless__label\">\n <sd-icon class=\"c-seamless__icon\" [name]=\"icon()\"></sd-icon>\n <span class=\"c-seamless__field\">{{ field().label }}</span>\n @if (showOperator() && !_isNoData) {\n <sd-operator class=\"c-seamless__op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-seamless__sep\">:</span>\n }\n </span>\n\n <!-- Input segment \u2014 seamless borderless primitive; hidden for NULL / NOT_NULL -->\n @if (!_isNoData) {\n <span class=\"c-seamless__input\">\n @if (isBetween()) {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draftFrom()\"\n (valueChange)=\"draftFrom.set($event)\"\n [placeholder]=\"phFrom()\"\n [autoId]=\"_autoId ? _autoId + '-from' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n <span class=\"c-seamless__dash\" aria-hidden=\"true\">\u2014</span>\n <sd-inline-text\n #secondInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [state]=\"_state\"\n [value]=\"draftTo()\"\n (valueChange)=\"draftTo.set($event)\"\n [placeholder]=\"phTo()\"\n [autoId]=\"_autoId ? _autoId + '-to' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"secondInput.blur()\"\n (keydownEscape)=\"revertAndBlur(secondInput)\" />\n } @else {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draft()\"\n (valueChange)=\"draft.set($event)\"\n [placeholder]=\"ph()\"\n [autoId]=\"_autoId ?? undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitSingle()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n }\n </span>\n }\n\n <!-- \u00D7 segment \u2014 pinned chips cannot be removed. -->\n @if (!pinned()) {\n <button type=\"button\" class=\"c-seamless__x\" [attr.aria-label]=\"removeLabel()\" (click)=\"onRemove($event)\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</span>\n", styles: [":host{display:inline-flex}.c-seamless:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.c-seamless{display:inline-flex;align-items:stretch;border-radius:var(--sd-radius-999, 999px);overflow:hidden;font-family:inherit;font-size:var(--sd-font-size-13, 13px);line-height:1;cursor:text;border:1px solid var(--sd-query-bar-border, #d6d8db);background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.c-seamless--compact{height:28px}.c-seamless--comfortable{height:32px}.c-seamless:hover:not([data-state=focus]):not([data-state=error]){border-color:var(--sd-primary)}.c-seamless[data-state=pending]{border-style:dashed;border-color:var(--sd-query-bar-border, #d6d8db);background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368)}.c-seamless[data-state=active]{border-color:var(--sd-primary-light);background:var(--sd-primary-light)}.c-seamless[data-state=focus]{border-color:var(--sd-primary);background:var(--sd-query-bar-bg, #ffffff);box-shadow:0 0 0 3px var(--sd-primary-light)}.c-seamless[data-state=error]{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535);box-shadow:0 0 0 3px #d235351f}.c-seamless__label{display:inline-flex;align-items:center;gap:4px;font-weight:var(--sd-font-weight-medium, 500);white-space:nowrap;cursor:text;color:inherit}.c-seamless--compact .c-seamless__label{padding:0 0 0 12px}.c-seamless--comfortable .c-seamless__label{padding:0 0 0 14px}.c-seamless__icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;color:inherit}.c-seamless__field{color:inherit}.c-seamless__op{display:inline-flex;align-items:center;color:inherit}.c-seamless__sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-seamless__input{display:inline-flex;align-items:center;gap:4px}.c-seamless--compact .c-seamless__input{padding:0 8px 0 4px}.c-seamless--comfortable .c-seamless__input{padding:0 10px 0 6px}.c-seamless__dash{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-seamless__x{display:inline-flex;align-items:center;justify-content:center;border:0;border-left:1px solid rgba(0,0,0,.04);background:transparent;cursor:pointer;color:inherit}.c-seamless--compact .c-seamless__x{width:26px}.c-seamless--comfortable .c-seamless__x{width:28px}.c-seamless__x sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-seamless__x:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdInlineText, selector: "sd-inline-text", inputs: ["value", "control", "placeholder", "disabled", "clearable", "state", "chrome", "autoId", "autofocus", "minSize"], outputs: ["valueChange", "cleared", "keyupEnter", "keydownEscape", "sdFocus", "sdBlur", "sdKeydown", "sdPaste", "sdCompositionStart", "sdCompositionEnd"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
513
1145
|
}
|
|
514
1146
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineValueChip, decorators: [{
|
|
515
1147
|
type: Component,
|
|
516
|
-
args: [{ selector: 'sd-query-inline-value-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, SdOperator, SdInlineText], template: "<!--\n Seamless string/number chip \u2014 the pill IS the input. One border, three flush\n segments: label \u00B7 input(s) \u00B7 \u00D7. State styling driven by [data-state]. The value\n field is the shared <sd-inline-text> primitive (chrome=\"seamless\") so width hugs\n content; the chip keeps the envelope + parse/commit logic.\n-->\n@let _state = state();\n@let _autoId = autoId();\n@let _isNoData = isNoData();\n@let _density = density();\n@let _operator = operator();\n\n<!-- why: v\u1ECF chip l\u00E0 m\u1ED9t NH\u00D3M control (nh\u00E3n + \u00F4 nh\u1EADp + n\u00FAt \u00D7), kh\u00F4ng ph\u1EA3i n\u00FAt \u2192 role=\"group\" +\n aria-label m\u00F4 t\u1EA3 \u0111\u00FAng c\u1EA5u tr\u00FAc v\u00E0 c\u0169ng cho bi\u1EBFt v\u00EC sao n\u00F3 KH\u00D4NG nh\u1EADn tabindex (tab \u0111i th\u1EB3ng\n v\u00E0o input b\u00EAn trong). `focusFromShell` \u0111\u00E3 t\u1EF1 lo\u1EA1i click tr\u00EAn input v\u00E0 tr\u00EAn n\u00FAt \u00D7 n\u00EAn g\u1EAFn th\u00EAm\n Enter d\u00F9ng chung handler l\u00E0 an to\u00E0n v\u00E0 ph\u1EA3n chi\u1EBFu \u0111\u00FAng h\u00E0nh vi click. -->\n<span\n class=\"c-seamless\"\n role=\"group\"\n [attr.aria-label]=\"field().label\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-state]=\"_state\"\n [class.c-seamless--compact]=\"_density === 'compact'\"\n [class.c-seamless--comfortable]=\"_density === 'comfortable'\"\n (click)=\"focusFromShell($event)\"\n (keydown.enter)=\"focusFromShell($event)\">\n\n <!-- Label segment: icon + field name (+ optional operator pill) -->\n <span class=\"c-seamless__label\">\n <sd-icon class=\"c-seamless__icon\" [name]=\"icon()\"></sd-icon>\n <span class=\"c-seamless__field\">{{ field().label }}</span>\n @if (showOperator() && !_isNoData) {\n <sd-operator class=\"c-seamless__op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-seamless__sep\">:</span>\n }\n </span>\n\n <!-- Input segment \u2014 seamless borderless primitive; hidden for NULL / NOT_NULL -->\n @if (!_isNoData) {\n <span class=\"c-seamless__input\">\n @if (isBetween()) {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draftFrom()\"\n (valueChange)=\"draftFrom.set($event)\"\n [placeholder]=\"phFrom()\"\n [autoId]=\"_autoId ? _autoId + '-from' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n <span class=\"c-seamless__dash\" aria-hidden=\"true\">\u2014</span>\n <sd-inline-text\n #secondInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [state]=\"_state\"\n [value]=\"draftTo()\"\n (valueChange)=\"draftTo.set($event)\"\n [placeholder]=\"phTo()\"\n [autoId]=\"_autoId ? _autoId + '-to' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"secondInput.blur()\"\n (keydownEscape)=\"revertAndBlur(secondInput)\" />\n } @else {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draft()\"\n (valueChange)=\"draft.set($event)\"\n [placeholder]=\"ph()\"\n [autoId]=\"_autoId ?? undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitSingle()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n }\n </span>\n }\n\n <!-- \u00D7 segment \u2014 pinned chips cannot be removed. -->\n @if (!pinned()) {\n <button type=\"button\" class=\"c-seamless__x\" aria-label=\"
|
|
517
|
-
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], operator: [{ type: i0.Input, args: [{ isSignal: true, alias: "operator", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], remove: [{ type: i0.Output, args: ["remove"] }], firstInput: [{ type: i0.ViewChild, args: ['firstInput', { isSignal: true }] }] } });
|
|
1148
|
+
args: [{ selector: 'sd-query-inline-value-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, SdOperator, SdInlineText], template: "<!--\n Seamless string/number chip \u2014 the pill IS the input. One border, three flush\n segments: label \u00B7 input(s) \u00B7 \u00D7. State styling driven by [data-state]. The value\n field is the shared <sd-inline-text> primitive (chrome=\"seamless\") so width hugs\n content; the chip keeps the envelope + parse/commit logic.\n-->\n@let _state = state();\n@let _autoId = autoId();\n@let _isNoData = isNoData();\n@let _density = density();\n@let _operator = operator();\n\n<!-- why: v\u1ECF chip l\u00E0 m\u1ED9t NH\u00D3M control (nh\u00E3n + \u00F4 nh\u1EADp + n\u00FAt \u00D7), kh\u00F4ng ph\u1EA3i n\u00FAt \u2192 role=\"group\" +\n aria-label m\u00F4 t\u1EA3 \u0111\u00FAng c\u1EA5u tr\u00FAc v\u00E0 c\u0169ng cho bi\u1EBFt v\u00EC sao n\u00F3 KH\u00D4NG nh\u1EADn tabindex (tab \u0111i th\u1EB3ng\n v\u00E0o input b\u00EAn trong). `focusFromShell` \u0111\u00E3 t\u1EF1 lo\u1EA1i click tr\u00EAn input v\u00E0 tr\u00EAn n\u00FAt \u00D7 n\u00EAn g\u1EAFn th\u00EAm\n Enter d\u00F9ng chung handler l\u00E0 an to\u00E0n v\u00E0 ph\u1EA3n chi\u1EBFu \u0111\u00FAng h\u00E0nh vi click. -->\n<span\n class=\"c-seamless\"\n role=\"group\"\n [attr.aria-label]=\"field().label\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-state]=\"_state\"\n [class.c-seamless--compact]=\"_density === 'compact'\"\n [class.c-seamless--comfortable]=\"_density === 'comfortable'\"\n (click)=\"focusFromShell($event)\"\n (keydown.enter)=\"focusFromShell($event)\">\n\n <!-- Label segment: icon + field name (+ optional operator pill) -->\n <span class=\"c-seamless__label\">\n <sd-icon class=\"c-seamless__icon\" [name]=\"icon()\"></sd-icon>\n <span class=\"c-seamless__field\">{{ field().label }}</span>\n @if (showOperator() && !_isNoData) {\n <sd-operator class=\"c-seamless__op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-seamless__sep\">:</span>\n }\n </span>\n\n <!-- Input segment \u2014 seamless borderless primitive; hidden for NULL / NOT_NULL -->\n @if (!_isNoData) {\n <span class=\"c-seamless__input\">\n @if (isBetween()) {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draftFrom()\"\n (valueChange)=\"draftFrom.set($event)\"\n [placeholder]=\"phFrom()\"\n [autoId]=\"_autoId ? _autoId + '-from' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n <span class=\"c-seamless__dash\" aria-hidden=\"true\">\u2014</span>\n <sd-inline-text\n #secondInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [state]=\"_state\"\n [value]=\"draftTo()\"\n (valueChange)=\"draftTo.set($event)\"\n [placeholder]=\"phTo()\"\n [autoId]=\"_autoId ? _autoId + '-to' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"secondInput.blur()\"\n (keydownEscape)=\"revertAndBlur(secondInput)\" />\n } @else {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draft()\"\n (valueChange)=\"draft.set($event)\"\n [placeholder]=\"ph()\"\n [autoId]=\"_autoId ?? undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitSingle()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n }\n </span>\n }\n\n <!-- \u00D7 segment \u2014 pinned chips cannot be removed. -->\n @if (!pinned()) {\n <button type=\"button\" class=\"c-seamless__x\" [attr.aria-label]=\"removeLabel()\" (click)=\"onRemove($event)\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</span>\n", styles: [":host{display:inline-flex}.c-seamless:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.c-seamless{display:inline-flex;align-items:stretch;border-radius:var(--sd-radius-999, 999px);overflow:hidden;font-family:inherit;font-size:var(--sd-font-size-13, 13px);line-height:1;cursor:text;border:1px solid var(--sd-query-bar-border, #d6d8db);background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}.c-seamless--compact{height:28px}.c-seamless--comfortable{height:32px}.c-seamless:hover:not([data-state=focus]):not([data-state=error]){border-color:var(--sd-primary)}.c-seamless[data-state=pending]{border-style:dashed;border-color:var(--sd-query-bar-border, #d6d8db);background:var(--sd-query-bar-bg, #ffffff);color:var(--sd-query-bar-text-secondary, #5f6368)}.c-seamless[data-state=active]{border-color:var(--sd-primary-light);background:var(--sd-primary-light)}.c-seamless[data-state=focus]{border-color:var(--sd-primary);background:var(--sd-query-bar-bg, #ffffff);box-shadow:0 0 0 3px var(--sd-primary-light)}.c-seamless[data-state=error]{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535);box-shadow:0 0 0 3px #d235351f}.c-seamless__label{display:inline-flex;align-items:center;gap:4px;font-weight:var(--sd-font-weight-medium, 500);white-space:nowrap;cursor:text;color:inherit}.c-seamless--compact .c-seamless__label{padding:0 0 0 12px}.c-seamless--comfortable .c-seamless__label{padding:0 0 0 14px}.c-seamless__icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;color:inherit}.c-seamless__field{color:inherit}.c-seamless__op{display:inline-flex;align-items:center;color:inherit}.c-seamless__sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-seamless__input{display:inline-flex;align-items:center;gap:4px}.c-seamless--compact .c-seamless__input{padding:0 8px 0 4px}.c-seamless--comfortable .c-seamless__input{padding:0 10px 0 6px}.c-seamless__dash{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-seamless__x{display:inline-flex;align-items:center;justify-content:center;border:0;border-left:1px solid rgba(0,0,0,.04);background:transparent;cursor:pointer;color:inherit}.c-seamless--compact .c-seamless__x{width:26px}.c-seamless--comfortable .c-seamless__x{width:28px}.c-seamless__x sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-seamless__x:hover{background:#0000000d}\n"] }]
|
|
1149
|
+
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], operator: [{ type: i0.Input, args: [{ isSignal: true, alias: "operator", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], remove: [{ type: i0.Output, args: ["remove"] }], firstInput: [{ type: i0.ViewChild, args: ['firstInput', { isSignal: true }] }] } });
|
|
518
1150
|
|
|
519
1151
|
/**
|
|
520
1152
|
* Visual block for the in-progress build chip (inline mode token builder).
|
|
@@ -612,31 +1244,51 @@ class SdQueryBuildChip {
|
|
|
612
1244
|
}, /* @ts-ignore */
|
|
613
1245
|
...(ngDevMode ? [{ debugName: "isSeamless" }] : /* istanbul ignore next */ []));
|
|
614
1246
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBuildChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
615
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBuildChip, isStandalone: true, selector: "sd-query-build-chip", inputs: { building: { classPropertyName: "building", publicName: "building", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, allowedOperators: { classPropertyName: "allowedOperators", publicName: "allowedOperators", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pickOperator: "pickOperator", commitValue: "commitValue", cancel: "cancel", seamlessCommit: "seamlessCommit", draftChange: "draftChange", draftCommit: "draftCommit" }, viewQueries: [{ propertyName: "opMenu", first: true, predicate: ["buildOperator"], descendants: true, isSignal: true }, { propertyName: "picker", first: true, predicate: ["bPicker"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n In-progress chip (inline-mode token build flow).\n Seamless string/number branch keeps its own pill; everything else renders inside\n the dashed .c-token.c-token-building shell.\n-->\n@let _building = building();\n@let _autoId = autoId();\n\n@if (isSeamless()) {\n <sd-query-inline-value-chip\n [field]=\"_building.field\"\n [operator]=\"$any(_building.operator)\"\n [value]=\"_building.value ?? null\"\n [density]=\"density()\"\n [showOperator]=\"showOperator()\"\n [autoId]=\"_autoId\"\n [autofocus]=\"true\"\n (valueChange)=\"seamlessCommit.emit($event)\"\n (remove)=\"cancel.emit()\" />\n} @else {\n <div class=\"c-token c-token-building\">\n <span class=\"c-token-field\">{{ _building.field.label }}</span>\n\n @if (_building.step === 'operator') {\n <sd-operator\n #buildOperator\n class=\"c-token-op\"\n size=\"xs\"\n [operators]=\"allowedOperators()\"\n [model]=\"_building.operator\"\n (modelChange)=\"pickOperator.emit($any($event))\" />\n } @else {\n <!-- why: operator \u0111\u00E3 ch\u1ECDn hi\u1EC7n nh\u01B0 chip ho\u00E0n th\u00E0nh \u2014 glyph ch\u1EC9-xem c\u00F3 t\u00EAn v\u00E0 tooltip (readonly), kh\u00F4ng ph\u1EA3i n\u00FAt\n disabled n\u00EAn tooltip v\u1EABn ch\u1EA1y. -->\n <sd-operator\n class=\"c-token-op\"\n [operators]=\"[$any(_building.operator)]\"\n [model]=\"$any(_building.operator)\"\n size=\"xs\"\n readonly />\n\n @if (_building.field.type === 'values' || _building.field.type === 'lazy-values') {\n @let _bopt = $any(_building.field).option;\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_building.field.type === 'lazy-values' ? $any(_bopt).search : $any(_bopt.items)\"\n [valueField]=\"_bopt.valueField\"\n [displayField]=\"_bopt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\">\n <!-- why: build chip multi-select c\u0169ng c\u1EA7n \"head +N\" \u0111\u1EC3 g\u1ECDn (gi\u1ED1ng completed chip). -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_building.field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: 1 sd-date-range thay 2 sd-date \u2014 g\u1ECDn h\u01A1n, h\u00E0nh vi th\u1ED1ng nh\u1EA5t v\u1EDBi completed chip. -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-date #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date>\n }\n </span>\n } @else if (_building.field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: datetime BETWEEN downgrade v\u1EC1 date-range (m\u1EA5t time precision; \u0111\u00E3 th\u1ED1ng nh\u1EA5t). -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-datetime #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-datetime>\n }\n </span>\n } @else if (_building.field.type === 'boolean') {\n <!-- why: native button thay sd-button (tr\u00E1nh mat-button baseline 36px g\u00E2y tr\u00E0n).\n Pill nh\u1ECF v\u1EBD b\u1EB1ng CSS scoped trong chip \u2014 gi\u1EEF semantic colour qua class\n .c-bool-true / .c-bool-false. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_building.value === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"commitValue.emit(true)\">\n {{ $any(_building.field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_building.value === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"commitValue.emit(false)\">\n {{ $any(_building.field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <!-- Fallback (e.g. unforeseen type) \u2014 generic sd-input wired via draft outputs. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-input size=\"sm\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"draftChange.emit($event)\"\n (keyupEnter)=\"draftCommit.emit()\"></sd-input>\n </span>\n }\n }\n\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Cancel\" (click)=\"cancel.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary)}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-building{border-style:dashed}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus", "pinned", "invalid", "describedBy"], outputs: ["valueChange", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1247
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBuildChip, isStandalone: true, selector: "sd-query-build-chip", inputs: { building: { classPropertyName: "building", publicName: "building", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, allowedOperators: { classPropertyName: "allowedOperators", publicName: "allowedOperators", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pickOperator: "pickOperator", commitValue: "commitValue", cancel: "cancel", seamlessCommit: "seamlessCommit", draftChange: "draftChange", draftCommit: "draftCommit" }, viewQueries: [{ propertyName: "opMenu", first: true, predicate: ["buildOperator"], descendants: true, isSignal: true }, { propertyName: "picker", first: true, predicate: ["bPicker"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n In-progress chip (inline-mode token build flow).\n Seamless string/number branch keeps its own pill; everything else renders inside\n the dashed .c-token.c-token-building shell.\n-->\n@let _building = building();\n@let _autoId = autoId();\n\n@if (isSeamless()) {\n <sd-query-inline-value-chip\n [field]=\"_building.field\"\n [operator]=\"$any(_building.operator)\"\n [value]=\"_building.value ?? null\"\n [density]=\"density()\"\n [showOperator]=\"showOperator()\"\n [autoId]=\"_autoId\"\n [autofocus]=\"true\"\n (valueChange)=\"seamlessCommit.emit($event)\"\n (remove)=\"cancel.emit()\" />\n} @else {\n <div class=\"c-token c-token-building\">\n <span class=\"c-token-field\">{{ _building.field.label }}</span>\n\n @if (_building.step === 'operator') {\n <sd-operator\n #buildOperator\n class=\"c-token-op\"\n size=\"xs\"\n [operators]=\"allowedOperators()\"\n [model]=\"_building.operator\"\n (modelChange)=\"pickOperator.emit($any($event))\" />\n } @else {\n <!-- why: operator \u0111\u00E3 ch\u1ECDn hi\u1EC7n nh\u01B0 chip ho\u00E0n th\u00E0nh \u2014 glyph ch\u1EC9-xem c\u00F3 t\u00EAn v\u00E0 tooltip (readonly), kh\u00F4ng ph\u1EA3i n\u00FAt\n disabled n\u00EAn tooltip v\u1EABn ch\u1EA1y. -->\n <sd-operator\n class=\"c-token-op\"\n [operators]=\"[$any(_building.operator)]\"\n [model]=\"$any(_building.operator)\"\n size=\"xs\"\n readonly />\n\n @if (_building.field.type === 'values' || _building.field.type === 'lazy-values') {\n @let _bopt = $any(_building.field).option;\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_building.field.type === 'lazy-values' ? $any(_bopt).search : $any(_bopt.items)\"\n [valueField]=\"_bopt.valueField\"\n [displayField]=\"_bopt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\">\n <!-- why: build chip multi-select c\u0169ng c\u1EA7n \"head +N\" \u0111\u1EC3 g\u1ECDn (gi\u1ED1ng completed chip). -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_building.field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: 1 sd-date-range thay 2 sd-date \u2014 g\u1ECDn h\u01A1n, h\u00E0nh vi th\u1ED1ng nh\u1EA5t v\u1EDBi completed chip. -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-date #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date>\n }\n </span>\n } @else if (_building.field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: datetime BETWEEN downgrade v\u1EC1 date-range (m\u1EA5t time precision; \u0111\u00E3 th\u1ED1ng nh\u1EA5t). -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-datetime #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-datetime>\n }\n </span>\n } @else if (_building.field.type === 'boolean') {\n <!-- why: native button thay sd-button (tr\u00E1nh mat-button baseline 36px g\u00E2y tr\u00E0n).\n Pill nh\u1ECF v\u1EBD b\u1EB1ng CSS scoped trong chip \u2014 gi\u1EEF semantic colour qua class\n .c-bool-true / .c-bool-false. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_building.value === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"commitValue.emit(true)\">\n {{ $any(_building.field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_building.value === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"commitValue.emit(false)\">\n {{ $any(_building.field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <!-- Fallback (e.g. unforeseen type) \u2014 generic sd-input wired via draft outputs. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-input size=\"sm\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"draftChange.emit($event)\"\n (keyupEnter)=\"draftCommit.emit()\"></sd-input>\n </span>\n }\n }\n\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Cancel\" (click)=\"cancel.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary)}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-building{border-style:dashed}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus", "pinned", "required", "invalid", "describedBy"], outputs: ["valueChange", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
616
1248
|
}
|
|
617
1249
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBuildChip, decorators: [{
|
|
618
1250
|
type: Component,
|
|
619
1251
|
args: [{ selector: 'sd-query-build-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, CommonModule, SdOperator, SdDate, SdDateRange, SdDatetime, SdInput, SdInputNumber, SdSelect, SdQueryInlineValueChip], template: "<!--\n In-progress chip (inline-mode token build flow).\n Seamless string/number branch keeps its own pill; everything else renders inside\n the dashed .c-token.c-token-building shell.\n-->\n@let _building = building();\n@let _autoId = autoId();\n\n@if (isSeamless()) {\n <sd-query-inline-value-chip\n [field]=\"_building.field\"\n [operator]=\"$any(_building.operator)\"\n [value]=\"_building.value ?? null\"\n [density]=\"density()\"\n [showOperator]=\"showOperator()\"\n [autoId]=\"_autoId\"\n [autofocus]=\"true\"\n (valueChange)=\"seamlessCommit.emit($event)\"\n (remove)=\"cancel.emit()\" />\n} @else {\n <div class=\"c-token c-token-building\">\n <span class=\"c-token-field\">{{ _building.field.label }}</span>\n\n @if (_building.step === 'operator') {\n <sd-operator\n #buildOperator\n class=\"c-token-op\"\n size=\"xs\"\n [operators]=\"allowedOperators()\"\n [model]=\"_building.operator\"\n (modelChange)=\"pickOperator.emit($any($event))\" />\n } @else {\n <!-- why: operator \u0111\u00E3 ch\u1ECDn hi\u1EC7n nh\u01B0 chip ho\u00E0n th\u00E0nh \u2014 glyph ch\u1EC9-xem c\u00F3 t\u00EAn v\u00E0 tooltip (readonly), kh\u00F4ng ph\u1EA3i n\u00FAt\n disabled n\u00EAn tooltip v\u1EABn ch\u1EA1y. -->\n <sd-operator\n class=\"c-token-op\"\n [operators]=\"[$any(_building.operator)]\"\n [model]=\"$any(_building.operator)\"\n size=\"xs\"\n readonly />\n\n @if (_building.field.type === 'values' || _building.field.type === 'lazy-values') {\n @let _bopt = $any(_building.field).option;\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_building.field.type === 'lazy-values' ? $any(_bopt).search : $any(_bopt.items)\"\n [valueField]=\"_bopt.valueField\"\n [displayField]=\"_bopt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\">\n <!-- why: build chip multi-select c\u0169ng c\u1EA7n \"head +N\" \u0111\u1EC3 g\u1ECDn (gi\u1ED1ng completed chip). -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_building.field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: 1 sd-date-range thay 2 sd-date \u2014 g\u1ECDn h\u01A1n, h\u00E0nh vi th\u1ED1ng nh\u1EA5t v\u1EDBi completed chip. -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-date #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date>\n }\n </span>\n } @else if (_building.field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: datetime BETWEEN downgrade v\u1EC1 date-range (m\u1EA5t time precision; \u0111\u00E3 th\u1ED1ng nh\u1EA5t). -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-datetime #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-datetime>\n }\n </span>\n } @else if (_building.field.type === 'boolean') {\n <!-- why: native button thay sd-button (tr\u00E1nh mat-button baseline 36px g\u00E2y tr\u00E0n).\n Pill nh\u1ECF v\u1EBD b\u1EB1ng CSS scoped trong chip \u2014 gi\u1EEF semantic colour qua class\n .c-bool-true / .c-bool-false. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_building.value === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"commitValue.emit(true)\">\n {{ $any(_building.field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_building.value === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"commitValue.emit(false)\">\n {{ $any(_building.field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <!-- Fallback (e.g. unforeseen type) \u2014 generic sd-input wired via draft outputs. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-input size=\"sm\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"draftChange.emit($event)\"\n (keyupEnter)=\"draftCommit.emit()\"></sd-input>\n </span>\n }\n }\n\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Cancel\" (click)=\"cancel.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary)}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-building{border-style:dashed}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"] }]
|
|
620
1252
|
}], propDecorators: { building: [{ type: i0.Input, args: [{ isSignal: true, alias: "building", required: true }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], allowedOperators: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowedOperators", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], pickOperator: [{ type: i0.Output, args: ["pickOperator"] }], commitValue: [{ type: i0.Output, args: ["commitValue"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], seamlessCommit: [{ type: i0.Output, args: ["seamlessCommit"] }], draftChange: [{ type: i0.Output, args: ["draftChange"] }], draftCommit: [{ type: i0.Output, args: ["draftCommit"] }], opMenu: [{ type: i0.ViewChild, args: ['buildOperator', { isSignal: true }] }], picker: [{ type: i0.ViewChild, args: ['bPicker', { isSignal: true }] }] } });
|
|
621
1253
|
|
|
1254
|
+
const hasValue$1 = (value) => value !== null && value !== undefined && value !== '';
|
|
1255
|
+
/**
|
|
1256
|
+
* A chip is "active" when it has a non-empty value OR a no-data operator (NULL / NOT_NULL). A BETWEEN range is active
|
|
1257
|
+
* when either end is set; `{ from: null, to: null }` is empty. Shared by the bar and the chip popover.
|
|
1258
|
+
*
|
|
1259
|
+
* Internal (`ɵ`): not exported from the entry point.
|
|
1260
|
+
*/
|
|
1261
|
+
function ɵsdQueryFilterActive(filter) {
|
|
1262
|
+
if (SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
1263
|
+
return true;
|
|
1264
|
+
const data = filter.data;
|
|
1265
|
+
if (data === null || data === undefined || data === '')
|
|
1266
|
+
return false;
|
|
1267
|
+
if (Array.isArray(data))
|
|
1268
|
+
return data.length > 0;
|
|
1269
|
+
if (filter.operator === 'BETWEEN' && typeof data === 'object') {
|
|
1270
|
+
const range = data;
|
|
1271
|
+
return hasValue$1(range.from) || hasValue$1(range.to);
|
|
1272
|
+
}
|
|
1273
|
+
return true;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
let nextLabelId = 0;
|
|
622
1277
|
/**
|
|
623
|
-
* Popover-mode chip editor — the
|
|
624
|
-
*
|
|
1278
|
+
* Popover-mode chip editor — the dialog panel that opens when a popover-mode chip is clicked (handoff section 4).
|
|
1279
|
+
* Owns ALL operator+value staging signals and async option loading.
|
|
625
1280
|
*
|
|
626
1281
|
* why: tách khỏi `<sd-query-bar>` để parent chỉ giữ `editingIndex` (chip nào đang
|
|
627
1282
|
* mở) + nhận `(commit)` khi popover đóng. Mỗi lần parent gọi `seed(filter, field)`
|
|
628
1283
|
* trước khi mở chip popover, child reset staging signals + kích option loading.
|
|
629
1284
|
*
|
|
630
1285
|
* Public surface (template ref `#cp`):
|
|
631
|
-
* - `cp.
|
|
632
|
-
* - `cp.seed(filter, field)` — parent reseeds staging before
|
|
633
|
-
* - `(commit)` output — emitted
|
|
634
|
-
* - `(swapField)` output — emitted when the nested field switcher picks a new field
|
|
1286
|
+
* - `cp.panel()` — the panel to feed `[panel]` of `<sd-query-popover-chip>`
|
|
1287
|
+
* - `cp.seed(filter, field, index)` — parent reseeds staging before the panel renders
|
|
1288
|
+
* - `(commit)` output — emitted when the panel closes (Esc, click outside, Tab out, close) with the staged Filter
|
|
635
1289
|
*/
|
|
636
1290
|
class SdQueryChipPopover {
|
|
637
1291
|
#i18n = inject(I18nService);
|
|
638
|
-
swapFieldTooltip = computed(() => this.#i18n.t('core.component.query-bar.swap-field'), /* @ts-ignore */
|
|
639
|
-
...(ngDevMode ? [{ debugName: "swapFieldTooltip" }] : /* istanbul ignore next */ []));
|
|
640
1292
|
fromPlaceholder = computed(() => this.#i18n.t('core.component.query-bar.placeholder.from-number'), /* @ts-ignore */
|
|
641
1293
|
...(ngDevMode ? [{ debugName: "fromPlaceholder" }] : /* istanbul ignore next */ []));
|
|
642
1294
|
toPlaceholder = computed(() => this.#i18n.t('core.component.query-bar.placeholder.to-number'), /* @ts-ignore */
|
|
@@ -651,6 +1303,8 @@ class SdQueryChipPopover {
|
|
|
651
1303
|
...(ngDevMode ? [{ debugName: "enterValuePlaceholder" }] : /* istanbul ignore next */ []));
|
|
652
1304
|
loadingValuesLabel = computed(() => this.#i18n.t('core.component.query-bar.loading-values'), /* @ts-ignore */
|
|
653
1305
|
...(ngDevMode ? [{ debugName: "loadingValuesLabel" }] : /* istanbul ignore next */ []));
|
|
1306
|
+
minOneLabel = computed(() => this.#i18n.t('core.component.query-bar.required-min-one'), /* @ts-ignore */
|
|
1307
|
+
...(ngDevMode ? [{ debugName: "minOneLabel" }] : /* istanbul ignore next */ []));
|
|
654
1308
|
// ---------------------------------------------------------------------------
|
|
655
1309
|
// Inputs
|
|
656
1310
|
// ---------------------------------------------------------------------------
|
|
@@ -666,18 +1320,13 @@ class SdQueryChipPopover {
|
|
|
666
1320
|
/** Prefix for `data-autoId` on inner controls. */
|
|
667
1321
|
autoIdBase = input('qb', /* @ts-ignore */
|
|
668
1322
|
...(ngDevMode ? [{ debugName: "autoIdBase" }] : /* istanbul ignore next */ []));
|
|
669
|
-
/** MatMenu for the field switcher — parent passes its `<sd-query-field-picker>` menu. */
|
|
670
|
-
switchPickerMenu = input(undefined, /* @ts-ignore */
|
|
671
|
-
...(ngDevMode ? [{ debugName: "switchPickerMenu" }] : /* istanbul ignore next */ []));
|
|
672
1323
|
// ---------------------------------------------------------------------------
|
|
673
1324
|
// Outputs
|
|
674
1325
|
// ---------------------------------------------------------------------------
|
|
675
|
-
/** Emitted when
|
|
1326
|
+
/** Emitted when the panel closes — parent splices `next` into filters[idx]. */
|
|
676
1327
|
commit = output();
|
|
677
|
-
/** Emitted when nested field-switcher picks a new field — parent calls changeFilterField. */
|
|
678
|
-
swapField = output();
|
|
679
1328
|
// ---------------------------------------------------------------------------
|
|
680
|
-
// Staging signals — uncommitted edits, committed
|
|
1329
|
+
// Staging signals — uncommitted edits, committed when the panel closes.
|
|
681
1330
|
// ---------------------------------------------------------------------------
|
|
682
1331
|
/** Staged operator. */
|
|
683
1332
|
editingOperator = signal('EQUAL', /* @ts-ignore */
|
|
@@ -691,16 +1340,34 @@ class SdQueryChipPopover {
|
|
|
691
1340
|
/** Loading flag for async option fetch. */
|
|
692
1341
|
editingOptionsLoading = signal(false, /* @ts-ignore */
|
|
693
1342
|
...(ngDevMode ? [{ debugName: "editingOptionsLoading" }] : /* istanbul ignore next */ []));
|
|
1343
|
+
// why: `seed()` chạy trước khi panel vẽ nội dung, còn `[field]` / `[filter]` / `[chipIndex]` của cha chỉ cập nhật ở lượt
|
|
1344
|
+
// change detection sau — giữ bản seed để lần vẽ đầu (và focus đầu tiên) đã đúng field.
|
|
1345
|
+
#seededField = signal(undefined, /* @ts-ignore */
|
|
1346
|
+
...(ngDevMode ? [{ debugName: "#seededField" }] : /* istanbul ignore next */ []));
|
|
1347
|
+
#seededFilter = signal(undefined, /* @ts-ignore */
|
|
1348
|
+
...(ngDevMode ? [{ debugName: "#seededFilter" }] : /* istanbul ignore next */ []));
|
|
1349
|
+
#seededIndex = signal(null, /* @ts-ignore */
|
|
1350
|
+
...(ngDevMode ? [{ debugName: "#seededIndex" }] : /* istanbul ignore next */ []));
|
|
1351
|
+
/** Field being edited: the one seeded last, else the `[field]` input. */
|
|
1352
|
+
currentField = computed(() => this.#seededField() ?? this.field(), /* @ts-ignore */
|
|
1353
|
+
...(ngDevMode ? [{ debugName: "currentField" }] : /* istanbul ignore next */ []));
|
|
1354
|
+
/** The field is required: no empty selection, no clear button (handoff B3). */
|
|
1355
|
+
required = computed(() => !!this.currentField()?.required, /* @ts-ignore */
|
|
1356
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
1357
|
+
/** "Choose at least one value." after a required multi-value chip was refused an empty selection. */
|
|
1358
|
+
minOneHint = signal(false, /* @ts-ignore */
|
|
1359
|
+
...(ngDevMode ? [{ debugName: "minOneHint" }] : /* istanbul ignore next */ []));
|
|
1360
|
+
hintId = `sd-query-chip-popover-hint-${nextLabelId}`;
|
|
694
1361
|
// ---------------------------------------------------------------------------
|
|
695
1362
|
// Derived state
|
|
696
1363
|
// ---------------------------------------------------------------------------
|
|
697
1364
|
allowedOperators = computed(() => {
|
|
698
|
-
const f = this.
|
|
1365
|
+
const f = this.currentField();
|
|
699
1366
|
return f ? sdQueryAllowedOperators(f) : [];
|
|
700
1367
|
}, /* @ts-ignore */
|
|
701
1368
|
...(ngDevMode ? [{ debugName: "allowedOperators" }] : /* istanbul ignore next */ []));
|
|
702
1369
|
showOperatorSelector = computed(() => {
|
|
703
|
-
const f = this.
|
|
1370
|
+
const f = this.currentField();
|
|
704
1371
|
return f ? sdQueryShowOperatorSelector(f) : false;
|
|
705
1372
|
}, /* @ts-ignore */
|
|
706
1373
|
...(ngDevMode ? [{ debugName: "showOperatorSelector" }] : /* istanbul ignore next */ []));
|
|
@@ -715,21 +1382,27 @@ class SdQueryChipPopover {
|
|
|
715
1382
|
/** Compose an autoId for an inner control (`<base>-chip<idx>-<role>`). */
|
|
716
1383
|
chipAutoId(role) {
|
|
717
1384
|
const base = this.autoIdBase() ?? 'qb';
|
|
718
|
-
const idx = this.chipIndex();
|
|
1385
|
+
const idx = this.#seededIndex() ?? this.chipIndex();
|
|
719
1386
|
return `${base}-chip${idx ?? 'x'}-${role}`;
|
|
720
1387
|
}
|
|
721
1388
|
iconFor = sdQueryFieldIcon;
|
|
722
1389
|
// ---------------------------------------------------------------------------
|
|
723
|
-
//
|
|
1390
|
+
// Panel — the chip trigger binds `[panel]="cp.panel()"`
|
|
724
1391
|
// ---------------------------------------------------------------------------
|
|
725
|
-
|
|
726
|
-
...(ngDevMode ? [{ debugName: "
|
|
1392
|
+
panel = viewChild.required('panel', /* @ts-ignore */
|
|
1393
|
+
...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
|
|
1394
|
+
/** Id of the field label in the header — the dialog's accessible name. */
|
|
1395
|
+
labelId = `sd-query-chip-popover-label-${nextLabelId++}`;
|
|
727
1396
|
// ---------------------------------------------------------------------------
|
|
728
1397
|
// Seed — parent calls before opening the popover so staging signals are
|
|
729
1398
|
// primed from the current filter + the option list is loaded.
|
|
730
1399
|
// ---------------------------------------------------------------------------
|
|
731
|
-
/** Reseed staging from a new filter/field pair — call before
|
|
732
|
-
seed(filter, field) {
|
|
1400
|
+
/** Reseed staging from a new filter/field pair — call before the panel renders (`panelOpened`). */
|
|
1401
|
+
seed(filter, field, index = null) {
|
|
1402
|
+
this.#seededField.set(filter && field ? field : undefined);
|
|
1403
|
+
this.#seededFilter.set(filter && field ? filter : undefined);
|
|
1404
|
+
this.#seededIndex.set(filter && field ? index : null);
|
|
1405
|
+
this.minOneHint.set(false);
|
|
733
1406
|
if (!filter || !field) {
|
|
734
1407
|
this.editingOperator.set('EQUAL');
|
|
735
1408
|
this.editingValue.set(null);
|
|
@@ -779,8 +1452,16 @@ class SdQueryChipPopover {
|
|
|
779
1452
|
this.editingValue.set(Array.isArray(v) && v.length > 0 ? v[0] : null);
|
|
780
1453
|
}
|
|
781
1454
|
}
|
|
782
|
-
/**
|
|
1455
|
+
/** Value control change. A required multi-value chip keeps its values when the change would empty it (B3). */
|
|
783
1456
|
onEditingValueInput(value) {
|
|
1457
|
+
if (this.required() && Array.isArray(value) && value.length === 0) {
|
|
1458
|
+
// why: bản sao mới (không phải cùng mảng) để sd-select nhận lại model và bỏ phần bỏ chọn nó đang hiện.
|
|
1459
|
+
const previous = this.editingValue();
|
|
1460
|
+
this.editingValue.set(Array.isArray(previous) ? [...previous] : previous);
|
|
1461
|
+
this.minOneHint.set(true);
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
this.minOneHint.set(false);
|
|
784
1465
|
this.editingValue.set(value);
|
|
785
1466
|
}
|
|
786
1467
|
/** BETWEEN range — mutate only `.from`. */
|
|
@@ -808,21 +1489,30 @@ class SdQueryChipPopover {
|
|
|
808
1489
|
return Array.isArray(v) && v.includes(value);
|
|
809
1490
|
}
|
|
810
1491
|
// ---------------------------------------------------------------------------
|
|
811
|
-
//
|
|
1492
|
+
// Panel lifecycle — close = commit
|
|
812
1493
|
// ---------------------------------------------------------------------------
|
|
813
1494
|
/**
|
|
814
|
-
*
|
|
815
|
-
* emit (commit). Parent splices into its filters[] and nulls editingIndex.
|
|
1495
|
+
* The panel closed (Esc, click outside, Tab out, `closeMenu()`, another panel opened): compose the next Filter from
|
|
1496
|
+
* staging signals and emit (commit). Parent splices into its filters[] and nulls editingIndex.
|
|
816
1497
|
*/
|
|
817
|
-
onMenuClosed() {
|
|
818
|
-
const f = this.filter();
|
|
1498
|
+
onMenuClosed(_reason) {
|
|
1499
|
+
const f = this.#seededFilter() ?? this.filter();
|
|
1500
|
+
const field = this.#seededField() ?? this.field();
|
|
1501
|
+
this.#seededField.set(undefined);
|
|
1502
|
+
this.#seededFilter.set(undefined);
|
|
1503
|
+
this.#seededIndex.set(null);
|
|
1504
|
+
this.minOneHint.set(false);
|
|
819
1505
|
if (!f)
|
|
820
1506
|
return;
|
|
821
|
-
|
|
1507
|
+
let next = {
|
|
822
1508
|
field: f.field,
|
|
823
1509
|
operator: this.editingOperator(),
|
|
824
1510
|
data: this.editingValue(),
|
|
825
1511
|
};
|
|
1512
|
+
// B3: a required chip that had a value and was emptied gets that value (and operator) back.
|
|
1513
|
+
if (field?.required && ɵsdQueryFilterActive(f) && !ɵsdQueryFilterActive(next)) {
|
|
1514
|
+
next = { field: f.field, operator: f.operator, data: f.data };
|
|
1515
|
+
}
|
|
826
1516
|
this.commit.emit(next);
|
|
827
1517
|
}
|
|
828
1518
|
// ---------------------------------------------------------------------------
|
|
@@ -868,16 +1558,15 @@ class SdQueryChipPopover {
|
|
|
868
1558
|
}
|
|
869
1559
|
}
|
|
870
1560
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryChipPopover, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
871
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryChipPopover, isStandalone: true, selector: "sd-query-chip-popover", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, chipIndex: { classPropertyName: "chipIndex", publicName: "chipIndex", isSignal: true, isRequired: false, transformFunction: null }, autoIdBase: { classPropertyName: "autoIdBase", publicName: "autoIdBase", isSignal: true, isRequired: false, transformFunction: null }, switchPickerMenu: { classPropertyName: "switchPickerMenu", publicName: "switchPickerMenu", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commit: "commit", swapField: "swapField" }, viewQueries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n Chip popover \u2014 operator + value editor for the popover-mode chip.\n Visual layout mirrors the previous inline `<mat-menu #chipPopover>` in query-bar.\n Body branches on operator + field.type \u2014 8 paths preserved exactly.\n-->\n<mat-menu #menu=\"matMenu\" class=\"c-chip-popover\" xPosition=\"after\" yPosition=\"below\" (closed)=\"onMenuClosed()\">\n <ng-template matMenuContent>\n @let _field = field();\n @let _editingOperator = editingOperator();\n @let _editingValue = editingValue();\n @let _editingOptions = editingOptions();\n @let _editingOptionsLoading = editingOptionsLoading();\n @let _switchPickerMenu = switchPickerMenu();\n\n @if (_field) {\n <!-- why: header/body c\u1EE7a popover l\u00E0 NH\u00D3M control (role=\"group\"), kh\u00F4ng ph\u1EA3i n\u00FAt \u2014 n\u00EAn ch\u00FAng\n KH\u00D4NG \u0111\u01B0\u1EE3c nh\u1EADn tabindex; tab ph\u1EA3i \u0111i th\u1EB3ng v\u00E0o c\u00E1c control b\u00EAn trong. Th\u00EAm ch\u1EB7n Enter\n b\u00EAn c\u1EA1nh ch\u1EB7n click: c\u1EA3 hai ch\u1EC9 \u0111\u1EC3 mat-menu kh\u00F4ng t\u1EF1 \u0111\u00F3ng khi ng\u01B0\u1EDDi d\u00F9ng thao t\u00E1c trong\n popover; Escape v\u00E0 ph\u00EDm m\u0169i t\u00EAn v\u1EABn b\u1ECDt l\u00EAn \u0111\u1EC3 menu \u0111\u00F3ng/\u0111i\u1EC1u h\u01B0\u1EDBng b\u00ECnh th\u01B0\u1EDDng. -->\n <div class=\"c-pop-header\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown.enter)=\"$event.stopPropagation()\">\n <sd-icon [name]=\"iconFor(_field)\"></sd-icon>\n <!-- why: nested mat-menu trigger to swap the chip's field \u2014 parent provides\n the field-picker MatMenu via [switchPickerMenu]. -->\n @if (_switchPickerMenu) {\n <button\n type=\"button\"\n class=\"c-pop-header-field\"\n [matMenuTriggerFor]=\"_switchPickerMenu\"\n [matTooltip]=\"swapFieldTooltip()\">\n <span>{{ _field.label }}</span>\n <sd-icon name=\"unfold_more\"></sd-icon>\n </button>\n } @else {\n <span class=\"c-pop-header-field\">{{ _field.label }}</span>\n }\n <!-- Operator selector (right-aligned). Disabled when field has \u22641 operator. -->\n <sd-operator\n class=\"c-pop-header-operator\"\n size=\"sm\"\n [autoId]=\"chipAutoId('operator')\"\n [operators]=\"allowedOperators()\"\n [model]=\"_editingOperator\"\n [disabled]=\"!showOperatorSelector()\"\n (modelChange)=\"onEditingOperatorChange($any($event))\" />\n </div>\n\n <div class=\"c-pop-body\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown.enter)=\"$event.stopPropagation()\">\n @if (!isNoDataOperator(_editingOperator)) {\n @if (_editingOperator === 'BETWEEN') {\n @if (_field.type === 'date') {\n <div class=\"c-pop-between\">\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-date>\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-date>\n </div>\n } @else if (_field.type === 'datetime') {\n <div class=\"c-pop-between\">\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-datetime>\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-datetime>\n </div>\n } @else {\n <div class=\"c-pop-between\">\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-input-number>\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-input-number>\n </div>\n }\n } @else if (_field.type === 'boolean') {\n <div class=\"c-pop-boolean c-bool-toggle\">\n <sd-button\n [autoId]=\"chipAutoId('value-true')\"\n [type]=\"_editingValue === true ? 'fill' : 'outline'\"\n color=\"success\"\n [title]=\"$any(_field).trueLabel || booleanTrueLabel()\"\n (click)=\"onEditingValueInput(true)\">\n </sd-button>\n <sd-button\n [autoId]=\"chipAutoId('value-false')\"\n [type]=\"_editingValue === false ? 'fill' : 'outline'\"\n color=\"warning\"\n [title]=\"$any(_field).falseLabel || booleanFalseLabel()\"\n (click)=\"onEditingValueInput(false)\">\n </sd-button>\n </div>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <sd-select size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [items]=\"_editingOptions\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-select>\n @if (_editingOptionsLoading) {\n <div class=\"c-pop-values-loading\">{{ loadingValuesLabel() }}</div>\n }\n } @else if (_field.type === 'date') {\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-date>\n } @else if (_field.type === 'datetime') {\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-datetime>\n } @else if (_field.type === 'number') {\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input-number>\n } @else {\n <sd-input size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input>\n }\n }\n </div>\n }\n </ng-template>\n</mat-menu>\n", styles: [":host{display:contents}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle{display:inline-flex;align-items:center;gap:4px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle .mdc-button,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-button],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-stroked-button],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i1.MatMenuContent, selector: "ng-template[matMenuContent]" }, { kind: "directive", type: i1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { 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: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "inputmode", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1561
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryChipPopover, isStandalone: true, selector: "sd-query-chip-popover", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, chipIndex: { classPropertyName: "chipIndex", publicName: "chipIndex", isSignal: true, isRequired: false, transformFunction: null }, autoIdBase: { classPropertyName: "autoIdBase", publicName: "autoIdBase", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commit: "commit" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n Chip popover \u2014 operator + value editor for the popover-mode chip.\n Dialog panel theo khung Action Popover (handoff m\u1EE5c 4); header, th\u00E2n, \u0111\u1ED9 r\u1ED9ng gi\u1EEF nh\u01B0 b\u1EA3n tr\u01B0\u1EDBc.\n Body branches on operator + field.type \u2014 8 paths preserved exactly.\n-->\n<ng-template sdQueryPanel=\"dialog\" #panel=\"sdQueryPanel\" (closed)=\"onMenuClosed($event)\">\n @let _field = currentField();\n @let _editingOperator = editingOperator();\n @let _editingValue = editingValue();\n @let _editingOptions = editingOptions();\n @let _editingOptionsLoading = editingOptionsLoading();\n\n <div\n class=\"sd-query-panel sd-query-panel--form c-chip-popover\"\n role=\"dialog\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"labelId\"\n [attr.data-autoid]=\"autoIdBase() ? autoIdBase() + '-panel-chip' : null\">\n @if (_field) {\n <!-- why: header/body c\u1EE7a popover l\u00E0 NH\u00D3M control (role=\"group\"), kh\u00F4ng ph\u1EA3i n\u00FAt \u2014 n\u00EAn ch\u00FAng KH\u00D4NG \u0111\u01B0\u1EE3c nh\u1EADn tabindex;\n tab \u0111i th\u1EB3ng v\u00E0o c\u00E1c control b\u00EAn trong. B\u1ECF ch\u1EB7n click / Enter c\u1EE7a b\u1EA3n tr\u01B0\u1EDBc: panel kh\u00F4ng t\u1EF1 \u0111\u00F3ng khi b\u1EA5m b\u00EAn\n trong, n\u00EAn kh\u00F4ng c\u00F2n g\u00EC ph\u1EA3i ch\u1EB7n. -->\n <div class=\"c-pop-header\" role=\"group\">\n <sd-icon [name]=\"iconFor(_field)\" aria-hidden=\"true\"></sd-icon>\n <!-- why: \u0111\u1ED5i field trong chip \u0111\u00E3 b\u1ECF (handoff M7) \u2014 nh\u00E3n t\u0129nh, l\u00E0 t\u00EAn c\u1EE7a dialog. -->\n <span class=\"c-pop-header-field\" [id]=\"labelId\">{{ _field.label }}</span>\n <!-- Operator selector (right-aligned). Disabled when field has \u22641 operator. -->\n <sd-operator\n class=\"c-pop-header-operator\"\n size=\"sm\"\n [autoId]=\"chipAutoId('operator')\"\n [operators]=\"allowedOperators()\"\n [model]=\"_editingOperator\"\n [disabled]=\"!showOperatorSelector()\"\n (modelChange)=\"onEditingOperatorChange($any($event))\" />\n </div>\n\n <div class=\"c-pop-body\" role=\"group\" data-sd-query-panel-initial [attr.aria-describedby]=\"minOneHint() ? hintId : null\">\n @if (!isNoDataOperator(_editingOperator)) {\n @if (_editingOperator === 'BETWEEN') {\n @if (_field.type === 'date') {\n <div class=\"c-pop-between\">\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-date>\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-date>\n </div>\n } @else if (_field.type === 'datetime') {\n <div class=\"c-pop-between\">\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-datetime>\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-datetime>\n </div>\n } @else {\n <div class=\"c-pop-between\">\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-input-number>\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-input-number>\n </div>\n }\n } @else if (_field.type === 'boolean') {\n <div class=\"c-pop-boolean c-bool-toggle\">\n <sd-button\n [autoId]=\"chipAutoId('value-true')\"\n [type]=\"_editingValue === true ? 'fill' : 'outline'\"\n color=\"success\"\n [title]=\"$any(_field).trueLabel || booleanTrueLabel()\"\n (click)=\"onEditingValueInput(true)\">\n </sd-button>\n <sd-button\n [autoId]=\"chipAutoId('value-false')\"\n [type]=\"_editingValue === false ? 'fill' : 'outline'\"\n color=\"warning\"\n [title]=\"$any(_field).falseLabel || booleanFalseLabel()\"\n (click)=\"onEditingValueInput(false)\">\n </sd-button>\n </div>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <sd-select size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [items]=\"_editingOptions\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"multiple()\"\n [required]=\"required()\"\n [clearable]=\"!required()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-select>\n @if (minOneHint()) {\n <div class=\"c-pop-required-hint\" aria-live=\"polite\" [id]=\"hintId\">{{ minOneLabel() }}</div>\n }\n @if (_editingOptionsLoading) {\n <div class=\"c-pop-values-loading\">{{ loadingValuesLabel() }}</div>\n }\n } @else if (_field.type === 'date') {\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-date>\n } @else if (_field.type === 'datetime') {\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-datetime>\n } @else if (_field.type === 'number') {\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input-number>\n } @else {\n <sd-input size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input>\n }\n }\n </div>\n }\n </div>\n</ng-template>\n", styles: [":host{display:contents}.c-chip-popover{box-sizing:border-box;min-width:min(160px,100vw - 16px);max-height:min(360px,100dvh - 16px);overflow:auto;border:1px solid var(--sd-border, #dde0e5);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface, var(--sd-white, #fff));color:var(--sd-text, #1a1b1f);box-shadow:0 4px 12px #0f172a24,0 1px 3px #0f172a1a;overflow:hidden;display:flex;flex-direction:column;min-width:min(280px,100vw - 16px);max-width:min(320px,100vw - 16px)}.c-chip-popover:focus{outline:none}.c-chip-popover ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-chip-popover ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-chip-popover ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}.c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}.c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}.c-pop-header .c-pop-header-operator{margin-left:auto}.c-pop-header-field{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px;min-height:0;overflow-y:auto}.c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}.c-pop-boolean{display:flex;gap:8px}.c-pop-boolean ::ng-deep button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}.c-pop-required-hint{margin-top:-8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555)}.c-pop-values-loading{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n"], dependencies: [{ kind: "directive", type: ɵSdQueryPanelDirective, selector: "ng-template[sdQueryPanel]", inputs: ["sdQueryPanel", "sdQueryPanelAlign", "sdQueryPanelControls"], outputs: ["opened", "closed"], exportAs: ["sdQueryPanel"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { 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: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "inputmode", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
872
1562
|
}
|
|
873
1563
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryChipPopover, decorators: [{
|
|
874
1564
|
type: Component,
|
|
875
1565
|
args: [{ selector: 'sd-query-chip-popover', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1566
|
+
ɵSdQueryPanelDirective,
|
|
876
1567
|
SdIcon,
|
|
877
1568
|
CommonModule,
|
|
878
1569
|
FormsModule,
|
|
879
|
-
MatMenuModule,
|
|
880
|
-
MatTooltipModule,
|
|
881
1570
|
SdButton,
|
|
882
1571
|
SdOperator,
|
|
883
1572
|
SdSelect,
|
|
@@ -885,59 +1574,71 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
885
1574
|
SdInputNumber,
|
|
886
1575
|
SdDate,
|
|
887
1576
|
SdDatetime,
|
|
888
|
-
], template: "<!--\n Chip popover \u2014 operator + value editor for the popover-mode chip.\n Visual layout mirrors the previous inline `<mat-menu #chipPopover>` in query-bar.\n Body branches on operator + field.type \u2014 8 paths preserved exactly.\n-->\n<mat-menu #menu=\"matMenu\" class=\"c-chip-popover\" xPosition=\"after\" yPosition=\"below\" (closed)=\"onMenuClosed()\">\n <ng-template matMenuContent>\n @let _field = field();\n @let _editingOperator = editingOperator();\n @let _editingValue = editingValue();\n @let _editingOptions = editingOptions();\n @let _editingOptionsLoading = editingOptionsLoading();\n @let _switchPickerMenu = switchPickerMenu();\n\n @if (_field) {\n <!-- why: header/body c\u1EE7a popover l\u00E0 NH\u00D3M control (role=\"group\"), kh\u00F4ng ph\u1EA3i n\u00FAt \u2014 n\u00EAn ch\u00FAng\n KH\u00D4NG \u0111\u01B0\u1EE3c nh\u1EADn tabindex; tab ph\u1EA3i \u0111i th\u1EB3ng v\u00E0o c\u00E1c control b\u00EAn trong. Th\u00EAm ch\u1EB7n Enter\n b\u00EAn c\u1EA1nh ch\u1EB7n click: c\u1EA3 hai ch\u1EC9 \u0111\u1EC3 mat-menu kh\u00F4ng t\u1EF1 \u0111\u00F3ng khi ng\u01B0\u1EDDi d\u00F9ng thao t\u00E1c trong\n popover; Escape v\u00E0 ph\u00EDm m\u0169i t\u00EAn v\u1EABn b\u1ECDt l\u00EAn \u0111\u1EC3 menu \u0111\u00F3ng/\u0111i\u1EC1u h\u01B0\u1EDBng b\u00ECnh th\u01B0\u1EDDng. -->\n <div class=\"c-pop-header\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown.enter)=\"$event.stopPropagation()\">\n <sd-icon [name]=\"iconFor(_field)\"></sd-icon>\n <!-- why: nested mat-menu trigger to swap the chip's field \u2014 parent provides\n the field-picker MatMenu via [switchPickerMenu]. -->\n @if (_switchPickerMenu) {\n <button\n type=\"button\"\n class=\"c-pop-header-field\"\n [matMenuTriggerFor]=\"_switchPickerMenu\"\n [matTooltip]=\"swapFieldTooltip()\">\n <span>{{ _field.label }}</span>\n <sd-icon name=\"unfold_more\"></sd-icon>\n </button>\n } @else {\n <span class=\"c-pop-header-field\">{{ _field.label }}</span>\n }\n <!-- Operator selector (right-aligned). Disabled when field has \u22641 operator. -->\n <sd-operator\n class=\"c-pop-header-operator\"\n size=\"sm\"\n [autoId]=\"chipAutoId('operator')\"\n [operators]=\"allowedOperators()\"\n [model]=\"_editingOperator\"\n [disabled]=\"!showOperatorSelector()\"\n (modelChange)=\"onEditingOperatorChange($any($event))\" />\n </div>\n\n <div class=\"c-pop-body\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown.enter)=\"$event.stopPropagation()\">\n @if (!isNoDataOperator(_editingOperator)) {\n @if (_editingOperator === 'BETWEEN') {\n @if (_field.type === 'date') {\n <div class=\"c-pop-between\">\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-date>\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-date>\n </div>\n } @else if (_field.type === 'datetime') {\n <div class=\"c-pop-between\">\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-datetime>\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-datetime>\n </div>\n } @else {\n <div class=\"c-pop-between\">\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-input-number>\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-input-number>\n </div>\n }\n } @else if (_field.type === 'boolean') {\n <div class=\"c-pop-boolean c-bool-toggle\">\n <sd-button\n [autoId]=\"chipAutoId('value-true')\"\n [type]=\"_editingValue === true ? 'fill' : 'outline'\"\n color=\"success\"\n [title]=\"$any(_field).trueLabel || booleanTrueLabel()\"\n (click)=\"onEditingValueInput(true)\">\n </sd-button>\n <sd-button\n [autoId]=\"chipAutoId('value-false')\"\n [type]=\"_editingValue === false ? 'fill' : 'outline'\"\n color=\"warning\"\n [title]=\"$any(_field).falseLabel || booleanFalseLabel()\"\n (click)=\"onEditingValueInput(false)\">\n </sd-button>\n </div>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <sd-select size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [items]=\"_editingOptions\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-select>\n @if (_editingOptionsLoading) {\n <div class=\"c-pop-values-loading\">{{ loadingValuesLabel() }}</div>\n }\n } @else if (_field.type === 'date') {\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-date>\n } @else if (_field.type === 'datetime') {\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-datetime>\n } @else if (_field.type === 'number') {\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input-number>\n } @else {\n <sd-input size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input>\n }\n }\n </div>\n }\n </ng-template>\n</mat-menu>\n", styles: [":host{display:contents}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle{display:inline-flex;align-items:center;gap:4px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle .mdc-button,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-button],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-stroked-button],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n"] }]
|
|
889
|
-
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], chipIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipIndex", required: false }] }], autoIdBase: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoIdBase", required: false }] }],
|
|
1577
|
+
], template: "<!--\n Chip popover \u2014 operator + value editor for the popover-mode chip.\n Dialog panel theo khung Action Popover (handoff m\u1EE5c 4); header, th\u00E2n, \u0111\u1ED9 r\u1ED9ng gi\u1EEF nh\u01B0 b\u1EA3n tr\u01B0\u1EDBc.\n Body branches on operator + field.type \u2014 8 paths preserved exactly.\n-->\n<ng-template sdQueryPanel=\"dialog\" #panel=\"sdQueryPanel\" (closed)=\"onMenuClosed($event)\">\n @let _field = currentField();\n @let _editingOperator = editingOperator();\n @let _editingValue = editingValue();\n @let _editingOptions = editingOptions();\n @let _editingOptionsLoading = editingOptionsLoading();\n\n <div\n class=\"sd-query-panel sd-query-panel--form c-chip-popover\"\n role=\"dialog\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"labelId\"\n [attr.data-autoid]=\"autoIdBase() ? autoIdBase() + '-panel-chip' : null\">\n @if (_field) {\n <!-- why: header/body c\u1EE7a popover l\u00E0 NH\u00D3M control (role=\"group\"), kh\u00F4ng ph\u1EA3i n\u00FAt \u2014 n\u00EAn ch\u00FAng KH\u00D4NG \u0111\u01B0\u1EE3c nh\u1EADn tabindex;\n tab \u0111i th\u1EB3ng v\u00E0o c\u00E1c control b\u00EAn trong. B\u1ECF ch\u1EB7n click / Enter c\u1EE7a b\u1EA3n tr\u01B0\u1EDBc: panel kh\u00F4ng t\u1EF1 \u0111\u00F3ng khi b\u1EA5m b\u00EAn\n trong, n\u00EAn kh\u00F4ng c\u00F2n g\u00EC ph\u1EA3i ch\u1EB7n. -->\n <div class=\"c-pop-header\" role=\"group\">\n <sd-icon [name]=\"iconFor(_field)\" aria-hidden=\"true\"></sd-icon>\n <!-- why: \u0111\u1ED5i field trong chip \u0111\u00E3 b\u1ECF (handoff M7) \u2014 nh\u00E3n t\u0129nh, l\u00E0 t\u00EAn c\u1EE7a dialog. -->\n <span class=\"c-pop-header-field\" [id]=\"labelId\">{{ _field.label }}</span>\n <!-- Operator selector (right-aligned). Disabled when field has \u22641 operator. -->\n <sd-operator\n class=\"c-pop-header-operator\"\n size=\"sm\"\n [autoId]=\"chipAutoId('operator')\"\n [operators]=\"allowedOperators()\"\n [model]=\"_editingOperator\"\n [disabled]=\"!showOperatorSelector()\"\n (modelChange)=\"onEditingOperatorChange($any($event))\" />\n </div>\n\n <div class=\"c-pop-body\" role=\"group\" data-sd-query-panel-initial [attr.aria-describedby]=\"minOneHint() ? hintId : null\">\n @if (!isNoDataOperator(_editingOperator)) {\n @if (_editingOperator === 'BETWEEN') {\n @if (_field.type === 'date') {\n <div class=\"c-pop-between\">\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-date>\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-date>\n </div>\n } @else if (_field.type === 'datetime') {\n <div class=\"c-pop-between\">\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-datetime>\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-datetime>\n </div>\n } @else {\n <div class=\"c-pop-between\">\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-input-number>\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-input-number>\n </div>\n }\n } @else if (_field.type === 'boolean') {\n <div class=\"c-pop-boolean c-bool-toggle\">\n <sd-button\n [autoId]=\"chipAutoId('value-true')\"\n [type]=\"_editingValue === true ? 'fill' : 'outline'\"\n color=\"success\"\n [title]=\"$any(_field).trueLabel || booleanTrueLabel()\"\n (click)=\"onEditingValueInput(true)\">\n </sd-button>\n <sd-button\n [autoId]=\"chipAutoId('value-false')\"\n [type]=\"_editingValue === false ? 'fill' : 'outline'\"\n color=\"warning\"\n [title]=\"$any(_field).falseLabel || booleanFalseLabel()\"\n (click)=\"onEditingValueInput(false)\">\n </sd-button>\n </div>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <sd-select size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [items]=\"_editingOptions\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"multiple()\"\n [required]=\"required()\"\n [clearable]=\"!required()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-select>\n @if (minOneHint()) {\n <div class=\"c-pop-required-hint\" aria-live=\"polite\" [id]=\"hintId\">{{ minOneLabel() }}</div>\n }\n @if (_editingOptionsLoading) {\n <div class=\"c-pop-values-loading\">{{ loadingValuesLabel() }}</div>\n }\n } @else if (_field.type === 'date') {\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-date>\n } @else if (_field.type === 'datetime') {\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-datetime>\n } @else if (_field.type === 'number') {\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input-number>\n } @else {\n <sd-input size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input>\n }\n }\n </div>\n }\n </div>\n</ng-template>\n", styles: [":host{display:contents}.c-chip-popover{box-sizing:border-box;min-width:min(160px,100vw - 16px);max-height:min(360px,100dvh - 16px);overflow:auto;border:1px solid var(--sd-border, #dde0e5);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface, var(--sd-white, #fff));color:var(--sd-text, #1a1b1f);box-shadow:0 4px 12px #0f172a24,0 1px 3px #0f172a1a;overflow:hidden;display:flex;flex-direction:column;min-width:min(280px,100vw - 16px);max-width:min(320px,100vw - 16px)}.c-chip-popover:focus{outline:none}.c-chip-popover ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-chip-popover ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-chip-popover ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}.c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}.c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}.c-pop-header .c-pop-header-operator{margin-left:auto}.c-pop-header-field{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px;min-height:0;overflow-y:auto}.c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}.c-pop-boolean{display:flex;gap:8px}.c-pop-boolean ::ng-deep button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}.c-pop-required-hint{margin-top:-8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555)}.c-pop-values-loading{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n"] }]
|
|
1578
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], chipIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipIndex", required: false }] }], autoIdBase: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoIdBase", required: false }] }], commit: [{ type: i0.Output, args: ["commit"] }], panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
|
|
890
1579
|
|
|
891
|
-
/**
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
const MENU_KEYS = new Set(['Escape', 'ArrowDown', 'ArrowUp', 'Tab']);
|
|
1580
|
+
/** From this many fields the picker gets a find box at the top (PD after R1, G-2). */
|
|
1581
|
+
const FIND_MIN_FIELDS = 10;
|
|
1582
|
+
let nextListId = 0;
|
|
895
1583
|
/**
|
|
896
|
-
* Field picker
|
|
1584
|
+
* Field picker of `sd-query-bar`: a listbox panel (handoff section 3). The "+" button opens it with
|
|
1585
|
+
* `[sdQueryPanelTrigger]="picker.panel()"`; the chosen field comes back through `(pick)`. Fields in `[usedKeys]`
|
|
1586
|
+
* render disabled with a check.
|
|
897
1587
|
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
* those entries render disabled with a check.
|
|
901
|
-
* - "Đổi field" inside the chip popover — pass `[currentKey]` to disable the
|
|
902
|
-
* currently-bound field.
|
|
903
|
-
*
|
|
904
|
-
* Parent triggers via `[matMenuTriggerFor]="picker.menu()"` and receives the
|
|
905
|
-
* chosen field through `(pick)`.
|
|
1588
|
+
* Keyboard: without a find box focus moves over the options (↑ ↓ Home End, Enter picks). With the find box focus stays
|
|
1589
|
+
* in it and the arrows move `aria-activedescendant` (combobox). No typeahead.
|
|
906
1590
|
*/
|
|
907
1591
|
class SdQueryFieldPicker {
|
|
908
1592
|
#i18n = inject(I18nService);
|
|
909
|
-
#injector = inject(Injector);
|
|
910
1593
|
emptyLabel = computed(() => this.#i18n.t('core.component.query-bar.field-empty'), /* @ts-ignore */
|
|
911
1594
|
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
912
1595
|
findLabel = computed(() => this.#i18n.t('core.component.query-bar.find-field'), /* @ts-ignore */
|
|
913
1596
|
...(ngDevMode ? [{ debugName: "findLabel" }] : /* istanbul ignore next */ []));
|
|
914
|
-
/**
|
|
1597
|
+
/**
|
|
1598
|
+
* Name of the listbox: the label of what opens it — the + button in popover mode, the Add condition box inline. The
|
|
1599
|
+
* find box label is a command ("Tìm kiếm"), not a name for the list.
|
|
1600
|
+
*/
|
|
1601
|
+
listLabel = computed(() => this.#i18n.t(this.findBox() ? 'core.component.query-bar.add-filter' : 'core.component.query-bar.add-condition'), /* @ts-ignore */
|
|
1602
|
+
...(ngDevMode ? [{ debugName: "listLabel" }] : /* istanbul ignore next */ []));
|
|
1603
|
+
/** Field list shown in the panel (caller-supplied; rendered in input order). */
|
|
915
1604
|
fields = input([], /* @ts-ignore */
|
|
916
1605
|
...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
917
|
-
/**
|
|
918
|
-
currentKey = input(undefined, /* @ts-ignore */
|
|
919
|
-
...(ngDevMode ? [{ debugName: "currentKey" }] : /* istanbul ignore next */ []));
|
|
920
|
-
/** Set of keys already in use — used in the "Add filter" flow to grey out duplicates. */
|
|
1606
|
+
/** Set of keys already in use — those render disabled with a check. */
|
|
921
1607
|
usedKeys = input(new Set(), /* @ts-ignore */
|
|
922
1608
|
...(ngDevMode ? [{ debugName: "usedKeys" }] : /* istanbul ignore next */ []));
|
|
1609
|
+
/** Prefix of `data-autoid` (handoff section 12). */
|
|
1610
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
1611
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1612
|
+
/**
|
|
1613
|
+
* `false`: no find box in the panel — an input outside (the inline "Add condition" combobox) types the filter through
|
|
1614
|
+
* `setQuery()` and moves the active option.
|
|
1615
|
+
*/
|
|
1616
|
+
findBox = input(true, /* @ts-ignore */
|
|
1617
|
+
...(ngDevMode ? [{ debugName: "findBox" }] : /* istanbul ignore next */ []));
|
|
923
1618
|
/** Emits when the user picks an enabled field. */
|
|
924
1619
|
pick = output();
|
|
925
|
-
/**
|
|
926
|
-
|
|
927
|
-
|
|
1620
|
+
/** The panel closed. */
|
|
1621
|
+
closed = output();
|
|
1622
|
+
/** The panel — the trigger binds `[sdQueryPanelTrigger]="picker.panel()"`. */
|
|
1623
|
+
panel = viewChild.required('panel', /* @ts-ignore */
|
|
1624
|
+
...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
|
|
928
1625
|
iconFor = sdQueryFieldIcon;
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
// ---------------------------------------------------------------------------
|
|
932
|
-
/** Text typed in the find box; reset when the menu closes. */
|
|
1626
|
+
listId = `sd-query-field-list-${nextListId++}`;
|
|
1627
|
+
/** Text typed in the find box; reset when the panel closes. */
|
|
933
1628
|
query = signal('', /* @ts-ignore */
|
|
934
1629
|
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
935
|
-
/**
|
|
936
|
-
|
|
1630
|
+
/** Key of the option the arrows point at (`aria-activedescendant` / roving focus). */
|
|
1631
|
+
activeKey = signal(null, /* @ts-ignore */
|
|
1632
|
+
...(ngDevMode ? [{ debugName: "activeKey" }] : /* istanbul ignore next */ []));
|
|
1633
|
+
/** Find box from ten fields (not when an outside input types the filter). */
|
|
1634
|
+
searchable = computed(() => this.findBox() && this.fields().length >= FIND_MIN_FIELDS, /* @ts-ignore */
|
|
937
1635
|
...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
1636
|
+
/** The list follows the typed text: with the find box, or with the outside combobox. */
|
|
1637
|
+
#filterable = computed(() => this.searchable() || !this.findBox(), /* @ts-ignore */
|
|
1638
|
+
...(ngDevMode ? [{ debugName: "#filterable" }] : /* istanbul ignore next */ []));
|
|
938
1639
|
/** Fields grouped by `field.group` in order of first appearance, filtered by the find box. */
|
|
939
1640
|
groups = computed(() => {
|
|
940
|
-
const term = this
|
|
1641
|
+
const term = this.#filterable() ? sdNormalizeSearchText(this.query().trim()) : '';
|
|
941
1642
|
const groups = [];
|
|
942
1643
|
const byLabel = new Map();
|
|
943
1644
|
for (const field of this.fields()) {
|
|
@@ -946,7 +1647,7 @@ class SdQueryFieldPicker {
|
|
|
946
1647
|
const label = field.group ?? '';
|
|
947
1648
|
let group = byLabel.get(label);
|
|
948
1649
|
if (!group) {
|
|
949
|
-
group = { label, fields: [] };
|
|
1650
|
+
group = { label, headingId: `${this.listId}-group-${groups.length}`, fields: [] };
|
|
950
1651
|
byLabel.set(label, group);
|
|
951
1652
|
groups.push(group);
|
|
952
1653
|
}
|
|
@@ -958,49 +1659,128 @@ class SdQueryFieldPicker {
|
|
|
958
1659
|
/** One group needs no heading. Counted on the whole list so filtering does not hide headings. */
|
|
959
1660
|
showGroupHeadings = computed(() => new Set(this.fields().map(field => field.group ?? '')).size > 1, /* @ts-ignore */
|
|
960
1661
|
...(ngDevMode ? [{ debugName: "showGroupHeadings" }] : /* istanbul ignore next */ []));
|
|
961
|
-
|
|
962
|
-
|
|
1662
|
+
/** Visible fields in order, with the id of their option element. */
|
|
1663
|
+
#visible = computed(() => {
|
|
1664
|
+
const ids = new Map();
|
|
1665
|
+
const list = this.groups().flatMap(group => group.fields);
|
|
1666
|
+
list.forEach((field, index) => ids.set(field.key, `${this.listId}-option-${index}`));
|
|
1667
|
+
return { list, ids };
|
|
1668
|
+
}, /* @ts-ignore */
|
|
1669
|
+
...(ngDevMode ? [{ debugName: "#visible" }] : /* istanbul ignore next */ []));
|
|
1670
|
+
/** Id of the active option, for `aria-activedescendant`. */
|
|
1671
|
+
activeId = computed(() => {
|
|
1672
|
+
const key = this.activeKey();
|
|
1673
|
+
return key === null ? null : (this.#visible().ids.get(key) ?? null);
|
|
1674
|
+
}, /* @ts-ignore */
|
|
1675
|
+
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
1676
|
+
optionId(field) {
|
|
1677
|
+
return this.#visible().ids.get(field.key) ?? '';
|
|
1678
|
+
}
|
|
1679
|
+
isDisabled(field) {
|
|
1680
|
+
return field.disabled === true || this.usedKeys().has(field.key);
|
|
1681
|
+
}
|
|
1682
|
+
/** "Used" check icon — when the field is in `usedKeys`. */
|
|
1683
|
+
isUsed(field) {
|
|
1684
|
+
return this.usedKeys().has(field.key);
|
|
1685
|
+
}
|
|
1686
|
+
/** Find box typed: filter, then point at the first enabled match (none while the box is empty). */
|
|
1687
|
+
setQuery(text) {
|
|
1688
|
+
this.query.set(text);
|
|
1689
|
+
this.activeKey.set(text.trim() ? (this.#enabled()[0]?.key ?? null) : null);
|
|
1690
|
+
}
|
|
963
1691
|
/**
|
|
964
|
-
*
|
|
965
|
-
*
|
|
1692
|
+
* Moves the active option over the enabled ones, wrapping: `1` / `-1`, or `'first'` / `'last'`. With `focus`, the
|
|
1693
|
+
* option also takes focus (no find box).
|
|
966
1694
|
*/
|
|
967
|
-
|
|
968
|
-
|
|
1695
|
+
move(step, focus = false) {
|
|
1696
|
+
const enabled = this.#enabled();
|
|
1697
|
+
if (!enabled.length)
|
|
969
1698
|
return;
|
|
970
|
-
|
|
1699
|
+
const current = enabled.findIndex(field => field.key === this.activeKey());
|
|
1700
|
+
let index;
|
|
1701
|
+
if (step === 'first')
|
|
1702
|
+
index = 0;
|
|
1703
|
+
else if (step === 'last')
|
|
1704
|
+
index = enabled.length - 1;
|
|
1705
|
+
else if (current < 0)
|
|
1706
|
+
index = step > 0 ? 0 : enabled.length - 1;
|
|
1707
|
+
else
|
|
1708
|
+
index = (current + step + enabled.length) % enabled.length;
|
|
1709
|
+
const key = enabled[index].key;
|
|
1710
|
+
this.activeKey.set(key);
|
|
1711
|
+
if (focus)
|
|
1712
|
+
this.panel()
|
|
1713
|
+
.element()
|
|
1714
|
+
?.querySelector(`#${CSS.escape(this.#visible().ids.get(key) ?? '')}`)
|
|
1715
|
+
?.focus();
|
|
1716
|
+
}
|
|
1717
|
+
/** Picks the active option; `false` when there is none. */
|
|
1718
|
+
pickActive() {
|
|
1719
|
+
const field = this.#enabled().find(item => item.key === this.activeKey());
|
|
1720
|
+
if (!field)
|
|
1721
|
+
return false;
|
|
1722
|
+
this.select(field);
|
|
1723
|
+
return true;
|
|
971
1724
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1725
|
+
/** Picks `field` unless it is disabled: the panel closes first, then `(pick)` fires. */
|
|
1726
|
+
select(field) {
|
|
1727
|
+
if (this.isDisabled(field))
|
|
1728
|
+
return;
|
|
1729
|
+
this.panel().close('select');
|
|
1730
|
+
this.pick.emit(field);
|
|
1731
|
+
}
|
|
1732
|
+
/** Keys inside the panel (find box or an option). */
|
|
1733
|
+
onKeydown(event) {
|
|
1734
|
+
const inFind = event.target.tagName === 'INPUT';
|
|
1735
|
+
switch (event.key) {
|
|
1736
|
+
case 'ArrowDown':
|
|
1737
|
+
this.move(1, !inFind);
|
|
1738
|
+
break;
|
|
1739
|
+
case 'ArrowUp':
|
|
1740
|
+
this.move(-1, !inFind);
|
|
1741
|
+
break;
|
|
1742
|
+
case 'Home':
|
|
1743
|
+
case 'End':
|
|
1744
|
+
// In the find box Home / End move the caret.
|
|
1745
|
+
if (inFind)
|
|
1746
|
+
return;
|
|
1747
|
+
this.move(event.key === 'Home' ? 'first' : 'last', true);
|
|
1748
|
+
break;
|
|
1749
|
+
case 'Enter':
|
|
1750
|
+
if (inFind)
|
|
1751
|
+
this.pickActive();
|
|
1752
|
+
else {
|
|
1753
|
+
const field = this.#visible().list.find(item => this.optionId(item) === event.target.id);
|
|
1754
|
+
if (field)
|
|
1755
|
+
this.select(field);
|
|
1756
|
+
}
|
|
1757
|
+
break;
|
|
1758
|
+
default:
|
|
1759
|
+
return;
|
|
1760
|
+
}
|
|
1761
|
+
event.preventDefault();
|
|
975
1762
|
}
|
|
976
|
-
/**
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
const cur = this.currentKey();
|
|
980
|
-
if (cur)
|
|
981
|
-
set.add(cur);
|
|
982
|
-
return set;
|
|
983
|
-
}, /* @ts-ignore */
|
|
984
|
-
...(ngDevMode ? [{ debugName: "disabledMap" }] : /* istanbul ignore next */ []));
|
|
985
|
-
isDisabled(field) {
|
|
986
|
-
return field.disabled === true || this.disabledMap().has(field.key);
|
|
1763
|
+
/** An option took focus (roving focus, or a click): it becomes the active one. */
|
|
1764
|
+
onOptionFocus(field) {
|
|
1765
|
+
this.activeKey.set(field.key);
|
|
987
1766
|
}
|
|
988
|
-
/**
|
|
989
|
-
|
|
990
|
-
|
|
1767
|
+
/** Panel closed: forget the find text and the active option. */
|
|
1768
|
+
reset() {
|
|
1769
|
+
this.query.set('');
|
|
1770
|
+
this.activeKey.set(null);
|
|
991
1771
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
return this.usedKeys().has(field.key);
|
|
1772
|
+
#enabled() {
|
|
1773
|
+
return this.#visible().list.filter(field => !this.isDisabled(field));
|
|
995
1774
|
}
|
|
996
1775
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryFieldPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
997
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryFieldPicker, isStandalone: true, selector: "sd-query-field-picker", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null },
|
|
1776
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryFieldPicker, isStandalone: true, selector: "sd-query-field-picker", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, usedKeys: { classPropertyName: "usedKeys", publicName: "usedKeys", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, findBox: { classPropertyName: "findBox", publicName: "findBox", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pick: "pick", closed: "closed" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _autoId = autoId();\n@let _activeKey = activeKey();\n@let _showHeadings = showGroupHeadings();\n\n<ng-template #option let-field>\n @let _disabled = isDisabled(field);\n <button\n type=\"button\"\n role=\"option\"\n tabindex=\"-1\"\n class=\"c-field-item\"\n [id]=\"optionId(field)\"\n [class.c-field-item--active]=\"field.key === _activeKey\"\n [attr.aria-selected]=\"field.key === _activeKey\"\n [attr.aria-disabled]=\"_disabled ? 'true' : null\"\n (focus)=\"onOptionFocus(field)\"\n (click)=\"select(field)\">\n <sd-icon class=\"c-field-item-icon\" size=\"16px\" [name]=\"iconFor(field)\" aria-hidden=\"true\"></sd-icon>\n <span class=\"c-field-item-label\">{{ field.label }}</span>\n <span class=\"c-field-item-type\">{{ field.type }}</span>\n @if (isUsed(field)) {\n <sd-icon class=\"c-field-item-check\" size=\"14px\" name=\"check\" aria-hidden=\"true\"></sd-icon>\n }\n </button>\n</ng-template>\n\n<!-- Panel danh s\u00E1ch theo khung Action Popover (handoff m\u1EE5c 3). why: \u00F4 t\u00ECm n\u1EB1m ngo\u00E0i listbox \u2014 n\u00F3 l\u00E0 combobox \u0111i\u1EC1u khi\u1EC3n\n listbox qua aria-activedescendant, focus th\u1EADt \u1EDF l\u1EA1i trong \u00F4. -->\n<ng-template sdQueryPanel=\"listbox\" #panel=\"sdQueryPanel\" [sdQueryPanelControls]=\"listId\" (closed)=\"reset(); closed.emit($event)\">\n <div\n class=\"sd-query-panel sd-query-panel--list c-field-picker-menu\"\n tabindex=\"-1\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-panel-field-picker' : null\"\n (keydown)=\"onKeydown($event)\">\n @if (searchable()) {\n <sd-search-field class=\"c-field-find\" size=\"sm\">\n <input\n sdSearchFieldInput\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n aria-expanded=\"true\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-label]=\"findLabel()\"\n [placeholder]=\"findLabel()\"\n [value]=\"query()\"\n (input)=\"setQuery($any($event.target).value)\" />\n </sd-search-field>\n }\n <div class=\"c-field-list\" role=\"listbox\" [id]=\"listId\" [attr.aria-label]=\"listLabel()\">\n @for (group of groups(); track group.label) {\n @if (_showHeadings) {\n <div role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <div class=\"c-field-group\" role=\"presentation\" [id]=\"group.headingId\">{{ group.label }}</div>\n @for (field of group.fields; track field.key) {\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: field }\" />\n }\n </div>\n } @else {\n @for (field of group.fields; track field.key) {\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: field }\" />\n }\n }\n }\n </div>\n @if (!groups().length) {\n <div class=\"c-field-empty\" role=\"status\">{{ emptyLabel() }}</div>\n }\n </div>\n</ng-template>\n", styles: [".c-field-picker-menu{box-sizing:border-box;min-width:min(160px,100vw - 16px);max-width:min(320px,100vw - 16px);max-height:min(360px,100dvh - 16px);overflow:auto;border:1px solid var(--sd-border, #dde0e5);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface, var(--sd-white, #fff));color:var(--sd-text, #1a1b1f);box-shadow:0 4px 12px #0f172a24,0 1px 3px #0f172a1a;padding:4px;min-width:min(200px,100vw - 16px);max-width:min(260px,100vw - 16px)}.c-field-picker-menu:focus{outline:none}.c-field-find{margin:4px 4px 6px}.c-field-group{padding:4px 12px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555)}.c-field-item{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:40px;padding:8px 12px;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer}.c-field-item:hover:not(:disabled),.c-field-item:focus-visible{background:color-mix(in srgb,var(--sd-action-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.c-field-item:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-field-item:disabled{opacity:.45;cursor:default}@media(pointer:coarse){.c-field-item{min-height:44px}}.c-field-item.c-field-item--active{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 8%,transparent);outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-field-item[aria-disabled=true]{opacity:.45;cursor:default}.c-field-item[aria-disabled=true]:hover{background:transparent}.c-field-item-icon{flex:0 0 16px;width:16px;height:16px;font-size:var(--sd-font-size-16, 16px);color:var(--sd-query-bar-text-secondary, #5f6368)}.c-field-item-label{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.c-field-item-type{flex-shrink:0;margin-left:auto;padding-left:4px;font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-11, 11px);color:var(--sd-query-bar-text-secondary, #5f6368)}.c-field-item-check{flex:0 0 14px;width:14px;height:14px;font-size:var(--sd-font-size-14, 14px);color:var(--sd-primary)}.c-field-empty{padding:12px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-text-secondary, #555)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "directive", type: ɵSdQueryPanelDirective, selector: "ng-template[sdQueryPanel]", inputs: ["sdQueryPanel", "sdQueryPanelAlign", "sdQueryPanelControls"], outputs: ["opened", "closed"], exportAs: ["sdQueryPanel"] }, { kind: "component", type: _SdSearchField, selector: "sd-search-field", inputs: ["size", "clearable", "clearLabel", "autoId"], outputs: ["cleared"] }, { kind: "directive", type: _SdSearchFieldInputDirective, selector: "input[sdSearchFieldInput]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
998
1777
|
}
|
|
999
1778
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryFieldPicker, decorators: [{
|
|
1000
1779
|
type: Component,
|
|
1001
|
-
args: [{ selector: 'sd-query-field-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon,
|
|
1002
|
-
}], propDecorators: { fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }],
|
|
1780
|
+
args: [{ selector: 'sd-query-field-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, SdIcon, ɵSdQueryPanelDirective, _SdSearchField, _SdSearchFieldInputDirective], template: "@let _autoId = autoId();\n@let _activeKey = activeKey();\n@let _showHeadings = showGroupHeadings();\n\n<ng-template #option let-field>\n @let _disabled = isDisabled(field);\n <button\n type=\"button\"\n role=\"option\"\n tabindex=\"-1\"\n class=\"c-field-item\"\n [id]=\"optionId(field)\"\n [class.c-field-item--active]=\"field.key === _activeKey\"\n [attr.aria-selected]=\"field.key === _activeKey\"\n [attr.aria-disabled]=\"_disabled ? 'true' : null\"\n (focus)=\"onOptionFocus(field)\"\n (click)=\"select(field)\">\n <sd-icon class=\"c-field-item-icon\" size=\"16px\" [name]=\"iconFor(field)\" aria-hidden=\"true\"></sd-icon>\n <span class=\"c-field-item-label\">{{ field.label }}</span>\n <span class=\"c-field-item-type\">{{ field.type }}</span>\n @if (isUsed(field)) {\n <sd-icon class=\"c-field-item-check\" size=\"14px\" name=\"check\" aria-hidden=\"true\"></sd-icon>\n }\n </button>\n</ng-template>\n\n<!-- Panel danh s\u00E1ch theo khung Action Popover (handoff m\u1EE5c 3). why: \u00F4 t\u00ECm n\u1EB1m ngo\u00E0i listbox \u2014 n\u00F3 l\u00E0 combobox \u0111i\u1EC1u khi\u1EC3n\n listbox qua aria-activedescendant, focus th\u1EADt \u1EDF l\u1EA1i trong \u00F4. -->\n<ng-template sdQueryPanel=\"listbox\" #panel=\"sdQueryPanel\" [sdQueryPanelControls]=\"listId\" (closed)=\"reset(); closed.emit($event)\">\n <div\n class=\"sd-query-panel sd-query-panel--list c-field-picker-menu\"\n tabindex=\"-1\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-panel-field-picker' : null\"\n (keydown)=\"onKeydown($event)\">\n @if (searchable()) {\n <sd-search-field class=\"c-field-find\" size=\"sm\">\n <input\n sdSearchFieldInput\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n aria-expanded=\"true\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-activedescendant]=\"activeId()\"\n [attr.aria-label]=\"findLabel()\"\n [placeholder]=\"findLabel()\"\n [value]=\"query()\"\n (input)=\"setQuery($any($event.target).value)\" />\n </sd-search-field>\n }\n <div class=\"c-field-list\" role=\"listbox\" [id]=\"listId\" [attr.aria-label]=\"listLabel()\">\n @for (group of groups(); track group.label) {\n @if (_showHeadings) {\n <div role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <div class=\"c-field-group\" role=\"presentation\" [id]=\"group.headingId\">{{ group.label }}</div>\n @for (field of group.fields; track field.key) {\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: field }\" />\n }\n </div>\n } @else {\n @for (field of group.fields; track field.key) {\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: field }\" />\n }\n }\n }\n </div>\n @if (!groups().length) {\n <div class=\"c-field-empty\" role=\"status\">{{ emptyLabel() }}</div>\n }\n </div>\n</ng-template>\n", styles: [".c-field-picker-menu{box-sizing:border-box;min-width:min(160px,100vw - 16px);max-width:min(320px,100vw - 16px);max-height:min(360px,100dvh - 16px);overflow:auto;border:1px solid var(--sd-border, #dde0e5);border-radius:var(--sd-radius-8, 8px);background:var(--sd-surface, var(--sd-white, #fff));color:var(--sd-text, #1a1b1f);box-shadow:0 4px 12px #0f172a24,0 1px 3px #0f172a1a;padding:4px;min-width:min(200px,100vw - 16px);max-width:min(260px,100vw - 16px)}.c-field-picker-menu:focus{outline:none}.c-field-find{margin:4px 4px 6px}.c-field-group{padding:4px 12px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555)}.c-field-item{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:40px;padding:8px 12px;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer}.c-field-item:hover:not(:disabled),.c-field-item:focus-visible{background:color-mix(in srgb,var(--sd-action-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.c-field-item:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-field-item:disabled{opacity:.45;cursor:default}@media(pointer:coarse){.c-field-item{min-height:44px}}.c-field-item.c-field-item--active{background:color-mix(in srgb,var(--sd-text, #1a1b1f) 8%,transparent);outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.c-field-item[aria-disabled=true]{opacity:.45;cursor:default}.c-field-item[aria-disabled=true]:hover{background:transparent}.c-field-item-icon{flex:0 0 16px;width:16px;height:16px;font-size:var(--sd-font-size-16, 16px);color:var(--sd-query-bar-text-secondary, #5f6368)}.c-field-item-label{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.c-field-item-type{flex-shrink:0;margin-left:auto;padding-left:4px;font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-11, 11px);color:var(--sd-query-bar-text-secondary, #5f6368)}.c-field-item-check{flex:0 0 14px;width:14px;height:14px;font-size:var(--sd-font-size-14, 14px);color:var(--sd-primary)}.c-field-empty{padding:12px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-text-secondary, #555)}\n"] }]
|
|
1781
|
+
}], propDecorators: { fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], usedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "usedKeys", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], findBox: [{ type: i0.Input, args: [{ isSignal: true, alias: "findBox", required: false }] }], pick: [{ type: i0.Output, args: ["pick"] }], closed: [{ type: i0.Output, args: ["closed"] }], panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
|
|
1003
1782
|
|
|
1783
|
+
let nextHintId = 0;
|
|
1004
1784
|
/**
|
|
1005
1785
|
* Completed inline chip (non-string/number — those use `<sd-query-inline-value-chip>`).
|
|
1006
1786
|
*
|
|
@@ -1025,6 +1805,9 @@ class SdQueryInlineChip {
|
|
|
1025
1805
|
...(ngDevMode ? [{ debugName: "booleanTrueLabel" }] : /* istanbul ignore next */ []));
|
|
1026
1806
|
booleanFalseLabel = computed(() => this.#i18n.t('core.component.query-bar.boolean.false'), /* @ts-ignore */
|
|
1027
1807
|
...(ngDevMode ? [{ debugName: "booleanFalseLabel" }] : /* istanbul ignore next */ []));
|
|
1808
|
+
/** `aria-label` of the × — names the field, in the current language. */
|
|
1809
|
+
removeLabel = computed(() => this.#i18n.t('core.component.query-bar.remove-filter', { label: this.field().label }), /* @ts-ignore */
|
|
1810
|
+
...(ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []));
|
|
1028
1811
|
// ---------------------------------------------------------------------------
|
|
1029
1812
|
// Inputs
|
|
1030
1813
|
// ---------------------------------------------------------------------------
|
|
@@ -1055,6 +1838,9 @@ class SdQueryInlineChip {
|
|
|
1055
1838
|
/** Pinned chip — no × button. */
|
|
1056
1839
|
pinned = input(false, /* @ts-ignore */
|
|
1057
1840
|
...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
1841
|
+
/** Required field: `aria-required`, no empty selection (handoff B3). */
|
|
1842
|
+
required = input(false, /* @ts-ignore */
|
|
1843
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
1058
1844
|
/** Required chip without a value — error look, `aria-invalid`. */
|
|
1059
1845
|
invalid = input(false, /* @ts-ignore */
|
|
1060
1846
|
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
@@ -1094,6 +1880,28 @@ class SdQueryInlineChip {
|
|
|
1094
1880
|
/** Data payload — convenience accessor for template. */
|
|
1095
1881
|
data = computed(() => this.filter().data, /* @ts-ignore */
|
|
1096
1882
|
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1883
|
+
/**
|
|
1884
|
+
* Model handed to the select. Follows `data`, and is reset to a copy of it when a required chip refuses an empty
|
|
1885
|
+
* selection — the new reference makes sd-select drop the deselection it already shows.
|
|
1886
|
+
*/
|
|
1887
|
+
selectModel = linkedSignal(() => this.data(), /* @ts-ignore */
|
|
1888
|
+
...(ngDevMode ? [{ debugName: "selectModel" }] : /* istanbul ignore next */ []));
|
|
1889
|
+
/** "Choose at least one value." under a required multi-value chip that was just refused an empty selection. */
|
|
1890
|
+
minOneHint = signal(false, /* @ts-ignore */
|
|
1891
|
+
...(ngDevMode ? [{ debugName: "minOneHint" }] : /* istanbul ignore next */ []));
|
|
1892
|
+
minOneLabel = computed(() => this.#i18n.t('core.component.query-bar.required-min-one'), /* @ts-ignore */
|
|
1893
|
+
...(ngDevMode ? [{ debugName: "minOneLabel" }] : /* istanbul ignore next */ []));
|
|
1894
|
+
hintId = `sd-query-inline-chip-hint-${nextHintId++}`;
|
|
1895
|
+
/** `aria-describedby` of the chip: the host's required hint and, while shown, the min-one line. */
|
|
1896
|
+
describedByIds = computed(() => [this.describedBy(), this.minOneHint() ? this.hintId : undefined].filter(Boolean).join(' ') || null, /* @ts-ignore */
|
|
1897
|
+
...(ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []));
|
|
1898
|
+
/** Date, date-time and date-range controls — a refused empty value is written back into them (B3). */
|
|
1899
|
+
dateControl = viewChild(SdDate, /* @ts-ignore */
|
|
1900
|
+
...(ngDevMode ? [{ debugName: "dateControl" }] : /* istanbul ignore next */ []));
|
|
1901
|
+
datetimeControl = viewChild(SdDatetime, /* @ts-ignore */
|
|
1902
|
+
...(ngDevMode ? [{ debugName: "datetimeControl" }] : /* istanbul ignore next */ []));
|
|
1903
|
+
dateRangeControl = viewChild(SdDateRange, /* @ts-ignore */
|
|
1904
|
+
...(ngDevMode ? [{ debugName: "dateRangeControl" }] : /* istanbul ignore next */ []));
|
|
1097
1905
|
// ---------------------------------------------------------------------------
|
|
1098
1906
|
// Edit lifecycle
|
|
1099
1907
|
// ---------------------------------------------------------------------------
|
|
@@ -1112,14 +1920,42 @@ class SdQueryInlineChip {
|
|
|
1112
1920
|
* forwards the value; it no longer toggles `#editing` (that's boolean-only now).
|
|
1113
1921
|
*/
|
|
1114
1922
|
emitSingleCommit(v) {
|
|
1923
|
+
if (this.#keepsRequired(v))
|
|
1924
|
+
return;
|
|
1115
1925
|
this.commit.emit(v);
|
|
1116
1926
|
}
|
|
1117
1927
|
/** BETWEEN commit — sd-date-range (viewed='inline') emits `{from, to}`; chip just forwards it. */
|
|
1118
1928
|
emitRangeCommit(ev) {
|
|
1929
|
+
if (this.#keepsRequired(ev ?? { from: null, to: null }))
|
|
1930
|
+
return;
|
|
1119
1931
|
this.commitRange.emit(ev ?? null);
|
|
1120
1932
|
}
|
|
1933
|
+
/**
|
|
1934
|
+
* B3: a required chip that has a value refuses an empty date, date-time or range — nothing is emitted and the control
|
|
1935
|
+
* shows the previous value again. `true` when refused.
|
|
1936
|
+
*/
|
|
1937
|
+
#keepsRequired(next) {
|
|
1938
|
+
const filter = this.filter();
|
|
1939
|
+
if (!this.required() || !ɵsdQueryFilterActive(filter) || ɵsdQueryFilterActive({ ...filter, data: next }))
|
|
1940
|
+
return false;
|
|
1941
|
+
// why: `[model]="data"` không đổi nên Angular không đẩy lại input, trong khi model của control đã bị chính nó ghi rỗng —
|
|
1942
|
+
// ghi thẳng giá trị trước vào model của control.
|
|
1943
|
+
const previous = this.data();
|
|
1944
|
+
this.dateControl()?.valueModel.set(previous);
|
|
1945
|
+
this.datetimeControl()?.valueModel.set(previous);
|
|
1946
|
+
this.dateRangeControl()?.valueModel.set(previous);
|
|
1947
|
+
return true;
|
|
1948
|
+
}
|
|
1121
1949
|
/** Multi-select live emit (sd-select inline). */
|
|
1122
1950
|
emitLive(v) {
|
|
1951
|
+
if (this.required() && Array.isArray(v) && v.length === 0) {
|
|
1952
|
+
// B3: keep the previous values of a required chip and say why.
|
|
1953
|
+
const previous = this.data();
|
|
1954
|
+
this.selectModel.set(Array.isArray(previous) ? [...previous] : previous);
|
|
1955
|
+
this.minOneHint.set(true);
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
this.minOneHint.set(false);
|
|
1123
1959
|
this.liveChange.emit(v);
|
|
1124
1960
|
}
|
|
1125
1961
|
/** Boolean toggle commit — exits edit. */
|
|
@@ -1128,17 +1964,17 @@ class SdQueryInlineChip {
|
|
|
1128
1964
|
this.#editing.set(false);
|
|
1129
1965
|
}
|
|
1130
1966
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1131
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineChip, isStandalone: true, selector: "sd-query-inline-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, isNoData: { classPropertyName: "isNoData", publicName: "isNoData", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commit: "commit", commitRange: "commitRange", liveChange: "liveChange", remove: "remove" }, ngImport: i0, template: "<!--\n Completed inline chip \u2014 non-string/number/seamless branches.\n Edit lifecycle is self-managed: click enters edit + auto-opens picker,\n focusout outside the wrapper exits edit, picker emits commit single OR\n liveChange (multi) OR commitRange (BETWEEN).\n-->\n@let _field = field();\n@let _operator = operator();\n@let _data = data();\n@let _multiple = multiple();\n@let _editing = editing();\n@let _isNoData = isNoData();\n@let _autoId = autoId();\n\n<div\n class=\"c-token\"\n [class.c-token-editing]=\"_editing\"\n [class.c-token-pinned]=\"pinned()\"\n [class.c-token-invalid]=\"invalid()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\">\n <sd-icon class=\"c-token-icon\" [name]=\"iconName()\"></sd-icon>\n <span class=\"c-token-field\">{{ _field.label }}</span>\n\n @if (!_isNoData && showOperator()) {\n <sd-operator class=\"c-token-op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-token-sep\">:</span>\n }\n\n @if (!_isNoData) {\n @if (_field.type === 'boolean') {\n @if (_editing) {\n <!-- why: native button thay sd-button \u2014 mat-button MDC baseline 36px bu\u1ED9c\n ph\u1EA3i hack height/padding overrides; chip 28/32px nh\u1ECF h\u01A1n nhi\u1EC1u. T\u1EF1 v\u1EBD\n pill nh\u1ECF v\u1EDBi CSS scoped trong chip, kh\u00F4ng qua MDC, g\u1ECDn + chu\u1EA9n baseline. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_data === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"emitBoolean(true)\">\n {{ $any(_field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_data === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"emitBoolean(false)\">\n {{ $any(_field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <button type=\"button\" class=\"c-token-value\" (click)=\"enterEdit()\">{{ valueText() }}</button>\n }\n } @else if ((_field.type === 'date' || _field.type === 'datetime') && _operator === 'BETWEEN') {\n <!-- why: sd-date-range [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout (datetime downgrade v\u1EC1 date).\n Chip kh\u00F4ng wiring lifecycle n\u1EEFa; [clearable]=false v\u00EC chip c\u00F3 \u00D7 ri\u00EAng. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date-range size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitRangeCommit($any($event))\"></sd-date-range>\n </span>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <!-- why: sd-select [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout\u2192tho\u00E1t + bare editor.\n Chip kh\u00F4ng wiring lifecycle cho nh\u00E1nh n\u00E0y n\u1EEFa (b\u1ECF enterEdit/onFocusOut/bare). -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #chipPicker size=\"sm\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_field.type === 'lazy-values' ? $any(_opt).search : $any(_opt.items)\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"_multiple\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"_multiple ? emitLive($event) : emitSingleCommit($event)\">\n <!-- why: viewed mode m\u1EB7c \u0111\u1ECBnh d\u00F9ng comma-joined cho multi \u2014 qu\u00E1 d\u00E0i cho chip.\n Override b\u1EB1ng template \"head +N\" gi\u1ED1ng popover chipValueText. -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-date>\n </span>\n } @else if (_field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-datetime size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-datetime>\n </span>\n } @else {\n <!-- Fallback (unforeseen type) \u2014 read-only display via valueText. -->\n <span class=\"c-token-value\">{{ valueText() }}</span>\n }\n }\n\n @if (!pinned()) {\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Remove filter\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</div>\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token.c-token-pinned{padding-right:12px}.c-token.c-token-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1967
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineChip, isStandalone: true, selector: "sd-query-inline-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, isNoData: { classPropertyName: "isNoData", publicName: "isNoData", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commit: "commit", commitRange: "commitRange", liveChange: "liveChange", remove: "remove" }, viewQueries: [{ propertyName: "dateControl", first: true, predicate: SdDate, descendants: true, isSignal: true }, { propertyName: "datetimeControl", first: true, predicate: SdDatetime, descendants: true, isSignal: true }, { propertyName: "dateRangeControl", first: true, predicate: SdDateRange, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n Completed inline chip \u2014 non-string/number/seamless branches.\n Edit lifecycle is self-managed: click enters edit + auto-opens picker,\n focusout outside the wrapper exits edit, picker emits commit single OR\n liveChange (multi) OR commitRange (BETWEEN).\n-->\n@let _field = field();\n@let _operator = operator();\n@let _data = data();\n@let _multiple = multiple();\n@let _editing = editing();\n@let _isNoData = isNoData();\n@let _autoId = autoId();\n\n<div\n class=\"c-token\"\n [class.c-token-editing]=\"_editing\"\n [class.c-token-pinned]=\"pinned()\"\n [class.c-token-invalid]=\"invalid()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedByIds()\">\n <sd-icon class=\"c-token-icon\" [name]=\"iconName()\"></sd-icon>\n <span class=\"c-token-field\">{{ _field.label }}</span>\n\n @if (!_isNoData && showOperator()) {\n <sd-operator class=\"c-token-op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-token-sep\">:</span>\n }\n\n @if (!_isNoData) {\n @if (_field.type === 'boolean') {\n @if (_editing) {\n <!-- why: native button thay sd-button \u2014 mat-button MDC baseline 36px bu\u1ED9c\n ph\u1EA3i hack height/padding overrides; chip 28/32px nh\u1ECF h\u01A1n nhi\u1EC1u. T\u1EF1 v\u1EBD\n pill nh\u1ECF v\u1EDBi CSS scoped trong chip, kh\u00F4ng qua MDC, g\u1ECDn + chu\u1EA9n baseline. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_data === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"emitBoolean(true)\">\n {{ $any(_field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_data === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"emitBoolean(false)\">\n {{ $any(_field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <button type=\"button\" class=\"c-token-value\" (click)=\"enterEdit()\">{{ valueText() }}</button>\n }\n } @else if ((_field.type === 'date' || _field.type === 'datetime') && _operator === 'BETWEEN') {\n <!-- why: sd-date-range [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout (datetime downgrade v\u1EC1 date).\n Chip kh\u00F4ng wiring lifecycle n\u1EEFa; [clearable]=false v\u00EC chip c\u00F3 \u00D7 ri\u00EAng. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date-range size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitRangeCommit($any($event))\"></sd-date-range>\n </span>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <!-- why: sd-select [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout\u2192tho\u00E1t + bare editor.\n Chip kh\u00F4ng wiring lifecycle cho nh\u00E1nh n\u00E0y n\u1EEFa (b\u1ECF enterEdit/onFocusOut/bare). -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #chipPicker size=\"sm\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_field.type === 'lazy-values' ? $any(_opt).search : $any(_opt.items)\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"_multiple\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [required]=\"required()\"\n [model]=\"$any(selectModel())\"\n (sdChange)=\"_multiple ? emitLive($event) : emitSingleCommit($event)\">\n <!-- why: viewed mode m\u1EB7c \u0111\u1ECBnh d\u00F9ng comma-joined cho multi \u2014 qu\u00E1 d\u00E0i cho chip.\n Override b\u1EB1ng template \"head +N\" gi\u1ED1ng popover chipValueText. -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-date>\n </span>\n } @else if (_field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-datetime size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-datetime>\n </span>\n } @else {\n <!-- Fallback (unforeseen type) \u2014 read-only display via valueText. -->\n <span class=\"c-token-value\">{{ valueText() }}</span>\n }\n }\n\n @if (!pinned()) {\n <button type=\"button\" class=\"c-token-remove\" [attr.aria-label]=\"removeLabel()\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</div>\n<!-- why: ngo\u00E0i .c-token (overflow: hidden c\u1EAFt n\u1ED9i dung) \u2014 host l\u00E0 display: contents n\u00EAn d\u00F2ng nh\u1EAFc n\u1EB1m ngay sau chip. -->\n@if (minOneHint()) {\n <span class=\"c-token-required-hint\" aria-live=\"polite\" [id]=\"hintId\">{{ minOneLabel() }}</span>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token.c-token-pinned{padding-right:12px}.c-token.c-token-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-token:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.c-token-required-hint{align-self:center;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555);white-space:nowrap}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1132
1968
|
}
|
|
1133
1969
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineChip, decorators: [{
|
|
1134
1970
|
type: Component,
|
|
1135
|
-
args: [{ selector: 'sd-query-inline-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, CommonModule, SdOperator, SdDate, SdDateRange, SdDatetime, SdSelect], template: "<!--\n Completed inline chip \u2014 non-string/number/seamless branches.\n Edit lifecycle is self-managed: click enters edit + auto-opens picker,\n focusout outside the wrapper exits edit, picker emits commit single OR\n liveChange (multi) OR commitRange (BETWEEN).\n-->\n@let _field = field();\n@let _operator = operator();\n@let _data = data();\n@let _multiple = multiple();\n@let _editing = editing();\n@let _isNoData = isNoData();\n@let _autoId = autoId();\n\n<div\n class=\"c-token\"\n [class.c-token-editing]=\"_editing\"\n [class.c-token-pinned]=\"pinned()\"\n [class.c-token-invalid]=\"invalid()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\">\n <sd-icon class=\"c-token-icon\" [name]=\"iconName()\"></sd-icon>\n <span class=\"c-token-field\">{{ _field.label }}</span>\n\n @if (!_isNoData && showOperator()) {\n <sd-operator class=\"c-token-op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-token-sep\">:</span>\n }\n\n @if (!_isNoData) {\n @if (_field.type === 'boolean') {\n @if (_editing) {\n <!-- why: native button thay sd-button \u2014 mat-button MDC baseline 36px bu\u1ED9c\n ph\u1EA3i hack height/padding overrides; chip 28/32px nh\u1ECF h\u01A1n nhi\u1EC1u. T\u1EF1 v\u1EBD\n pill nh\u1ECF v\u1EDBi CSS scoped trong chip, kh\u00F4ng qua MDC, g\u1ECDn + chu\u1EA9n baseline. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_data === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"emitBoolean(true)\">\n {{ $any(_field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_data === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"emitBoolean(false)\">\n {{ $any(_field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <button type=\"button\" class=\"c-token-value\" (click)=\"enterEdit()\">{{ valueText() }}</button>\n }\n } @else if ((_field.type === 'date' || _field.type === 'datetime') && _operator === 'BETWEEN') {\n <!-- why: sd-date-range [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout (datetime downgrade v\u1EC1 date).\n Chip kh\u00F4ng wiring lifecycle n\u1EEFa; [clearable]=false v\u00EC chip c\u00F3 \u00D7 ri\u00EAng. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date-range size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitRangeCommit($any($event))\"></sd-date-range>\n </span>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <!-- why: sd-select [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout\u2192tho\u00E1t + bare editor.\n Chip kh\u00F4ng wiring lifecycle cho nh\u00E1nh n\u00E0y n\u1EEFa (b\u1ECF enterEdit/onFocusOut/bare). -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #chipPicker size=\"sm\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_field.type === 'lazy-values' ? $any(_opt).search : $any(_opt.items)\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"_multiple\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"_multiple ? emitLive($event) : emitSingleCommit($event)\">\n <!-- why: viewed mode m\u1EB7c \u0111\u1ECBnh d\u00F9ng comma-joined cho multi \u2014 qu\u00E1 d\u00E0i cho chip.\n Override b\u1EB1ng template \"head +N\" gi\u1ED1ng popover chipValueText. -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-date>\n </span>\n } @else if (_field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-datetime size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-datetime>\n </span>\n } @else {\n <!-- Fallback (unforeseen type) \u2014 read-only display via valueText. -->\n <span class=\"c-token-value\">{{ valueText() }}</span>\n }\n }\n\n @if (!pinned()) {\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Remove filter\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</div>\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token.c-token-pinned{padding-right:12px}.c-token.c-token-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"] }]
|
|
1136
|
-
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], isNoData: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNoData", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], commit: [{ type: i0.Output, args: ["commit"] }], commitRange: [{ type: i0.Output, args: ["commitRange"] }], liveChange: [{ type: i0.Output, args: ["liveChange"] }], remove: [{ type: i0.Output, args: ["remove"] }] } });
|
|
1971
|
+
args: [{ selector: 'sd-query-inline-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, CommonModule, SdOperator, SdDate, SdDateRange, SdDatetime, SdSelect], template: "<!--\n Completed inline chip \u2014 non-string/number/seamless branches.\n Edit lifecycle is self-managed: click enters edit + auto-opens picker,\n focusout outside the wrapper exits edit, picker emits commit single OR\n liveChange (multi) OR commitRange (BETWEEN).\n-->\n@let _field = field();\n@let _operator = operator();\n@let _data = data();\n@let _multiple = multiple();\n@let _editing = editing();\n@let _isNoData = isNoData();\n@let _autoId = autoId();\n\n<div\n class=\"c-token\"\n [class.c-token-editing]=\"_editing\"\n [class.c-token-pinned]=\"pinned()\"\n [class.c-token-invalid]=\"invalid()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedByIds()\">\n <sd-icon class=\"c-token-icon\" [name]=\"iconName()\"></sd-icon>\n <span class=\"c-token-field\">{{ _field.label }}</span>\n\n @if (!_isNoData && showOperator()) {\n <sd-operator class=\"c-token-op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-token-sep\">:</span>\n }\n\n @if (!_isNoData) {\n @if (_field.type === 'boolean') {\n @if (_editing) {\n <!-- why: native button thay sd-button \u2014 mat-button MDC baseline 36px bu\u1ED9c\n ph\u1EA3i hack height/padding overrides; chip 28/32px nh\u1ECF h\u01A1n nhi\u1EC1u. T\u1EF1 v\u1EBD\n pill nh\u1ECF v\u1EDBi CSS scoped trong chip, kh\u00F4ng qua MDC, g\u1ECDn + chu\u1EA9n baseline. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_data === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"emitBoolean(true)\">\n {{ $any(_field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_data === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"emitBoolean(false)\">\n {{ $any(_field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <button type=\"button\" class=\"c-token-value\" (click)=\"enterEdit()\">{{ valueText() }}</button>\n }\n } @else if ((_field.type === 'date' || _field.type === 'datetime') && _operator === 'BETWEEN') {\n <!-- why: sd-date-range [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout (datetime downgrade v\u1EC1 date).\n Chip kh\u00F4ng wiring lifecycle n\u1EEFa; [clearable]=false v\u00EC chip c\u00F3 \u00D7 ri\u00EAng. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date-range size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitRangeCommit($any($event))\"></sd-date-range>\n </span>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <!-- why: sd-select [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout\u2192tho\u00E1t + bare editor.\n Chip kh\u00F4ng wiring lifecycle cho nh\u00E1nh n\u00E0y n\u1EEFa (b\u1ECF enterEdit/onFocusOut/bare). -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #chipPicker size=\"sm\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_field.type === 'lazy-values' ? $any(_opt).search : $any(_opt.items)\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"_multiple\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [required]=\"required()\"\n [model]=\"$any(selectModel())\"\n (sdChange)=\"_multiple ? emitLive($event) : emitSingleCommit($event)\">\n <!-- why: viewed mode m\u1EB7c \u0111\u1ECBnh d\u00F9ng comma-joined cho multi \u2014 qu\u00E1 d\u00E0i cho chip.\n Override b\u1EB1ng template \"head +N\" gi\u1ED1ng popover chipValueText. -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-date>\n </span>\n } @else if (_field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-datetime size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-datetime>\n </span>\n } @else {\n <!-- Fallback (unforeseen type) \u2014 read-only display via valueText. -->\n <span class=\"c-token-value\">{{ valueText() }}</span>\n }\n }\n\n @if (!pinned()) {\n <button type=\"button\" class=\"c-token-remove\" [attr.aria-label]=\"removeLabel()\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</div>\n<!-- why: ngo\u00E0i .c-token (overflow: hidden c\u1EAFt n\u1ED9i dung) \u2014 host l\u00E0 display: contents n\u00EAn d\u00F2ng nh\u1EAFc n\u1EB1m ngay sau chip. -->\n@if (minOneHint()) {\n <span class=\"c-token-required-hint\" aria-live=\"polite\" [id]=\"hintId\">{{ minOneLabel() }}</span>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token.c-token-pinned{padding-right:12px}.c-token.c-token-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-token:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:2px}.c-token-required-hint{align-self:center;font-size:var(--sd-font-size-12, 12px);color:var(--sd-text-secondary, #555);white-space:nowrap}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"] }]
|
|
1972
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], isNoData: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNoData", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], commit: [{ type: i0.Output, args: ["commit"] }], commitRange: [{ type: i0.Output, args: ["commitRange"] }], liveChange: [{ type: i0.Output, args: ["liveChange"] }], remove: [{ type: i0.Output, args: ["remove"] }], dateControl: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdDate), { isSignal: true }] }], datetimeControl: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdDatetime), { isSignal: true }] }], dateRangeControl: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdDateRange), { isSignal: true }] }] } });
|
|
1137
1973
|
|
|
1138
1974
|
/**
|
|
1139
|
-
* Compact popover-mode chip face. Click → opens the parent-supplied [
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1975
|
+
* Compact popover-mode chip face. Click, Enter or Space → opens the parent-supplied [panel] (the chip popover dialog).
|
|
1976
|
+
* Inert div[role=button] so the nested <sd-operator> doesn't end up as a button-in-button (invalid HTML).
|
|
1977
|
+
* The × is a `<button>` beside that trigger, never inside it.
|
|
1142
1978
|
*/
|
|
1143
1979
|
class SdQueryPopoverChip {
|
|
1144
1980
|
/** Resolved field (from the bar's `fieldByKey()` map). `undefined` → render raw key. */
|
|
@@ -1165,69 +2001,227 @@ class SdQueryPopoverChip {
|
|
|
1165
2001
|
/** Read-only chip — does not open its popover. */
|
|
1166
2002
|
disabled = input(false, /* @ts-ignore */
|
|
1167
2003
|
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2004
|
+
/** Chip of a required field — `aria-required`. */
|
|
2005
|
+
required = input(false, /* @ts-ignore */
|
|
2006
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
1168
2007
|
/** Required chip without a value — error look, `aria-invalid`. */
|
|
1169
2008
|
invalid = input(false, /* @ts-ignore */
|
|
1170
2009
|
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
1171
2010
|
/** Id set as `aria-describedby` (the host's required hint). */
|
|
1172
2011
|
describedBy = input(undefined, /* @ts-ignore */
|
|
1173
2012
|
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
1174
|
-
/** Chip popover
|
|
1175
|
-
|
|
1176
|
-
...(ngDevMode ? [{ debugName: "
|
|
1177
|
-
/** Fired when the chip popover opens (parent seeds its editing state). */
|
|
2013
|
+
/** Chip popover panel supplied by the parent. */
|
|
2014
|
+
panel = input.required(/* @ts-ignore */
|
|
2015
|
+
...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
|
|
2016
|
+
/** Fired when the chip popover opens, before it renders (parent seeds its editing state). */
|
|
1178
2017
|
open = output();
|
|
1179
2018
|
/** Fired when the user clicks the × removal icon. */
|
|
1180
2019
|
remove = output();
|
|
1181
2020
|
iconFor = sdQueryFieldIcon;
|
|
2021
|
+
#i18n = inject(I18nService);
|
|
2022
|
+
/** `aria-label` of the × — names the field, in the current language. */
|
|
2023
|
+
removeLabel = computed(() => this.#i18n.t('core.component.query-bar.remove-filter', { label: this.field()?.label || this.filterField() }), /* @ts-ignore */
|
|
2024
|
+
...(ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []));
|
|
1182
2025
|
filterField() {
|
|
1183
2026
|
return this.filter().field;
|
|
1184
2027
|
}
|
|
1185
2028
|
filterOperator() {
|
|
1186
2029
|
return this.filter().operator;
|
|
1187
2030
|
}
|
|
1188
|
-
// why: parent's add
|
|
1189
|
-
//
|
|
1190
|
-
|
|
1191
|
-
|
|
2031
|
+
// why: parent's add flow auto-opens the chip popover after render, and removeFilter closes the open one — expose
|
|
2032
|
+
// open/close so the parent doesn't need a ViewChild on the internal panel trigger.
|
|
2033
|
+
trigger = viewChild('chipTrigger', { ...(ngDevMode ? { debugName: "trigger" } : /* istanbul ignore next */ {}), read: ɵSdQueryPanelTriggerDirective });
|
|
2034
|
+
/** The chip popover is open for this chip. */
|
|
2035
|
+
isOpen() {
|
|
2036
|
+
return !!this.trigger()?.expanded();
|
|
2037
|
+
}
|
|
1192
2038
|
/**
|
|
1193
2039
|
* Opens the chip popover. With `returnFocusTo`, that element (e.g. the host control that asked
|
|
1194
2040
|
* for the chip) gets focus back when the popover closes, instead of the chip.
|
|
1195
2041
|
*/
|
|
1196
2042
|
openMenu(returnFocusTo) {
|
|
1197
|
-
|
|
1198
|
-
if (!trigger)
|
|
1199
|
-
return;
|
|
1200
|
-
if (returnFocusTo) {
|
|
1201
|
-
trigger.restoreFocus = false;
|
|
1202
|
-
trigger.menuClosed.pipe(take(1)).subscribe(() => {
|
|
1203
|
-
trigger.restoreFocus = true;
|
|
1204
|
-
returnFocusTo.focus();
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
trigger.openMenu();
|
|
2043
|
+
this.trigger()?.openMenu(returnFocusTo);
|
|
1208
2044
|
}
|
|
1209
2045
|
closeMenu() {
|
|
1210
2046
|
this.trigger()?.closeMenu();
|
|
1211
2047
|
}
|
|
1212
2048
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryPopoverChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1213
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryPopoverChip, isStandalone: true, selector: "sd-query-popover-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null },
|
|
2049
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryPopoverChip, isStandalone: true, selector: "sd-query-popover-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null }, panel: { classPropertyName: "panel", publicName: "panel", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open", remove: "remove" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["chipTrigger"], descendants: true, read: ɵSdQueryPanelTriggerDirective, isSignal: true }], ngImport: i0, template: "<!-- why: div[role=button] (not <button>) so the nested <sd-operator> isn't button-in-button (invalid HTML). -->\n@let _active = active();\n@let _field = field();\n@let _filterField = filterField();\n@let _filterOperator = filterOperator();\n@let _emptyText = emptyText();\n@let _invalid = invalid();\n@let _removable = _active && !pinned();\n\n<!-- why: n\u00FAt \u00D7 l\u00E0 anh em c\u1EE7a trigger, kh\u00F4ng n\u1EB1m trong n\u00F3 (n\u00FAt l\u1ED3ng n\u00FAt \u2014 R1 G-4). V\u1ECF `.c-chip-shell` \u0111\u1EB7t \u00D7 \u0111\u00E8 l\u00EAn \u0111u\u00F4i\n vi\u00EAn chip, n\u00EAn chip gi\u1EEF nguy\u00EAn k\u00EDch th\u01B0\u1EDBc v\u00E0 h\u00ECnh d\u1EA1ng. -->\n<div class=\"c-chip-shell\">\n @if (disabled()) {\n <!-- why: chip ch\u1EC9 \u0111\u1ECDc kh\u00F4ng g\u1EAFn trigger c\u1EE7a panel \u2014 kh\u00F4ng c\u00F3 c\u00E1ch n\u00E0o m\u1EDF popover, k\u1EC3 c\u1EA3 openMenu() c\u1EE7a parent. -->\n <div\n role=\"button\"\n tabindex=\"0\"\n aria-disabled=\"true\"\n class=\"c-chip c-chip-disabled\"\n [class.c-chip-active]=\"_active\"\n [class.c-chip-inactive]=\"!_active\"\n [attr.data-field]=\"_filterField\"\n [matTooltip]=\"_field?.label || _filterField\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n </div>\n } @else {\n <div\n #chipTrigger\n role=\"button\"\n tabindex=\"0\"\n class=\"c-chip\"\n [class.c-chip-active]=\"_active\"\n [class.c-chip-inactive]=\"!_active\"\n [class.c-chip-pinned]=\"pinned()\"\n [class.c-chip-removable]=\"_removable\"\n [class.c-chip-invalid]=\"_invalid\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"_invalid ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-field]=\"_filterField\"\n [matTooltip]=\"_field?.label || _filterField\"\n [sdQueryPanelTrigger]=\"panel()\"\n (panelOpened)=\"open.emit()\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n </div>\n\n @if (_removable) {\n <button type=\"button\" class=\"c-chip-remove\" [attr.aria-label]=\"removeLabel()\" (click)=\"$event.stopPropagation(); remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n }\n</div>\n\n<ng-template #face>\n <sd-icon class=\"c-chip-icon\" [name]=\"_field ? iconFor(_field) : 'tune'\"></sd-icon>\n <span class=\"c-chip-label\">{{ _field?.label || _filterField }}</span>\n\n @if (showOperator() && _active) {\n <sd-operator class=\"c-chip-operator\" [operators]=\"[_filterOperator]\" [model]=\"_filterOperator\" size=\"xs\" readonly />\n } @else if (_active || _emptyText) {\n <span class=\"c-chip-sep\">:</span>\n }\n\n @if (_active) {\n <span class=\"c-chip-value\">{{ valueText() }}</span>\n } @else if (_emptyText) {\n <span class=\"c-chip-value c-chip-value--empty\">{{ _emptyText }}</span>\n }\n\n <sd-icon class=\"c-chip-chevron\" name=\"arrow_drop_down\"></sd-icon>\n</ng-template>\n", styles: [":host{display:contents}.c-chip-shell{position:relative;display:inline-flex;align-items:center}.c-chip{display:inline-flex;align-items:center;gap:4px;padding:0 4px 0 10px;border-radius:999px;border:1px solid var(--sd-query-bar-border, #d6d8db);background:var(--sd-query-bar-bg, #ffffff);cursor:pointer;font-family:inherit;font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text-secondary, #5f6368);transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-compact) .c-chip{height:28px}:host-context(.c-density-comfortable) .c-chip{height:32px}.c-chip:hover{border-color:var(--sd-primary)}.c-chip.c-chip-active{border-color:var(--sd-primary-light);background:var(--sd-primary-light)}.c-chip.c-chip-active .c-chip-value{color:var(--sd-primary)}.c-chip.c-chip-inactive{padding-right:10px}.c-chip.c-chip-pinned.c-chip-active{padding-right:4px}.c-chip.c-chip-removable{padding-right:28px}.c-chip.c-chip-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-chip.c-chip-invalid .c-chip-value{color:var(--sd-query-bar-chip-danger, #d23535)}.c-chip.c-chip-disabled{cursor:default;opacity:.6}.c-chip.c-chip-disabled:hover{border-color:var(--sd-query-bar-border, #d6d8db)}.c-chip.c-chip-disabled.c-chip-active:hover{border-color:var(--sd-primary-light)}.c-chip .c-chip-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px}.c-chip .c-chip-label{font-weight:var(--sd-font-weight-medium, 500);white-space:nowrap}.c-chip .c-chip-operator{display:inline-flex;align-items:center;color:inherit}.c-chip .c-chip-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip .c-chip-value{font-weight:var(--sd-font-weight-medium, 500);max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-chip .c-chip-value.c-chip-value--empty{font-weight:var(--sd-font-weight-regular, 400);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip .c-chip-chevron{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px;color:currentColor}.c-chip-remove{position:absolute;top:50%;right:5px;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:20px;height:20px;padding:0;border:0;border-radius:50%;background:transparent;font:inherit;cursor:pointer;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-chip-remove:hover{background:#0000000f}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ɵSdQueryPanelTriggerDirective, selector: "[sdQueryPanelTrigger]", inputs: ["sdQueryPanelTrigger"], outputs: ["panelOpened", "panelClosed"], exportAs: ["sdQueryPanelTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1214
2050
|
}
|
|
1215
2051
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryPopoverChip, decorators: [{
|
|
1216
2052
|
type: Component,
|
|
1217
|
-
args: [{ selector: 'sd-query-popover-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon,
|
|
1218
|
-
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }],
|
|
2053
|
+
args: [{ selector: 'sd-query-popover-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatTooltipModule, SdOperator, NgTemplateOutlet, ɵSdQueryPanelTriggerDirective], template: "<!-- why: div[role=button] (not <button>) so the nested <sd-operator> isn't button-in-button (invalid HTML). -->\n@let _active = active();\n@let _field = field();\n@let _filterField = filterField();\n@let _filterOperator = filterOperator();\n@let _emptyText = emptyText();\n@let _invalid = invalid();\n@let _removable = _active && !pinned();\n\n<!-- why: n\u00FAt \u00D7 l\u00E0 anh em c\u1EE7a trigger, kh\u00F4ng n\u1EB1m trong n\u00F3 (n\u00FAt l\u1ED3ng n\u00FAt \u2014 R1 G-4). V\u1ECF `.c-chip-shell` \u0111\u1EB7t \u00D7 \u0111\u00E8 l\u00EAn \u0111u\u00F4i\n vi\u00EAn chip, n\u00EAn chip gi\u1EEF nguy\u00EAn k\u00EDch th\u01B0\u1EDBc v\u00E0 h\u00ECnh d\u1EA1ng. -->\n<div class=\"c-chip-shell\">\n @if (disabled()) {\n <!-- why: chip ch\u1EC9 \u0111\u1ECDc kh\u00F4ng g\u1EAFn trigger c\u1EE7a panel \u2014 kh\u00F4ng c\u00F3 c\u00E1ch n\u00E0o m\u1EDF popover, k\u1EC3 c\u1EA3 openMenu() c\u1EE7a parent. -->\n <div\n role=\"button\"\n tabindex=\"0\"\n aria-disabled=\"true\"\n class=\"c-chip c-chip-disabled\"\n [class.c-chip-active]=\"_active\"\n [class.c-chip-inactive]=\"!_active\"\n [attr.data-field]=\"_filterField\"\n [matTooltip]=\"_field?.label || _filterField\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n </div>\n } @else {\n <div\n #chipTrigger\n role=\"button\"\n tabindex=\"0\"\n class=\"c-chip\"\n [class.c-chip-active]=\"_active\"\n [class.c-chip-inactive]=\"!_active\"\n [class.c-chip-pinned]=\"pinned()\"\n [class.c-chip-removable]=\"_removable\"\n [class.c-chip-invalid]=\"_invalid\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"_invalid ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-field]=\"_filterField\"\n [matTooltip]=\"_field?.label || _filterField\"\n [sdQueryPanelTrigger]=\"panel()\"\n (panelOpened)=\"open.emit()\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n </div>\n\n @if (_removable) {\n <button type=\"button\" class=\"c-chip-remove\" [attr.aria-label]=\"removeLabel()\" (click)=\"$event.stopPropagation(); remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n }\n</div>\n\n<ng-template #face>\n <sd-icon class=\"c-chip-icon\" [name]=\"_field ? iconFor(_field) : 'tune'\"></sd-icon>\n <span class=\"c-chip-label\">{{ _field?.label || _filterField }}</span>\n\n @if (showOperator() && _active) {\n <sd-operator class=\"c-chip-operator\" [operators]=\"[_filterOperator]\" [model]=\"_filterOperator\" size=\"xs\" readonly />\n } @else if (_active || _emptyText) {\n <span class=\"c-chip-sep\">:</span>\n }\n\n @if (_active) {\n <span class=\"c-chip-value\">{{ valueText() }}</span>\n } @else if (_emptyText) {\n <span class=\"c-chip-value c-chip-value--empty\">{{ _emptyText }}</span>\n }\n\n <sd-icon class=\"c-chip-chevron\" name=\"arrow_drop_down\"></sd-icon>\n</ng-template>\n", styles: [":host{display:contents}.c-chip-shell{position:relative;display:inline-flex;align-items:center}.c-chip{display:inline-flex;align-items:center;gap:4px;padding:0 4px 0 10px;border-radius:999px;border:1px solid var(--sd-query-bar-border, #d6d8db);background:var(--sd-query-bar-bg, #ffffff);cursor:pointer;font-family:inherit;font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text-secondary, #5f6368);transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-compact) .c-chip{height:28px}:host-context(.c-density-comfortable) .c-chip{height:32px}.c-chip:hover{border-color:var(--sd-primary)}.c-chip.c-chip-active{border-color:var(--sd-primary-light);background:var(--sd-primary-light)}.c-chip.c-chip-active .c-chip-value{color:var(--sd-primary)}.c-chip.c-chip-inactive{padding-right:10px}.c-chip.c-chip-pinned.c-chip-active{padding-right:4px}.c-chip.c-chip-removable{padding-right:28px}.c-chip.c-chip-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-chip.c-chip-invalid .c-chip-value{color:var(--sd-query-bar-chip-danger, #d23535)}.c-chip.c-chip-disabled{cursor:default;opacity:.6}.c-chip.c-chip-disabled:hover{border-color:var(--sd-query-bar-border, #d6d8db)}.c-chip.c-chip-disabled.c-chip-active:hover{border-color:var(--sd-primary-light)}.c-chip .c-chip-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px}.c-chip .c-chip-label{font-weight:var(--sd-font-weight-medium, 500);white-space:nowrap}.c-chip .c-chip-operator{display:inline-flex;align-items:center;color:inherit}.c-chip .c-chip-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip .c-chip-value{font-weight:var(--sd-font-weight-medium, 500);max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-chip .c-chip-value.c-chip-value--empty{font-weight:var(--sd-font-weight-regular, 400);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip .c-chip-chevron{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px;color:currentColor}.c-chip-remove{position:absolute;top:50%;right:5px;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:20px;height:20px;padding:0;border:0;border-radius:50%;background:transparent;font:inherit;cursor:pointer;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-chip-remove:hover{background:#0000000f}\n"] }]
|
|
2054
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], panel: [{ type: i0.Input, args: [{ isSignal: true, alias: "panel", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], remove: [{ type: i0.Output, args: ["remove"] }], trigger: [{ type: i0.ViewChild, args: ['chipTrigger', { ...{ read: ɵSdQueryPanelTriggerDirective }, isSignal: true }] }] } });
|
|
1219
2055
|
|
|
1220
|
-
/** Shared empty array — stable reference so template bindings don't churn change detection. */
|
|
1221
|
-
const EMPTY_ARRAY = [];
|
|
1222
|
-
/** Chip date formats — the `dd/MM/yyyy` that sd-date / sd-datetime show in their input. */
|
|
1223
2056
|
const DATE_FORMAT = 'dd/MM/yyyy';
|
|
1224
2057
|
const DATETIME_FORMAT = 'dd/MM/yyyy HH:mm';
|
|
1225
2058
|
const hasValue = (value) => value !== null && value !== undefined && value !== '';
|
|
2059
|
+
/**
|
|
2060
|
+
* Value text of a chip, shared by the query bar and the sd-table phone filters so both show the same string:
|
|
2061
|
+
* one value → its label; several → `first +n`; a date range in one year → `01/10 – 31/10/2026`; one open end →
|
|
2062
|
+
* `From x` / `To y`; `NULL` / `NOT_NULL` → empty.
|
|
2063
|
+
*/
|
|
2064
|
+
const ɵsdQueryChipValueText = (filter, field, context) => {
|
|
2065
|
+
if (SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
2066
|
+
return '';
|
|
2067
|
+
const data = filter.data;
|
|
2068
|
+
if (data === null || data === undefined)
|
|
2069
|
+
return '';
|
|
2070
|
+
if (filter.operator === 'BETWEEN' && data && typeof data === 'object' && !Array.isArray(data)) {
|
|
2071
|
+
return rangeText(field, data, context);
|
|
2072
|
+
}
|
|
2073
|
+
if (Array.isArray(data)) {
|
|
2074
|
+
if (data.length === 0)
|
|
2075
|
+
return '';
|
|
2076
|
+
const head = displayOne(field, data[0], context);
|
|
2077
|
+
return data.length > 1 ? `${head} +${data.length - 1}` : head;
|
|
2078
|
+
}
|
|
2079
|
+
return displayOne(field, data, context);
|
|
2080
|
+
};
|
|
2081
|
+
/** `01/10 – 31/10/2026` inside one year, `From …` / `To …` when one end is open. */
|
|
2082
|
+
const rangeText = (field, range, context) => {
|
|
2083
|
+
const hasFrom = hasValue(range.from);
|
|
2084
|
+
const hasTo = hasValue(range.to);
|
|
2085
|
+
if (field?.type === 'date' && hasFrom && hasTo) {
|
|
2086
|
+
const year = context.toFormat(range.from, 'yyyy');
|
|
2087
|
+
if (year && year === context.toFormat(range.to, 'yyyy')) {
|
|
2088
|
+
return `${context.toFormat(range.from, 'dd/MM')} – ${context.toFormat(range.to, DATE_FORMAT)}`;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
const from = hasFrom ? displayOne(field, range.from, context) : '';
|
|
2092
|
+
const to = hasTo ? displayOne(field, range.to, context) : '';
|
|
2093
|
+
if (hasFrom && hasTo)
|
|
2094
|
+
return `${from} – ${to}`;
|
|
2095
|
+
if (hasFrom)
|
|
2096
|
+
return context.t('core.component.query-bar.range.from', { value: from });
|
|
2097
|
+
if (hasTo)
|
|
2098
|
+
return context.t('core.component.query-bar.range.to', { value: to });
|
|
2099
|
+
return '';
|
|
2100
|
+
};
|
|
2101
|
+
const displayOne = (field, raw, context) => {
|
|
2102
|
+
if (!field)
|
|
2103
|
+
return String(raw);
|
|
2104
|
+
if (field.type === 'boolean') {
|
|
2105
|
+
// why: nhãn mặc định của field boolean phải theo ngôn ngữ đang chọn; consumer vẫn override
|
|
2106
|
+
// được bằng `trueLabel` / `falseLabel` trên chính field.
|
|
2107
|
+
const trueLabel = field.trueLabel ?? context.t('core.component.query-bar.boolean.true');
|
|
2108
|
+
const falseLabel = field.falseLabel ?? context.t('core.component.query-bar.boolean.false');
|
|
2109
|
+
return raw ? trueLabel : falseLabel;
|
|
2110
|
+
}
|
|
2111
|
+
if (field.type === 'date' || field.type === 'datetime') {
|
|
2112
|
+
// why: chip in đúng định dạng của sd-date / sd-datetime, không in chuỗi model `yyyy/MM/dd` hay ISO.
|
|
2113
|
+
return context.toFormat(raw, field.type === 'date' ? DATE_FORMAT : DATETIME_FORMAT) || String(raw);
|
|
2114
|
+
}
|
|
2115
|
+
if (field.type === 'values' || field.type === 'lazy-values') {
|
|
2116
|
+
const opt = field.option;
|
|
2117
|
+
const cachedOptions = context.options ?? [];
|
|
2118
|
+
const items = resolveSyncItems(opt?.items) ?? cachedOptions;
|
|
2119
|
+
const match = items.find((i) => i?.[opt.valueField] === raw);
|
|
2120
|
+
if (match)
|
|
2121
|
+
return String(match[opt.displayField]);
|
|
2122
|
+
const cached = cachedOptions.find((i) => i?.[opt.valueField] === raw);
|
|
2123
|
+
if (cached)
|
|
2124
|
+
return String(cached[opt.displayField]);
|
|
2125
|
+
return context.labels?.get(raw) ?? String(raw);
|
|
2126
|
+
}
|
|
2127
|
+
return String(raw);
|
|
2128
|
+
};
|
|
2129
|
+
const resolveSyncItems = (items) => {
|
|
2130
|
+
if (Array.isArray(items))
|
|
2131
|
+
return items;
|
|
2132
|
+
if (isSignal(items))
|
|
2133
|
+
return items();
|
|
2134
|
+
return null;
|
|
2135
|
+
};
|
|
2136
|
+
/**
|
|
2137
|
+
* Labels of `values` / `lazy-values` chip values that are not in memory (restored from a cache, a URL or the
|
|
2138
|
+
* table's filter): looked up once per field (`values` with an items function) or per field + value (`lazy-values`,
|
|
2139
|
+
* through `views` or `search`). `get` reads a signal, so a view re-renders when a lookup lands.
|
|
2140
|
+
*/
|
|
2141
|
+
class ɵSdQueryChipLabels {
|
|
2142
|
+
/** `field.key` → value → label. Replaced (not mutated) so readers re-render. */
|
|
2143
|
+
#labels = signal(new Map(), /* @ts-ignore */
|
|
2144
|
+
...(ngDevMode ? [{ debugName: "#labels" }] : /* istanbul ignore next */ []));
|
|
2145
|
+
/** Lookups already started — each runs once per field (values) or per field + value (lazy-values). */
|
|
2146
|
+
#requests = new Set();
|
|
2147
|
+
get(key) {
|
|
2148
|
+
return this.#labels().get(key);
|
|
2149
|
+
}
|
|
2150
|
+
resolve(filter, field) {
|
|
2151
|
+
if (!('field' in filter) || SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
2152
|
+
return;
|
|
2153
|
+
if (field?.type !== 'values' && field?.type !== 'lazy-values')
|
|
2154
|
+
return;
|
|
2155
|
+
const data = filter.data;
|
|
2156
|
+
const values = Array.isArray(data) ? data : hasValue(data) ? [data] : [];
|
|
2157
|
+
if (!values.length)
|
|
2158
|
+
return;
|
|
2159
|
+
const key = field.key;
|
|
2160
|
+
if (field.type === 'values') {
|
|
2161
|
+
const items = field.option.items;
|
|
2162
|
+
// why: mảng / signal đã đọc đồng bộ trong displayOne; chỉ hàm (Promise) mới cần nạp.
|
|
2163
|
+
if (typeof items !== 'function' || isSignal(items) || this.#requests.has(key))
|
|
2164
|
+
return;
|
|
2165
|
+
this.#requests.add(key);
|
|
2166
|
+
this.#load(field, () => items());
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
const known = this.#labels().get(key);
|
|
2170
|
+
if (values.every(value => known?.has(value)))
|
|
2171
|
+
return;
|
|
2172
|
+
const request = `${key}|${stringify(data)}`;
|
|
2173
|
+
if (this.#requests.has(request))
|
|
2174
|
+
return;
|
|
2175
|
+
this.#requests.add(request);
|
|
2176
|
+
const option = field.option;
|
|
2177
|
+
this.#load(field, () => (option.views ? option.views(values) : option.search({ type: 'VALUE', value: data })));
|
|
2178
|
+
}
|
|
2179
|
+
#load(field, load) {
|
|
2180
|
+
const option = field.option;
|
|
2181
|
+
let result;
|
|
2182
|
+
try {
|
|
2183
|
+
result = load();
|
|
2184
|
+
}
|
|
2185
|
+
catch {
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
const items = isObservable(result) ? firstValueFrom(result) : Promise.resolve(result);
|
|
2189
|
+
items
|
|
2190
|
+
.then(list => {
|
|
2191
|
+
if (!Array.isArray(list) || !list.length)
|
|
2192
|
+
return;
|
|
2193
|
+
const next = new Map(this.#labels());
|
|
2194
|
+
const labels = new Map(next.get(field.key) ?? []);
|
|
2195
|
+
for (const item of list) {
|
|
2196
|
+
const value = item?.[option.valueField];
|
|
2197
|
+
if (value !== undefined)
|
|
2198
|
+
labels.set(value, String(item[option.displayField]));
|
|
2199
|
+
}
|
|
2200
|
+
next.set(field.key, labels);
|
|
2201
|
+
this.#labels.set(next);
|
|
2202
|
+
})
|
|
2203
|
+
// why: tra nhãn thất bại thì chip giữ giá trị thô — không phải lỗi của thanh.
|
|
2204
|
+
.catch(() => undefined);
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
const stringify = (value) => {
|
|
2208
|
+
try {
|
|
2209
|
+
return Utilities.canonicalStringify(value);
|
|
2210
|
+
}
|
|
2211
|
+
catch {
|
|
2212
|
+
return String(value);
|
|
2213
|
+
}
|
|
2214
|
+
};
|
|
2215
|
+
|
|
2216
|
+
/** Shared empty array — stable reference so template bindings don't churn change detection. */
|
|
2217
|
+
const EMPTY_ARRAY = [];
|
|
1226
2218
|
class SdQueryBar {
|
|
1227
2219
|
#i18n = inject(I18nService);
|
|
1228
2220
|
#injector = inject(Injector);
|
|
1229
2221
|
#host = inject(ElementRef);
|
|
1230
2222
|
#dateTime = inject(SdDateTimeService);
|
|
2223
|
+
/** Labels of restored values (values with an items function, lazy-values). */
|
|
2224
|
+
#labels = new ɵSdQueryChipLabels();
|
|
1231
2225
|
/** All popover-mode chips in order — used to auto-open after addFilter / close before removeFilter. */
|
|
1232
2226
|
popoverChips = viewChildren(SdQueryPopoverChip, /* @ts-ignore */
|
|
1233
2227
|
...(ngDevMode ? [{ debugName: "popoverChips" }] : /* istanbul ignore next */ []));
|
|
@@ -1282,7 +2276,7 @@ class SdQueryBar {
|
|
|
1282
2276
|
/**
|
|
1283
2277
|
* Editing mode:
|
|
1284
2278
|
* - `'popover'` (default) → compact chips; click a chip to edit operator + value in a
|
|
1285
|
-
*
|
|
2279
|
+
* popover panel; the value is committed when the popover closes.
|
|
1286
2280
|
* - `'inline'` → GitLab-style. Each filter's operator + value controls render directly
|
|
1287
2281
|
* on the bar (no popup, no per-filter apply). Edits update `filters` live; the user
|
|
1288
2282
|
* presses the search button (or Enter) once to fire `(apply)`.
|
|
@@ -1306,9 +2300,30 @@ class SdQueryBar {
|
|
|
1306
2300
|
*/
|
|
1307
2301
|
currentQuery = computed(() => this.#buildQuery(), /* @ts-ignore */
|
|
1308
2302
|
...(ngDevMode ? [{ debugName: "currentQuery" }] : /* istanbul ignore next */ []));
|
|
1309
|
-
/**
|
|
2303
|
+
/**
|
|
2304
|
+
* Receive an applied filter from the saved-filters menu — re-install bar state + trigger apply (handoff B4). Entries of
|
|
2305
|
+
* fields the bar no longer has, or of disabled fields, are dropped. A required or pinned field takes the saved chip
|
|
2306
|
+
* only when it has a value; otherwise its current chip (operator included) stays. Required and pinned chips come
|
|
2307
|
+
* first, in field order.
|
|
2308
|
+
*/
|
|
1310
2309
|
onApplyFilter(saved) {
|
|
1311
|
-
this.
|
|
2310
|
+
const fields = this.fieldByKey();
|
|
2311
|
+
const keyOf = (filter) => ('field' in filter ? filter.field : '');
|
|
2312
|
+
const usable = (saved.query.filters ?? []).filter(filter => {
|
|
2313
|
+
const field = fields[keyOf(filter)];
|
|
2314
|
+
return !!field && !field.disabled;
|
|
2315
|
+
});
|
|
2316
|
+
const current = this.filters();
|
|
2317
|
+
const locked = [];
|
|
2318
|
+
for (const field of this.resolvedFields()) {
|
|
2319
|
+
if (!this.isLocked(field))
|
|
2320
|
+
continue;
|
|
2321
|
+
const key = field.key;
|
|
2322
|
+
const fromSaved = usable.find(filter => keyOf(filter) === key && this.isFilterActive(filter));
|
|
2323
|
+
locked.push(fromSaved ?? current.find(filter => keyOf(filter) === key) ?? this.#emptyChip(field));
|
|
2324
|
+
}
|
|
2325
|
+
const rest = usable.filter(filter => !this.isLocked(fields[keyOf(filter)]));
|
|
2326
|
+
this.filters.set([...locked, ...rest]);
|
|
1312
2327
|
this.logic.set(saved.query.logic ?? 'AND');
|
|
1313
2328
|
if (saved.query.search !== undefined)
|
|
1314
2329
|
this.search.set(saved.query.search);
|
|
@@ -1343,6 +2358,15 @@ class SdQueryBar {
|
|
|
1343
2358
|
/** Placeholder của ô tìm kiếm tự do bên trái; `option.searchPlaceholder` thắng i18n. */
|
|
1344
2359
|
searchPlaceholder = computed(() => this.option()?.searchPlaceholder ?? this.#i18n.t('core.component.query-bar.search-placeholder'), /* @ts-ignore */
|
|
1345
2360
|
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
2361
|
+
/** Tên của ô tìm cho trình đọc màn hình: `option.searchPlaceholder` nếu host đặt, không thì key `search`. */
|
|
2362
|
+
searchLabel = computed(() => this.option()?.searchPlaceholder ?? this.#i18n.t('core.component.query-bar.search'), /* @ts-ignore */
|
|
2363
|
+
...(ngDevMode ? [{ debugName: "searchLabel" }] : /* istanbul ignore next */ []));
|
|
2364
|
+
/** Nhãn nút xoá của ô tìm. */
|
|
2365
|
+
searchClearLabel = computed(() => this.#i18n.t('core.component.query-bar.search-clear'), /* @ts-ignore */
|
|
2366
|
+
...(ngDevMode ? [{ debugName: "searchClearLabel" }] : /* istanbul ignore next */ []));
|
|
2367
|
+
/** Nhãn và placeholder của ô Thêm điều kiện (mode inline). */
|
|
2368
|
+
addConditionLabel = computed(() => this.#i18n.t('core.component.query-bar.add-condition'), /* @ts-ignore */
|
|
2369
|
+
...(ngDevMode ? [{ debugName: "addConditionLabel" }] : /* istanbul ignore next */ []));
|
|
1346
2370
|
/** Chữ trên chip ghim đang rỗng. */
|
|
1347
2371
|
allLabel = computed(() => this.#i18n.t('core.component.query-bar.all'), /* @ts-ignore */
|
|
1348
2372
|
...(ngDevMode ? [{ debugName: "allLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -1380,11 +2404,29 @@ class SdQueryBar {
|
|
|
1380
2404
|
...(ngDevMode ? [{ debugName: "resolvedApplyOn" }] : /* istanbul ignore next */ []));
|
|
1381
2405
|
resolvedAppearance = computed(() => this.option()?.appearance ?? 'default', /* @ts-ignore */
|
|
1382
2406
|
...(ngDevMode ? [{ debugName: "resolvedAppearance" }] : /* istanbul ignore next */ []));
|
|
1383
|
-
|
|
2407
|
+
/**
|
|
2408
|
+
* Clear-all is disabled when the host says so, or — with the built-in clearAll() — when no chip but required ones has a
|
|
2409
|
+
* value: there is nothing left to clear (handoff B2).
|
|
2410
|
+
*/
|
|
2411
|
+
resolvedClearDisabled = computed(() => {
|
|
2412
|
+
const option = this.option();
|
|
2413
|
+
return !!option?.clearDisabled || (!option?.onClearAll && this.activeCount() === 0);
|
|
2414
|
+
}, /* @ts-ignore */
|
|
1384
2415
|
...(ngDevMode ? [{ debugName: "resolvedClearDisabled" }] : /* istanbul ignore next */ []));
|
|
1385
2416
|
resolvedInvalidHintId = computed(() => this.option()?.invalidHintId, /* @ts-ignore */
|
|
1386
2417
|
...(ngDevMode ? [{ debugName: "resolvedInvalidHintId" }] : /* istanbul ignore next */ []));
|
|
1387
2418
|
constructor() {
|
|
2419
|
+
// why: B1 — field bắt buộc hoặc ghim luôn có chip. Thiếu thì thêm chip rỗng ngay trong lượt cập nhật filters này
|
|
2420
|
+
// (không phát apply); thanh không bao giờ bỏ chip đó.
|
|
2421
|
+
effect(() => {
|
|
2422
|
+
const filters = this.filters();
|
|
2423
|
+
const fields = this.resolvedFields();
|
|
2424
|
+
untracked(() => {
|
|
2425
|
+
const next = this.#withLockedChips(filters, fields);
|
|
2426
|
+
if (next !== filters)
|
|
2427
|
+
this.filters.set(next);
|
|
2428
|
+
});
|
|
2429
|
+
});
|
|
1388
2430
|
effect(() => {
|
|
1389
2431
|
const option = this.option();
|
|
1390
2432
|
if (!option)
|
|
@@ -1405,7 +2447,7 @@ class SdQueryBar {
|
|
|
1405
2447
|
const fields = this.fieldByKey();
|
|
1406
2448
|
untracked(() => {
|
|
1407
2449
|
for (const filter of filters)
|
|
1408
|
-
this.#
|
|
2450
|
+
this.#labels.resolve(filter, 'field' in filter ? fields[filter.field] : undefined);
|
|
1409
2451
|
});
|
|
1410
2452
|
});
|
|
1411
2453
|
}
|
|
@@ -1426,11 +2468,11 @@ class SdQueryBar {
|
|
|
1426
2468
|
return set;
|
|
1427
2469
|
}, /* @ts-ignore */
|
|
1428
2470
|
...(ngDevMode ? [{ debugName: "usedFieldKeys" }] : /* istanbul ignore next */ []));
|
|
1429
|
-
/** Fields the user can add: pinned fields always have their chip, so the picker leaves them out. */
|
|
2471
|
+
/** Fields the user can add: pinned and required fields always have their chip, so the picker leaves them out. */
|
|
1430
2472
|
pickerFields = computed(() => {
|
|
1431
2473
|
const fields = this.resolvedFields();
|
|
1432
|
-
// why: giữ nguyên ref khi không có field ghim để picker (OnPush) không bị dirty vô cớ.
|
|
1433
|
-
return fields.some(field => field
|
|
2474
|
+
// why: giữ nguyên ref khi không có field ghim / bắt buộc để picker (OnPush) không bị dirty vô cớ.
|
|
2475
|
+
return fields.some(field => this.isLocked(field)) ? fields.filter(field => !this.isLocked(field)) : fields;
|
|
1434
2476
|
}, /* @ts-ignore */
|
|
1435
2477
|
...(ngDevMode ? [{ debugName: "pickerFields" }] : /* istanbul ignore next */ []));
|
|
1436
2478
|
/** "+" is disabled when nothing is left to add. */
|
|
@@ -1454,12 +2496,21 @@ class SdQueryBar {
|
|
|
1454
2496
|
return invalid.length ? invalid : EMPTY_ARRAY;
|
|
1455
2497
|
}, /* @ts-ignore */
|
|
1456
2498
|
...(ngDevMode ? [{ debugName: "invalidFields" }] : /* istanbul ignore next */ []));
|
|
1457
|
-
/**
|
|
1458
|
-
|
|
2499
|
+
/**
|
|
2500
|
+
* Chips holding a value that Clear would empty — the number shown in the clear-all label. Required chips keep their
|
|
2501
|
+
* value on clear, so they are not counted (handoff B2).
|
|
2502
|
+
*/
|
|
2503
|
+
activeCount = computed(() => this.filters().filter(filter => !this.fieldOf(filter)?.required && this.isFilterActive(filter)).length, /* @ts-ignore */
|
|
1459
2504
|
...(ngDevMode ? [{ debugName: "activeCount" }] : /* istanbul ignore next */ []));
|
|
1460
2505
|
/** Render the global AND/OR connector text between chips when `logic === 'OR'`. */
|
|
1461
2506
|
showOrConnector = computed(() => this.resolvedShowLogicToggle() && this.logic() === 'OR' && this.filters().length >= 2, /* @ts-ignore */
|
|
1462
2507
|
...(ngDevMode ? [{ debugName: "showOrConnector" }] : /* istanbul ignore next */ []));
|
|
2508
|
+
/**
|
|
2509
|
+
* "Save current filter" needs something to save: a chip with a value (required chips included — Bước 0, decision 2)
|
|
2510
|
+
* or text in the search box.
|
|
2511
|
+
*/
|
|
2512
|
+
canSaveFilter = computed(() => this.filters().some(filter => this.isFilterActive(filter)) || (this.resolvedShowSearch() && this.search().trim().length > 0), /* @ts-ignore */
|
|
2513
|
+
...(ngDevMode ? [{ debugName: "canSaveFilter" }] : /* istanbul ignore next */ []));
|
|
1463
2514
|
/** Search button is actionable only when there is something to apply and no required field is empty. */
|
|
1464
2515
|
canSearch = computed(() => (this.filters().length > 0 || this.search().trim().length > 0) && this.invalidFields().length === 0, /* @ts-ignore */
|
|
1465
2516
|
...(ngDevMode ? [{ debugName: "canSearch" }] : /* istanbul ignore next */ []));
|
|
@@ -1544,42 +2595,32 @@ class SdQueryBar {
|
|
|
1544
2595
|
* A BETWEEN range is active when either end is set; `{ from: null, to: null }` is empty.
|
|
1545
2596
|
*/
|
|
1546
2597
|
isFilterActive(filter) {
|
|
1547
|
-
|
|
1548
|
-
return true;
|
|
1549
|
-
const data = filter.data;
|
|
1550
|
-
if (data === null || data === undefined || data === '')
|
|
1551
|
-
return false;
|
|
1552
|
-
if (Array.isArray(data))
|
|
1553
|
-
return data.length > 0;
|
|
1554
|
-
if (filter.operator === 'BETWEEN' && typeof data === 'object')
|
|
1555
|
-
return hasValue(data.from) || hasValue(data.to);
|
|
1556
|
-
return true;
|
|
2598
|
+
return ɵsdQueryFilterActive(filter);
|
|
1557
2599
|
}
|
|
1558
2600
|
/** Rendered value text on a chip. */
|
|
1559
2601
|
chipValueText(filter) {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
if (Array.isArray(data)) {
|
|
1569
|
-
if (data.length === 0)
|
|
1570
|
-
return '';
|
|
1571
|
-
const head = this.#displayOne(filter, data[0]);
|
|
1572
|
-
return data.length > 1 ? `${head} +${data.length - 1}` : head;
|
|
1573
|
-
}
|
|
1574
|
-
return this.#displayOne(filter, data);
|
|
2602
|
+
const field = this.fieldOf(filter);
|
|
2603
|
+
return ɵsdQueryChipValueText(filter, field, {
|
|
2604
|
+
t: (key, params) => this.#i18n.t(key, params),
|
|
2605
|
+
toFormat: (value, format) => this.#dateTime.toFormat(value, format),
|
|
2606
|
+
options: this.chipPopover()?.editingOptions() ?? [],
|
|
2607
|
+
labels: field ? this.#labels.get(field.key) : undefined,
|
|
2608
|
+
});
|
|
1575
2609
|
}
|
|
1576
2610
|
/** The field of a chip, or `undefined` for a key the bar does not know. */
|
|
1577
2611
|
fieldOf(filter) {
|
|
1578
2612
|
return 'field' in filter ? this.fieldByKey()[filter.field] : undefined;
|
|
1579
2613
|
}
|
|
1580
|
-
/**
|
|
2614
|
+
/**
|
|
2615
|
+
* Pinned and required chips have no remove button and survive removeFilter / clearAll; an empty one is never dropped
|
|
2616
|
+
* (handoff B1: `required` implies `pinned`).
|
|
2617
|
+
*/
|
|
1581
2618
|
isPinned(filter) {
|
|
1582
|
-
return
|
|
2619
|
+
return this.isLocked(this.fieldOf(filter));
|
|
2620
|
+
}
|
|
2621
|
+
/** The field always has its chip on the bar: `pinned` or `required`. */
|
|
2622
|
+
isLocked(field) {
|
|
2623
|
+
return !!field && (!!field.pinned || !!field.required);
|
|
1583
2624
|
}
|
|
1584
2625
|
/** Empty chip of a required field. */
|
|
1585
2626
|
isInvalid(filter) {
|
|
@@ -1649,17 +2690,36 @@ class SdQueryBar {
|
|
|
1649
2690
|
/** Value committed by a completed inline chip (seamless input, picker, boolean toggle). */
|
|
1650
2691
|
onInlineCommit(index, data) {
|
|
1651
2692
|
const previous = this.filters()[index];
|
|
2693
|
+
if (this.#emptiesRequired(previous, { data }))
|
|
2694
|
+
return;
|
|
1652
2695
|
this.updateFilterData(index, data);
|
|
1653
2696
|
this.#applyIfChanged(previous, this.filters()[index]);
|
|
1654
2697
|
}
|
|
1655
2698
|
/** Range committed by a completed inline BETWEEN chip. */
|
|
1656
2699
|
onInlineRange(index, ev) {
|
|
1657
2700
|
const previous = this.filters()[index];
|
|
2701
|
+
if (this.#emptiesRequired(previous, { data: ev ?? { from: null, to: null } }))
|
|
2702
|
+
return;
|
|
1658
2703
|
this.setFilterRange(index, ev);
|
|
1659
2704
|
this.#applyIfChanged(previous, this.filters()[index]);
|
|
1660
2705
|
}
|
|
2706
|
+
/**
|
|
2707
|
+
* B3: a required chip that has a value cannot become empty — the chips already refuse it; the bar refuses it too when
|
|
2708
|
+
* a host calls the mutators directly. The first empty state (B5) is the only empty one.
|
|
2709
|
+
*/
|
|
2710
|
+
#emptiesRequired(previous, patch) {
|
|
2711
|
+
if (!previous || !this.fieldOf(previous)?.required || !this.isFilterActive(previous))
|
|
2712
|
+
return false;
|
|
2713
|
+
return !this.isFilterActive({ ...previous, ...patch });
|
|
2714
|
+
}
|
|
1661
2715
|
/** Entry point from the field picker — start building a chip for `field`. */
|
|
1662
2716
|
beginBuild(field) {
|
|
2717
|
+
// why: field ghim / bắt buộc luôn có chip sẵn (B1) — host gọi beginBuild cho nó thì đưa tới chip đó, không dựng chip thứ hai.
|
|
2718
|
+
const existing = this.isLocked(field) ? this.filters().findIndex(filter => 'field' in filter && filter.field === field.key) : -1;
|
|
2719
|
+
if (existing >= 0) {
|
|
2720
|
+
afterNextRender(() => this.#focusInlineChip(existing), { injector: this.#injector });
|
|
2721
|
+
return;
|
|
2722
|
+
}
|
|
1663
2723
|
const allowed = sdQueryAllowedOperators(field);
|
|
1664
2724
|
const def = sdQueryDefaultOperator(field);
|
|
1665
2725
|
// why: date/datetime mặc định là BETWEEN — skip operator step để user vào value
|
|
@@ -1677,6 +2737,7 @@ class SdQueryBar {
|
|
|
1677
2737
|
if (SD_QUERY_NO_DATA_OPERATORS.includes(operator)) {
|
|
1678
2738
|
this.#pushComplete(field, operator, null);
|
|
1679
2739
|
this.#building.set(null);
|
|
2740
|
+
this.#returnToAddInput();
|
|
1680
2741
|
return;
|
|
1681
2742
|
}
|
|
1682
2743
|
this.#building.set({ field, operator, step: 'value' });
|
|
@@ -1690,6 +2751,7 @@ class SdQueryBar {
|
|
|
1690
2751
|
if (SD_QUERY_NO_DATA_OPERATORS.includes(op)) {
|
|
1691
2752
|
this.#pushComplete(b.field, op, null);
|
|
1692
2753
|
this.#building.set(null);
|
|
2754
|
+
this.#returnToAddInput();
|
|
1693
2755
|
return;
|
|
1694
2756
|
}
|
|
1695
2757
|
this.#building.set({ ...b, operator: op, step: 'value' });
|
|
@@ -1700,8 +2762,14 @@ class SdQueryBar {
|
|
|
1700
2762
|
const b = this.#building();
|
|
1701
2763
|
if (!b || !b.operator)
|
|
1702
2764
|
return;
|
|
2765
|
+
// B3: an empty value never makes a chip for a required field.
|
|
2766
|
+
if (b.field.required && !this.isFilterActive({ field: b.field.key, operator: b.operator, data: value })) {
|
|
2767
|
+
this.cancelBuild();
|
|
2768
|
+
return;
|
|
2769
|
+
}
|
|
1703
2770
|
this.#pushComplete(b.field, b.operator, value);
|
|
1704
2771
|
this.#building.set(null);
|
|
2772
|
+
this.#returnToAddInput();
|
|
1705
2773
|
}
|
|
1706
2774
|
/**
|
|
1707
2775
|
* Commit from the seamless build chip (string / number). An empty value (blur with no
|
|
@@ -1718,6 +2786,159 @@ class SdQueryBar {
|
|
|
1718
2786
|
/** Abandon the in-progress chip. */
|
|
1719
2787
|
cancelBuild() {
|
|
1720
2788
|
this.#building.set(null);
|
|
2789
|
+
this.#returnToAddInput();
|
|
2790
|
+
}
|
|
2791
|
+
// ---------------------------------------------------------------------------
|
|
2792
|
+
// Inline mode — "Add condition" combobox (handoff section 8)
|
|
2793
|
+
// ---------------------------------------------------------------------------
|
|
2794
|
+
/** The "Add condition" input (inline mode). */
|
|
2795
|
+
addInput = viewChild('addInput', /* @ts-ignore */
|
|
2796
|
+
...(ngDevMode ? [{ debugName: "addInput" }] : /* istanbul ignore next */ []));
|
|
2797
|
+
/** The field picker the box drives. */
|
|
2798
|
+
addPicker = viewChild(SdQueryFieldPicker, /* @ts-ignore */
|
|
2799
|
+
...(ngDevMode ? [{ debugName: "addPicker" }] : /* istanbul ignore next */ []));
|
|
2800
|
+
/** Text typed in the box — filters the field list. */
|
|
2801
|
+
addQuery = signal('', /* @ts-ignore */
|
|
2802
|
+
...(ngDevMode ? [{ debugName: "addQuery" }] : /* istanbul ignore next */ []));
|
|
2803
|
+
/** The chip the first Backspace on an empty box moved focus to; a second Backspace removes it. */
|
|
2804
|
+
#pendingRemove = null;
|
|
2805
|
+
/** A field was picked in the field picker: inline builds a chip from it, popover adds a chip and opens it. */
|
|
2806
|
+
onPick(field) {
|
|
2807
|
+
if (this.resolvedMode() !== 'inline') {
|
|
2808
|
+
this.addFilter(field);
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2811
|
+
this.addQuery.set('');
|
|
2812
|
+
this.beginBuild(field);
|
|
2813
|
+
}
|
|
2814
|
+
/** Opens the field list under the box, keeping focus in the box (combobox). */
|
|
2815
|
+
openAddList() {
|
|
2816
|
+
const input = this.addInput()?.nativeElement;
|
|
2817
|
+
const picker = this.addPicker();
|
|
2818
|
+
if (!input || !picker || input.disabled || picker.panel().isOpen())
|
|
2819
|
+
return;
|
|
2820
|
+
picker.setQuery(this.addQuery());
|
|
2821
|
+
picker.panel().open(input, { focus: false });
|
|
2822
|
+
}
|
|
2823
|
+
/** Typing filters the list and opens it; the first enabled match is pointed at. */
|
|
2824
|
+
onAddInput(text) {
|
|
2825
|
+
this.addQuery.set(text);
|
|
2826
|
+
this.addPicker()?.setQuery(text);
|
|
2827
|
+
this.openAddList();
|
|
2828
|
+
}
|
|
2829
|
+
onAddKeydown(event) {
|
|
2830
|
+
const picker = this.addPicker();
|
|
2831
|
+
if (!picker)
|
|
2832
|
+
return;
|
|
2833
|
+
const open = picker.panel().isOpen();
|
|
2834
|
+
switch (event.key) {
|
|
2835
|
+
case 'ArrowDown':
|
|
2836
|
+
if (!open) {
|
|
2837
|
+
this.openAddList();
|
|
2838
|
+
// Alt+ArrowDown only opens; ArrowDown also points at the first option.
|
|
2839
|
+
if (!event.altKey)
|
|
2840
|
+
picker.move(1);
|
|
2841
|
+
}
|
|
2842
|
+
else
|
|
2843
|
+
picker.move(1);
|
|
2844
|
+
break;
|
|
2845
|
+
case 'ArrowUp':
|
|
2846
|
+
if (!open)
|
|
2847
|
+
return;
|
|
2848
|
+
picker.move(-1);
|
|
2849
|
+
break;
|
|
2850
|
+
case 'Enter':
|
|
2851
|
+
if (open) {
|
|
2852
|
+
if (!picker.pickActive())
|
|
2853
|
+
return;
|
|
2854
|
+
}
|
|
2855
|
+
else if (!this.addQuery()) {
|
|
2856
|
+
// why: ô rỗng, danh sách đóng — Enter là "Tìm kiếm" của thanh, bị chặn khi còn field bắt buộc rỗng.
|
|
2857
|
+
this.applySearch();
|
|
2858
|
+
}
|
|
2859
|
+
else
|
|
2860
|
+
return;
|
|
2861
|
+
break;
|
|
2862
|
+
case 'Escape':
|
|
2863
|
+
if (!open && !this.addQuery())
|
|
2864
|
+
return;
|
|
2865
|
+
if (open)
|
|
2866
|
+
picker.panel().close('escape');
|
|
2867
|
+
this.addQuery.set('');
|
|
2868
|
+
event.stopPropagation();
|
|
2869
|
+
break;
|
|
2870
|
+
case 'Backspace':
|
|
2871
|
+
if (this.addQuery())
|
|
2872
|
+
return;
|
|
2873
|
+
this.#focusLastChip();
|
|
2874
|
+
break;
|
|
2875
|
+
case 'Tab':
|
|
2876
|
+
if (open)
|
|
2877
|
+
picker.panel().close('tab');
|
|
2878
|
+
return;
|
|
2879
|
+
default:
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
event.preventDefault();
|
|
2883
|
+
}
|
|
2884
|
+
/** A click on the empty part of the chip area (inline mode) focuses the box and opens the list. */
|
|
2885
|
+
onMainClick(event) {
|
|
2886
|
+
const target = event.target;
|
|
2887
|
+
if (this.resolvedMode() !== 'inline' || !target?.classList.contains('c-query-bar__main'))
|
|
2888
|
+
return;
|
|
2889
|
+
this.addInput()?.nativeElement.focus();
|
|
2890
|
+
this.openAddList();
|
|
2891
|
+
}
|
|
2892
|
+
/** Backspace / Delete on the chip the box pointed at removes it — never a required or pinned chip. */
|
|
2893
|
+
onMainKeydown(event) {
|
|
2894
|
+
const pending = this.#pendingRemove;
|
|
2895
|
+
if (!pending || event.target !== pending.element)
|
|
2896
|
+
return;
|
|
2897
|
+
if (event.key !== 'Backspace' && event.key !== 'Delete') {
|
|
2898
|
+
this.#pendingRemove = null;
|
|
2899
|
+
return;
|
|
2900
|
+
}
|
|
2901
|
+
event.preventDefault();
|
|
2902
|
+
const filter = this.filters()[pending.index];
|
|
2903
|
+
if (!filter || this.isPinned(filter) || this.fieldOf(filter)?.disabled)
|
|
2904
|
+
return;
|
|
2905
|
+
this.#pendingRemove = null;
|
|
2906
|
+
this.removeFilter(pending.index);
|
|
2907
|
+
afterNextRender(() => this.addInput()?.nativeElement.focus(), { injector: this.#injector });
|
|
2908
|
+
}
|
|
2909
|
+
/** First Backspace on an empty box: focus the last chip so a second Backspace removes it. */
|
|
2910
|
+
#focusLastChip() {
|
|
2911
|
+
const rendered = this.#chipElements();
|
|
2912
|
+
const last = rendered[rendered.length - 1];
|
|
2913
|
+
if (!last)
|
|
2914
|
+
return;
|
|
2915
|
+
if (!last.element.hasAttribute('tabindex'))
|
|
2916
|
+
last.element.tabIndex = -1;
|
|
2917
|
+
last.element.focus();
|
|
2918
|
+
this.#pendingRemove = last;
|
|
2919
|
+
}
|
|
2920
|
+
/** The focusable wrapper of each rendered inline chip, with the index of its filter. */
|
|
2921
|
+
#chipElements() {
|
|
2922
|
+
const elements = Array.from(this.#host.nativeElement.querySelectorAll('.c-query-bar__main > sd-query-inline-value-chip .c-seamless, .c-query-bar__main > sd-query-inline-chip .c-token, .c-query-bar__main > sd-query-popover-chip .c-chip'));
|
|
2923
|
+
// why: @for chỉ vẽ chip của field thanh biết — ghép phần tử thứ n với filter thứ n có field.
|
|
2924
|
+
const indexes = this.filters()
|
|
2925
|
+
.map((filter, index) => (this.fieldOf(filter) ? index : -1))
|
|
2926
|
+
.filter(index => index >= 0);
|
|
2927
|
+
return elements.map((element, position) => ({ element, index: indexes[position] })).filter(entry => entry.index !== undefined);
|
|
2928
|
+
}
|
|
2929
|
+
/**
|
|
2930
|
+
* After a chip is finished (value committed, build cancelled) focus goes back to the box, without opening the list —
|
|
2931
|
+
* unless the user has moved focus somewhere else meanwhile.
|
|
2932
|
+
*/
|
|
2933
|
+
#returnToAddInput() {
|
|
2934
|
+
if (this.resolvedMode() !== 'inline')
|
|
2935
|
+
return;
|
|
2936
|
+
afterNextRender(() => {
|
|
2937
|
+
const active = document.activeElement;
|
|
2938
|
+
if (active && active !== document.body && !this.#host.nativeElement.contains(active))
|
|
2939
|
+
return;
|
|
2940
|
+
this.addInput()?.nativeElement.focus();
|
|
2941
|
+
}, { injector: this.#injector });
|
|
1721
2942
|
}
|
|
1722
2943
|
/**
|
|
1723
2944
|
* Commit both ends of a BETWEEN range at once — called from `<sd-query-inline-chip>`'s
|
|
@@ -1762,18 +2983,35 @@ class SdQueryBar {
|
|
|
1762
2983
|
afterNextRender(() => this.#focusInlineChip(index), { injector: this.#injector });
|
|
1763
2984
|
return;
|
|
1764
2985
|
}
|
|
1765
|
-
if (index < 0)
|
|
2986
|
+
if (index < 0) {
|
|
1766
2987
|
this.#addFilter(field, returnFocusTo ?? undefined);
|
|
2988
|
+
return;
|
|
2989
|
+
}
|
|
2990
|
+
const chip = this.popoverChips()[index];
|
|
2991
|
+
// why: icon ở header bấm lần nữa khi popover của nó đang mở thì đóng lại — menu Material trước đây có backdrop nuốt lần bấm đó
|
|
2992
|
+
// và đóng menu; panel mới không có backdrop.
|
|
2993
|
+
if (chip?.isOpen())
|
|
2994
|
+
chip.closeMenu();
|
|
1767
2995
|
else
|
|
1768
|
-
|
|
2996
|
+
chip?.openMenu(returnFocusTo ?? undefined);
|
|
1769
2997
|
}
|
|
1770
|
-
/**
|
|
2998
|
+
/**
|
|
2999
|
+
* Clear-all button: the host's `onClearAll` when given, else the built-in clearAll(). With `applyOn: 'commit'` the
|
|
3000
|
+
* built-in path applies once when it emptied a chip that had a value (R2 G-10).
|
|
3001
|
+
*/
|
|
1771
3002
|
onClearClick() {
|
|
1772
3003
|
const onClearAll = this.option()?.onClearAll;
|
|
1773
|
-
if (onClearAll)
|
|
3004
|
+
if (onClearAll) {
|
|
1774
3005
|
onClearAll();
|
|
1775
|
-
|
|
1776
|
-
|
|
3006
|
+
return;
|
|
3007
|
+
}
|
|
3008
|
+
// why: activeCount đếm đúng các chip có giá trị mà clearAll sẽ làm rỗng hoặc bỏ (chip bắt buộc giữ nguyên) — bằng 0
|
|
3009
|
+
// thì clearAll không đổi điều kiện lọc nào nên không áp dụng.
|
|
3010
|
+
const changed = this.activeCount() > 0;
|
|
3011
|
+
this.clearAll();
|
|
3012
|
+
// why: ở applyOn 'commit' thanh không có nút Tìm kiếm; không áp dụng ở đây thì host vẫn lọc theo các chip vừa xoá.
|
|
3013
|
+
if (changed && this.resolvedApplyOn() === 'commit')
|
|
3014
|
+
this.#applyChipChange();
|
|
1777
3015
|
}
|
|
1778
3016
|
/** Swap the field of an existing chip — reset operator + value to the new field's defaults. */
|
|
1779
3017
|
changeFilterField(index, field) {
|
|
@@ -1784,9 +3022,8 @@ class SdQueryBar {
|
|
|
1784
3022
|
const data = SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null;
|
|
1785
3023
|
list[index] = { field: field.key, operator, data };
|
|
1786
3024
|
this.filters.set(list);
|
|
1787
|
-
// why:
|
|
1788
|
-
//
|
|
1789
|
-
// continue picking operator + value without a second manual click.
|
|
3025
|
+
// why: re-open the chip's popover on the next render so the user can pick operator + value for the new field
|
|
3026
|
+
// without a second click.
|
|
1790
3027
|
afterNextRender(() => this.popoverChips()[index]?.openMenu(), { injector: this.#injector });
|
|
1791
3028
|
}
|
|
1792
3029
|
updateFilter(index, patch) {
|
|
@@ -1831,23 +3068,54 @@ class SdQueryBar {
|
|
|
1831
3068
|
if (this.resolvedApplyOn() === 'commit' && this.isFilterActive(removed))
|
|
1832
3069
|
this.#applyChipChange();
|
|
1833
3070
|
}
|
|
1834
|
-
/**
|
|
3071
|
+
/**
|
|
3072
|
+
* Empties the bar (handoff B2). Required chips stay as they are (operator and value); pinned chips stay, reset to their
|
|
3073
|
+
* field's default operator and no value; other chips go.
|
|
3074
|
+
*/
|
|
1835
3075
|
clearAll() {
|
|
1836
3076
|
if (this.filters().length === 0)
|
|
1837
3077
|
return;
|
|
1838
3078
|
const kept = [];
|
|
1839
3079
|
for (const filter of this.filters()) {
|
|
1840
3080
|
const field = this.fieldOf(filter);
|
|
3081
|
+
if (field?.required) {
|
|
3082
|
+
kept.push(filter);
|
|
3083
|
+
continue;
|
|
3084
|
+
}
|
|
1841
3085
|
if (!field?.pinned)
|
|
1842
3086
|
continue;
|
|
1843
|
-
const
|
|
1844
|
-
const next = { field: field.key, operator, data: SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null };
|
|
3087
|
+
const next = this.#emptyChip(field);
|
|
1845
3088
|
this.#inheritRowId(filter, next);
|
|
1846
3089
|
kept.push(next);
|
|
1847
3090
|
}
|
|
1848
|
-
this.filters.set(kept);
|
|
3091
|
+
this.filters.set(this.#withLockedChips(kept, this.resolvedFields()));
|
|
1849
3092
|
this.editingIndex.set(null);
|
|
1850
3093
|
}
|
|
3094
|
+
/** A chip of `field` with its default operator and no value. */
|
|
3095
|
+
#emptyChip(field) {
|
|
3096
|
+
const operator = sdQueryDefaultOperator(field);
|
|
3097
|
+
return { field: field.key, operator, data: SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null };
|
|
3098
|
+
}
|
|
3099
|
+
/**
|
|
3100
|
+
* B1: every pinned or required field has a chip. Missing ones are added empty; the locked chips then come first in
|
|
3101
|
+
* field order, the others keep their order. Returns `filters` itself when nothing is missing.
|
|
3102
|
+
*/
|
|
3103
|
+
#withLockedChips(filters, fields) {
|
|
3104
|
+
const locked = fields.filter(field => this.isLocked(field));
|
|
3105
|
+
if (!locked.length)
|
|
3106
|
+
return filters;
|
|
3107
|
+
const chips = new Map();
|
|
3108
|
+
for (const filter of filters)
|
|
3109
|
+
if ('field' in filter && !chips.has(filter.field))
|
|
3110
|
+
chips.set(filter.field, filter);
|
|
3111
|
+
if (locked.every(field => chips.has(field.key)))
|
|
3112
|
+
return filters;
|
|
3113
|
+
const keys = new Set(locked.map(field => field.key));
|
|
3114
|
+
return [
|
|
3115
|
+
...locked.map(field => chips.get(field.key) ?? this.#emptyChip(field)),
|
|
3116
|
+
...filters.filter(filter => !('field' in filter) || !keys.has(filter.field)),
|
|
3117
|
+
];
|
|
3118
|
+
}
|
|
1851
3119
|
setLogic(value) {
|
|
1852
3120
|
if (this.logic() === value)
|
|
1853
3121
|
return;
|
|
@@ -1860,6 +3128,18 @@ class SdQueryBar {
|
|
|
1860
3128
|
this.#searchBase = this.search();
|
|
1861
3129
|
this.search.set(value);
|
|
1862
3130
|
}
|
|
3131
|
+
/** Clear button of the search box: empties the text and applies once (handoff 7.2). */
|
|
3132
|
+
clearSearch() {
|
|
3133
|
+
this.setSearch('');
|
|
3134
|
+
this.applySearch();
|
|
3135
|
+
}
|
|
3136
|
+
/** Escape in the search box: like the clear button when there is text; nothing on an empty box. */
|
|
3137
|
+
onSearchEscape(event) {
|
|
3138
|
+
if (!this.search())
|
|
3139
|
+
return;
|
|
3140
|
+
event.preventDefault();
|
|
3141
|
+
this.clearSearch();
|
|
3142
|
+
}
|
|
1863
3143
|
/** Enter in the search box: applies the typed text too, unless a required field is still empty. */
|
|
1864
3144
|
applySearch() {
|
|
1865
3145
|
if (this.invalidFields().length)
|
|
@@ -1899,7 +3179,7 @@ class SdQueryBar {
|
|
|
1899
3179
|
return;
|
|
1900
3180
|
this.editingIndex.set(index);
|
|
1901
3181
|
const field = this.fieldByKey()[filter.field];
|
|
1902
|
-
this.chipPopover()?.seed(filter, field);
|
|
3182
|
+
this.chipPopover()?.seed(filter, field, index);
|
|
1903
3183
|
}
|
|
1904
3184
|
/**
|
|
1905
3185
|
* Receive `(commit)` from the child popover — splice into filters, null the index. With
|
|
@@ -1924,7 +3204,7 @@ class SdQueryBar {
|
|
|
1924
3204
|
return;
|
|
1925
3205
|
}
|
|
1926
3206
|
// why: popover chỉ đổi operator + value của CHÍNH chip đó → giữ track key, nếu không chip sẽ
|
|
1927
|
-
// bị huỷ ngay lúc
|
|
3207
|
+
// bị huỷ ngay lúc panel đóng (trigger của overlay biến mất giữa chừng).
|
|
1928
3208
|
this.#inheritRowId(previous, next);
|
|
1929
3209
|
list[idx] = next;
|
|
1930
3210
|
this.filters.set(list);
|
|
@@ -1967,148 +3247,21 @@ class SdQueryBar {
|
|
|
1967
3247
|
const chips = this.#host.nativeElement.querySelectorAll('sd-query-inline-value-chip, sd-query-inline-chip');
|
|
1968
3248
|
chips[index]?.querySelector('input, button, [tabindex]:not([tabindex="-1"])')?.focus();
|
|
1969
3249
|
}
|
|
1970
|
-
/** `01/10 – 31/10/2026` inside one year, `From …` / `To …` when one end is open. */
|
|
1971
|
-
#rangeText(filter, range) {
|
|
1972
|
-
const field = this.fieldOf(filter);
|
|
1973
|
-
const hasFrom = hasValue(range.from);
|
|
1974
|
-
const hasTo = hasValue(range.to);
|
|
1975
|
-
if (field?.type === 'date' && hasFrom && hasTo) {
|
|
1976
|
-
const year = this.#dateTime.toFormat(range.from, 'yyyy');
|
|
1977
|
-
if (year && year === this.#dateTime.toFormat(range.to, 'yyyy')) {
|
|
1978
|
-
return `${this.#dateTime.toFormat(range.from, 'dd/MM')} – ${this.#dateTime.toFormat(range.to, DATE_FORMAT)}`;
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
const from = hasFrom ? this.#displayOne(filter, range.from) : '';
|
|
1982
|
-
const to = hasTo ? this.#displayOne(filter, range.to) : '';
|
|
1983
|
-
if (hasFrom && hasTo)
|
|
1984
|
-
return `${from} – ${to}`;
|
|
1985
|
-
if (hasFrom)
|
|
1986
|
-
return this.#i18n.t('core.component.query-bar.range.from', { value: from });
|
|
1987
|
-
if (hasTo)
|
|
1988
|
-
return this.#i18n.t('core.component.query-bar.range.to', { value: to });
|
|
1989
|
-
return '';
|
|
1990
|
-
}
|
|
1991
|
-
#displayOne(filter, raw) {
|
|
1992
|
-
const fieldKey = 'field' in filter ? filter.field : '';
|
|
1993
|
-
const field = this.fieldByKey()[fieldKey];
|
|
1994
|
-
if (!field)
|
|
1995
|
-
return String(raw);
|
|
1996
|
-
if (field.type === 'boolean') {
|
|
1997
|
-
// why: nhãn mặc định của field boolean phải theo ngôn ngữ đang chọn; consumer vẫn override
|
|
1998
|
-
// được bằng `trueLabel` / `falseLabel` trên chính field.
|
|
1999
|
-
const trueLabel = field.trueLabel ?? this.#i18n.t('core.component.query-bar.boolean.true');
|
|
2000
|
-
const falseLabel = field.falseLabel ?? this.#i18n.t('core.component.query-bar.boolean.false');
|
|
2001
|
-
return raw ? trueLabel : falseLabel;
|
|
2002
|
-
}
|
|
2003
|
-
if (field.type === 'date' || field.type === 'datetime') {
|
|
2004
|
-
// why: chip in đúng định dạng của sd-date / sd-datetime, không in chuỗi model `yyyy/MM/dd` hay ISO.
|
|
2005
|
-
return this.#dateTime.toFormat(raw, field.type === 'date' ? DATE_FORMAT : DATETIME_FORMAT) || String(raw);
|
|
2006
|
-
}
|
|
2007
|
-
if (field.type === 'values' || field.type === 'lazy-values') {
|
|
2008
|
-
const opt = field.option;
|
|
2009
|
-
const cachedOptions = this.chipPopover()?.editingOptions() ?? [];
|
|
2010
|
-
const items = this.#resolveSyncItems(opt?.items) ?? cachedOptions;
|
|
2011
|
-
const match = items.find((i) => i?.[opt.valueField] === raw);
|
|
2012
|
-
if (match)
|
|
2013
|
-
return String(match[opt.displayField]);
|
|
2014
|
-
const cached = cachedOptions.find((i) => i?.[opt.valueField] === raw);
|
|
2015
|
-
if (cached)
|
|
2016
|
-
return String(cached[opt.displayField]);
|
|
2017
|
-
return this.#labels().get(fieldKey)?.get(raw) ?? String(raw);
|
|
2018
|
-
}
|
|
2019
|
-
return String(raw);
|
|
2020
|
-
}
|
|
2021
|
-
// ---------------------------------------------------------------------------
|
|
2022
|
-
// Labels of restored values (values with an items function, lazy-values)
|
|
2023
|
-
// ---------------------------------------------------------------------------
|
|
2024
|
-
/** `field.key` → value → label, filled by #resolveLabels. Replaced (not mutated) so chips re-render. */
|
|
2025
|
-
#labels = signal(new Map(), /* @ts-ignore */
|
|
2026
|
-
...(ngDevMode ? [{ debugName: "#labels" }] : /* istanbul ignore next */ []));
|
|
2027
|
-
/** Lookups already started — each runs once per field (values) or per field + value (lazy-values). */
|
|
2028
|
-
#labelRequests = new Set();
|
|
2029
|
-
#resolveLabels(filter, fields) {
|
|
2030
|
-
if (!('field' in filter) || SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
2031
|
-
return;
|
|
2032
|
-
const field = fields[filter.field];
|
|
2033
|
-
if (field?.type !== 'values' && field?.type !== 'lazy-values')
|
|
2034
|
-
return;
|
|
2035
|
-
const data = filter.data;
|
|
2036
|
-
const values = Array.isArray(data) ? data : hasValue(data) ? [data] : [];
|
|
2037
|
-
if (!values.length)
|
|
2038
|
-
return;
|
|
2039
|
-
const key = field.key;
|
|
2040
|
-
if (field.type === 'values') {
|
|
2041
|
-
const items = field.option.items;
|
|
2042
|
-
// why: mảng / signal đã đọc đồng bộ trong #displayOne; chỉ hàm (Promise) mới cần nạp.
|
|
2043
|
-
if (typeof items !== 'function' || isSignal(items) || this.#labelRequests.has(key))
|
|
2044
|
-
return;
|
|
2045
|
-
this.#labelRequests.add(key);
|
|
2046
|
-
this.#loadLabels(field, () => items());
|
|
2047
|
-
return;
|
|
2048
|
-
}
|
|
2049
|
-
const known = this.#labels().get(key);
|
|
2050
|
-
if (values.every(value => known?.has(value)))
|
|
2051
|
-
return;
|
|
2052
|
-
const request = `${key}|${this.#stringify(data)}`;
|
|
2053
|
-
if (this.#labelRequests.has(request))
|
|
2054
|
-
return;
|
|
2055
|
-
this.#labelRequests.add(request);
|
|
2056
|
-
const option = field.option;
|
|
2057
|
-
this.#loadLabels(field, () => (option.views ? option.views(values) : option.search({ type: 'VALUE', value: data })));
|
|
2058
|
-
}
|
|
2059
|
-
#loadLabels(field, load) {
|
|
2060
|
-
const option = field.option;
|
|
2061
|
-
let result;
|
|
2062
|
-
try {
|
|
2063
|
-
result = load();
|
|
2064
|
-
}
|
|
2065
|
-
catch {
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
const items = isObservable(result) ? firstValueFrom(result) : Promise.resolve(result);
|
|
2069
|
-
items
|
|
2070
|
-
.then(list => {
|
|
2071
|
-
if (!Array.isArray(list) || !list.length)
|
|
2072
|
-
return;
|
|
2073
|
-
const next = new Map(this.#labels());
|
|
2074
|
-
const labels = new Map(next.get(field.key) ?? []);
|
|
2075
|
-
for (const item of list) {
|
|
2076
|
-
const value = item?.[option.valueField];
|
|
2077
|
-
if (value !== undefined)
|
|
2078
|
-
labels.set(value, String(item[option.displayField]));
|
|
2079
|
-
}
|
|
2080
|
-
next.set(field.key, labels);
|
|
2081
|
-
this.#labels.set(next);
|
|
2082
|
-
})
|
|
2083
|
-
// why: tra nhãn thất bại thì chip giữ giá trị thô — không phải lỗi của thanh.
|
|
2084
|
-
.catch(() => undefined);
|
|
2085
|
-
}
|
|
2086
|
-
#stringify(value) {
|
|
2087
|
-
try {
|
|
2088
|
-
return Utilities.canonicalStringify(value);
|
|
2089
|
-
}
|
|
2090
|
-
catch {
|
|
2091
|
-
return String(value);
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
#resolveSyncItems(items) {
|
|
2095
|
-
if (Array.isArray(items))
|
|
2096
|
-
return items;
|
|
2097
|
-
if (isSignal(items))
|
|
2098
|
-
return items();
|
|
2099
|
-
return null;
|
|
2100
|
-
}
|
|
2101
3250
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2102
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBar, isStandalone: true, selector: "sd-query-bar", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, showOperatorOnChip: { classPropertyName: "showOperatorOnChip", publicName: "showOperatorOnChip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filters: "filtersChange", logic: "logicChange", search: "searchChange", queryChange: "queryChange", apply: "apply" }, viewQueries: [{ propertyName: "popoverChips", predicate: SdQueryPopoverChip, descendants: true, isSignal: true }, { propertyName: "buildChip", first: true, predicate: SdQueryBuildChip, descendants: true, isSignal: true }, { propertyName: "chipPopover", first: true, predicate: SdQueryChipPopover, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n sd-query-bar \u2014 unified filter chip row (Jira/Linear/Notion style).\n Visual spec: refs/design_handoff_sd_query_bar/README.md\n TODO(next-iter): replace inline placeholders for field-picker + chip-popover\n with extracted sub-components driven by CDK overlay.\n-->\n@let _filters = filters();\n@let _resolvedFields = resolvedFields();\n@let _resolvedDensity = resolvedDensity();\n@let _showOrConnector = showOrConnector();\n@let _usedFieldKeys = usedFieldKeys();\n@let _editingIndex = editingIndex();\n@let _resolvedMode = resolvedMode();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n@let _addDisabled = addDisabled();\n@let _invalidHintId = resolvedInvalidHintId();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\"\n [class.c-appearance-flush]=\"resolvedAppearance() === 'flush'\">\n\n <!-- Main region \u2014 search + filters + add-filter. Wraps internally; the right\n action toolbar stays anchored and does NOT flow with this. -->\n <div class=\"c-query-bar__main\">\n\n <!-- Free-text search (left, optional) -->\n @if (resolvedShowSearch()) {\n <div class=\"c-search\">\n <sd-icon class=\"c-search-icon\" name=\"search\"></sd-icon>\n <input\n class=\"c-search-input\"\n type=\"text\"\n [ngModel]=\"search()\"\n (ngModelChange)=\"setSearch($event)\"\n (keydown.enter)=\"applySearch()\"\n [placeholder]=\"searchPlaceholder()\" />\n </div>\n <span class=\"c-divider\" aria-hidden=\"true\"></span>\n }\n\n <!-- Chip popover \u2014 extracted into <sd-query-chip-popover>. Declared BEFORE chips\n so the popover-mode @for chips can bind their [menu] to `chipPopover.menu()`.\n why: m\u1EDF popover \u0111\u1EC3 EDIT ch\u1EC9 cho ch\u1EC9nh operator + value \u2014 KH\u00D4NG \u0111\u1ED5i field.\n B\u1ECF [switchPickerMenu] \u2192 header render nh\u00E3n field t\u0129nh (read-only). Mu\u1ED1n \u0111\u1ED5i\n field th\u00EC xo\u00E1 chip r\u1ED3i th\u00EAm l\u1EA1i. -->\n <sd-query-chip-popover\n #chipPopover\n [field]=\"editingField() ?? undefined\"\n [filter]=\"_editingIndex !== null ? $any(_filters[_editingIndex!]) : undefined\"\n [chipIndex]=\"_editingIndex\"\n [autoIdBase]=\"resolvedAutoId() ?? 'qb'\"\n (commit)=\"onChipPopoverCommit($event)\" />\n\n @if (_resolvedMode === 'inline') {\n <!-- ===== INLINE MODE (GitLab-style token builder) ===== -->\n\n <!-- Completed chips.\n why: track theo rowId(filter) ch\u1EE9 KH\u00D4NG theo $index \u2014 track $index g\u1EAFn chip v\u1EDBi v\u1ECB tr\u00ED,\n n\u00EAn xo\u00E1 filter \u0111\u1EA7u ti\u00EAn s\u1EBD bind l\u1EA1i chip c\u0169 sang filter k\u1EBF ti\u1EBFp v\u00E0 k\u00E9o theo state n\u1ED9i b\u1ED9\n (inline-chip `#editing`, inline-value-chip `draft`) sang sai filter. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @if (_field) {\n @let _op = $any(filter.operator);\n @let _data = $any(filter).data;\n @let _invalid = isInvalid(filter);\n @if (_field.disabled) {\n <!-- why: chip inline l\u00E0 ch\u00EDnh \u00F4 nh\u1EADp \u2014 field b\u1ECB kho\u00E1 d\u00F9ng chip popover b\u1ECB kho\u00E1 (ch\u1EC9 hi\u1EC3n th\u1ECB), nh\u01B0 \u1EDF mode popover. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"isFilterActive(filter)\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"!!_field.pinned\"\n [disabled]=\"true\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [menu]=\"chipPopover.menu()!\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n } @else if (_field.type === 'string' || _field.type === 'number') {\n <!-- Seamless chip \u2014 the pill is the input (string / number). -->\n <sd-query-inline-value-chip\n [field]=\"_field\"\n [operator]=\"_op\"\n [value]=\"_data\"\n [density]=\"_resolvedDensity\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"!!_field.pinned\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n } @else {\n <sd-query-inline-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [density]=\"_resolvedDensity\"\n [multiple]=\"multiple(_op)\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"!!_field.pinned\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"onInlineCommit(i, $event)\"\n (commitRange)=\"onInlineRange(i, $event)\"\n (liveChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n }\n }\n }\n\n <!-- Building chip (in-progress) \u2014 extracted into <sd-query-build-chip>. -->\n @if (building(); as _b) {\n <sd-query-build-chip\n [building]=\"_b\"\n [density]=\"_resolvedDensity\"\n [allowedOperators]=\"allowedOperatorsFor(_b.field)\"\n [multiple]=\"multiple($any(_b.operator))\"\n [showOperator]=\"showOperatorFor(_b.field, _b.operator)\"\n (pickOperator)=\"pickBuildOperator($any($event))\"\n (commitValue)=\"commitBuildValue($event)\"\n (cancel)=\"cancelBuild()\"\n (seamlessCommit)=\"onBuildSeamlessCommit($event)\" />\n }\n\n <!-- Add filter -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [matMenuTriggerFor]=\"addPicker.menu()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n (menuOpened)=\"addPicker.focusFind()\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n } @else {\n <!-- ===== POPOVER MODE (default) \u2014 compact chips edited via mat-menu ===== -->\n <!-- why: track theo rowId(filter) \u2014 xem ghi ch\u00FA \u1EDF nh\u00E1nh inline. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @let _active = isFilterActive(filter);\n @let _invalid = isInvalid(filter);\n <!-- why: menu close commit is handled by chipPopover's (commit) \u2192\n onChipPopoverCommit; popover-chip only signals open + remove here. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"_active\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"!!_field?.pinned\"\n [disabled]=\"!!_field?.disabled\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [menu]=\"chipPopover.menu()!\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n }\n\n <!-- Add filter trigger -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [matMenuTriggerFor]=\"addPicker.menu()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n (menuOpened)=\"addPicker.focusFind()\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n }\n\n </div><!-- /.c-query-bar__main -->\n\n <!-- Field picker \u2014 list available fields, fade ones already in use. Pinned fields\n always have their chip, so the picker leaves them out. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"pickerFields()\"\n [usedKeys]=\"_usedFieldKeys\"\n (pick)=\"_resolvedMode === 'inline' ? beginBuild($event) : addFilter($event)\" />\n\n <sd-query-actions-bar\n [showLogicToggle]=\"resolvedShowLogicToggle()\"\n [(logic)]=\"logic\"\n [filtersCount]=\"_filters.length\"\n [clearCount]=\"activeCount()\"\n [clearDisabled]=\"resolvedClearDisabled()\"\n [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n [showSearchButton]=\"resolvedApplyOn() !== 'commit'\"\n (clear)=\"onClearClick()\"\n (search)=\"triggerApply()\" />\n\n <!-- Host content pinned after the toolbar (e.g. sd-table's quick-search right slot). -->\n <ng-content select=\"[sdQueryBarEnd]\" />\n</div>\n", styles: [":host{display:block;font-family:Roboto,system-ui,sans-serif}.c-query-bar{display:flex;align-items:flex-start;flex-wrap:nowrap;gap:8px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:var(--sd-radius-8, 8px);box-shadow:0 1px 2px #0f172a0a}.c-query-bar.c-density-compact{padding:8px}.c-query-bar.c-density-comfortable{padding:10px}.c-query-bar.c-appearance-flush{background:transparent;border:0;border-radius:0;box-shadow:none;padding:8px 12px}.c-query-bar__main{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.c-search{display:flex;align-items:center;gap:6px;min-width:220px;padding:0 10px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-control-border, var(--sd-border));border-radius:var(--sd-control-radius, 8px)}.c-search:hover{border-color:var(--sd-control-border-hover, var(--sd-border-strong))}.c-search:focus-within{border-color:var(--sd-control-border-focus, var(--sd-primary));box-shadow:var(--sd-control-ring, none);outline:none}@media(forced-colors:active){.c-search:focus-within{--sd-control-focus-ring: Highlight;outline:2px solid var(--sd-control-focus-ring);outline-offset:2px}}.c-density-compact .c-search{height:28px}.c-density-comfortable .c-search{height:32px}.c-search .c-search-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-input{flex:1;border:none;outline:none;background:transparent;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121)}.c-search .c-search-input::placeholder{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-kbd{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);padding:1px 4px;border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:3px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-divider{width:1px;height:16px;background:var(--sd-query-bar-border-soft, #e2e4e7);margin:0 2px}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}.c-density-compact .c-token{height:28px}.c-density-comfortable .c-token{height:32px}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-dash{color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 4px;line-height:1}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}.c-density-compact .c-token-remove{width:26px}.c-density-comfortable .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}.c-add-filter{display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:999px;border:1px dashed var(--sd-query-bar-border, #d6d8db);background:transparent;cursor:pointer;color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.c-density-compact .c-add-filter{width:28px;height:28px}.c-density-comfortable .c-add-filter{width:32px;height:32px}.c-add-filter sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-add-filter:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-add-filter[disabled]{opacity:.5;cursor:not-allowed}.c-or-connector{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-bold, 700);letter-spacing:.6px;color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 2px}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input{width:100%;height:32px;padding:0 10px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font-family:inherit;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121);outline:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus{border-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button.c-pop-boolean-active{background:var(--sd-primary-light);border-color:var(--sd-primary);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values{max-height:220px;overflow-y:auto;margin:0;padding:0;list-style:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:var(--sd-radius-4, 4px);font-size:var(--sd-font-size-13, 13px);cursor:pointer;-webkit-user-select:none;user-select:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li.c-pop-value-selected{background:var(--sd-primary-light);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=checkbox],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=radio]{accent-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-empty{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n", ".c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-query-bar ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "directive", type: i1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdQueryActionsBar, selector: "sd-query-actions-bar", inputs: ["showLogicToggle", "logic", "filtersCount", "showSavedFilters", "savedFiltersKey", "query", "showClearAll", "clearCount", "clearDisabled", "canSearch", "showSearchButton"], outputs: ["logicChange", "applyFilter", "clear", "search"] }, { kind: "component", type: SdQueryBuildChip, selector: "sd-query-build-chip", inputs: ["building", "density", "allowedOperators", "multiple", "showOperator", "autoId"], outputs: ["pickOperator", "commitValue", "cancel", "seamlessCommit", "draftChange", "draftCommit"] }, { kind: "component", type: SdQueryChipPopover, selector: "sd-query-chip-popover", inputs: ["field", "filter", "chipIndex", "autoIdBase", "switchPickerMenu"], outputs: ["commit", "swapField"] }, { kind: "component", type: SdQueryFieldPicker, selector: "sd-query-field-picker", inputs: ["fields", "currentKey", "usedKeys"], outputs: ["pick"] }, { kind: "component", type: SdQueryInlineChip, selector: "sd-query-inline-chip", inputs: ["field", "filter", "density", "multiple", "showOperator", "autoId", "valueText", "isNoData", "pinned", "invalid", "describedBy"], outputs: ["commit", "commitRange", "liveChange", "remove"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus", "pinned", "invalid", "describedBy"], outputs: ["valueChange", "remove"] }, { kind: "component", type: SdQueryPopoverChip, selector: "sd-query-popover-chip", inputs: ["field", "filter", "active", "showOperator", "valueText", "emptyText", "pinned", "disabled", "invalid", "describedBy", "menu"], outputs: ["open", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3251
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBar, isStandalone: true, selector: "sd-query-bar", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, showOperatorOnChip: { classPropertyName: "showOperatorOnChip", publicName: "showOperatorOnChip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filters: "filtersChange", logic: "logicChange", search: "searchChange", queryChange: "queryChange", apply: "apply" }, host: { listeners: { "click": "onMainClick($event)", "keydown": "onMainKeydown($event)" } }, providers: [ɵSdQueryPanelGroup], viewQueries: [{ propertyName: "popoverChips", predicate: SdQueryPopoverChip, descendants: true, isSignal: true }, { propertyName: "buildChip", first: true, predicate: SdQueryBuildChip, descendants: true, isSignal: true }, { propertyName: "chipPopover", first: true, predicate: SdQueryChipPopover, descendants: true, isSignal: true }, { propertyName: "addInput", first: true, predicate: ["addInput"], descendants: true, isSignal: true }, { propertyName: "addPicker", first: true, predicate: SdQueryFieldPicker, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n sd-query-bar \u2014 unified filter chip row (Jira/Linear/Notion style).\n Panels (field picker, chip popover, saved filters) share one CDK Overlay frame \u2014 handoff\n design_handoff_sd_query_bar_panels.\n-->\n@let _filters = filters();\n@let _resolvedFields = resolvedFields();\n@let _resolvedDensity = resolvedDensity();\n@let _showOrConnector = showOrConnector();\n@let _usedFieldKeys = usedFieldKeys();\n@let _editingIndex = editingIndex();\n@let _resolvedMode = resolvedMode();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n@let _addDisabled = addDisabled();\n@let _invalidHintId = resolvedInvalidHintId();\n@let _autoId = resolvedAutoId();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\"\n [class.c-appearance-flush]=\"resolvedAppearance() === 'flush'\">\n\n <!-- Main region \u2014 search + filters + add-filter. Wraps internally; the right\n action toolbar stays anchored and does NOT flow with this. -->\n <div class=\"c-query-bar__main\">\n\n <!-- Free-text search (left, optional) -->\n @if (resolvedShowSearch()) {\n <!-- Handoff m\u1EE5c 7: primitive t\u00ECm ki\u1EBFm d\u00F9ng chung \u2014 c\u1EE1 xs (28px) \u1EDF density compact, sm (32px) \u1EDF comfortable. -->\n <sd-search-field\n class=\"c-search\"\n clearable\n [size]=\"_resolvedDensity === 'compact' ? 'xs' : 'sm'\"\n [clearLabel]=\"searchClearLabel()\"\n [autoId]=\"_autoId ? _autoId + '-search' : undefined\"\n (cleared)=\"clearSearch()\">\n <input\n sdSearchFieldInput\n type=\"text\"\n enterkeyhint=\"search\"\n autocomplete=\"off\"\n [attr.aria-label]=\"searchLabel()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n [placeholder]=\"searchPlaceholder()\"\n [value]=\"search()\"\n (input)=\"setSearch($any($event.target).value)\"\n (keydown.enter)=\"applySearch()\"\n (keydown.escape)=\"onSearchEscape($event)\" />\n </sd-search-field>\n <span class=\"c-divider\" aria-hidden=\"true\"></span>\n }\n\n <!-- Chip popover \u2014 extracted into <sd-query-chip-popover>. Declared BEFORE chips\n so the popover-mode @for chips can bind their [panel] to `chipPopover.panel()`.\n why: m\u1EDF popover \u0111\u1EC3 EDIT ch\u1EC9 cho ch\u1EC9nh operator + value \u2014 KH\u00D4NG \u0111\u1ED5i field (handoff M7):\n header render nh\u00E3n field t\u0129nh (read-only). Mu\u1ED1n \u0111\u1ED5i field th\u00EC xo\u00E1 chip r\u1ED3i th\u00EAm l\u1EA1i. -->\n <sd-query-chip-popover\n #chipPopover\n [field]=\"editingField() ?? undefined\"\n [filter]=\"_editingIndex !== null ? $any(_filters[_editingIndex!]) : undefined\"\n [chipIndex]=\"_editingIndex\"\n [autoIdBase]=\"resolvedAutoId()\"\n (commit)=\"onChipPopoverCommit($event)\" />\n\n @if (_resolvedMode === 'inline') {\n <!-- ===== INLINE MODE (GitLab-style token builder) ===== -->\n\n <!-- Completed chips.\n why: track theo rowId(filter) ch\u1EE9 KH\u00D4NG theo $index \u2014 track $index g\u1EAFn chip v\u1EDBi v\u1ECB tr\u00ED,\n n\u00EAn xo\u00E1 filter \u0111\u1EA7u ti\u00EAn s\u1EBD bind l\u1EA1i chip c\u0169 sang filter k\u1EBF ti\u1EBFp v\u00E0 k\u00E9o theo state n\u1ED9i b\u1ED9\n (inline-chip `#editing`, inline-value-chip `draft`) sang sai filter. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @if (_field) {\n @let _op = $any(filter.operator);\n @let _data = $any(filter).data;\n @let _invalid = isInvalid(filter);\n @if (_field.disabled) {\n <!-- why: chip inline l\u00E0 ch\u00EDnh \u00F4 nh\u1EADp \u2014 field b\u1ECB kho\u00E1 d\u00F9ng chip popover b\u1ECB kho\u00E1 (ch\u1EC9 hi\u1EC3n th\u1ECB), nh\u01B0 \u1EDF mode popover. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"isFilterActive(filter)\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field.required\"\n [disabled]=\"true\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [panel]=\"chipPopover.panel()\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n } @else if (_field.type === 'string' || _field.type === 'number') {\n <!-- Seamless chip \u2014 the pill is the input (string / number). -->\n <sd-query-inline-value-chip\n [field]=\"_field\"\n [operator]=\"_op\"\n [value]=\"_data\"\n [density]=\"_resolvedDensity\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field.required\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n } @else {\n <sd-query-inline-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [density]=\"_resolvedDensity\"\n [multiple]=\"multiple(_op)\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field.required\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"onInlineCommit(i, $event)\"\n (commitRange)=\"onInlineRange(i, $event)\"\n (liveChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n }\n }\n }\n\n <!-- Building chip (in-progress) \u2014 extracted into <sd-query-build-chip>. -->\n @if (building(); as _b) {\n <sd-query-build-chip\n [building]=\"_b\"\n [density]=\"_resolvedDensity\"\n [allowedOperators]=\"allowedOperatorsFor(_b.field)\"\n [multiple]=\"multiple($any(_b.operator))\"\n [showOperator]=\"showOperatorFor(_b.field, _b.operator)\"\n (pickOperator)=\"pickBuildOperator($any($event))\"\n (commitValue)=\"commitBuildValue($event)\"\n (cancel)=\"cancelBuild()\"\n (seamlessCommit)=\"onBuildSeamlessCommit($event)\" />\n }\n\n <!-- Th\u00EAm \u0111i\u1EC1u ki\u1EC7n (handoff m\u1EE5c 8): \u00F4 combobox \u0111i\u1EC1u khi\u1EC3n listbox c\u1EE7a field picker, focus th\u1EADt \u1EDF l\u1EA1i trong \u00F4.\n Kh\u00F4ng t\u1EF1 m\u1EDF khi ch\u1EC9 Tab t\u1EDBi. H\u1EBFt field th\u00EC \u00F4 kho\u00E1, tooltip n\u00F3i l\u00FD do nh\u01B0 n\u00FAt + tr\u01B0\u1EDBc \u0111\u00E2y. -->\n <div\n class=\"c-add-condition\"\n [class.c-add-condition--disabled]=\"_addDisabled\"\n [matTooltip]=\"_addDisabled ? (_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel) : ''\">\n <sd-icon class=\"c-add-condition-icon\" name=\"add\" size=\"16px\" aria-hidden=\"true\"></sd-icon>\n <input\n #addInput\n class=\"c-add-condition-input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"addPicker.panel().isOpen()\"\n [attr.aria-controls]=\"addPicker.listId\"\n [attr.aria-activedescendant]=\"addPicker.panel().isOpen() ? addPicker.activeId() : null\"\n [attr.aria-label]=\"addConditionLabel()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-add-condition' : null\"\n [placeholder]=\"addConditionLabel()\"\n [disabled]=\"_addDisabled\"\n [value]=\"addQuery()\"\n (input)=\"onAddInput($any($event.target).value)\"\n (click)=\"openAddList()\"\n (keydown)=\"onAddKeydown($event)\" />\n </div>\n } @else {\n <!-- ===== POPOVER MODE (default) \u2014 compact chips edited in the chip popover panel ===== -->\n <!-- why: track theo rowId(filter) \u2014 xem ghi ch\u00FA \u1EDF nh\u00E1nh inline. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @let _active = isFilterActive(filter);\n @let _invalid = isInvalid(filter);\n <!-- why: menu close commit is handled by chipPopover's (commit) \u2192\n onChipPopoverCommit; popover-chip only signals open + remove here. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"_active\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field?.required\"\n [disabled]=\"!!_field?.disabled\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [panel]=\"chipPopover.panel()\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n }\n\n <!-- Add filter trigger -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [sdQueryPanelTrigger]=\"addPicker.panel()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n [attr.aria-label]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n }\n\n </div><!-- /.c-query-bar__main -->\n\n <!-- Field picker \u2014 list available fields, fade ones already in use. Pinned fields\n always have their chip, so the picker leaves them out. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"pickerFields()\"\n [usedKeys]=\"_usedFieldKeys\"\n [autoId]=\"resolvedAutoId()\"\n [findBox]=\"_resolvedMode !== 'inline'\"\n (pick)=\"onPick($event)\"\n (closed)=\"addQuery.set('')\" />\n\n <sd-query-actions-bar\n [showLogicToggle]=\"resolvedShowLogicToggle()\"\n [(logic)]=\"logic\"\n [filtersCount]=\"_filters.length\"\n [clearCount]=\"activeCount()\"\n [clearDisabled]=\"resolvedClearDisabled()\"\n [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n [canSaveFilter]=\"canSaveFilter()\"\n [autoId]=\"resolvedAutoId()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n [showSearchButton]=\"resolvedApplyOn() !== 'commit'\"\n (clear)=\"onClearClick()\"\n (search)=\"triggerApply()\" />\n\n <!-- Host content pinned after the toolbar (e.g. sd-table's quick-search right slot). -->\n <ng-content select=\"[sdQueryBarEnd]\" />\n</div>\n", styles: [":host{display:block;font-family:Roboto,system-ui,sans-serif}.c-query-bar{display:flex;align-items:flex-start;flex-wrap:nowrap;gap:8px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:var(--sd-radius-8, 8px);box-shadow:0 1px 2px #0f172a0a}.c-query-bar.c-density-compact{padding:8px}.c-query-bar.c-density-comfortable{padding:10px}.c-query-bar.c-appearance-flush{background:transparent;border:0;border-radius:0;box-shadow:none;padding:8px 12px}.c-query-bar__main{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.c-search{flex:0 0 auto;min-width:220px}.c-divider{width:1px;height:16px;background:var(--sd-query-bar-border-soft, #e2e4e7);margin:0 2px}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}.c-density-compact .c-token{height:28px}.c-density-comfortable .c-token{height:32px}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-dash{color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 4px;line-height:1}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}.c-density-compact .c-token-remove{width:26px}.c-density-comfortable .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}.c-add-filter{display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:999px;border:1px dashed var(--sd-query-bar-border, #d6d8db);background:transparent;cursor:pointer;color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.c-density-compact .c-add-filter{width:28px;height:28px}.c-density-comfortable .c-add-filter{width:32px;height:32px}.c-add-filter sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-add-filter:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-add-filter[disabled]{opacity:.5;cursor:not-allowed}.c-add-condition{display:flex;flex:1 1 150px;align-items:center;gap:6px;box-sizing:border-box;min-width:150px;padding:0 8px;border-radius:var(--sd-radius-6, 6px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-density-compact .c-add-condition{height:28px}.c-density-comfortable .c-add-condition{height:32px}.c-add-condition:focus-within{box-shadow:inset 0 0 0 1px var(--sd-primary)}.c-add-condition.c-add-condition--disabled{opacity:.5}.c-add-condition-icon{flex:0 0 16px;width:16px;height:16px;font-size:var(--sd-font-size-16, 16px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-add-condition-input{flex:1 1 auto;min-width:0;height:100%;margin:0;padding:0;border:0;background:transparent;color:var(--sd-query-bar-text, #212121);font:inherit;font-size:var(--sd-font-size-13, 13px)}.c-add-condition-input:focus{outline:none}.c-add-condition-input::placeholder{color:var(--sd-query-bar-text-muted, #7a7a7a);opacity:1}.c-add-condition-input:disabled{cursor:not-allowed}@media(forced-colors:active){.c-add-condition:focus-within{--sd-control-focus-ring: Highlight;outline:2px solid var(--sd-control-focus-ring);outline-offset:-2px}}.c-or-connector{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-bold, 700);letter-spacing:.6px;color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 2px}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n", ".c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-query-bar ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: ɵSdQueryPanelTriggerDirective, selector: "[sdQueryPanelTrigger]", inputs: ["sdQueryPanelTrigger"], outputs: ["panelOpened", "panelClosed"], exportAs: ["sdQueryPanelTrigger"] }, { kind: "component", type: _SdSearchField, selector: "sd-search-field", inputs: ["size", "clearable", "clearLabel", "autoId"], outputs: ["cleared"] }, { kind: "directive", type: _SdSearchFieldInputDirective, selector: "input[sdSearchFieldInput]" }, { kind: "component", type: SdQueryActionsBar, selector: "sd-query-actions-bar", inputs: ["showLogicToggle", "logic", "filtersCount", "showSavedFilters", "savedFiltersKey", "query", "canSaveFilter", "autoId", "showClearAll", "clearCount", "clearDisabled", "canSearch", "showSearchButton"], outputs: ["logicChange", "applyFilter", "clear", "search"] }, { kind: "component", type: SdQueryBuildChip, selector: "sd-query-build-chip", inputs: ["building", "density", "allowedOperators", "multiple", "showOperator", "autoId"], outputs: ["pickOperator", "commitValue", "cancel", "seamlessCommit", "draftChange", "draftCommit"] }, { kind: "component", type: SdQueryChipPopover, selector: "sd-query-chip-popover", inputs: ["field", "filter", "chipIndex", "autoIdBase"], outputs: ["commit"] }, { kind: "component", type: SdQueryFieldPicker, selector: "sd-query-field-picker", inputs: ["fields", "usedKeys", "autoId", "findBox"], outputs: ["pick", "closed"] }, { kind: "component", type: SdQueryInlineChip, selector: "sd-query-inline-chip", inputs: ["field", "filter", "density", "multiple", "showOperator", "autoId", "valueText", "isNoData", "pinned", "required", "invalid", "describedBy"], outputs: ["commit", "commitRange", "liveChange", "remove"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus", "pinned", "required", "invalid", "describedBy"], outputs: ["valueChange", "remove"] }, { kind: "component", type: SdQueryPopoverChip, selector: "sd-query-popover-chip", inputs: ["field", "filter", "active", "showOperator", "valueText", "emptyText", "pinned", "disabled", "required", "invalid", "describedBy", "panel"], outputs: ["open", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2103
3252
|
}
|
|
2104
3253
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBar, decorators: [{
|
|
2105
3254
|
type: Component,
|
|
2106
|
-
args: [{ selector: 'sd-query-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3255
|
+
args: [{ selector: 'sd-query-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [ɵSdQueryPanelGroup], host: {
|
|
3256
|
+
'(click)': 'onMainClick($event)',
|
|
3257
|
+
'(keydown)': 'onMainKeydown($event)',
|
|
3258
|
+
}, imports: [
|
|
2107
3259
|
SdIcon,
|
|
2108
3260
|
CommonModule,
|
|
2109
|
-
FormsModule,
|
|
2110
|
-
MatMenuModule,
|
|
2111
3261
|
MatTooltipModule,
|
|
3262
|
+
ɵSdQueryPanelTriggerDirective,
|
|
3263
|
+
_SdSearchField,
|
|
3264
|
+
_SdSearchFieldInputDirective,
|
|
2112
3265
|
SdQueryActionsBar,
|
|
2113
3266
|
SdQueryBuildChip,
|
|
2114
3267
|
SdQueryChipPopover,
|
|
@@ -2116,12 +3269,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
2116
3269
|
SdQueryInlineChip,
|
|
2117
3270
|
SdQueryInlineValueChip,
|
|
2118
3271
|
SdQueryPopoverChip,
|
|
2119
|
-
], template: "<!--\n sd-query-bar \u2014 unified filter chip row (Jira/Linear/Notion style).\n Visual spec: refs/design_handoff_sd_query_bar/README.md\n TODO(next-iter): replace inline placeholders for field-picker + chip-popover\n with extracted sub-components driven by CDK overlay.\n-->\n@let _filters = filters();\n@let _resolvedFields = resolvedFields();\n@let _resolvedDensity = resolvedDensity();\n@let _showOrConnector = showOrConnector();\n@let _usedFieldKeys = usedFieldKeys();\n@let _editingIndex = editingIndex();\n@let _resolvedMode = resolvedMode();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n@let _addDisabled = addDisabled();\n@let _invalidHintId = resolvedInvalidHintId();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\"\n [class.c-appearance-flush]=\"resolvedAppearance() === 'flush'\">\n\n <!-- Main region \u2014 search + filters + add-filter. Wraps internally; the right\n action toolbar stays anchored and does NOT flow with this. -->\n <div class=\"c-query-bar__main\">\n\n <!-- Free-text search (left, optional) -->\n @if (resolvedShowSearch()) {\n <div class=\"c-search\">\n <sd-icon class=\"c-search-icon\" name=\"search\"></sd-icon>\n <input\n class=\"c-search-input\"\n type=\"text\"\n [ngModel]=\"search()\"\n (ngModelChange)=\"setSearch($event)\"\n (keydown.enter)=\"applySearch()\"\n [placeholder]=\"searchPlaceholder()\" />\n </div>\n <span class=\"c-divider\" aria-hidden=\"true\"></span>\n }\n\n <!-- Chip popover \u2014 extracted into <sd-query-chip-popover>. Declared BEFORE chips\n so the popover-mode @for chips can bind their [menu] to `chipPopover.menu()`.\n why: m\u1EDF popover \u0111\u1EC3 EDIT ch\u1EC9 cho ch\u1EC9nh operator + value \u2014 KH\u00D4NG \u0111\u1ED5i field.\n B\u1ECF [switchPickerMenu] \u2192 header render nh\u00E3n field t\u0129nh (read-only). Mu\u1ED1n \u0111\u1ED5i\n field th\u00EC xo\u00E1 chip r\u1ED3i th\u00EAm l\u1EA1i. -->\n <sd-query-chip-popover\n #chipPopover\n [field]=\"editingField() ?? undefined\"\n [filter]=\"_editingIndex !== null ? $any(_filters[_editingIndex!]) : undefined\"\n [chipIndex]=\"_editingIndex\"\n [autoIdBase]=\"resolvedAutoId() ?? 'qb'\"\n (commit)=\"onChipPopoverCommit($event)\" />\n\n @if (_resolvedMode === 'inline') {\n <!-- ===== INLINE MODE (GitLab-style token builder) ===== -->\n\n <!-- Completed chips.\n why: track theo rowId(filter) ch\u1EE9 KH\u00D4NG theo $index \u2014 track $index g\u1EAFn chip v\u1EDBi v\u1ECB tr\u00ED,\n n\u00EAn xo\u00E1 filter \u0111\u1EA7u ti\u00EAn s\u1EBD bind l\u1EA1i chip c\u0169 sang filter k\u1EBF ti\u1EBFp v\u00E0 k\u00E9o theo state n\u1ED9i b\u1ED9\n (inline-chip `#editing`, inline-value-chip `draft`) sang sai filter. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @if (_field) {\n @let _op = $any(filter.operator);\n @let _data = $any(filter).data;\n @let _invalid = isInvalid(filter);\n @if (_field.disabled) {\n <!-- why: chip inline l\u00E0 ch\u00EDnh \u00F4 nh\u1EADp \u2014 field b\u1ECB kho\u00E1 d\u00F9ng chip popover b\u1ECB kho\u00E1 (ch\u1EC9 hi\u1EC3n th\u1ECB), nh\u01B0 \u1EDF mode popover. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"isFilterActive(filter)\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"!!_field.pinned\"\n [disabled]=\"true\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [menu]=\"chipPopover.menu()!\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n } @else if (_field.type === 'string' || _field.type === 'number') {\n <!-- Seamless chip \u2014 the pill is the input (string / number). -->\n <sd-query-inline-value-chip\n [field]=\"_field\"\n [operator]=\"_op\"\n [value]=\"_data\"\n [density]=\"_resolvedDensity\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"!!_field.pinned\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n } @else {\n <sd-query-inline-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [density]=\"_resolvedDensity\"\n [multiple]=\"multiple(_op)\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"!!_field.pinned\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"onInlineCommit(i, $event)\"\n (commitRange)=\"onInlineRange(i, $event)\"\n (liveChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n }\n }\n }\n\n <!-- Building chip (in-progress) \u2014 extracted into <sd-query-build-chip>. -->\n @if (building(); as _b) {\n <sd-query-build-chip\n [building]=\"_b\"\n [density]=\"_resolvedDensity\"\n [allowedOperators]=\"allowedOperatorsFor(_b.field)\"\n [multiple]=\"multiple($any(_b.operator))\"\n [showOperator]=\"showOperatorFor(_b.field, _b.operator)\"\n (pickOperator)=\"pickBuildOperator($any($event))\"\n (commitValue)=\"commitBuildValue($event)\"\n (cancel)=\"cancelBuild()\"\n (seamlessCommit)=\"onBuildSeamlessCommit($event)\" />\n }\n\n <!-- Add filter -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [matMenuTriggerFor]=\"addPicker.menu()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n (menuOpened)=\"addPicker.focusFind()\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n } @else {\n <!-- ===== POPOVER MODE (default) \u2014 compact chips edited via mat-menu ===== -->\n <!-- why: track theo rowId(filter) \u2014 xem ghi ch\u00FA \u1EDF nh\u00E1nh inline. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @let _active = isFilterActive(filter);\n @let _invalid = isInvalid(filter);\n <!-- why: menu close commit is handled by chipPopover's (commit) \u2192\n onChipPopoverCommit; popover-chip only signals open + remove here. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"_active\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"!!_field?.pinned\"\n [disabled]=\"!!_field?.disabled\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [menu]=\"chipPopover.menu()!\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n }\n\n <!-- Add filter trigger -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [matMenuTriggerFor]=\"addPicker.menu()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n (menuOpened)=\"addPicker.focusFind()\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n }\n\n </div><!-- /.c-query-bar__main -->\n\n <!-- Field picker \u2014 list available fields, fade ones already in use. Pinned fields\n always have their chip, so the picker leaves them out. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"pickerFields()\"\n [usedKeys]=\"_usedFieldKeys\"\n (pick)=\"_resolvedMode === 'inline' ? beginBuild($event) : addFilter($event)\" />\n\n <sd-query-actions-bar\n [showLogicToggle]=\"resolvedShowLogicToggle()\"\n [(logic)]=\"logic\"\n [filtersCount]=\"_filters.length\"\n [clearCount]=\"activeCount()\"\n [clearDisabled]=\"resolvedClearDisabled()\"\n [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n [showSearchButton]=\"resolvedApplyOn() !== 'commit'\"\n (clear)=\"onClearClick()\"\n (search)=\"triggerApply()\" />\n\n <!-- Host content pinned after the toolbar (e.g. sd-table's quick-search right slot). -->\n <ng-content select=\"[sdQueryBarEnd]\" />\n</div>\n", styles: [":host{display:block;font-family:Roboto,system-ui,sans-serif}.c-query-bar{display:flex;align-items:flex-start;flex-wrap:nowrap;gap:8px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:var(--sd-radius-8, 8px);box-shadow:0 1px 2px #0f172a0a}.c-query-bar.c-density-compact{padding:8px}.c-query-bar.c-density-comfortable{padding:10px}.c-query-bar.c-appearance-flush{background:transparent;border:0;border-radius:0;box-shadow:none;padding:8px 12px}.c-query-bar__main{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.c-search{display:flex;align-items:center;gap:6px;min-width:220px;padding:0 10px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-control-border, var(--sd-border));border-radius:var(--sd-control-radius, 8px)}.c-search:hover{border-color:var(--sd-control-border-hover, var(--sd-border-strong))}.c-search:focus-within{border-color:var(--sd-control-border-focus, var(--sd-primary));box-shadow:var(--sd-control-ring, none);outline:none}@media(forced-colors:active){.c-search:focus-within{--sd-control-focus-ring: Highlight;outline:2px solid var(--sd-control-focus-ring);outline-offset:2px}}.c-density-compact .c-search{height:28px}.c-density-comfortable .c-search{height:32px}.c-search .c-search-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-input{flex:1;border:none;outline:none;background:transparent;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121)}.c-search .c-search-input::placeholder{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-kbd{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);padding:1px 4px;border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:3px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-divider{width:1px;height:16px;background:var(--sd-query-bar-border-soft, #e2e4e7);margin:0 2px}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}.c-density-compact .c-token{height:28px}.c-density-comfortable .c-token{height:32px}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-dash{color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 4px;line-height:1}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}.c-density-compact .c-token-remove{width:26px}.c-density-comfortable .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}.c-add-filter{display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:999px;border:1px dashed var(--sd-query-bar-border, #d6d8db);background:transparent;cursor:pointer;color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.c-density-compact .c-add-filter{width:28px;height:28px}.c-density-comfortable .c-add-filter{width:32px;height:32px}.c-add-filter sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-add-filter:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-add-filter[disabled]{opacity:.5;cursor:not-allowed}.c-or-connector{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-bold, 700);letter-spacing:.6px;color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 2px}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input{width:100%;height:32px;padding:0 10px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font-family:inherit;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121);outline:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus{border-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button.c-pop-boolean-active{background:var(--sd-primary-light);border-color:var(--sd-primary);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values{max-height:220px;overflow-y:auto;margin:0;padding:0;list-style:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:var(--sd-radius-4, 4px);font-size:var(--sd-font-size-13, 13px);cursor:pointer;-webkit-user-select:none;user-select:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li.c-pop-value-selected{background:var(--sd-primary-light);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=checkbox],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=radio]{accent-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-empty{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n", ".c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-query-bar ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}\n"] }]
|
|
2120
|
-
}], ctorParameters: () => [], propDecorators: { popoverChips: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => SdQueryPopoverChip), { isSignal: true }] }], buildChip: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdQueryBuildChip), { isSignal: true }] }], chipPopover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdQueryChipPopover), { isSignal: true }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }, { type: i0.Output, args: ["filtersChange"] }], logic: [{ type: i0.Input, args: [{ isSignal: true, alias: "logic", required: false }] }, { type: i0.Output, args: ["logicChange"] }], search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }, { type: i0.Output, args: ["searchChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], showSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearch", required: false }] }], showSavedFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSavedFilters", required: false }] }], savedFiltersKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "savedFiltersKey", required: false }] }], showLogicToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLogicToggle", required: false }] }], showClearAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearAll", required: false }] }], showOperatorOnChip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperatorOnChip", required: false }] }], queryChange: [{ type: i0.Output, args: ["queryChange"] }], apply: [{ type: i0.Output, args: ["apply"] }] } });
|
|
3272
|
+
], template: "<!--\n sd-query-bar \u2014 unified filter chip row (Jira/Linear/Notion style).\n Panels (field picker, chip popover, saved filters) share one CDK Overlay frame \u2014 handoff\n design_handoff_sd_query_bar_panels.\n-->\n@let _filters = filters();\n@let _resolvedFields = resolvedFields();\n@let _resolvedDensity = resolvedDensity();\n@let _showOrConnector = showOrConnector();\n@let _usedFieldKeys = usedFieldKeys();\n@let _editingIndex = editingIndex();\n@let _resolvedMode = resolvedMode();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n@let _addDisabled = addDisabled();\n@let _invalidHintId = resolvedInvalidHintId();\n@let _autoId = resolvedAutoId();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\"\n [class.c-appearance-flush]=\"resolvedAppearance() === 'flush'\">\n\n <!-- Main region \u2014 search + filters + add-filter. Wraps internally; the right\n action toolbar stays anchored and does NOT flow with this. -->\n <div class=\"c-query-bar__main\">\n\n <!-- Free-text search (left, optional) -->\n @if (resolvedShowSearch()) {\n <!-- Handoff m\u1EE5c 7: primitive t\u00ECm ki\u1EBFm d\u00F9ng chung \u2014 c\u1EE1 xs (28px) \u1EDF density compact, sm (32px) \u1EDF comfortable. -->\n <sd-search-field\n class=\"c-search\"\n clearable\n [size]=\"_resolvedDensity === 'compact' ? 'xs' : 'sm'\"\n [clearLabel]=\"searchClearLabel()\"\n [autoId]=\"_autoId ? _autoId + '-search' : undefined\"\n (cleared)=\"clearSearch()\">\n <input\n sdSearchFieldInput\n type=\"text\"\n enterkeyhint=\"search\"\n autocomplete=\"off\"\n [attr.aria-label]=\"searchLabel()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n [placeholder]=\"searchPlaceholder()\"\n [value]=\"search()\"\n (input)=\"setSearch($any($event.target).value)\"\n (keydown.enter)=\"applySearch()\"\n (keydown.escape)=\"onSearchEscape($event)\" />\n </sd-search-field>\n <span class=\"c-divider\" aria-hidden=\"true\"></span>\n }\n\n <!-- Chip popover \u2014 extracted into <sd-query-chip-popover>. Declared BEFORE chips\n so the popover-mode @for chips can bind their [panel] to `chipPopover.panel()`.\n why: m\u1EDF popover \u0111\u1EC3 EDIT ch\u1EC9 cho ch\u1EC9nh operator + value \u2014 KH\u00D4NG \u0111\u1ED5i field (handoff M7):\n header render nh\u00E3n field t\u0129nh (read-only). Mu\u1ED1n \u0111\u1ED5i field th\u00EC xo\u00E1 chip r\u1ED3i th\u00EAm l\u1EA1i. -->\n <sd-query-chip-popover\n #chipPopover\n [field]=\"editingField() ?? undefined\"\n [filter]=\"_editingIndex !== null ? $any(_filters[_editingIndex!]) : undefined\"\n [chipIndex]=\"_editingIndex\"\n [autoIdBase]=\"resolvedAutoId()\"\n (commit)=\"onChipPopoverCommit($event)\" />\n\n @if (_resolvedMode === 'inline') {\n <!-- ===== INLINE MODE (GitLab-style token builder) ===== -->\n\n <!-- Completed chips.\n why: track theo rowId(filter) ch\u1EE9 KH\u00D4NG theo $index \u2014 track $index g\u1EAFn chip v\u1EDBi v\u1ECB tr\u00ED,\n n\u00EAn xo\u00E1 filter \u0111\u1EA7u ti\u00EAn s\u1EBD bind l\u1EA1i chip c\u0169 sang filter k\u1EBF ti\u1EBFp v\u00E0 k\u00E9o theo state n\u1ED9i b\u1ED9\n (inline-chip `#editing`, inline-value-chip `draft`) sang sai filter. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @if (_field) {\n @let _op = $any(filter.operator);\n @let _data = $any(filter).data;\n @let _invalid = isInvalid(filter);\n @if (_field.disabled) {\n <!-- why: chip inline l\u00E0 ch\u00EDnh \u00F4 nh\u1EADp \u2014 field b\u1ECB kho\u00E1 d\u00F9ng chip popover b\u1ECB kho\u00E1 (ch\u1EC9 hi\u1EC3n th\u1ECB), nh\u01B0 \u1EDF mode popover. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"isFilterActive(filter)\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field.required\"\n [disabled]=\"true\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [panel]=\"chipPopover.panel()\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n } @else if (_field.type === 'string' || _field.type === 'number') {\n <!-- Seamless chip \u2014 the pill is the input (string / number). -->\n <sd-query-inline-value-chip\n [field]=\"_field\"\n [operator]=\"_op\"\n [value]=\"_data\"\n [density]=\"_resolvedDensity\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field.required\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n } @else {\n <sd-query-inline-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [density]=\"_resolvedDensity\"\n [multiple]=\"multiple(_op)\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field.required\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"onInlineCommit(i, $event)\"\n (commitRange)=\"onInlineRange(i, $event)\"\n (liveChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n }\n }\n }\n\n <!-- Building chip (in-progress) \u2014 extracted into <sd-query-build-chip>. -->\n @if (building(); as _b) {\n <sd-query-build-chip\n [building]=\"_b\"\n [density]=\"_resolvedDensity\"\n [allowedOperators]=\"allowedOperatorsFor(_b.field)\"\n [multiple]=\"multiple($any(_b.operator))\"\n [showOperator]=\"showOperatorFor(_b.field, _b.operator)\"\n (pickOperator)=\"pickBuildOperator($any($event))\"\n (commitValue)=\"commitBuildValue($event)\"\n (cancel)=\"cancelBuild()\"\n (seamlessCommit)=\"onBuildSeamlessCommit($event)\" />\n }\n\n <!-- Th\u00EAm \u0111i\u1EC1u ki\u1EC7n (handoff m\u1EE5c 8): \u00F4 combobox \u0111i\u1EC1u khi\u1EC3n listbox c\u1EE7a field picker, focus th\u1EADt \u1EDF l\u1EA1i trong \u00F4.\n Kh\u00F4ng t\u1EF1 m\u1EDF khi ch\u1EC9 Tab t\u1EDBi. H\u1EBFt field th\u00EC \u00F4 kho\u00E1, tooltip n\u00F3i l\u00FD do nh\u01B0 n\u00FAt + tr\u01B0\u1EDBc \u0111\u00E2y. -->\n <div\n class=\"c-add-condition\"\n [class.c-add-condition--disabled]=\"_addDisabled\"\n [matTooltip]=\"_addDisabled ? (_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel) : ''\">\n <sd-icon class=\"c-add-condition-icon\" name=\"add\" size=\"16px\" aria-hidden=\"true\"></sd-icon>\n <input\n #addInput\n class=\"c-add-condition-input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"addPicker.panel().isOpen()\"\n [attr.aria-controls]=\"addPicker.listId\"\n [attr.aria-activedescendant]=\"addPicker.panel().isOpen() ? addPicker.activeId() : null\"\n [attr.aria-label]=\"addConditionLabel()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-add-condition' : null\"\n [placeholder]=\"addConditionLabel()\"\n [disabled]=\"_addDisabled\"\n [value]=\"addQuery()\"\n (input)=\"onAddInput($any($event.target).value)\"\n (click)=\"openAddList()\"\n (keydown)=\"onAddKeydown($event)\" />\n </div>\n } @else {\n <!-- ===== POPOVER MODE (default) \u2014 compact chips edited in the chip popover panel ===== -->\n <!-- why: track theo rowId(filter) \u2014 xem ghi ch\u00FA \u1EDF nh\u00E1nh inline. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @let _active = isFilterActive(filter);\n @let _invalid = isInvalid(filter);\n <!-- why: menu close commit is handled by chipPopover's (commit) \u2192\n onChipPopoverCommit; popover-chip only signals open + remove here. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"_active\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"isLocked(_field)\"\n [required]=\"!!_field?.required\"\n [disabled]=\"!!_field?.disabled\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [panel]=\"chipPopover.panel()\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n }\n\n <!-- Add filter trigger -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [sdQueryPanelTrigger]=\"addPicker.panel()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n [attr.aria-label]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n }\n\n </div><!-- /.c-query-bar__main -->\n\n <!-- Field picker \u2014 list available fields, fade ones already in use. Pinned fields\n always have their chip, so the picker leaves them out. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"pickerFields()\"\n [usedKeys]=\"_usedFieldKeys\"\n [autoId]=\"resolvedAutoId()\"\n [findBox]=\"_resolvedMode !== 'inline'\"\n (pick)=\"onPick($event)\"\n (closed)=\"addQuery.set('')\" />\n\n <sd-query-actions-bar\n [showLogicToggle]=\"resolvedShowLogicToggle()\"\n [(logic)]=\"logic\"\n [filtersCount]=\"_filters.length\"\n [clearCount]=\"activeCount()\"\n [clearDisabled]=\"resolvedClearDisabled()\"\n [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n [canSaveFilter]=\"canSaveFilter()\"\n [autoId]=\"resolvedAutoId()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n [showSearchButton]=\"resolvedApplyOn() !== 'commit'\"\n (clear)=\"onClearClick()\"\n (search)=\"triggerApply()\" />\n\n <!-- Host content pinned after the toolbar (e.g. sd-table's quick-search right slot). -->\n <ng-content select=\"[sdQueryBarEnd]\" />\n</div>\n", styles: [":host{display:block;font-family:Roboto,system-ui,sans-serif}.c-query-bar{display:flex;align-items:flex-start;flex-wrap:nowrap;gap:8px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:var(--sd-radius-8, 8px);box-shadow:0 1px 2px #0f172a0a}.c-query-bar.c-density-compact{padding:8px}.c-query-bar.c-density-comfortable{padding:10px}.c-query-bar.c-appearance-flush{background:transparent;border:0;border-radius:0;box-shadow:none;padding:8px 12px}.c-query-bar__main{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.c-search{flex:0 0 auto;min-width:220px}.c-divider{width:1px;height:16px;background:var(--sd-query-bar-border-soft, #e2e4e7);margin:0 2px}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}.c-density-compact .c-token{height:28px}.c-density-comfortable .c-token{height:32px}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-dash{color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 4px;line-height:1}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}.c-density-compact .c-token-remove{width:26px}.c-density-comfortable .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}.c-add-filter{display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:999px;border:1px dashed var(--sd-query-bar-border, #d6d8db);background:transparent;cursor:pointer;color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.c-density-compact .c-add-filter{width:28px;height:28px}.c-density-comfortable .c-add-filter{width:32px;height:32px}.c-add-filter sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-add-filter:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-add-filter[disabled]{opacity:.5;cursor:not-allowed}.c-add-condition{display:flex;flex:1 1 150px;align-items:center;gap:6px;box-sizing:border-box;min-width:150px;padding:0 8px;border-radius:var(--sd-radius-6, 6px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-density-compact .c-add-condition{height:28px}.c-density-comfortable .c-add-condition{height:32px}.c-add-condition:focus-within{box-shadow:inset 0 0 0 1px var(--sd-primary)}.c-add-condition.c-add-condition--disabled{opacity:.5}.c-add-condition-icon{flex:0 0 16px;width:16px;height:16px;font-size:var(--sd-font-size-16, 16px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-add-condition-input{flex:1 1 auto;min-width:0;height:100%;margin:0;padding:0;border:0;background:transparent;color:var(--sd-query-bar-text, #212121);font:inherit;font-size:var(--sd-font-size-13, 13px)}.c-add-condition-input:focus{outline:none}.c-add-condition-input::placeholder{color:var(--sd-query-bar-text-muted, #7a7a7a);opacity:1}.c-add-condition-input:disabled{cursor:not-allowed}@media(forced-colors:active){.c-add-condition:focus-within{--sd-control-focus-ring: Highlight;outline:2px solid var(--sd-control-focus-ring);outline-offset:-2px}}.c-or-connector{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-bold, 700);letter-spacing:.6px;color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 2px}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n", ".c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-query-bar ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}\n"] }]
|
|
3273
|
+
}], ctorParameters: () => [], propDecorators: { popoverChips: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => SdQueryPopoverChip), { isSignal: true }] }], buildChip: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdQueryBuildChip), { isSignal: true }] }], chipPopover: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdQueryChipPopover), { isSignal: true }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: false }] }], autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], filters: [{ type: i0.Input, args: [{ isSignal: true, alias: "filters", required: false }] }, { type: i0.Output, args: ["filtersChange"] }], logic: [{ type: i0.Input, args: [{ isSignal: true, alias: "logic", required: false }] }, { type: i0.Output, args: ["logicChange"] }], search: [{ type: i0.Input, args: [{ isSignal: true, alias: "search", required: false }] }, { type: i0.Output, args: ["searchChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], showSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearch", required: false }] }], showSavedFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSavedFilters", required: false }] }], savedFiltersKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "savedFiltersKey", required: false }] }], showLogicToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLogicToggle", required: false }] }], showClearAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearAll", required: false }] }], showOperatorOnChip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperatorOnChip", required: false }] }], queryChange: [{ type: i0.Output, args: ["queryChange"] }], apply: [{ type: i0.Output, args: ["apply"] }], addInput: [{ type: i0.ViewChild, args: ['addInput', { isSignal: true }] }], addPicker: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdQueryFieldPicker), { isSignal: true }] }] } });
|
|
2121
3274
|
|
|
2122
3275
|
/**
|
|
2123
3276
|
* Generated bundle index. Do not edit.
|
|
2124
3277
|
*/
|
|
2125
3278
|
|
|
2126
|
-
export { SD_QUERY_DEFAULT_OPERATOR_BY_TYPE, SD_QUERY_MULTI_OPERATORS, SD_QUERY_NO_DATA_OPERATORS, SD_QUERY_OPERATORS_BY_TYPE, SD_QUERY_TYPE_ICON, SdQueryBar, sdQueryAllowedOperators, sdQueryDefaultOperator, sdQueryFieldIcon, sdQueryShowOperatorSelector };
|
|
3279
|
+
export { SD_QUERY_DEFAULT_OPERATOR_BY_TYPE, SD_QUERY_MULTI_OPERATORS, SD_QUERY_NO_DATA_OPERATORS, SD_QUERY_OPERATORS_BY_TYPE, SD_QUERY_TYPE_ICON, SdQueryBar, sdQueryAllowedOperators, sdQueryDefaultOperator, sdQueryFieldIcon, sdQueryShowOperatorSelector, ɵSdQueryChipLabels, ɵsdQueryChipValueText };
|
|
2127
3280
|
//# sourceMappingURL=sdcorejs-angular-components-query-bar.mjs.map
|