@kuzntsv/uikit 0.0.11 → 0.0.13

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.
@@ -65,6 +65,8 @@ export declare class BasePageClass<T> implements OnDestroy {
65
65
  loadLength$: Subject<null>;
66
66
  /** Очистка фильтра. */
67
67
  clearFilter$: Subject<null>;
68
+ /** Очистка фильтра (для очистки присвоить пустой объект '{}'). */
69
+ clearFilter: any;
68
70
  /** Разрешен выбор нескольких строк. */
69
71
  allowMultiSelect: boolean;
70
72
  /** Выбранные строки в таблице. */
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, HostListener, Output, ViewChild, Component, Input, Injectable, ChangeDetectionStrategy, Directive, inject, Inject, Pipe } from '@angular/core';
2
+ import { EventEmitter, HostListener, Output, ViewChild, Component, Input, Injectable, ChangeDetectionStrategy, Directive, inject, Inject, Pipe, input, output, effect } from '@angular/core';
3
3
  import { MatCard, MatCardHeader, MatCardTitle, MatCardContent } from '@angular/material/card';
4
4
  import * as i1 from '@angular/forms';
5
5
  import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -1255,6 +1255,8 @@ class BasePageClass {
1255
1255
  loadLength$ = new Subject();
1256
1256
  /** Очистка фильтра. */
1257
1257
  clearFilter$ = new Subject();
1258
+ /** Очистка фильтра (для очистки присвоить пустой объект '{}'). */
1259
+ clearFilter = null;
1258
1260
  /** Разрешен выбор нескольких строк. */
1259
1261
  allowMultiSelect = false;
1260
1262
  /** Выбранные строки в таблице. */
@@ -1474,6 +1476,7 @@ class BasePageClass {
1474
1476
  /** Cобытие очистки фильтра. */
1475
1477
  clearEvent() {
1476
1478
  this.clearFilter$.next(null);
1479
+ this.clearFilter = {};
1477
1480
  }
1478
1481
  /** Изменение сообщения об удалении. */
1479
1482
  onRemovalMessageChange(message) {
@@ -1879,14 +1882,14 @@ const MY_FORMATS = {
1879
1882
  },
1880
1883
  };
1881
1884
 
1882
- class DateRangeFilterComponent {
1883
- label = '';
1884
- dateRange$ = new BehaviorSubject({ begin: '', end: '' });
1885
+ class DateRangeInputComponent {
1886
+ label = input('');
1887
+ dateRange = input({ begin: '', end: '' });
1885
1888
  // eslint-disable-next-line no-magic-numbers
1886
- minDate = new Date(2020, 0, 1);
1887
- clearFilter$ = new Subject();
1888
- required = false;
1889
- dateRangeChange = new EventEmitter();
1889
+ minDate = input(new Date(2020, 0, 1));
1890
+ clearInput = input(null);
1891
+ required = input(false);
1892
+ dateRangeChange = output();
1890
1893
  form;
1891
1894
  subscription;
1892
1895
  constructor() {
@@ -1894,17 +1897,21 @@ class DateRangeFilterComponent {
1894
1897
  begin: new FormControl(),
1895
1898
  end: new FormControl(),
1896
1899
  });
1897
- }
1898
- ngOnInit() {
1899
- this.subscription = this.dateRange$.subscribe((value) => {
1900
- console.log(value);
1900
+ effect(() => {
1901
+ if (this.clearInput())
1902
+ this.form.reset();
1903
+ });
1904
+ effect(() => {
1905
+ const value = this.dateRange();
1901
1906
  if (this.form) {
1902
1907
  this.form.controls['begin'].setValue(value.begin ? new Date(value.begin) : null);
1903
1908
  this.form.controls['end'].setValue(value.end ? new Date(value.begin) : null);
1904
1909
  }
1905
1910
  this.dateRangeChange.emit(this.rangeToDateDateRange(this.form.value));
1906
1911
  });
1907
- if (this.required) {
1912
+ }
1913
+ ngOnInit() {
1914
+ if (this.required()) {
1908
1915
  this.form.controls['begin'].addValidators(Validators.required);
1909
1916
  this.form.controls['end'].addValidators(Validators.required);
1910
1917
  }
@@ -1915,7 +1922,7 @@ class DateRangeFilterComponent {
1915
1922
  debounceTime(500), distinctUntilChanged())
1916
1923
  .subscribe({
1917
1924
  next: range => {
1918
- if (this.required) {
1925
+ if (this.required()) {
1919
1926
  if (range.begin && range.end) {
1920
1927
  this.dateRangeChange.emit(this.rangeToDateDateRange(range));
1921
1928
  }
@@ -1925,10 +1932,6 @@ class DateRangeFilterComponent {
1925
1932
  }
1926
1933
  }
1927
1934
  });
1928
- const subs = this.clearFilter$.subscribe(() => {
1929
- this.form.reset();
1930
- });
1931
- this.subscription?.add(subs);
1932
1935
  }
1933
1936
  ngOnDestroy() {
1934
1937
  if (this.subscription)
@@ -1940,32 +1943,20 @@ class DateRangeFilterComponent {
1940
1943
  end: range.end ? dateFormat(range.end) : ''
1941
1944
  };
1942
1945
  }
1943
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DateRangeFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1944
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: DateRangeFilterComponent, isStandalone: true, selector: "ngx-uik-date-range-filter", inputs: { label: "label", dateRange$: "dateRange$", minDate: "minDate", clearFilter$: "clearFilter$", required: "required" }, outputs: { dateRangeChange: "dateRangeChange" }, providers: [
1946
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DateRangeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1947
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", type: DateRangeInputComponent, isStandalone: true, selector: "ngx-uik-date-range-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dateRange: { classPropertyName: "dateRange", publicName: "dateRange", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, clearInput: { classPropertyName: "clearInput", publicName: "clearInput", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateRangeChange: "dateRangeChange" }, providers: [
1945
1948
  { provide: MAT_DATE_LOCALE, useValue: 'ru' },
1946
1949
  { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
1947
- ], ngImport: i0, template: "<mat-form-field appearance=\"fill\">\n <mat-label>{{label}}</mat-label>\n <mat-date-range-input\n [rangePicker]=\"picker\"\n [formGroup]=\"form\"\n [min]=\"minDate\">\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker></mat-date-range-picker>\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\n</mat-form-field>\n\n", styles: ["mat-form-field{margin-right:16px}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }] });
1950
+ ], ngImport: i0, template: "<mat-form-field appearance=\"fill\">\n <mat-label>{{label()}}</mat-label>\n <mat-date-range-input\n [rangePicker]=\"picker\"\n [formGroup]=\"form\"\n [min]=\"minDate()\">\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker></mat-date-range-picker>\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\n</mat-form-field>\n\n", styles: ["mat-form-field{margin-right:16px}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }] });
1948
1951
  }
1949
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DateRangeFilterComponent, decorators: [{
1952
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DateRangeInputComponent, decorators: [{
1950
1953
  type: Component,
1951
- args: [{ selector: 'ngx-uik-date-range-filter', imports: [MatFormField, MatLabel, MatDateRangeInput, FormsModule, ReactiveFormsModule, MatStartDate, MatEndDate,
1954
+ args: [{ selector: 'ngx-uik-date-range-input', imports: [MatFormField, MatLabel, MatDateRangeInput, FormsModule, ReactiveFormsModule, MatStartDate, MatEndDate,
1952
1955
  MatDatepickerToggle, MatSuffix, MatDateRangePicker, MatError], providers: [
1953
1956
  { provide: MAT_DATE_LOCALE, useValue: 'ru' },
1954
1957
  { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
1955
- ], template: "<mat-form-field appearance=\"fill\">\n <mat-label>{{label}}</mat-label>\n <mat-date-range-input\n [rangePicker]=\"picker\"\n [formGroup]=\"form\"\n [min]=\"minDate\">\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker></mat-date-range-picker>\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\n</mat-form-field>\n\n", styles: ["mat-form-field{margin-right:16px}\n"] }]
1956
- }], ctorParameters: () => [], propDecorators: { label: [{
1957
- type: Input
1958
- }], dateRange$: [{
1959
- type: Input
1960
- }], minDate: [{
1961
- type: Input
1962
- }], clearFilter$: [{
1963
- type: Input
1964
- }], required: [{
1965
- type: Input
1966
- }], dateRangeChange: [{
1967
- type: Output
1968
- }] } });
1958
+ ], template: "<mat-form-field appearance=\"fill\">\n <mat-label>{{label()}}</mat-label>\n <mat-date-range-input\n [rangePicker]=\"picker\"\n [formGroup]=\"form\"\n [min]=\"minDate()\">\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker></mat-date-range-picker>\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\n</mat-form-field>\n\n", styles: ["mat-form-field{margin-right:16px}\n"] }]
1959
+ }], ctorParameters: () => [] });
1969
1960
 
1970
1961
  var DialogAction;
1971
1962
  (function (DialogAction) {
@@ -2475,5 +2466,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
2475
2466
  * Generated bundle index. Do not edit.
2476
2467
  */
2477
2468
 
2478
- export { Action, AlertService, AnimationsService, AuthService, AvatarService, BaseEditClass, BaseFilterClass, BaseMatChipComponent, BaseNavBarMenuClass, BasePageClass, BaseSelectAutocompleteWithVirtualScrollComponent, BaseSelectWithGroupComponent, BaseServiceClass, BaseToolbarComponent, DateRangeFilterComponent, DialogAction, DialogComponent, DisableIfRoleDirective, DisableIfUnauthorizedDirective, EntityAction, Environment, ExportService, HideIfRoleNotDirective, HideIfUnauthorizedDirective, LoaderService, LocalStorageService, LoginPageComponent, MY_FORMATS, NavBarComponent, NotFoundComponent, ProgressSpinnerComponent, ROUTE_ANIMATIONS_ELEMENTS, RedirectGuard, RoleService, SafePipe, SecUser, TableComponent, TimePipe, TruncatePipe, User, UserService, authGuard, dateFormat, isRouteAnimationsAll, isRouteAnimationsElements, isRouteAnimationsNone, isRouteAnimationsPage, roleGuard, routeAnimations };
2469
+ export { Action, AlertService, AnimationsService, AuthService, AvatarService, BaseEditClass, BaseFilterClass, BaseMatChipComponent, BaseNavBarMenuClass, BasePageClass, BaseSelectAutocompleteWithVirtualScrollComponent, BaseSelectWithGroupComponent, BaseServiceClass, BaseToolbarComponent, DateRangeInputComponent, DialogAction, DialogComponent, DisableIfRoleDirective, DisableIfUnauthorizedDirective, EntityAction, Environment, ExportService, HideIfRoleNotDirective, HideIfUnauthorizedDirective, LoaderService, LocalStorageService, LoginPageComponent, MY_FORMATS, NavBarComponent, NotFoundComponent, ProgressSpinnerComponent, ROUTE_ANIMATIONS_ELEMENTS, RedirectGuard, RoleService, SafePipe, SecUser, TableComponent, TimePipe, TruncatePipe, User, UserService, authGuard, dateFormat, isRouteAnimationsAll, isRouteAnimationsElements, isRouteAnimationsNone, isRouteAnimationsPage, roleGuard, routeAnimations };
2479
2470
  //# sourceMappingURL=kuzntsv-uikit.mjs.map