@shival99/z-ui 1.2.21 → 1.2.22

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.
@@ -264,8 +264,26 @@ class ZTableFilterComponent {
264
264
  if (columnDef.filterOptions && columnDef.filterOptions.length > 0) {
265
265
  return columnDef.filterOptions;
266
266
  }
267
- const uniqueValues = Array.from(this.zColumn().getFacetedUniqueValues().keys()).sort().slice(0, 5000);
268
- return uniqueValues.map(v => ({ label: String(v), value: String(v) }));
267
+ const facetedValues = this.zColumn().getFacetedUniqueValues();
268
+ if (facetedValues && facetedValues.size > 0) {
269
+ const uniqueValues = Array.from(facetedValues.keys()).sort().slice(0, 5000);
270
+ return uniqueValues.map(v => ({ label: String(v), value: String(v) }));
271
+ }
272
+ const table = this.zTable();
273
+ const column = this.zColumn();
274
+ const { rows } = table.getRowModel();
275
+ if (rows.length === 0) {
276
+ return [];
277
+ }
278
+ const uniqueValues = new Set();
279
+ for (const row of rows) {
280
+ const value = row.getValue(column.id);
281
+ if (value !== null && value !== undefined && value !== '') {
282
+ uniqueValues.add(String(value));
283
+ }
284
+ }
285
+ const sortedValues = Array.from(uniqueValues).sort();
286
+ return sortedValues.map(v => ({ label: String(v), value: String(v) }));
269
287
  }, ...(ngDevMode ? [{ debugName: "selectOptions" }] : []));
