@kris701/ez-ui 1.1.21 → 1.1.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.
@@ -3464,6 +3464,32 @@ class EzUITableFilterService {
3464
3464
  action: 'true',
3465
3465
  filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i === value, column)
3466
3466
  },
3467
+ // Number filters
3468
+ {
3469
+ key: 'num',
3470
+ action: 'gr',
3471
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i > value, column)
3472
+ },
3473
+ {
3474
+ key: 'num',
3475
+ action: 'greq',
3476
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i >= value, column)
3477
+ },
3478
+ {
3479
+ key: 'num',
3480
+ action: 'eq',
3481
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i == value, column)
3482
+ },
3483
+ {
3484
+ key: 'num',
3485
+ action: 'ls',
3486
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i < value, column)
3487
+ },
3488
+ {
3489
+ key: 'num',
3490
+ action: 'lseq',
3491
+ filter: (values, column, value) => EzUIFilterHelpers.genericFilter(values, (i) => i <= value, column)
3492
+ },
3467
3493
  ];
3468
3494
  sort(values, sort) {
3469
3495
  const target = this.sortMethods.find(x => x.state == sort.state);
@@ -4224,6 +4250,222 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
4224
4250
  type: Input
4225
4251
  }] } });
4226
4252
 
4253
+ class EzUITableNumberFilter {
4254
+ column;
4255
+ filterApplied = signal(false, /* @ts-ignore */
4256
+ ...(ngDevMode ? [{ debugName: "filterApplied" }] : /* istanbul ignore next */ []));
4257
+ filterVisible = signal(false, /* @ts-ignore */
4258
+ ...(ngDevMode ? [{ debugName: "filterVisible" }] : /* istanbul ignore next */ []));
4259
+ table;
4260
+ value = 0;
4261
+ filterType;
4262
+ filterTypes;
4263
+ stringify = (item) => `${item.label}`;
4264
+ constructor(table) {
4265
+ this.table = table;
4266
+ this.filterTypes = [
4267
+ {
4268
+ label: 'Less Than',
4269
+ expression: 'num;ls'
4270
+ },
4271
+ {
4272
+ label: 'Less Than or Equal',
4273
+ expression: 'num;lseq'
4274
+ },
4275
+ {
4276
+ label: 'Equal',
4277
+ expression: 'num;eq'
4278
+ },
4279
+ {
4280
+ label: 'Greater Than',
4281
+ expression: 'num;gr'
4282
+ },
4283
+ {
4284
+ label: 'Greater Than or Equal',
4285
+ expression: 'num;greq'
4286
+ }
4287
+ ];
4288
+ this.filterType = this.filterTypes[0];
4289
+ this.table.onPresetChange.subscribe(x => {
4290
+ if (!x) {
4291
+ this.filterType = this.filterTypes[0];
4292
+ this.value = 0;
4293
+ this.filterApplied.set(false);
4294
+ return;
4295
+ }
4296
+ const filter = x.filters.find(x => x.column == this.column);
4297
+ if (!filter) {
4298
+ this.filterType = this.filterTypes[0];
4299
+ this.value = 0;
4300
+ this.filterApplied.set(false);
4301
+ return;
4302
+ }
4303
+ const type = this.filterTypes.find(x => x.expression == filter.expression);
4304
+ if (!type) {
4305
+ this.filterType = this.filterTypes[0];
4306
+ this.value = 0;
4307
+ this.filterApplied.set(false);
4308
+ return;
4309
+ }
4310
+ this.filterType = type;
4311
+ this.value = filter.value;
4312
+ this.filterApplied.set(true);
4313
+ });
4314
+ }
4315
+ applyFilter(expression) {
4316
+ this.table.setFilter({
4317
+ column: this.column,
4318
+ value: this.value,
4319
+ expression: expression,
4320
+ });
4321
+ this.filterVisible.set(false);
4322
+ this.filterApplied.set(true);
4323
+ }
4324
+ clearFilter() {
4325
+ this.table.clearFilter(this.column);
4326
+ this.filterVisible.set(false);
4327
+ this.filterApplied.set(false);
4328
+ }
4329
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableNumberFilter, deps: [{ token: EzUITable }], target: i0.ɵɵFactoryTarget.Component });
4330
+ 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: `
4331
+ @if(column){
4332
+ <tui-badged-content>
4333
+ @if(filterApplied()){
4334
+ <tui-badge-notification
4335
+ size="s"
4336
+ tuiSlot="top"
4337
+ >
4338
+ 1
4339
+ </tui-badge-notification>
4340
+ }
4341
+ <button
4342
+ tuiButton size="s"
4343
+ iconStart="funnel"
4344
+ appearance="flat-grayscale"
4345
+ style="opacity:0.72"
4346
+ [tuiDropdown]="filterPop"
4347
+ [(tuiDropdownOpen)]="filterVisible"
4348
+ (click)="filterVisible.set(true)"
4349
+ ></button>
4350
+ </tui-badged-content>
4351
+
4352
+ <ng-template #filterPop>
4353
+ <div class="filterPopContainer">
4354
+ <button
4355
+ appearance="outline-grayscale"
4356
+ size="s"
4357
+ tuiButton
4358
+ tuiButtonSelect
4359
+ [(ngModel)]="filterType"
4360
+ >
4361
+ {{ filterType.label }}
4362
+ <tui-data-list-wrapper
4363
+ *tuiDropdown
4364
+ [itemContent]="stringify | tuiStringifyContent"
4365
+ [items]="filterTypes"
4366
+ />
4367
+ </button>
4368
+
4369
+ <tui-textfield tuiTextfieldSize="s" (keydown.enter)="applyFilter(filterType.expression)">
4370
+ <input tuiInputNumber [(ngModel)]="value"/>
4371
+ </tui-textfield>
4372
+ <button
4373
+ tuiButton size="s"
4374
+ iconStart="funnel"
4375
+ tuiButton
4376
+ (click)="applyFilter(filterType.expression)"
4377
+ >
4378
+ Apply
4379
+ </button>
4380
+
4381
+ @if(filterApplied()){
4382
+ <button
4383
+ tuiButton size="s"
4384
+ iconStart="circle-x"
4385
+ appearance="secondary"
4386
+ tuiButton
4387
+ (click)="clearFilter()"
4388
+ >
4389
+ Clear
4390
+ </button>
4391
+ }
4392
+ </div>
4393
+ </ng-template>
4394
+ }
4395
+ `, 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" }] });
4396
+ }
4397
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUITableNumberFilter, decorators: [{
4398
+ type: Component,
4399
+ args: [{ selector: 'ezui-table-numberfilter', imports: [CommonModule, FormsModule, TuiDropdown, TuiDataListWrapper, TuiButton, TuiButtonSelect, TuiStringifyContentPipe, TuiBadgeNotification, TuiBadgedContent, TuiInputNumber], template: `
4400
+ @if(column){
4401
+ <tui-badged-content>
4402
+ @if(filterApplied()){
4403
+ <tui-badge-notification
4404
+ size="s"
4405
+ tuiSlot="top"
4406
+ >
4407
+ 1
4408
+ </tui-badge-notification>
4409
+ }
4410
+ <button
4411
+ tuiButton size="s"
4412
+ iconStart="funnel"
4413
+ appearance="flat-grayscale"
4414
+ style="opacity:0.72"
4415
+ [tuiDropdown]="filterPop"
4416
+ [(tuiDropdownOpen)]="filterVisible"
4417
+ (click)="filterVisible.set(true)"
4418
+ ></button>
4419
+ </tui-badged-content>
4420
+
4421
+ <ng-template #filterPop>
4422
+ <div class="filterPopContainer">
4423
+ <button
4424
+ appearance="outline-grayscale"
4425
+ size="s"
4426
+ tuiButton
4427
+ tuiButtonSelect
4428
+ [(ngModel)]="filterType"
4429
+ >
4430
+ {{ filterType.label }}
4431
+ <tui-data-list-wrapper
4432
+ *tuiDropdown
4433
+ [itemContent]="stringify | tuiStringifyContent"
4434
+ [items]="filterTypes"
4435
+ />
4436
+ </button>
4437
+
4438
+ <tui-textfield tuiTextfieldSize="s" (keydown.enter)="applyFilter(filterType.expression)">
4439
+ <input tuiInputNumber [(ngModel)]="value"/>
4440
+ </tui-textfield>
4441
+ <button
4442
+ tuiButton size="s"
4443
+ iconStart="funnel"
4444
+ tuiButton
4445
+ (click)="applyFilter(filterType.expression)"
4446
+ >
4447
+ Apply
4448
+ </button>
4449
+
4450
+ @if(filterApplied()){
4451
+ <button
4452
+ tuiButton size="s"
4453
+ iconStart="circle-x"
4454
+ appearance="secondary"
4455
+ tuiButton
4456
+ (click)="clearFilter()"
4457
+ >
4458
+ Clear
4459
+ </button>
4460
+ }
4461
+ </div>
4462
+ </ng-template>
4463
+ }
4464
+ `, styles: [".filterPopContainer{display:flex;flex-direction:column;gap:10px;padding:10px;min-width:20rem}\n"] }]
4465
+ }], ctorParameters: () => [{ type: EzUITable }], propDecorators: { column: [{
4466
+ type: Input
4467
+ }] } });
4468
+
4227
4469
  class EzUITableSelectFilter {
4228
4470
  column;
4229
4471
  filterApplied = signal(false, /* @ts-ignore */
@@ -5414,5 +5656,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5414
5656
  * Generated bundle index. Do not edit.
5415
5657
  */
5416
5658
 
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 };
5659
+ export { BaseCRUDInterface, BaseListInterface, EzUIBooleanInput, EzUIDateInput, EzUIDateTimeInput, EzUIFileInput, EzUIFilterHelpers, EzUIIconSelector, EzUILayout, EzUILayoutService, EzUIMarkdownEditor, EzUIMenuBar, EzUIMenuBarSubDataList, EzUIMultiSelect, EzUINumberInput, EzUIPasswordInput, EzUISelect, EzUITTableSortableColumn, EzUITable, EzUITableBooleanFilter, EzUITableDateFilter, EzUITableFilterService, EzUITableNumberFilter, EzUITableSelectFilter, EzUITableTextFilter, EzUITextInput, compressImage };
5418
5660
  //# sourceMappingURL=kris701-ez-ui.mjs.map