@shival99/z-ui 1.5.0 → 1.6.0
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/shival99-z-ui-components-z-autocomplete.mjs +533 -0
- package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-filter.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-filter.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-menu.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-popover.mjs +21 -3
- package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-select.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-table.mjs +32 -11
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-i18n.mjs +6 -0
- package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -1
- package/package.json +5 -1
- package/types/shival99-z-ui-components-z-autocomplete.d.ts +183 -0
- package/types/shival99-z-ui-components-z-calendar.d.ts +4 -4
- package/types/shival99-z-ui-components-z-popover.d.ts +4 -3
- package/types/shival99-z-ui-components-z-select.d.ts +1 -1
- package/types/shival99-z-ui-components-z-table.d.ts +9 -2
|
@@ -41,7 +41,7 @@ class ZDropdownMenuComponent {
|
|
|
41
41
|
this.popoverControl.set(control);
|
|
42
42
|
}
|
|
43
43
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZDropdownMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
44
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ZDropdownMenuComponent, isStandalone: true, selector: "z-dropdown-menu", inputs: { zItems: { classPropertyName: "zItems", publicName: "zItems", isSignal: true, isRequired: true, transformFunction: null }, zLabel: { classPropertyName: "zLabel", publicName: "zLabel", isSignal: true, isRequired: false, transformFunction: null }, zIcon: { classPropertyName: "zIcon", publicName: "zIcon", isSignal: true, isRequired: false, transformFunction: null }, zButtonType: { classPropertyName: "zButtonType", publicName: "zButtonType", isSignal: true, isRequired: false, transformFunction: null }, zPosition: { classPropertyName: "zPosition", publicName: "zPosition", isSignal: true, isRequired: false, transformFunction: null }, zButtonSize: { classPropertyName: "zButtonSize", publicName: "zButtonSize", isSignal: true, isRequired: false, transformFunction: null }, zOffset: { classPropertyName: "zOffset", publicName: "zOffset", isSignal: true, isRequired: false, transformFunction: null }, zMinWidth: { classPropertyName: "zMinWidth", publicName: "zMinWidth", isSignal: true, isRequired: false, transformFunction: null }, zMaxWidth: { classPropertyName: "zMaxWidth", publicName: "zMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, zDisabled: { classPropertyName: "zDisabled", publicName: "zDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zOnItemClick: "zOnItemClick" }, providers: [TranslatePipe], viewQueries: [{ propertyName: "contentWrapper", first: true, predicate: ["contentWrapper"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Custom trigger via ng-content -->\n<div\n #contentWrapper\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zDisabled]=\"zDisabled()\"\n (zControl)=\"onControl($event)\"\n [class.hidden]=\"!hasContent()\">\n <ng-content />\n</div>\n\n<!-- Default button trigger -->\n@if (!hasContent()) {\n <button\n type=\"button\"\n z-button\n [zType]=\"zButtonType()\"\n [zSize]=\"zButtonSize()\"\n [zDisabled]=\"zDisabled()\"\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zTypeIcon]=\"zIcon()!\"\n (zControl)=\"onControl($event)\">\n @if (zLabel()) {\n {{ zLabel() | translate }}\n }\n </button>\n}\n\n<!-- Menu content template -->\n<ng-template #menuContent let-close=\"close\">\n <div class=\"z-dropdown-menu-content p-1\" [style.min-width.px]=\"zMinWidth()\" [style.max-width.px]=\"zMaxWidth()\">\n @for (item of visibleItems(); track $index) {\n @if (item.divide === 'before' && $index > 0) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <!-- Menu item - check if has submenu -->\n @if (item.submenu && item.submenu.length > 0) {\n <!-- Menu item with nested submenu -->\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"submenuTemplate\"\n [zPosition]=\"item.submenuPosition || 'right'\"\n zTrigger=\"hover\"\n [zShowDelay]=\"200\"\n [zHideDelay]=\"100\"\n [zOffset]=\"6\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent data-[state=open]:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label | translate }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ item.shortcut | translate }}\n </span>\n }\n <z-icon zType=\"lucideChevronRight\" zSize=\"14\" class=\"ml-auto shrink-0\" />\n </button>\n\n <!-- Submenu template -->\n <ng-template #submenuTemplate>\n <div\n class=\"p-1\"\n [style.min-width.px]=\"item.subMinWidth || zMinWidth()\"\n [style.max-width.px]=\"item.subMaxWidth || zMaxWidth()\">\n @for (subItem of item.submenu; track subItem.label) {\n <!-- Nested divider before -->\n @if (subItem.divide === 'before') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <button\n type=\"button\"\n [disabled]=\"subItem.disabled\"\n [class]=\"subItem.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(subItem)\">\n @if (subItem.icon) {\n <z-icon\n [zType]=\"subItem.icon\"\n [zSize]=\"subItem.iconSize || '14'\"\n class=\"text-muted-foreground shrink-0\" />\n }\n <span\n class=\"truncate\"\n z-tooltip\n [zContent]=\"subItem.label\"\n [zShowDelay]=\"200\"\n zTrigger=\"hover\"\n zPosition=\"top\">\n {{ subItem.label }}\n </span>\n @if (subItem.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ subItem.shortcut }}\n </span>\n }\n </button>\n\n <!-- Nested divider after -->\n @if (subItem.divide === 'after') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n </ng-template>\n } @else {\n <!-- Regular menu item (no submenu) -->\n <button\n type=\"button\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(item)\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">{{ item.shortcut }}</span>\n }\n </button>\n }\n\n <!-- Divider after -->\n @if (item.divide === 'after' && $index < visibleItems().length - 1) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n</ng-template>\n", styles: [".z-dropdown-menu-content{min-width:inherit}\n"], dependencies: [{ kind: "directive", type: ZPopoverDirective, selector: "[z-popover]", inputs: ["zPopoverContent", "zPosition", "zTrigger", "zClass", "zShowDelay", "zHideDelay", "zDisabled", "zOffset", "zPopoverWidth", "zManualClose", "zScrollClose", "zShowArrow"], outputs: ["zShow", "zHide", "zHideStart", "zControl"], exportAs: ["zPopover"] }, { kind: "component", type: ZButtonComponent, selector: "z-button, button[z-button], a[z-button]", inputs: ["class", "zType", "zSize", "zShape", "zLabel", "zLoading", "zDisabled", "zTypeIcon", "zSizeIcon", "zStrokeWidthIcon", "zWave"], exportAs: ["zButton"] }, { kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "directive", type: ZTooltipDirective, selector: "[z-tooltip], [zTooltip]", inputs: ["zContent", "zPosition", "zTrigger", "zTooltipType", "zTooltipSize", "zClass", "zShowDelay", "zHideDelay", "zArrow", "zDisabled", "zOffset", "zAutoDetect", "zTriggerElement", "zAlwaysShow", "zMaxWidth"], outputs: ["zShow", "zHide"], exportAs: ["zTooltip"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
44
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ZDropdownMenuComponent, isStandalone: true, selector: "z-dropdown-menu", inputs: { zItems: { classPropertyName: "zItems", publicName: "zItems", isSignal: true, isRequired: true, transformFunction: null }, zLabel: { classPropertyName: "zLabel", publicName: "zLabel", isSignal: true, isRequired: false, transformFunction: null }, zIcon: { classPropertyName: "zIcon", publicName: "zIcon", isSignal: true, isRequired: false, transformFunction: null }, zButtonType: { classPropertyName: "zButtonType", publicName: "zButtonType", isSignal: true, isRequired: false, transformFunction: null }, zPosition: { classPropertyName: "zPosition", publicName: "zPosition", isSignal: true, isRequired: false, transformFunction: null }, zButtonSize: { classPropertyName: "zButtonSize", publicName: "zButtonSize", isSignal: true, isRequired: false, transformFunction: null }, zOffset: { classPropertyName: "zOffset", publicName: "zOffset", isSignal: true, isRequired: false, transformFunction: null }, zMinWidth: { classPropertyName: "zMinWidth", publicName: "zMinWidth", isSignal: true, isRequired: false, transformFunction: null }, zMaxWidth: { classPropertyName: "zMaxWidth", publicName: "zMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, zDisabled: { classPropertyName: "zDisabled", publicName: "zDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zOnItemClick: "zOnItemClick" }, providers: [TranslatePipe], viewQueries: [{ propertyName: "contentWrapper", first: true, predicate: ["contentWrapper"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Custom trigger via ng-content -->\n<div\n #contentWrapper\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zDisabled]=\"zDisabled()\"\n (zControl)=\"onControl($event)\"\n [class.hidden]=\"!hasContent()\">\n <ng-content />\n</div>\n\n<!-- Default button trigger -->\n@if (!hasContent()) {\n <button\n type=\"button\"\n z-button\n [zType]=\"zButtonType()\"\n [zSize]=\"zButtonSize()\"\n [zDisabled]=\"zDisabled()\"\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zTypeIcon]=\"zIcon()!\"\n (zControl)=\"onControl($event)\">\n @if (zLabel()) {\n {{ zLabel() | translate }}\n }\n </button>\n}\n\n<!-- Menu content template -->\n<ng-template #menuContent let-close=\"close\">\n <div class=\"z-dropdown-menu-content p-1\" [style.min-width.px]=\"zMinWidth()\" [style.max-width.px]=\"zMaxWidth()\">\n @for (item of visibleItems(); track $index) {\n @if (item.divide === 'before' && $index > 0) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <!-- Menu item - check if has submenu -->\n @if (item.submenu && item.submenu.length > 0) {\n <!-- Menu item with nested submenu -->\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"submenuTemplate\"\n [zPosition]=\"item.submenuPosition || 'right'\"\n zTrigger=\"hover\"\n [zShowDelay]=\"200\"\n [zHideDelay]=\"100\"\n [zOffset]=\"6\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent data-[state=open]:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label | translate }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ item.shortcut | translate }}\n </span>\n }\n <z-icon zType=\"lucideChevronRight\" zSize=\"14\" class=\"ml-auto shrink-0\" />\n </button>\n\n <!-- Submenu template -->\n <ng-template #submenuTemplate>\n <div\n class=\"p-1\"\n [style.min-width.px]=\"item.subMinWidth || zMinWidth()\"\n [style.max-width.px]=\"item.subMaxWidth || zMaxWidth()\">\n @for (subItem of item.submenu; track subItem.label) {\n <!-- Nested divider before -->\n @if (subItem.divide === 'before') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <button\n type=\"button\"\n [disabled]=\"subItem.disabled\"\n [class]=\"subItem.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(subItem)\">\n @if (subItem.icon) {\n <z-icon\n [zType]=\"subItem.icon\"\n [zSize]=\"subItem.iconSize || '14'\"\n class=\"text-muted-foreground shrink-0\" />\n }\n <span\n class=\"truncate\"\n z-tooltip\n [zContent]=\"subItem.label\"\n [zShowDelay]=\"200\"\n zTrigger=\"hover\"\n zPosition=\"top\">\n {{ subItem.label }}\n </span>\n @if (subItem.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ subItem.shortcut }}\n </span>\n }\n </button>\n\n <!-- Nested divider after -->\n @if (subItem.divide === 'after') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n </ng-template>\n } @else {\n <!-- Regular menu item (no submenu) -->\n <button\n type=\"button\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(item)\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">{{ item.shortcut }}</span>\n }\n </button>\n }\n\n <!-- Divider after -->\n @if (item.divide === 'after' && $index < visibleItems().length - 1) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n</ng-template>\n", styles: [".z-dropdown-menu-content{min-width:inherit}\n"], dependencies: [{ kind: "directive", type: ZPopoverDirective, selector: "[z-popover]", inputs: ["zPopoverContent", "zPosition", "zTrigger", "zClass", "zShowDelay", "zHideDelay", "zDisabled", "zOffset", "zPopoverWidth", "zManualClose", "zScrollClose", "zShowArrow"], outputs: ["zShow", "zHide", "zHideStart", "zControl", "zPositionChange"], exportAs: ["zPopover"] }, { kind: "component", type: ZButtonComponent, selector: "z-button, button[z-button], a[z-button]", inputs: ["class", "zType", "zSize", "zShape", "zLabel", "zLoading", "zDisabled", "zTypeIcon", "zSizeIcon", "zStrokeWidthIcon", "zWave"], exportAs: ["zButton"] }, { kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "directive", type: ZTooltipDirective, selector: "[z-tooltip], [zTooltip]", inputs: ["zContent", "zPosition", "zTrigger", "zTooltipType", "zTooltipSize", "zClass", "zShowDelay", "zHideDelay", "zArrow", "zDisabled", "zOffset", "zAutoDetect", "zTriggerElement", "zAlwaysShow", "zMaxWidth"], outputs: ["zShow", "zHide"], exportAs: ["zTooltip"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
45
45
|
}
|
|
46
46
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZDropdownMenuComponent, decorators: [{
|
|
47
47
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shival99-z-ui-components-z-dropdown-menu.mjs","sources":["../../../../libs/core-ui/components/z-dropdown-menu/z-dropdown-menu.component.ts","../../../../libs/core-ui/components/z-dropdown-menu/z-dropdown-menu.component.html","../../../../libs/core-ui/components/z-dropdown-menu/shival99-z-ui-components-z-dropdown-menu.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ZButtonComponent, ZButtonVariants } from '@shival99/z-ui/components/z-button';\nimport { ZIconComponent } from '@shival99/z-ui/components/z-icon';\nimport { type ZIcon } from '@shival99/z-ui/components/z-icon';\nimport { ZPopoverDirective } from '@shival99/z-ui/components/z-popover';\nimport { type ZPopoverPosition } from '@shival99/z-ui/components/z-popover';\nimport { ZTooltipDirective } from '@shival99/z-ui/components/z-tooltip';\nimport { ZDropdownMenuItem } from './z-dropdown-menu.types';\n\n@Component({\n selector: 'z-dropdown-menu',\n imports: [ZPopoverDirective, ZButtonComponent, ZIconComponent, ZTooltipDirective, TranslatePipe],\n standalone: true,\n templateUrl: './z-dropdown-menu.component.html',\n styleUrl: './z-dropdown-menu.component.scss',\n providers: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ZDropdownMenuComponent implements AfterContentInit {\n protected readonly contentWrapper = viewChild<ElementRef<HTMLElement>>('contentWrapper');\n\n public readonly zOnItemClick = output<ZDropdownMenuItem>();\n\n public readonly zItems = input.required<ZDropdownMenuItem[]>();\n public readonly zLabel = input<string>();\n public readonly zIcon = input<ZIcon>('lucideMenu');\n public readonly zButtonType = input<'primary' | 'secondary' | 'outline' | 'ghost'>('outline');\n public readonly zPosition = input<ZPopoverPosition>('bottom-right');\n public readonly zButtonSize = input<ZButtonVariants['zSize']>('default');\n public readonly zOffset = input<number>(4);\n public readonly zMinWidth = input<number>(224);\n public readonly zMaxWidth = input<number>(320);\n public readonly zDisabled = input<boolean>(false);\n\n protected readonly hasContent = signal(false);\n protected readonly popoverControl = signal<{ close: () => void; closeImmediate: () => void } | null>(null);\n\n protected readonly visibleItems = computed(() => this.zItems().filter(item => !item.hidden));\n\n ngAfterContentInit(): void {\n const wrapper = this.contentWrapper();\n if (wrapper) {\n const hasProjectedContent = wrapper.nativeElement.children.length > 0;\n this.hasContent.set(hasProjectedContent);\n }\n }\n\n protected onItemClick(item: ZDropdownMenuItem): void {\n if (item.disabled) {\n return;\n }\n\n item.onClick?.();\n this.zOnItemClick.emit(item);\n this.popoverControl()?.closeImmediate();\n }\n\n protected onControl(control: { close: () => void; closeImmediate: () => void }): void {\n this.popoverControl.set(control);\n }\n}\n","<!-- Custom trigger via ng-content -->\n<div\n #contentWrapper\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zDisabled]=\"zDisabled()\"\n (zControl)=\"onControl($event)\"\n [class.hidden]=\"!hasContent()\">\n <ng-content />\n</div>\n\n<!-- Default button trigger -->\n@if (!hasContent()) {\n <button\n type=\"button\"\n z-button\n [zType]=\"zButtonType()\"\n [zSize]=\"zButtonSize()\"\n [zDisabled]=\"zDisabled()\"\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zTypeIcon]=\"zIcon()!\"\n (zControl)=\"onControl($event)\">\n @if (zLabel()) {\n {{ zLabel() | translate }}\n }\n </button>\n}\n\n<!-- Menu content template -->\n<ng-template #menuContent let-close=\"close\">\n <div class=\"z-dropdown-menu-content p-1\" [style.min-width.px]=\"zMinWidth()\" [style.max-width.px]=\"zMaxWidth()\">\n @for (item of visibleItems(); track $index) {\n @if (item.divide === 'before' && $index > 0) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <!-- Menu item - check if has submenu -->\n @if (item.submenu && item.submenu.length > 0) {\n <!-- Menu item with nested submenu -->\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"submenuTemplate\"\n [zPosition]=\"item.submenuPosition || 'right'\"\n zTrigger=\"hover\"\n [zShowDelay]=\"200\"\n [zHideDelay]=\"100\"\n [zOffset]=\"6\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent data-[state=open]:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label | translate }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ item.shortcut | translate }}\n </span>\n }\n <z-icon zType=\"lucideChevronRight\" zSize=\"14\" class=\"ml-auto shrink-0\" />\n </button>\n\n <!-- Submenu template -->\n <ng-template #submenuTemplate>\n <div\n class=\"p-1\"\n [style.min-width.px]=\"item.subMinWidth || zMinWidth()\"\n [style.max-width.px]=\"item.subMaxWidth || zMaxWidth()\">\n @for (subItem of item.submenu; track subItem.label) {\n <!-- Nested divider before -->\n @if (subItem.divide === 'before') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <button\n type=\"button\"\n [disabled]=\"subItem.disabled\"\n [class]=\"subItem.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(subItem)\">\n @if (subItem.icon) {\n <z-icon\n [zType]=\"subItem.icon\"\n [zSize]=\"subItem.iconSize || '14'\"\n class=\"text-muted-foreground shrink-0\" />\n }\n <span\n class=\"truncate\"\n z-tooltip\n [zContent]=\"subItem.label\"\n [zShowDelay]=\"200\"\n zTrigger=\"hover\"\n zPosition=\"top\">\n {{ subItem.label }}\n </span>\n @if (subItem.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ subItem.shortcut }}\n </span>\n }\n </button>\n\n <!-- Nested divider after -->\n @if (subItem.divide === 'after') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n </ng-template>\n } @else {\n <!-- Regular menu item (no submenu) -->\n <button\n type=\"button\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(item)\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">{{ item.shortcut }}</span>\n }\n </button>\n }\n\n <!-- Divider after -->\n @if (item.divide === 'after' && $index < visibleItems().length - 1) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MA6Ba,sBAAsB,CAAA;AACd,IAAA,cAAc,GAAG,SAAS,CAA0B,gBAAgB,0DAAC;IAExE,YAAY,GAAG,MAAM,EAAqB;AAE1C,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,iDAAuB;IAC9C,MAAM,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,QAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AACxB,IAAA,KAAK,GAAG,KAAK,CAAQ,YAAY,iDAAC;AAClC,IAAA,WAAW,GAAG,KAAK,CAAgD,SAAS,uDAAC;AAC7E,IAAA,SAAS,GAAG,KAAK,CAAmB,cAAc,qDAAC;AACnD,IAAA,WAAW,GAAG,KAAK,CAA2B,SAAS,uDAAC;AACxD,IAAA,OAAO,GAAG,KAAK,CAAS,CAAC,m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A,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,WAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9BzF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"shival99-z-ui-components-z-dropdown-menu.mjs","sources":["../../../../libs/core-ui/components/z-dropdown-menu/z-dropdown-menu.component.ts","../../../../libs/core-ui/components/z-dropdown-menu/z-dropdown-menu.component.html","../../../../libs/core-ui/components/z-dropdown-menu/shival99-z-ui-components-z-dropdown-menu.ts"],"sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { ZButtonComponent, ZButtonVariants } from '@shival99/z-ui/components/z-button';\nimport { ZIconComponent } from '@shival99/z-ui/components/z-icon';\nimport { type ZIcon } from '@shival99/z-ui/components/z-icon';\nimport { ZPopoverDirective } from '@shival99/z-ui/components/z-popover';\nimport { type ZPopoverPosition } from '@shival99/z-ui/components/z-popover';\nimport { ZTooltipDirective } from '@shival99/z-ui/components/z-tooltip';\nimport { ZDropdownMenuItem } from './z-dropdown-menu.types';\n\n@Component({\n selector: 'z-dropdown-menu',\n imports: [ZPopoverDirective, ZButtonComponent, ZIconComponent, ZTooltipDirective, TranslatePipe],\n standalone: true,\n templateUrl: './z-dropdown-menu.component.html',\n styleUrl: './z-dropdown-menu.component.scss',\n providers: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ZDropdownMenuComponent implements AfterContentInit {\n protected readonly contentWrapper = viewChild<ElementRef<HTMLElement>>('contentWrapper');\n\n public readonly zOnItemClick = output<ZDropdownMenuItem>();\n\n public readonly zItems = input.required<ZDropdownMenuItem[]>();\n public readonly zLabel = input<string>();\n public readonly zIcon = input<ZIcon>('lucideMenu');\n public readonly zButtonType = input<'primary' | 'secondary' | 'outline' | 'ghost'>('outline');\n public readonly zPosition = input<ZPopoverPosition>('bottom-right');\n public readonly zButtonSize = input<ZButtonVariants['zSize']>('default');\n public readonly zOffset = input<number>(4);\n public readonly zMinWidth = input<number>(224);\n public readonly zMaxWidth = input<number>(320);\n public readonly zDisabled = input<boolean>(false);\n\n protected readonly hasContent = signal(false);\n protected readonly popoverControl = signal<{ close: () => void; closeImmediate: () => void } | null>(null);\n\n protected readonly visibleItems = computed(() => this.zItems().filter(item => !item.hidden));\n\n ngAfterContentInit(): void {\n const wrapper = this.contentWrapper();\n if (wrapper) {\n const hasProjectedContent = wrapper.nativeElement.children.length > 0;\n this.hasContent.set(hasProjectedContent);\n }\n }\n\n protected onItemClick(item: ZDropdownMenuItem): void {\n if (item.disabled) {\n return;\n }\n\n item.onClick?.();\n this.zOnItemClick.emit(item);\n this.popoverControl()?.closeImmediate();\n }\n\n protected onControl(control: { close: () => void; closeImmediate: () => void }): void {\n this.popoverControl.set(control);\n }\n}\n","<!-- Custom trigger via ng-content -->\n<div\n #contentWrapper\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zDisabled]=\"zDisabled()\"\n (zControl)=\"onControl($event)\"\n [class.hidden]=\"!hasContent()\">\n <ng-content />\n</div>\n\n<!-- Default button trigger -->\n@if (!hasContent()) {\n <button\n type=\"button\"\n z-button\n [zType]=\"zButtonType()\"\n [zSize]=\"zButtonSize()\"\n [zDisabled]=\"zDisabled()\"\n z-popover\n [zPopoverContent]=\"menuContent\"\n zTrigger=\"click\"\n [zPosition]=\"zPosition()\"\n [zOffset]=\"zOffset()\"\n [zTypeIcon]=\"zIcon()!\"\n (zControl)=\"onControl($event)\">\n @if (zLabel()) {\n {{ zLabel() | translate }}\n }\n </button>\n}\n\n<!-- Menu content template -->\n<ng-template #menuContent let-close=\"close\">\n <div class=\"z-dropdown-menu-content p-1\" [style.min-width.px]=\"zMinWidth()\" [style.max-width.px]=\"zMaxWidth()\">\n @for (item of visibleItems(); track $index) {\n @if (item.divide === 'before' && $index > 0) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <!-- Menu item - check if has submenu -->\n @if (item.submenu && item.submenu.length > 0) {\n <!-- Menu item with nested submenu -->\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"submenuTemplate\"\n [zPosition]=\"item.submenuPosition || 'right'\"\n zTrigger=\"hover\"\n [zShowDelay]=\"200\"\n [zHideDelay]=\"100\"\n [zOffset]=\"6\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent data-[state=open]:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label | translate }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ item.shortcut | translate }}\n </span>\n }\n <z-icon zType=\"lucideChevronRight\" zSize=\"14\" class=\"ml-auto shrink-0\" />\n </button>\n\n <!-- Submenu template -->\n <ng-template #submenuTemplate>\n <div\n class=\"p-1\"\n [style.min-width.px]=\"item.subMinWidth || zMinWidth()\"\n [style.max-width.px]=\"item.subMaxWidth || zMaxWidth()\">\n @for (subItem of item.submenu; track subItem.label) {\n <!-- Nested divider before -->\n @if (subItem.divide === 'before') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n\n <button\n type=\"button\"\n [disabled]=\"subItem.disabled\"\n [class]=\"subItem.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(subItem)\">\n @if (subItem.icon) {\n <z-icon\n [zType]=\"subItem.icon\"\n [zSize]=\"subItem.iconSize || '14'\"\n class=\"text-muted-foreground shrink-0\" />\n }\n <span\n class=\"truncate\"\n z-tooltip\n [zContent]=\"subItem.label\"\n [zShowDelay]=\"200\"\n zTrigger=\"hover\"\n zPosition=\"top\">\n {{ subItem.label }}\n </span>\n @if (subItem.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">\n {{ subItem.shortcut }}\n </span>\n }\n </button>\n\n <!-- Nested divider after -->\n @if (subItem.divide === 'after') {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n </ng-template>\n } @else {\n <!-- Regular menu item (no submenu) -->\n <button\n type=\"button\"\n [disabled]=\"item.disabled\"\n [class]=\"item.class\"\n class=\"hover:bg-accent focus:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none disabled:pointer-events-none disabled:opacity-50\"\n (click)=\"onItemClick(item)\">\n @if (item.icon) {\n <z-icon [zType]=\"item.icon\" [zSize]=\"item.iconSize || '14'\" class=\"text-muted-foreground shrink-0\" />\n }\n <span class=\"truncate\" z-tooltip [zContent]=\"item.label\" [zShowDelay]=\"500\" zTrigger=\"hover\" zPosition=\"top\">\n {{ item.label }}\n </span>\n @if (item.shortcut) {\n <span class=\"text-muted-foreground ml-auto shrink-0 text-xs tracking-widest\">{{ item.shortcut }}</span>\n }\n </button>\n }\n\n <!-- Divider after -->\n @if (item.divide === 'after' && $index < visibleItems().length - 1) {\n <div class=\"bg-border -mx-1 my-1 h-px\"></div>\n }\n }\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MA6Ba,sBAAsB,CAAA;AACd,IAAA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AAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,SAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,WAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,WAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,WAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9BzF;;AAEG;;;;"}
|
|
@@ -770,7 +770,7 @@ class ZFilterComponent {
|
|
|
770
770
|
return field.key || `field-${index}`;
|
|
771
771
|
}
|
|
772
772
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
773
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ZFilterComponent, isStandalone: true, selector: "z-filter", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, zFilters: { classPropertyName: "zFilters", publicName: "zFilters", isSignal: true, isRequired: true, transformFunction: null }, zFields: { classPropertyName: "zFields", publicName: "zFields", isSignal: true, isRequired: true, transformFunction: null }, zSize: { classPropertyName: "zSize", publicName: "zSize", isSignal: true, isRequired: false, transformFunction: null }, zI18n: { classPropertyName: "zI18n", publicName: "zI18n", isSignal: true, isRequired: false, transformFunction: null }, zShowAddButton: { classPropertyName: "zShowAddButton", publicName: "zShowAddButton", isSignal: true, isRequired: false, transformFunction: null }, zAllowMultiple: { classPropertyName: "zAllowMultiple", publicName: "zAllowMultiple", isSignal: true, isRequired: false, transformFunction: null }, zAddButtonIcon: { classPropertyName: "zAddButtonIcon", publicName: "zAddButtonIcon", isSignal: true, isRequired: false, transformFunction: null }, zAddButtonText: { classPropertyName: "zAddButtonText", publicName: "zAddButtonText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zFiltersChange: "zFiltersChange", zFilterAdd: "zFilterAdd", zFilterRemove: "zFilterRemove", zFilterUpdate: "zFilterUpdate" }, host: { attributes: { "data-slot": "z-filter" }, properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "addButtonTemplate", first: true, predicate: ["addButton"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "addFilterSearchInput", first: true, predicate: ["addFilterSearchInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Add Filter Button -->\n@if (zShowAddButton() && selectableFields().length > 0) {\n @if (addButtonTemplate()) {\n <ng-container [ngTemplateOutlet]=\"addButtonTemplate()!\" />\n } @else {\n <button\n z-button\n zType=\"outline\"\n [zSize]=\"buttonSize()\"\n z-popover\n [zPopoverContent]=\"addFilterPopover\"\n zTrigger=\"click\"\n zPosition=\"bottom-left\"\n [zOffset]=\"6\"\n (zShow)=\"addFilterOpen.set(true); focusSearchInput()\"\n (zHide)=\"addFilterOpen.set(false); searchQuery.set('')\">\n <z-icon [zType]=\"zAddButtonIcon()\" zSize=\"14\" />\n {{ zAddButtonText() || i18n().addFilter }}\n </button>\n }\n}\n\n<ng-template #addFilterPopover let-close=\"close\">\n <div class=\"w-[200px]\">\n <div class=\"border-border flex items-center border-b px-3\">\n <z-icon zType=\"lucideSearch\" zSize=\"16\" class=\"text-muted-foreground/50 mr-2 shrink-0\" />\n <input\n #addFilterSearchInput\n type=\"text\"\n [placeholder]=\"i18n().searchFields\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($event)\"\n class=\"placeholder:text-muted-foreground text-foreground flex h-10 w-full bg-transparent py-3 text-sm outline-none\" />\n </div>\n <div class=\"flex max-h-[300px] flex-col gap-0.5 overflow-y-auto p-1\">\n @for (group of groupedFields(); track group.group; let groupIndex = $index) {\n @if (group.group) {\n <div\n class=\"text-muted-foreground px-2 py-1.5 text-xs font-medium\"\n [class.border-border]=\"groupIndex > 0\"\n [class.mt-2]=\"groupIndex > 0\"\n [class.border-t]=\"groupIndex > 0\"\n [class.ml-1]=\"groupIndex > 0\">\n {{ group.group }}\n </div>\n }\n @for (field of group.fields; track trackByFieldKey($index, field)) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors\"\n (click)=\"onFieldSelect(field); close()\">\n @if (field.icon) {\n <z-icon [zType]=\"field.icon\" zSize=\"14\" class=\"text-muted-foreground\" />\n }\n <span>{{ field.label }}</span>\n </button>\n }\n } @empty {\n <div class=\"text-muted-foreground py-6 text-center text-sm\">\n {{ i18n().noFieldsFound }}\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n<!-- Filter Items -->\n@for (filter of zFilters(); track trackByFilterId($index, filter)) {\n @if (filter | zFilterField: $any(zFields()); as field) {\n <div [class]=\"getItemClasses()\" data-slot=\"filter-item\">\n <!-- Field Label -->\n <div [class]=\"getLabelClasses()\">\n @if (field.icon) {\n <z-icon [zType]=\"field.icon\" zSize=\"14\" />\n }\n {{ field.label }}\n </div>\n\n <!-- Operator Dropdown -->\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"operatorDropdown\"\n zTrigger=\"click\"\n zPosition=\"bottom-left\"\n [zOffset]=\"4\"\n (zShow)=\"operatorPopoverOpen.set(filter.id)\"\n (zHide)=\"operatorPopoverOpen.set(null)\"\n class=\"text-muted-foreground hover:text-foreground hover:bg-muted flex cursor-pointer items-center px-2.5 text-sm transition-colors\"\n [class.text-foreground]=\"operatorPopoverOpen() === filter.id\"\n [class.bg-muted]=\"operatorPopoverOpen() === filter.id\">\n {{ filter | zFilterOperatorLabel: $any(zFields()) : i18n() }}\n <z-icon zType=\"lucideChevronDown\" zSize=\"12\" class=\"ml-1\" />\n </button>\n\n <ng-template #operatorDropdown let-close=\"close\">\n <div class=\"flex w-fit min-w-32 flex-col gap-0.5 p-1\">\n @for (op of filter | zFilterOperators: $any(zFields()) : i18n(); track op.value) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center justify-between gap-4 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none\"\n (click)=\"updateFilterOperator(filter, op.value); close()\">\n <span>{{ op.label }}</span>\n @if (op.value === filter.operator) {\n <z-icon zType=\"lucideCheck\" zSize=\"14\" class=\"text-primary\" />\n }\n </button>\n }\n </div>\n </ng-template>\n\n <!-- Value Selector -->\n @if (!(filter | zFilterIsValueHidden)) {\n <!-- Boolean Field -->\n @if (field.type === 'boolean') {\n <div class=\"flex items-center gap-2 px-2.5\">\n <z-switch [zChecked]=\"filter.values[0] === true\" (zChange)=\"onBooleanChange(filter, $event)\" zSize=\"sm\" />\n @if (field.onLabel && field.offLabel) {\n <span class=\"text-muted-foreground text-xs\">\n {{ filter.values[0] === true ? field.onLabel : field.offLabel }}\n </span>\n }\n </div>\n }\n\n <!-- Text/Email/URL/Tel Input -->\n @else if (field.type === 'text' || field.type === 'email' || field.type === 'url' || field.type === 'tel') {\n <div [class]=\"getInputClasses()\" class=\"w-36\">\n @if (field.prefix) {\n <span class=\"text-muted-foreground mr-1\">{{ field.prefix }}</span>\n }\n <input\n type=\"{{\n field.type === 'email' ? 'email' : field.type === 'url' ? 'url' : field.type === 'tel' ? 'tel' : 'text'\n }}\"\n [value]=\"filter.values[0] || ''\"\n [placeholder]=\"field.placeholder || i18n().placeholders.enterField\"\n [pattern]=\"field | zFilterInputPattern\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event)\" />\n @if (field.suffix) {\n <span class=\"text-muted-foreground ml-1\">{{ field.suffix }}</span>\n }\n </div>\n }\n\n <!-- Number Input -->\n @else if (field.type === 'number') {\n @if (filter | zFilterIsBetweenOperator) {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-20\">\n @if (field.prefix) {\n <span class=\"text-muted-foreground mr-1\">{{ field.prefix }}</span>\n }\n <input\n type=\"number\"\n [value]=\"filter.values[0] || ''\"\n [placeholder]=\"i18n().min\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [step]=\"field.step\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-20\">\n <input\n type=\"number\"\n [value]=\"filter.values[1] || ''\"\n [placeholder]=\"i18n().max\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [step]=\"field.step\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event, 1)\" />\n @if (field.suffix) {\n <span class=\"text-muted-foreground ml-1\">{{ field.suffix }}</span>\n }\n </div>\n </div>\n } @else {\n <div [class]=\"getInputClasses()\" class=\"w-24\">\n @if (field.prefix) {\n <span class=\"text-muted-foreground mr-1\">{{ field.prefix }}</span>\n }\n <input\n type=\"number\"\n [value]=\"filter.values[0] || ''\"\n [placeholder]=\"field.placeholder || i18n().placeholders.enterField\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [step]=\"field.step\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event)\" />\n @if (field.suffix) {\n <span class=\"text-muted-foreground ml-1\">{{ field.suffix }}</span>\n }\n </div>\n }\n }\n\n <!-- Date Input -->\n @else if (field.type === 'date') {\n <div [class]=\"getInputClasses()\" class=\"w-36\">\n <input\n type=\"date\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event)\" />\n </div>\n }\n\n <!-- Date Range Input -->\n @else if (field.type === 'daterange') {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-32\">\n <input\n type=\"date\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-32\">\n <input\n type=\"date\"\n [value]=\"filter.values[1] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 1)\" />\n </div>\n </div>\n }\n\n <!-- Time Input -->\n @else if (field.type === 'time') {\n @if (filter | zFilterIsBetweenOperator) {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-28\">\n <input\n type=\"time\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-28\">\n <input\n type=\"time\"\n [value]=\"filter.values[1] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 1)\" />\n </div>\n </div>\n } @else {\n <div [class]=\"getInputClasses()\" class=\"w-28\">\n <input\n type=\"time\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event)\" />\n </div>\n }\n }\n\n <!-- DateTime Input -->\n @else if (field.type === 'datetime') {\n @if (filter | zFilterIsBetweenOperator) {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-44\">\n <input\n type=\"datetime-local\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-44\">\n <input\n type=\"datetime-local\"\n [value]=\"filter.values[1] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 1)\" />\n </div>\n </div>\n } @else {\n <div [class]=\"getInputClasses()\" class=\"w-44\">\n <input\n type=\"datetime-local\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event)\" />\n </div>\n }\n }\n\n <!-- Select/Multiselect -->\n @else if (field.type === 'select' || field.type === 'multiselect' || field.options) {\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"selectPopover\"\n zTrigger=\"click\"\n zPosition=\"bottom-left\"\n [zOffset]=\"4\"\n (zShow)=\"valuePopoverOpen.set(filter.id); focusSelectSearch(filter.id)\"\n (zHide)=\"valuePopoverOpen.set(null)\"\n class=\"hover:bg-muted flex cursor-pointer items-center gap-1.5 px-2.5 text-sm transition-colors\"\n [class.bg-muted]=\"valuePopoverOpen() === filter.id\">\n @if (filter | zFilterSelectedOptions: $any(zFields()); as selectedOpts) {\n @if (selectedOpts.length > 0) {\n <div class=\"flex items-center -space-x-1.5\">\n @for (opt of selectedOpts.slice(0, 3); track $any(opt).value) {\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"14\" />\n }\n }\n </div>\n @if (selectedOpts.length === 1) {\n {{ selectedOpts[0].label }}\n } @else {\n {{ selectedOpts.length }} {{ i18n().selectedCount }}\n }\n } @else {\n <span class=\"text-muted-foreground\">{{ i18n().select }}</span>\n }\n }\n <z-icon zType=\"lucideChevronDown\" zSize=\"12\" class=\"text-muted-foreground ml-1\" />\n </button>\n\n <ng-template #selectPopover let-close=\"close\">\n <div class=\"w-[200px]\">\n @if (field.searchable !== false) {\n <div class=\"border-border flex items-center border-b px-3\">\n <z-icon zType=\"lucideSearch\" zSize=\"16\" class=\"text-muted-foreground/50 mr-2 shrink-0\" />\n <input\n [id]=\"'select-search-' + filter.id\"\n type=\"text\"\n [placeholder]=\"i18n().placeholders.searchField\"\n class=\"placeholder:text-muted-foreground text-foreground flex h-9 w-full bg-transparent py-2 text-sm outline-none\" />\n </div>\n }\n <div class=\"flex max-h-[200px] flex-col gap-0.5 overflow-y-auto p-1\">\n <!-- Selected Options -->\n @for (opt of filter | zFilterSelectedOptions: $any(zFields()); track $any(opt).value) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors\"\n (click)=\"onSelectValueChange(filter, $any(opt)); field.type !== 'multiselect' && close()\">\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"14\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n <z-icon zType=\"lucideCheck\" zSize=\"14\" class=\"text-primary ml-auto\" />\n </button>\n }\n\n <!-- Separator -->\n @if (\n (filter | zFilterSelectedOptions: $any(zFields())).length > 0 &&\n (filter | zFilterUnselectedOptions: $any(zFields())).length > 0\n ) {\n <div class=\"bg-border my-1 ml-1 h-px\"></div>\n }\n\n <!-- Unselected Options -->\n @for (opt of filter | zFilterUnselectedOptions: $any(zFields()); track $any(opt).value) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors\"\n (click)=\"onSelectValueChange(filter, $any(opt)); field.type !== 'multiselect' && close()\">\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"14\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n\n @if (\n (filter | zFilterSelectedOptions: $any(zFields())).length === 0 &&\n (filter | zFilterUnselectedOptions: $any(zFields())).length === 0\n ) {\n <div class=\"text-muted-foreground py-6 text-center text-sm\">\n {{ i18n().noResultsFound }}\n </div>\n }\n </div>\n </div>\n </ng-template>\n }\n }\n\n <!-- Remove Button -->\n <button type=\"button\" [class]=\"getRemoveButtonClasses()\" data-slot=\"filter-remove\" (click)=\"removeFilter(filter)\">\n <z-icon zType=\"lucideX\" zSize=\"14\" />\n </button>\n </div>\n }\n}\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ZSwitchComponent, selector: "z-switch", inputs: ["class", "zSize", "zLabel", "zText", "zDisabled", "zLoading", "zTextPosition", "zChecked"], outputs: ["zChange", "zCheckedChange"] }, { kind: "component", type: ZButtonComponent, selector: "z-button, button[z-button], a[z-button]", inputs: ["class", "zType", "zSize", "zShape", "zLabel", "zLoading", "zDisabled", "zTypeIcon", "zSizeIcon", "zStrokeWidthIcon", "zWave"], exportAs: ["zButton"] }, { kind: "directive", type: ZPopoverDirective, selector: "[z-popover]", inputs: ["zPopoverContent", "zPosition", "zTrigger", "zClass", "zShowDelay", "zHideDelay", "zDisabled", "zOffset", "zPopoverWidth", "zManualClose", "zScrollClose", "zShowArrow"], outputs: ["zShow", "zHide", "zHideStart", "zControl"], exportAs: ["zPopover"] }, { kind: "pipe", type: ZFilterFieldPipe, name: "zFilterField" }, { kind: "pipe", type: ZFilterOperatorLabelPipe, name: "zFilterOperatorLabel" }, { kind: "pipe", type: ZFilterOperatorsPipe, name: "zFilterOperators" }, { kind: "pipe", type: ZFilterSelectedOptionsPipe, name: "zFilterSelectedOptions" }, { kind: "pipe", type: ZFilterUnselectedOptionsPipe, name: "zFilterUnselectedOptions" }, { kind: "pipe", type: ZFilterInputPatternPipe, name: "zFilterInputPattern" }, { kind: "pipe", type: ZFilterIsValueHiddenPipe, name: "zFilterIsValueHidden" }, { kind: "pipe", type: ZFilterIsBetweenOperatorPipe, name: "zFilterIsBetweenOperator" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
773
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ZFilterComponent, isStandalone: true, selector: "z-filter", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, zFilters: { classPropertyName: "zFilters", publicName: "zFilters", isSignal: true, isRequired: true, transformFunction: null }, zFields: { classPropertyName: "zFields", publicName: "zFields", isSignal: true, isRequired: true, transformFunction: null }, zSize: { classPropertyName: "zSize", publicName: "zSize", isSignal: true, isRequired: false, transformFunction: null }, zI18n: { classPropertyName: "zI18n", publicName: "zI18n", isSignal: true, isRequired: false, transformFunction: null }, zShowAddButton: { classPropertyName: "zShowAddButton", publicName: "zShowAddButton", isSignal: true, isRequired: false, transformFunction: null }, zAllowMultiple: { classPropertyName: "zAllowMultiple", publicName: "zAllowMultiple", isSignal: true, isRequired: false, transformFunction: null }, zAddButtonIcon: { classPropertyName: "zAddButtonIcon", publicName: "zAddButtonIcon", isSignal: true, isRequired: false, transformFunction: null }, zAddButtonText: { classPropertyName: "zAddButtonText", publicName: "zAddButtonText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zFiltersChange: "zFiltersChange", zFilterAdd: "zFilterAdd", zFilterRemove: "zFilterRemove", zFilterUpdate: "zFilterUpdate" }, host: { attributes: { "data-slot": "z-filter" }, properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "addButtonTemplate", first: true, predicate: ["addButton"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "addFilterSearchInput", first: true, predicate: ["addFilterSearchInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Add Filter Button -->\n@if (zShowAddButton() && selectableFields().length > 0) {\n @if (addButtonTemplate()) {\n <ng-container [ngTemplateOutlet]=\"addButtonTemplate()!\" />\n } @else {\n <button\n z-button\n zType=\"outline\"\n [zSize]=\"buttonSize()\"\n z-popover\n [zPopoverContent]=\"addFilterPopover\"\n zTrigger=\"click\"\n zPosition=\"bottom-left\"\n [zOffset]=\"6\"\n (zShow)=\"addFilterOpen.set(true); focusSearchInput()\"\n (zHide)=\"addFilterOpen.set(false); searchQuery.set('')\">\n <z-icon [zType]=\"zAddButtonIcon()\" zSize=\"14\" />\n {{ zAddButtonText() || i18n().addFilter }}\n </button>\n }\n}\n\n<ng-template #addFilterPopover let-close=\"close\">\n <div class=\"w-[200px]\">\n <div class=\"border-border flex items-center border-b px-3\">\n <z-icon zType=\"lucideSearch\" zSize=\"16\" class=\"text-muted-foreground/50 mr-2 shrink-0\" />\n <input\n #addFilterSearchInput\n type=\"text\"\n [placeholder]=\"i18n().searchFields\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchInput($event)\"\n class=\"placeholder:text-muted-foreground text-foreground flex h-10 w-full bg-transparent py-3 text-sm outline-none\" />\n </div>\n <div class=\"flex max-h-[300px] flex-col gap-0.5 overflow-y-auto p-1\">\n @for (group of groupedFields(); track group.group; let groupIndex = $index) {\n @if (group.group) {\n <div\n class=\"text-muted-foreground px-2 py-1.5 text-xs font-medium\"\n [class.border-border]=\"groupIndex > 0\"\n [class.mt-2]=\"groupIndex > 0\"\n [class.border-t]=\"groupIndex > 0\"\n [class.ml-1]=\"groupIndex > 0\">\n {{ group.group }}\n </div>\n }\n @for (field of group.fields; track trackByFieldKey($index, field)) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors\"\n (click)=\"onFieldSelect(field); close()\">\n @if (field.icon) {\n <z-icon [zType]=\"field.icon\" zSize=\"14\" class=\"text-muted-foreground\" />\n }\n <span>{{ field.label }}</span>\n </button>\n }\n } @empty {\n <div class=\"text-muted-foreground py-6 text-center text-sm\">\n {{ i18n().noFieldsFound }}\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n<!-- Filter Items -->\n@for (filter of zFilters(); track trackByFilterId($index, filter)) {\n @if (filter | zFilterField: $any(zFields()); as field) {\n <div [class]=\"getItemClasses()\" data-slot=\"filter-item\">\n <!-- Field Label -->\n <div [class]=\"getLabelClasses()\">\n @if (field.icon) {\n <z-icon [zType]=\"field.icon\" zSize=\"14\" />\n }\n {{ field.label }}\n </div>\n\n <!-- Operator Dropdown -->\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"operatorDropdown\"\n zTrigger=\"click\"\n zPosition=\"bottom-left\"\n [zOffset]=\"4\"\n (zShow)=\"operatorPopoverOpen.set(filter.id)\"\n (zHide)=\"operatorPopoverOpen.set(null)\"\n class=\"text-muted-foreground hover:text-foreground hover:bg-muted flex cursor-pointer items-center px-2.5 text-sm transition-colors\"\n [class.text-foreground]=\"operatorPopoverOpen() === filter.id\"\n [class.bg-muted]=\"operatorPopoverOpen() === filter.id\">\n {{ filter | zFilterOperatorLabel: $any(zFields()) : i18n() }}\n <z-icon zType=\"lucideChevronDown\" zSize=\"12\" class=\"ml-1\" />\n </button>\n\n <ng-template #operatorDropdown let-close=\"close\">\n <div class=\"flex w-fit min-w-32 flex-col gap-0.5 p-1\">\n @for (op of filter | zFilterOperators: $any(zFields()) : i18n(); track op.value) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center justify-between gap-4 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none\"\n (click)=\"updateFilterOperator(filter, op.value); close()\">\n <span>{{ op.label }}</span>\n @if (op.value === filter.operator) {\n <z-icon zType=\"lucideCheck\" zSize=\"14\" class=\"text-primary\" />\n }\n </button>\n }\n </div>\n </ng-template>\n\n <!-- Value Selector -->\n @if (!(filter | zFilterIsValueHidden)) {\n <!-- Boolean Field -->\n @if (field.type === 'boolean') {\n <div class=\"flex items-center gap-2 px-2.5\">\n <z-switch [zChecked]=\"filter.values[0] === true\" (zChange)=\"onBooleanChange(filter, $event)\" zSize=\"sm\" />\n @if (field.onLabel && field.offLabel) {\n <span class=\"text-muted-foreground text-xs\">\n {{ filter.values[0] === true ? field.onLabel : field.offLabel }}\n </span>\n }\n </div>\n }\n\n <!-- Text/Email/URL/Tel Input -->\n @else if (field.type === 'text' || field.type === 'email' || field.type === 'url' || field.type === 'tel') {\n <div [class]=\"getInputClasses()\" class=\"w-36\">\n @if (field.prefix) {\n <span class=\"text-muted-foreground mr-1\">{{ field.prefix }}</span>\n }\n <input\n type=\"{{\n field.type === 'email' ? 'email' : field.type === 'url' ? 'url' : field.type === 'tel' ? 'tel' : 'text'\n }}\"\n [value]=\"filter.values[0] || ''\"\n [placeholder]=\"field.placeholder || i18n().placeholders.enterField\"\n [pattern]=\"field | zFilterInputPattern\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event)\" />\n @if (field.suffix) {\n <span class=\"text-muted-foreground ml-1\">{{ field.suffix }}</span>\n }\n </div>\n }\n\n <!-- Number Input -->\n @else if (field.type === 'number') {\n @if (filter | zFilterIsBetweenOperator) {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-20\">\n @if (field.prefix) {\n <span class=\"text-muted-foreground mr-1\">{{ field.prefix }}</span>\n }\n <input\n type=\"number\"\n [value]=\"filter.values[0] || ''\"\n [placeholder]=\"i18n().min\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [step]=\"field.step\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-20\">\n <input\n type=\"number\"\n [value]=\"filter.values[1] || ''\"\n [placeholder]=\"i18n().max\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [step]=\"field.step\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event, 1)\" />\n @if (field.suffix) {\n <span class=\"text-muted-foreground ml-1\">{{ field.suffix }}</span>\n }\n </div>\n </div>\n } @else {\n <div [class]=\"getInputClasses()\" class=\"w-24\">\n @if (field.prefix) {\n <span class=\"text-muted-foreground mr-1\">{{ field.prefix }}</span>\n }\n <input\n type=\"number\"\n [value]=\"filter.values[0] || ''\"\n [placeholder]=\"field.placeholder || i18n().placeholders.enterField\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [step]=\"field.step\"\n class=\"w-full bg-transparent outline-none\"\n (blur)=\"onInputChange(filter, $event)\" />\n @if (field.suffix) {\n <span class=\"text-muted-foreground ml-1\">{{ field.suffix }}</span>\n }\n </div>\n }\n }\n\n <!-- Date Input -->\n @else if (field.type === 'date') {\n <div [class]=\"getInputClasses()\" class=\"w-36\">\n <input\n type=\"date\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event)\" />\n </div>\n }\n\n <!-- Date Range Input -->\n @else if (field.type === 'daterange') {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-32\">\n <input\n type=\"date\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-32\">\n <input\n type=\"date\"\n [value]=\"filter.values[1] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 1)\" />\n </div>\n </div>\n }\n\n <!-- Time Input -->\n @else if (field.type === 'time') {\n @if (filter | zFilterIsBetweenOperator) {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-28\">\n <input\n type=\"time\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-28\">\n <input\n type=\"time\"\n [value]=\"filter.values[1] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 1)\" />\n </div>\n </div>\n } @else {\n <div [class]=\"getInputClasses()\" class=\"w-28\">\n <input\n type=\"time\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event)\" />\n </div>\n }\n }\n\n <!-- DateTime Input -->\n @else if (field.type === 'datetime') {\n @if (filter | zFilterIsBetweenOperator) {\n <div class=\"flex items-center\">\n <div [class]=\"getInputClasses()\" class=\"w-44\">\n <input\n type=\"datetime-local\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 0)\" />\n </div>\n <div [class]=\"getBetweenClasses()\">{{ i18n().to }}</div>\n <div [class]=\"getInputClasses()\" class=\"w-44\">\n <input\n type=\"datetime-local\"\n [value]=\"filter.values[1] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event, 1)\" />\n </div>\n </div>\n } @else {\n <div [class]=\"getInputClasses()\" class=\"w-44\">\n <input\n type=\"datetime-local\"\n [value]=\"filter.values[0] || ''\"\n class=\"w-full bg-transparent outline-none\"\n (change)=\"onInputChange(filter, $event)\" />\n </div>\n }\n }\n\n <!-- Select/Multiselect -->\n @else if (field.type === 'select' || field.type === 'multiselect' || field.options) {\n <button\n type=\"button\"\n z-popover\n [zPopoverContent]=\"selectPopover\"\n zTrigger=\"click\"\n zPosition=\"bottom-left\"\n [zOffset]=\"4\"\n (zShow)=\"valuePopoverOpen.set(filter.id); focusSelectSearch(filter.id)\"\n (zHide)=\"valuePopoverOpen.set(null)\"\n class=\"hover:bg-muted flex cursor-pointer items-center gap-1.5 px-2.5 text-sm transition-colors\"\n [class.bg-muted]=\"valuePopoverOpen() === filter.id\">\n @if (filter | zFilterSelectedOptions: $any(zFields()); as selectedOpts) {\n @if (selectedOpts.length > 0) {\n <div class=\"flex items-center -space-x-1.5\">\n @for (opt of selectedOpts.slice(0, 3); track $any(opt).value) {\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"14\" />\n }\n }\n </div>\n @if (selectedOpts.length === 1) {\n {{ selectedOpts[0].label }}\n } @else {\n {{ selectedOpts.length }} {{ i18n().selectedCount }}\n }\n } @else {\n <span class=\"text-muted-foreground\">{{ i18n().select }}</span>\n }\n }\n <z-icon zType=\"lucideChevronDown\" zSize=\"12\" class=\"text-muted-foreground ml-1\" />\n </button>\n\n <ng-template #selectPopover let-close=\"close\">\n <div class=\"w-[200px]\">\n @if (field.searchable !== false) {\n <div class=\"border-border flex items-center border-b px-3\">\n <z-icon zType=\"lucideSearch\" zSize=\"16\" class=\"text-muted-foreground/50 mr-2 shrink-0\" />\n <input\n [id]=\"'select-search-' + filter.id\"\n type=\"text\"\n [placeholder]=\"i18n().placeholders.searchField\"\n class=\"placeholder:text-muted-foreground text-foreground flex h-9 w-full bg-transparent py-2 text-sm outline-none\" />\n </div>\n }\n <div class=\"flex max-h-[200px] flex-col gap-0.5 overflow-y-auto p-1\">\n <!-- Selected Options -->\n @for (opt of filter | zFilterSelectedOptions: $any(zFields()); track $any(opt).value) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors\"\n (click)=\"onSelectValueChange(filter, $any(opt)); field.type !== 'multiselect' && close()\">\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"14\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n <z-icon zType=\"lucideCheck\" zSize=\"14\" class=\"text-primary ml-auto\" />\n </button>\n }\n\n <!-- Separator -->\n @if (\n (filter | zFilterSelectedOptions: $any(zFields())).length > 0 &&\n (filter | zFilterUnselectedOptions: $any(zFields())).length > 0\n ) {\n <div class=\"bg-border my-1 ml-1 h-px\"></div>\n }\n\n <!-- Unselected Options -->\n @for (opt of filter | zFilterUnselectedOptions: $any(zFields()); track $any(opt).value) {\n <button\n type=\"button\"\n class=\"hover:bg-accent flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors\"\n (click)=\"onSelectValueChange(filter, $any(opt)); field.type !== 'multiselect' && close()\">\n @if (opt.icon) {\n <z-icon [zType]=\"opt.icon\" zSize=\"14\" />\n }\n <span class=\"truncate\">{{ opt.label }}</span>\n </button>\n }\n\n @if (\n (filter | zFilterSelectedOptions: $any(zFields())).length === 0 &&\n (filter | zFilterUnselectedOptions: $any(zFields())).length === 0\n ) {\n <div class=\"text-muted-foreground py-6 text-center text-sm\">\n {{ i18n().noResultsFound }}\n </div>\n }\n </div>\n </div>\n </ng-template>\n }\n }\n\n <!-- Remove Button -->\n <button type=\"button\" [class]=\"getRemoveButtonClasses()\" data-slot=\"filter-remove\" (click)=\"removeFilter(filter)\">\n <z-icon zType=\"lucideX\" zSize=\"14\" />\n </button>\n </div>\n }\n}\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ZSwitchComponent, selector: "z-switch", inputs: ["class", "zSize", "zLabel", "zText", "zDisabled", "zLoading", "zTextPosition", "zChecked"], outputs: ["zChange", "zCheckedChange"] }, { kind: "component", type: ZButtonComponent, selector: "z-button, button[z-button], a[z-button]", inputs: ["class", "zType", "zSize", "zShape", "zLabel", "zLoading", "zDisabled", "zTypeIcon", "zSizeIcon", "zStrokeWidthIcon", "zWave"], exportAs: ["zButton"] }, { kind: "directive", type: ZPopoverDirective, selector: "[z-popover]", inputs: ["zPopoverContent", "zPosition", "zTrigger", "zClass", "zShowDelay", "zHideDelay", "zDisabled", "zOffset", "zPopoverWidth", "zManualClose", "zScrollClose", "zShowArrow"], outputs: ["zShow", "zHide", "zHideStart", "zControl", "zPositionChange"], exportAs: ["zPopover"] }, { kind: "pipe", type: ZFilterFieldPipe, name: "zFilterField" }, { kind: "pipe", type: ZFilterOperatorLabelPipe, name: "zFilterOperatorLabel" }, { kind: "pipe", type: ZFilterOperatorsPipe, name: "zFilterOperators" }, { kind: "pipe", type: ZFilterSelectedOptionsPipe, name: "zFilterSelectedOptions" }, { kind: "pipe", type: ZFilterUnselectedOptionsPipe, name: "zFilterUnselectedOptions" }, { kind: "pipe", type: ZFilterInputPatternPipe, name: "zFilterInputPattern" }, { kind: "pipe", type: ZFilterIsValueHiddenPipe, name: "zFilterIsValueHidden" }, { kind: "pipe", type: ZFilterIsBetweenOperatorPipe, name: "zFilterIsBetweenOperator" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
774
774
|
}
|
|
775
775
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZFilterComponent, decorators: [{
|
|
776
776
|
type: Component,
|