270
288
  ngOnDestroy() {
271
289
  if (this._debounceTimeout) {
@@ -348,6 +366,7 @@ class ZTableFilterComponent {
348
366
  zSize="sm"
349
367
  zAllowClear
350
368
  zValueType="date"
369
+ [zScrollClose]="true"
351
370
  [zPlaceholder]="'i18n_z_ui_table_filter_date' | translate"
352
371
  [ngModel]="dateValue()"
353
372
  (ngModelChange)="onDateChange($event)"
@@ -360,6 +379,7 @@ class ZTableFilterComponent {
360
379
  zSize="sm"
361
380
  zAllowClear
362
381
  zValueType="date"
382
+ [zScrollClose]="true"
363
383
  [zPlaceholder]="'i18n_z_ui_table_filter_date_range' | translate"
364
384
  [ngModel]="dateRangeValue()"
365
385
  (ngModelChange)="onDateRangeChange($event)"
@@ -371,8 +391,10 @@ class ZTableFilterComponent {
371
391
  zSize="sm"
372
392
  zAllowClear
373
393
  [zWrap]="false"
394
+ [zScrollClose]="true"
374
395
  [zOptions]="selectOptions()"
375
396
  [ngModel]="selectValue()"
397
+ [zMaxVisible]="30"
376
398
  [zPlaceholder]="'i18n_z_ui_common_select' | translate"
377
399
  (ngModelChange)="onSelectChange($event)"
378
400
  class="w-full min-w-0"
@@ -384,8 +406,10 @@ class ZTableFilterComponent {
384
406
  zSize="sm"
385
407
  zAllowClear
386
408
  [zWrap]="false"
409
+ [zScrollClose]="true"
387
410
  [zOptions]="selectOptions()"
388
411
  [zMaxTagCount]="1"
412
+ [zMaxVisible]="30"
389
413
  [ngModel]="multiSelectValue()"
390
414
  [zPlaceholder]="'i18n_z_ui_common_select' | translate"
391
415
  (ngModelChange)="onMultiSelectChange($event)"
@@ -398,7 +422,9 @@ class ZTableFilterComponent {
398
422
  zSize="sm"
399
423
  [zOptions]="selectOptions()"
400
424
  [zWrap]="false"
425
+ [zScrollClose]="true"
401
426
  [zMaxTagCount]="1"
427
+ [zMaxVisible]="30"
402
428
  [zPlaceholder]="'i18n_z_ui_common_select' | translate"
403
429
  class="w-full min-w-0"
404
430
  [zAllowClear]="true"
@@ -429,7 +455,7 @@ class ZTableFilterComponent {
429
455
  />
430
456
  }
431
457
  }
432
- `, isInline: true, styles: [":host{color:var(--foreground);font-weight:450;font-style:normal;text-decoration:none;text-transform:none;letter-spacing:normal}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZInputComponent, selector: "z-input", inputs: ["class", "zType", "zSize", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zPrefix", "zSuffix", "zMin", "zMax", "zStep", "zShowArrows", "zMask", "zDecimalPlaces", "zAllowNegative", "zThousandSeparator", "zDecimalMarker", "zValidators", "zAsyncValidators", "zAsyncDebounce", "zAsyncValidateOn", "zShowPasswordToggle", "zSearch", "zDebounce", "zAutofocus", "zAutoComplete", "zAllowClear", "zAutoSizeContent", "zRows", "zResize", "zMaxLength", "zAutoSuggest"], outputs: ["zOnSearch", "zOnChange", "zControl"], exportAs: ["zInput"] }, { kind: "component", type: ZSelectComponent, selector: "z-select", inputs: ["class", "zMode", "zSize", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zLoading", "zPrefix", "zAllowClear", "zWrap", "zShowSearch", "zPlaceholderSearch", "zDebounce", "zNotFoundText", "zEmptyText", "zEmptyIcon", "zMaxTagCount", "zDropdownMaxHeight", "zOptionHeight", "zVirtualScroll", "zShowAction", "zOptions", "zTranslateLabels", "zKey", "zSearchServer", "zLoadingMore", "zEnableLoadMore", "zScrollDistance", "zSelectedTemplate", "zOptionTemplate", "zActionTemplate", "zAsyncValidators", "zAsyncDebounce", "zAsyncValidateOn", "zValidators"], outputs: ["zOnSearch", "zOnLoadMore", "zControl"], exportAs: ["zSelect"] }, { kind: "component", type: ZCalendarComponent, selector: "z-calendar", inputs: ["class", "zMode", "zSize", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zShowTime", "zTimeFormat", "zShowHour", "zShowMinute", "zShowSecond", "zQuickSelect", "zAllowClear", "zFormat", "zMinDate", "zMaxDate", "zValueType", "zValidators", "zLocale", "zShowOk", "zOkText", "zShowCancel", "zCancelText", "zDisabledDate"], outputs: ["zControl", "zChange"], exportAs: ["zCalendar"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
458
+ `, isInline: true, styles: [":host{color:var(--foreground);font-weight:450;font-style:normal;text-decoration:none;text-transform:none;letter-spacing:normal}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ZInputComponent, selector: "z-input", inputs: ["class", "zType", "zSize", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zPrefix", "zSuffix", "zMin", "zMax", "zStep", "zShowArrows", "zMask", "zDecimalPlaces", "zAllowNegative", "zThousandSeparator", "zDecimalMarker", "zValidators", "zAsyncValidators", "zAsyncDebounce", "zAsyncValidateOn", "zShowPasswordToggle", "zSearch", "zDebounce", "zAutofocus", "zAutoComplete", "zAllowClear", "zAutoSizeContent", "zRows", "zResize", "zMaxLength", "zAutoSuggest"], outputs: ["zOnSearch", "zOnChange", "zControl"], exportAs: ["zInput"] }, { kind: "component", type: ZSelectComponent, selector: "z-select", inputs: ["class", "zMode", "zSize", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zLoading", "zPrefix", "zAllowClear", "zWrap", "zShowSearch", "zPlaceholderSearch", "zDebounce", "zNotFoundText", "zEmptyText", "zEmptyIcon", "zMaxTagCount", "zDropdownMaxHeight", "zOptionHeight", "zVirtualScroll", "zShowAction", "zOptions", "zTranslateLabels", "zKey", "zSearchServer", "zLoadingMore", "zEnableLoadMore", "zScrollDistance", "zMaxVisible", "zScrollClose", "zSelectedTemplate", "zOptionTemplate", "zActionTemplate", "zAsyncValidators", "zAsyncDebounce", "zAsyncValidateOn", "zValidators"], outputs: ["zOnSearch", "zOnLoadMore", "zControl"], exportAs: ["zSelect"] }, { kind: "component", type: ZCalendarComponent, selector: "z-calendar", inputs: ["class", "zMode", "zSize", "zLabel", "zLabelClass", "zPlaceholder", "zRequired", "zDisabled", "zReadonly", "zShowTime", "zTimeFormat", "zShowHour", "zShowMinute", "zShowSecond", "zQuickSelect", "zAllowClear", "zFormat", "zMinDate", "zMaxDate", "zValueType", "zValidators", "zLocale", "zShowOk", "zOkText", "zShowCancel", "zCancelText", "zDisabledDate", "zScrollClose"], outputs: ["zControl", "zChange"], exportAs: ["zCalendar"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
433
459
  }
434
460
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZTableFilterComponent, decorators: [{
435
461
  type: Component,
@@ -461,6 +487,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
461
487
  zSize="sm"
462
488
  zAllowClear
463
489
  zValueType="date"
490
+ [zScrollClose]="true"
464
491
  [zPlaceholder]="'i18n_z_ui_table_filter_date' | translate"
465
492
  [ngModel]="dateValue()"
466
493
  (ngModelChange)="onDateChange($event)"
@@ -473,6 +500,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
473
500
  zSize="sm"
474
501
  zAllowClear
475
502
  zValueType="date"
503
+ [zScrollClose]="true"
476
504
  [zPlaceholder]="'i18n_z_ui_table_filter_date_range' | translate"
477
505
  [ngModel]="dateRangeValue()"
478
506
  (ngModelChange)="onDateRangeChange($event)"
@@ -484,8 +512,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
484
512
  zSize="sm"
485
513
  zAllowClear
486
514
  [zWrap]="false"
515
+ [zScrollClose]="true"
487
516
  [zOptions]="selectOptions()"
488
517
  [ngModel]="selectValue()"
518
+ [zMaxVisible]="30"
489
519
  [zPlaceholder]="'i18n_z_ui_common_select' | translate"
490
520
  (ngModelChange)="onSelectChange($event)"
491
521
  class="w-full min-w-0"
@@ -497,8 +527,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
497
527
  zSize="sm"
498
528
  zAllowClear
499
529
  [zWrap]="false"
530
+ [zScrollClose]="true"
500
531
  [zOptions]="selectOptions()"
501
532
  [zMaxTagCount]="1"
533
+ [zMaxVisible]="30"
502
534
  [ngModel]="multiSelectValue()"
503
535
  [zPlaceholder]="'i18n_z_ui_common_select' | translate"
504
536
  (ngModelChange)="onMultiSelectChange($event)"
@@ -511,7 +543,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
511
543
  zSize="sm"
512
544
  [zOptions]="selectOptions()"
513
545
  [zWrap]="false"
546
+ [zScrollClose]="true"
514
547
  [zMaxTagCount]="1"
548
+ [zMaxVisible]="30"
515
549
  [zPlaceholder]="'i18n_z_ui_common_select' | translate"
516
550
  class="w-full min-w-0"
517
551
  [zAllowClear]="true"
@@ -1029,6 +1063,91 @@ function columnConfigToColumnDef(config) {
1029
1063
  return filterSet.has(cellValue);
1030
1064
  };
1031
1065
  }
1066
+ if (filterConfig?.type === 'date') {
1067
+ columnDef.filterFn = (row, columnId, filterValue) => {
1068
+ if (!filterValue) {
1069
+ return true;
1070
+ }
1071
+ const cellValue = row.getValue(columnId);
1072
+ if (!cellValue) {
1073
+ return false;
1074
+ }
1075
+ const cellDate = cellValue instanceof Date ? cellValue : new Date(cellValue);
1076
+ const filterDate = filterValue instanceof Date ? filterValue : new Date(filterValue);
1077
+ if (isNaN(cellDate.getTime()) || isNaN(filterDate.getTime())) {
1078
+ return false;
1079
+ }
1080
+ return (cellDate.getFullYear() === filterDate.getFullYear() &&
1081
+ cellDate.getMonth() === filterDate.getMonth() &&
1082
+ cellDate.getDate() === filterDate.getDate());
1083
+ };
1084
+ }
1085
+ if (filterConfig?.type === 'date-range') {
1086
+ columnDef.filterFn = (row, columnId, filterValue) => {
1087
+ if (!filterValue || typeof filterValue !== 'object') {
1088
+ return true;
1089
+ }
1090
+ const { start, end } = filterValue;
1091
+ if (!start && !end) {
1092
+ return true;
1093
+ }
1094
+ const cellValue = row.getValue(columnId);
1095
+ if (!cellValue) {
1096
+ return false;
1097
+ }
1098
+ const cellDate = cellValue instanceof Date ? cellValue : new Date(cellValue);
1099
+ if (isNaN(cellDate.getTime())) {
1100
+ return false;
1101
+ }
1102
+ // Normalize cell date to start of day for comparison
1103
+ const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
1104
+ if (start) {
1105
+ const startDate = start instanceof Date ? start : new Date(start);
1106
+ if (!isNaN(startDate.getTime())) {
1107
+ const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
1108
+ if (cellDateOnly < startDateOnly) {
1109
+ return false;
1110
+ }
1111
+ }
1112
+ }
1113
+ if (end) {
1114
+ const endDate = end instanceof Date ? end : new Date(end);
1115
+ if (!isNaN(endDate.getTime())) {
1116
+ const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
1117
+ if (cellDateOnly > endDateOnly) {
1118
+ return false;
1119
+ }
1120
+ }
1121
+ }
1122
+ return true;
1123
+ };
1124
+ }
1125
+ if (filterConfig?.type === 'range') {
1126
+ columnDef.filterFn = (row, columnId, filterValue) => {
1127
+ if (!filterValue || !Array.isArray(filterValue)) {
1128
+ return true;
1129
+ }
1130
+ const [min, max] = filterValue;
1131
+ if (min === undefined && max === undefined) {
1132
+ return true;
1133
+ }
1134
+ const cellValue = row.getValue(columnId);
1135
+ if (cellValue === null || cellValue === undefined) {
1136
+ return false;
1137
+ }
1138
+ const numValue = typeof cellValue === 'number' ? cellValue : Number(cellValue);
1139
+ if (isNaN(numValue)) {
1140
+ return false;
1141
+ }
1142
+ if (min !== undefined && numValue < min) {
1143
+ return false;
1144
+ }
1145
+ if (max !== undefined && numValue > max) {
1146
+ return false;
1147
+ }
1148
+ return true;
1149
+ };
1150
+ }
1032
1151
  if (config.columns && config.columns.length > 0) {
1033
1152
  columnDef.columns = config.columns.map(subConfig => columnConfigToColumnDef(subConfig));
1034
1153
  }