@sdcorejs/angular 22.3.3 → 22.3.5
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/fesm2022/sdcorejs-angular-components-form-generic.mjs +5 -5
- 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-modal.mjs +46 -10
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +549 -82
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +6528 -3510
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +23 -4
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +330 -5
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +97 -11
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs → sdcorejs-angular-modules-pattern-base-api.service-C2o5xPVB.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-base-api.service-Cfmr0L_5.mjs.map → sdcorejs-angular-modules-pattern-base-api.service-C2o5xPVB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs → sdcorejs-angular-modules-pattern-create-side-drawer.component-CRc9T7rb.mjs} +18 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CRc9T7rb.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs → sdcorejs-angular-modules-pattern-create-side-drawer.component-Cz-MjRG0.mjs} +18 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-Cz-MjRG0.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs → sdcorejs-angular-modules-pattern-create.component-CxicczH7.mjs} +19 -5
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CxicczH7.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs → sdcorejs-angular-modules-pattern-create.component-D3MzNJ3F.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-DIivNX4o.mjs.map → sdcorejs-angular-modules-pattern-create.component-D3MzNJ3F.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs → sdcorejs-angular-modules-pattern-create.component-RBvVv88D.mjs} +36 -12
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-RBvVv88D.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs → sdcorejs-angular-modules-pattern-customer.service-3hWkJClX.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-customer.service-B0nhFd_M.mjs.map → sdcorejs-angular-modules-pattern-customer.service-3hWkJClX.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs → sdcorejs-angular-modules-pattern-detail-side-drawer.component-DzDAX3B7.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail-side-drawer.component-D1dqsKX0.mjs.map → sdcorejs-angular-modules-pattern-detail-side-drawer.component-DzDAX3B7.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs → sdcorejs-angular-modules-pattern-detail.component-CEhbU12j.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-WK0AcxNJ.mjs.map → sdcorejs-angular-modules-pattern-detail.component-CEhbU12j.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs → sdcorejs-angular-modules-pattern-detail.component-CcpYULut.mjs} +28 -11
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CcpYULut.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs → sdcorejs-angular-modules-pattern-flow.component-G5lHfG81.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-flow.component-BvhEMUgY.mjs.map → sdcorejs-angular-modules-pattern-flow.component-G5lHfG81.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs → sdcorejs-angular-modules-pattern-general-information-form.component-BJaYcNzf.mjs} +3 -3
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-BJaYcNzf.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs → sdcorejs-angular-modules-pattern-index.component-CosbQK0W.mjs} +4 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-CosbQK0W.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-table-form.component-DmmVKrgM.mjs +836 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-table-form.component-DmmVKrgM.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs → sdcorejs-angular-modules-pattern-list.component-BjehcQEk.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-CaXgC8wK.mjs.map → sdcorejs-angular-modules-pattern-list.component-BjehcQEk.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs → sdcorejs-angular-modules-pattern-list.component-CNVqk3JC.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-1Xn1WaAP.mjs.map → sdcorejs-angular-modules-pattern-list.component-CNVqk3JC.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs → sdcorejs-angular-modules-pattern-list.component-C_pVqRcC.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-Bv_l7vnz.mjs.map → sdcorejs-angular-modules-pattern-list.component-C_pVqRcC.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs → sdcorejs-angular-modules-pattern-list.component-EaNDEtCn.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-ChwTb4BU.mjs.map → sdcorejs-angular-modules-pattern-list.component-EaNDEtCn.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs → sdcorejs-angular-modules-pattern-list.component-jB3E20UF.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-list.component-B6Ndq542.mjs.map → sdcorejs-angular-modules-pattern-list.component-jB3E20UF.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs → sdcorejs-angular-modules-pattern-mock-backend.factory-CFljqhjv.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-mock-backend.factory-DKK3NmbN.mjs.map → sdcorejs-angular-modules-pattern-mock-backend.factory-CFljqhjv.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs → sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs} +9 -2
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs → sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs} +21 -19
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs → sdcorejs-angular-modules-pattern-product.service-DitXmlr1.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-product.service-GSlXwL2Z.mjs.map → sdcorejs-angular-modules-pattern-product.service-DitXmlr1.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs → sdcorejs-angular-modules-pattern-profile.component-Dxw7Ix9d.mjs} +2 -2
- package/fesm2022/{sdcorejs-angular-modules-pattern-profile.component-DPBwMafn.mjs.map → sdcorejs-angular-modules-pattern-profile.component-Dxw7Ix9d.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs → sdcorejs-angular-modules-pattern-routes-BOiWZHqg.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-B6z9lJYB.mjs.map → sdcorejs-angular-modules-pattern-routes-BOiWZHqg.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs → sdcorejs-angular-modules-pattern-routes-BWZxOMhB.mjs} +7 -7
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-h66efEeH.mjs.map → sdcorejs-angular-modules-pattern-routes-BWZxOMhB.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs → sdcorejs-angular-modules-pattern-routes-BxXgJVsW.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DeThmv4f.mjs.map → sdcorejs-angular-modules-pattern-routes-BxXgJVsW.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs → sdcorejs-angular-modules-pattern-routes-C43Q4Wtq.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-t3O2L2J5.mjs.map → sdcorejs-angular-modules-pattern-routes-C43Q4Wtq.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs → sdcorejs-angular-modules-pattern-routes-CJ-RAMa5.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-D1fsRfRB.mjs.map → sdcorejs-angular-modules-pattern-routes-CJ-RAMa5.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs → sdcorejs-angular-modules-pattern-routes-CWixJ2If.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-DdCFCwxY.mjs.map → sdcorejs-angular-modules-pattern-routes-CWixJ2If.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs → sdcorejs-angular-modules-pattern-routes-CophQH_L.mjs} +5 -5
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-1kifjm82.mjs.map → sdcorejs-angular-modules-pattern-routes-CophQH_L.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs → sdcorejs-angular-modules-pattern-routes-w4VY9P_H.mjs} +9 -9
- package/fesm2022/{sdcorejs-angular-modules-pattern-routes-bQpdxKlY.mjs.map → sdcorejs-angular-modules-pattern-routes-w4VY9P_H.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BQCWgQsr.mjs} +12 -12
- package/fesm2022/{sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-B6w4N6wo.mjs.map → sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-BQCWgQsr.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs → sdcorejs-angular-modules-pattern-shell.component-BOjJteMd.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-pattern-shell.component-BIYHlzVQ.mjs.map → sdcorejs-angular-modules-pattern-shell.component-BOjJteMd.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs → sdcorejs-angular-modules-pattern-update-side-drawer.component-BT2PzXTG.mjs} +4 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-BT2PzXTG.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs → sdcorejs-angular-modules-pattern-update-side-drawer.component-qmGn2tCI.mjs} +4 -4
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-qmGn2tCI.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs → sdcorejs-angular-modules-pattern-update.component-CS3jlV-R.mjs} +5 -5
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CS3jlV-R.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs → sdcorejs-angular-modules-pattern-update.component-CUgQPcR4.mjs} +22 -12
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-CUgQPcR4.mjs.map +1 -0
- package/fesm2022/{sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs → sdcorejs-angular-modules-pattern-update.component-lGwicZKW.mjs} +12 -10
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-lGwicZKW.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +11 -11
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-cache.mjs +7 -5
- package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +34 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-storage.mjs +6 -4
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/modules/pattern/docs/drawer.md +1 -1
- package/modules/pattern/docs/form.md +445 -148
- package/modules/pattern/docs/header-actions.md +14 -12
- package/modules/pattern/docs/select.md +9 -1
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +8 -1
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +1 -1
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +8 -1
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +1 -1
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +1 -1
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +124 -147
- package/modules/pattern/features/order/components/lines-form/order-lines.ts +101 -0
- package/modules/pattern/features/order/components/lines-table-form/lines-table-form.component.ts +196 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +18 -4
- package/modules/pattern/features/order/pages/detail/detail.component.ts +14 -12
- package/modules/pattern/features/order/pages/update/update.component.ts +11 -4
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +1 -1
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +9 -1
- package/modules/pattern/features/product/pages/create/create.component.ts +8 -1
- package/modules/pattern/features/product/pages/update/update.component.ts +1 -1
- package/modules/pattern/features/settings/pages/update/update.component.ts +5 -4
- package/package.json +1 -1
- package/types/sdcorejs-angular-components-modal.d.ts +6 -1
- package/types/sdcorejs-angular-components-query-bar.d.ts +154 -13
- package/types/sdcorejs-angular-components-table.d.ts +448 -29
- package/types/sdcorejs-angular-i18n.d.ts +66 -1
- package/types/sdcorejs-angular-services-api.d.ts +5 -5
- package/types/sdcorejs-angular-services-cache.d.ts +4 -2
- package/types/sdcorejs-angular-services-excel.d.ts +59 -0
- package/types/sdcorejs-angular-services-storage.d.ts +3 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-C7-itJqB.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-CxgmaNod.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-C2GdGhkJ.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CzJh4LMR.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-Dkmm0a2Y.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-cxNRkeRU.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-D1zWXyN6.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs +0 -541
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-form.component-BK__9Mzb.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BpLQaYP5.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-BrejHvB2.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DKgmhJT2.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-nnldn2cz.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-C0Bewuwz.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-Qlh3Lm2p.mjs.map +0 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-p9R5-eou.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
1
|
+
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, computed, input, output, signal, effect, ChangeDetectionStrategy, Component, booleanAttribute, model, viewChild, isSignal, Injector,
|
|
3
|
+
import { inject, computed, input, output, signal, effect, ChangeDetectionStrategy, Component, booleanAttribute, model, viewChild, isSignal, Injector, afterNextRender, ElementRef, viewChildren, untracked } from '@angular/core';
|
|
4
4
|
import * as i1$1 from '@angular/forms';
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
6
|
import * as i1 from '@angular/material/menu';
|
|
@@ -8,6 +8,8 @@ import { MatMenuModule, MatMenu, MatMenuTrigger } from '@angular/material/menu';
|
|
|
8
8
|
import * as i2 from '@angular/material/tooltip';
|
|
9
9
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
10
10
|
import { I18nService } from '@sdcorejs/angular/i18n';
|
|
11
|
+
import { SdDateTimeService } from '@sdcorejs/angular/services/date-time';
|
|
12
|
+
import { Utilities } from '@sdcorejs/utils/fns';
|
|
11
13
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
12
14
|
import { SdConfirmService } from '@sdcorejs/angular/services/confirm';
|
|
13
15
|
import { SdOperator } from '@sdcorejs/angular/components/operator';
|
|
@@ -18,8 +20,10 @@ import { SdInput } from '@sdcorejs/angular/forms/input';
|
|
|
18
20
|
import { SdInputNumber } from '@sdcorejs/angular/forms/input-number';
|
|
19
21
|
import { SdSelect } from '@sdcorejs/angular/forms/select';
|
|
20
22
|
import { SdInlineText } from '@sdcorejs/angular/forms/inline-text';
|
|
21
|
-
import { isObservable } from 'rxjs';
|
|
23
|
+
import { isObservable, firstValueFrom } from 'rxjs';
|
|
22
24
|
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
25
|
+
import { sdNormalizeSearchText } from '@sdcorejs/angular/utilities/extensions';
|
|
26
|
+
import { take } from 'rxjs/operators';
|
|
23
27
|
|
|
24
28
|
/**
|
|
25
29
|
* Saved-filters dropdown for `sd-query-bar`.
|
|
@@ -168,10 +172,18 @@ class SdQueryActionsBar {
|
|
|
168
172
|
applyFilter = output();
|
|
169
173
|
// Clear-all —
|
|
170
174
|
showClearAll = input(true, { ...(ngDevMode ? { debugName: "showClearAll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
175
|
+
/** Number in the clear-all label; falls back to `filtersCount`. `0` drops the number. */
|
|
176
|
+
clearCount = input(undefined, /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "clearCount" }] : /* istanbul ignore next */ []));
|
|
178
|
+
clearDisabled = input(false, /* @ts-ignore */
|
|
179
|
+
...(ngDevMode ? [{ debugName: "clearDisabled" }] : /* istanbul ignore next */ []));
|
|
171
180
|
clear = output();
|
|
172
181
|
// Search trigger —
|
|
173
182
|
canSearch = input(false, /* @ts-ignore */
|
|
174
183
|
...(ngDevMode ? [{ debugName: "canSearch" }] : /* istanbul ignore next */ []));
|
|
184
|
+
/** `false` hides the button (bar `applyOn: 'commit'`). */
|
|
185
|
+
showSearchButton = input(true, /* @ts-ignore */
|
|
186
|
+
...(ngDevMode ? [{ debugName: "showSearchButton" }] : /* istanbul ignore next */ []));
|
|
175
187
|
search = output();
|
|
176
188
|
// Nhãn i18n —
|
|
177
189
|
// why: bọc trong `computed()` chứ không dùng pipe `translate` (pure pipe không chạy lại khi
|
|
@@ -179,7 +191,13 @@ class SdQueryActionsBar {
|
|
|
179
191
|
// ghép chuỗi trong template sẽ khoá cứng trật tự từ của tiếng Việt.
|
|
180
192
|
logicGroupLabel = computed(() => this.#i18n.t('core.component.query-bar.logic-operator'), /* @ts-ignore */
|
|
181
193
|
...(ngDevMode ? [{ debugName: "logicGroupLabel" }] : /* istanbul ignore next */ []));
|
|
182
|
-
clearAllLabel = computed(() =>
|
|
194
|
+
clearAllLabel = computed(() => {
|
|
195
|
+
const count = this.clearCount() ?? this.filtersCount();
|
|
196
|
+
// why: nút tắt (không có gì khác mặc định) hoặc không chip nào có giá trị thì "(0)" chỉ gây nhiễu.
|
|
197
|
+
if (this.clearDisabled() || count === 0)
|
|
198
|
+
return this.#i18n.t('core.component.query-bar.clear');
|
|
199
|
+
return this.#i18n.t('core.component.query-bar.clear-all', { count });
|
|
200
|
+
}, /* @ts-ignore */
|
|
183
201
|
...(ngDevMode ? [{ debugName: "clearAllLabel" }] : /* istanbul ignore next */ []));
|
|
184
202
|
searchLabel = computed(() => this.#i18n.t('core.component.query-bar.search'), /* @ts-ignore */
|
|
185
203
|
...(ngDevMode ? [{ debugName: "searchLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -189,12 +207,12 @@ class SdQueryActionsBar {
|
|
|
189
207
|
this.logic.set(value);
|
|
190
208
|
}
|
|
191
209
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryActionsBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
192
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryActionsBar, isStandalone: true, selector: "sd-query-actions-bar", inputs: { showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, filtersCount: { classPropertyName: "filtersCount", publicName: "filtersCount", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, canSearch: { classPropertyName: "canSearch", publicName: "canSearch", 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 [matTooltip]=\"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 mat-menu 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 (apply)=\"applyFilter.emit($event)\" />\n }\n\n <!-- why: far-right \"submit at the end of the toolbar\" position; sole query trigger. -->\n <button\n
|
|
210
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryActionsBar, isStandalone: true, selector: "sd-query-actions-bar", inputs: { showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, filtersCount: { classPropertyName: "filtersCount", publicName: "filtersCount", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, clearCount: { classPropertyName: "clearCount", publicName: "clearCount", isSignal: true, isRequired: false, transformFunction: null }, clearDisabled: { classPropertyName: "clearDisabled", publicName: "clearDisabled", isSignal: true, isRequired: false, transformFunction: null }, canSearch: { classPropertyName: "canSearch", publicName: "canSearch", isSignal: true, isRequired: false, transformFunction: null }, showSearchButton: { classPropertyName: "showSearchButton", publicName: "showSearchButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { logic: "logicChange", applyFilter: "applyFilter", clear: "clear", search: "search" }, ngImport: i0, template: "<!-- Vertical separator between the wrapping filter area (left) and the pinned toolbar. -->\n<span class=\"c-bar-divider\" aria-hidden=\"true\"></span>\n\n<div class=\"c-query-bar__actions\">\n <!-- AND / OR toggle -->\n @if (showLogicToggle() && filtersCount() >= 2) {\n <div class=\"c-logic-toggle\" role=\"group\" [attr.aria-label]=\"logicGroupLabel()\">\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'AND'\"\n (click)=\"setLogic('AND')\">\n AND\n </button>\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'OR'\"\n (click)=\"setLogic('OR')\">\n OR\n </button>\n </div>\n }\n\n @if (showClearAll() && filtersCount() > 0) {\n <button\n type=\"button\"\n class=\"c-clear-all\"\n [disabled]=\"clearDisabled()\"\n [matTooltip]=\"clearAllLabel()\"\n [attr.aria-label]=\"clearAllLabel()\"\n (click)=\"clear.emit()\">\n <sd-icon name=\"delete_sweep\"></sd-icon>\n </button>\n }\n\n <!-- why: saved-filters dropdown \u0111\u1EB7t s\u00E1t ngay tr\u01B0\u1EDBc Search \u2014 gom to\u00E0n b\u1ED9\n h\u00E0nh \u0111\u1ED9ng v\u1EC1 b\u1ED9 l\u1ECDc (apply view c\u0169 / l\u01B0u view hi\u1EC7n t\u1EA1i) c\u1EA1nh n\u00FAt submit,\n user th\u1EA5y 1 c\u1EE5m. Footer \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\" s\u1ED1ng trong mat-menu 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 (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 (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: i2.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"], outputs: ["apply"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
193
211
|
}
|
|
194
212
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryActionsBar, decorators: [{
|
|
195
213
|
type: Component,
|
|
196
|
-
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 [matTooltip]=\"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 mat-menu 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 (apply)=\"applyFilter.emit($event)\" />\n }\n\n <!-- why: far-right \"submit at the end of the toolbar\" position; sole query trigger. -->\n <button\n
|
|
197
|
-
}], 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 }] }], clear: [{ type: i0.Output, args: ["clear"] }], canSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSearch", required: false }] }], search: [{ type: i0.Output, args: ["search"] }] } });
|
|
214
|
+
args: [{ selector: 'sd-query-actions-bar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatTooltipModule, SdQuerySavedFiltersMenu], template: "<!-- Vertical separator between the wrapping filter area (left) and the pinned toolbar. -->\n<span class=\"c-bar-divider\" aria-hidden=\"true\"></span>\n\n<div class=\"c-query-bar__actions\">\n <!-- AND / OR toggle -->\n @if (showLogicToggle() && filtersCount() >= 2) {\n <div class=\"c-logic-toggle\" role=\"group\" [attr.aria-label]=\"logicGroupLabel()\">\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'AND'\"\n (click)=\"setLogic('AND')\">\n AND\n </button>\n <button\n type=\"button\"\n class=\"c-logic-segment\"\n [class.c-logic-active]=\"logic() === 'OR'\"\n (click)=\"setLogic('OR')\">\n OR\n </button>\n </div>\n }\n\n @if (showClearAll() && filtersCount() > 0) {\n <button\n type=\"button\"\n class=\"c-clear-all\"\n [disabled]=\"clearDisabled()\"\n [matTooltip]=\"clearAllLabel()\"\n [attr.aria-label]=\"clearAllLabel()\"\n (click)=\"clear.emit()\">\n <sd-icon name=\"delete_sweep\"></sd-icon>\n </button>\n }\n\n <!-- why: saved-filters dropdown \u0111\u1EB7t s\u00E1t ngay tr\u01B0\u1EDBc Search \u2014 gom to\u00E0n b\u1ED9\n h\u00E0nh \u0111\u1ED9ng v\u1EC1 b\u1ED9 l\u1ECDc (apply view c\u0169 / l\u01B0u view hi\u1EC7n t\u1EA1i) c\u1EA1nh n\u00FAt submit,\n user th\u1EA5y 1 c\u1EE5m. Footer \"L\u01B0u b\u1ED9 l\u1ECDc hi\u1EC7n t\u1EA1i\" s\u1ED1ng trong mat-menu 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 (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 (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"] }]
|
|
215
|
+
}], propDecorators: { showLogicToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLogicToggle", required: false }] }], logic: [{ type: i0.Input, args: [{ isSignal: true, alias: "logic", required: false }] }, { type: i0.Output, args: ["logicChange"] }], filtersCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "filtersCount", required: false }] }], showSavedFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSavedFilters", required: false }] }], savedFiltersKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "savedFiltersKey", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], applyFilter: [{ type: i0.Output, args: ["applyFilter"] }], showClearAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearAll", required: false }] }], clearCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearCount", required: false }] }], clearDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearDisabled", required: false }] }], clear: [{ type: i0.Output, args: ["clear"] }], canSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "canSearch", required: false }] }], showSearchButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearchButton", required: false }] }], search: [{ type: i0.Output, args: ["search"] }] } });
|
|
198
216
|
|
|
199
217
|
// ---------------------------------------------------------------------------
|
|
200
218
|
// Constants
|
|
@@ -323,6 +341,15 @@ class SdQueryInlineValueChip {
|
|
|
323
341
|
/** Focus the first input on creation — used for the in-progress build chip. */
|
|
324
342
|
autofocus = input(false, /* @ts-ignore */
|
|
325
343
|
...(ngDevMode ? [{ debugName: "autofocus" }] : /* istanbul ignore next */ []));
|
|
344
|
+
/** Pinned chip — no × segment. */
|
|
345
|
+
pinned = input(false, /* @ts-ignore */
|
|
346
|
+
...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
347
|
+
/** Required chip without a value — error look while not focused, `aria-invalid`. */
|
|
348
|
+
invalid = input(false, /* @ts-ignore */
|
|
349
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
350
|
+
/** Id set as `aria-describedby` (the host's required hint). */
|
|
351
|
+
describedBy = input(undefined, /* @ts-ignore */
|
|
352
|
+
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
326
353
|
/** Emitted on commit (Enter / blur) with the parsed next value. */
|
|
327
354
|
valueChange = output();
|
|
328
355
|
/** Emitted when the user clicks the × segment. */
|
|
@@ -372,6 +399,8 @@ class SdQueryInlineValueChip {
|
|
|
372
399
|
return 'error';
|
|
373
400
|
if (this.focused())
|
|
374
401
|
return 'focus';
|
|
402
|
+
if (this.invalid())
|
|
403
|
+
return 'error';
|
|
375
404
|
return this.hasValue() ? 'active' : 'pending';
|
|
376
405
|
}, /* @ts-ignore */
|
|
377
406
|
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
@@ -480,12 +509,12 @@ class SdQueryInlineValueChip {
|
|
|
480
509
|
return { ok: true, value: t };
|
|
481
510
|
}
|
|
482
511
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineValueChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
483
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineValueChip, isStandalone: true, selector: "sd-query-inline-value-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null } }, 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.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 -->\n <button type=\"button\" class=\"c-seamless__x\" aria-label=\"Remove filter\" (click)=\"onRemove($event)\">\n
|
|
512
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineValueChip, isStandalone: true, selector: "sd-query-inline-value-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", remove: "remove" }, viewQueries: [{ propertyName: "firstInput", first: true, predicate: ["firstInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n Seamless string/number chip \u2014 the pill IS the input. One border, three flush\n segments: label \u00B7 input(s) \u00B7 \u00D7. State styling driven by [data-state]. The value\n field is the shared <sd-inline-text> primitive (chrome=\"seamless\") so width hugs\n content; the chip keeps the envelope + parse/commit logic.\n-->\n@let _state = state();\n@let _autoId = autoId();\n@let _isNoData = isNoData();\n@let _density = density();\n@let _operator = operator();\n\n<!-- why: v\u1ECF chip l\u00E0 m\u1ED9t NH\u00D3M control (nh\u00E3n + \u00F4 nh\u1EADp + n\u00FAt \u00D7), kh\u00F4ng ph\u1EA3i n\u00FAt \u2192 role=\"group\" +\n aria-label m\u00F4 t\u1EA3 \u0111\u00FAng c\u1EA5u tr\u00FAc v\u00E0 c\u0169ng cho bi\u1EBFt v\u00EC sao n\u00F3 KH\u00D4NG nh\u1EADn tabindex (tab \u0111i th\u1EB3ng\n v\u00E0o input b\u00EAn trong). `focusFromShell` \u0111\u00E3 t\u1EF1 lo\u1EA1i click tr\u00EAn input v\u00E0 tr\u00EAn n\u00FAt \u00D7 n\u00EAn g\u1EAFn th\u00EAm\n Enter d\u00F9ng chung handler l\u00E0 an to\u00E0n v\u00E0 ph\u1EA3n chi\u1EBFu \u0111\u00FAng h\u00E0nh vi click. -->\n<span\n class=\"c-seamless\"\n role=\"group\"\n [attr.aria-label]=\"field().label\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-state]=\"_state\"\n [class.c-seamless--compact]=\"_density === 'compact'\"\n [class.c-seamless--comfortable]=\"_density === 'comfortable'\"\n (click)=\"focusFromShell($event)\"\n (keydown.enter)=\"focusFromShell($event)\">\n\n <!-- Label segment: icon + field name (+ optional operator pill) -->\n <span class=\"c-seamless__label\">\n <sd-icon class=\"c-seamless__icon\" [name]=\"icon()\"></sd-icon>\n <span class=\"c-seamless__field\">{{ field().label }}</span>\n @if (showOperator() && !_isNoData) {\n <sd-operator class=\"c-seamless__op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-seamless__sep\">:</span>\n }\n </span>\n\n <!-- Input segment \u2014 seamless borderless primitive; hidden for NULL / NOT_NULL -->\n @if (!_isNoData) {\n <span class=\"c-seamless__input\">\n @if (isBetween()) {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draftFrom()\"\n (valueChange)=\"draftFrom.set($event)\"\n [placeholder]=\"phFrom()\"\n [autoId]=\"_autoId ? _autoId + '-from' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n <span class=\"c-seamless__dash\" aria-hidden=\"true\">\u2014</span>\n <sd-inline-text\n #secondInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [state]=\"_state\"\n [value]=\"draftTo()\"\n (valueChange)=\"draftTo.set($event)\"\n [placeholder]=\"phTo()\"\n [autoId]=\"_autoId ? _autoId + '-to' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"secondInput.blur()\"\n (keydownEscape)=\"revertAndBlur(secondInput)\" />\n } @else {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draft()\"\n (valueChange)=\"draft.set($event)\"\n [placeholder]=\"ph()\"\n [autoId]=\"_autoId ?? undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitSingle()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n }\n </span>\n }\n\n <!-- \u00D7 segment \u2014 pinned chips cannot be removed. -->\n @if (!pinned()) {\n <button type=\"button\" class=\"c-seamless__x\" aria-label=\"Remove filter\" (click)=\"onRemove($event)\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</span>\n", styles: [":host{display:inline-flex}.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 });
|
|
484
513
|
}
|
|
485
514
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineValueChip, decorators: [{
|
|
486
515
|
type: Component,
|
|
487
|
-
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.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 -->\n <button type=\"button\" class=\"c-seamless__x\" aria-label=\"Remove filter\" (click)=\"onRemove($event)\">\n
|
|
488
|
-
}], 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 }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], remove: [{ type: i0.Output, args: ["remove"] }], firstInput: [{ type: i0.ViewChild, args: ['firstInput', { isSignal: true }] }] } });
|
|
516
|
+
args: [{ selector: 'sd-query-inline-value-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, SdOperator, SdInlineText], template: "<!--\n Seamless string/number chip \u2014 the pill IS the input. One border, three flush\n segments: label \u00B7 input(s) \u00B7 \u00D7. State styling driven by [data-state]. The value\n field is the shared <sd-inline-text> primitive (chrome=\"seamless\") so width hugs\n content; the chip keeps the envelope + parse/commit logic.\n-->\n@let _state = state();\n@let _autoId = autoId();\n@let _isNoData = isNoData();\n@let _density = density();\n@let _operator = operator();\n\n<!-- why: v\u1ECF chip l\u00E0 m\u1ED9t NH\u00D3M control (nh\u00E3n + \u00F4 nh\u1EADp + n\u00FAt \u00D7), kh\u00F4ng ph\u1EA3i n\u00FAt \u2192 role=\"group\" +\n aria-label m\u00F4 t\u1EA3 \u0111\u00FAng c\u1EA5u tr\u00FAc v\u00E0 c\u0169ng cho bi\u1EBFt v\u00EC sao n\u00F3 KH\u00D4NG nh\u1EADn tabindex (tab \u0111i th\u1EB3ng\n v\u00E0o input b\u00EAn trong). `focusFromShell` \u0111\u00E3 t\u1EF1 lo\u1EA1i click tr\u00EAn input v\u00E0 tr\u00EAn n\u00FAt \u00D7 n\u00EAn g\u1EAFn th\u00EAm\n Enter d\u00F9ng chung handler l\u00E0 an to\u00E0n v\u00E0 ph\u1EA3n chi\u1EBFu \u0111\u00FAng h\u00E0nh vi click. -->\n<span\n class=\"c-seamless\"\n role=\"group\"\n [attr.aria-label]=\"field().label\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-state]=\"_state\"\n [class.c-seamless--compact]=\"_density === 'compact'\"\n [class.c-seamless--comfortable]=\"_density === 'comfortable'\"\n (click)=\"focusFromShell($event)\"\n (keydown.enter)=\"focusFromShell($event)\">\n\n <!-- Label segment: icon + field name (+ optional operator pill) -->\n <span class=\"c-seamless__label\">\n <sd-icon class=\"c-seamless__icon\" [name]=\"icon()\"></sd-icon>\n <span class=\"c-seamless__field\">{{ field().label }}</span>\n @if (showOperator() && !_isNoData) {\n <sd-operator class=\"c-seamless__op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-seamless__sep\">:</span>\n }\n </span>\n\n <!-- Input segment \u2014 seamless borderless primitive; hidden for NULL / NOT_NULL -->\n @if (!_isNoData) {\n <span class=\"c-seamless__input\">\n @if (isBetween()) {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draftFrom()\"\n (valueChange)=\"draftFrom.set($event)\"\n [placeholder]=\"phFrom()\"\n [autoId]=\"_autoId ? _autoId + '-from' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n <span class=\"c-seamless__dash\" aria-hidden=\"true\">\u2014</span>\n <sd-inline-text\n #secondInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [state]=\"_state\"\n [value]=\"draftTo()\"\n (valueChange)=\"draftTo.set($event)\"\n [placeholder]=\"phTo()\"\n [autoId]=\"_autoId ? _autoId + '-to' : undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitRange()\"\n (keyupEnter)=\"secondInput.blur()\"\n (keydownEscape)=\"revertAndBlur(secondInput)\" />\n } @else {\n <sd-inline-text\n #firstInput\n chrome=\"seamless\"\n [clearable]=\"false\"\n [autofocus]=\"autofocus()\"\n [state]=\"_state\"\n [value]=\"draft()\"\n (valueChange)=\"draft.set($event)\"\n [placeholder]=\"ph()\"\n [autoId]=\"_autoId ?? undefined\"\n (sdFocus)=\"onFocus()\"\n (sdBlur)=\"commitSingle()\"\n (keyupEnter)=\"firstInput.blur()\"\n (keydownEscape)=\"revertAndBlur(firstInput)\" />\n }\n </span>\n }\n\n <!-- \u00D7 segment \u2014 pinned chips cannot be removed. -->\n @if (!pinned()) {\n <button type=\"button\" class=\"c-seamless__x\" aria-label=\"Remove filter\" (click)=\"onRemove($event)\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</span>\n", styles: [":host{display:inline-flex}.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"] }]
|
|
517
|
+
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], operator: [{ type: i0.Input, args: [{ isSignal: true, alias: "operator", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], remove: [{ type: i0.Output, args: ["remove"] }], firstInput: [{ type: i0.ViewChild, args: ['firstInput', { isSignal: true }] }] } });
|
|
489
518
|
|
|
490
519
|
/**
|
|
491
520
|
* Visual block for the in-progress build chip (inline mode token builder).
|
|
@@ -583,7 +612,7 @@ class SdQueryBuildChip {
|
|
|
583
612
|
}, /* @ts-ignore */
|
|
584
613
|
...(ngDevMode ? [{ debugName: "isSeamless" }] : /* istanbul ignore next */ []));
|
|
585
614
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBuildChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
586
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBuildChip, isStandalone: true, selector: "sd-query-build-chip", inputs: { building: { classPropertyName: "building", publicName: "building", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, allowedOperators: { classPropertyName: "allowedOperators", publicName: "allowedOperators", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pickOperator: "pickOperator", commitValue: "commitValue", cancel: "cancel", seamlessCommit: "seamlessCommit", draftChange: "draftChange", draftCommit: "draftCommit" }, viewQueries: [{ propertyName: "opMenu", first: true, predicate: ["buildOperator"], descendants: true, isSignal: true }, { propertyName: "picker", first: true, predicate: ["bPicker"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n In-progress chip (inline-mode token build flow).\n Seamless string/number branch keeps its own pill; everything else renders inside\n the dashed .c-token.c-token-building shell.\n-->\n@let _building = building();\n@let _autoId = autoId();\n\n@if (isSeamless()) {\n <sd-query-inline-value-chip\n [field]=\"_building.field\"\n [operator]=\"$any(_building.operator)\"\n [value]=\"_building.value ?? null\"\n [density]=\"density()\"\n [showOperator]=\"showOperator()\"\n [autoId]=\"_autoId\"\n [autofocus]=\"true\"\n (valueChange)=\"seamlessCommit.emit($event)\"\n (remove)=\"cancel.emit()\" />\n} @else {\n <div class=\"c-token c-token-building\">\n <span class=\"c-token-field\">{{ _building.field.label }}</span>\n\n @if (_building.step === 'operator') {\n <sd-operator\n #buildOperator\n class=\"c-token-op\"\n size=\"xs\"\n [operators]=\"allowedOperators()\"\n [model]=\"_building.operator\"\n (modelChange)=\"pickOperator.emit($any($event))\" />\n } @else {\n <!-- why: operator \u0111\u00E3 ch\u1ECDn hi\u1EC7n nh\u01B0 chip ho\u00E0n th\u00E0nh \u2014 glyph ch\u1EC9-xem c\u00F3 t\u00EAn v\u00E0 tooltip (readonly), kh\u00F4ng ph\u1EA3i n\u00FAt\n disabled n\u00EAn tooltip v\u1EABn ch\u1EA1y. -->\n <sd-operator\n class=\"c-token-op\"\n [operators]=\"[$any(_building.operator)]\"\n [model]=\"$any(_building.operator)\"\n size=\"xs\"\n readonly />\n\n @if (_building.field.type === 'values' || _building.field.type === 'lazy-values') {\n @let _bopt = $any(_building.field).option;\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_building.field.type === 'lazy-values' ? $any(_bopt).search : $any(_bopt.items)\"\n [valueField]=\"_bopt.valueField\"\n [displayField]=\"_bopt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\">\n <!-- why: build chip multi-select c\u0169ng c\u1EA7n \"head +N\" \u0111\u1EC3 g\u1ECDn (gi\u1ED1ng completed chip). -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_building.field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: 1 sd-date-range thay 2 sd-date \u2014 g\u1ECDn h\u01A1n, h\u00E0nh vi th\u1ED1ng nh\u1EA5t v\u1EDBi completed chip. -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-date #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date>\n }\n </span>\n } @else if (_building.field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: datetime BETWEEN downgrade v\u1EC1 date-range (m\u1EA5t time precision; \u0111\u00E3 th\u1ED1ng nh\u1EA5t). -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-datetime #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-datetime>\n }\n </span>\n } @else if (_building.field.type === 'boolean') {\n <!-- why: native button thay sd-button (tr\u00E1nh mat-button baseline 36px g\u00E2y tr\u00E0n).\n Pill nh\u1ECF v\u1EBD b\u1EB1ng CSS scoped trong chip \u2014 gi\u1EEF semantic colour qua class\n .c-bool-true / .c-bool-false. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_building.value === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"commitValue.emit(true)\">\n {{ $any(_building.field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_building.value === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"commitValue.emit(false)\">\n {{ $any(_building.field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <!-- Fallback (e.g. unforeseen type) \u2014 generic sd-input wired via draft outputs. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-input size=\"sm\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"draftChange.emit($event)\"\n (keyupEnter)=\"draftCommit.emit()\"></sd-input>\n </span>\n }\n }\n\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Cancel\" (click)=\"cancel.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary)}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-building{border-style:dashed}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus"], outputs: ["valueChange", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
615
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBuildChip, isStandalone: true, selector: "sd-query-build-chip", inputs: { building: { classPropertyName: "building", publicName: "building", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, allowedOperators: { classPropertyName: "allowedOperators", publicName: "allowedOperators", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pickOperator: "pickOperator", commitValue: "commitValue", cancel: "cancel", seamlessCommit: "seamlessCommit", draftChange: "draftChange", draftCommit: "draftCommit" }, viewQueries: [{ propertyName: "opMenu", first: true, predicate: ["buildOperator"], descendants: true, isSignal: true }, { propertyName: "picker", first: true, predicate: ["bPicker"], descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n In-progress chip (inline-mode token build flow).\n Seamless string/number branch keeps its own pill; everything else renders inside\n the dashed .c-token.c-token-building shell.\n-->\n@let _building = building();\n@let _autoId = autoId();\n\n@if (isSeamless()) {\n <sd-query-inline-value-chip\n [field]=\"_building.field\"\n [operator]=\"$any(_building.operator)\"\n [value]=\"_building.value ?? null\"\n [density]=\"density()\"\n [showOperator]=\"showOperator()\"\n [autoId]=\"_autoId\"\n [autofocus]=\"true\"\n (valueChange)=\"seamlessCommit.emit($event)\"\n (remove)=\"cancel.emit()\" />\n} @else {\n <div class=\"c-token c-token-building\">\n <span class=\"c-token-field\">{{ _building.field.label }}</span>\n\n @if (_building.step === 'operator') {\n <sd-operator\n #buildOperator\n class=\"c-token-op\"\n size=\"xs\"\n [operators]=\"allowedOperators()\"\n [model]=\"_building.operator\"\n (modelChange)=\"pickOperator.emit($any($event))\" />\n } @else {\n <!-- why: operator \u0111\u00E3 ch\u1ECDn hi\u1EC7n nh\u01B0 chip ho\u00E0n th\u00E0nh \u2014 glyph ch\u1EC9-xem c\u00F3 t\u00EAn v\u00E0 tooltip (readonly), kh\u00F4ng ph\u1EA3i n\u00FAt\n disabled n\u00EAn tooltip v\u1EABn ch\u1EA1y. -->\n <sd-operator\n class=\"c-token-op\"\n [operators]=\"[$any(_building.operator)]\"\n [model]=\"$any(_building.operator)\"\n size=\"xs\"\n readonly />\n\n @if (_building.field.type === 'values' || _building.field.type === 'lazy-values') {\n @let _bopt = $any(_building.field).option;\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_building.field.type === 'lazy-values' ? $any(_bopt).search : $any(_bopt.items)\"\n [valueField]=\"_bopt.valueField\"\n [displayField]=\"_bopt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\">\n <!-- why: build chip multi-select c\u0169ng c\u1EA7n \"head +N\" \u0111\u1EC3 g\u1ECDn (gi\u1ED1ng completed chip). -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_bopt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_building.field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: 1 sd-date-range thay 2 sd-date \u2014 g\u1ECDn h\u01A1n, h\u00E0nh vi th\u1ED1ng nh\u1EA5t v\u1EDBi completed chip. -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-date #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date>\n }\n </span>\n } @else if (_building.field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n @if (_building.operator === 'BETWEEN') {\n <!-- why: datetime BETWEEN downgrade v\u1EC1 date-range (m\u1EA5t time precision; \u0111\u00E3 th\u1ED1ng nh\u1EA5t). -->\n <sd-date-range #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-date-range>\n } @else {\n <sd-datetime #bPicker size=\"sm\" [viewed]=\"'inline'\" [clearable]=\"false\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"commitValue.emit($event)\"></sd-datetime>\n }\n </span>\n } @else if (_building.field.type === 'boolean') {\n <!-- why: native button thay sd-button (tr\u00E1nh mat-button baseline 36px g\u00E2y tr\u00E0n).\n Pill nh\u1ECF v\u1EBD b\u1EB1ng CSS scoped trong chip \u2014 gi\u1EEF semantic colour qua class\n .c-bool-true / .c-bool-false. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_building.value === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"commitValue.emit(true)\">\n {{ $any(_building.field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_building.value === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"commitValue.emit(false)\">\n {{ $any(_building.field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <!-- Fallback (e.g. unforeseen type) \u2014 generic sd-input wired via draft outputs. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-input size=\"sm\"\n [autoId]=\"_autoId\"\n [model]=\"$any(_building.value)\"\n (sdChange)=\"draftChange.emit($event)\"\n (keyupEnter)=\"draftCommit.emit()\"></sd-input>\n </span>\n }\n }\n\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Cancel\" (click)=\"cancel.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n}\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary)}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-building{border-style:dashed}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "labelPlacement", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "type", "mask", "inputmode", "autocomplete", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus", "pinned", "invalid", "describedBy"], outputs: ["valueChange", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
587
616
|
}
|
|
588
617
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBuildChip, decorators: [{
|
|
589
618
|
type: Component,
|
|
@@ -859,6 +888,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
859
888
|
], template: "<!--\n Chip popover \u2014 operator + value editor for the popover-mode chip.\n Visual layout mirrors the previous inline `<mat-menu #chipPopover>` in query-bar.\n Body branches on operator + field.type \u2014 8 paths preserved exactly.\n-->\n<mat-menu #menu=\"matMenu\" class=\"c-chip-popover\" xPosition=\"after\" yPosition=\"below\" (closed)=\"onMenuClosed()\">\n <ng-template matMenuContent>\n @let _field = field();\n @let _editingOperator = editingOperator();\n @let _editingValue = editingValue();\n @let _editingOptions = editingOptions();\n @let _editingOptionsLoading = editingOptionsLoading();\n @let _switchPickerMenu = switchPickerMenu();\n\n @if (_field) {\n <!-- why: header/body c\u1EE7a popover l\u00E0 NH\u00D3M control (role=\"group\"), kh\u00F4ng ph\u1EA3i n\u00FAt \u2014 n\u00EAn ch\u00FAng\n KH\u00D4NG \u0111\u01B0\u1EE3c nh\u1EADn tabindex; tab ph\u1EA3i \u0111i th\u1EB3ng v\u00E0o c\u00E1c control b\u00EAn trong. Th\u00EAm ch\u1EB7n Enter\n b\u00EAn c\u1EA1nh ch\u1EB7n click: c\u1EA3 hai ch\u1EC9 \u0111\u1EC3 mat-menu kh\u00F4ng t\u1EF1 \u0111\u00F3ng khi ng\u01B0\u1EDDi d\u00F9ng thao t\u00E1c trong\n popover; Escape v\u00E0 ph\u00EDm m\u0169i t\u00EAn v\u1EABn b\u1ECDt l\u00EAn \u0111\u1EC3 menu \u0111\u00F3ng/\u0111i\u1EC1u h\u01B0\u1EDBng b\u00ECnh th\u01B0\u1EDDng. -->\n <div class=\"c-pop-header\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown.enter)=\"$event.stopPropagation()\">\n <sd-icon [name]=\"iconFor(_field)\"></sd-icon>\n <!-- why: nested mat-menu trigger to swap the chip's field \u2014 parent provides\n the field-picker MatMenu via [switchPickerMenu]. -->\n @if (_switchPickerMenu) {\n <button\n type=\"button\"\n class=\"c-pop-header-field\"\n [matMenuTriggerFor]=\"_switchPickerMenu\"\n [matTooltip]=\"swapFieldTooltip()\">\n <span>{{ _field.label }}</span>\n <sd-icon name=\"unfold_more\"></sd-icon>\n </button>\n } @else {\n <span class=\"c-pop-header-field\">{{ _field.label }}</span>\n }\n <!-- Operator selector (right-aligned). Disabled when field has \u22641 operator. -->\n <sd-operator\n class=\"c-pop-header-operator\"\n size=\"sm\"\n [autoId]=\"chipAutoId('operator')\"\n [operators]=\"allowedOperators()\"\n [model]=\"_editingOperator\"\n [disabled]=\"!showOperatorSelector()\"\n (modelChange)=\"onEditingOperatorChange($any($event))\" />\n </div>\n\n <div class=\"c-pop-body\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown.enter)=\"$event.stopPropagation()\">\n @if (!isNoDataOperator(_editingOperator)) {\n @if (_editingOperator === 'BETWEEN') {\n @if (_field.type === 'date') {\n <div class=\"c-pop-between\">\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-date>\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-date>\n </div>\n } @else if (_field.type === 'datetime') {\n <div class=\"c-pop-between\">\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-datetime>\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-datetime>\n </div>\n } @else {\n <div class=\"c-pop-between\">\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-from')\"\n [placeholder]=\"fromPlaceholder()\"\n [model]=\"$any(_editingValue)?.from\"\n (sdChange)=\"onEditingRangeFrom($event)\">\n </sd-input-number>\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value-to')\"\n [placeholder]=\"toPlaceholder()\"\n [model]=\"$any(_editingValue)?.to\"\n (sdChange)=\"onEditingRangeTo($event)\">\n </sd-input-number>\n </div>\n }\n } @else if (_field.type === 'boolean') {\n <div class=\"c-pop-boolean c-bool-toggle\">\n <sd-button\n [autoId]=\"chipAutoId('value-true')\"\n [type]=\"_editingValue === true ? 'fill' : 'outline'\"\n color=\"success\"\n [title]=\"$any(_field).trueLabel || booleanTrueLabel()\"\n (click)=\"onEditingValueInput(true)\">\n </sd-button>\n <sd-button\n [autoId]=\"chipAutoId('value-false')\"\n [type]=\"_editingValue === false ? 'fill' : 'outline'\"\n color=\"warning\"\n [title]=\"$any(_field).falseLabel || booleanFalseLabel()\"\n (click)=\"onEditingValueInput(false)\">\n </sd-button>\n </div>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <sd-select size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [items]=\"_editingOptions\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"multiple()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-select>\n @if (_editingOptionsLoading) {\n <div class=\"c-pop-values-loading\">{{ loadingValuesLabel() }}</div>\n }\n } @else if (_field.type === 'date') {\n <sd-date size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-date>\n } @else if (_field.type === 'datetime') {\n <sd-datetime size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"selectValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-datetime>\n } @else if (_field.type === 'number') {\n <sd-input-number size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input-number>\n } @else {\n <sd-input size=\"sm\" hideInlineError\n [autoId]=\"chipAutoId('value')\"\n [placeholder]=\"enterValuePlaceholder()\"\n [model]=\"$any(_editingValue)\"\n (sdChange)=\"onEditingValueInput($event)\">\n </sd-input>\n }\n }\n </div>\n }\n </ng-template>\n</mat-menu>\n", styles: [":host{display:contents}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle{display:inline-flex;align-items:center;gap:4px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle .mdc-button,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-button],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-stroked-button],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-bool-toggle button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n"] }]
|
|
860
889
|
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], chipIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipIndex", required: false }] }], autoIdBase: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoIdBase", required: false }] }], switchPickerMenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "switchPickerMenu", required: false }] }], commit: [{ type: i0.Output, args: ["commit"] }], swapField: [{ type: i0.Output, args: ["swapField"] }], menu: [{ type: i0.ViewChild, args: ['menu', { isSignal: true }] }] } });
|
|
861
890
|
|
|
891
|
+
/** More fields than this get a find box at the top of the picker. */
|
|
892
|
+
const FIND_THRESHOLD = 8;
|
|
893
|
+
/** Keys the find box leaves to mat-menu: close, move into the list, leave the menu. */
|
|
894
|
+
const MENU_KEYS = new Set(['Escape', 'ArrowDown', 'ArrowUp', 'Tab']);
|
|
862
895
|
/**
|
|
863
896
|
* Field picker mat-menu for `sd-query-bar`.
|
|
864
897
|
*
|
|
@@ -873,8 +906,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
873
906
|
*/
|
|
874
907
|
class SdQueryFieldPicker {
|
|
875
908
|
#i18n = inject(I18nService);
|
|
909
|
+
#injector = inject(Injector);
|
|
876
910
|
emptyLabel = computed(() => this.#i18n.t('core.component.query-bar.field-empty'), /* @ts-ignore */
|
|
877
911
|
...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
912
|
+
findLabel = computed(() => this.#i18n.t('core.component.query-bar.find-field'), /* @ts-ignore */
|
|
913
|
+
...(ngDevMode ? [{ debugName: "findLabel" }] : /* istanbul ignore next */ []));
|
|
878
914
|
/** Field list shown in the menu (caller-supplied; rendered in input order). */
|
|
879
915
|
fields = input([], /* @ts-ignore */
|
|
880
916
|
...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
@@ -890,6 +926,53 @@ class SdQueryFieldPicker {
|
|
|
890
926
|
menu = viewChild.required(MatMenu, /* @ts-ignore */
|
|
891
927
|
...(ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []));
|
|
892
928
|
iconFor = sdQueryFieldIcon;
|
|
929
|
+
// ---------------------------------------------------------------------------
|
|
930
|
+
// Groups + find box (long field lists, e.g. sd-table "Bộ lọc" / "Cột")
|
|
931
|
+
// ---------------------------------------------------------------------------
|
|
932
|
+
/** Text typed in the find box; reset when the menu closes. */
|
|
933
|
+
query = signal('', /* @ts-ignore */
|
|
934
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
935
|
+
/** Find box above more than eight fields. */
|
|
936
|
+
searchable = computed(() => this.fields().length > FIND_THRESHOLD, /* @ts-ignore */
|
|
937
|
+
...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
938
|
+
/** Fields grouped by `field.group` in order of first appearance, filtered by the find box. */
|
|
939
|
+
groups = computed(() => {
|
|
940
|
+
const term = this.searchable() ? sdNormalizeSearchText(this.query().trim()) : '';
|
|
941
|
+
const groups = [];
|
|
942
|
+
const byLabel = new Map();
|
|
943
|
+
for (const field of this.fields()) {
|
|
944
|
+
if (term && !sdNormalizeSearchText(field.label).includes(term))
|
|
945
|
+
continue;
|
|
946
|
+
const label = field.group ?? '';
|
|
947
|
+
let group = byLabel.get(label);
|
|
948
|
+
if (!group) {
|
|
949
|
+
group = { label, fields: [] };
|
|
950
|
+
byLabel.set(label, group);
|
|
951
|
+
groups.push(group);
|
|
952
|
+
}
|
|
953
|
+
group.fields.push(field);
|
|
954
|
+
}
|
|
955
|
+
return groups;
|
|
956
|
+
}, /* @ts-ignore */
|
|
957
|
+
...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
958
|
+
/** One group needs no heading. Counted on the whole list so filtering does not hide headings. */
|
|
959
|
+
showGroupHeadings = computed(() => new Set(this.fields().map(field => field.group ?? '')).size > 1, /* @ts-ignore */
|
|
960
|
+
...(ngDevMode ? [{ debugName: "showGroupHeadings" }] : /* istanbul ignore next */ []));
|
|
961
|
+
findInput = viewChild('findInput', /* @ts-ignore */
|
|
962
|
+
...(ngDevMode ? [{ debugName: "findInput" }] : /* istanbul ignore next */ []));
|
|
963
|
+
/**
|
|
964
|
+
* Called by the trigger's `(menuOpened)`: land in the find box. why: mat-menu focuses its first
|
|
965
|
+
* item after rendering (afterNextRender), so the find box takes focus in a later render callback.
|
|
966
|
+
*/
|
|
967
|
+
focusFind() {
|
|
968
|
+
if (!this.searchable())
|
|
969
|
+
return;
|
|
970
|
+
afterNextRender(() => this.findInput()?.nativeElement.focus(), { injector: this.#injector });
|
|
971
|
+
}
|
|
972
|
+
onFindKeydown(event) {
|
|
973
|
+
if (!MENU_KEYS.has(event.key))
|
|
974
|
+
event.stopPropagation();
|
|
975
|
+
}
|
|
893
976
|
/** Per-field disabled state — current key OR used key OR field's own disabled flag. */
|
|
894
977
|
disabledMap = computed(() => {
|
|
895
978
|
const set = new Set(this.usedKeys());
|
|
@@ -911,12 +994,12 @@ class SdQueryFieldPicker {
|
|
|
911
994
|
return this.usedKeys().has(field.key);
|
|
912
995
|
}
|
|
913
996
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryFieldPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
914
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryFieldPicker, isStandalone: true, selector: "sd-query-field-picker", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, currentKey: { classPropertyName: "currentKey", publicName: "currentKey", isSignal: true, isRequired: false, transformFunction: null }, usedKeys: { classPropertyName: "usedKeys", publicName: "usedKeys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pick: "pick" }, viewQueries: [{ propertyName: "menu", first: true, predicate: MatMenu, descendants: true, isSignal: true }], ngImport: i0, template: "<mat-menu #m=\"matMenu\" xPosition=\"after\" yPosition=\"below\" class=\"c-field-picker-menu\">\n @
|
|
997
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryFieldPicker, isStandalone: true, selector: "sd-query-field-picker", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, currentKey: { classPropertyName: "currentKey", publicName: "currentKey", isSignal: true, isRequired: false, transformFunction: null }, usedKeys: { classPropertyName: "usedKeys", publicName: "usedKeys", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pick: "pick" }, viewQueries: [{ propertyName: "menu", first: true, predicate: MatMenu, descendants: true, isSignal: true }, { propertyName: "findInput", first: true, predicate: ["findInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<mat-menu #m=\"matMenu\" xPosition=\"after\" yPosition=\"below\" class=\"c-field-picker-menu\" (closed)=\"query.set('')\">\n @if (searchable()) {\n <!-- why: \u00F4 l\u1ECDc n\u1EB1m trong mat-menu \u2014 ch\u1EB7n click (menu t\u1EF1 \u0111\u00F3ng) v\u00E0 ph\u00EDm g\u00F5 (typeahead c\u1EE7a menu\n s\u1EBD nh\u1EA3y focus sang m\u1EE5c), ch\u1EC9 \u0111\u1EC3 Escape / m\u0169i t\u00EAn xu\u1ED1ng / Tab \u0111i ti\u1EBFp cho menu. -->\n <div class=\"c-field-find\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown)=\"onFindKeydown($event)\">\n <sd-icon class=\"c-field-find-icon\" name=\"search\"></sd-icon>\n <input\n #findInput\n class=\"c-field-find-input\"\n type=\"text\"\n autocomplete=\"off\"\n [placeholder]=\"findLabel()\"\n [attr.aria-label]=\"findLabel()\"\n [value]=\"query()\"\n (input)=\"query.set(findInput.value)\" />\n </div>\n }\n @for (group of groups(); track group.label) {\n @if (showGroupHeadings()) {\n <div class=\"c-field-group\" role=\"presentation\">{{ group.label }}</div>\n }\n @for (field of group.fields; track $index) {\n <button\n type=\"button\"\n mat-menu-item\n [disabled]=\"isDisabled(field)\"\n (click)=\"pick.emit(field)\">\n <sd-icon class=\"c-field-item-icon\" [name]=\"iconFor(field)\"></sd-icon>\n <span class=\"c-field-item-label\">{{ field.label }}</span>\n <span class=\"c-field-item-type\">{{ field.type }}</span>\n @if (isCurrent(field) || isUsed(field)) {\n <sd-icon class=\"c-field-item-check\" name=\"check\"></sd-icon>\n }\n </button>\n }\n } @empty {\n <div class=\"c-field-empty\">{{ emptyLabel() }}</div>\n }\n</mat-menu>\n", styles: ["::ng-deep .mat-mdc-menu-panel.c-field-picker-menu{min-width:200px;max-width:260px}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-menu-item{min-height:36px}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-menu-item .mat-mdc-menu-item-text{display:flex;align-items:center;flex:1;min-width:0}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;margin-right:8px;color:var(--sd-query-bar-text-secondary, #5f6368);flex-shrink:0}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-label{flex:1 1 auto;min-width:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-type{flex-shrink:0;margin-left:auto;padding-left:12px;font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-11, 11px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-check{flex-shrink:0;font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;margin-left:6px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-empty{padding:12px 16px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-group{padding:8px 16px 4px;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find{display:flex;align-items:center;gap:6px;margin:4px 8px;padding:0 8px;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:var(--sd-radius-6, 6px)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find:focus-within{border-color:var(--sd-primary);outline:2px solid var(--sd-focus-ring-color);outline-offset:-1px}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find-input{flex:1;min-width:0;border:0;outline:0;background:transparent;font:inherit;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { 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: "component", type: i1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
915
998
|
}
|
|
916
999
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryFieldPicker, decorators: [{
|
|
917
1000
|
type: Component,
|
|
918
|
-
args: [{ selector: 'sd-query-field-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatMenuModule], template: "<mat-menu #m=\"matMenu\" xPosition=\"after\" yPosition=\"below\" class=\"c-field-picker-menu\">\n @
|
|
919
|
-
}], propDecorators: { fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], currentKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentKey", required: false }] }], usedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "usedKeys", required: false }] }], pick: [{ type: i0.Output, args: ["pick"] }], menu: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatMenu), { isSignal: true }] }] } });
|
|
1001
|
+
args: [{ selector: 'sd-query-field-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatMenuModule], template: "<mat-menu #m=\"matMenu\" xPosition=\"after\" yPosition=\"below\" class=\"c-field-picker-menu\" (closed)=\"query.set('')\">\n @if (searchable()) {\n <!-- why: \u00F4 l\u1ECDc n\u1EB1m trong mat-menu \u2014 ch\u1EB7n click (menu t\u1EF1 \u0111\u00F3ng) v\u00E0 ph\u00EDm g\u00F5 (typeahead c\u1EE7a menu\n s\u1EBD nh\u1EA3y focus sang m\u1EE5c), ch\u1EC9 \u0111\u1EC3 Escape / m\u0169i t\u00EAn xu\u1ED1ng / Tab \u0111i ti\u1EBFp cho menu. -->\n <div class=\"c-field-find\" role=\"group\" (click)=\"$event.stopPropagation()\" (keydown)=\"onFindKeydown($event)\">\n <sd-icon class=\"c-field-find-icon\" name=\"search\"></sd-icon>\n <input\n #findInput\n class=\"c-field-find-input\"\n type=\"text\"\n autocomplete=\"off\"\n [placeholder]=\"findLabel()\"\n [attr.aria-label]=\"findLabel()\"\n [value]=\"query()\"\n (input)=\"query.set(findInput.value)\" />\n </div>\n }\n @for (group of groups(); track group.label) {\n @if (showGroupHeadings()) {\n <div class=\"c-field-group\" role=\"presentation\">{{ group.label }}</div>\n }\n @for (field of group.fields; track $index) {\n <button\n type=\"button\"\n mat-menu-item\n [disabled]=\"isDisabled(field)\"\n (click)=\"pick.emit(field)\">\n <sd-icon class=\"c-field-item-icon\" [name]=\"iconFor(field)\"></sd-icon>\n <span class=\"c-field-item-label\">{{ field.label }}</span>\n <span class=\"c-field-item-type\">{{ field.type }}</span>\n @if (isCurrent(field) || isUsed(field)) {\n <sd-icon class=\"c-field-item-check\" name=\"check\"></sd-icon>\n }\n </button>\n }\n } @empty {\n <div class=\"c-field-empty\">{{ emptyLabel() }}</div>\n }\n</mat-menu>\n", styles: ["::ng-deep .mat-mdc-menu-panel.c-field-picker-menu{min-width:200px;max-width:260px}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-menu-item{min-height:36px}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-menu-item .mat-mdc-menu-item-text{display:flex;align-items:center;flex:1;min-width:0}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;margin-right:8px;color:var(--sd-query-bar-text-secondary, #5f6368);flex-shrink:0}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-label{flex:1 1 auto;min-width:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-type{flex-shrink:0;margin-left:auto;padding-left:12px;font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-11, 11px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-item-check{flex-shrink:0;font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;margin-left:6px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-empty{padding:12px 16px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-group{padding:8px 16px 4px;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find{display:flex;align-items:center;gap:6px;margin:4px 8px;padding:0 8px;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:var(--sd-radius-6, 6px)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find:focus-within{border-color:var(--sd-primary);outline:2px solid var(--sd-focus-ring-color);outline-offset:-1px}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-query-bar-text-muted, #7a7a7a)}::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .c-field-find-input{flex:1;min-width:0;border:0;outline:0;background:transparent;font:inherit;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121)}\n"] }]
|
|
1002
|
+
}], propDecorators: { fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], currentKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentKey", required: false }] }], usedKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "usedKeys", required: false }] }], pick: [{ type: i0.Output, args: ["pick"] }], menu: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatMenu), { isSignal: true }] }], findInput: [{ type: i0.ViewChild, args: ['findInput', { isSignal: true }] }] } });
|
|
920
1003
|
|
|
921
1004
|
/**
|
|
922
1005
|
* Completed inline chip (non-string/number — those use `<sd-query-inline-value-chip>`).
|
|
@@ -969,6 +1052,15 @@ class SdQueryInlineChip {
|
|
|
969
1052
|
/** No-data operator (NULL/NOT_NULL) — hide entire value slot when true. */
|
|
970
1053
|
isNoData = input(false, /* @ts-ignore */
|
|
971
1054
|
...(ngDevMode ? [{ debugName: "isNoData" }] : /* istanbul ignore next */ []));
|
|
1055
|
+
/** Pinned chip — no × button. */
|
|
1056
|
+
pinned = input(false, /* @ts-ignore */
|
|
1057
|
+
...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
1058
|
+
/** Required chip without a value — error look, `aria-invalid`. */
|
|
1059
|
+
invalid = input(false, /* @ts-ignore */
|
|
1060
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
1061
|
+
/** Id set as `aria-describedby` (the host's required hint). */
|
|
1062
|
+
describedBy = input(undefined, /* @ts-ignore */
|
|
1063
|
+
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
972
1064
|
// ---------------------------------------------------------------------------
|
|
973
1065
|
// Outputs
|
|
974
1066
|
// ---------------------------------------------------------------------------
|
|
@@ -1036,12 +1128,12 @@ class SdQueryInlineChip {
|
|
|
1036
1128
|
this.#editing.set(false);
|
|
1037
1129
|
}
|
|
1038
1130
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1039
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineChip, isStandalone: true, selector: "sd-query-inline-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, isNoData: { classPropertyName: "isNoData", publicName: "isNoData", isSignal: true, isRequired: false, transformFunction: null } }, 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 class=\"c-token\" [class.c-token-editing]=\"_editing\">\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 <button type=\"button\" class=\"c-token-remove\" aria-label=\"Remove filter\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\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-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 });
|
|
1131
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryInlineChip, isStandalone: true, selector: "sd-query-inline-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, isNoData: { classPropertyName: "isNoData", publicName: "isNoData", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commit: "commit", commitRange: "commitRange", liveChange: "liveChange", remove: "remove" }, ngImport: i0, template: "<!--\n Completed inline chip \u2014 non-string/number/seamless branches.\n Edit lifecycle is self-managed: click enters edit + auto-opens picker,\n focusout outside the wrapper exits edit, picker emits commit single OR\n liveChange (multi) OR commitRange (BETWEEN).\n-->\n@let _field = field();\n@let _operator = operator();\n@let _data = data();\n@let _multiple = multiple();\n@let _editing = editing();\n@let _isNoData = isNoData();\n@let _autoId = autoId();\n\n<div\n class=\"c-token\"\n [class.c-token-editing]=\"_editing\"\n [class.c-token-pinned]=\"pinned()\"\n [class.c-token-invalid]=\"invalid()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\">\n <sd-icon class=\"c-token-icon\" [name]=\"iconName()\"></sd-icon>\n <span class=\"c-token-field\">{{ _field.label }}</span>\n\n @if (!_isNoData && showOperator()) {\n <sd-operator class=\"c-token-op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-token-sep\">:</span>\n }\n\n @if (!_isNoData) {\n @if (_field.type === 'boolean') {\n @if (_editing) {\n <!-- why: native button thay sd-button \u2014 mat-button MDC baseline 36px bu\u1ED9c\n ph\u1EA3i hack height/padding overrides; chip 28/32px nh\u1ECF h\u01A1n nhi\u1EC1u. T\u1EF1 v\u1EBD\n pill nh\u1ECF v\u1EDBi CSS scoped trong chip, kh\u00F4ng qua MDC, g\u1ECDn + chu\u1EA9n baseline. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_data === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"emitBoolean(true)\">\n {{ $any(_field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_data === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"emitBoolean(false)\">\n {{ $any(_field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <button type=\"button\" class=\"c-token-value\" (click)=\"enterEdit()\">{{ valueText() }}</button>\n }\n } @else if ((_field.type === 'date' || _field.type === 'datetime') && _operator === 'BETWEEN') {\n <!-- why: sd-date-range [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout (datetime downgrade v\u1EC1 date).\n Chip kh\u00F4ng wiring lifecycle n\u1EEFa; [clearable]=false v\u00EC chip c\u00F3 \u00D7 ri\u00EAng. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date-range size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitRangeCommit($any($event))\"></sd-date-range>\n </span>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <!-- why: sd-select [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout\u2192tho\u00E1t + bare editor.\n Chip kh\u00F4ng wiring lifecycle cho nh\u00E1nh n\u00E0y n\u1EEFa (b\u1ECF enterEdit/onFocusOut/bare). -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #chipPicker size=\"sm\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_field.type === 'lazy-values' ? $any(_opt).search : $any(_opt.items)\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"_multiple\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"_multiple ? emitLive($event) : emitSingleCommit($event)\">\n <!-- why: viewed mode m\u1EB7c \u0111\u1ECBnh d\u00F9ng comma-joined cho multi \u2014 qu\u00E1 d\u00E0i cho chip.\n Override b\u1EB1ng template \"head +N\" gi\u1ED1ng popover chipValueText. -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-date>\n </span>\n } @else if (_field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-datetime size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-datetime>\n </span>\n } @else {\n <!-- Fallback (unforeseen type) \u2014 read-only display via valueText. -->\n <span class=\"c-token-value\">{{ valueText() }}</span>\n }\n }\n\n @if (!pinned()) {\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Remove filter\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</div>\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token.c-token-pinned{padding-right:12px}.c-token.c-token-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId", "size", "readonly", "active", "showCode"], outputs: ["modelChange"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["operatorChange", "modelChange", "sdChange"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "labelPlacement", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "operators", "operator", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "virtualScroll", "itemSize", "hyperlink", "minWidthPanel", "hideInlineError", "hideReadError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "labelPlacement", "items", "model"], outputs: ["operatorChange", "sdReadStateChange", "modelChange", "sdChange", "sdSelection"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1040
1132
|
}
|
|
1041
1133
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryInlineChip, decorators: [{
|
|
1042
1134
|
type: Component,
|
|
1043
|
-
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 class=\"c-token\" [class.c-token-editing]=\"_editing\">\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 <button type=\"button\" class=\"c-token-remove\" aria-label=\"Remove filter\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\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-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"] }]
|
|
1044
|
-
}], 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 }] }], commit: [{ type: i0.Output, args: ["commit"] }], commitRange: [{ type: i0.Output, args: ["commitRange"] }], liveChange: [{ type: i0.Output, args: ["liveChange"] }], remove: [{ type: i0.Output, args: ["remove"] }] } });
|
|
1135
|
+
args: [{ selector: 'sd-query-inline-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, CommonModule, SdOperator, SdDate, SdDateRange, SdDatetime, SdSelect], template: "<!--\n Completed inline chip \u2014 non-string/number/seamless branches.\n Edit lifecycle is self-managed: click enters edit + auto-opens picker,\n focusout outside the wrapper exits edit, picker emits commit single OR\n liveChange (multi) OR commitRange (BETWEEN).\n-->\n@let _field = field();\n@let _operator = operator();\n@let _data = data();\n@let _multiple = multiple();\n@let _editing = editing();\n@let _isNoData = isNoData();\n@let _autoId = autoId();\n\n<div\n class=\"c-token\"\n [class.c-token-editing]=\"_editing\"\n [class.c-token-pinned]=\"pinned()\"\n [class.c-token-invalid]=\"invalid()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\">\n <sd-icon class=\"c-token-icon\" [name]=\"iconName()\"></sd-icon>\n <span class=\"c-token-field\">{{ _field.label }}</span>\n\n @if (!_isNoData && showOperator()) {\n <sd-operator class=\"c-token-op\" [operators]=\"[_operator]\" [model]=\"_operator\" size=\"xs\" readonly />\n } @else if (!_isNoData) {\n <span class=\"c-token-sep\">:</span>\n }\n\n @if (!_isNoData) {\n @if (_field.type === 'boolean') {\n @if (_editing) {\n <!-- why: native button thay sd-button \u2014 mat-button MDC baseline 36px bu\u1ED9c\n ph\u1EA3i hack height/padding overrides; chip 28/32px nh\u1ECF h\u01A1n nhi\u1EC1u. T\u1EF1 v\u1EBD\n pill nh\u1ECF v\u1EDBi CSS scoped trong chip, kh\u00F4ng qua MDC, g\u1ECDn + chu\u1EA9n baseline. -->\n <span class=\"c-token-value c-token-value-edit c-bool-toggle\">\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-true\"\n [class.c-bool-active]=\"_data === true\"\n [attr.data-autoId]=\"_autoId + '-true'\"\n (click)=\"emitBoolean(true)\">\n {{ $any(_field).trueLabel || booleanTrueLabel() }}\n </button>\n <button\n type=\"button\"\n class=\"c-bool-btn c-bool-false\"\n [class.c-bool-active]=\"_data === false\"\n [attr.data-autoId]=\"_autoId + '-false'\"\n (click)=\"emitBoolean(false)\">\n {{ $any(_field).falseLabel || booleanFalseLabel() }}\n </button>\n </span>\n } @else {\n <button type=\"button\" class=\"c-token-value\" (click)=\"enterEdit()\">{{ valueText() }}</button>\n }\n } @else if ((_field.type === 'date' || _field.type === 'datetime') && _operator === 'BETWEEN') {\n <!-- why: sd-date-range [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout (datetime downgrade v\u1EC1 date).\n Chip kh\u00F4ng wiring lifecycle n\u1EEFa; [clearable]=false v\u00EC chip c\u00F3 \u00D7 ri\u00EAng. -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date-range size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitRangeCommit($any($event))\"></sd-date-range>\n </span>\n } @else if (_field.type === 'values' || _field.type === 'lazy-values') {\n @let _opt = $any(_field).option;\n <!-- why: sd-select [viewed]=\"'inline'\" t\u1EF1 qu\u1EA3n click\u2192edit + focusout\u2192tho\u00E1t + bare editor.\n Chip kh\u00F4ng wiring lifecycle cho nh\u00E1nh n\u00E0y n\u1EEFa (b\u1ECF enterEdit/onFocusOut/bare). -->\n <span class=\"c-token-value c-token-value-edit\">\n <sd-select #chipPicker size=\"sm\" minWidthPanel=\"300px\"\n [autoId]=\"_autoId\"\n [items]=\"_field.type === 'lazy-values' ? $any(_opt).search : $any(_opt.items)\"\n [valueField]=\"_opt.valueField\"\n [displayField]=\"_opt.displayField\"\n [multiple]=\"_multiple\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"_multiple ? emitLive($event) : emitSingleCommit($event)\">\n <!-- why: viewed mode m\u1EB7c \u0111\u1ECBnh d\u00F9ng comma-joined cho multi \u2014 qu\u00E1 d\u00E0i cho chip.\n Override b\u1EB1ng template \"head +N\" gi\u1ED1ng popover chipValueText. -->\n <ng-template #sdValue let-selectedItems=\"selectedItems\">\n @if ((selectedItems?.length ?? 0) > 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span> +{{ selectedItems.length - 1 }}\n } @else if ((selectedItems?.length ?? 0) === 1) {\n <span class=\"c-token-multi-head\">{{ $any(selectedItems)[0][_opt.displayField] }}</span>\n }\n </ng-template>\n </sd-select>\n </span>\n } @else if (_field.type === 'date') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-date size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-date>\n </span>\n } @else if (_field.type === 'datetime') {\n <span class=\"c-token-value c-token-value-edit\">\n <sd-datetime size=\"sm\"\n [autoId]=\"_autoId\"\n [viewed]=\"'inline'\"\n [clearable]=\"false\"\n [model]=\"$any(_data)\"\n (sdChange)=\"emitSingleCommit($any($event))\"></sd-datetime>\n </span>\n } @else {\n <!-- Fallback (unforeseen type) \u2014 read-only display via valueText. -->\n <span class=\"c-token-value\">{{ valueText() }}</span>\n }\n }\n\n @if (!pinned()) {\n <button type=\"button\" class=\"c-token-remove\" aria-label=\"Remove filter\" (click)=\"remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n }\n</div>\n", styles: [":host{display:contents}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}:host-context(.c-density-compact) .c-token{height:28px}:host-context(.c-density-comfortable) .c-token{height:32px}.c-token.c-token-pinned{padding-right:12px}.c-token.c-token-invalid{border-color:var(--sd-query-bar-chip-danger, #d23535);background:var(--sd-query-bar-chip-danger-bg, #fff5f5);color:var(--sd-query-bar-chip-danger, #d23535)}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-btn{display:inline-flex;align-items:center;justify-content:center;height:18px;min-width:0;padding:0 8px;border:1px solid currentColor;border-radius:var(--sd-radius-999, 999px);background:transparent;font:inherit;font-size:var(--sd-font-size-11, 11px);font-weight:var(--sd-font-weight-medium, 500);line-height:1;cursor:pointer;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease}:host-context(.c-density-comfortable) .c-bool-btn{height:20px;padding:0 10px;font-size:var(--sd-font-size-12, 12px)}.c-bool-true{color:var(--sd-success)}.c-bool-false{color:var(--sd-warning)}.c-bool-active.c-bool-true{background:var(--sd-success);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-success)}.c-bool-active.c-bool-false{background:var(--sd-warning);color:var(--sd-text-on-solid, #ffffff);border-color:var(--sd-warning)}.c-bool-btn:hover:not(.c-bool-active).c-bool-true{background:var(--sd-success-light)}.c-bool-btn:hover:not(.c-bool-active).c-bool-false{background:var(--sd-warning-light)}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}:host-context(.c-density-compact) .c-token-remove{width:26px}:host-context(.c-density-comfortable) .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}\n"] }]
|
|
1136
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], isNoData: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNoData", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], commit: [{ type: i0.Output, args: ["commit"] }], commitRange: [{ type: i0.Output, args: ["commitRange"] }], liveChange: [{ type: i0.Output, args: ["liveChange"] }], remove: [{ type: i0.Output, args: ["remove"] }] } });
|
|
1045
1137
|
|
|
1046
1138
|
/**
|
|
1047
1139
|
* Compact popover-mode chip face. Click → opens the parent-supplied [menu] (mat-menu
|
|
@@ -1064,6 +1156,21 @@ class SdQueryPopoverChip {
|
|
|
1064
1156
|
/** Rendered value text for the value slot. */
|
|
1065
1157
|
valueText = input('', /* @ts-ignore */
|
|
1066
1158
|
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
1159
|
+
/** Muted text shown after the label while the chip has no value ("All" on a pinned chip). */
|
|
1160
|
+
emptyText = input('', /* @ts-ignore */
|
|
1161
|
+
...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
1162
|
+
/** Pinned chip — no remove button. */
|
|
1163
|
+
pinned = input(false, /* @ts-ignore */
|
|
1164
|
+
...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
1165
|
+
/** Read-only chip — does not open its popover. */
|
|
1166
|
+
disabled = input(false, /* @ts-ignore */
|
|
1167
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1168
|
+
/** Required chip without a value — error look, `aria-invalid`. */
|
|
1169
|
+
invalid = input(false, /* @ts-ignore */
|
|
1170
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
1171
|
+
/** Id set as `aria-describedby` (the host's required hint). */
|
|
1172
|
+
describedBy = input(undefined, /* @ts-ignore */
|
|
1173
|
+
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
1067
1174
|
/** Chip popover mat-menu instance supplied by the parent. */
|
|
1068
1175
|
menu = input.required(/* @ts-ignore */
|
|
1069
1176
|
...(ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []));
|
|
@@ -1082,25 +1189,204 @@ class SdQueryPopoverChip {
|
|
|
1082
1189
|
// closes the open one — expose open/close so the parent doesn't need a ViewChild on the
|
|
1083
1190
|
// internal MatMenuTrigger directive.
|
|
1084
1191
|
trigger = viewChild('chipTrigger', { ...(ngDevMode ? { debugName: "trigger" } : /* istanbul ignore next */ {}), read: MatMenuTrigger });
|
|
1085
|
-
|
|
1086
|
-
|
|
1192
|
+
/**
|
|
1193
|
+
* Opens the chip popover. With `returnFocusTo`, that element (e.g. the host control that asked
|
|
1194
|
+
* for the chip) gets focus back when the popover closes, instead of the chip.
|
|
1195
|
+
*/
|
|
1196
|
+
openMenu(returnFocusTo) {
|
|
1197
|
+
const trigger = this.trigger();
|
|
1198
|
+
if (!trigger)
|
|
1199
|
+
return;
|
|
1200
|
+
if (returnFocusTo) {
|
|
1201
|
+
trigger.restoreFocus = false;
|
|
1202
|
+
trigger.menuClosed.pipe(take(1)).subscribe(() => {
|
|
1203
|
+
trigger.restoreFocus = true;
|
|
1204
|
+
returnFocusTo.focus();
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
trigger.openMenu();
|
|
1087
1208
|
}
|
|
1088
1209
|
closeMenu() {
|
|
1089
1210
|
this.trigger()?.closeMenu();
|
|
1090
1211
|
}
|
|
1091
1212
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryPopoverChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1092
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryPopoverChip, isStandalone: true, selector: "sd-query-popover-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, menu: { classPropertyName: "menu", publicName: "menu", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open", remove: "remove" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["chipTrigger"], descendants: true, read: MatMenuTrigger, 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\n<div\n #chipTrigger=\"matMenuTrigger\"\n
|
|
1213
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryPopoverChip, isStandalone: true, selector: "sd-query-popover-chip", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, showOperator: { classPropertyName: "showOperator", publicName: "showOperator", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "describedBy", isSignal: true, isRequired: false, transformFunction: null }, menu: { classPropertyName: "menu", publicName: "menu", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open", remove: "remove" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["chipTrigger"], descendants: true, read: MatMenuTrigger, 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\n@if (disabled()) {\n <!-- why: chip ch\u1EC9 \u0111\u1ECDc kh\u00F4ng g\u1EAFn matMenuTrigger \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=\"matMenuTrigger\"\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-invalid]=\"_invalid\"\n [attr.aria-invalid]=\"_invalid ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-field]=\"_filterField\"\n [matTooltip]=\"_field?.label || _filterField\"\n [matMenuTriggerFor]=\"menu()\"\n (menuOpened)=\"open.emit()\"\n (keydown.enter)=\"chipTrigger.openMenu()\"\n (keydown.space)=\"$event.preventDefault(); chipTrigger.openMenu()\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n </div>\n}\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\n @if (_active && !pinned() && !disabled()) {\n <span\n role=\"button\"\n tabindex=\"0\"\n class=\"c-chip-remove\"\n aria-label=\"Remove filter\"\n (click)=\"$event.stopPropagation(); remove.emit()\"\n (keydown.enter)=\"$event.stopPropagation(); remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </span>\n }\n</ng-template>\n", styles: [":host{display:contents}.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-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 .c-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;cursor:pointer;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip .c-chip-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-chip .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: 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: 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1093
1214
|
}
|
|
1094
1215
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryPopoverChip, decorators: [{
|
|
1095
1216
|
type: Component,
|
|
1096
|
-
args: [{ selector: 'sd-query-popover-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatMenuModule, MatTooltipModule, SdOperator], 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\n<div\n #chipTrigger=\"matMenuTrigger\"\n
|
|
1097
|
-
}], 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 }] }], menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "menu", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], remove: [{ type: i0.Output, args: ["remove"] }], trigger: [{ type: i0.ViewChild, args: ['chipTrigger', { ...{ read: MatMenuTrigger }, isSignal: true }] }] } });
|
|
1217
|
+
args: [{ selector: 'sd-query-popover-chip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatMenuModule, MatTooltipModule, SdOperator, NgTemplateOutlet], 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\n@if (disabled()) {\n <!-- why: chip ch\u1EC9 \u0111\u1ECDc kh\u00F4ng g\u1EAFn matMenuTrigger \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=\"matMenuTrigger\"\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-invalid]=\"_invalid\"\n [attr.aria-invalid]=\"_invalid ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy() ?? null\"\n [attr.data-field]=\"_filterField\"\n [matTooltip]=\"_field?.label || _filterField\"\n [matMenuTriggerFor]=\"menu()\"\n (menuOpened)=\"open.emit()\"\n (keydown.enter)=\"chipTrigger.openMenu()\"\n (keydown.space)=\"$event.preventDefault(); chipTrigger.openMenu()\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n </div>\n}\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\n @if (_active && !pinned() && !disabled()) {\n <span\n role=\"button\"\n tabindex=\"0\"\n class=\"c-chip-remove\"\n aria-label=\"Remove filter\"\n (click)=\"$event.stopPropagation(); remove.emit()\"\n (keydown.enter)=\"$event.stopPropagation(); remove.emit()\">\n <sd-icon name=\"close\"></sd-icon>\n </span>\n }\n</ng-template>\n", styles: [":host{display:contents}.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-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 .c-chip-remove{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;cursor:pointer;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-chip .c-chip-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-chip .c-chip-remove:hover{background:#0000000f}\n"] }]
|
|
1218
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }], showOperator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOperator", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "describedBy", required: false }] }], menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "menu", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], remove: [{ type: i0.Output, args: ["remove"] }], trigger: [{ type: i0.ViewChild, args: ['chipTrigger', { ...{ read: MatMenuTrigger }, isSignal: true }] }] } });
|
|
1219
|
+
|
|
1220
|
+
const DATE_FORMAT = 'dd/MM/yyyy';
|
|
1221
|
+
const DATETIME_FORMAT = 'dd/MM/yyyy HH:mm';
|
|
1222
|
+
const hasValue$1 = (value) => value !== null && value !== undefined && value !== '';
|
|
1223
|
+
/**
|
|
1224
|
+
* Value text of a chip, shared by the query bar and the sd-table phone filters so both show the same string:
|
|
1225
|
+
* one value → its label; several → `first +n`; a date range in one year → `01/10 – 31/10/2026`; one open end →
|
|
1226
|
+
* `From x` / `To y`; `NULL` / `NOT_NULL` → empty.
|
|
1227
|
+
*/
|
|
1228
|
+
const ɵsdQueryChipValueText = (filter, field, context) => {
|
|
1229
|
+
if (SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
1230
|
+
return '';
|
|
1231
|
+
const data = filter.data;
|
|
1232
|
+
if (data === null || data === undefined)
|
|
1233
|
+
return '';
|
|
1234
|
+
if (filter.operator === 'BETWEEN' && data && typeof data === 'object' && !Array.isArray(data)) {
|
|
1235
|
+
return rangeText(field, data, context);
|
|
1236
|
+
}
|
|
1237
|
+
if (Array.isArray(data)) {
|
|
1238
|
+
if (data.length === 0)
|
|
1239
|
+
return '';
|
|
1240
|
+
const head = displayOne(field, data[0], context);
|
|
1241
|
+
return data.length > 1 ? `${head} +${data.length - 1}` : head;
|
|
1242
|
+
}
|
|
1243
|
+
return displayOne(field, data, context);
|
|
1244
|
+
};
|
|
1245
|
+
/** `01/10 – 31/10/2026` inside one year, `From …` / `To …` when one end is open. */
|
|
1246
|
+
const rangeText = (field, range, context) => {
|
|
1247
|
+
const hasFrom = hasValue$1(range.from);
|
|
1248
|
+
const hasTo = hasValue$1(range.to);
|
|
1249
|
+
if (field?.type === 'date' && hasFrom && hasTo) {
|
|
1250
|
+
const year = context.toFormat(range.from, 'yyyy');
|
|
1251
|
+
if (year && year === context.toFormat(range.to, 'yyyy')) {
|
|
1252
|
+
return `${context.toFormat(range.from, 'dd/MM')} – ${context.toFormat(range.to, DATE_FORMAT)}`;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
const from = hasFrom ? displayOne(field, range.from, context) : '';
|
|
1256
|
+
const to = hasTo ? displayOne(field, range.to, context) : '';
|
|
1257
|
+
if (hasFrom && hasTo)
|
|
1258
|
+
return `${from} – ${to}`;
|
|
1259
|
+
if (hasFrom)
|
|
1260
|
+
return context.t('core.component.query-bar.range.from', { value: from });
|
|
1261
|
+
if (hasTo)
|
|
1262
|
+
return context.t('core.component.query-bar.range.to', { value: to });
|
|
1263
|
+
return '';
|
|
1264
|
+
};
|
|
1265
|
+
const displayOne = (field, raw, context) => {
|
|
1266
|
+
if (!field)
|
|
1267
|
+
return String(raw);
|
|
1268
|
+
if (field.type === 'boolean') {
|
|
1269
|
+
// why: nhãn mặc định của field boolean phải theo ngôn ngữ đang chọn; consumer vẫn override
|
|
1270
|
+
// được bằng `trueLabel` / `falseLabel` trên chính field.
|
|
1271
|
+
const trueLabel = field.trueLabel ?? context.t('core.component.query-bar.boolean.true');
|
|
1272
|
+
const falseLabel = field.falseLabel ?? context.t('core.component.query-bar.boolean.false');
|
|
1273
|
+
return raw ? trueLabel : falseLabel;
|
|
1274
|
+
}
|
|
1275
|
+
if (field.type === 'date' || field.type === 'datetime') {
|
|
1276
|
+
// why: chip in đúng định dạng của sd-date / sd-datetime, không in chuỗi model `yyyy/MM/dd` hay ISO.
|
|
1277
|
+
return context.toFormat(raw, field.type === 'date' ? DATE_FORMAT : DATETIME_FORMAT) || String(raw);
|
|
1278
|
+
}
|
|
1279
|
+
if (field.type === 'values' || field.type === 'lazy-values') {
|
|
1280
|
+
const opt = field.option;
|
|
1281
|
+
const cachedOptions = context.options ?? [];
|
|
1282
|
+
const items = resolveSyncItems(opt?.items) ?? cachedOptions;
|
|
1283
|
+
const match = items.find((i) => i?.[opt.valueField] === raw);
|
|
1284
|
+
if (match)
|
|
1285
|
+
return String(match[opt.displayField]);
|
|
1286
|
+
const cached = cachedOptions.find((i) => i?.[opt.valueField] === raw);
|
|
1287
|
+
if (cached)
|
|
1288
|
+
return String(cached[opt.displayField]);
|
|
1289
|
+
return context.labels?.get(raw) ?? String(raw);
|
|
1290
|
+
}
|
|
1291
|
+
return String(raw);
|
|
1292
|
+
};
|
|
1293
|
+
const resolveSyncItems = (items) => {
|
|
1294
|
+
if (Array.isArray(items))
|
|
1295
|
+
return items;
|
|
1296
|
+
if (isSignal(items))
|
|
1297
|
+
return items();
|
|
1298
|
+
return null;
|
|
1299
|
+
};
|
|
1300
|
+
/**
|
|
1301
|
+
* Labels of `values` / `lazy-values` chip values that are not in memory (restored from a cache, a URL or the
|
|
1302
|
+
* table's filter): looked up once per field (`values` with an items function) or per field + value (`lazy-values`,
|
|
1303
|
+
* through `views` or `search`). `get` reads a signal, so a view re-renders when a lookup lands.
|
|
1304
|
+
*/
|
|
1305
|
+
class ɵSdQueryChipLabels {
|
|
1306
|
+
/** `field.key` → value → label. Replaced (not mutated) so readers re-render. */
|
|
1307
|
+
#labels = signal(new Map(), /* @ts-ignore */
|
|
1308
|
+
...(ngDevMode ? [{ debugName: "#labels" }] : /* istanbul ignore next */ []));
|
|
1309
|
+
/** Lookups already started — each runs once per field (values) or per field + value (lazy-values). */
|
|
1310
|
+
#requests = new Set();
|
|
1311
|
+
get(key) {
|
|
1312
|
+
return this.#labels().get(key);
|
|
1313
|
+
}
|
|
1314
|
+
resolve(filter, field) {
|
|
1315
|
+
if (!('field' in filter) || SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
1316
|
+
return;
|
|
1317
|
+
if (field?.type !== 'values' && field?.type !== 'lazy-values')
|
|
1318
|
+
return;
|
|
1319
|
+
const data = filter.data;
|
|
1320
|
+
const values = Array.isArray(data) ? data : hasValue$1(data) ? [data] : [];
|
|
1321
|
+
if (!values.length)
|
|
1322
|
+
return;
|
|
1323
|
+
const key = field.key;
|
|
1324
|
+
if (field.type === 'values') {
|
|
1325
|
+
const items = field.option.items;
|
|
1326
|
+
// why: mảng / signal đã đọc đồng bộ trong displayOne; chỉ hàm (Promise) mới cần nạp.
|
|
1327
|
+
if (typeof items !== 'function' || isSignal(items) || this.#requests.has(key))
|
|
1328
|
+
return;
|
|
1329
|
+
this.#requests.add(key);
|
|
1330
|
+
this.#load(field, () => items());
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
const known = this.#labels().get(key);
|
|
1334
|
+
if (values.every(value => known?.has(value)))
|
|
1335
|
+
return;
|
|
1336
|
+
const request = `${key}|${stringify(data)}`;
|
|
1337
|
+
if (this.#requests.has(request))
|
|
1338
|
+
return;
|
|
1339
|
+
this.#requests.add(request);
|
|
1340
|
+
const option = field.option;
|
|
1341
|
+
this.#load(field, () => (option.views ? option.views(values) : option.search({ type: 'VALUE', value: data })));
|
|
1342
|
+
}
|
|
1343
|
+
#load(field, load) {
|
|
1344
|
+
const option = field.option;
|
|
1345
|
+
let result;
|
|
1346
|
+
try {
|
|
1347
|
+
result = load();
|
|
1348
|
+
}
|
|
1349
|
+
catch {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
const items = isObservable(result) ? firstValueFrom(result) : Promise.resolve(result);
|
|
1353
|
+
items
|
|
1354
|
+
.then(list => {
|
|
1355
|
+
if (!Array.isArray(list) || !list.length)
|
|
1356
|
+
return;
|
|
1357
|
+
const next = new Map(this.#labels());
|
|
1358
|
+
const labels = new Map(next.get(field.key) ?? []);
|
|
1359
|
+
for (const item of list) {
|
|
1360
|
+
const value = item?.[option.valueField];
|
|
1361
|
+
if (value !== undefined)
|
|
1362
|
+
labels.set(value, String(item[option.displayField]));
|
|
1363
|
+
}
|
|
1364
|
+
next.set(field.key, labels);
|
|
1365
|
+
this.#labels.set(next);
|
|
1366
|
+
})
|
|
1367
|
+
// why: tra nhãn thất bại thì chip giữ giá trị thô — không phải lỗi của thanh.
|
|
1368
|
+
.catch(() => undefined);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
const stringify = (value) => {
|
|
1372
|
+
try {
|
|
1373
|
+
return Utilities.canonicalStringify(value);
|
|
1374
|
+
}
|
|
1375
|
+
catch {
|
|
1376
|
+
return String(value);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1098
1379
|
|
|
1099
1380
|
/** Shared empty array — stable reference so template bindings don't churn change detection. */
|
|
1100
1381
|
const EMPTY_ARRAY = [];
|
|
1382
|
+
const hasValue = (value) => value !== null && value !== undefined && value !== '';
|
|
1101
1383
|
class SdQueryBar {
|
|
1102
1384
|
#i18n = inject(I18nService);
|
|
1103
1385
|
#injector = inject(Injector);
|
|
1386
|
+
#host = inject(ElementRef);
|
|
1387
|
+
#dateTime = inject(SdDateTimeService);
|
|
1388
|
+
/** Labels of restored values (values with an items function, lazy-values). */
|
|
1389
|
+
#labels = new ɵSdQueryChipLabels();
|
|
1104
1390
|
/** All popover-mode chips in order — used to auto-open after addFilter / close before removeFilter. */
|
|
1105
1391
|
popoverChips = viewChildren(SdQueryPopoverChip, /* @ts-ignore */
|
|
1106
1392
|
...(ngDevMode ? [{ debugName: "popoverChips" }] : /* istanbul ignore next */ []));
|
|
@@ -1149,6 +1435,9 @@ class SdQueryBar {
|
|
|
1149
1435
|
/** Free-text search string. Two-way bindable via `[(search)]`. Only shown when `showSearch=true`. */
|
|
1150
1436
|
search = model('', /* @ts-ignore */
|
|
1151
1437
|
...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
|
|
1438
|
+
// why: chữ trong ô tìm trước khi người dùng bắt đầu gõ — đổi chip ở applyOn 'commit' áp dụng giá trị này, không áp
|
|
1439
|
+
// dụng phần đang gõ dở. `null`: không có gì đang gõ.
|
|
1440
|
+
#searchBase = null;
|
|
1152
1441
|
/**
|
|
1153
1442
|
* Editing mode:
|
|
1154
1443
|
* - `'popover'` (default) → compact chips; click a chip to edit operator + value in a
|
|
@@ -1188,8 +1477,11 @@ class SdQueryBar {
|
|
|
1188
1477
|
showLogicToggle = input(false, { ...(ngDevMode ? { debugName: "showLogicToggle" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1189
1478
|
/** Show "Clear all" button when at least one filter is active. */
|
|
1190
1479
|
showClearAll = input(true, { ...(ngDevMode ? { debugName: "showClearAll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1191
|
-
/**
|
|
1192
|
-
|
|
1480
|
+
/**
|
|
1481
|
+
* Render the operator label on the chip face (default: hidden — operator only visible in popover).
|
|
1482
|
+
* `'auto'`: only on chips whose field offers a choice or whose operator is not the type default.
|
|
1483
|
+
*/
|
|
1484
|
+
showOperatorOnChip = input(false, { ...(ngDevMode ? { debugName: "showOperatorOnChip" } : /* istanbul ignore next */ {}), transform: (v) => (v === 'auto' ? 'auto' : booleanAttribute(v)) });
|
|
1193
1485
|
// ---------------------------------------------------------------------------
|
|
1194
1486
|
// Outputs
|
|
1195
1487
|
// ---------------------------------------------------------------------------
|
|
@@ -1207,9 +1499,15 @@ class SdQueryBar {
|
|
|
1207
1499
|
// input đổi tham chiếu, nên đổi ngôn ngữ runtime không refresh được. `t()` đọc signal `messages()`
|
|
1208
1500
|
// nên computed tự invalidate khi `I18nService.setLanguage()` chạy.
|
|
1209
1501
|
// ---------------------------------------------------------------------------
|
|
1210
|
-
/** Placeholder của ô tìm kiếm tự do bên trái. */
|
|
1211
|
-
searchPlaceholder = computed(() => this.#i18n.t('core.component.query-bar.search-placeholder'), /* @ts-ignore */
|
|
1502
|
+
/** Placeholder của ô tìm kiếm tự do bên trái; `option.searchPlaceholder` thắng i18n. */
|
|
1503
|
+
searchPlaceholder = computed(() => this.option()?.searchPlaceholder ?? this.#i18n.t('core.component.query-bar.search-placeholder'), /* @ts-ignore */
|
|
1212
1504
|
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
1505
|
+
/** Chữ trên chip ghim đang rỗng. */
|
|
1506
|
+
allLabel = computed(() => this.#i18n.t('core.component.query-bar.all'), /* @ts-ignore */
|
|
1507
|
+
...(ngDevMode ? [{ debugName: "allLabel" }] : /* istanbul ignore next */ []));
|
|
1508
|
+
/** 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. */
|
|
1509
|
+
selectValueLabel = computed(() => this.#i18n.t('core.component.query-bar.placeholder.select-value'), /* @ts-ignore */
|
|
1510
|
+
...(ngDevMode ? [{ debugName: "selectValueLabel" }] : /* istanbul ignore next */ []));
|
|
1213
1511
|
/** Tooltip nút "+" khi consumer chưa khai `fields`. */
|
|
1214
1512
|
noFieldsLabel = computed(() => this.#i18n.t('core.component.query-bar.no-fields'), /* @ts-ignore */
|
|
1215
1513
|
...(ngDevMode ? [{ debugName: "noFieldsLabel" }] : /* istanbul ignore next */ []));
|
|
@@ -1237,6 +1535,14 @@ class SdQueryBar {
|
|
|
1237
1535
|
...(ngDevMode ? [{ debugName: "resolvedShowClearAll" }] : /* istanbul ignore next */ []));
|
|
1238
1536
|
resolvedShowOperatorOnChip = computed(() => this.option()?.showOperatorOnChip ?? this.showOperatorOnChip(), /* @ts-ignore */
|
|
1239
1537
|
...(ngDevMode ? [{ debugName: "resolvedShowOperatorOnChip" }] : /* istanbul ignore next */ []));
|
|
1538
|
+
resolvedApplyOn = computed(() => this.option()?.applyOn ?? 'search', /* @ts-ignore */
|
|
1539
|
+
...(ngDevMode ? [{ debugName: "resolvedApplyOn" }] : /* istanbul ignore next */ []));
|
|
1540
|
+
resolvedAppearance = computed(() => this.option()?.appearance ?? 'default', /* @ts-ignore */
|
|
1541
|
+
...(ngDevMode ? [{ debugName: "resolvedAppearance" }] : /* istanbul ignore next */ []));
|
|
1542
|
+
resolvedClearDisabled = computed(() => !!this.option()?.clearDisabled, /* @ts-ignore */
|
|
1543
|
+
...(ngDevMode ? [{ debugName: "resolvedClearDisabled" }] : /* istanbul ignore next */ []));
|
|
1544
|
+
resolvedInvalidHintId = computed(() => this.option()?.invalidHintId, /* @ts-ignore */
|
|
1545
|
+
...(ngDevMode ? [{ debugName: "resolvedInvalidHintId" }] : /* istanbul ignore next */ []));
|
|
1240
1546
|
constructor() {
|
|
1241
1547
|
effect(() => {
|
|
1242
1548
|
const option = this.option();
|
|
@@ -1251,6 +1557,16 @@ class SdQueryBar {
|
|
|
1251
1557
|
this.search.set(option.search);
|
|
1252
1558
|
});
|
|
1253
1559
|
});
|
|
1560
|
+
// why: chip khôi phục (cache, URL) mang id chứ không mang nhãn; nhãn của values/lazy-values chỉ có
|
|
1561
|
+
// khi popover nạp option. Tra một lần cho mỗi giá trị lạ để chip không hiện id thô.
|
|
1562
|
+
effect(() => {
|
|
1563
|
+
const filters = this.filters();
|
|
1564
|
+
const fields = this.fieldByKey();
|
|
1565
|
+
untracked(() => {
|
|
1566
|
+
for (const filter of filters)
|
|
1567
|
+
this.#labels.resolve(filter, 'field' in filter ? fields[filter.field] : undefined);
|
|
1568
|
+
});
|
|
1569
|
+
});
|
|
1254
1570
|
}
|
|
1255
1571
|
fieldByKey = computed(() => {
|
|
1256
1572
|
const map = {};
|
|
@@ -1269,11 +1585,42 @@ class SdQueryBar {
|
|
|
1269
1585
|
return set;
|
|
1270
1586
|
}, /* @ts-ignore */
|
|
1271
1587
|
...(ngDevMode ? [{ debugName: "usedFieldKeys" }] : /* istanbul ignore next */ []));
|
|
1588
|
+
/** Fields the user can add: pinned fields always have their chip, so the picker leaves them out. */
|
|
1589
|
+
pickerFields = computed(() => {
|
|
1590
|
+
const fields = this.resolvedFields();
|
|
1591
|
+
// why: giữ nguyên ref khi không có field ghim để picker (OnPush) không bị dirty vô cớ.
|
|
1592
|
+
return fields.some(field => field.pinned) ? fields.filter(field => !field.pinned) : fields;
|
|
1593
|
+
}, /* @ts-ignore */
|
|
1594
|
+
...(ngDevMode ? [{ debugName: "pickerFields" }] : /* istanbul ignore next */ []));
|
|
1595
|
+
/** "+" is disabled when nothing is left to add. */
|
|
1596
|
+
addDisabled = computed(() => {
|
|
1597
|
+
const fields = this.pickerFields();
|
|
1598
|
+
const used = this.usedFieldKeys();
|
|
1599
|
+
return fields.length === 0 || fields.every(field => used.has(field.key));
|
|
1600
|
+
}, /* @ts-ignore */
|
|
1601
|
+
...(ngDevMode ? [{ debugName: "addDisabled" }] : /* istanbul ignore next */ []));
|
|
1602
|
+
/** Required fields without a chip value. The host renders the explanation from this list. */
|
|
1603
|
+
invalidFields = computed(() => {
|
|
1604
|
+
const required = this.resolvedFields().filter(field => field.required);
|
|
1605
|
+
if (!required.length)
|
|
1606
|
+
return EMPTY_ARRAY;
|
|
1607
|
+
const filled = new Set();
|
|
1608
|
+
for (const filter of this.filters()) {
|
|
1609
|
+
if ('field' in filter && this.isFilterActive(filter))
|
|
1610
|
+
filled.add(filter.field);
|
|
1611
|
+
}
|
|
1612
|
+
const invalid = required.filter(field => !filled.has(field.key));
|
|
1613
|
+
return invalid.length ? invalid : EMPTY_ARRAY;
|
|
1614
|
+
}, /* @ts-ignore */
|
|
1615
|
+
...(ngDevMode ? [{ debugName: "invalidFields" }] : /* istanbul ignore next */ []));
|
|
1616
|
+
/** Chips holding a value — the number shown in the clear-all label. */
|
|
1617
|
+
activeCount = computed(() => this.filters().filter(filter => this.isFilterActive(filter)).length, /* @ts-ignore */
|
|
1618
|
+
...(ngDevMode ? [{ debugName: "activeCount" }] : /* istanbul ignore next */ []));
|
|
1272
1619
|
/** Render the global AND/OR connector text between chips when `logic === 'OR'`. */
|
|
1273
1620
|
showOrConnector = computed(() => this.resolvedShowLogicToggle() && this.logic() === 'OR' && this.filters().length >= 2, /* @ts-ignore */
|
|
1274
1621
|
...(ngDevMode ? [{ debugName: "showOrConnector" }] : /* istanbul ignore next */ []));
|
|
1275
|
-
/** Search button is actionable only when there is something to apply. */
|
|
1276
|
-
canSearch = computed(() => this.filters().length > 0 || this.search().trim().length > 0, /* @ts-ignore */
|
|
1622
|
+
/** Search button is actionable only when there is something to apply and no required field is empty. */
|
|
1623
|
+
canSearch = computed(() => (this.filters().length > 0 || this.search().trim().length > 0) && this.invalidFields().length === 0, /* @ts-ignore */
|
|
1277
1624
|
...(ngDevMode ? [{ debugName: "canSearch" }] : /* istanbul ignore next */ []));
|
|
1278
1625
|
// ---------------------------------------------------------------------------
|
|
1279
1626
|
// Chip popover state — only `editingIndex` lives on the parent; the
|
|
@@ -1351,34 +1698,61 @@ class SdQueryBar {
|
|
|
1351
1698
|
// Template helpers
|
|
1352
1699
|
// ---------------------------------------------------------------------------
|
|
1353
1700
|
iconFor = sdQueryFieldIcon;
|
|
1354
|
-
/**
|
|
1701
|
+
/**
|
|
1702
|
+
* Chip is "active" when it has a non-empty value OR a no-data operator (NULL/NOT_NULL).
|
|
1703
|
+
* A BETWEEN range is active when either end is set; `{ from: null, to: null }` is empty.
|
|
1704
|
+
*/
|
|
1355
1705
|
isFilterActive(filter) {
|
|
1356
1706
|
if (SD_QUERY_NO_DATA_OPERATORS.includes(filter.operator))
|
|
1357
1707
|
return true;
|
|
1358
1708
|
const data = filter.data;
|
|
1359
1709
|
if (data === null || data === undefined || data === '')
|
|
1360
1710
|
return false;
|
|
1361
|
-
if (Array.isArray(data)
|
|
1362
|
-
return
|
|
1711
|
+
if (Array.isArray(data))
|
|
1712
|
+
return data.length > 0;
|
|
1713
|
+
if (filter.operator === 'BETWEEN' && typeof data === 'object')
|
|
1714
|
+
return hasValue(data.from) || hasValue(data.to);
|
|
1363
1715
|
return true;
|
|
1364
1716
|
}
|
|
1365
1717
|
/** Rendered value text on a chip. */
|
|
1366
1718
|
chipValueText(filter) {
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
return this
|
|
1719
|
+
const field = this.fieldOf(filter);
|
|
1720
|
+
return ɵsdQueryChipValueText(filter, field, {
|
|
1721
|
+
t: (key, params) => this.#i18n.t(key, params),
|
|
1722
|
+
toFormat: (value, format) => this.#dateTime.toFormat(value, format),
|
|
1723
|
+
options: this.chipPopover()?.editingOptions() ?? [],
|
|
1724
|
+
labels: field ? this.#labels.get(field.key) : undefined,
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
/** The field of a chip, or `undefined` for a key the bar does not know. */
|
|
1728
|
+
fieldOf(filter) {
|
|
1729
|
+
return 'field' in filter ? this.fieldByKey()[filter.field] : undefined;
|
|
1730
|
+
}
|
|
1731
|
+
/** Pinned chips have no remove button and survive removeFilter / clearAll. */
|
|
1732
|
+
isPinned(filter) {
|
|
1733
|
+
return !!this.fieldOf(filter)?.pinned;
|
|
1734
|
+
}
|
|
1735
|
+
/** Empty chip of a required field. */
|
|
1736
|
+
isInvalid(filter) {
|
|
1737
|
+
return !!this.fieldOf(filter)?.required && !this.isFilterActive(filter);
|
|
1738
|
+
}
|
|
1739
|
+
/** Text of an empty chip: "All" on a pinned chip, "Select a value" on a required one, nothing otherwise. */
|
|
1740
|
+
emptyTextFor(field) {
|
|
1741
|
+
if (field?.required)
|
|
1742
|
+
return this.selectValueLabel();
|
|
1743
|
+
return field?.pinned ? this.allLabel() : '';
|
|
1744
|
+
}
|
|
1745
|
+
/**
|
|
1746
|
+
* Whether a chip of `field` shows its operator. A boolean setting applies to every chip; `'auto'`
|
|
1747
|
+
* shows it when the field offers a choice, or when the operator is not the default of the type.
|
|
1748
|
+
*/
|
|
1749
|
+
showOperatorFor(field, operator) {
|
|
1750
|
+
const setting = this.resolvedShowOperatorOnChip();
|
|
1751
|
+
if (setting !== 'auto')
|
|
1752
|
+
return setting;
|
|
1753
|
+
if (!field)
|
|
1754
|
+
return false;
|
|
1755
|
+
return sdQueryAllowedOperators(field).length > 1 || (!!operator && operator !== SD_QUERY_DEFAULT_OPERATOR_BY_TYPE[field.type]);
|
|
1382
1756
|
}
|
|
1383
1757
|
isNoDataOperator(op) {
|
|
1384
1758
|
return SD_QUERY_NO_DATA_OPERATORS.includes(op);
|
|
@@ -1420,6 +1794,20 @@ class SdQueryBar {
|
|
|
1420
1794
|
}
|
|
1421
1795
|
const next = { field: field.key, operator, data };
|
|
1422
1796
|
this.filters.set([...this.filters(), next]);
|
|
1797
|
+
if (this.resolvedApplyOn() === 'commit' && this.isFilterActive(next))
|
|
1798
|
+
this.#applyChipChange();
|
|
1799
|
+
}
|
|
1800
|
+
/** Value committed by a completed inline chip (seamless input, picker, boolean toggle). */
|
|
1801
|
+
onInlineCommit(index, data) {
|
|
1802
|
+
const previous = this.filters()[index];
|
|
1803
|
+
this.updateFilterData(index, data);
|
|
1804
|
+
this.#applyIfChanged(previous, this.filters()[index]);
|
|
1805
|
+
}
|
|
1806
|
+
/** Range committed by a completed inline BETWEEN chip. */
|
|
1807
|
+
onInlineRange(index, ev) {
|
|
1808
|
+
const previous = this.filters()[index];
|
|
1809
|
+
this.setFilterRange(index, ev);
|
|
1810
|
+
this.#applyIfChanged(previous, this.filters()[index]);
|
|
1423
1811
|
}
|
|
1424
1812
|
/** Entry point from the field picker — start building a chip for `field`. */
|
|
1425
1813
|
beginBuild(field) {
|
|
@@ -1495,6 +1883,9 @@ class SdQueryBar {
|
|
|
1495
1883
|
// Mutations
|
|
1496
1884
|
// ---------------------------------------------------------------------------
|
|
1497
1885
|
addFilter(field) {
|
|
1886
|
+
this.#addFilter(field);
|
|
1887
|
+
}
|
|
1888
|
+
#addFilter(field, returnFocusTo) {
|
|
1498
1889
|
const operator = sdQueryDefaultOperator(field);
|
|
1499
1890
|
const data = SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null;
|
|
1500
1891
|
const next = { field: field.key, operator, data };
|
|
@@ -1502,7 +1893,38 @@ class SdQueryBar {
|
|
|
1502
1893
|
this.filters.set([...this.filters(), next]);
|
|
1503
1894
|
// why: user added a field — open its edit popover immediately so they can pick
|
|
1504
1895
|
// operator + value in one continuous flow (no second click required).
|
|
1505
|
-
afterNextRender(() => this.popoverChips()[newIndex]?.openMenu(), { injector: this.#injector });
|
|
1896
|
+
afterNextRender(() => this.popoverChips()[newIndex]?.openMenu(returnFocusTo), { injector: this.#injector });
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Opens the editor of `key` — for a host control outside the bar, such as a table header icon.
|
|
1900
|
+
* Popover mode opens the chip's popover, adding the chip first when the field has none; inline
|
|
1901
|
+
* mode focuses the chip or starts building one. `returnFocusTo` receives focus when the popover
|
|
1902
|
+
* closes, instead of the chip.
|
|
1903
|
+
*/
|
|
1904
|
+
openField(key, returnFocusTo) {
|
|
1905
|
+
const field = this.fieldByKey()[key];
|
|
1906
|
+
if (!field)
|
|
1907
|
+
return;
|
|
1908
|
+
const index = this.filters().findIndex(filter => 'field' in filter && filter.field === key);
|
|
1909
|
+
if (this.resolvedMode() === 'inline') {
|
|
1910
|
+
if (index < 0)
|
|
1911
|
+
this.beginBuild(field);
|
|
1912
|
+
else
|
|
1913
|
+
afterNextRender(() => this.#focusInlineChip(index), { injector: this.#injector });
|
|
1914
|
+
return;
|
|
1915
|
+
}
|
|
1916
|
+
if (index < 0)
|
|
1917
|
+
this.#addFilter(field, returnFocusTo ?? undefined);
|
|
1918
|
+
else
|
|
1919
|
+
this.popoverChips()[index]?.openMenu(returnFocusTo ?? undefined);
|
|
1920
|
+
}
|
|
1921
|
+
/** Clear-all button: the host's `onClearAll` when given, else the built-in clearAll(). */
|
|
1922
|
+
onClearClick() {
|
|
1923
|
+
const onClearAll = this.option()?.onClearAll;
|
|
1924
|
+
if (onClearAll)
|
|
1925
|
+
onClearAll();
|
|
1926
|
+
else
|
|
1927
|
+
this.clearAll();
|
|
1506
1928
|
}
|
|
1507
1929
|
/** Swap the field of an existing chip — reset operator + value to the new field's defaults. */
|
|
1508
1930
|
changeFilterField(index, field) {
|
|
@@ -1537,15 +1959,19 @@ class SdQueryBar {
|
|
|
1537
1959
|
const list = [...this.filters()];
|
|
1538
1960
|
if (index < 0 || index >= list.length)
|
|
1539
1961
|
return;
|
|
1962
|
+
const removed = list[index];
|
|
1963
|
+
if (this.isPinned(removed))
|
|
1964
|
+
return;
|
|
1540
1965
|
const editing = this.editingIndex();
|
|
1541
1966
|
// why: `editingIndex` là chỉ số vào mảng filters, nên mọi lần xoá ở vị trí <= nó đều làm nó
|
|
1542
1967
|
// lệch. Trước đây chỉ xử lý trường hợp bằng nhau → xoá một chip ĐỨNG TRƯỚC khiến editingIndex
|
|
1543
1968
|
// trỏ lố 1 ô và `onChipPopoverCommit` ghi giá trị staged vào SAI filter.
|
|
1544
1969
|
if (editing !== null && index <= editing) {
|
|
1545
1970
|
if (index === editing) {
|
|
1546
|
-
//
|
|
1547
|
-
|
|
1971
|
+
// why: null trước rồi mới đóng — commit mà menu phát khi đóng phải bị bỏ qua (chip sắp mất),
|
|
1972
|
+
// nếu không `applyOn: 'commit'` sẽ áp dụng giá trị nháp của một chip đang bị xoá.
|
|
1548
1973
|
this.editingIndex.set(null);
|
|
1974
|
+
this.popoverChips()[index]?.closeMenu();
|
|
1549
1975
|
}
|
|
1550
1976
|
else {
|
|
1551
1977
|
this.editingIndex.set(editing - 1);
|
|
@@ -1553,11 +1979,24 @@ class SdQueryBar {
|
|
|
1553
1979
|
}
|
|
1554
1980
|
list.splice(index, 1);
|
|
1555
1981
|
this.filters.set(list);
|
|
1982
|
+
if (this.resolvedApplyOn() === 'commit' && this.isFilterActive(removed))
|
|
1983
|
+
this.#applyChipChange();
|
|
1556
1984
|
}
|
|
1985
|
+
/** Empties the bar. Pinned chips stay, reset to their field's default operator and no value. */
|
|
1557
1986
|
clearAll() {
|
|
1558
1987
|
if (this.filters().length === 0)
|
|
1559
1988
|
return;
|
|
1560
|
-
|
|
1989
|
+
const kept = [];
|
|
1990
|
+
for (const filter of this.filters()) {
|
|
1991
|
+
const field = this.fieldOf(filter);
|
|
1992
|
+
if (!field?.pinned)
|
|
1993
|
+
continue;
|
|
1994
|
+
const operator = sdQueryDefaultOperator(field);
|
|
1995
|
+
const next = { field: field.key, operator, data: SD_QUERY_MULTI_OPERATORS.includes(operator) ? [] : null };
|
|
1996
|
+
this.#inheritRowId(filter, next);
|
|
1997
|
+
kept.push(next);
|
|
1998
|
+
}
|
|
1999
|
+
this.filters.set(kept);
|
|
1561
2000
|
this.editingIndex.set(null);
|
|
1562
2001
|
}
|
|
1563
2002
|
setLogic(value) {
|
|
@@ -1568,12 +2007,31 @@ class SdQueryBar {
|
|
|
1568
2007
|
setSearch(value) {
|
|
1569
2008
|
if (this.search() === value)
|
|
1570
2009
|
return;
|
|
2010
|
+
if (this.#searchBase === null)
|
|
2011
|
+
this.#searchBase = this.search();
|
|
1571
2012
|
this.search.set(value);
|
|
1572
2013
|
}
|
|
2014
|
+
/** Enter in the search box: applies the typed text too, unless a required field is still empty. */
|
|
2015
|
+
applySearch() {
|
|
2016
|
+
if (this.invalidFields().length)
|
|
2017
|
+
return;
|
|
2018
|
+
this.triggerApply();
|
|
2019
|
+
}
|
|
1573
2020
|
triggerApply() {
|
|
2021
|
+
this.#searchBase = null;
|
|
2022
|
+
this.#emitApply(this.#buildQuery());
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* A chip change applied at once (`applyOn: 'commit'`). It keeps the search text applied last: the text still being
|
|
2026
|
+
* typed is applied by Enter, like the quick search of sd-table.
|
|
2027
|
+
*/
|
|
2028
|
+
#applyChipChange() {
|
|
2029
|
+
const query = this.#buildQuery();
|
|
2030
|
+
this.#emitApply(this.#searchBase !== null && 'search' in query ? { ...query, search: this.#searchBase } : query);
|
|
2031
|
+
}
|
|
2032
|
+
#emitApply(q) {
|
|
1574
2033
|
// why: single deferred trigger — fire both the change notification and the reload
|
|
1575
2034
|
// signal once, from here only (mutations no longer emit).
|
|
1576
|
-
const q = this.#buildQuery();
|
|
1577
2035
|
this.option()?.onQueryChange?.(q);
|
|
1578
2036
|
this.queryChange.emit(q);
|
|
1579
2037
|
this.option()?.onApply?.(q);
|
|
@@ -1594,7 +2052,11 @@ class SdQueryBar {
|
|
|
1594
2052
|
const field = this.fieldByKey()[filter.field];
|
|
1595
2053
|
this.chipPopover()?.seed(filter, field);
|
|
1596
2054
|
}
|
|
1597
|
-
/**
|
|
2055
|
+
/**
|
|
2056
|
+
* Receive `(commit)` from the child popover — splice into filters, null the index. With
|
|
2057
|
+
* `applyOn: 'commit'` a changed chip applies at once, and an unpinned chip that closes empty is
|
|
2058
|
+
* dropped (applying only when it had a value before).
|
|
2059
|
+
*/
|
|
1598
2060
|
onChipPopoverCommit(next) {
|
|
1599
2061
|
const idx = this.editingIndex();
|
|
1600
2062
|
if (idx === null)
|
|
@@ -1603,12 +2065,23 @@ class SdQueryBar {
|
|
|
1603
2065
|
const previous = list[idx];
|
|
1604
2066
|
if (!previous)
|
|
1605
2067
|
return;
|
|
2068
|
+
const commit = this.resolvedApplyOn() === 'commit';
|
|
2069
|
+
if (commit && !this.isPinned(next) && !this.isFilterActive(next)) {
|
|
2070
|
+
list.splice(idx, 1);
|
|
2071
|
+
this.filters.set(list);
|
|
2072
|
+
this.editingIndex.set(null);
|
|
2073
|
+
if (this.isFilterActive(previous))
|
|
2074
|
+
this.#applyChipChange();
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
1606
2077
|
// why: popover chỉ đổi operator + value của CHÍNH chip đó → giữ track key, nếu không chip sẽ
|
|
1607
2078
|
// bị huỷ ngay lúc menu đóng (trigger của overlay biến mất giữa chừng).
|
|
1608
2079
|
this.#inheritRowId(previous, next);
|
|
1609
2080
|
list[idx] = next;
|
|
1610
2081
|
this.filters.set(list);
|
|
1611
2082
|
this.editingIndex.set(null);
|
|
2083
|
+
if (commit && this.#changed(previous, next))
|
|
2084
|
+
this.#applyChipChange();
|
|
1612
2085
|
}
|
|
1613
2086
|
// ---------------------------------------------------------------------------
|
|
1614
2087
|
// Internals
|
|
@@ -1620,39 +2093,33 @@ class SdQueryBar {
|
|
|
1620
2093
|
...(this.resolvedShowSearch() ? { search: this.search() } : {}),
|
|
1621
2094
|
};
|
|
1622
2095
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
if (
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
return
|
|
2096
|
+
/** Operator or value changed. Two empty chips with the same operator count as unchanged. */
|
|
2097
|
+
#changed(previous, next) {
|
|
2098
|
+
if (previous.operator !== next.operator)
|
|
2099
|
+
return true;
|
|
2100
|
+
const wasActive = this.isFilterActive(previous);
|
|
2101
|
+
if (wasActive !== this.isFilterActive(next))
|
|
2102
|
+
return true;
|
|
2103
|
+
if (!wasActive)
|
|
2104
|
+
return false;
|
|
2105
|
+
try {
|
|
2106
|
+
return Utilities.canonicalStringify(previous.data) !== Utilities.canonicalStringify(next.data);
|
|
1634
2107
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
const cachedOptions = this.chipPopover()?.editingOptions() ?? [];
|
|
1638
|
-
const items = this.#resolveSyncItems(opt?.items) ?? cachedOptions;
|
|
1639
|
-
const match = items.find((i) => i?.[opt.valueField] === raw);
|
|
1640
|
-
if (match)
|
|
1641
|
-
return String(match[opt.displayField]);
|
|
1642
|
-
const cached = cachedOptions.find((i) => i?.[opt.valueField] === raw);
|
|
1643
|
-
return cached ? String(cached[opt.displayField]) : String(raw);
|
|
2108
|
+
catch {
|
|
2109
|
+
return true;
|
|
1644
2110
|
}
|
|
1645
|
-
return String(raw);
|
|
1646
2111
|
}
|
|
1647
|
-
#
|
|
1648
|
-
if (
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
2112
|
+
#applyIfChanged(previous, next) {
|
|
2113
|
+
if (this.resolvedApplyOn() === 'commit' && previous && next && this.#changed(previous, next))
|
|
2114
|
+
this.#applyChipChange();
|
|
2115
|
+
}
|
|
2116
|
+
/** Focus the first control of the inline chip at `index` (chips render in `filters` order). */
|
|
2117
|
+
#focusInlineChip(index) {
|
|
2118
|
+
const chips = this.#host.nativeElement.querySelectorAll('sd-query-inline-value-chip, sd-query-inline-chip');
|
|
2119
|
+
chips[index]?.querySelector('input, button, [tabindex]:not([tabindex="-1"])')?.focus();
|
|
1653
2120
|
}
|
|
1654
2121
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1655
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBar, isStandalone: true, selector: "sd-query-bar", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, showOperatorOnChip: { classPropertyName: "showOperatorOnChip", publicName: "showOperatorOnChip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filters: "filtersChange", logic: "logicChange", search: "searchChange", queryChange: "queryChange", apply: "apply" }, viewQueries: [{ propertyName: "popoverChips", predicate: SdQueryPopoverChip, descendants: true, isSignal: true }, { propertyName: "buildChip", first: true, predicate: SdQueryBuildChip, descendants: true, isSignal: true }, { propertyName: "chipPopover", first: true, predicate: SdQueryChipPopover, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n sd-query-bar \u2014 unified filter chip row (Jira/Linear/Notion style).\n Visual spec: refs/design_handoff_sd_query_bar/README.md\n TODO(next-iter): replace inline placeholders for field-picker + chip-popover\n with extracted sub-components driven by CDK overlay.\n-->\n@let _filters = filters();\n@let _resolvedFields = resolvedFields();\n@let _resolvedDensity = resolvedDensity();\n@let _showOrConnector = showOrConnector();\n@let _usedFieldKeys = usedFieldKeys();\n@let _editingIndex = editingIndex();\n@let _resolvedMode = resolvedMode();\n@let _resolvedShowOperatorOnChip = resolvedShowOperatorOnChip();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\">\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)=\"triggerApply()\"\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 @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]=\"_resolvedShowOperatorOnChip\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"updateFilterData(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]=\"_resolvedShowOperatorOnChip\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"updateFilterData(i, $event)\"\n (commitRange)=\"setFilterRange(i, $event)\"\n (liveChange)=\"updateFilterData(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]=\"_resolvedShowOperatorOnChip\"\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]=\"_resolvedFields.length === 0 || _usedFieldKeys.size >= _resolvedFields.length\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\">\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 <!-- 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]=\"_resolvedShowOperatorOnChip\"\n [valueText]=\"chipValueText(filter)\"\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]=\"_resolvedFields.length === 0 || _usedFieldKeys.size >= _resolvedFields.length\"\n [matTooltip]=\"_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. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"_resolvedFields\"\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 [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n (clear)=\"clearAll()\"\n (search)=\"triggerApply()\" />\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__main{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.c-search{display:flex;align-items:center;gap:6px;min-width:220px;padding:0 10px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-control-border, var(--sd-border));border-radius:var(--sd-control-radius, 8px)}.c-search:hover{border-color:var(--sd-control-border-hover, var(--sd-border-strong))}.c-search:focus-within{border-color:var(--sd-control-border-focus, var(--sd-primary));box-shadow:var(--sd-control-ring, none);outline:none}@media(forced-colors:active){.c-search:focus-within{--sd-control-focus-ring: Highlight;outline:2px solid var(--sd-control-focus-ring);outline-offset:2px}}.c-density-compact .c-search{height:28px}.c-density-comfortable .c-search{height:32px}.c-search .c-search-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-input{flex:1;border:none;outline:none;background:transparent;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121)}.c-search .c-search-input::placeholder{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-kbd{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);padding:1px 4px;border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:3px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-divider{width:1px;height:16px;background:var(--sd-query-bar-border-soft, #e2e4e7);margin:0 2px}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}.c-density-compact .c-token{height:28px}.c-density-comfortable .c-token{height:32px}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-dash{color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 4px;line-height:1}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}.c-density-compact .c-token-remove{width:26px}.c-density-comfortable .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}.c-add-filter{display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:999px;border:1px dashed var(--sd-query-bar-border, #d6d8db);background:transparent;cursor:pointer;color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.c-density-compact .c-add-filter{width:28px;height:28px}.c-density-comfortable .c-add-filter{width:32px;height:32px}.c-add-filter sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-add-filter:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-add-filter[disabled]{opacity:.5;cursor:not-allowed}.c-or-connector{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-bold, 700);letter-spacing:.6px;color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 2px}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input{width:100%;height:32px;padding:0 10px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font-family:inherit;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121);outline:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus{border-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button.c-pop-boolean-active{background:var(--sd-primary-light);border-color:var(--sd-primary);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values{max-height:220px;overflow-y:auto;margin:0;padding:0;list-style:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:var(--sd-radius-4, 4px);font-size:var(--sd-font-size-13, 13px);cursor:pointer;-webkit-user-select:none;user-select:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li.c-pop-value-selected{background:var(--sd-primary-light);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=checkbox],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=radio]{accent-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-empty{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n", ".c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-query-bar ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "directive", type: i1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdQueryActionsBar, selector: "sd-query-actions-bar", inputs: ["showLogicToggle", "logic", "filtersCount", "showSavedFilters", "savedFiltersKey", "query", "showClearAll", "canSearch"], 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"], outputs: ["commit", "commitRange", "liveChange", "remove"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus"], outputs: ["valueChange", "remove"] }, { kind: "component", type: SdQueryPopoverChip, selector: "sd-query-popover-chip", inputs: ["field", "filter", "active", "showOperator", "valueText", "menu"], outputs: ["open", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2122
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdQueryBar, isStandalone: true, selector: "sd-query-bar", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, filters: { classPropertyName: "filters", publicName: "filters", isSignal: true, isRequired: false, transformFunction: null }, logic: { classPropertyName: "logic", publicName: "logic", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null }, showSearch: { classPropertyName: "showSearch", publicName: "showSearch", isSignal: true, isRequired: false, transformFunction: null }, showSavedFilters: { classPropertyName: "showSavedFilters", publicName: "showSavedFilters", isSignal: true, isRequired: false, transformFunction: null }, savedFiltersKey: { classPropertyName: "savedFiltersKey", publicName: "savedFiltersKey", isSignal: true, isRequired: false, transformFunction: null }, showLogicToggle: { classPropertyName: "showLogicToggle", publicName: "showLogicToggle", isSignal: true, isRequired: false, transformFunction: null }, showClearAll: { classPropertyName: "showClearAll", publicName: "showClearAll", isSignal: true, isRequired: false, transformFunction: null }, showOperatorOnChip: { classPropertyName: "showOperatorOnChip", publicName: "showOperatorOnChip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { filters: "filtersChange", logic: "logicChange", search: "searchChange", queryChange: "queryChange", apply: "apply" }, viewQueries: [{ propertyName: "popoverChips", predicate: SdQueryPopoverChip, descendants: true, isSignal: true }, { propertyName: "buildChip", first: true, predicate: SdQueryBuildChip, descendants: true, isSignal: true }, { propertyName: "chipPopover", first: true, predicate: SdQueryChipPopover, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n sd-query-bar \u2014 unified filter chip row (Jira/Linear/Notion style).\n Visual spec: refs/design_handoff_sd_query_bar/README.md\n TODO(next-iter): replace inline placeholders for field-picker + chip-popover\n with extracted sub-components driven by CDK overlay.\n-->\n@let _filters = filters();\n@let _resolvedFields = resolvedFields();\n@let _resolvedDensity = resolvedDensity();\n@let _showOrConnector = showOrConnector();\n@let _usedFieldKeys = usedFieldKeys();\n@let _editingIndex = editingIndex();\n@let _resolvedMode = resolvedMode();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n@let _addDisabled = addDisabled();\n@let _invalidHintId = resolvedInvalidHintId();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\"\n [class.c-appearance-flush]=\"resolvedAppearance() === 'flush'\">\n\n <!-- Main region \u2014 search + filters + add-filter. Wraps internally; the right\n action toolbar stays anchored and does NOT flow with this. -->\n <div class=\"c-query-bar__main\">\n\n <!-- Free-text search (left, optional) -->\n @if (resolvedShowSearch()) {\n <div class=\"c-search\">\n <sd-icon class=\"c-search-icon\" name=\"search\"></sd-icon>\n <input\n class=\"c-search-input\"\n type=\"text\"\n [ngModel]=\"search()\"\n (ngModelChange)=\"setSearch($event)\"\n (keydown.enter)=\"applySearch()\"\n [placeholder]=\"searchPlaceholder()\" />\n </div>\n <span class=\"c-divider\" aria-hidden=\"true\"></span>\n }\n\n <!-- Chip popover \u2014 extracted into <sd-query-chip-popover>. Declared BEFORE chips\n so the popover-mode @for chips can bind their [menu] to `chipPopover.menu()`.\n why: m\u1EDF popover \u0111\u1EC3 EDIT ch\u1EC9 cho ch\u1EC9nh operator + value \u2014 KH\u00D4NG \u0111\u1ED5i field.\n B\u1ECF [switchPickerMenu] \u2192 header render nh\u00E3n field t\u0129nh (read-only). Mu\u1ED1n \u0111\u1ED5i\n field th\u00EC xo\u00E1 chip r\u1ED3i th\u00EAm l\u1EA1i. -->\n <sd-query-chip-popover\n #chipPopover\n [field]=\"editingField() ?? undefined\"\n [filter]=\"_editingIndex !== null ? $any(_filters[_editingIndex!]) : undefined\"\n [chipIndex]=\"_editingIndex\"\n [autoIdBase]=\"resolvedAutoId() ?? 'qb'\"\n (commit)=\"onChipPopoverCommit($event)\" />\n\n @if (_resolvedMode === 'inline') {\n <!-- ===== INLINE MODE (GitLab-style token builder) ===== -->\n\n <!-- Completed chips.\n why: track theo rowId(filter) ch\u1EE9 KH\u00D4NG theo $index \u2014 track $index g\u1EAFn chip v\u1EDBi v\u1ECB tr\u00ED,\n n\u00EAn xo\u00E1 filter \u0111\u1EA7u ti\u00EAn s\u1EBD bind l\u1EA1i chip c\u0169 sang filter k\u1EBF ti\u1EBFp v\u00E0 k\u00E9o theo state n\u1ED9i b\u1ED9\n (inline-chip `#editing`, inline-value-chip `draft`) sang sai filter. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @if (_field) {\n @let _op = $any(filter.operator);\n @let _data = $any(filter).data;\n @let _invalid = isInvalid(filter);\n @if (_field.disabled) {\n <!-- why: chip inline l\u00E0 ch\u00EDnh \u00F4 nh\u1EADp \u2014 field b\u1ECB kho\u00E1 d\u00F9ng chip popover b\u1ECB kho\u00E1 (ch\u1EC9 hi\u1EC3n th\u1ECB), nh\u01B0 \u1EDF mode popover. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"isFilterActive(filter)\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"!!_field.pinned\"\n [disabled]=\"true\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [menu]=\"chipPopover.menu()!\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n } @else if (_field.type === 'string' || _field.type === 'number') {\n <!-- Seamless chip \u2014 the pill is the input (string / number). -->\n <sd-query-inline-value-chip\n [field]=\"_field\"\n [operator]=\"_op\"\n [value]=\"_data\"\n [density]=\"_resolvedDensity\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"!!_field.pinned\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n } @else {\n <sd-query-inline-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [density]=\"_resolvedDensity\"\n [multiple]=\"multiple(_op)\"\n [showOperator]=\"showOperatorFor(_field, _op)\"\n [pinned]=\"!!_field.pinned\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"onInlineCommit(i, $event)\"\n (commitRange)=\"onInlineRange(i, $event)\"\n (liveChange)=\"onInlineCommit(i, $event)\"\n (remove)=\"removeFilter(i)\" />\n }\n }\n }\n\n <!-- Building chip (in-progress) \u2014 extracted into <sd-query-build-chip>. -->\n @if (building(); as _b) {\n <sd-query-build-chip\n [building]=\"_b\"\n [density]=\"_resolvedDensity\"\n [allowedOperators]=\"allowedOperatorsFor(_b.field)\"\n [multiple]=\"multiple($any(_b.operator))\"\n [showOperator]=\"showOperatorFor(_b.field, _b.operator)\"\n (pickOperator)=\"pickBuildOperator($any($event))\"\n (commitValue)=\"commitBuildValue($event)\"\n (cancel)=\"cancelBuild()\"\n (seamlessCommit)=\"onBuildSeamlessCommit($event)\" />\n }\n\n <!-- Add filter -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [matMenuTriggerFor]=\"addPicker.menu()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n (menuOpened)=\"addPicker.focusFind()\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n } @else {\n <!-- ===== POPOVER MODE (default) \u2014 compact chips edited via mat-menu ===== -->\n <!-- why: track theo rowId(filter) \u2014 xem ghi ch\u00FA \u1EDF nh\u00E1nh inline. -->\n @for (filter of _filters; track rowId(filter); let i = $index) {\n @if (_showOrConnector && i > 0) {\n <span class=\"c-or-connector\" aria-hidden=\"true\">OR</span>\n }\n @let _field = fieldByKey()[$any(filter).field];\n @let _active = isFilterActive(filter);\n @let _invalid = isInvalid(filter);\n <!-- why: menu close commit is handled by chipPopover's (commit) \u2192\n onChipPopoverCommit; popover-chip only signals open + remove here. -->\n <sd-query-popover-chip\n [field]=\"_field\"\n [filter]=\"filter\"\n [active]=\"_active\"\n [showOperator]=\"showOperatorFor(_field, $any(filter.operator))\"\n [valueText]=\"chipValueText(filter)\"\n [emptyText]=\"emptyTextFor(_field)\"\n [pinned]=\"!!_field?.pinned\"\n [disabled]=\"!!_field?.disabled\"\n [invalid]=\"_invalid\"\n [describedBy]=\"_invalid ? _invalidHintId : undefined\"\n [menu]=\"chipPopover.menu()!\"\n (open)=\"openChipPopover(i)\"\n (remove)=\"removeFilter(i)\" />\n }\n\n <!-- Add filter trigger -->\n <button\n type=\"button\"\n class=\"c-add-filter\"\n [matMenuTriggerFor]=\"addPicker.menu()\"\n [disabled]=\"_addDisabled\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\"\n (menuOpened)=\"addPicker.focusFind()\">\n <sd-icon name=\"add\"></sd-icon>\n </button>\n }\n\n </div><!-- /.c-query-bar__main -->\n\n <!-- Field picker \u2014 list available fields, fade ones already in use. Pinned fields\n always have their chip, so the picker leaves them out. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"pickerFields()\"\n [usedKeys]=\"_usedFieldKeys\"\n (pick)=\"_resolvedMode === 'inline' ? beginBuild($event) : addFilter($event)\" />\n\n <sd-query-actions-bar\n [showLogicToggle]=\"resolvedShowLogicToggle()\"\n [(logic)]=\"logic\"\n [filtersCount]=\"_filters.length\"\n [clearCount]=\"activeCount()\"\n [clearDisabled]=\"resolvedClearDisabled()\"\n [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n [showSearchButton]=\"resolvedApplyOn() !== 'commit'\"\n (clear)=\"onClearClick()\"\n (search)=\"triggerApply()\" />\n\n <!-- Host content pinned after the toolbar (e.g. sd-table's quick-search right slot). -->\n <ng-content select=\"[sdQueryBarEnd]\" />\n</div>\n", styles: [":host{display:block;font-family:Roboto,system-ui,sans-serif}.c-query-bar{display:flex;align-items:flex-start;flex-wrap:nowrap;gap:8px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:var(--sd-radius-8, 8px);box-shadow:0 1px 2px #0f172a0a}.c-query-bar.c-density-compact{padding:8px}.c-query-bar.c-density-comfortable{padding:10px}.c-query-bar.c-appearance-flush{background:transparent;border:0;border-radius:0;box-shadow:none;padding:8px 12px}.c-query-bar__main{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.c-search{display:flex;align-items:center;gap:6px;min-width:220px;padding:0 10px;background:var(--sd-query-bar-bg, #ffffff);border:1px solid var(--sd-control-border, var(--sd-border));border-radius:var(--sd-control-radius, 8px)}.c-search:hover{border-color:var(--sd-control-border-hover, var(--sd-border-strong))}.c-search:focus-within{border-color:var(--sd-control-border-focus, var(--sd-primary));box-shadow:var(--sd-control-ring, none);outline:none}@media(forced-colors:active){.c-search:focus-within{--sd-control-focus-ring: Highlight;outline:2px solid var(--sd-control-focus-ring);outline-offset:2px}}.c-density-compact .c-search{height:28px}.c-density-comfortable .c-search{height:32px}.c-search .c-search-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-input{flex:1;border:none;outline:none;background:transparent;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121)}.c-search .c-search-input::placeholder{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-search .c-search-kbd{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);padding:1px 4px;border:1px solid var(--sd-query-bar-border-soft, #e2e4e7);border-radius:3px;color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-divider{width:1px;height:16px;background:var(--sd-query-bar-border-soft, #e2e4e7);margin:0 2px}.c-token{display:inline-flex;align-items:center;gap:4px;padding:0 0 0 12px;border:1px solid var(--sd-primary-light);border-radius:999px;background:var(--sd-primary-light);font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text-secondary, #5f6368);white-space:nowrap;overflow:hidden}.c-density-compact .c-token{height:28px}.c-density-comfortable .c-token{height:32px}.c-token-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px;line-height:14px;color:inherit}.c-token-field{font-weight:var(--sd-font-weight-medium, 500);line-height:1}.c-token-op{display:inline-flex;align-items:center;color:inherit}.c-token-value-edit sd-select,.c-token-value-edit sd-date,.c-token-value-edit sd-datetime{display:inline-flex;align-items:center;line-height:1}.c-token ::ng-deep .mat-mdc-form-field{line-height:1}.c-token ::ng-deep .mat-mdc-text-field-wrapper,.c-token ::ng-deep .mat-mdc-form-field-flex{padding:0;min-height:0;background:transparent}.c-token ::ng-deep .mat-mdc-form-field-infix{padding:0;min-height:0;width:auto;border:0;display:inline-flex;align-items:center}.c-token ::ng-deep .mat-mdc-select-value,.c-token ::ng-deep .mat-mdc-input-element,.c-token ::ng-deep input{line-height:1;font-size:var(--sd-font-size-13, 13px);padding:0;height:auto;color:inherit}.c-token ::ng-deep .mat-mdc-select-value{display:inline-flex;align-items:center;min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;color:var(--sd-primary);font-weight:var(--sd-font-weight-medium, 500)}.c-token ::ng-deep .sd-suffix-icon{display:none}.c-token-sep{color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-token-dash{color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 4px;line-height:1}.c-token-value{border:none;background:transparent;padding:0;font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-primary);cursor:pointer}.c-token-value:hover{text-decoration:underline}.c-token-value-edit{display:inline-flex;align-items:center;gap:4px;max-width:240px}.c-token-value-edit sd-input,.c-token-value-edit sd-input-number{display:inline-flex;max-width:140px}.c-token-value-edit sd-date-range{display:inline-flex;max-width:220px;min-width:0;flex:0 1 auto}.c-token-multi-head{display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}.c-token-remove{align-self:stretch;display:inline-flex;align-items:center;justify-content:center;border:none;border-left:1px solid rgba(0,0,0,.04);border-radius:0;background:transparent;cursor:pointer;color:inherit}.c-density-compact .c-token-remove{width:26px}.c-density-comfortable .c-token-remove{width:28px}.c-token-remove sd-icon{font-size:var(--sd-font-size-14, 14px);width:14px;height:14px}.c-token-remove:hover{background:#0000000d}.c-add-filter{display:inline-flex;align-items:center;justify-content:center;padding:0;border-radius:999px;border:1px dashed var(--sd-query-bar-border, #d6d8db);background:transparent;cursor:pointer;color:var(--sd-query-bar-text-secondary, #5f6368);transition:border-color var(--sd-duration-fast, .12s) ease,color var(--sd-duration-fast, .12s) ease,background-color var(--sd-duration-fast, .12s) ease}.c-density-compact .c-add-filter{width:28px;height:28px}.c-density-comfortable .c-add-filter{width:32px;height:32px}.c-add-filter sd-icon{font-size:var(--sd-font-size-18, 18px);width:18px;height:18px}.c-add-filter:hover:not([disabled]){border-color:var(--sd-primary);color:var(--sd-primary)}.c-add-filter[disabled]{opacity:.5;cursor:not-allowed}.c-or-connector{font-family:Roboto Mono,monospace;font-size:var(--sd-font-size-10, 10px);font-weight:var(--sd-font-weight-bold, 700);letter-spacing:.6px;color:var(--sd-query-bar-text-muted, #7a7a7a);padding:0 2px}::ng-deep .mat-mdc-menu-panel.c-chip-popover{min-width:280px;max-width:320px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--sd-query-bar-border-soft, #e2e4e7);font-size:var(--sd-font-size-13, 13px);font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header>sd-icon{font-size:var(--sd-font-size-16, 16px);width:16px;height:16px;color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header .c-pop-header-operator{margin-left:auto}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field{display:inline-flex;align-items:center;gap:4px;padding:2px 4px 2px 6px;margin-left:-4px;background:transparent;border:1px solid transparent;border-radius:var(--sd-radius-4, 4px);font:inherit;font-weight:var(--sd-font-weight-medium, 500);color:var(--sd-query-bar-text, #212121);cursor:pointer;transition:background-color var(--sd-duration-fast, .12s) ease,border-color var(--sd-duration-fast, .12s) ease}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field sd-icon{font-size:var(--sd-font-size-14, 14px)!important;width:14px!important;height:14px!important;color:var(--sd-query-bar-text-muted, #7a7a7a)!important}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-header-field:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7);border-color:var(--sd-query-bar-border-soft, #e2e4e7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-body{padding:10px 12px;display:flex;flex-direction:column;gap:12px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input{width:100%;height:32px;padding:0 10px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font-family:inherit;font-size:var(--sd-font-size-13, 13px);color:var(--sd-query-bar-text, #212121);outline:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus{border-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-input:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:1px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-between{display:grid;grid-template-columns:1fr 1fr;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean{display:flex;gap:8px}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button{flex:1;height:32px;border:1px solid var(--sd-query-bar-border, #d6d8db);border-radius:6px;background:var(--sd-query-bar-bg, #ffffff);font:inherit;font-size:var(--sd-font-size-13, 13px);cursor:pointer}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-boolean button.c-pop-boolean-active{background:var(--sd-primary-light);border-color:var(--sd-primary);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values{max-height:220px;overflow-y:auto;margin:0;padding:0;list-style:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:var(--sd-radius-4, 4px);font-size:var(--sd-font-size-13, 13px);cursor:pointer;-webkit-user-select:none;user-select:none}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li:hover{background:var(--sd-query-bar-bg-soft, #f5f6f7)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li.c-pop-value-selected{background:var(--sd-primary-light);color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=checkbox],::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values li input[type=radio]{accent-color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-loading,::ng-deep .mat-mdc-menu-panel.c-chip-popover .c-pop-values-empty{padding:10px 8px;font-size:var(--sd-font-size-12, 12px);color:var(--sd-query-bar-text-muted, #7a7a7a)}.c-bool-toggle{display:inline-flex;align-items:center;gap:4px}.c-bool-toggle ::ng-deep .mdc-button,.c-bool-toggle ::ng-deep button[mat-button],.c-bool-toggle ::ng-deep button[mat-stroked-button],.c-bool-toggle ::ng-deep button[mat-flat-button]{border-radius:var(--sd-radius-999, 999px);min-width:0;padding:0 12px}\n", ".c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-select-arrow,.c-query-bar ::ng-deep .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}.c-query-bar ::ng-deep .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field .mat-mdc-form-field-icon-suffix sd-icon{color:var(--sd-query-bar-text-secondary, #5f6368)}::ng-deep .mat-mdc-menu-panel.c-chip-popover .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow,::ng-deep .mat-mdc-menu-panel.c-field-picker-menu .mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--sd-primary)}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "directive", type: i1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdQueryActionsBar, selector: "sd-query-actions-bar", inputs: ["showLogicToggle", "logic", "filtersCount", "showSavedFilters", "savedFiltersKey", "query", "showClearAll", "clearCount", "clearDisabled", "canSearch", "showSearchButton"], outputs: ["logicChange", "applyFilter", "clear", "search"] }, { kind: "component", type: SdQueryBuildChip, selector: "sd-query-build-chip", inputs: ["building", "density", "allowedOperators", "multiple", "showOperator", "autoId"], outputs: ["pickOperator", "commitValue", "cancel", "seamlessCommit", "draftChange", "draftCommit"] }, { kind: "component", type: SdQueryChipPopover, selector: "sd-query-chip-popover", inputs: ["field", "filter", "chipIndex", "autoIdBase", "switchPickerMenu"], outputs: ["commit", "swapField"] }, { kind: "component", type: SdQueryFieldPicker, selector: "sd-query-field-picker", inputs: ["fields", "currentKey", "usedKeys"], outputs: ["pick"] }, { kind: "component", type: SdQueryInlineChip, selector: "sd-query-inline-chip", inputs: ["field", "filter", "density", "multiple", "showOperator", "autoId", "valueText", "isNoData", "pinned", "invalid", "describedBy"], outputs: ["commit", "commitRange", "liveChange", "remove"] }, { kind: "component", type: SdQueryInlineValueChip, selector: "sd-query-inline-value-chip", inputs: ["field", "operator", "value", "density", "showOperator", "autoId", "autofocus", "pinned", "invalid", "describedBy"], outputs: ["valueChange", "remove"] }, { kind: "component", type: SdQueryPopoverChip, selector: "sd-query-popover-chip", inputs: ["field", "filter", "active", "showOperator", "valueText", "emptyText", "pinned", "disabled", "invalid", "describedBy", "menu"], outputs: ["open", "remove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1656
2123
|
}
|
|
1657
2124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdQueryBar, decorators: [{
|
|
1658
2125
|
type: Component,
|
|
@@ -1669,12 +2136,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1669
2136
|
SdQueryInlineChip,
|
|
1670
2137
|
SdQueryInlineValueChip,
|
|
1671
2138
|
SdQueryPopoverChip,
|
|
1672
|
-
], 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 _resolvedShowOperatorOnChip = resolvedShowOperatorOnChip();\n@let _noFieldsLabel = noFieldsLabel();\n@let _addFilterLabel = addFilterLabel();\n\n<div\n class=\"c-query-bar\"\n [class.c-density-compact]=\"_resolvedDensity === 'compact'\"\n [class.c-density-comfortable]=\"_resolvedDensity === 'comfortable'\">\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)=\"triggerApply()\"\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 @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]=\"_resolvedShowOperatorOnChip\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n (valueChange)=\"updateFilterData(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]=\"_resolvedShowOperatorOnChip\"\n [autoId]=\"inlineAutoId(i, 'value')\"\n [valueText]=\"chipValueText(filter)\"\n [isNoData]=\"isNoDataOperator(_op)\"\n (commit)=\"updateFilterData(i, $event)\"\n (commitRange)=\"setFilterRange(i, $event)\"\n (liveChange)=\"updateFilterData(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]=\"_resolvedShowOperatorOnChip\"\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]=\"_resolvedFields.length === 0 || _usedFieldKeys.size >= _resolvedFields.length\"\n [matTooltip]=\"_resolvedFields.length === 0 ? _noFieldsLabel : _addFilterLabel\">\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 <!-- 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]=\"_resolvedShowOperatorOnChip\"\n [valueText]=\"chipValueText(filter)\"\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]=\"_resolvedFields.length === 0 || _usedFieldKeys.size >= _resolvedFields.length\"\n [matTooltip]=\"_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. -->\n <sd-query-field-picker\n #addPicker\n [fields]=\"_resolvedFields\"\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 [showSavedFilters]=\"resolvedShowSavedFilters()\"\n [savedFiltersKey]=\"resolvedSavedFiltersKey()\"\n [query]=\"currentQuery()\"\n (applyFilter)=\"onApplyFilter($event)\"\n [showClearAll]=\"resolvedShowClearAll()\"\n [canSearch]=\"canSearch()\"\n (clear)=\"clearAll()\"\n (search)=\"triggerApply()\" />\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__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"] }]
|
|
2139
|
+
], 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"] }]
|
|
1673
2140
|
}], 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"] }] } });
|
|
1674
2141
|
|
|
1675
2142
|
/**
|
|
1676
2143
|
* Generated bundle index. Do not edit.
|
|
1677
2144
|
*/
|
|
1678
2145
|
|
|
1679
|
-
export { SD_QUERY_DEFAULT_OPERATOR_BY_TYPE, SD_QUERY_MULTI_OPERATORS, SD_QUERY_NO_DATA_OPERATORS, SD_QUERY_OPERATORS_BY_TYPE, SD_QUERY_TYPE_ICON, SdQueryBar, sdQueryAllowedOperators, sdQueryDefaultOperator, sdQueryFieldIcon, sdQueryShowOperatorSelector };
|
|
2146
|
+
export { SD_QUERY_DEFAULT_OPERATOR_BY_TYPE, SD_QUERY_MULTI_OPERATORS, SD_QUERY_NO_DATA_OPERATORS, SD_QUERY_OPERATORS_BY_TYPE, SD_QUERY_TYPE_ICON, SdQueryBar, sdQueryAllowedOperators, sdQueryDefaultOperator, sdQueryFieldIcon, sdQueryShowOperatorSelector, ɵSdQueryChipLabels, ɵsdQueryChipValueText };
|
|
1680
2147
|
//# sourceMappingURL=sdcorejs-angular-components-query-bar.mjs.map
|