@sdcorejs/angular 20.3.5 → 20.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/STYLE-GUIDE.md +78 -1
- package/assets/THEME.md +45 -3
- package/assets/scss/core/_popover-panel.scss +90 -0
- package/assets/scss/core/form.scss +5 -2
- package/assets/scss/core/utilities/_grid.scss +15 -0
- package/assets/scss/core/utilities/_sizing.scss +4 -0
- package/assets/scss/themes/_component-tokens.scss +9 -4
- package/assets/scss/themes/_semantic.scss +6 -5
- package/components/anchor/index.d.ts +6 -1
- package/components/button/index.d.ts +7 -1
- package/components/calendar/index.d.ts +1092 -0
- package/components/card/index.d.ts +247 -9
- package/components/index.d.ts +3 -1
- package/components/kanban/index.d.ts +191 -74
- package/components/modal/index.d.ts +10 -1
- package/components/query-bar/index.d.ts +176 -36
- package/components/quick-action/index.d.ts +65 -1
- package/components/scheduler/index.d.ts +544 -0
- package/components/tab/index.d.ts +6 -1
- package/components/table/index.d.ts +56 -7
- package/components/timeline/index.d.ts +216 -0
- package/components/tree/index.d.ts +119 -6
- package/directives/index.d.ts +4 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +62 -3
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +14 -6
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-calendar.mjs +2481 -0
- package/fesm2022/sdcorejs-angular-components-calendar.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs +486 -23
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +4 -18
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +7 -7
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +833 -154
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +26 -7
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +1312 -220
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +68 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs +1934 -0
- package/fesm2022/sdcorejs-angular-components-scheduler.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +126 -26
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +31 -2
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +615 -104
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-timeline.mjs +473 -0
- package/fesm2022/sdcorejs-angular-components-timeline.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-tree.mjs +597 -36
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +2 -4
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +3 -1
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +109 -22
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +140 -42
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +70 -21
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +4 -3
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +622 -52
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-w7iVesRB.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-D_1BxDC9.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-w7iVesRB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-DwGr3EVD.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-CgH8Qi25.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-DwGr3EVD.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs → sdcorejs-angular-modules-generic-generic-list.page-QqBNS185.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-CyCGqW9W.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-QqBNS185.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-_WrprZ_o.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DTmU8Te4.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-_WrprZ_o.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +7 -2
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-okZVmcd5.mjs → sdcorejs-angular-modules-pattern-base-api.service-B2HMyv8F.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-okZVmcd5.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-B2HMyv8F.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-LPUj7MqG.mjs → sdcorejs-angular-modules-pattern-create.component-CNtkbnRK.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-LPUj7MqG.mjs.map → sdcorejs-angular-modules-pattern-create.component-CNtkbnRK.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-2-dyjvCH.mjs → sdcorejs-angular-modules-pattern-create.component-DlNyY3e7.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-2-dyjvCH.mjs.map → sdcorejs-angular-modules-pattern-create.component-DlNyY3e7.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-BCoG3bVV.mjs → sdcorejs-angular-modules-pattern-create.component-DxV_0Ckg.mjs} +11 -7
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-DxV_0Ckg.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-Caua6Xto.mjs → sdcorejs-angular-modules-pattern-customer.service-DS0cFc3u.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-Caua6Xto.mjs.map → sdcorejs-angular-modules-pattern-customer.service-DS0cFc3u.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-_c_4slgf.mjs → sdcorejs-angular-modules-pattern-detail.component-B_1ppVNA.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-_c_4slgf.mjs.map → sdcorejs-angular-modules-pattern-detail.component-B_1ppVNA.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-B2Y0PbbC.mjs → sdcorejs-angular-modules-pattern-detail.component-CFvwPHFx.mjs} +58 -55
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CFvwPHFx.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-C_HziBQN.mjs → sdcorejs-angular-modules-pattern-flow.component-Ba4xO_tF.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-C_HziBQN.mjs.map → sdcorejs-angular-modules-pattern-flow.component-Ba4xO_tF.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-B2dNqckm.mjs → sdcorejs-angular-modules-pattern-index.component-DvwY0K3t.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-B2dNqckm.mjs.map → sdcorejs-angular-modules-pattern-index.component-DvwY0K3t.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-Dq8Q8Vfm.mjs → sdcorejs-angular-modules-pattern-lines-table-form.component-BSAQaAgH.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-lines-table-form.component-Dq8Q8Vfm.mjs.map → sdcorejs-angular-modules-pattern-lines-table-form.component-BSAQaAgH.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BIv2k6NI.mjs +506 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BIv2k6NI.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CeX57FPi.mjs → sdcorejs-angular-modules-pattern-list.component-BYyL5Q5n.mjs} +30 -39
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BYyL5Q5n.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CZRTnqNx.mjs +501 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CZRTnqNx.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-DS8A17mM.mjs → sdcorejs-angular-modules-pattern-list.component-DF7CvaVG.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-DS8A17mM.mjs.map → sdcorejs-angular-modules-pattern-list.component-DF7CvaVG.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Bs9hhMr7.mjs → sdcorejs-angular-modules-pattern-list.component-nMyLso8Z.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Bs9hhMr7.mjs.map → sdcorejs-angular-modules-pattern-list.component-nMyLso8Z.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-Dfil91qL.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-CS7VK5Ol.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-Dfil91qL.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-CS7VK5Ol.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs → sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs} +4 -22
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-DuhyXsGn.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs → sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs} +26 -27
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-bfpj85ke.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-PaIGZ1ve.mjs → sdcorejs-angular-modules-pattern-product.service-KKWwzMEG.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-PaIGZ1ve.mjs.map → sdcorejs-angular-modules-pattern-product.service-KKWwzMEG.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-B8j8cieu.mjs → sdcorejs-angular-modules-pattern-profile.component-XDuLwzEl.mjs} +25 -15
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-XDuLwzEl.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-0Vh73aXL.mjs → sdcorejs-angular-modules-pattern-routes--ScZNg7A.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-0Vh73aXL.mjs.map → sdcorejs-angular-modules-pattern-routes--ScZNg7A.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-Cw9uJySU.mjs → sdcorejs-angular-modules-pattern-routes-Bka6PaRB.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-Cw9uJySU.mjs.map → sdcorejs-angular-modules-pattern-routes-Bka6PaRB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-nrxSHE-O.mjs → sdcorejs-angular-modules-pattern-routes-CCwFQAdd.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-nrxSHE-O.mjs.map → sdcorejs-angular-modules-pattern-routes-CCwFQAdd.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFT9DyKj.mjs → sdcorejs-angular-modules-pattern-routes-CKryLRCh.mjs} +8 -8
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFT9DyKj.mjs.map → sdcorejs-angular-modules-pattern-routes-CKryLRCh.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFLETqYK.mjs → sdcorejs-angular-modules-pattern-routes-Dr72yGSt.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-CFLETqYK.mjs.map → sdcorejs-angular-modules-pattern-routes-Dr72yGSt.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BoB2usST.mjs → sdcorejs-angular-modules-pattern-routes-P9WvwSEW.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-BoB2usST.mjs.map → sdcorejs-angular-modules-pattern-routes-P9WvwSEW.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-_EDJ1-63.mjs +65 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-_EDJ1-63.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-n4kpjO0y.mjs +56 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-n4kpjO0y.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-CJ6hUHjk.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-DHhmKKVI.mjs} +12 -12
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-CJ6hUHjk.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-DHhmKKVI.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-C_AFK_9X.mjs → sdcorejs-angular-modules-pattern-shell.component-DxNC-ixx.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-C_AFK_9X.mjs.map → sdcorejs-angular-modules-pattern-shell.component-DxNC-ixx.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-TWYHj6in.mjs +480 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-TWYHj6in.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-B7H9pp-R.mjs → sdcorejs-angular-modules-pattern-update.component-BcBxBqWB.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-B7H9pp-R.mjs.map → sdcorejs-angular-modules-pattern-update.component-BcBxBqWB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-Dhfba-qx.mjs → sdcorejs-angular-modules-pattern-update.component-BntTyV55.mjs} +9 -6
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BntTyV55.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-hRTu79uE.mjs → sdcorejs-angular-modules-pattern-update.component-CJjZWZuz.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-hRTu79uE.mjs.map → sdcorejs-angular-modules-pattern-update.component-CJjZWZuz.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +171 -158
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-query-params.mjs +226 -0
- package/fesm2022/sdcorejs-angular-services-query-params.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +24 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/forms/date/index.d.ts +2 -0
- package/forms/directives/index.d.ts +1 -1
- package/i18n/index.d.ts +121 -9
- package/modules/layout/index.d.ts +2 -1
- package/modules/pattern/README.md +5 -4
- package/modules/pattern/docs/detail.md +18 -9
- package/modules/pattern/docs/drawer.md +185 -83
- package/modules/pattern/docs/header-actions.md +1 -1
- package/modules/pattern/docs/list.md +3 -3
- package/modules/pattern/docs/states.md +1 -1
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +12 -16
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +58 -29
- package/modules/pattern/features/category/pages/list/list.component.html +11 -3
- package/modules/pattern/features/category/pages/list/list.component.ts +36 -10
- package/modules/pattern/features/category/routes.ts +5 -22
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +7 -11
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +70 -27
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +9 -53
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +53 -19
- package/modules/pattern/features/customer/entity.resolver.ts +1 -1
- package/modules/pattern/features/customer/pages/list/list.component.html +18 -3
- package/modules/pattern/features/customer/pages/list/list.component.ts +43 -16
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +17 -8
- package/modules/pattern/features/customer/routes.ts +6 -27
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +37 -56
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +14 -76
- package/modules/pattern/features/order/pages/create/create.component.ts +7 -3
- package/modules/pattern/features/order/pages/detail/detail.component.ts +1 -1
- package/modules/pattern/features/order/pages/update/update.component.ts +5 -2
- package/package.json +17 -5
- package/services/confirm/index.d.ts +22 -81
- package/services/query-params/index.d.ts +67 -0
- package/utilities/extensions/index.d.ts +10 -1
- package/components/history/index.d.ts +0 -23
- package/fesm2022/sdcorejs-angular-components-history.mjs +0 -54
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CB4F9cBe.mjs +0 -144
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CB4F9cBe.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CowdEzyv.mjs +0 -145
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CowdEzyv.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-BCoG3bVV.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +0 -18
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-Bu6E63bN.mjs +0 -148
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-Bu6E63bN.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-B2Y0PbbC.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs +0 -87
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BRsdOwWy.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs +0 -232
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-DalxHa8D.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs +0 -70
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-kdEZ9s7K.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B3-th1z4.mjs +0 -164
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-B3-th1z4.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CRttQEXa.mjs +0 -118
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CRttQEXa.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CeX57FPi.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-B8j8cieu.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CZusLcS3.mjs +0 -74
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-CZusLcS3.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Cq4BqjE9.mjs +0 -99
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-Cq4BqjE9.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-C74EEboR.mjs +0 -143
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-C74EEboR.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Dj9lvkCP.mjs +0 -132
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-Dj9lvkCP.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Dhfba-qx.mjs.map +0 -1
- package/modules/pattern/features/category/entity.resolver.ts +0 -27
|
@@ -1,17 +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
10
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
14
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';
|
|
15
20
|
import { SdOperator } from '@sdcorejs/angular/components/operator';
|
|
16
21
|
import { SdDate } from '@sdcorejs/angular/forms/date';
|
|
17
22
|
import { SdDateRange } from '@sdcorejs/angular/forms/date-range';
|
|
@@ -20,81 +25,539 @@ import { SdInput } from '@sdcorejs/angular/forms/input';
|
|
|
20
25
|
import { SdInputNumber } from '@sdcorejs/angular/forms/input-number';
|
|
21
26
|
import { SdSelect } from '@sdcorejs/angular/forms/select';
|
|
22
27
|
import { SdInlineText } from '@sdcorejs/angular/forms/inline-text';
|
|
23
|
-
import {
|
|
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"])';
|
|
52
|
+
/**
|
|
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: "20.3.25", ngImport: i0, type: ɵSdQueryPanelGroup, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
68
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ɵSdQueryPanelGroup });
|
|
69
|
+
}
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", 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).
|
|
76
|
+
*
|
|
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`.
|
|
81
|
+
*
|
|
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", alias: 'sdQueryPanel' }] : [{ alias: 'sdQueryPanel' }]));
|
|
97
|
+
/** Horizontal alignment with the trigger; flips when there is no room. */
|
|
98
|
+
align = input('start', ...(ngDevMode ? [{ debugName: "align", alias: 'sdQueryPanelAlign' }] : [{ 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", alias: 'sdQueryPanelControls' }] : [{ alias: 'sdQueryPanelControls' }]));
|
|
104
|
+
/** Id the trigger's `aria-controls` names. */
|
|
105
|
+
controlledId = computed(() => this.controls() ?? this.id, ...(ngDevMode ? [{ debugName: "controlledId" }] : []));
|
|
106
|
+
/** The panel opened and took focus. */
|
|
107
|
+
opened = output();
|
|
108
|
+
/**
|
|
109
|
+
* The panel closed; `reason` says how. Not emitted for `detach`: the panel or its trigger is being destroyed, and
|
|
110
|
+
* outputs of a destroyed view must not fire (NG0953).
|
|
111
|
+
*/
|
|
112
|
+
closed = output();
|
|
113
|
+
#isOpen = signal(false, ...(ngDevMode ? [{ debugName: "#isOpen" }] : []));
|
|
114
|
+
#origin = signal(undefined, ...(ngDevMode ? [{ debugName: "#origin" }] : []));
|
|
115
|
+
/** Whether the panel is open. */
|
|
116
|
+
isOpen = this.#isOpen.asReadonly();
|
|
117
|
+
/** The trigger the panel is open for (kept until `closed` has been emitted). */
|
|
118
|
+
origin = this.#origin.asReadonly();
|
|
119
|
+
#kind = computed(() => (this.role() === 'dialog' ? 'form' : 'list'), ...(ngDevMode ? [{ debugName: "#kind" }] : []));
|
|
120
|
+
/** @internal Triggers listen here, so an opening made through `open()` still reaches the trigger it uses. */
|
|
121
|
+
ɵopening = new Subject();
|
|
122
|
+
/** @internal */
|
|
123
|
+
ɵclosing = new Subject();
|
|
124
|
+
#ref;
|
|
125
|
+
#root;
|
|
126
|
+
#returnFocusTo;
|
|
127
|
+
#teardown = [];
|
|
128
|
+
#destroyed = false;
|
|
129
|
+
constructor() {
|
|
130
|
+
inject(DestroyRef).onDestroy(() => {
|
|
131
|
+
// why: output của directive đã huỷ không được phát nữa (NG0953) — đóng im lặng.
|
|
132
|
+
this.#destroyed = true;
|
|
133
|
+
this.close('detach');
|
|
134
|
+
this.ɵopening.complete();
|
|
135
|
+
this.ɵclosing.complete();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** The panel's root element while open. */
|
|
139
|
+
element() {
|
|
140
|
+
return this.#root;
|
|
141
|
+
}
|
|
142
|
+
/** Opens the panel next to `origin`. Open for another trigger: closes for that one first (`switch`). */
|
|
143
|
+
open(origin, options = {}) {
|
|
144
|
+
if (this.#destroyed)
|
|
145
|
+
return;
|
|
146
|
+
if (this.#ref && this.#origin() === origin) {
|
|
147
|
+
this.#returnFocusTo = options.returnFocusTo ?? undefined;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.close('switch');
|
|
151
|
+
this.#group?.activate(this);
|
|
152
|
+
this.#returnFocusTo = options.returnFocusTo ?? undefined;
|
|
153
|
+
this.#origin.set(origin);
|
|
154
|
+
// 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
|
|
155
|
+
// tiên đã đúng field (không vẽ field cũ rồi đổi).
|
|
156
|
+
this.ɵopening.next(origin);
|
|
157
|
+
const ref = this.#overlay.create({
|
|
158
|
+
positionStrategy: this.#overlay
|
|
159
|
+
.position()
|
|
160
|
+
.flexibleConnectedTo(origin)
|
|
161
|
+
.withPositions(this.align() === 'end' ? END_POSITIONS : START_POSITIONS)
|
|
162
|
+
.withViewportMargin(8)
|
|
163
|
+
.withPush(true)
|
|
164
|
+
.withFlexibleDimensions(true),
|
|
165
|
+
scrollStrategy: this.#overlay.scrollStrategies.reposition(),
|
|
166
|
+
panelClass: 'sd-query-panel-pane',
|
|
167
|
+
maxWidth: 'calc(100vw - 16px)',
|
|
168
|
+
maxHeight: 'calc(100dvh - 16px)',
|
|
169
|
+
direction: this.#dir?.value,
|
|
170
|
+
});
|
|
171
|
+
this.#ref = ref;
|
|
172
|
+
this.#isOpen.set(true);
|
|
173
|
+
ref.attach(new TemplatePortal(this.#template, this.#views)).detectChanges();
|
|
174
|
+
ref.updatePosition();
|
|
175
|
+
this.#root = ref.overlayElement.querySelector('.sd-query-panel') ?? undefined;
|
|
176
|
+
if (this.#root) {
|
|
177
|
+
this.#root.id = this.id;
|
|
178
|
+
if (!this.#root.hasAttribute('tabindex'))
|
|
179
|
+
this.#root.tabIndex = -1;
|
|
180
|
+
}
|
|
181
|
+
this.#listen(ref, origin);
|
|
182
|
+
const keyboard = !!options.keyboard;
|
|
183
|
+
// 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.
|
|
184
|
+
if (options.focus !== false && !this.#focusInitial(keyboard)) {
|
|
185
|
+
afterNextRender(() => {
|
|
186
|
+
if (this.#ref === ref)
|
|
187
|
+
this.#focusInitial(keyboard, true);
|
|
188
|
+
}, { injector: this.#injector });
|
|
189
|
+
}
|
|
190
|
+
this.opened.emit();
|
|
191
|
+
}
|
|
192
|
+
/** Closes the panel. Focus returns to `returnFocusTo` or the trigger, except as described for each reason. */
|
|
193
|
+
close(reason = 'close') {
|
|
194
|
+
this.#close(reason);
|
|
195
|
+
}
|
|
196
|
+
#close(reason, focusMoved = false) {
|
|
197
|
+
const ref = this.#ref;
|
|
198
|
+
const origin = this.#origin();
|
|
199
|
+
if (!ref || !origin)
|
|
200
|
+
return;
|
|
201
|
+
const active = this.#document.activeElement;
|
|
202
|
+
// 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
|
|
203
|
+
// 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.
|
|
204
|
+
const restore = reason === 'switch' || reason === 'detach' || focusMoved
|
|
205
|
+
? false
|
|
206
|
+
: reason === 'outside'
|
|
207
|
+
? !active || active === this.#document.body || ref.overlayElement.contains(active)
|
|
208
|
+
: true;
|
|
209
|
+
const returnTo = this.#returnFocusTo ?? origin;
|
|
210
|
+
this.#ref = undefined;
|
|
211
|
+
this.#root = undefined;
|
|
212
|
+
this.#returnFocusTo = undefined;
|
|
213
|
+
for (const stop of this.#teardown.splice(0))
|
|
214
|
+
stop();
|
|
215
|
+
ref.dispose();
|
|
216
|
+
this.#isOpen.set(false);
|
|
217
|
+
this.#group?.release(this);
|
|
218
|
+
if (restore && returnTo.isConnected && !returnTo.disabled)
|
|
219
|
+
returnTo.focus();
|
|
220
|
+
if (!this.#destroyed)
|
|
221
|
+
this.ɵclosing.next({ origin, reason });
|
|
222
|
+
if (!this.#destroyed && reason !== 'detach')
|
|
223
|
+
this.closed.emit(reason);
|
|
224
|
+
// why: một listener của `closed` có thể đã mở lại panel (cho trigger khác) — khi đó giữ origin mới.
|
|
225
|
+
if (!this.#ref)
|
|
226
|
+
this.#origin.set(undefined);
|
|
227
|
+
}
|
|
228
|
+
#listen(ref, origin) {
|
|
229
|
+
const outside = ref.outsidePointerEvents().subscribe(event => {
|
|
230
|
+
const target = _getEventTarget(event);
|
|
231
|
+
if (target && (origin.contains(target) || this.#returnFocusTo?.contains(target) || this.#inStackedLayer(target)))
|
|
232
|
+
return;
|
|
233
|
+
this.close('outside');
|
|
234
|
+
});
|
|
235
|
+
const pane = ref.overlayElement;
|
|
236
|
+
// 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
|
|
237
|
+
// panel, nằm trên cùng) không nuốt được Esc qua OverlayKeyboardDispatcher (R1 · N-1). keydownEvents() chỉ còn cho
|
|
238
|
+
// 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
|
|
239
|
+
// của sd-date) là của popup đó.
|
|
240
|
+
const keys = ref.keydownEvents().subscribe(event => {
|
|
241
|
+
const target = _getEventTarget(event);
|
|
242
|
+
if (target && (pane.contains(target) || this.#inStackedLayer(target)))
|
|
243
|
+
return;
|
|
244
|
+
this.#escape(event);
|
|
245
|
+
});
|
|
246
|
+
const onKeydown = (event) => {
|
|
247
|
+
if (event.key === 'Escape')
|
|
248
|
+
this.#escape(event);
|
|
249
|
+
// 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.
|
|
250
|
+
else if (event.key === 'Tab' && !event.defaultPrevented && this.#leavesByTab(event))
|
|
251
|
+
this.close('tab');
|
|
252
|
+
};
|
|
253
|
+
const onFocusOut = (event) => {
|
|
254
|
+
const next = event.relatedTarget;
|
|
255
|
+
// why: relatedTarget null = focus rơi về body hoặc cửa sổ mất focus — bấm ra ngoài đã có outsidePointerEvents.
|
|
256
|
+
if (!next || pane.contains(next) || origin.contains(next) || this.#returnFocusTo?.contains(next) || this.#inStackedLayer(next))
|
|
257
|
+
return;
|
|
258
|
+
this.#close('outside', true);
|
|
259
|
+
};
|
|
260
|
+
pane.addEventListener('keydown', onKeydown);
|
|
261
|
+
pane.addEventListener('focusout', onFocusOut);
|
|
262
|
+
this.#teardown.push(() => outside.unsubscribe(), () => keys.unsubscribe(), () => pane.removeEventListener('keydown', onKeydown), () => pane.removeEventListener('focusout', onFocusOut));
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Escape closes the panel unless the popup of a control is open above it (an sd-select panel closes first).
|
|
266
|
+
* 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
|
|
267
|
+
* 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.
|
|
268
|
+
*/
|
|
269
|
+
#escape(event) {
|
|
270
|
+
if (event.key !== 'Escape' || !this.#ref || hasModifierKey(event) || this.#interactiveLayerAbove())
|
|
271
|
+
return;
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
this.close('escape');
|
|
274
|
+
}
|
|
275
|
+
/** An overlay layer stacked above this panel that a user can interact with (not a tooltip). */
|
|
276
|
+
#interactiveLayerAbove() {
|
|
277
|
+
const host = this.#ref?.hostElement;
|
|
278
|
+
if (!host)
|
|
279
|
+
return false;
|
|
280
|
+
return Array.from(this.#container.getContainerElement().children).some(layer => layer !== host && !!(host.compareDocumentPosition(layer) & Node.DOCUMENT_POSITION_FOLLOWING) && !!layer.querySelector(INTERACTIVE));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Tab leaves a list at once (focus goes back to the trigger and the browser moves on from there, like the Action
|
|
284
|
+
* Popover). In a form it leaves from the last control, Shift+Tab from the first.
|
|
285
|
+
*/
|
|
286
|
+
#leavesByTab(event) {
|
|
287
|
+
if (this.#kind() === 'list')
|
|
288
|
+
return true;
|
|
289
|
+
const root = this.#root;
|
|
290
|
+
if (!root)
|
|
291
|
+
return true;
|
|
292
|
+
const tabbables = this.#tabbables(root);
|
|
293
|
+
const target = event.target;
|
|
294
|
+
if (!tabbables.length)
|
|
295
|
+
return true;
|
|
296
|
+
return event.shiftKey ? target === tabbables[0] || target === root : target === tabbables[tabbables.length - 1];
|
|
297
|
+
}
|
|
298
|
+
#focusInitial(keyboard, last = false) {
|
|
299
|
+
const root = this.#root;
|
|
300
|
+
if (!root)
|
|
301
|
+
return false;
|
|
302
|
+
let target;
|
|
303
|
+
if (this.#kind() === 'form') {
|
|
304
|
+
const marked = root.querySelector('[data-sd-query-panel-initial]');
|
|
305
|
+
target = marked ? this.#tabbables(marked)[0] : this.#tabbables(root)[0];
|
|
306
|
+
if (!target && !last)
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
target = root.querySelector('input:not([disabled])');
|
|
311
|
+
if (!target && keyboard)
|
|
312
|
+
target = root.querySelector(FIRST_OPTION);
|
|
313
|
+
}
|
|
314
|
+
(target ?? root).focus();
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
#tabbables(root) {
|
|
318
|
+
return Array.from(root.querySelectorAll(TABBABLE)).filter(element => this.#checker.isFocusable(element) && this.#checker.isTabbable(element));
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Whether `node` sits in an overlay layer stacked above this panel: the panel of an sd-select, a date picker, the menu
|
|
322
|
+
* of sd-operator. Clicks and focus there belong to a control of the panel, so they are not "outside". Layers below it
|
|
323
|
+
* (a dialog that hosts the bar) are outside.
|
|
324
|
+
*/
|
|
325
|
+
#inStackedLayer(node) {
|
|
326
|
+
const host = this.#ref?.hostElement;
|
|
327
|
+
const container = this.#container.getContainerElement();
|
|
328
|
+
if (!host || !container.contains(node) || host.contains(node))
|
|
329
|
+
return false;
|
|
330
|
+
let layer = node;
|
|
331
|
+
while (layer && layer.parentNode !== container)
|
|
332
|
+
layer = layer.parentNode;
|
|
333
|
+
return !!layer && !!(host.compareDocumentPosition(layer) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
334
|
+
}
|
|
335
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ɵSdQueryPanelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
336
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.25", 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 });
|
|
337
|
+
}
|
|
338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ɵSdQueryPanelDirective, decorators: [{
|
|
339
|
+
type: Directive,
|
|
340
|
+
args: [{
|
|
341
|
+
selector: 'ng-template[sdQueryPanel]',
|
|
342
|
+
exportAs: 'sdQueryPanel',
|
|
343
|
+
standalone: true,
|
|
344
|
+
}]
|
|
345
|
+
}], 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"] }] } });
|
|
28
346
|
/**
|
|
29
|
-
*
|
|
347
|
+
* Button (or `div[role=button]`) that opens a `ɵSdQueryPanelDirective`: click, Enter, Space. Sets `aria-haspopup`,
|
|
348
|
+
* `aria-expanded` and `aria-controls`; a second activation closes the panel.
|
|
30
349
|
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
350
|
+
* Internal (`ɵ`): not part of SemVer.
|
|
351
|
+
*/
|
|
352
|
+
class ɵSdQueryPanelTriggerDirective {
|
|
353
|
+
#host = inject(ElementRef).nativeElement;
|
|
354
|
+
#pointer = false;
|
|
355
|
+
#destroyed = false;
|
|
356
|
+
panel = input(undefined, ...(ngDevMode ? [{ debugName: "panel", alias: 'sdQueryPanelTrigger' }] : [{ alias: 'sdQueryPanelTrigger' }]));
|
|
357
|
+
/** The panel is opening for this trigger — emitted before its content renders. */
|
|
358
|
+
panelOpened = output();
|
|
359
|
+
/** The panel closed for this trigger. */
|
|
360
|
+
panelClosed = output();
|
|
361
|
+
/** The panel is open for this trigger. */
|
|
362
|
+
expanded = computed(() => {
|
|
363
|
+
const panel = this.panel();
|
|
364
|
+
return !!panel && panel.isOpen() && panel.origin() === this.#host;
|
|
365
|
+
}, ...(ngDevMode ? [{ debugName: "expanded" }] : []));
|
|
366
|
+
constructor() {
|
|
367
|
+
effect(onCleanup => {
|
|
368
|
+
const panel = this.panel();
|
|
369
|
+
if (!panel)
|
|
370
|
+
return;
|
|
371
|
+
const opening = panel.ɵopening.subscribe(origin => {
|
|
372
|
+
if (origin === this.#host && !this.#destroyed)
|
|
373
|
+
this.panelOpened.emit();
|
|
374
|
+
});
|
|
375
|
+
const closing = panel.ɵclosing.subscribe(({ origin, reason }) => {
|
|
376
|
+
if (origin === this.#host && !this.#destroyed && reason !== 'detach')
|
|
377
|
+
this.panelClosed.emit(reason);
|
|
378
|
+
});
|
|
379
|
+
onCleanup(() => {
|
|
380
|
+
opening.unsubscribe();
|
|
381
|
+
closing.unsubscribe();
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
inject(DestroyRef).onDestroy(() => {
|
|
385
|
+
this.#destroyed = true;
|
|
386
|
+
if (this.expanded())
|
|
387
|
+
this.panel()?.close('detach');
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
/** Opens the panel for this trigger (no-op when already open). `returnFocusTo` gets focus back on close. */
|
|
391
|
+
openMenu(returnFocusTo) {
|
|
392
|
+
if (!this.expanded())
|
|
393
|
+
this.panel()?.open(this.#host, { keyboard: true, returnFocusTo });
|
|
394
|
+
}
|
|
395
|
+
/** Closes the panel when it is open for this trigger. */
|
|
396
|
+
closeMenu() {
|
|
397
|
+
if (this.expanded())
|
|
398
|
+
this.panel()?.close('close');
|
|
399
|
+
}
|
|
400
|
+
onPointerDown() {
|
|
401
|
+
this.#pointer = true;
|
|
402
|
+
}
|
|
403
|
+
onClick() {
|
|
404
|
+
// why: click do Enter / Space trên <button> không có pointerdown đi trước — mở bằng bàn phím.
|
|
405
|
+
const keyboard = !this.#pointer;
|
|
406
|
+
this.#pointer = false;
|
|
407
|
+
this.#toggle(keyboard);
|
|
408
|
+
}
|
|
409
|
+
onKeydown(event) {
|
|
410
|
+
// <button> đã tự biến Enter / Space thành click.
|
|
411
|
+
if (this.#host.tagName === 'BUTTON' || (event.key !== 'Enter' && event.key !== ' '))
|
|
412
|
+
return;
|
|
413
|
+
if (event.target !== this.#host)
|
|
414
|
+
return;
|
|
415
|
+
event.preventDefault();
|
|
416
|
+
this.#toggle(true);
|
|
417
|
+
}
|
|
418
|
+
#toggle(keyboard) {
|
|
419
|
+
const panel = this.panel();
|
|
420
|
+
if (!panel)
|
|
421
|
+
return;
|
|
422
|
+
if (this.expanded())
|
|
423
|
+
panel.close('close');
|
|
424
|
+
else
|
|
425
|
+
panel.open(this.#host, { keyboard });
|
|
426
|
+
}
|
|
427
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ɵSdQueryPanelTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
428
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.25", 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 });
|
|
429
|
+
}
|
|
430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ɵSdQueryPanelTriggerDirective, decorators: [{
|
|
431
|
+
type: Directive,
|
|
432
|
+
args: [{
|
|
433
|
+
selector: '[sdQueryPanelTrigger]',
|
|
434
|
+
exportAs: 'sdQueryPanelTrigger',
|
|
435
|
+
standalone: true,
|
|
436
|
+
host: {
|
|
437
|
+
class: 'sd-query-panel-trigger',
|
|
438
|
+
'[attr.aria-haspopup]': 'panel()?.role() ?? null',
|
|
439
|
+
'[attr.aria-expanded]': 'panel() ? expanded() : null',
|
|
440
|
+
'[attr.aria-controls]': 'expanded() ? panel()!.controlledId() : null',
|
|
441
|
+
'(pointerdown)': 'onPointerDown()',
|
|
442
|
+
'(click)': 'onClick()',
|
|
443
|
+
'(keydown)': 'onKeydown($event)',
|
|
444
|
+
},
|
|
445
|
+
}]
|
|
446
|
+
}], 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"] }] } });
|
|
447
|
+
|
|
448
|
+
/** localStorage key of the saved filters of `key` — unchanged since the first release, so old lists still load. */
|
|
449
|
+
const ɵsdSavedFiltersStorageKey = (key) => `sd-query-bar:savedFilters:${key}`;
|
|
450
|
+
// why: chép từ `components/table/src/services/table-query-params/table-query-params.util.ts` (ISO_DATE + reviver).
|
|
451
|
+
// query-bar không được import components/table (sai chiều phụ thuộc) và @sdcorejs/utils chưa có helper tương đương.
|
|
452
|
+
// 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.
|
|
453
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
|
454
|
+
const reviveDate = (_, value) => (typeof value === 'string' && ISO_DATE.test(value) ? new Date(value) : value);
|
|
455
|
+
const isSavedFilter = (value) => {
|
|
456
|
+
if (!value || typeof value !== 'object')
|
|
457
|
+
return false;
|
|
458
|
+
const { id, name, query } = value;
|
|
459
|
+
if (typeof id !== 'string' || !id || typeof name !== 'string' || !query || typeof query !== 'object')
|
|
460
|
+
return false;
|
|
461
|
+
return query.filters === undefined || Array.isArray(query.filters);
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Parses the stored list. Dates written by `JSON.stringify` come back as `Date`. Entries without `id`, `name` or `query`
|
|
465
|
+
* are dropped one by one instead of losing the whole list.
|
|
466
|
+
*/
|
|
467
|
+
function ɵsdReadSavedFilters(raw) {
|
|
468
|
+
if (raw === null || raw === '')
|
|
469
|
+
return { filters: [], error: false };
|
|
470
|
+
let parsed;
|
|
471
|
+
try {
|
|
472
|
+
parsed = JSON.parse(raw, reviveDate);
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
return { filters: [], error: true };
|
|
476
|
+
}
|
|
477
|
+
return Array.isArray(parsed) ? { filters: parsed.filter(isSavedFilter), error: false } : { filters: [], error: true };
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
let nextHeadingId = 0;
|
|
481
|
+
/**
|
|
482
|
+
* Saved-filters dropdown for `sd-query-bar` (handoff section 5).
|
|
35
483
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* into its own `filters` / `logic` / `search` model.
|
|
484
|
+
* Self-contained: persists the list to `localStorage` under `sd-query-bar:savedFilters:<key>` whenever the host passes
|
|
485
|
+
* a `[key]`. Without a key the trigger stays disabled.
|
|
39
486
|
*
|
|
40
|
-
* The
|
|
41
|
-
* own
|
|
487
|
+
* The host owns the live `[query]`: each save snapshots it into a new entry, each apply emits the chosen filter back via
|
|
488
|
+
* `(apply)` for the host to install into its own `filters` / `logic` / `search`. Deleting asks nothing: the toast offers
|
|
489
|
+
* Undo, which puts the filter back where it was.
|
|
42
490
|
*/
|
|
43
491
|
class SdQuerySavedFiltersMenu {
|
|
44
492
|
#i18n = inject(I18nService);
|
|
45
493
|
#confirm = inject(SdConfirmService);
|
|
494
|
+
#notify = inject(SdNotifyService);
|
|
495
|
+
#cdr = inject(ChangeDetectorRef);
|
|
46
496
|
tooltipLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.tooltip'), ...(ngDevMode ? [{ debugName: "tooltipLabel" }] : []));
|
|
47
497
|
tooltipDisabledLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.tooltip-disabled'), ...(ngDevMode ? [{ debugName: "tooltipDisabledLabel" }] : []));
|
|
48
|
-
|
|
498
|
+
headingLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.heading'), ...(ngDevMode ? [{ debugName: "headingLabel" }] : []));
|
|
49
499
|
emptyLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.empty'), ...(ngDevMode ? [{ debugName: "emptyLabel" }] : []));
|
|
500
|
+
readErrorLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.read-error'), ...(ngDevMode ? [{ debugName: "readErrorLabel" }] : []));
|
|
50
501
|
saveLabel = computed(() => this.#i18n.t('core.component.query-bar.saved-filters.save'), ...(ngDevMode ? [{ debugName: "saveLabel" }] : []));
|
|
502
|
+
headingId = `sd-query-saved-filters-heading-${nextHeadingId++}`;
|
|
51
503
|
/** Namespace key used to scope localStorage. `undefined` → menu disabled. */
|
|
52
504
|
key = input(undefined, ...(ngDevMode ? [{ debugName: "key" }] : []));
|
|
53
505
|
/** Current query the host wants to snapshot when the user clicks "Save current". */
|
|
54
506
|
query = input({ filters: [], logic: 'AND' }, ...(ngDevMode ? [{ debugName: "query" }] : []));
|
|
507
|
+
/** `false` disables "Save current filter": no chip has a value and the search box is empty. */
|
|
508
|
+
canSave = input(true, ...(ngDevMode ? [{ debugName: "canSave", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
509
|
+
/** Prefix of `data-autoid` (handoff section 12). */
|
|
510
|
+
autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
55
511
|
/** Fired when the user picks a saved filter from the list. */
|
|
56
512
|
apply = output();
|
|
57
513
|
savedFilters = signal([], ...(ngDevMode ? [{ debugName: "savedFilters" }] : []));
|
|
514
|
+
/** The stored list could not be read (broken JSON, not an array, storage blocked). Saving replaces it. */
|
|
515
|
+
readError = signal(false, ...(ngDevMode ? [{ debugName: "readError" }] : []));
|
|
516
|
+
/** Delete buttons always shown at touch size (`pointer: coarse`), read when the panel opens. */
|
|
517
|
+
coarse = signal(false, ...(ngDevMode ? [{ debugName: "coarse" }] : []));
|
|
518
|
+
panel = viewChild.required('panel');
|
|
58
519
|
#storageKey = computed(() => {
|
|
59
520
|
const k = this.key();
|
|
60
|
-
return k ?
|
|
521
|
+
return k ? ɵsdSavedFiltersStorageKey(k) : undefined;
|
|
61
522
|
}, ...(ngDevMode ? [{ debugName: "#storageKey" }] : []));
|
|
62
523
|
// why: reload whenever the namespace key changes (e.g. host switches user/context).
|
|
63
524
|
#loadFilters = effect(() => {
|
|
64
525
|
const storage = this.#storageKey();
|
|
65
526
|
if (!storage) {
|
|
66
527
|
this.savedFilters.set([]);
|
|
528
|
+
this.readError.set(false);
|
|
67
529
|
return;
|
|
68
530
|
}
|
|
531
|
+
let read;
|
|
69
532
|
try {
|
|
70
|
-
|
|
71
|
-
this.savedFilters.set(raw ? JSON.parse(raw) : []);
|
|
533
|
+
read = ɵsdReadSavedFilters(localStorage.getItem(storage));
|
|
72
534
|
}
|
|
73
535
|
catch {
|
|
74
|
-
|
|
536
|
+
// Storage bị chặn (SecurityError): như dữ liệu đọc không được.
|
|
537
|
+
read = { filters: [], error: true };
|
|
75
538
|
}
|
|
539
|
+
this.savedFilters.set(read.filters);
|
|
540
|
+
this.readError.set(read.error);
|
|
76
541
|
}, ...(ngDevMode ? [{ debugName: "#loadFilters" }] : []));
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
542
|
+
deleteLabel(name) {
|
|
543
|
+
return this.#i18n.t('core.component.query-bar.saved-filters.delete', { name });
|
|
544
|
+
}
|
|
545
|
+
autoIdOf(role) {
|
|
546
|
+
const base = this.autoId();
|
|
547
|
+
return base ? `${base}-${role}` : null;
|
|
548
|
+
}
|
|
549
|
+
/** Before the panel renders: touch devices show delete buttons without hover. */
|
|
550
|
+
onOpening() {
|
|
551
|
+
this.coarse.set(typeof window !== 'undefined' && !!window.matchMedia?.('(pointer: coarse)').matches);
|
|
87
552
|
}
|
|
88
553
|
/**
|
|
89
|
-
* Prompt for a name and append a snapshot of the current query as a new
|
|
90
|
-
* saved filter. Public so the parent toolbar can wire its external "save"
|
|
91
|
-
* button to this method without re-implementing persistence.
|
|
554
|
+
* Prompt for a name and append a snapshot of the current query as a new saved filter. The bar itself does not change.
|
|
92
555
|
*/
|
|
93
556
|
async promptSave() {
|
|
94
557
|
if (!this.#storageKey())
|
|
95
558
|
return;
|
|
96
|
-
// why: window.prompt chặn UI thread, không style/i18n được và bị vô hiệu trong vài
|
|
97
|
-
//
|
|
559
|
+
// 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) —
|
|
560
|
+
// dialog withInput dùng chung hạ tầng confirm của lib.
|
|
98
561
|
let name;
|
|
99
562
|
try {
|
|
100
563
|
name = await this.#confirm.withInput(this.#i18n.t('core.component.query-bar.saved-filters.name-label'), {
|
|
@@ -112,28 +575,145 @@ class SdQuerySavedFiltersMenu {
|
|
|
112
575
|
name: name.trim(),
|
|
113
576
|
query: this.query(),
|
|
114
577
|
};
|
|
115
|
-
|
|
116
|
-
this.savedFilters.set(next);
|
|
117
|
-
this.#persist(next);
|
|
578
|
+
this.#write([...this.savedFilters(), filter]);
|
|
118
579
|
}
|
|
119
580
|
/** Apply a saved filter — host re-installs filters/logic/search via `(apply)`. */
|
|
120
581
|
pick(filter) {
|
|
582
|
+
this.panel().close('select');
|
|
121
583
|
this.apply.emit(filter);
|
|
122
584
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
585
|
+
onSave() {
|
|
586
|
+
this.panel().close('select');
|
|
587
|
+
void this.promptSave();
|
|
588
|
+
}
|
|
589
|
+
/** Deletes the filter at `index` at once; the toast offers Undo. */
|
|
590
|
+
remove(index) {
|
|
591
|
+
const list = this.savedFilters();
|
|
592
|
+
const removed = list[index];
|
|
593
|
+
if (!removed || !this.#write(list.filter((_, i) => i !== index)))
|
|
594
|
+
return;
|
|
595
|
+
const storage = this.#storageKey();
|
|
596
|
+
this.#notify.info(removed.name, {
|
|
597
|
+
title: this.#i18n.t('core.component.query-bar.saved-filters.deleted'),
|
|
598
|
+
actionLabel: this.#i18n.t('core.component.query-bar.saved-filters.undo'),
|
|
599
|
+
onAction: () => this.#restore(removed, index, storage),
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
/** Delete from the panel: focus moves to the next row, else to "Save current filter". */
|
|
603
|
+
removeAt(index) {
|
|
604
|
+
this.remove(index);
|
|
605
|
+
this.#cdr.detectChanges();
|
|
606
|
+
const root = this.panel().element();
|
|
607
|
+
if (!root)
|
|
608
|
+
return;
|
|
609
|
+
const next = this.#applyButtons(root)[index] ??
|
|
610
|
+
root.querySelector('.c-sf-save:not(:disabled)') ??
|
|
611
|
+
this.#applyButtons(root).at(-1);
|
|
612
|
+
(next ?? root).focus();
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Arrow keys move over the apply buttons and "Save current filter" only (handoff section 5.3); → or Tab reach the
|
|
616
|
+
* delete button of the row, ← or Shift+Tab come back; Delete removes the filter of an apply button.
|
|
617
|
+
*/
|
|
618
|
+
onKeydown(event) {
|
|
619
|
+
const root = this.panel().element();
|
|
620
|
+
const target = event.target;
|
|
621
|
+
if (!root)
|
|
622
|
+
return;
|
|
623
|
+
// 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.
|
|
624
|
+
const items = Array.from(root.querySelectorAll('.c-sf-apply:not(:disabled), .c-sf-save:not(:disabled)'));
|
|
625
|
+
const row = target.closest('.c-sf-row');
|
|
626
|
+
const index = row ? Array.from(root.querySelectorAll('.c-sf-row')).indexOf(row) : -1;
|
|
627
|
+
const onApply = target.classList.contains('c-sf-apply');
|
|
628
|
+
const onDelete = target.classList.contains('c-sf-del');
|
|
629
|
+
const current = onDelete
|
|
630
|
+
? items.indexOf(row.querySelector('.c-sf-apply'))
|
|
631
|
+
: items.indexOf(target);
|
|
632
|
+
const focusItem = (position) => {
|
|
633
|
+
if (items.length)
|
|
634
|
+
items[(position + items.length) % items.length].focus();
|
|
635
|
+
};
|
|
636
|
+
switch (event.key) {
|
|
637
|
+
case 'ArrowDown':
|
|
638
|
+
focusItem(current + 1);
|
|
639
|
+
break;
|
|
640
|
+
case 'ArrowUp':
|
|
641
|
+
focusItem(current < 0 ? -1 : current - 1);
|
|
642
|
+
break;
|
|
643
|
+
case 'Home':
|
|
644
|
+
focusItem(0);
|
|
645
|
+
break;
|
|
646
|
+
case 'End':
|
|
647
|
+
focusItem(-1);
|
|
648
|
+
break;
|
|
649
|
+
case 'ArrowRight':
|
|
650
|
+
if (!onApply)
|
|
651
|
+
return;
|
|
652
|
+
row.querySelector('.c-sf-del').focus();
|
|
653
|
+
break;
|
|
654
|
+
case 'ArrowLeft':
|
|
655
|
+
if (!onDelete)
|
|
656
|
+
return;
|
|
657
|
+
row.querySelector('.c-sf-apply').focus();
|
|
658
|
+
break;
|
|
659
|
+
case 'Tab':
|
|
660
|
+
// why: Tab ra khỏi panel thì panel tự đóng; chỉ giữ lại hai bước trong cùng một hàng.
|
|
661
|
+
if (onApply && !event.shiftKey)
|
|
662
|
+
row.querySelector('.c-sf-del').focus();
|
|
663
|
+
else if (onDelete && event.shiftKey)
|
|
664
|
+
row.querySelector('.c-sf-apply').focus();
|
|
665
|
+
else
|
|
666
|
+
return;
|
|
667
|
+
break;
|
|
668
|
+
case 'Delete':
|
|
669
|
+
if (!onApply)
|
|
670
|
+
return;
|
|
671
|
+
this.removeAt(index);
|
|
672
|
+
break;
|
|
673
|
+
default:
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
event.preventDefault();
|
|
677
|
+
}
|
|
678
|
+
#applyButtons(root) {
|
|
679
|
+
return Array.from(root.querySelectorAll('.c-sf-apply'));
|
|
680
|
+
}
|
|
681
|
+
/** Undo of a delete: back at its old index, clamped to the current length. */
|
|
682
|
+
#restore(filter, index, storage) {
|
|
683
|
+
const list = this.savedFilters();
|
|
684
|
+
if (storage !== this.#storageKey() || list.some(item => item.id === filter.id))
|
|
685
|
+
return;
|
|
686
|
+
const at = Math.min(index, list.length);
|
|
687
|
+
this.#write([...list.slice(0, at), filter, ...list.slice(at)]);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Shows `next` and writes it. A failing write (quota, blocked storage) puts the previous list back and shows an error
|
|
691
|
+
* toast without the exception text.
|
|
692
|
+
*/
|
|
693
|
+
#write(next) {
|
|
694
|
+
const storage = this.#storageKey();
|
|
695
|
+
if (!storage)
|
|
696
|
+
return false;
|
|
697
|
+
const previous = this.savedFilters();
|
|
127
698
|
this.savedFilters.set(next);
|
|
128
|
-
|
|
699
|
+
try {
|
|
700
|
+
localStorage.setItem(storage, JSON.stringify(next));
|
|
701
|
+
}
|
|
702
|
+
catch {
|
|
703
|
+
this.savedFilters.set(previous);
|
|
704
|
+
this.#notify.error(this.#i18n.t('core.component.query-bar.saved-filters.write-error'));
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
this.readError.set(false);
|
|
708
|
+
return true;
|
|
129
709
|
}
|
|
130
710
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQuerySavedFiltersMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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]=\"!
|
|
711
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
132
712
|
}
|
|
133
713
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQuerySavedFiltersMenu, decorators: [{
|
|
134
714
|
type: Component,
|
|
135
|
-
args: [{ selector: 'sd-query-saved-filters-menu', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon,
|
|
136
|
-
}], 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"] }] } });
|
|
715
|
+
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"] }]
|
|
716
|
+
}], 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 }] }] } });
|
|
137
717
|
|
|
138
718
|
/**
|
|
139
719
|
* Right-pinned toolbar for `sd-query-bar`: AND/OR connector toggle, clear-all,
|
|
@@ -141,7 +721,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
141
721
|
* Search trigger. Owns no business logic — just routes user intent back via
|
|
142
722
|
* outputs (`(logic)` model, `(clear)`, `(search)`, `(applyFilter)`).
|
|
143
723
|
*
|
|
144
|
-
* The "save current query" action lives INSIDE the saved-filters
|
|
724
|
+
* The "save current query" action lives INSIDE the saved-filters panel
|
|
145
725
|
* footer (one zone for both apply + save). The dropdown trigger sits
|
|
146
726
|
* immediately before Search so the user sees one filter-cluster on the right.
|
|
147
727
|
*/
|
|
@@ -155,6 +735,10 @@ class SdQueryActionsBar {
|
|
|
155
735
|
showSavedFilters = input(false, ...(ngDevMode ? [{ debugName: "showSavedFilters", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
156
736
|
savedFiltersKey = input(undefined, ...(ngDevMode ? [{ debugName: "savedFiltersKey" }] : []));
|
|
157
737
|
query = input({ filters: [], logic: 'AND' }, ...(ngDevMode ? [{ debugName: "query" }] : []));
|
|
738
|
+
/** `false` disables "Save current filter" (nothing to save). */
|
|
739
|
+
canSaveFilter = input(true, ...(ngDevMode ? [{ debugName: "canSaveFilter" }] : []));
|
|
740
|
+
/** Prefix of `data-autoid` for the saved-filters controls. */
|
|
741
|
+
autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
158
742
|
applyFilter = output();
|
|
159
743
|
// Clear-all —
|
|
160
744
|
showClearAll = input(true, ...(ngDevMode ? [{ debugName: "showClearAll", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
@@ -186,12 +770,12 @@ class SdQueryActionsBar {
|
|
|
186
770
|
this.logic.set(value);
|
|
187
771
|
}
|
|
188
772
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryActionsBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
189
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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
|
|
773
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
190
774
|
}
|
|
191
775
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryActionsBar, decorators: [{
|
|
192
776
|
type: Component,
|
|
193
|
-
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
|
|
194
|
-
}], 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"] }] } });
|
|
777
|
+
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"] }]
|
|
778
|
+
}], 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"] }] } });
|
|
195
779
|
|
|
196
780
|
// ---------------------------------------------------------------------------
|
|
197
781
|
// Constants
|
|
@@ -264,10 +848,25 @@ const DEFAULT_OPERATOR_LIST_CACHE = new WeakMap();
|
|
|
264
848
|
* - `operators` is an array → that array (deduped against the type set is the caller's job)
|
|
265
849
|
* - otherwise (simple mode) → just the single default operator (no real choice)
|
|
266
850
|
*
|
|
851
|
+
* A `required` field never offers `NULL` / `NOT_NULL`: its value cannot be left out (handoff B3).
|
|
852
|
+
*
|
|
267
853
|
* The returned array is referentially stable for a given `field` object, so it is safe to call
|
|
268
854
|
* straight from a template binding.
|
|
269
855
|
*/
|
|
270
856
|
function sdQueryAllowedOperators(field) {
|
|
857
|
+
const operators = baseAllowedOperators(field);
|
|
858
|
+
if (!field.required || !operators.some(op => SD_QUERY_NO_DATA_OPERATORS.includes(op)))
|
|
859
|
+
return operators;
|
|
860
|
+
// 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.
|
|
861
|
+
let required = REQUIRED_OPERATOR_LIST_CACHE.get(operators);
|
|
862
|
+
if (!required) {
|
|
863
|
+
required = operators.filter(op => !SD_QUERY_NO_DATA_OPERATORS.includes(op));
|
|
864
|
+
REQUIRED_OPERATOR_LIST_CACHE.set(operators, required);
|
|
865
|
+
}
|
|
866
|
+
return required;
|
|
867
|
+
}
|
|
868
|
+
const REQUIRED_OPERATOR_LIST_CACHE = new WeakMap();
|
|
869
|
+
function baseAllowedOperators(field) {
|
|
271
870
|
if (field.operators === true)
|
|
272
871
|
return SD_QUERY_OPERATORS_BY_TYPE[field.type];
|
|
273
872
|
if (Array.isArray(field.operators) && field.operators.length > 0)
|
|
@@ -315,6 +914,8 @@ class SdQueryInlineValueChip {
|
|
|
315
914
|
autofocus = input(false, ...(ngDevMode ? [{ debugName: "autofocus" }] : []));
|
|
316
915
|
/** Pinned chip — no × segment. */
|
|
317
916
|
pinned = input(false, ...(ngDevMode ? [{ debugName: "pinned" }] : []));
|
|
917
|
+
/** Required field: `aria-required`; a value, once set, cannot be emptied (handoff B3). */
|
|
918
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
318
919
|
/** Required chip without a value — error look while not focused, `aria-invalid`. */
|
|
319
920
|
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : []));
|
|
320
921
|
/** Id set as `aria-describedby` (the host's required hint). */
|
|
@@ -339,6 +940,8 @@ class SdQueryInlineValueChip {
|
|
|
339
940
|
ph = computed(() => this.#i18n.t(this.isNumber() ? 'core.component.query-bar.placeholder.value' : 'core.component.query-bar.placeholder.text'), ...(ngDevMode ? [{ debugName: "ph" }] : []));
|
|
340
941
|
phFrom = computed(() => this.#i18n.t(this.isNumber() ? 'core.component.query-bar.placeholder.from-number' : 'core.component.query-bar.placeholder.from-text'), ...(ngDevMode ? [{ debugName: "phFrom" }] : []));
|
|
341
942
|
phTo = computed(() => this.#i18n.t(this.isNumber() ? 'core.component.query-bar.placeholder.to-number' : 'core.component.query-bar.placeholder.to-text'), ...(ngDevMode ? [{ debugName: "phTo" }] : []));
|
|
943
|
+
/** `aria-label` of the × — names the field, in the current language. */
|
|
944
|
+
removeLabel = computed(() => this.#i18n.t('core.component.query-bar.remove-filter', { label: this.field().label }), ...(ngDevMode ? [{ debugName: "removeLabel" }] : []));
|
|
342
945
|
hasValue = computed(() => {
|
|
343
946
|
if (this.isNoData())
|
|
344
947
|
return true;
|
|
@@ -393,6 +996,8 @@ class SdQueryInlineValueChip {
|
|
|
393
996
|
this.hasError.set(true);
|
|
394
997
|
return;
|
|
395
998
|
}
|
|
999
|
+
if (this.#keepsRequired(parsed.value == null || parsed.value === ''))
|
|
1000
|
+
return;
|
|
396
1001
|
this.hasError.set(false);
|
|
397
1002
|
this.valueChange.emit(parsed.value);
|
|
398
1003
|
}
|
|
@@ -405,6 +1010,9 @@ class SdQueryInlineValueChip {
|
|
|
405
1010
|
this.hasError.set(true);
|
|
406
1011
|
return;
|
|
407
1012
|
}
|
|
1013
|
+
const blank = (value) => value == null || value === '';
|
|
1014
|
+
if (this.#keepsRequired(blank(from.value) && blank(to.value)))
|
|
1015
|
+
return;
|
|
408
1016
|
this.hasError.set(false);
|
|
409
1017
|
this.valueChange.emit({ from: from.value, to: to.value });
|
|
410
1018
|
}
|
|
@@ -423,6 +1031,16 @@ class SdQueryInlineValueChip {
|
|
|
423
1031
|
this.focused.set(false);
|
|
424
1032
|
ref?.blur();
|
|
425
1033
|
}
|
|
1034
|
+
/**
|
|
1035
|
+
* B3: emptying the value of a required chip that has one gives the previous value back instead of committing.
|
|
1036
|
+
* `true` when the commit was refused.
|
|
1037
|
+
*/
|
|
1038
|
+
#keepsRequired(empty) {
|
|
1039
|
+
if (!empty || !this.required() || !this.hasValue())
|
|
1040
|
+
return false;
|
|
1041
|
+
this.revertAndBlur();
|
|
1042
|
+
return true;
|
|
1043
|
+
}
|
|
426
1044
|
onRemove(ev) {
|
|
427
1045
|
ev.stopPropagation();
|
|
428
1046
|
this.remove.emit();
|
|
@@ -463,12 +1081,12 @@ class SdQueryInlineValueChip {
|
|
|
463
1081
|
return { ok: true, value: t };
|
|
464
1082
|
}
|
|
465
1083
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryInlineValueChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
466
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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=\"
|
|
1084
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
467
1085
|
}
|
|
468
1086
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryInlineValueChip, decorators: [{
|
|
469
1087
|
type: Component,
|
|
470
|
-
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=\"
|
|
471
|
-
}], 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 }] }] } });
|
|
1088
|
+
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"] }]
|
|
1089
|
+
}], 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 }] }] } });
|
|
472
1090
|
|
|
473
1091
|
/**
|
|
474
1092
|
* Visual block for the in-progress build chip (inline mode token builder).
|
|
@@ -555,30 +1173,51 @@ class SdQueryBuildChip {
|
|
|
555
1173
|
return t === 'string' || t === 'number';
|
|
556
1174
|
}, ...(ngDevMode ? [{ debugName: "isSeamless" }] : []));
|
|
557
1175
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryBuildChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
558
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
1176
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
559
1177
|
}
|
|
560
1178
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryBuildChip, decorators: [{
|
|
561
1179
|
type: Component,
|
|
562
1180
|
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"] }]
|
|
563
1181
|
}], 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 }] }] } });
|
|
564
1182
|
|
|
1183
|
+
const hasValue$1 = (value) => value !== null && value !== undefined && value !== '';
|
|
1184
|
+
/**
|
|
1185
|
+
* A chip is "active" when it has a non-empty value OR a no-data operator (NULL / NOT_NULL). A BETWEEN range is active
|
|
1186
|
+
* when either end is set; `{ from: null, to: null }` is empty. Shared by the bar and the chip popover.
|
|
1187
|
+
*
|
|
1188
|
+
* Internal (`ɵ`): not exported from the entry point.
|
|
1189
|
+
*/
|
|
1190
|
+
function ɵsdQueryFilterActive(filter) {
|
|
1191
|
+
if (SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
1192
|
+
return true;
|
|
1193
|
+
const data = filter.data;
|
|
1194
|
+
if (data === null || data === undefined || data === '')
|
|
1195
|
+
return false;
|
|
1196
|
+
if (Array.isArray(data))
|
|
1197
|
+
return data.length > 0;
|
|
1198
|
+
if (filter.operator === 'BETWEEN' && typeof data === 'object') {
|
|
1199
|
+
const range = data;
|
|
1200
|
+
return hasValue$1(range.from) || hasValue$1(range.to);
|
|
1201
|
+
}
|
|
1202
|
+
return true;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
let nextLabelId = 0;
|
|
565
1206
|
/**
|
|
566
|
-
* Popover-mode chip editor — the
|
|
567
|
-
*
|
|
1207
|
+
* Popover-mode chip editor — the dialog panel that opens when a popover-mode chip is clicked (handoff section 4).
|
|
1208
|
+
* Owns ALL operator+value staging signals and async option loading.
|
|
568
1209
|
*
|
|
569
1210
|
* why: tách khỏi `<sd-query-bar>` để parent chỉ giữ `editingIndex` (chip nào đang
|
|
570
1211
|
* mở) + nhận `(commit)` khi popover đóng. Mỗi lần parent gọi `seed(filter, field)`
|
|
571
1212
|
* trước khi mở chip popover, child reset staging signals + kích option loading.
|
|
572
1213
|
*
|
|
573
1214
|
* Public surface (template ref `#cp`):
|
|
574
|
-
* - `cp.
|
|
575
|
-
* - `cp.seed(filter, field)` — parent reseeds staging before
|
|
576
|
-
* - `(commit)` output — emitted
|
|
577
|
-
* - `(swapField)` output — emitted when the nested field switcher picks a new field
|
|
1215
|
+
* - `cp.panel()` — the panel to feed `[panel]` of `<sd-query-popover-chip>`
|
|
1216
|
+
* - `cp.seed(filter, field, index)` — parent reseeds staging before the panel renders
|
|
1217
|
+
* - `(commit)` output — emitted when the panel closes (Esc, click outside, Tab out, close) with the staged Filter
|
|
578
1218
|
*/
|
|
579
1219
|
class SdQueryChipPopover {
|
|
580
1220
|
#i18n = inject(I18nService);
|
|
581
|
-
swapFieldTooltip = computed(() => this.#i18n.t('core.component.query-bar.swap-field'), ...(ngDevMode ? [{ debugName: "swapFieldTooltip" }] : []));
|
|
582
1221
|
fromPlaceholder = computed(() => this.#i18n.t('core.component.query-bar.placeholder.from-number'), ...(ngDevMode ? [{ debugName: "fromPlaceholder" }] : []));
|
|
583
1222
|
toPlaceholder = computed(() => this.#i18n.t('core.component.query-bar.placeholder.to-number'), ...(ngDevMode ? [{ debugName: "toPlaceholder" }] : []));
|
|
584
1223
|
booleanTrueLabel = computed(() => this.#i18n.t('core.component.query-bar.boolean.true'), ...(ngDevMode ? [{ debugName: "booleanTrueLabel" }] : []));
|
|
@@ -586,6 +1225,7 @@ class SdQueryChipPopover {
|
|
|
586
1225
|
selectValuePlaceholder = computed(() => this.#i18n.t('core.component.query-bar.placeholder.select-value'), ...(ngDevMode ? [{ debugName: "selectValuePlaceholder" }] : []));
|
|
587
1226
|
enterValuePlaceholder = computed(() => this.#i18n.t('core.component.query-bar.placeholder.enter-value'), ...(ngDevMode ? [{ debugName: "enterValuePlaceholder" }] : []));
|
|
588
1227
|
loadingValuesLabel = computed(() => this.#i18n.t('core.component.query-bar.loading-values'), ...(ngDevMode ? [{ debugName: "loadingValuesLabel" }] : []));
|
|
1228
|
+
minOneLabel = computed(() => this.#i18n.t('core.component.query-bar.required-min-one'), ...(ngDevMode ? [{ debugName: "minOneLabel" }] : []));
|
|
589
1229
|
// ---------------------------------------------------------------------------
|
|
590
1230
|
// Inputs
|
|
591
1231
|
// ---------------------------------------------------------------------------
|
|
@@ -597,17 +1237,13 @@ class SdQueryChipPopover {
|
|
|
597
1237
|
chipIndex = input(null, ...(ngDevMode ? [{ debugName: "chipIndex" }] : []));
|
|
598
1238
|
/** Prefix for `data-autoId` on inner controls. */
|
|
599
1239
|
autoIdBase = input('qb', ...(ngDevMode ? [{ debugName: "autoIdBase" }] : []));
|
|
600
|
-
/** MatMenu for the field switcher — parent passes its `<sd-query-field-picker>` menu. */
|
|
601
|
-
switchPickerMenu = input(undefined, ...(ngDevMode ? [{ debugName: "switchPickerMenu" }] : []));
|
|
602
1240
|
// ---------------------------------------------------------------------------
|
|
603
1241
|
// Outputs
|
|
604
1242
|
// ---------------------------------------------------------------------------
|
|
605
|
-
/** Emitted when
|
|
1243
|
+
/** Emitted when the panel closes — parent splices `next` into filters[idx]. */
|
|
606
1244
|
commit = output();
|
|
607
|
-
/** Emitted when nested field-switcher picks a new field — parent calls changeFilterField. */
|
|
608
|
-
swapField = output();
|
|
609
1245
|
// ---------------------------------------------------------------------------
|
|
610
|
-
// Staging signals — uncommitted edits, committed
|
|
1246
|
+
// Staging signals — uncommitted edits, committed when the panel closes.
|
|
611
1247
|
// ---------------------------------------------------------------------------
|
|
612
1248
|
/** Staged operator. */
|
|
613
1249
|
editingOperator = signal('EQUAL', ...(ngDevMode ? [{ debugName: "editingOperator" }] : []));
|
|
@@ -617,15 +1253,27 @@ class SdQueryChipPopover {
|
|
|
617
1253
|
editingOptions = signal([], ...(ngDevMode ? [{ debugName: "editingOptions" }] : []));
|
|
618
1254
|
/** Loading flag for async option fetch. */
|
|
619
1255
|
editingOptionsLoading = signal(false, ...(ngDevMode ? [{ debugName: "editingOptionsLoading" }] : []));
|
|
1256
|
+
// 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
|
|
1257
|
+
// change detection sau — giữ bản seed để lần vẽ đầu (và focus đầu tiên) đã đúng field.
|
|
1258
|
+
#seededField = signal(undefined, ...(ngDevMode ? [{ debugName: "#seededField" }] : []));
|
|
1259
|
+
#seededFilter = signal(undefined, ...(ngDevMode ? [{ debugName: "#seededFilter" }] : []));
|
|
1260
|
+
#seededIndex = signal(null, ...(ngDevMode ? [{ debugName: "#seededIndex" }] : []));
|
|
1261
|
+
/** Field being edited: the one seeded last, else the `[field]` input. */
|
|
1262
|
+
currentField = computed(() => this.#seededField() ?? this.field(), ...(ngDevMode ? [{ debugName: "currentField" }] : []));
|
|
1263
|
+
/** The field is required: no empty selection, no clear button (handoff B3). */
|
|
1264
|
+
required = computed(() => !!this.currentField()?.required, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
1265
|
+
/** "Choose at least one value." after a required multi-value chip was refused an empty selection. */
|
|
1266
|
+
minOneHint = signal(false, ...(ngDevMode ? [{ debugName: "minOneHint" }] : []));
|
|
1267
|
+
hintId = `sd-query-chip-popover-hint-${nextLabelId}`;
|
|
620
1268
|
// ---------------------------------------------------------------------------
|
|
621
1269
|
// Derived state
|
|
622
1270
|
// ---------------------------------------------------------------------------
|
|
623
1271
|
allowedOperators = computed(() => {
|
|
624
|
-
const f = this.
|
|
1272
|
+
const f = this.currentField();
|
|
625
1273
|
return f ? sdQueryAllowedOperators(f) : [];
|
|
626
1274
|
}, ...(ngDevMode ? [{ debugName: "allowedOperators" }] : []));
|
|
627
1275
|
showOperatorSelector = computed(() => {
|
|
628
|
-
const f = this.
|
|
1276
|
+
const f = this.currentField();
|
|
629
1277
|
return f ? sdQueryShowOperatorSelector(f) : false;
|
|
630
1278
|
}, ...(ngDevMode ? [{ debugName: "showOperatorSelector" }] : []));
|
|
631
1279
|
/** Whether the staged operator is multi-select (IN/NOT_IN). */
|
|
@@ -639,20 +1287,26 @@ class SdQueryChipPopover {
|
|
|
639
1287
|
/** Compose an autoId for an inner control (`<base>-chip<idx>-<role>`). */
|
|
640
1288
|
chipAutoId(role) {
|
|
641
1289
|
const base = this.autoIdBase() ?? 'qb';
|
|
642
|
-
const idx = this.chipIndex();
|
|
1290
|
+
const idx = this.#seededIndex() ?? this.chipIndex();
|
|
643
1291
|
return `${base}-chip${idx ?? 'x'}-${role}`;
|
|
644
1292
|
}
|
|
645
1293
|
iconFor = sdQueryFieldIcon;
|
|
646
1294
|
// ---------------------------------------------------------------------------
|
|
647
|
-
//
|
|
1295
|
+
// Panel — the chip trigger binds `[panel]="cp.panel()"`
|
|
648
1296
|
// ---------------------------------------------------------------------------
|
|
649
|
-
|
|
1297
|
+
panel = viewChild.required('panel');
|
|
1298
|
+
/** Id of the field label in the header — the dialog's accessible name. */
|
|
1299
|
+
labelId = `sd-query-chip-popover-label-${nextLabelId++}`;
|
|
650
1300
|
// ---------------------------------------------------------------------------
|
|
651
1301
|
// Seed — parent calls before opening the popover so staging signals are
|
|
652
1302
|
// primed from the current filter + the option list is loaded.
|
|
653
1303
|
// ---------------------------------------------------------------------------
|
|
654
|
-
/** Reseed staging from a new filter/field pair — call before
|
|
655
|
-
seed(filter, field) {
|
|
1304
|
+
/** Reseed staging from a new filter/field pair — call before the panel renders (`panelOpened`). */
|
|
1305
|
+
seed(filter, field, index = null) {
|
|
1306
|
+
this.#seededField.set(filter && field ? field : undefined);
|
|
1307
|
+
this.#seededFilter.set(filter && field ? filter : undefined);
|
|
1308
|
+
this.#seededIndex.set(filter && field ? index : null);
|
|
1309
|
+
this.minOneHint.set(false);
|
|
656
1310
|
if (!filter || !field) {
|
|
657
1311
|
this.editingOperator.set('EQUAL');
|
|
658
1312
|
this.editingValue.set(null);
|
|
@@ -702,8 +1356,16 @@ class SdQueryChipPopover {
|
|
|
702
1356
|
this.editingValue.set(Array.isArray(v) && v.length > 0 ? v[0] : null);
|
|
703
1357
|
}
|
|
704
1358
|
}
|
|
705
|
-
/**
|
|
1359
|
+
/** Value control change. A required multi-value chip keeps its values when the change would empty it (B3). */
|
|
706
1360
|
onEditingValueInput(value) {
|
|
1361
|
+
if (this.required() && Array.isArray(value) && value.length === 0) {
|
|
1362
|
+
// 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.
|
|
1363
|
+
const previous = this.editingValue();
|
|
1364
|
+
this.editingValue.set(Array.isArray(previous) ? [...previous] : previous);
|
|
1365
|
+
this.minOneHint.set(true);
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
this.minOneHint.set(false);
|
|
707
1369
|
this.editingValue.set(value);
|
|
708
1370
|
}
|
|
709
1371
|
/** BETWEEN range — mutate only `.from`. */
|
|
@@ -731,21 +1393,30 @@ class SdQueryChipPopover {
|
|
|
731
1393
|
return Array.isArray(v) && v.includes(value);
|
|
732
1394
|
}
|
|
733
1395
|
// ---------------------------------------------------------------------------
|
|
734
|
-
//
|
|
1396
|
+
// Panel lifecycle — close = commit
|
|
735
1397
|
// ---------------------------------------------------------------------------
|
|
736
1398
|
/**
|
|
737
|
-
*
|
|
738
|
-
* emit (commit). Parent splices into its filters[] and nulls editingIndex.
|
|
1399
|
+
* The panel closed (Esc, click outside, Tab out, `closeMenu()`, another panel opened): compose the next Filter from
|
|
1400
|
+
* staging signals and emit (commit). Parent splices into its filters[] and nulls editingIndex.
|
|
739
1401
|
*/
|
|
740
|
-
onMenuClosed() {
|
|
741
|
-
const f = this.filter();
|
|
1402
|
+
onMenuClosed(_reason) {
|
|
1403
|
+
const f = this.#seededFilter() ?? this.filter();
|
|
1404
|
+
const field = this.#seededField() ?? this.field();
|
|
1405
|
+
this.#seededField.set(undefined);
|
|
1406
|
+
this.#seededFilter.set(undefined);
|
|
1407
|
+
this.#seededIndex.set(null);
|
|
1408
|
+
this.minOneHint.set(false);
|
|
742
1409
|
if (!f)
|
|
743
1410
|
return;
|
|
744
|
-
|
|
1411
|
+
let next = {
|
|
745
1412
|
field: f.field,
|
|
746
1413
|
operator: this.editingOperator(),
|
|
747
1414
|
data: this.editingValue(),
|
|
748
1415
|
};
|
|
1416
|
+
// B3: a required chip that had a value and was emptied gets that value (and operator) back.
|
|
1417
|
+
if (field?.required && ɵsdQueryFilterActive(f) && !ɵsdQueryFilterActive(next)) {
|
|
1418
|
+
next = { field: f.field, operator: f.operator, data: f.data };
|
|
1419
|
+
}
|
|
749
1420
|
this.commit.emit(next);
|
|
750
1421
|
}
|
|
751
1422
|
// ---------------------------------------------------------------------------
|
|
@@ -791,16 +1462,15 @@ class SdQueryChipPopover {
|
|
|
791
1462
|
}
|
|
792
1463
|
}
|
|
793
1464
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryChipPopover, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
794
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
1465
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
795
1466
|
}
|
|
796
1467
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryChipPopover, decorators: [{
|
|
797
1468
|
type: Component,
|
|
798
1469
|
args: [{ selector: 'sd-query-chip-popover', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1470
|
+
ɵSdQueryPanelDirective,
|
|
799
1471
|
SdIcon,
|
|
800
1472
|
CommonModule,
|
|
801
1473
|
FormsModule,
|
|
802
|
-
MatMenuModule,
|
|
803
|
-
MatTooltipModule,
|
|
804
1474
|
SdButton,
|
|
805
1475
|
SdOperator,
|
|
806
1476
|
SdSelect,
|
|
@@ -808,51 +1478,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
808
1478
|
SdInputNumber,
|
|
809
1479
|
SdDate,
|
|
810
1480
|
SdDatetime,
|
|
811
|
-
], 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"] }]
|
|
812
|
-
}], 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 }] }],
|
|
1481
|
+
], 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"] }]
|
|
1482
|
+
}], 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 }] }] } });
|
|
813
1483
|
|
|
814
|
-
/**
|
|
815
|
-
const
|
|
816
|
-
|
|
817
|
-
const MENU_KEYS = new Set(['Escape', 'ArrowDown', 'ArrowUp', 'Tab']);
|
|
1484
|
+
/** From this many fields the picker gets a find box at the top (PD after R1, G-2). */
|
|
1485
|
+
const FIND_MIN_FIELDS = 10;
|
|
1486
|
+
let nextListId = 0;
|
|
818
1487
|
/**
|
|
819
|
-
* Field picker
|
|
1488
|
+
* Field picker of `sd-query-bar`: a listbox panel (handoff section 3). The "+" button opens it with
|
|
1489
|
+
* `[sdQueryPanelTrigger]="picker.panel()"`; the chosen field comes back through `(pick)`. Fields in `[usedKeys]`
|
|
1490
|
+
* render disabled with a check.
|
|
820
1491
|
*
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
* those entries render disabled with a check.
|
|
824
|
-
* - "Đổi field" inside the chip popover — pass `[currentKey]` to disable the
|
|
825
|
-
* currently-bound field.
|
|
826
|
-
*
|
|
827
|
-
* Parent triggers via `[matMenuTriggerFor]="picker.menu()"` and receives the
|
|
828
|
-
* chosen field through `(pick)`.
|
|
1492
|
+
* Keyboard: without a find box focus moves over the options (↑ ↓ Home End, Enter picks). With the find box focus stays
|
|
1493
|
+
* in it and the arrows move `aria-activedescendant` (combobox). No typeahead.
|
|
829
1494
|
*/
|
|
830
1495
|
class SdQueryFieldPicker {
|
|
831
1496
|
#i18n = inject(I18nService);
|
|
832
|
-
#injector = inject(Injector);
|
|
833
1497
|
emptyLabel = computed(() => this.#i18n.t('core.component.query-bar.field-empty'), ...(ngDevMode ? [{ debugName: "emptyLabel" }] : []));
|
|
834
1498
|
findLabel = computed(() => this.#i18n.t('core.component.query-bar.find-field'), ...(ngDevMode ? [{ debugName: "findLabel" }] : []));
|
|
835
|
-
/**
|
|
1499
|
+
/**
|
|
1500
|
+
* Name of the listbox: the label of what opens it — the + button in popover mode, the Add condition box inline. The
|
|
1501
|
+
* find box label is a command ("Tìm kiếm"), not a name for the list.
|
|
1502
|
+
*/
|
|
1503
|
+
listLabel = computed(() => this.#i18n.t(this.findBox() ? 'core.component.query-bar.add-filter' : 'core.component.query-bar.add-condition'), ...(ngDevMode ? [{ debugName: "listLabel" }] : []));
|
|
1504
|
+
/** Field list shown in the panel (caller-supplied; rendered in input order). */
|
|
836
1505
|
fields = input([], ...(ngDevMode ? [{ debugName: "fields" }] : []));
|
|
837
|
-
/**
|
|
838
|
-
currentKey = input(undefined, ...(ngDevMode ? [{ debugName: "currentKey" }] : []));
|
|
839
|
-
/** Set of keys already in use — used in the "Add filter" flow to grey out duplicates. */
|
|
1506
|
+
/** Set of keys already in use — those render disabled with a check. */
|
|
840
1507
|
usedKeys = input(new Set(), ...(ngDevMode ? [{ debugName: "usedKeys" }] : []));
|
|
1508
|
+
/** Prefix of `data-autoid` (handoff section 12). */
|
|
1509
|
+
autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
1510
|
+
/**
|
|
1511
|
+
* `false`: no find box in the panel — an input outside (the inline "Add condition" combobox) types the filter through
|
|
1512
|
+
* `setQuery()` and moves the active option.
|
|
1513
|
+
*/
|
|
1514
|
+
findBox = input(true, ...(ngDevMode ? [{ debugName: "findBox" }] : []));
|
|
841
1515
|
/** Emits when the user picks an enabled field. */
|
|
842
1516
|
pick = output();
|
|
843
|
-
/**
|
|
844
|
-
|
|
1517
|
+
/** The panel closed. */
|
|
1518
|
+
closed = output();
|
|
1519
|
+
/** The panel — the trigger binds `[sdQueryPanelTrigger]="picker.panel()"`. */
|
|
1520
|
+
panel = viewChild.required('panel');
|
|
845
1521
|
iconFor = sdQueryFieldIcon;
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
// ---------------------------------------------------------------------------
|
|
849
|
-
/** Text typed in the find box; reset when the menu closes. */
|
|
1522
|
+
listId = `sd-query-field-list-${nextListId++}`;
|
|
1523
|
+
/** Text typed in the find box; reset when the panel closes. */
|
|
850
1524
|
query = signal('', ...(ngDevMode ? [{ debugName: "query" }] : []));
|
|
851
|
-
/**
|
|
852
|
-
|
|
1525
|
+
/** Key of the option the arrows point at (`aria-activedescendant` / roving focus). */
|
|
1526
|
+
activeKey = signal(null, ...(ngDevMode ? [{ debugName: "activeKey" }] : []));
|
|
1527
|
+
/** Find box from ten fields (not when an outside input types the filter). */
|
|
1528
|
+
searchable = computed(() => this.findBox() && this.fields().length >= FIND_MIN_FIELDS, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
1529
|
+
/** The list follows the typed text: with the find box, or with the outside combobox. */
|
|
1530
|
+
#filterable = computed(() => this.searchable() || !this.findBox(), ...(ngDevMode ? [{ debugName: "#filterable" }] : []));
|
|
853
1531
|
/** Fields grouped by `field.group` in order of first appearance, filtered by the find box. */
|
|
854
1532
|
groups = computed(() => {
|
|
855
|
-
const term = this
|
|
1533
|
+
const term = this.#filterable() ? sdNormalizeSearchText(this.query().trim()) : '';
|
|
856
1534
|
const groups = [];
|
|
857
1535
|
const byLabel = new Map();
|
|
858
1536
|
for (const field of this.fields()) {
|
|
@@ -861,7 +1539,7 @@ class SdQueryFieldPicker {
|
|
|
861
1539
|
const label = field.group ?? '';
|
|
862
1540
|
let group = byLabel.get(label);
|
|
863
1541
|
if (!group) {
|
|
864
|
-
group = { label, fields: [] };
|
|
1542
|
+
group = { label, headingId: `${this.listId}-group-${groups.length}`, fields: [] };
|
|
865
1543
|
byLabel.set(label, group);
|
|
866
1544
|
groups.push(group);
|
|
867
1545
|
}
|
|
@@ -871,47 +1549,126 @@ class SdQueryFieldPicker {
|
|
|
871
1549
|
}, ...(ngDevMode ? [{ debugName: "groups" }] : []));
|
|
872
1550
|
/** One group needs no heading. Counted on the whole list so filtering does not hide headings. */
|
|
873
1551
|
showGroupHeadings = computed(() => new Set(this.fields().map(field => field.group ?? '')).size > 1, ...(ngDevMode ? [{ debugName: "showGroupHeadings" }] : []));
|
|
874
|
-
|
|
1552
|
+
/** Visible fields in order, with the id of their option element. */
|
|
1553
|
+
#visible = computed(() => {
|
|
1554
|
+
const ids = new Map();
|
|
1555
|
+
const list = this.groups().flatMap(group => group.fields);
|
|
1556
|
+
list.forEach((field, index) => ids.set(field.key, `${this.listId}-option-${index}`));
|
|
1557
|
+
return { list, ids };
|
|
1558
|
+
}, ...(ngDevMode ? [{ debugName: "#visible" }] : []));
|
|
1559
|
+
/** Id of the active option, for `aria-activedescendant`. */
|
|
1560
|
+
activeId = computed(() => {
|
|
1561
|
+
const key = this.activeKey();
|
|
1562
|
+
return key === null ? null : (this.#visible().ids.get(key) ?? null);
|
|
1563
|
+
}, ...(ngDevMode ? [{ debugName: "activeId" }] : []));
|
|
1564
|
+
optionId(field) {
|
|
1565
|
+
return this.#visible().ids.get(field.key) ?? '';
|
|
1566
|
+
}
|
|
1567
|
+
isDisabled(field) {
|
|
1568
|
+
return field.disabled === true || this.usedKeys().has(field.key);
|
|
1569
|
+
}
|
|
1570
|
+
/** "Used" check icon — when the field is in `usedKeys`. */
|
|
1571
|
+
isUsed(field) {
|
|
1572
|
+
return this.usedKeys().has(field.key);
|
|
1573
|
+
}
|
|
1574
|
+
/** Find box typed: filter, then point at the first enabled match (none while the box is empty). */
|
|
1575
|
+
setQuery(text) {
|
|
1576
|
+
this.query.set(text);
|
|
1577
|
+
this.activeKey.set(text.trim() ? (this.#enabled()[0]?.key ?? null) : null);
|
|
1578
|
+
}
|
|
875
1579
|
/**
|
|
876
|
-
*
|
|
877
|
-
*
|
|
1580
|
+
* Moves the active option over the enabled ones, wrapping: `1` / `-1`, or `'first'` / `'last'`. With `focus`, the
|
|
1581
|
+
* option also takes focus (no find box).
|
|
878
1582
|
*/
|
|
879
|
-
|
|
880
|
-
|
|
1583
|
+
move(step, focus = false) {
|
|
1584
|
+
const enabled = this.#enabled();
|
|
1585
|
+
if (!enabled.length)
|
|
881
1586
|
return;
|
|
882
|
-
|
|
1587
|
+
const current = enabled.findIndex(field => field.key === this.activeKey());
|
|
1588
|
+
let index;
|
|
1589
|
+
if (step === 'first')
|
|
1590
|
+
index = 0;
|
|
1591
|
+
else if (step === 'last')
|
|
1592
|
+
index = enabled.length - 1;
|
|
1593
|
+
else if (current < 0)
|
|
1594
|
+
index = step > 0 ? 0 : enabled.length - 1;
|
|
1595
|
+
else
|
|
1596
|
+
index = (current + step + enabled.length) % enabled.length;
|
|
1597
|
+
const key = enabled[index].key;
|
|
1598
|
+
this.activeKey.set(key);
|
|
1599
|
+
if (focus)
|
|
1600
|
+
this.panel()
|
|
1601
|
+
.element()
|
|
1602
|
+
?.querySelector(`#${CSS.escape(this.#visible().ids.get(key) ?? '')}`)
|
|
1603
|
+
?.focus();
|
|
1604
|
+
}
|
|
1605
|
+
/** Picks the active option; `false` when there is none. */
|
|
1606
|
+
pickActive() {
|
|
1607
|
+
const field = this.#enabled().find(item => item.key === this.activeKey());
|
|
1608
|
+
if (!field)
|
|
1609
|
+
return false;
|
|
1610
|
+
this.select(field);
|
|
1611
|
+
return true;
|
|
883
1612
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1613
|
+
/** Picks `field` unless it is disabled: the panel closes first, then `(pick)` fires. */
|
|
1614
|
+
select(field) {
|
|
1615
|
+
if (this.isDisabled(field))
|
|
1616
|
+
return;
|
|
1617
|
+
this.panel().close('select');
|
|
1618
|
+
this.pick.emit(field);
|
|
1619
|
+
}
|
|
1620
|
+
/** Keys inside the panel (find box or an option). */
|
|
1621
|
+
onKeydown(event) {
|
|
1622
|
+
const inFind = event.target.tagName === 'INPUT';
|
|
1623
|
+
switch (event.key) {
|
|
1624
|
+
case 'ArrowDown':
|
|
1625
|
+
this.move(1, !inFind);
|
|
1626
|
+
break;
|
|
1627
|
+
case 'ArrowUp':
|
|
1628
|
+
this.move(-1, !inFind);
|
|
1629
|
+
break;
|
|
1630
|
+
case 'Home':
|
|
1631
|
+
case 'End':
|
|
1632
|
+
// In the find box Home / End move the caret.
|
|
1633
|
+
if (inFind)
|
|
1634
|
+
return;
|
|
1635
|
+
this.move(event.key === 'Home' ? 'first' : 'last', true);
|
|
1636
|
+
break;
|
|
1637
|
+
case 'Enter':
|
|
1638
|
+
if (inFind)
|
|
1639
|
+
this.pickActive();
|
|
1640
|
+
else {
|
|
1641
|
+
const field = this.#visible().list.find(item => this.optionId(item) === event.target.id);
|
|
1642
|
+
if (field)
|
|
1643
|
+
this.select(field);
|
|
1644
|
+
}
|
|
1645
|
+
break;
|
|
1646
|
+
default:
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
event.preventDefault();
|
|
887
1650
|
}
|
|
888
|
-
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const cur = this.currentKey();
|
|
892
|
-
if (cur)
|
|
893
|
-
set.add(cur);
|
|
894
|
-
return set;
|
|
895
|
-
}, ...(ngDevMode ? [{ debugName: "disabledMap" }] : []));
|
|
896
|
-
isDisabled(field) {
|
|
897
|
-
return field.disabled === true || this.disabledMap().has(field.key);
|
|
1651
|
+
/** An option took focus (roving focus, or a click): it becomes the active one. */
|
|
1652
|
+
onOptionFocus(field) {
|
|
1653
|
+
this.activeKey.set(field.key);
|
|
898
1654
|
}
|
|
899
|
-
/**
|
|
900
|
-
|
|
901
|
-
|
|
1655
|
+
/** Panel closed: forget the find text and the active option. */
|
|
1656
|
+
reset() {
|
|
1657
|
+
this.query.set('');
|
|
1658
|
+
this.activeKey.set(null);
|
|
902
1659
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
return this.usedKeys().has(field.key);
|
|
1660
|
+
#enabled() {
|
|
1661
|
+
return this.#visible().list.filter(field => !this.isDisabled(field));
|
|
906
1662
|
}
|
|
907
1663
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryFieldPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
908
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdQueryFieldPicker, isStandalone: true, selector: "sd-query-field-picker", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null },
|
|
1664
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
909
1665
|
}
|
|
910
1666
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryFieldPicker, decorators: [{
|
|
911
1667
|
type: Component,
|
|
912
|
-
args: [{ selector: 'sd-query-field-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon,
|
|
913
|
-
}], propDecorators: { fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }],
|
|
1668
|
+
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"] }]
|
|
1669
|
+
}], 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 }] }] } });
|
|
914
1670
|
|
|
1671
|
+
let nextHintId = 0;
|
|
915
1672
|
/**
|
|
916
1673
|
* Completed inline chip (non-string/number — those use `<sd-query-inline-value-chip>`).
|
|
917
1674
|
*
|
|
@@ -934,6 +1691,8 @@ class SdQueryInlineChip {
|
|
|
934
1691
|
// và với build chip, nếu không cùng một field sẽ hiện hai ngôn ngữ tuỳ chỗ.
|
|
935
1692
|
booleanTrueLabel = computed(() => this.#i18n.t('core.component.query-bar.boolean.true'), ...(ngDevMode ? [{ debugName: "booleanTrueLabel" }] : []));
|
|
936
1693
|
booleanFalseLabel = computed(() => this.#i18n.t('core.component.query-bar.boolean.false'), ...(ngDevMode ? [{ debugName: "booleanFalseLabel" }] : []));
|
|
1694
|
+
/** `aria-label` of the × — names the field, in the current language. */
|
|
1695
|
+
removeLabel = computed(() => this.#i18n.t('core.component.query-bar.remove-filter', { label: this.field().label }), ...(ngDevMode ? [{ debugName: "removeLabel" }] : []));
|
|
937
1696
|
// ---------------------------------------------------------------------------
|
|
938
1697
|
// Inputs
|
|
939
1698
|
// ---------------------------------------------------------------------------
|
|
@@ -955,6 +1714,8 @@ class SdQueryInlineChip {
|
|
|
955
1714
|
isNoData = input(false, ...(ngDevMode ? [{ debugName: "isNoData" }] : []));
|
|
956
1715
|
/** Pinned chip — no × button. */
|
|
957
1716
|
pinned = input(false, ...(ngDevMode ? [{ debugName: "pinned" }] : []));
|
|
1717
|
+
/** Required field: `aria-required`, no empty selection (handoff B3). */
|
|
1718
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
958
1719
|
/** Required chip without a value — error look, `aria-invalid`. */
|
|
959
1720
|
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : []));
|
|
960
1721
|
/** Id set as `aria-describedby` (the host's required hint). */
|
|
@@ -988,6 +1749,21 @@ class SdQueryInlineChip {
|
|
|
988
1749
|
operator = computed(() => this.filter().operator, ...(ngDevMode ? [{ debugName: "operator" }] : []));
|
|
989
1750
|
/** Data payload — convenience accessor for template. */
|
|
990
1751
|
data = computed(() => this.filter().data, ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
1752
|
+
/**
|
|
1753
|
+
* Model handed to the select. Follows `data`, and is reset to a copy of it when a required chip refuses an empty
|
|
1754
|
+
* selection — the new reference makes sd-select drop the deselection it already shows.
|
|
1755
|
+
*/
|
|
1756
|
+
selectModel = linkedSignal(() => this.data(), ...(ngDevMode ? [{ debugName: "selectModel" }] : []));
|
|
1757
|
+
/** "Choose at least one value." under a required multi-value chip that was just refused an empty selection. */
|
|
1758
|
+
minOneHint = signal(false, ...(ngDevMode ? [{ debugName: "minOneHint" }] : []));
|
|
1759
|
+
minOneLabel = computed(() => this.#i18n.t('core.component.query-bar.required-min-one'), ...(ngDevMode ? [{ debugName: "minOneLabel" }] : []));
|
|
1760
|
+
hintId = `sd-query-inline-chip-hint-${nextHintId++}`;
|
|
1761
|
+
/** `aria-describedby` of the chip: the host's required hint and, while shown, the min-one line. */
|
|
1762
|
+
describedByIds = computed(() => [this.describedBy(), this.minOneHint() ? this.hintId : undefined].filter(Boolean).join(' ') || null, ...(ngDevMode ? [{ debugName: "describedByIds" }] : []));
|
|
1763
|
+
/** Date, date-time and date-range controls — a refused empty value is written back into them (B3). */
|
|
1764
|
+
dateControl = viewChild(SdDate, ...(ngDevMode ? [{ debugName: "dateControl" }] : []));
|
|
1765
|
+
datetimeControl = viewChild(SdDatetime, ...(ngDevMode ? [{ debugName: "datetimeControl" }] : []));
|
|
1766
|
+
dateRangeControl = viewChild(SdDateRange, ...(ngDevMode ? [{ debugName: "dateRangeControl" }] : []));
|
|
991
1767
|
// ---------------------------------------------------------------------------
|
|
992
1768
|
// Edit lifecycle
|
|
993
1769
|
// ---------------------------------------------------------------------------
|
|
@@ -1006,14 +1782,42 @@ class SdQueryInlineChip {
|
|
|
1006
1782
|
* forwards the value; it no longer toggles `#editing` (that's boolean-only now).
|
|
1007
1783
|
*/
|
|
1008
1784
|
emitSingleCommit(v) {
|
|
1785
|
+
if (this.#keepsRequired(v))
|
|
1786
|
+
return;
|
|
1009
1787
|
this.commit.emit(v);
|
|
1010
1788
|
}
|
|
1011
1789
|
/** BETWEEN commit — sd-date-range (viewed='inline') emits `{from, to}`; chip just forwards it. */
|
|
1012
1790
|
emitRangeCommit(ev) {
|
|
1791
|
+
if (this.#keepsRequired(ev ?? { from: null, to: null }))
|
|
1792
|
+
return;
|
|
1013
1793
|
this.commitRange.emit(ev ?? null);
|
|
1014
1794
|
}
|
|
1795
|
+
/**
|
|
1796
|
+
* B3: a required chip that has a value refuses an empty date, date-time or range — nothing is emitted and the control
|
|
1797
|
+
* shows the previous value again. `true` when refused.
|
|
1798
|
+
*/
|
|
1799
|
+
#keepsRequired(next) {
|
|
1800
|
+
const filter = this.filter();
|
|
1801
|
+
if (!this.required() || !ɵsdQueryFilterActive(filter) || ɵsdQueryFilterActive({ ...filter, data: next }))
|
|
1802
|
+
return false;
|
|
1803
|
+
// 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 —
|
|
1804
|
+
// ghi thẳng giá trị trước vào model của control.
|
|
1805
|
+
const previous = this.data();
|
|
1806
|
+
this.dateControl()?.valueModel.set(previous);
|
|
1807
|
+
this.datetimeControl()?.valueModel.set(previous);
|
|
1808
|
+
this.dateRangeControl()?.valueModel.set(previous);
|
|
1809
|
+
return true;
|
|
1810
|
+
}
|
|
1015
1811
|
/** Multi-select live emit (sd-select inline). */
|
|
1016
1812
|
emitLive(v) {
|
|
1813
|
+
if (this.required() && Array.isArray(v) && v.length === 0) {
|
|
1814
|
+
// B3: keep the previous values of a required chip and say why.
|
|
1815
|
+
const previous = this.data();
|
|
1816
|
+
this.selectModel.set(Array.isArray(previous) ? [...previous] : previous);
|
|
1817
|
+
this.minOneHint.set(true);
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
this.minOneHint.set(false);
|
|
1017
1821
|
this.liveChange.emit(v);
|
|
1018
1822
|
}
|
|
1019
1823
|
/** Boolean toggle commit — exits edit. */
|
|
@@ -1022,17 +1826,17 @@ class SdQueryInlineChip {
|
|
|
1022
1826
|
this.#editing.set(false);
|
|
1023
1827
|
}
|
|
1024
1828
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryInlineChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1025
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
1829
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
1026
1830
|
}
|
|
1027
1831
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryInlineChip, decorators: [{
|
|
1028
1832
|
type: Component,
|
|
1029
|
-
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"] }]
|
|
1030
|
-
}], 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"] }] } });
|
|
1833
|
+
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"] }]
|
|
1834
|
+
}], 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 }] }] } });
|
|
1031
1835
|
|
|
1032
1836
|
/**
|
|
1033
|
-
* Compact popover-mode chip face. Click → opens the parent-supplied [
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1837
|
+
* Compact popover-mode chip face. Click, Enter or Space → opens the parent-supplied [panel] (the chip popover dialog).
|
|
1838
|
+
* Inert div[role=button] so the nested <sd-operator> doesn't end up as a button-in-button (invalid HTML).
|
|
1839
|
+
* The × is a `<button>` beside that trigger, never inside it.
|
|
1036
1840
|
*/
|
|
1037
1841
|
class SdQueryPopoverChip {
|
|
1038
1842
|
/** Resolved field (from the bar's `fieldByKey()` map). `undefined` → render raw key. */
|
|
@@ -1051,58 +1855,56 @@ class SdQueryPopoverChip {
|
|
|
1051
1855
|
pinned = input(false, ...(ngDevMode ? [{ debugName: "pinned" }] : []));
|
|
1052
1856
|
/** Read-only chip — does not open its popover. */
|
|
1053
1857
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
1858
|
+
/** Chip of a required field — `aria-required`. */
|
|
1859
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
1054
1860
|
/** Required chip without a value — error look, `aria-invalid`. */
|
|
1055
1861
|
invalid = input(false, ...(ngDevMode ? [{ debugName: "invalid" }] : []));
|
|
1056
1862
|
/** Id set as `aria-describedby` (the host's required hint). */
|
|
1057
1863
|
describedBy = input(undefined, ...(ngDevMode ? [{ debugName: "describedBy" }] : []));
|
|
1058
|
-
/** Chip popover
|
|
1059
|
-
|
|
1060
|
-
/** Fired when the chip popover opens (parent seeds its editing state). */
|
|
1864
|
+
/** Chip popover panel supplied by the parent. */
|
|
1865
|
+
panel = input.required(...(ngDevMode ? [{ debugName: "panel" }] : []));
|
|
1866
|
+
/** Fired when the chip popover opens, before it renders (parent seeds its editing state). */
|
|
1061
1867
|
open = output();
|
|
1062
1868
|
/** Fired when the user clicks the × removal icon. */
|
|
1063
1869
|
remove = output();
|
|
1064
1870
|
iconFor = sdQueryFieldIcon;
|
|
1871
|
+
#i18n = inject(I18nService);
|
|
1872
|
+
/** `aria-label` of the × — names the field, in the current language. */
|
|
1873
|
+
removeLabel = computed(() => this.#i18n.t('core.component.query-bar.remove-filter', { label: this.field()?.label || this.filterField() }), ...(ngDevMode ? [{ debugName: "removeLabel" }] : []));
|
|
1065
1874
|
filterField() {
|
|
1066
1875
|
return this.filter().field;
|
|
1067
1876
|
}
|
|
1068
1877
|
filterOperator() {
|
|
1069
1878
|
return this.filter().operator;
|
|
1070
1879
|
}
|
|
1071
|
-
// why: parent's add
|
|
1072
|
-
//
|
|
1073
|
-
|
|
1074
|
-
|
|
1880
|
+
// why: parent's add flow auto-opens the chip popover after render, and removeFilter closes the open one — expose
|
|
1881
|
+
// open/close so the parent doesn't need a ViewChild on the internal panel trigger.
|
|
1882
|
+
trigger = viewChild('chipTrigger', ...(ngDevMode ? [{ debugName: "trigger", read: ɵSdQueryPanelTriggerDirective }] : [{ read: ɵSdQueryPanelTriggerDirective }]));
|
|
1883
|
+
/** The chip popover is open for this chip. */
|
|
1884
|
+
isOpen() {
|
|
1885
|
+
return !!this.trigger()?.expanded();
|
|
1886
|
+
}
|
|
1075
1887
|
/**
|
|
1076
1888
|
* Opens the chip popover. With `returnFocusTo`, that element (e.g. the host control that asked
|
|
1077
1889
|
* for the chip) gets focus back when the popover closes, instead of the chip.
|
|
1078
1890
|
*/
|
|
1079
1891
|
openMenu(returnFocusTo) {
|
|
1080
|
-
|
|
1081
|
-
if (!trigger)
|
|
1082
|
-
return;
|
|
1083
|
-
if (returnFocusTo) {
|
|
1084
|
-
trigger.restoreFocus = false;
|
|
1085
|
-
trigger.menuClosed.pipe(take(1)).subscribe(() => {
|
|
1086
|
-
trigger.restoreFocus = true;
|
|
1087
|
-
returnFocusTo.focus();
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
trigger.openMenu();
|
|
1892
|
+
this.trigger()?.openMenu(returnFocusTo);
|
|
1091
1893
|
}
|
|
1092
1894
|
closeMenu() {
|
|
1093
1895
|
this.trigger()?.closeMenu();
|
|
1094
1896
|
}
|
|
1095
1897
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryPopoverChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1096
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 },
|
|
1898
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
1097
1899
|
}
|
|
1098
1900
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryPopoverChip, decorators: [{
|
|
1099
1901
|
type: Component,
|
|
1100
|
-
args: [{ selector: 'sd-query-popover-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon,
|
|
1101
|
-
}], 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 }] }],
|
|
1902
|
+
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"] }]
|
|
1903
|
+
}], 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 }] }] } });
|
|
1102
1904
|
|
|
1103
1905
|
const DATE_FORMAT = 'dd/MM/yyyy';
|
|
1104
1906
|
const DATETIME_FORMAT = 'dd/MM/yyyy HH:mm';
|
|
1105
|
-
const hasValue
|
|
1907
|
+
const hasValue = (value) => value !== null && value !== undefined && value !== '';
|
|
1106
1908
|
/**
|
|
1107
1909
|
* Value text of a chip, shared by the query bar and the sd-table phone filters so both show the same string:
|
|
1108
1910
|
* one value → its label; several → `first +n`; a date range in one year → `01/10 – 31/10/2026`; one open end →
|
|
@@ -1127,8 +1929,8 @@ const ɵsdQueryChipValueText = (filter, field, context) => {
|
|
|
1127
1929
|
};
|
|
1128
1930
|
/** `01/10 – 31/10/2026` inside one year, `From …` / `To …` when one end is open. */
|
|
1129
1931
|
const rangeText = (field, range, context) => {
|
|
1130
|
-
const hasFrom = hasValue
|
|
1131
|
-
const hasTo = hasValue
|
|
1932
|
+
const hasFrom = hasValue(range.from);
|
|
1933
|
+
const hasTo = hasValue(range.to);
|
|
1132
1934
|
if (field?.type === 'date' && hasFrom && hasTo) {
|
|
1133
1935
|
const year = context.toFormat(range.from, 'yyyy');
|
|
1134
1936
|
if (year && year === context.toFormat(range.to, 'yyyy')) {
|
|
@@ -1199,7 +2001,7 @@ class ɵSdQueryChipLabels {
|
|
|
1199
2001
|
if (field?.type !== 'values' && field?.type !== 'lazy-values')
|
|
1200
2002
|
return;
|
|
1201
2003
|
const data = filter.data;
|
|
1202
|
-
const values = Array.isArray(data) ? data : hasValue
|
|
2004
|
+
const values = Array.isArray(data) ? data : hasValue(data) ? [data] : [];
|
|
1203
2005
|
if (!values.length)
|
|
1204
2006
|
return;
|
|
1205
2007
|
const key = field.key;
|
|
@@ -1261,7 +2063,6 @@ const stringify = (value) => {
|
|
|
1261
2063
|
|
|
1262
2064
|
/** Shared empty array — stable reference so template bindings don't churn change detection. */
|
|
1263
2065
|
const EMPTY_ARRAY = [];
|
|
1264
|
-
const hasValue = (value) => value !== null && value !== undefined && value !== '';
|
|
1265
2066
|
class SdQueryBar {
|
|
1266
2067
|
#i18n = inject(I18nService);
|
|
1267
2068
|
#injector = inject(Injector);
|
|
@@ -1321,7 +2122,7 @@ class SdQueryBar {
|
|
|
1321
2122
|
/**
|
|
1322
2123
|
* Editing mode:
|
|
1323
2124
|
* - `'popover'` (default) → compact chips; click a chip to edit operator + value in a
|
|
1324
|
-
*
|
|
2125
|
+
* popover panel; the value is committed when the popover closes.
|
|
1325
2126
|
* - `'inline'` → GitLab-style. Each filter's operator + value controls render directly
|
|
1326
2127
|
* on the bar (no popup, no per-filter apply). Edits update `filters` live; the user
|
|
1327
2128
|
* presses the search button (or Enter) once to fire `(apply)`.
|
|
@@ -1347,9 +2148,30 @@ class SdQueryBar {
|
|
|
1347
2148
|
* saving a filter captures live filters/logic/search.
|
|
1348
2149
|
*/
|
|
1349
2150
|
currentQuery = computed(() => this.#buildQuery(), ...(ngDevMode ? [{ debugName: "currentQuery" }] : []));
|
|
1350
|
-
/**
|
|
2151
|
+
/**
|
|
2152
|
+
* Receive an applied filter from the saved-filters menu — re-install bar state + trigger apply (handoff B4). Entries of
|
|
2153
|
+
* fields the bar no longer has, or of disabled fields, are dropped. A required or pinned field takes the saved chip
|
|
2154
|
+
* only when it has a value; otherwise its current chip (operator included) stays. Required and pinned chips come
|
|
2155
|
+
* first, in field order.
|
|
2156
|
+
*/
|
|
1351
2157
|
onApplyFilter(saved) {
|
|
1352
|
-
this.
|
|
2158
|
+
const fields = this.fieldByKey();
|
|
2159
|
+
const keyOf = (filter) => ('field' in filter ? filter.field : '');
|
|
2160
|
+
const usable = (saved.query.filters ?? []).filter(filter => {
|
|
2161
|
+
const field = fields[keyOf(filter)];
|
|
2162
|
+
return !!field && !field.disabled;
|
|
2163
|
+
});
|
|
2164
|
+
const current = this.filters();
|
|
2165
|
+
const locked = [];
|
|
2166
|
+
for (const field of this.resolvedFields()) {
|
|
2167
|
+
if (!this.isLocked(field))
|
|
2168
|
+
continue;
|
|
2169
|
+
const key = field.key;
|
|
2170
|
+
const fromSaved = usable.find(filter => keyOf(filter) === key && this.isFilterActive(filter));
|
|
2171
|
+
locked.push(fromSaved ?? current.find(filter => keyOf(filter) === key) ?? this.#emptyChip(field));
|
|
2172
|
+
}
|
|
2173
|
+
const rest = usable.filter(filter => !this.isLocked(fields[keyOf(filter)]));
|
|
2174
|
+
this.filters.set([...locked, ...rest]);
|
|
1353
2175
|
this.logic.set(saved.query.logic ?? 'AND');
|
|
1354
2176
|
if (saved.query.search !== undefined)
|
|
1355
2177
|
this.search.set(saved.query.search);
|
|
@@ -1385,6 +2207,12 @@ class SdQueryBar {
|
|
|
1385
2207
|
// ---------------------------------------------------------------------------
|
|
1386
2208
|
/** Placeholder của ô tìm kiếm tự do bên trái; `option.searchPlaceholder` thắng i18n. */
|
|
1387
2209
|
searchPlaceholder = computed(() => this.option()?.searchPlaceholder ?? this.#i18n.t('core.component.query-bar.search-placeholder'), ...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : []));
|
|
2210
|
+
/** 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`. */
|
|
2211
|
+
searchLabel = computed(() => this.option()?.searchPlaceholder ?? this.#i18n.t('core.component.query-bar.search'), ...(ngDevMode ? [{ debugName: "searchLabel" }] : []));
|
|
2212
|
+
/** Nhãn nút xoá của ô tìm. */
|
|
2213
|
+
searchClearLabel = computed(() => this.#i18n.t('core.component.query-bar.search-clear'), ...(ngDevMode ? [{ debugName: "searchClearLabel" }] : []));
|
|
2214
|
+
/** Nhãn và placeholder của ô Thêm điều kiện (mode inline). */
|
|
2215
|
+
addConditionLabel = computed(() => this.#i18n.t('core.component.query-bar.add-condition'), ...(ngDevMode ? [{ debugName: "addConditionLabel" }] : []));
|
|
1388
2216
|
/** Chữ trên chip ghim đang rỗng. */
|
|
1389
2217
|
allLabel = computed(() => this.#i18n.t('core.component.query-bar.all'), ...(ngDevMode ? [{ debugName: "allLabel" }] : []));
|
|
1390
2218
|
/** Chữ trên chip bắt buộc đang rỗng — "Tất cả" sai nghĩa khi field không cho phép bỏ trống. */
|
|
@@ -1406,9 +2234,27 @@ class SdQueryBar {
|
|
|
1406
2234
|
resolvedShowOperatorOnChip = computed(() => this.option()?.showOperatorOnChip ?? this.showOperatorOnChip(), ...(ngDevMode ? [{ debugName: "resolvedShowOperatorOnChip" }] : []));
|
|
1407
2235
|
resolvedApplyOn = computed(() => this.option()?.applyOn ?? 'search', ...(ngDevMode ? [{ debugName: "resolvedApplyOn" }] : []));
|
|
1408
2236
|
resolvedAppearance = computed(() => this.option()?.appearance ?? 'default', ...(ngDevMode ? [{ debugName: "resolvedAppearance" }] : []));
|
|
1409
|
-
|
|
2237
|
+
/**
|
|
2238
|
+
* Clear-all is disabled when the host says so, or — with the built-in clearAll() — when no chip but required ones has a
|
|
2239
|
+
* value: there is nothing left to clear (handoff B2).
|
|
2240
|
+
*/
|
|
2241
|
+
resolvedClearDisabled = computed(() => {
|
|
2242
|
+
const option = this.option();
|
|
2243
|
+
return !!option?.clearDisabled || (!option?.onClearAll && this.activeCount() === 0);
|
|
2244
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedClearDisabled" }] : []));
|
|
1410
2245
|
resolvedInvalidHintId = computed(() => this.option()?.invalidHintId, ...(ngDevMode ? [{ debugName: "resolvedInvalidHintId" }] : []));
|
|
1411
2246
|
constructor() {
|
|
2247
|
+
// 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
|
|
2248
|
+
// (không phát apply); thanh không bao giờ bỏ chip đó.
|
|
2249
|
+
effect(() => {
|
|
2250
|
+
const filters = this.filters();
|
|
2251
|
+
const fields = this.resolvedFields();
|
|
2252
|
+
untracked(() => {
|
|
2253
|
+
const next = this.#withLockedChips(filters, fields);
|
|
2254
|
+
if (next !== filters)
|
|
2255
|
+
this.filters.set(next);
|
|
2256
|
+
});
|
|
2257
|
+
});
|
|
1412
2258
|
effect(() => {
|
|
1413
2259
|
const option = this.option();
|
|
1414
2260
|
if (!option)
|
|
@@ -1448,11 +2294,11 @@ class SdQueryBar {
|
|
|
1448
2294
|
}
|
|
1449
2295
|
return set;
|
|
1450
2296
|
}, ...(ngDevMode ? [{ debugName: "usedFieldKeys" }] : []));
|
|
1451
|
-
/** Fields the user can add: pinned fields always have their chip, so the picker leaves them out. */
|
|
2297
|
+
/** Fields the user can add: pinned and required fields always have their chip, so the picker leaves them out. */
|
|
1452
2298
|
pickerFields = computed(() => {
|
|
1453
2299
|
const fields = this.resolvedFields();
|
|
1454
|
-
// why: giữ nguyên ref khi không có field ghim để picker (OnPush) không bị dirty vô cớ.
|
|
1455
|
-
return fields.some(field => field
|
|
2300
|
+
// why: giữ nguyên ref khi không có field ghim / bắt buộc để picker (OnPush) không bị dirty vô cớ.
|
|
2301
|
+
return fields.some(field => this.isLocked(field)) ? fields.filter(field => !this.isLocked(field)) : fields;
|
|
1456
2302
|
}, ...(ngDevMode ? [{ debugName: "pickerFields" }] : []));
|
|
1457
2303
|
/** "+" is disabled when nothing is left to add. */
|
|
1458
2304
|
addDisabled = computed(() => {
|
|
@@ -1473,10 +2319,18 @@ class SdQueryBar {
|
|
|
1473
2319
|
const invalid = required.filter(field => !filled.has(field.key));
|
|
1474
2320
|
return invalid.length ? invalid : EMPTY_ARRAY;
|
|
1475
2321
|
}, ...(ngDevMode ? [{ debugName: "invalidFields" }] : []));
|
|
1476
|
-
/**
|
|
1477
|
-
|
|
2322
|
+
/**
|
|
2323
|
+
* Chips holding a value that Clear would empty — the number shown in the clear-all label. Required chips keep their
|
|
2324
|
+
* value on clear, so they are not counted (handoff B2).
|
|
2325
|
+
*/
|
|
2326
|
+
activeCount = computed(() => this.filters().filter(filter => !this.fieldOf(filter)?.required && this.isFilterActive(filter)).length, ...(ngDevMode ? [{ debugName: "activeCount" }] : []));
|
|
1478
2327
|
/** Render the global AND/OR connector text between chips when `logic === 'OR'`. */
|
|
1479
2328
|
showOrConnector = computed(() => this.resolvedShowLogicToggle() && this.logic() === 'OR' && this.filters().length >= 2, ...(ngDevMode ? [{ debugName: "showOrConnector" }] : []));
|
|
2329
|
+
/**
|
|
2330
|
+
* "Save current filter" needs something to save: a chip with a value (required chips included — Bước 0, decision 2)
|
|
2331
|
+
* or text in the search box.
|
|
2332
|
+
*/
|
|
2333
|
+
canSaveFilter = computed(() => this.filters().some(filter => this.isFilterActive(filter)) || (this.resolvedShowSearch() && this.search().trim().length > 0), ...(ngDevMode ? [{ debugName: "canSaveFilter" }] : []));
|
|
1480
2334
|
/** Search button is actionable only when there is something to apply and no required field is empty. */
|
|
1481
2335
|
canSearch = computed(() => (this.filters().length > 0 || this.search().trim().length > 0) && this.invalidFields().length === 0, ...(ngDevMode ? [{ debugName: "canSearch" }] : []));
|
|
1482
2336
|
// ---------------------------------------------------------------------------
|
|
@@ -1558,16 +2412,7 @@ class SdQueryBar {
|
|
|
1558
2412
|
* A BETWEEN range is active when either end is set; `{ from: null, to: null }` is empty.
|
|
1559
2413
|
*/
|
|
1560
2414
|
isFilterActive(filter) {
|
|
1561
|
-
|
|
1562
|
-
return true;
|
|
1563
|
-
const data = filter.data;
|
|
1564
|
-
if (data === null || data === undefined || data === '')
|
|
1565
|
-
return false;
|
|
1566
|
-
if (Array.isArray(data))
|
|
1567
|
-
return data.length > 0;
|
|
1568
|
-
if (filter.operator === 'BETWEEN' && typeof data === 'object')
|
|
1569
|
-
return hasValue(data.from) || hasValue(data.to);
|
|
1570
|
-
return true;
|
|
2415
|
+
return ɵsdQueryFilterActive(filter);
|
|
1571
2416
|
}
|
|
1572
2417
|
/** Rendered value text on a chip. */
|
|
1573
2418
|
chipValueText(filter) {
|
|
@@ -1583,9 +2428,16 @@ class SdQueryBar {
|
|
|
1583
2428
|
fieldOf(filter) {
|
|
1584
2429
|
return 'field' in filter ? this.fieldByKey()[filter.field] : undefined;
|
|
1585
2430
|
}
|
|
1586
|
-
/**
|
|
2431
|
+
/**
|
|
2432
|
+
* Pinned and required chips have no remove button and survive removeFilter / clearAll; an empty one is never dropped
|
|
2433
|
+
* (handoff B1: `required` implies `pinned`).
|
|
2434
|
+
*/
|
|
1587
2435
|
isPinned(filter) {
|
|
1588
|
-
return
|
|
2436
|
+
return this.isLocked(this.fieldOf(filter));
|
|
2437
|
+
}
|
|
2438
|
+
/** The field always has its chip on the bar: `pinned` or `required`. */
|
|
2439
|
+
isLocked(field) {
|
|
2440
|
+
return !!field && (!!field.pinned || !!field.required);
|
|
1589
2441
|
}
|
|
1590
2442
|
/** Empty chip of a required field. */
|
|
1591
2443
|
isInvalid(filter) {
|
|
@@ -1654,17 +2506,36 @@ class SdQueryBar {
|
|
|
1654
2506
|
/** Value committed by a completed inline chip (seamless input, picker, boolean toggle). */
|
|
1655
2507
|
onInlineCommit(index, data) {
|
|
1656
2508
|
const previous = this.filters()[index];
|
|
2509
|
+
if (this.#emptiesRequired(previous, { data }))
|
|
2510
|
+
return;
|
|
1657
2511
|
this.updateFilterData(index, data);
|
|
1658
2512
|
this.#applyIfChanged(previous, this.filters()[index]);
|
|
1659
2513
|
}
|
|
1660
2514
|
/** Range committed by a completed inline BETWEEN chip. */
|
|
1661
2515
|
onInlineRange(index, ev) {
|
|
1662
2516
|
const previous = this.filters()[index];
|
|
2517
|
+
if (this.#emptiesRequired(previous, { data: ev ?? { from: null, to: null } }))
|
|
2518
|
+
return;
|
|
1663
2519
|
this.setFilterRange(index, ev);
|
|
1664
2520
|
this.#applyIfChanged(previous, this.filters()[index]);
|
|
1665
2521
|
}
|
|
2522
|
+
/**
|
|
2523
|
+
* B3: a required chip that has a value cannot become empty — the chips already refuse it; the bar refuses it too when
|
|
2524
|
+
* a host calls the mutators directly. The first empty state (B5) is the only empty one.
|
|
2525
|
+
*/
|
|
2526
|
+
#emptiesRequired(previous, patch) {
|
|
2527
|
+
if (!previous || !this.fieldOf(previous)?.required || !this.isFilterActive(previous))
|
|
2528
|
+
return false;
|
|
2529
|
+
return !this.isFilterActive({ ...previous, ...patch });
|
|
2530
|
+
}
|
|
1666
2531
|
/** Entry point from the field picker — start building a chip for `field`. */
|
|
1667
2532
|
beginBuild(field) {
|
|
2533
|
+
// 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.
|
|
2534
|
+
const existing = this.isLocked(field) ? this.filters().findIndex(filter => 'field' in filter && filter.field === field.key) : -1;
|
|
2535
|
+
if (existing >= 0) {
|
|
2536
|
+
afterNextRender(() => this.#focusInlineChip(existing), { injector: this.#injector });
|
|
2537
|
+
return;
|
|
2538
|
+
}
|
|
1668
2539
|
const allowed = sdQueryAllowedOperators(field);
|
|
1669
2540
|
const def = sdQueryDefaultOperator(field);
|
|
1670
2541
|
// why: date/datetime mặc định là BETWEEN — skip operator step để user vào value
|
|
@@ -1682,6 +2553,7 @@ class SdQueryBar {
|
|
|
1682
2553
|
if (SD_QUERY_NO_DATA_OPERATORS.includes(operator)) {
|
|
1683
2554
|
this.#pushComplete(field, operator, null);
|
|
1684
2555
|
this.#building.set(null);
|
|
2556
|
+
this.#returnToAddInput();
|
|
1685
2557
|
return;
|
|
1686
2558
|
}
|
|
1687
2559
|
this.#building.set({ field, operator, step: 'value' });
|
|
@@ -1695,6 +2567,7 @@ class SdQueryBar {
|
|
|
1695
2567
|
if (SD_QUERY_NO_DATA_OPERATORS.includes(op)) {
|
|
1696
2568
|
this.#pushComplete(b.field, op, null);
|
|
1697
2569
|
this.#building.set(null);
|
|
2570
|
+
this.#returnToAddInput();
|
|
1698
2571
|
return;
|
|
1699
2572
|
}
|
|
1700
2573
|
this.#building.set({ ...b, operator: op, step: 'value' });
|
|
@@ -1705,8 +2578,14 @@ class SdQueryBar {
|
|
|
1705
2578
|
const b = this.#building();
|
|
1706
2579
|
if (!b || !b.operator)
|
|
1707
2580
|
return;
|
|
2581
|
+
// B3: an empty value never makes a chip for a required field.
|
|
2582
|
+
if (b.field.required && !this.isFilterActive({ field: b.field.key, operator: b.operator, data: value })) {
|
|
2583
|
+
this.cancelBuild();
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
1708
2586
|
this.#pushComplete(b.field, b.operator, value);
|
|
1709
2587
|
this.#building.set(null);
|
|
2588
|
+
this.#returnToAddInput();
|
|
1710
2589
|
}
|
|
1711
2590
|
/**
|
|
1712
2591
|
* Commit from the seamless build chip (string / number). An empty value (blur with no
|
|
@@ -1723,6 +2602,156 @@ class SdQueryBar {
|
|
|
1723
2602
|
/** Abandon the in-progress chip. */
|
|
1724
2603
|
cancelBuild() {
|
|
1725
2604
|
this.#building.set(null);
|
|
2605
|
+
this.#returnToAddInput();
|
|
2606
|
+
}
|
|
2607
|
+
// ---------------------------------------------------------------------------
|
|
2608
|
+
// Inline mode — "Add condition" combobox (handoff section 8)
|
|
2609
|
+
// ---------------------------------------------------------------------------
|
|
2610
|
+
/** The "Add condition" input (inline mode). */
|
|
2611
|
+
addInput = viewChild('addInput', ...(ngDevMode ? [{ debugName: "addInput" }] : []));
|
|
2612
|
+
/** The field picker the box drives. */
|
|
2613
|
+
addPicker = viewChild(SdQueryFieldPicker, ...(ngDevMode ? [{ debugName: "addPicker" }] : []));
|
|
2614
|
+
/** Text typed in the box — filters the field list. */
|
|
2615
|
+
addQuery = signal('', ...(ngDevMode ? [{ debugName: "addQuery" }] : []));
|
|
2616
|
+
/** The chip the first Backspace on an empty box moved focus to; a second Backspace removes it. */
|
|
2617
|
+
#pendingRemove = null;
|
|
2618
|
+
/** A field was picked in the field picker: inline builds a chip from it, popover adds a chip and opens it. */
|
|
2619
|
+
onPick(field) {
|
|
2620
|
+
if (this.resolvedMode() !== 'inline') {
|
|
2621
|
+
this.addFilter(field);
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2624
|
+
this.addQuery.set('');
|
|
2625
|
+
this.beginBuild(field);
|
|
2626
|
+
}
|
|
2627
|
+
/** Opens the field list under the box, keeping focus in the box (combobox). */
|
|
2628
|
+
openAddList() {
|
|
2629
|
+
const input = this.addInput()?.nativeElement;
|
|
2630
|
+
const picker = this.addPicker();
|
|
2631
|
+
if (!input || !picker || input.disabled || picker.panel().isOpen())
|
|
2632
|
+
return;
|
|
2633
|
+
picker.setQuery(this.addQuery());
|
|
2634
|
+
picker.panel().open(input, { focus: false });
|
|
2635
|
+
}
|
|
2636
|
+
/** Typing filters the list and opens it; the first enabled match is pointed at. */
|
|
2637
|
+
onAddInput(text) {
|
|
2638
|
+
this.addQuery.set(text);
|
|
2639
|
+
this.addPicker()?.setQuery(text);
|
|
2640
|
+
this.openAddList();
|
|
2641
|
+
}
|
|
2642
|
+
onAddKeydown(event) {
|
|
2643
|
+
const picker = this.addPicker();
|
|
2644
|
+
if (!picker)
|
|
2645
|
+
return;
|
|
2646
|
+
const open = picker.panel().isOpen();
|
|
2647
|
+
switch (event.key) {
|
|
2648
|
+
case 'ArrowDown':
|
|
2649
|
+
if (!open) {
|
|
2650
|
+
this.openAddList();
|
|
2651
|
+
// Alt+ArrowDown only opens; ArrowDown also points at the first option.
|
|
2652
|
+
if (!event.altKey)
|
|
2653
|
+
picker.move(1);
|
|
2654
|
+
}
|
|
2655
|
+
else
|
|
2656
|
+
picker.move(1);
|
|
2657
|
+
break;
|
|
2658
|
+
case 'ArrowUp':
|
|
2659
|
+
if (!open)
|
|
2660
|
+
return;
|
|
2661
|
+
picker.move(-1);
|
|
2662
|
+
break;
|
|
2663
|
+
case 'Enter':
|
|
2664
|
+
if (open) {
|
|
2665
|
+
if (!picker.pickActive())
|
|
2666
|
+
return;
|
|
2667
|
+
}
|
|
2668
|
+
else if (!this.addQuery()) {
|
|
2669
|
+
// 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.
|
|
2670
|
+
this.applySearch();
|
|
2671
|
+
}
|
|
2672
|
+
else
|
|
2673
|
+
return;
|
|
2674
|
+
break;
|
|
2675
|
+
case 'Escape':
|
|
2676
|
+
if (!open && !this.addQuery())
|
|
2677
|
+
return;
|
|
2678
|
+
if (open)
|
|
2679
|
+
picker.panel().close('escape');
|
|
2680
|
+
this.addQuery.set('');
|
|
2681
|
+
event.stopPropagation();
|
|
2682
|
+
break;
|
|
2683
|
+
case 'Backspace':
|
|
2684
|
+
if (this.addQuery())
|
|
2685
|
+
return;
|
|
2686
|
+
this.#focusLastChip();
|
|
2687
|
+
break;
|
|
2688
|
+
case 'Tab':
|
|
2689
|
+
if (open)
|
|
2690
|
+
picker.panel().close('tab');
|
|
2691
|
+
return;
|
|
2692
|
+
default:
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
event.preventDefault();
|
|
2696
|
+
}
|
|
2697
|
+
/** A click on the empty part of the chip area (inline mode) focuses the box and opens the list. */
|
|
2698
|
+
onMainClick(event) {
|
|
2699
|
+
const target = event.target;
|
|
2700
|
+
if (this.resolvedMode() !== 'inline' || !target?.classList.contains('c-query-bar__main'))
|
|
2701
|
+
return;
|
|
2702
|
+
this.addInput()?.nativeElement.focus();
|
|
2703
|
+
this.openAddList();
|
|
2704
|
+
}
|
|
2705
|
+
/** Backspace / Delete on the chip the box pointed at removes it — never a required or pinned chip. */
|
|
2706
|
+
onMainKeydown(event) {
|
|
2707
|
+
const pending = this.#pendingRemove;
|
|
2708
|
+
if (!pending || event.target !== pending.element)
|
|
2709
|
+
return;
|
|
2710
|
+
if (event.key !== 'Backspace' && event.key !== 'Delete') {
|
|
2711
|
+
this.#pendingRemove = null;
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2714
|
+
event.preventDefault();
|
|
2715
|
+
const filter = this.filters()[pending.index];
|
|
2716
|
+
if (!filter || this.isPinned(filter) || this.fieldOf(filter)?.disabled)
|
|
2717
|
+
return;
|
|
2718
|
+
this.#pendingRemove = null;
|
|
2719
|
+
this.removeFilter(pending.index);
|
|
2720
|
+
afterNextRender(() => this.addInput()?.nativeElement.focus(), { injector: this.#injector });
|
|
2721
|
+
}
|
|
2722
|
+
/** First Backspace on an empty box: focus the last chip so a second Backspace removes it. */
|
|
2723
|
+
#focusLastChip() {
|
|
2724
|
+
const rendered = this.#chipElements();
|
|
2725
|
+
const last = rendered[rendered.length - 1];
|
|
2726
|
+
if (!last)
|
|
2727
|
+
return;
|
|
2728
|
+
if (!last.element.hasAttribute('tabindex'))
|
|
2729
|
+
last.element.tabIndex = -1;
|
|
2730
|
+
last.element.focus();
|
|
2731
|
+
this.#pendingRemove = last;
|
|
2732
|
+
}
|
|
2733
|
+
/** The focusable wrapper of each rendered inline chip, with the index of its filter. */
|
|
2734
|
+
#chipElements() {
|
|
2735
|
+
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'));
|
|
2736
|
+
// 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.
|
|
2737
|
+
const indexes = this.filters()
|
|
2738
|
+
.map((filter, index) => (this.fieldOf(filter) ? index : -1))
|
|
2739
|
+
.filter(index => index >= 0);
|
|
2740
|
+
return elements.map((element, position) => ({ element, index: indexes[position] })).filter(entry => entry.index !== undefined);
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* After a chip is finished (value committed, build cancelled) focus goes back to the box, without opening the list —
|
|
2744
|
+
* unless the user has moved focus somewhere else meanwhile.
|
|
2745
|
+
*/
|
|
2746
|
+
#returnToAddInput() {
|
|
2747
|
+
if (this.resolvedMode() !== 'inline')
|
|
2748
|
+
return;
|
|
2749
|
+
afterNextRender(() => {
|
|
2750
|
+
const active = document.activeElement;
|
|
2751
|
+
if (active && active !== document.body && !this.#host.nativeElement.contains(active))
|
|
2752
|
+
return;
|
|
2753
|
+
this.addInput()?.nativeElement.focus();
|
|
2754
|
+
}, { injector: this.#injector });
|
|
1726
2755
|
}
|
|
1727
2756
|
/**
|
|
1728
2757
|
* Commit both ends of a BETWEEN range at once — called from `<sd-query-inline-chip>`'s
|
|
@@ -1767,18 +2796,35 @@ class SdQueryBar {
|
|
|
1767
2796
|
afterNextRender(() => this.#focusInlineChip(index), { injector: this.#injector });
|
|
1768
2797
|
return;
|
|
1769
2798
|
}
|
|
1770
|
-
if (index < 0)
|
|
2799
|
+
if (index < 0) {
|
|
1771
2800
|
this.#addFilter(field, returnFocusTo ?? undefined);
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
const chip = this.popoverChips()[index];
|
|
2804
|
+
// 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 đó
|
|
2805
|
+
// và đóng menu; panel mới không có backdrop.
|
|
2806
|
+
if (chip?.isOpen())
|
|
2807
|
+
chip.closeMenu();
|
|
1772
2808
|
else
|
|
1773
|
-
|
|
2809
|
+
chip?.openMenu(returnFocusTo ?? undefined);
|
|
1774
2810
|
}
|
|
1775
|
-
/**
|
|
2811
|
+
/**
|
|
2812
|
+
* Clear-all button: the host's `onClearAll` when given, else the built-in clearAll(). With `applyOn: 'commit'` the
|
|
2813
|
+
* built-in path applies once when it emptied a chip that had a value (R2 G-10).
|
|
2814
|
+
*/
|
|
1776
2815
|
onClearClick() {
|
|
1777
2816
|
const onClearAll = this.option()?.onClearAll;
|
|
1778
|
-
if (onClearAll)
|
|
2817
|
+
if (onClearAll) {
|
|
1779
2818
|
onClearAll();
|
|
1780
|
-
|
|
1781
|
-
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
// 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
|
|
2822
|
+
// thì clearAll không đổi điều kiện lọc nào nên không áp dụng.
|
|
2823
|
+
const changed = this.activeCount() > 0;
|
|
2824
|
+
this.clearAll();
|
|
2825
|
+
// 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á.
|
|
2826
|
+
if (changed && this.resolvedApplyOn() === 'commit')
|
|
2827
|
+
this.#applyChipChange();
|
|
1782
2828
|
}
|
|
1783
2829
|
/** Swap the field of an existing chip — reset operator + value to the new field's defaults. */
|
|
1784
2830
|
changeFilterField(index, field) {
|
|
@@ -1789,9 +2835,8 @@ class SdQueryBar {
|
|
|
1789
2835
|
const data = SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null;
|
|
1790
2836
|
list[index] = { field: field.key, operator, data };
|
|
1791
2837
|
this.filters.set(list);
|
|
1792
|
-
// why:
|
|
1793
|
-
//
|
|
1794
|
-
// continue picking operator + value without a second manual click.
|
|
2838
|
+
// why: re-open the chip's popover on the next render so the user can pick operator + value for the new field
|
|
2839
|
+
// without a second click.
|
|
1795
2840
|
afterNextRender(() => this.popoverChips()[index]?.openMenu(), { injector: this.#injector });
|
|
1796
2841
|
}
|
|
1797
2842
|
updateFilter(index, patch) {
|
|
@@ -1836,23 +2881,54 @@ class SdQueryBar {
|
|
|
1836
2881
|
if (this.resolvedApplyOn() === 'commit' && this.isFilterActive(removed))
|
|
1837
2882
|
this.#applyChipChange();
|
|
1838
2883
|
}
|
|
1839
|
-
/**
|
|
2884
|
+
/**
|
|
2885
|
+
* Empties the bar (handoff B2). Required chips stay as they are (operator and value); pinned chips stay, reset to their
|
|
2886
|
+
* field's default operator and no value; other chips go.
|
|
2887
|
+
*/
|
|
1840
2888
|
clearAll() {
|
|
1841
2889
|
if (this.filters().length === 0)
|
|
1842
2890
|
return;
|
|
1843
2891
|
const kept = [];
|
|
1844
2892
|
for (const filter of this.filters()) {
|
|
1845
2893
|
const field = this.fieldOf(filter);
|
|
2894
|
+
if (field?.required) {
|
|
2895
|
+
kept.push(filter);
|
|
2896
|
+
continue;
|
|
2897
|
+
}
|
|
1846
2898
|
if (!field?.pinned)
|
|
1847
2899
|
continue;
|
|
1848
|
-
const
|
|
1849
|
-
const next = { field: field.key, operator, data: SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null };
|
|
2900
|
+
const next = this.#emptyChip(field);
|
|
1850
2901
|
this.#inheritRowId(filter, next);
|
|
1851
2902
|
kept.push(next);
|
|
1852
2903
|
}
|
|
1853
|
-
this.filters.set(kept);
|
|
2904
|
+
this.filters.set(this.#withLockedChips(kept, this.resolvedFields()));
|
|
1854
2905
|
this.editingIndex.set(null);
|
|
1855
2906
|
}
|
|
2907
|
+
/** A chip of `field` with its default operator and no value. */
|
|
2908
|
+
#emptyChip(field) {
|
|
2909
|
+
const operator = sdQueryDefaultOperator(field);
|
|
2910
|
+
return { field: field.key, operator, data: SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null };
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* B1: every pinned or required field has a chip. Missing ones are added empty; the locked chips then come first in
|
|
2914
|
+
* field order, the others keep their order. Returns `filters` itself when nothing is missing.
|
|
2915
|
+
*/
|
|
2916
|
+
#withLockedChips(filters, fields) {
|
|
2917
|
+
const locked = fields.filter(field => this.isLocked(field));
|
|
2918
|
+
if (!locked.length)
|
|
2919
|
+
return filters;
|
|
2920
|
+
const chips = new Map();
|
|
2921
|
+
for (const filter of filters)
|
|
2922
|
+
if ('field' in filter && !chips.has(filter.field))
|
|
2923
|
+
chips.set(filter.field, filter);
|
|
2924
|
+
if (locked.every(field => chips.has(field.key)))
|
|
2925
|
+
return filters;
|
|
2926
|
+
const keys = new Set(locked.map(field => field.key));
|
|
2927
|
+
return [
|
|
2928
|
+
...locked.map(field => chips.get(field.key) ?? this.#emptyChip(field)),
|
|
2929
|
+
...filters.filter(filter => !('field' in filter) || !keys.has(filter.field)),
|
|
2930
|
+
];
|
|
2931
|
+
}
|
|
1856
2932
|
setLogic(value) {
|
|
1857
2933
|
if (this.logic() === value)
|
|
1858
2934
|
return;
|
|
@@ -1865,6 +2941,18 @@ class SdQueryBar {
|
|
|
1865
2941
|
this.#searchBase = this.search();
|
|
1866
2942
|
this.search.set(value);
|
|
1867
2943
|
}
|
|
2944
|
+
/** Clear button of the search box: empties the text and applies once (handoff 7.2). */
|
|
2945
|
+
clearSearch() {
|
|
2946
|
+
this.setSearch('');
|
|
2947
|
+
this.applySearch();
|
|
2948
|
+
}
|
|
2949
|
+
/** Escape in the search box: like the clear button when there is text; nothing on an empty box. */
|
|
2950
|
+
onSearchEscape(event) {
|
|
2951
|
+
if (!this.search())
|
|
2952
|
+
return;
|
|
2953
|
+
event.preventDefault();
|
|
2954
|
+
this.clearSearch();
|
|
2955
|
+
}
|
|
1868
2956
|
/** Enter in the search box: applies the typed text too, unless a required field is still empty. */
|
|
1869
2957
|
applySearch() {
|
|
1870
2958
|
if (this.invalidFields().length)
|
|
@@ -1904,7 +2992,7 @@ class SdQueryBar {
|
|
|
1904
2992
|
return;
|
|
1905
2993
|
this.editingIndex.set(index);
|
|
1906
2994
|
const field = this.fieldByKey()[filter.field];
|
|
1907
|
-
this.chipPopover()?.seed(filter, field);
|
|
2995
|
+
this.chipPopover()?.seed(filter, field, index);
|
|
1908
2996
|
}
|
|
1909
2997
|
/**
|
|
1910
2998
|
* Receive `(commit)` from the child popover — splice into filters, null the index. With
|
|
@@ -1929,7 +3017,7 @@ class SdQueryBar {
|
|
|
1929
3017
|
return;
|
|
1930
3018
|
}
|
|
1931
3019
|
// why: popover chỉ đổi operator + value của CHÍNH chip đó → giữ track key, nếu không chip sẽ
|
|
1932
|
-
// bị huỷ ngay lúc
|
|
3020
|
+
// bị huỷ ngay lúc panel đóng (trigger của overlay biến mất giữa chừng).
|
|
1933
3021
|
this.#inheritRowId(previous, next);
|
|
1934
3022
|
list[idx] = next;
|
|
1935
3023
|
this.filters.set(list);
|
|
@@ -1973,16 +3061,20 @@ class SdQueryBar {
|
|
|
1973
3061
|
chips[index]?.querySelector('input, button, [tabindex]:not([tabindex="-1"])')?.focus();
|
|
1974
3062
|
}
|
|
1975
3063
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1976
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[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 });
|
|
3064
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
1977
3065
|
}
|
|
1978
3066
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdQueryBar, decorators: [{
|
|
1979
3067
|
type: Component,
|
|
1980
|
-
args: [{ selector: 'sd-query-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3068
|
+
args: [{ selector: 'sd-query-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [ɵSdQueryPanelGroup], host: {
|
|
3069
|
+
'(click)': 'onMainClick($event)',
|
|
3070
|
+
'(keydown)': 'onMainKeydown($event)',
|
|
3071
|
+
}, imports: [
|
|
1981
3072
|
SdIcon,
|
|
1982
3073
|
CommonModule,
|
|
1983
|
-
FormsModule,
|
|
1984
|
-
MatMenuModule,
|
|
1985
3074
|
MatTooltipModule,
|
|
3075
|
+
ɵSdQueryPanelTriggerDirective,
|
|
3076
|
+
_SdSearchField,
|
|
3077
|
+
_SdSearchFieldInputDirective,
|
|
1986
3078
|
SdQueryActionsBar,
|
|
1987
3079
|
SdQueryBuildChip,
|
|
1988
3080
|
SdQueryChipPopover,
|
|
@@ -1990,8 +3082,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1990
3082
|
SdQueryInlineChip,
|
|
1991
3083
|
SdQueryInlineValueChip,
|
|
1992
3084
|
SdQueryPopoverChip,
|
|
1993
|
-
], 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"] }]
|
|
1994
|
-
}], 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"] }] } });
|
|
3085
|
+
], 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"] }]
|
|
3086
|
+
}], 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 }] }] } });
|
|
1995
3087
|
|
|
1996
3088
|
/**
|
|
1997
3089
|
* Generated bundle index. Do not edit.
|