@kris701/ez-ui 1.1.8 → 1.1.10

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.
@@ -1,20 +1,20 @@
1
+ import * as i2$1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
1
3
  import * as i0 from '@angular/core';
2
- import { EventEmitter, signal, Output, Input, Component, ViewChild, ContentChild, Directive, inject } from '@angular/core';
4
+ import { EventEmitter, Output, Input, Component, signal, ViewChild, ContentChild, Directive, inject } from '@angular/core';
3
5
  import * as i1 from '@angular/forms';
4
6
  import { FormsModule } from '@angular/forms';
7
+ import * as i3$1 from '@taiga-ui/core';
8
+ import { TuiIcon, TuiInput, TuiButton, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiHint, TuiLoader, TuiCheckbox, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
9
+ import * as i4$1 from '@taiga-ui/kit';
10
+ import { TuiBlock, TuiSwitch, TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiMultiSelect, TuiInputNumber, TuiInputChip, TuiPassword, TuiBadge, TuiStatus, TuiDataListWrapper, TuiBadgeNotification, TuiBadgedContent, TuiButtonSelect, TuiStringifyContentPipe, TUI_CONFIRM } from '@taiga-ui/kit';
5
11
  import * as i3$3 from '@taiga-ui/addon-mobile';
6
12
  import { TuiDropdownSheet } from '@taiga-ui/addon-mobile';
7
13
  import { TuiDay, TuiTime } from '@taiga-ui/cdk/date-time';
8
- import * as i3$1 from '@taiga-ui/core';
9
- import { TuiInput, TuiButton, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiIcon, TuiHint, TuiLoader, TuiCheckbox, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
10
- import * as i4$1 from '@taiga-ui/kit';
11
- import { TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiMultiSelect, TuiInputNumber, TuiInputChip, TuiPassword, TuiBadge, TuiStatus, TuiDataListWrapper, TuiBadgeNotification, TuiBlock, TuiBadgedContent, TuiButtonSelect, TuiStringifyContentPipe, TUI_CONFIRM } from '@taiga-ui/kit';
12
14
  import * as i2 from '@taiga-ui/core/components/label';
13
15
  import * as i3 from '@taiga-ui/core/components/textfield';
14
16
  import * as i4 from '@taiga-ui/core/portals/dropdown';
15
17
  import * as i6 from '@taiga-ui/core/components/calendar';
16
- import * as i2$1 from '@angular/common';
17
- import { CommonModule } from '@angular/common';
18
18
  import { marked } from 'marked';
19
19
  import Compressor from 'compressorjs';
20
20
  import * as i7 from '@taiga-ui/cdk/directives/item';
@@ -28,6 +28,76 @@ import * as i1$1 from '@angular/common/http';
28
28
  import * as i3$4 from '@angular/router';
29
29
  import { RouterLink, NavigationEnd, RouterModule } from '@angular/router';
30
30
 
31
+ class EzUIBooleanInput {
32
+ icon = '';
33
+ label = '';
34
+ size = 'm';
35
+ disabled = false;
36
+ value = false;
37
+ valueChange = new EventEmitter();
38
+ ngOnChanges(changes) {
39
+ if (changes['value'] && changes['value'].currentValue != changes['value'].previousValue) {
40
+ this.value = changes['value'].currentValue;
41
+ }
42
+ }
43
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUIBooleanInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
44
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUIBooleanInput, isStandalone: true, selector: "ezui-booleaninput", inputs: { icon: "icon", label: "label", size: "size", disabled: "disabled", value: "value" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: `
45
+ <label class="boolean-container" [tuiBlock]="size">
46
+ @if(icon && icon != ''){
47
+ <tui-icon [icon]="icon" />
48
+ }
49
+ {{label}}
50
+ <div style="flex-grow:1"></div>
51
+ <input
52
+ size="s"
53
+ tuiSwitch
54
+ type="checkbox"
55
+ [disabled]="disabled"
56
+ [(ngModel)]="value"
57
+ (ngModelChange)="valueChange.emit(value)"
58
+ />
59
+ </label>
60
+ `, isInline: true, styles: [".boolean-container{display:flex;flex-direction:row;gap:10px;width:100%;background-color:var(--tui-background-neutral-1)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]" }, { 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: "ngmodule", type: CommonModule }, { kind: "directive", type: TuiBlock, selector: "label[tuiBlock],input[tuiBlock]", inputs: ["tuiBlock"] }, { kind: "component", type: TuiSwitch, selector: "input[type=\"checkbox\"][tuiSwitch]", inputs: ["showIcons"] }, { kind: "component", type: TuiIcon, selector: "tui-icon:not([tuiBadge])", inputs: ["background"] }] });
61
+ }
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUIBooleanInput, decorators: [{
63
+ type: Component,
64
+ args: [{ selector: 'ezui-booleaninput', imports: [
65
+ FormsModule,
66
+ CommonModule,
67
+ TuiBlock,
68
+ TuiSwitch,
69
+ TuiIcon
70
+ ], template: `
71
+ <label class="boolean-container" [tuiBlock]="size">
72
+ @if(icon && icon != ''){
73
+ <tui-icon [icon]="icon" />
74
+ }
75
+ {{label}}
76
+ <div style="flex-grow:1"></div>
77
+ <input
78
+ size="s"
79
+ tuiSwitch
80
+ type="checkbox"
81
+ [disabled]="disabled"
82
+ [(ngModel)]="value"
83
+ (ngModelChange)="valueChange.emit(value)"
84
+ />
85
+ </label>
86
+ `, styles: [".boolean-container{display:flex;flex-direction:row;gap:10px;width:100%;background-color:var(--tui-background-neutral-1)}\n"] }]
87
+ }], propDecorators: { icon: [{
88
+ type: Input
89
+ }], label: [{
90
+ type: Input
91
+ }], size: [{
92
+ type: Input
93
+ }], disabled: [{
94
+ type: Input
95
+ }], value: [{
96
+ type: Input
97
+ }], valueChange: [{
98
+ type: Output
99
+ }] } });
100
+
31
101
  class EzUIDateInput {
32
102
  icon = '';
33
103
  label = '';
@@ -3176,30 +3246,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3176
3246
  }] } });
