@kris701/ez-ui 1.1.21 → 1.2.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.
@@ -5,7 +5,7 @@ import { EventEmitter, Output, Input, Component, signal, ViewChild, ContentChild
5
5
  import * as i1 from '@angular/forms';
6
6
  import { FormsModule } from '@angular/forms';
7
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';
8
+ import { TuiIcon, TuiInput, TuiButton, TuiDropdown, TuiOption, TuiGroup, TuiScrollbar, TuiSelectLike, TuiDataList, TuiTextfield, TuiLink, TuiHint, TuiLoader, TuiCheckbox, TUI_DARK_MODE, TuiRoot } from '@taiga-ui/core';
9
9
  import * as i4$1 from '@taiga-ui/kit';
10
10
  import { TuiBlock, TuiSwitch, TuiInputDate, TuiInputDateTime, TuiFiles, TuiChevron, TuiTextarea, TuiMultiSelect, TuiInputNumber, TuiInputChip, TuiPassword, TuiSelect, TuiBadge, TuiStatus, TuiDataListWrapper, TuiBadgeNotification, TuiBadgedContent, TuiButtonSelect, TuiStringifyContentPipe, TUI_CONFIRM } from '@taiga-ui/kit';
11
11
  import * as i3$3 from '@taiga-ui/addon-mobile';
@@ -18,10 +18,10 @@ import * as i6 from '@taiga-ui/core/components/calendar';
18
18
  import { marked } from 'marked';
19
19
  import Compressor from 'compressorjs';
20
20
  import * as i7 from '@taiga-ui/cdk/directives/item';
21
+ import * as i4$2 from '@taiga-ui/layout';
22
+ import { TuiElasticContainer, TuiBlockStatus, TuiNavigation, TuiAsideGroupComponent } from '@taiga-ui/layout';
21
23
  import * as i3$2 from '@taiga-ui/addon-table';
22
24
  import { TuiTablePagination, TuiTable } from '@taiga-ui/addon-table';
23
- import * as i4$2 from '@taiga-ui/layout';
24
- import { TuiBlockStatus, TuiNavigation, TuiAsideGroupComponent } from '@taiga-ui/layout';
25
25
  import { v4 } from 'uuid';
26
26
  import { firstValueFrom, switchMap } from 'rxjs';
27
27
  import * as i1$1 from '@angular/common/http';
@@ -3152,6 +3152,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
3152
3152
  type: Output
3153
3153
  }] } });
3154
3154
 
