@shival99/z-ui 1.3.26 → 1.3.28

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.
@@ -28,13 +28,21 @@ import { FormsModule } from '@angular/forms';
28
28
  import { ZCalendarComponent } from '@shival99/z-ui/components/z-calendar';
29
29
  import { ZSelectComponent } from '@shival99/z-ui/components/z-select';
30
30
 
31
- const DEFAULT_MAX_VISIBLE = 3;
32
- const DEFAULT_DROPDOWN_BUTTON_SIZE = 'sm';
31
+ const Z_DEFAULT_ROW_HEIGHT = 40;
32
+ const Z_DEFAULT_VIRTUAL_OVERSCAN = 5;
33
+ const Z_DEFAULT_GROUP_SIZE = 1;
34
+ const Z_DEFAULT_COLUMN_MIN_SIZE = 100;
35
+ const Z_DEFAULT_DEBOUNCE_TIME = 150;
36
+ const Z_SKELETON_ROW_HEIGHT = 60;
37
+ const Z_TABLE_DEFAULT_ACTION_BUTTON_WIDTH = 32;
38
+ const Z_TABLE_DEFAULT_MAX_VISIBLE_ACTIONS = 3;
39
+ const Z_TABLE_DEFAULT_DROPDOWN_BUTTON_SIZE = 'sm';
40
+
33
41
  class ZTableActionsComponent {
34
42
  zConfig = input.required(...(ngDevMode ? [{ debugName: "zConfig" }] : []));
35
43
  zRow = input.required(...(ngDevMode ? [{ debugName: "zRow" }] : []));
36
44
  zRowId = input.required(...(ngDevMode ? [{ debugName: "zRowId" }] : []));
37
- zDropdownButtonSize = input(DEFAULT_DROPDOWN_BUTTON_SIZE, ...(ngDevMode ? [{ debugName: "zDropdownButtonSize" }] : []));
45
+ zDropdownButtonSize = input(Z_TABLE_DEFAULT_DROPDOWN_BUTTON_SIZE, ...(ngDevMode ? [{ debugName: "zDropdownButtonSize" }] : []));
38
46
  zActionClick = output();
39
47
  allActions = computed(() => {
40
48
  const config = this.zConfig();
@@ -48,7 +56,7 @@ class ZTableActionsComponent {
48
56
  }, ...(ngDevMode ? [{ debugName: "allActions" }] : []));
49
57
  shouldShowAsButtons = computed(() => {
50
58
  const actions = this.allActions();
51
- const maxVisible = this.zConfig().maxVisible ?? DEFAULT_MAX_VISIBLE;
59
+ const maxVisible = this.zConfig().maxVisible ?? Z_TABLE_DEFAULT_MAX_VISIBLE_ACTIONS;
52
60
  return actions.length <= maxVisible;
53
61
  }, ...(ngDevMode ? [{ debugName: "shouldShowAsButtons" }] : []));
54
62
  actionStates = computed(() => {
@@ -61,7 +69,7 @@ class ZTableActionsComponent {
61
69
  states[action.key] = {
62
70
  visible: !isHidden,
63
71
  disabled: isDisabled,
64
- tooltip: action.tooltip ?? '',
72
+ tooltipState: this._getTooltipState(action.tooltip),
65
73
  };
66
74
  }
67
75
  return states;
@@ -81,6 +89,22 @@ class ZTableActionsComponent {
81
89
  };
82
90
  });
83
91
  }, ...(ngDevMode ? [{ debugName: "dropdownItems" }] : []));
92
+ _getTooltipState(tooltip) {
93
+ if (!tooltip) {
94
+ return { content: '', alwaysShow: false };
95
+ }
96
+ if (typeof tooltip === 'string') {
97
+ return { content: tooltip, alwaysShow: true };
98
+ }
99
+ return {
100
+ content: tooltip.content ?? '',
101
+ alwaysShow: tooltip.alwaysShow ?? true,
102
+ position: tooltip.position,
103
+ arrow: tooltip.arrow,
104
+ offset: tooltip.offset,
105
+ maxWidth: tooltip.maxWidth,
106
+ };
107
+ }
84
108
  _onActionClick(action, event) {
85
109
  event.stopPropagation();
86
110
  const states = this.actionStates();
@@ -117,7 +141,11 @@ class ZTableActionsComponent {
117
141
  [zSize]="action.size ?? 'sm'"
118
142
  [zDisabled]="actionStates()[action.key]?.disabled ?? false"
119
143
  [class]="action.class ?? ''"
120
- [zContent]="actionStates()[action.key]?.tooltip ?? ''"
144
+ [zContent]="actionStates()[action.key]?.tooltipState?.content ?? ''"
145
+ [zAlwaysShow]="actionStates()[action.key]?.tooltipState?.alwaysShow ?? false"
146
+ [zArrow]="actionStates()[action.key]?.tooltipState?.arrow ?? true"
147
+ [zOffset]="actionStates()[action.key]?.tooltipState?.offset ?? 8"
148
+ [zMaxWidth]="actionStates()[action.key]?.tooltipState?.maxWidth ?? '250px'"
121
149
  (click)="_onActionClick(action, $event)"
122
150
  >
123
151
  @if (action.icon && action.label) {
@@ -169,7 +197,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
169
197
  [zSize]="action.size ?? 'sm'"
170
198
  [zDisabled]="actionStates()[action.key]?.disabled ?? false"
171
199
  [class]="action.class ?? ''"
172
- [zContent]="actionStates()[action.key]?.tooltip ?? ''"
200
+ [zContent]="actionStates()[action.key]?.tooltipState?.content ?? ''"
201
+ [zAlwaysShow]="actionStates()[action.key]?.tooltipState?.alwaysShow ?? false"
202
+ [zArrow]="actionStates()[action.key]?.tooltipState?.arrow ?? true"
203
+ [zOffset]="actionStates()[action.key]?.tooltipState?.offset ?? 8"
204
+ [zMaxWidth]="actionStates()[action.key]?.tooltipState?.maxWidth ?? '250px'"
173
205
  (click)="_onActionClick(action, $event)"
174
206
  >
175
207
  @if (action.icon && action.label) {
@@ -581,14 +613,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
581
613
  }, styles: [":host{color:var(--foreground);font-weight:450;font-style:normal;text-decoration:none;text-transform:none;letter-spacing:normal}\n"] }]
582
614
  }], propDecorators: { zColumn: [{ type: i0.Input, args: [{ isSignal: true, alias: "zColumn", required: true }] }], zTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "zTable", required: true }] }] } });
583
615
 
584
- const Z_DEFAULT_ROW_HEIGHT = 40;
585
- const Z_DEFAULT_VIRTUAL_OVERSCAN = 5;
586
- const Z_DEFAULT_GROUP_SIZE = 1;
587
- const Z_DEFAULT_COLUMN_MIN_SIZE = 100;
588
- const Z_DEFAULT_DEBOUNCE_TIME = 150;
589
- const Z_SKELETON_ROW_HEIGHT = 60;
590
- const Z_TABLE_DEFAULT_ACTION_BUTTON_WIDTH = 32;
591
-
592
616
  const filterVisibleColumns = (columns) => columns
593
617
  .filter(col => {
594
618
  const { visible } = col;