3177
3247
 
3178
3248
  class EzUIFilterHelpers {
3179
- static textFilter(values, fn, column) {
3249
+ static genericFilter(values, fn, column) {
3180
3250
  const filtered = [];
3181
3251
  for (const value of values) {
3182
- const asStr = value[column];
3183
- if (fn(asStr))
3184
- filtered.push(value);
3252
+ const base = value[column];
3253
+ if (Array.isArray(base)) {
3254
+ for (let item of base) {
3255
+ const asGeneric = item;
3256
+ if (fn(asGeneric)) {
3257
+ filtered.push(value);
3258
+ break;
3259
+ }
3260
+ }
3261
+ }
3262
+ else {
3263
+ const asGeneric = base;
3264
+ if (fn(asGeneric))
3265
+ filtered.push(value);
3266
+ }
3185
3267
  }
3186
3268
  return filtered;
3187
3269
  }
3188
3270
  static dateFilter(values, fn, column) {
3189
3271
  const filtered = [];
3190
3272
  for (const value of values) {
3191
- const asDate = new Date(value[column]);
3192
- if (fn(asDate))
3193
- filtered.push(value);
3194
- }
3195
- return filtered;
3196
- }
3197
- static boolFilter(values, fn, column) {
3198
- const filtered = [];
3199
- for (const value of values) {
3200
- const asBoolean = value[column];
3201
- if (fn(asBoolean))
3202
- filtered.push(value);
3273
+ const base = value[column];
3274
+ if (Array.isArray(base)) {
3275
+ for (let item of base) {
3276
+ const asDate = new Date(item);
3277
+ if (fn(asDate)) {
3278
+ filtered.push(value);
3279
+ break;
3280
+ }
3281
+ }
3282
+ }
3283
+ else {
3284
+ const asDate = new Date(base);
3285
+ if (fn(asDate))
3286
+ filtered.push(value);
3287
+ }
3203
3288
  }
3204
3289
  return filtered;
3205
3290
  }
@@ -3233,33 +3318,33 @@ class EzUITableFilterService {
3233
3318
  {
3234
3319
  key: 'str',
3235
3320
  action: 'con',
3236
- filter: (values, column, value) => EzUIFilterHelpers.textFilter(values, (i) => i.includes(value), column)
3321
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i.includes(value), column)
3237
3322
  },
3238
3323
  {
3239
3324
  key: 'str',
3240
3325
  action: 'ncon',
3241
- filter: (values, column, value) => EzUIFilterHelpers.textFilter(values, (i) => !i.includes(value), column)
3326
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => !i.includes(value), column)
3242
3327
  },
3243
3328
  {
3244
3329
  key: 'str',
3245
3330
  action: 'sta',
3246
- filter: (values, column, value) => EzUIFilterHelpers.textFilter(values, (i) => i.startsWith(value), column)
3331
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i.startsWith(value), column)
3247
3332
  },
3248
3333
  {
3249
3334
  key: 'str',
3250
3335
  action: 'end',
3251
- filter: (values, column, value) => EzUIFilterHelpers.textFilter(values, (i) => i.endsWith(value), column)
3336
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i.endsWith(value), column)
3252
3337
  },
3253
3338
  // Select filters
3254
3339
  {
3255
3340
  key: 'sel',
3256
3341
  action: 'con',
3257
- filter: (values, column, value) => EzUIFilterHelpers.textFilter(values, (i) => value.includes(i), column)
3342
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => value.includes(i), column)
3258
3343
  },