3155
+ class EzUIShowMoreText {
3156
+ value = "";
3157
+ valueSmall = "";
3158
+ maxCharacters = 256;
3159
+ current = signal(this.valueSmall, /* @ts-ignore */
3160
+ ...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
3161
+ toggle() {
3162
+ this.current.set(this.current() === this.valueSmall ? this.value : this.valueSmall);
3163
+ }
3164
+ ngOnChanges(changes) {
3165
+ if (changes['value'] && changes['value'].currentValue != changes['value'].previousValue) {
3166
+ this.value = changes['value'].currentValue;
3167
+ this.valueSmall = this.value.substring(0, this.maxCharacters) + "...";
3168
+ this.current.set(this.valueSmall);
3169
+ }
3170
+ }
3171
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUIShowMoreText, deps: [], target: i0.ɵɵFactoryTarget.Component });
3172
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.0", type: EzUIShowMoreText, isStandalone: true, selector: "ezui-showmoretext", inputs: { value: "value", maxCharacters: "maxCharacters" }, usesOnChanges: true, ngImport: i0, template: `
3173
+ <tui-elastic-container>
3174
+ {{ current() }}
3175
+ <button
3176
+ tuiLink
3177
+ type="button"
3178
+ (click)="toggle()"
3179
+ >
3180
+ Show {{ current() === value ? 'less' : 'more' }}
3181
+ </button>
3182
+ </tui-elastic-container>
3183
+ `, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: TuiElasticContainer, selector: "tui-elastic-container" }, { kind: "directive", type: TuiLink, selector: "a[tuiLink], button[tuiLink]" }] });
3184
+ }
3185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUIShowMoreText, decorators: [{
3186
+ type: Component,
3187
+ args: [{ selector: 'ezui-showmoretext', imports: [
3188
+ FormsModule,
3189
+ CommonModule,
3190
+ TuiElasticContainer,
3191
+ TuiLink
3192
+ ], template: `
3193
+ <tui-elastic-container>
3194
+ {{ current() }}
3195
+ <button
3196
+ tuiLink
3197
+ type="button"
3198
+ (click)="toggle()"
3199
+ >
3200
+ Show {{ current() === value ? 'less' : 'more' }}
3201
+ </button>
3202
+ </tui-elastic-container>
3203
+ ` }]
3204
+ }], propDecorators: { value: [{
3205
+ type: Input
3206
+ }], maxCharacters: [{
3207
+ type: Input
3208
+ }] } });
3209
+
3155
3210
  class EzUITablePresets {
3156
3211
  table;
3157
3212
  storageKey = null;
@@ -3464,6 +3519,32 @@ class EzUITableFilterService {
3464
3519
  action: 'true',
3465
3520
  filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i === value, column)
3466
3521
  },
3522
+ // Number filters
3523
+ {
3524
+ key: 'num',
3525
+ action: 'gr',
3526
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i > value, column)
3527
+ },
3528
+ {
3529
+ key: 'num',
3530
+ action: 'greq',
3531
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i >= value, column)
3532
+ },
3533
+ {
3534
+ key: 'num',
3535
+ action: 'eq',
3536
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i == value, column)
3537
+ },
3538
+ {
3539
+ key: 'num',
3540
+ action: 'ls',
3541
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i < value, column)
3542
+ },
3543
+ {
3544
+ key: 'num',
3545
+ action: 'lseq',
3546
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i <= value, column)
3547
+ },
3467
3548
  ];
3468
3549
  sort(values, sort) {
3469
3550
  const target = this.sortMethods.find(x => x.state == sort.state);
@@ -4224,6 +4305,222 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4224
4305
  type: Input
4225
4306
  }] } });
4226
4307
 
4308
+ class EzUITableNumberFilter {
4309
+ column;
4310
+ filterApplied = signal(false, /* @ts-ignore */
4311
+ ...(ngDevMode ? [{ debugName: "filterApplied" }] : /* istanbul ignore next */ []));
4312
+ filterVisible = signal(false, /* @ts-ignore */
4313
+ ...(ngDevMode ? [{ debugName: "filterVisible" }] : /* istanbul ignore next */ []));
4314
+ table;
4315
+ value = 0;
4316
+ filterType;
4317
+ filterTypes;
4318
+ stringify = (item) => `${item.label}`;
4319
+ constructor(table) {
4320
+ this.table = table;
4321
+ this.filterTypes = [
4322
+ {
4323
+ label: 'Less Than',
4324
+ expression: 'num;ls'
4325
+ },
4326
+ {
4327
+ label: 'Less Than or Equal',
4328
+ expression: 'num;lseq'
4329
+ },
4330
+ {
4331
+ label: 'Equal',
4332
+ expression: 'num;eq'
4333
+ },
4334
+ {
4335
+ label: 'Greater Than',
4336
+ expression: 'num;gr'
4337
+ },
4338
+ {
4339
+ label: 'Greater Than or Equal',
4340
+ expression: 'num;greq'
4341
+ }
4342
+ ];
4343
+ this.filterType = this.filterTypes[0];
4344
+ this.table.onPresetChange.subscribe(x => {
4345
+ if (!x) {
4346
+ this.filterType = this.filterTypes[0];
4347
+ this.value = 0;
4348
+ this.filterApplied.set(false);
4349
+ return;
4350
+ }
4351
+ const filter = x.filters.find(x => x.column == this.column);
4352
+ if (!filter) {
4353
+ this.filterType = this.filterTypes[0];
4354
+ this.value = 0;
4355
+ this.filterApplied.set(false);
4356
+ return;
4357
+ }
4358
+ const type = this.filterTypes.find(x => x.expression == filter.expression);
4359
+ if (!type) {
4360
+ this.filterType = this.filterTypes[0];
4361
+ this.value = 0;
4362
+ this.filterApplied.set(false);
4363
+ return;
4364
+ }
4365
+ this.filterType = type;
4366
+ this.value = filter.value;
4367
+ this.filterApplied.set(true);
4368
+ });
4369
+ }
4370
+ applyFilter(expression) {
4371
+ this.table.setFilter({
4372
+ column: this.column,
4373
+ value: this.value,
4374
+ expression: expression,
4375
+ });
4376
+ this.filterVisible.set(false);
4377
+ this.filterApplied.set(true);
4378
+ }
4379
+ clearFilter() {
4380
+ this.table.clearFilter(this.column);
4381
+ this.filterVisible.set(false);
4382
+ this.filterApplied.set(false);
4383
+ }
4384
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableNumberFilter, deps: [{ token: EzUITable }], target: i0.ɵɵFactoryTarget.Component });
4385
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUITableNumberFilter, isStandalone: true, selector: "ezui-table-numberfilter", inputs: { column: "column" }, ngImport: i0, template: `
4386
+ @if(column){
4387
+ <tui-badged-content>
4388
+ @if(filterApplied()){
4389
+ <tui-badge-notification
4390
+ size="s"
4391
+ tuiSlot="top"
4392
+ >
4393
+ 1
4394
+ </tui-badge-notification>
4395
+ }
4396
+ <button
4397
+ tuiButton size="s"
4398
+ iconStart="funnel"
4399
+ appearance="flat-grayscale"
4400
+ style="opacity:0.72"
4401
+ [tuiDropdown]="filterPop"
4402
+ [(tuiDropdownOpen)]="filterVisible"
4403
+ (click)="filterVisible.set(true)"
4404
+ ></button>
4405
+ </tui-badged-content>
4406
+
4407
+ <ng-template #filterPop>
4408
+ <div class="filterPopContainer">
4409
+ <button
4410
+ appearance="outline-grayscale"
4411
+ size="s"
4412
+ tuiButton
4413
+ tuiButtonSelect
4414
+ [(ngModel)]="filterType"
4415
+ >
4416
+ {{ filterType.label }}
4417
+ <tui-data-list-wrapper
4418
+ *tuiDropdown
4419
+ [itemContent]="stringify | tuiStringifyContent"
4420
+ [items]="filterTypes"
4421
+ />
4422
+ </button>
4423
+
4424
+ <tui-textfield tuiTextfieldSize="s" (keydown.enter)="applyFilter(filterType.expression)">
4425
+ <input tuiInputNumber [(ngModel)]="value"/>
4426
+ </tui-textfield>
4427
+ <button
4428
+ tuiButton size="s"
4429
+ iconStart="funnel"
4430
+ tuiButton
4431
+ (click)="applyFilter(filterType.expression)"
4432
+ >
4433
+ Apply
4434
+ </button>
4435
+
4436
+ @if(filterApplied()){
4437
+ <button
4438
+ tuiButton size="s"
4439
+ iconStart="circle-x"
4440
+ appearance="secondary"
4441
+ tuiButton
4442
+ (click)="clearFilter()"
4443
+ >
4444
+ Clear
4445
+ </button>
4446
+ }
4447
+ </div>
4448
+ </ng-template>
4449
+ }
4450
+ `, isInline: true, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { 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: "directive", type: i3$1.TuiDropdownDirective, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: ["tuiDropdown"], exportAs: ["tuiDropdown"] }, { kind: "directive", type: i3$1.TuiDropdownOpen, selector: "[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: ["tuiDropdownEnabled", "tuiDropdownOpen"], outputs: ["tuiDropdownOpenChange"] }, { kind: "directive", type: i3$1.TuiDropdownContent, selector: "ng-template[tuiDropdown]" }, { kind: "component", type: i4$1.TuiDataListWrapperComponent, selector: "tui-data-list-wrapper:not([labels])", inputs: ["items", "emptyContent", "size", "itemContent"], outputs: ["itemClick"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "directive", type: TuiButtonSelect, selector: "button[tuiButtonSelect]" }, { kind: "component", type: TuiBadgeNotification, selector: "tui-badge-notification", inputs: ["size"] }, { kind: "directive", type: i4$1.TuiBadgedContentDirective, selector: "[tuiSlot]", inputs: ["tuiSlot"] }, { kind: "component", type: i4$1.TuiBadgedContentComponent, selector: "tui-badged-content" }, { kind: "directive", type: i4$1.TuiInputNumberDirective, selector: "input[tuiInputNumber]" }, { kind: "component", type: i3.TuiTextfieldComponent, selector: "tui-textfield:not([multi])", inputs: ["content", "filler"] }, { kind: "directive", type: i3.TuiTextfieldOptionsDirective, selector: "[tuiTextfieldAppearance],[tuiTextfieldSize],[tuiTextfieldCleaner]", inputs: ["tuiTextfieldAppearance", "tuiTextfieldSize", "tuiTextfieldCleaner"] }, { kind: "pipe", type: TuiStringifyContentPipe, name: "tuiStringifyContent" }] });
4451
+ }
4452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableNumberFilter, decorators: [{
4453
+ type: Component,
4454
+ args: [{ selector: 'ezui-table-numberfilter', imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiButtonSelect, TuiStringifyContentPipe, TuiBadgeNotification, TuiBadgedContent, TuiInputNumber], template: `
4455
+ @if(column){
4456
+ <tui-badged-content>
4457
+ @if(filterApplied()){
4458
+ <tui-badge-notification
4459
+ size="s"
4460
+ tuiSlot="top"
4461
+ >
4462
+ 1
4463
+ </tui-badge-notification>
4464
+ }
4465
+ <button
4466
+ tuiButton size="s"
4467
+ iconStart="funnel"
4468
+ appearance="flat-grayscale"
4469
+ style="opacity:0.72"
4470
+ [tuiDropdown]="filterPop"
4471
+ [(tuiDropdownOpen)]="filterVisible"
4472
+ (click)="filterVisible.set(true)"
4473
+ ></button>
4474
+ </tui-badged-content>
4475
+
4476
+ <ng-template #filterPop>
4477
+ <div class="filterPopContainer">
4478
+ <button
4479
+ appearance="outline-grayscale"
4480
+ size="s"
4481
+ tuiButton
4482
+ tuiButtonSelect
4483
+ [(ngModel)]="filterType"
4484
+ >
4485
+ {{ filterType.label }}
4486
+ <tui-data-list-wrapper
4487
+ *tuiDropdown
4488
+ [itemContent]="stringify | tuiStringifyContent"
4489
+ [items]="filterTypes"
4490
+ />
4491
+ </button>
4492
+
4493
+ <tui-textfield tuiTextfieldSize="s" (keydown.enter)="applyFilter(filterType.expression)">
4494
+ <input tuiInputNumber [(ngModel)]="value"/>
4495
+ </tui-textfield>
4496
+ <button
4497
+ tuiButton size="s"
4498
+ iconStart="funnel"
4499
+ tuiButton
4500
+ (click)="applyFilter(filterType.expression)"
4501
+ >
4502
+ Apply
4503
+ </button>
4504
+
4505
+ @if(filterApplied()){
4506
+ <button
4507
+ tuiButton size="s"
4508
+ iconStart="circle-x"
4509
+ appearance="secondary"
4510
+ tuiButton
4511
+ (click)="clearFilter()"
4512
+ >
4513
+ Clear
4514
+ </button>
4515
+ }
4516
+ </div>
4517
+ </ng-template>
4518
+ }
4519
+ `, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"] }]
4520
+ }], ctorParameters: () => [{ type: EzUITable }], propDecorators: { column: [{
4521
+ type: Input
4522
+ }] } });
4523
+
4227
4524
  class EzUITableSelectFilter {
4228
4525
  column;
4229
4526
  filterApplied = signal(false, /* @ts-ignore */
@@ -5414,5 +5711,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5414
5711
  * Generated bundle index. Do not edit.
5415
5712
  */
5416
5713
 
5417
- export { BaseCRUDInterface, BaseListInterface, EzUIBooleanInput, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUISelect, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5714
+ export { BaseCRUDInterface, BaseListInterface, EzUIBooleanInput, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUISelect, EzUIShowMoreText, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableNumberFilter, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5418
5715
  //# sourceMappingURL=kris701-ez-ui.mjs.map