@shival99/z-ui 1.9.26 → 1.9.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shival99/z-ui",
3
- "version": "1.9.26",
3
+ "version": "1.9.27",
4
4
  "description": "Z-UI: Modern Angular UI Component Library - A comprehensive, high-performance design system built with Angular 20+, featuring 40+ customizable components with dark mode, accessibility, and enterprise-ready features.",
5
5
  "keywords": [
6
6
  "angular",
@@ -410,16 +410,16 @@ declare class ZCalendarComponent implements OnInit, ControlValueAccessor {
410
410
 
411
411
  declare const zCalendarVariants: (props?: ({
412
412
  zSize?: "sm" | "default" | "lg" | null | undefined;
413
- zStatus?: "default" | "disabled" | "readonly" | "open" | "error" | null | undefined;
413
+ zStatus?: "default" | "disabled" | "open" | "error" | "readonly" | null | undefined;
414
414
  } & class_variance_authority_types.ClassProp) | undefined) => string;
415
415
  declare const zCalendarDayVariants: (props?: ({
416
- state?: "default" | "disabled" | "today" | "selected" | "inRange" | "rangeStart" | "rangeEnd" | "rangeSingle" | "otherMonth" | "hovered" | null | undefined;
416
+ state?: "default" | "today" | "selected" | "inRange" | "rangeStart" | "rangeEnd" | "rangeSingle" | "disabled" | "otherMonth" | "hovered" | null | undefined;
417
417
  } & class_variance_authority_types.ClassProp) | undefined) => string;
418
418
  declare const zCalendarMonthVariants: (props?: ({
419
- state?: "default" | "current" | "disabled" | "selected" | null | undefined;
419
+ state?: "default" | "selected" | "disabled" | "current" | null | undefined;
420
420
  } & class_variance_authority_types.ClassProp) | undefined) => string;
421
421
  declare const zCalendarYearVariants: (props?: ({
422
- state?: "default" | "current" | "disabled" | "selected" | null | undefined;
422
+ state?: "default" | "selected" | "disabled" | "current" | null | undefined;
423
423
  } & class_variance_authority_types.ClassProp) | undefined) => string;
424
424
 
425
425
  export { ZCalendarComponent, zCalendarDayVariants, zCalendarMonthVariants, zCalendarVariants, zCalendarYearVariants };
@@ -1,11 +1,12 @@
1
1
  import * as _tanstack_angular_table from '@tanstack/angular-table';
2
- import { RowData, SortingState, ColumnFiltersState, PaginationState, RowSelectionState, ExpandedState, HeaderContext, CellContext, FlexRenderComponent, Row, ColumnPinningState, RowPinningState, VisibilityState, ColumnOrderState, Column, createAngularTable, Table, ColumnDef } from '@tanstack/angular-table';
2
+ import { RowData, RowSelectionState, HeaderContext, CellContext, FlexRenderComponent, Row, SortingState, ColumnFiltersState, PaginationState, ExpandedState, ColumnPinningState, RowPinningState, VisibilityState, ColumnOrderState, Column, createAngularTable, Table, ColumnDef } from '@tanstack/angular-table';
3
3
  import * as _shival99_angular_virtual from '@shival99/angular-virtual';
4
4
  import * as _shival99_z_ui_components_z_input from '@shival99/z-ui/components/z-input';
5
5
  import { ZInputSize } from '@shival99/z-ui/components/z-input';
6
6
  import * as _angular_core from '@angular/core';
7
7
  import { TemplateRef, Type, AfterViewInit, ElementRef, OnDestroy, OnInit } from '@angular/core';
8
8
  import { CdkDragDrop, CdkDragEnd } from '@angular/cdk/drag-drop';
9
+ import { ConnectedPosition } from '@angular/cdk/overlay';
9
10
  import { ClassValue } from 'clsx';
10
11
  import { NgScrollbar } from 'ngx-scrollbar';
11
12
  import { ZAutocompleteType, ZAutocompleteOption } from '@shival99/z-ui/components/z-autocomplete';
@@ -15,6 +16,7 @@ import * as _shival99_z_ui_components_z_select from '@shival99/z-ui/components/z
15
16
  import { ZSelectOption } from '@shival99/z-ui/components/z-select';
16
17
  import * as _shival99_z_ui_components_z_tooltip from '@shival99/z-ui/components/z-tooltip';
17
18
  import { ZTooltipConfig, ZTooltipContent } from '@shival99/z-ui/components/z-tooltip';
19
+ import { ZExcelColumnConfig, ZExcelExportOptions } from '@shival99/z-ui/services';
18
20
  import * as _shival99_z_ui_components_z_table from '@shival99/z-ui/components/z-table';
19
21
  import { ZDateRange } from '@shival99/z-ui/components/z-calendar';
20
22
  import { ZDropdownMenuItem } from '@shival99/z-ui/components/z-dropdown-menu';
@@ -181,6 +183,7 @@ interface ZTableControl<T> {
181
183
  toggleSettings: () => void;
182
184
  resetFilters: () => void;
183
185
  resetSorting: () => void;
186
+ clearSelection: () => void;
184
187
  addItem: (item: T) => void;
185
188
  updateItem: (id: string | number, updates: Partial<T>, fieldKey?: keyof T) => void;
186
189
  deleteItem: (id: string | number, fieldKey?: keyof T) => void;
@@ -377,6 +380,59 @@ interface ZTableActionClickEvent<T = unknown> {
377
380
  rowId: string;
378
381
  action: ZTableActionItem<T>;
379
382
  }
383
+ interface ZTableBulkActionContext<T = unknown> {
384
+ selectedRows: T[];
385
+ selectedRowIds: string[];
386
+ selection: RowSelectionState;
387
+ }
388
+ interface ZTableBulkActionHandlerContext<T = unknown> extends ZTableBulkActionContext<T> {
389
+ exportExcel: (config: ZTableExcelExportConfig<T>) => Promise<void>;
390
+ }
391
+ interface ZTableBulkActionItem<T = unknown> extends Omit<ZTableActionItem<ZTableBulkActionContext<T>>, 'disabled' | 'hidden'> {
392
+ disabled?: boolean | ((context: ZTableBulkActionContext<T>) => boolean);
393
+ hidden?: boolean | ((context: ZTableBulkActionContext<T>) => boolean);
394
+ handler?: (context: ZTableBulkActionHandlerContext<T>) => void | false | Promise<void | false>;
395
+ }
396
+ interface ZTableBulkActionViewItem<T = unknown> {
397
+ action: ZTableBulkActionItem<T>;
398
+ disabled: boolean;
399
+ }
400
+ type ZTableBulkActionList<T = unknown> = ZTableBulkActionItem<T>[] | ((context: ZTableBulkActionContext<T>) => ZTableBulkActionItem<T>[]);
401
+ interface ZTableBulkActionOptions<T = unknown> {
402
+ enabled?: boolean;
403
+ /** Custom actions rendered when rows are selected. */
404
+ actions?: ZTableBulkActionList<T>;
405
+ maxVisible?: number;
406
+ selectedLabel?: string;
407
+ clearLabel?: string;
408
+ }
409
+ type ZTableBulkActionConfig<T = unknown> = ZTableBulkActionOptions<T> | ZTableBulkActionList<T>;
410
+ interface ZTableBulkActionClickEvent<T = unknown> extends ZTableBulkActionContext<T> {
411
+ key: string;
412
+ action: ZTableBulkActionItem<T>;
413
+ }
414
+ type ZTableExcelExportScope = 'selected' | 'filtered' | 'all';
415
+ interface ZTableExcelExportContext<T = unknown> extends ZTableBulkActionContext<T> {
416
+ data: T[];
417
+ columns: ZTableColumnConfig<T>[];
418
+ }
419
+ interface ZTableExcelExportConfig<T = unknown> {
420
+ enabled?: boolean;
421
+ /** Built-in action key. Use the same key in bulkAction to override the button. */
422
+ actionKey?: string;
423
+ actionLabel?: string;
424
+ actionIcon?: ZIcon;
425
+ actionIconSize?: string;
426
+ fileName?: string | ((context: ZTableExcelExportContext<T>) => string);
427
+ sheetName?: string;
428
+ /** Shortcut for `scope: 'all'`. */
429
+ exportAll?: boolean;
430
+ scope?: ZTableExcelExportScope;
431
+ excludeColumns?: string[];
432
+ excelOverrides?: Partial<Record<string, Partial<ZExcelColumnConfig<T>>>>;
433
+ headerResolver?: (col: ZTableColumnConfig<T>) => string;
434
+ options?: ZExcelExportOptions;
435
+ }
380
436
  /**
381
437
  * @deprecated Use `ZTableBodyColumnConfig.actions` directly with an action array
382
438
  * or `(row) => action[]`, and set `actionMaxVisible` on the body config when needed.
@@ -390,7 +446,7 @@ interface ZTableActionColumnConfig<T = unknown> {
390
446
  }
391
447
  type ZTableActionBodyConfig<T = unknown> = ZTableActionColumnConfig<T> | (ZTableActionList<T> & Partial<ZTableActionColumnConfig<T>>);
392
448
  /** All possible change event types — used as discriminant in ZTableChangeEvent */
393
- type ZTableChangeType = 'page' | 'sort' | 'filter' | 'search' | 'select' | 'expand' | 'rowSelect' | 'rowSelectAll' | 'rowExpand' | 'rowDrag' | 'cellClick' | 'cellEdit' | 'action';
449
+ type ZTableChangeType = 'page' | 'sort' | 'filter' | 'search' | 'select' | 'expand' | 'rowSelect' | 'rowSelectAll' | 'rowExpand' | 'rowDrag' | 'cellClick' | 'cellEdit' | 'action' | 'bulkAction';
394
450
  interface ZTableChangeEventBase {
395
451
  type: ZTableChangeType;
396
452
  }
@@ -446,6 +502,10 @@ interface ZTableActionChange<T> extends ZTableChangeEventBase {
446
502
  type: 'action';
447
503
  data: ZTableActionClickEvent<T>;
448
504
  }
505
+ interface ZTableBulkActionChange<T> extends ZTableChangeEventBase {
506
+ type: 'bulkAction';
507
+ data: ZTableBulkActionClickEvent<T>;
508
+ }
449
509
  interface ZTableCellEditChange<T> extends ZTableChangeEventBase {
450
510
  type: 'cellEdit';
451
511
  data: ZTableCellEditEvent<T>;
@@ -463,7 +523,7 @@ interface ZTableCellEditChange<T> extends ZTableChangeEventBase {
463
523
  * }
464
524
  * ```
465
525
  */
466
- type ZTableChangeEvent<T> = ZTablePageChange | ZTableSortChange | ZTableFilterChange | ZTableSearchChange | ZTableSelectChange | ZTableExpandChange | ZTableRowSelectChange<T> | ZTableRowSelectAllChange<T> | ZTableRowExpandChange<T> | ZTableRowDragChange<T> | ZTableCellClickChange<T> | ZTableCellEditChange<T> | ZTableActionChange<T>;
526
+ type ZTableChangeEvent<T> = ZTablePageChange | ZTableSortChange | ZTableFilterChange | ZTableSearchChange | ZTableSelectChange | ZTableExpandChange | ZTableRowSelectChange<T> | ZTableRowSelectAllChange<T> | ZTableRowExpandChange<T> | ZTableRowDragChange<T> | ZTableCellClickChange<T> | ZTableCellEditChange<T> | ZTableActionChange<T> | ZTableBulkActionChange<T>;
467
527
  /** Initial table state — applied on first render, before any cached config is loaded */
468
528
  interface ZTableInitialState {
469
529
  columnPinning?: ColumnPinningState;
@@ -585,6 +645,8 @@ interface ZTableConfig<T> {
585
645
  enableMultiSort?: boolean;
586
646
  /** true = enable with defaults; object = full search bar config */
587
647
  search?: ZTableSearchConfig | boolean;
648
+ /** Floating bulk action bar shown when rows are selected */
649
+ bulkAction?: ZTableBulkActionConfig<T> | boolean;
588
650
  enableRowPinning?: boolean;
589
651
  enableColumnPinning?: boolean;
590
652
  enableColumnOrdering?: boolean;
@@ -652,6 +714,7 @@ declare class ZTableComponent<T> implements AfterViewInit {
652
714
  /** Visual variant: 'default' has card shadow, 'borderless' has no container border */
653
715
  readonly zVariant: _angular_core.InputSignal<"default" | "borderless">;
654
716
  private readonly _destroy$;
717
+ private readonly _zExcel;
655
718
  private readonly _zTranslate;
656
719
  /** Prevents recursive scroll sync between thead/tbody/tfoot */
657
720
  private readonly _isSyncingScroll;
@@ -663,6 +726,8 @@ declare class ZTableComponent<T> implements AfterViewInit {
663
726
  private _settingsDebounceTimeout;
664
727
  /** Debounces filter change emissions to server */
665
728
  private _filterEmitDebounceTimeout;
729
+ /** Keeps the bulk bar mounted long enough for its exit animation */
730
+ private _bulkBarTimer;
666
731
  /** Merged loading state from both zLoading input and config.loading */
667
732
  protected readonly isLoading: _angular_core.Signal<boolean>;
668
733
  /** True during debounced async state transitions (sort/filter processing) */
@@ -705,12 +770,18 @@ declare class ZTableComponent<T> implements AfterViewInit {
705
770
  protected readonly showHorizontalBorder: _angular_core.WritableSignal<boolean>;
706
771
  protected readonly showVerticalBorder: _angular_core.WritableSignal<boolean>;
707
772
  protected readonly showHeaderFooterShadow: _angular_core.WritableSignal<boolean>;
773
+ protected readonly bulkBarMounted: _angular_core.WritableSignal<boolean>;
774
+ protected readonly bulkBarClosing: _angular_core.WritableSignal<boolean>;
775
+ protected readonly bulkBarConfig: _angular_core.WritableSignal<ZTableBulkActionOptions<T> | null>;
776
+ protected readonly bulkBarContext: _angular_core.WritableSignal<ZTableBulkActionContext<T> | null>;
777
+ protected readonly bulkBarItems: _angular_core.WritableSignal<ZTableBulkActionViewItem<T>[]>;
708
778
  /** True when table body is scrolled away from left edge (shows left pin shadow) */
709
779
  protected readonly hasScrollLeft: _angular_core.WritableSignal<boolean>;
710
780
  /** True when table has right-pinned columns and body isn't scrolled to the end */
711
781
  protected readonly hasScrollRight: _angular_core.WritableSignal<boolean>;
712
782
  /** Maps row IDs to measured DOM heights for pinned row offset calculations */
713
783
  protected readonly pinnedRowHeights: _angular_core.WritableSignal<Record<string, number>>;
784
+ protected readonly defaultBulkActions: _angular_core.Signal<ZTableBulkActionItem<T>[]>;
714
785
  /** Bumped to force recomputation of pinned column IDs after programmatic pin changes */
715
786
  private readonly _columnPinVersion;
716
787
  /** Bumped to trigger data refresh (e.g., after addItem/deleteItem via control API) */
@@ -838,6 +909,17 @@ declare class ZTableComponent<T> implements AfterViewInit {
838
909
  protected readonly columnSizeVars: _angular_core.Signal<Record<string, number>>;
839
910
  protected readonly table: ReturnType<typeof createAngularTable<T>>;
840
911
  private readonly _virtualGroupCount;
912
+ protected readonly selectedRowIds: _angular_core.Signal<string[]>;
913
+ protected readonly selectedRows: _angular_core.Signal<T[]>;
914
+ protected readonly bulkActionContext: _angular_core.Signal<ZTableBulkActionContext<T>>;
915
+ protected readonly bulkActionConfig: _angular_core.Signal<ZTableBulkActionOptions<T> | null>;
916
+ protected readonly bulkActionItems: _angular_core.Signal<{
917
+ action: ZTableBulkActionItem<T>;
918
+ disabled: boolean;
919
+ }[]>;
920
+ protected readonly showBulkBar: _angular_core.Signal<boolean>;
921
+ protected readonly bulkBarPositions: ConnectedPosition[];
922
+ private readonly _bulkBarExitDuration;
841
923
  /** Virtualizer instance — operates on groups rather than individual rows */
842
924
  protected readonly virtualizer: _shival99_angular_virtual.AngularVirtualizer<HTMLDivElement, Element>;
843
925
  private readonly _measureVirtualItems;
@@ -849,6 +931,18 @@ declare class ZTableComponent<T> implements AfterViewInit {
849
931
  * if no children are selected, the parent is deselected.
850
932
  */
851
933
  private _handleRowSelectionWithParents;
934
+ protected clearSelection(): void;
935
+ protected onBulkActionClick(item: ZTableBulkActionItem<T>): Promise<void>;
936
+ private _resolveBulkActionList;
937
+ private _createBulkActionHandlerContext;
938
+ private _exportSelectionToExcel;
939
+ private _createExcelExportContext;
940
+ private _getExcelExportData;
941
+ private _getExcelExportFileName;
942
+ private _toExcelTableColumns;
943
+ private _getExcelColumnHeader;
944
+ private _getExcelColumnHeaderAlign;
945
+ private _clearBulkBarTimer;
852
946
  /**
853
947
  * Wraps state mutations with a debounced processing indicator.
854
948
  * Shows a brief loading state to prevent UI flicker during
@@ -1119,4 +1213,4 @@ declare const findColumnConfig: <T>(columnId: string, columns: ZTableColumnConfi
1119
1213
  declare function columnConfigToColumnDef<T>(config: ZTableColumnConfig<T>): ColumnDef<T>;
1120
1214
 
1121
1215
  export { ZTableActionsComponent, ZTableComponent, ZTableEditCellComponent, ZTableFilterComponent, ZTableIconTextComponent, columnConfigToColumnDef, findColumnConfig, getBodyConfig, getFooterConfig, getHeaderConfig, isBodyConfig, isFooterConfig, isHeaderConfig };
1122
- export type { ZTableActionBodyConfig, ZTableActionClickEvent, ZTableActionColumnConfig, ZTableActionItem, ZTableActionList, ZTableCellEditChange, ZTableCellEditEvent, ZTableChangeEvent, ZTableColumn, ZTableColumnConfig, ZTableConfig, ZTableControl, ZTableEditCellChangeEvent, ZTableEditConfig, ZTableEditSize, ZTableEditType, ZTableFilterChangeEvent, ZTableFilterConfig, ZTableFilterType, ZTablePageChangeEvent, ZTablePaginationConfig, ZTableRowExpandEvent, ZTableRowSelectEvent, ZTableSavedConfig, ZTableSearchChangeEvent, ZTableSearchConfig, ZTableSortChangeEvent, ZTableSortConfig };
1216
+ export type { ZTableActionBodyConfig, ZTableActionClickEvent, ZTableActionColumnConfig, ZTableActionItem, ZTableActionList, ZTableBulkActionClickEvent, ZTableBulkActionConfig, ZTableBulkActionContext, ZTableBulkActionHandlerContext, ZTableBulkActionItem, ZTableBulkActionList, ZTableBulkActionOptions, ZTableBulkActionViewItem, ZTableCellEditChange, ZTableCellEditEvent, ZTableChangeEvent, ZTableColumn, ZTableColumnConfig, ZTableConfig, ZTableControl, ZTableEditCellChangeEvent, ZTableEditConfig, ZTableEditSize, ZTableEditType, ZTableExcelExportConfig, ZTableExcelExportContext, ZTableExcelExportScope, ZTableFilterChangeEvent, ZTableFilterConfig, ZTableFilterType, ZTablePageChangeEvent, ZTablePaginationConfig, ZTableRowExpandEvent, ZTableRowSelectEvent, ZTableSavedConfig, ZTableSearchChangeEvent, ZTableSearchConfig, ZTableSortChangeEvent, ZTableSortConfig };