3259
3344
  {
3260
3345
  key: 'sel',
3261
3346
  action: 'ncon',
3262
- filter: (values, column, value) => EzUIFilterHelpers.textFilter(values, (i) => !value.includes(i), column)
3347
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => !value.includes(i), column)
3263
3348
  },
3264
3349
  // Date filters
3265
3350
  {
@@ -3284,7 +3369,7 @@ class EzUITableFilterService {
3284
3369
  {
3285
3370
  key: 'bol',
3286
3371
  action: 'true',
3287
- filter: (values, column, value) => EzUIFilterHelpers.boolFilter(values, (i) => i === value, column)
3372
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i === value, column)
3288
3373
  },
3289
3374
  ];
3290
3375
  sort(values, sort) {
@@ -4052,11 +4137,27 @@ class EzUITableSelectFilter {
4052
4137
  filterVisible = signal(false, /* @ts-ignore */
4053
4138
  ...(ngDevMode ? [{ debugName: "filterVisible" }] : /* istanbul ignore next */ []));
4054
4139
  table;
4140
+ optionLabel = undefined;
4141
+ optionValue = undefined;
4055
4142
  options = [];
4056
4143
  selected = [];
4057
4144
  filterType;
4058
4145
  filterTypes;
4059
- stringify = (item) => `${item.label}`;
4146
+ stringify = (value) => this.getOptionLabel(this.options.find((item) => this.getOptionValue(item) === value));
4147
+ getOptionLabel(item) {
4148
+ if (!item)
4149
+ return "";
4150
+ if (this.optionLabel == undefined || this.optionLabel == '')
4151
+ return item;
4152
+ return item[this.optionLabel];
4153
+ }
4154
+ getOptionValue(item) {
4155
+ if (!item)
4156
+ return "";
4157
+ if (this.optionValue == undefined || this.optionValue == '')
4158
+ return item;
4159
+ return item[this.optionValue];
4160
+ }
4060
4161
  constructor(table) {
4061
4162
  this.table = table;
4062
4163
  this.filterTypes = [
@@ -4111,7 +4212,7 @@ class EzUITableSelectFilter {
4111
4212
  this.filterApplied.set(false);
4112
4213
  }
4113
4214
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableSelectFilter, deps: [{ token: EzUITable }], target: i0.ɵɵFactoryTarget.Component });
4114
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUITableSelectFilter, isStandalone: true, selector: "ezui-table-selectfilter", inputs: { column: "column", options: "options" }, ngImport: i0, template: `
4215
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUITableSelectFilter, isStandalone: true, selector: "ezui-table-selectfilter", inputs: { column: "column", optionLabel: "optionLabel", optionValue: "optionValue", options: "options" }, ngImport: i0, template: `
4115
4216
  @if(column){
4116
4217
  <tui-badged-content>
4117
4218
  @if(filterApplied()){
@@ -4164,13 +4265,13 @@ class EzUITableSelectFilter {
4164
4265
  label="Options"
4165
4266
  tuiMultiSelectGroup
4166
4267
  >
4167
- @for (option of options; track option) {
4268
+ @for (option of options; track getOptionValue(option)) {
4168
4269
  <button
4169
4270
  tuiOption
4170
4271
  type="button"
4171
- [value]="option"
4272
+ [value]="getOptionValue(option)"
4172
4273
  >
4173
- {{ option }}
4274
+ {{ getOptionLabel(option) }}
4174
4275
  </button>
4175
4276
  }
4176
4277
  </tui-opt-group>
@@ -4257,13 +4358,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4257
4358
  label="Options"
4258
4359
  tuiMultiSelectGroup
4259
4360
  >
4260
- @for (option of options; track option) {
4361
+ @for (option of options; track getOptionValue(option)) {
4261
4362
  <button
4262
4363
  tuiOption
4263
4364
  type="button"
4264
- [value]="option"
4365
+ [value]="getOptionValue(option)"
4265
4366
  >
4266
- {{ option }}
4367
+ {{ getOptionLabel(option) }}
4267
4368
  </button>
4268
4369
  }
4269
4370
  </tui-opt-group>
@@ -4296,6 +4397,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4296
4397
  `, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"] }]
4297
4398
  }], ctorParameters: () => [{ type: EzUITable }], propDecorators: { column: [{
4298
4399
  type: Input
4400
+ }], optionLabel: [{
4401
+ type: Input
4402
+ }], optionValue: [{
4403
+ type: Input
4299
4404
  }], options: [{
4300
4405
  type: Input
4301
4406
  }] } });
@@ -5190,5 +5295,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5190
5295
  * Generated bundle index. Do not edit.
5191
5296
  */
5192
5297
 
5193
- export { BaseCRUDInterface, BaseListInterface, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5298
+ export { BaseCRUDInterface, BaseListInterface, EzUIBooleanInput, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5194
5299
  //# sourceMappingURL=kris701-ez-ui.mjs.map