@tetacom/ng-components 1.6.17 → 1.6.19

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.
package/README.md CHANGED
@@ -1,7 +1,3 @@
1
1
  # components
2
2
 
3
3
  This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Running unit tests
6
-
7
- Run `nx test components` to execute the unit tests.
@@ -46,7 +46,7 @@ export declare class DatePickerComponent extends BasePicker implements OnInit, C
46
46
  constructor(_elementRef: ElementRef, _cdr: ChangeDetectorRef, datePipe: DatePipe, localeService: TetaConfigService);
47
47
  ngOnInit(): void;
48
48
  prepareInput(isFirstRender?: boolean): Promise<void>;
49
- onBlur(): void;
49
+ onBlur(event?: FocusEvent): void;
50
50
  setDate(date: any): void;
51
51
  onChange(date: Date): void;
52
52
  registerOnChange(fn: (date: Date) => any): void;
@@ -2361,6 +2361,271 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
2361
2361
  args: [DOCUMENT]
2362
2362
  }] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }] });
2363
2363
 
2364
+ const getPrecision = (a) => {
2365
+ if (!isFinite(a)) {
2366
+ return 0;
2367
+ }
2368
+ let e = 1;
2369
+ let p = 0;
2370
+ while (Math.round(a * e) / e !== a) {
2371
+ e *= 10;
2372
+ p++;
2373
+ }
2374
+ return p;
2375
+ };
2376
+ const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
2377
+ const abs = Math.abs(value);
2378
+ if (0 < abs && 1 > abs) {
2379
+ const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
2380
+ decimalLength += firstDigitIndex;
2381
+ }
2382
+ const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
2383
+ const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
2384
+ const num = value.toFixed(precision);
2385
+ return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
2386
+ };
2387
+ const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
2388
+
2389
+ class DateUtil {
2390
+ /**
2391
+ * Вычесть n-дней
2392
+ */
2393
+ static subtractDays(date, days = 0) {
2394
+ if (date && date instanceof Date) {
2395
+ const dt = new Date(date.getTime());
2396
+ dt.setDate(dt.getDate() - days);
2397
+ return dt;
2398
+ }
2399
+ return null;
2400
+ }
2401
+ /**
2402
+ * Добавить n-дней
2403
+ */
2404
+ static addDays(date, days = 0) {
2405
+ if (date && date instanceof Date) {
2406
+ const dt = new Date(date.getTime());
2407
+ dt.setDate(dt.getDate() + days);
2408
+ return dt;
2409
+ }
2410
+ return null;
2411
+ }
2412
+ /**
2413
+ * Получить дату из строки
2414
+ */
2415
+ static parseString(dat) {
2416
+ if (!dat || dat.length < 1) {
2417
+ return null;
2418
+ }
2419
+ const parts = dat.split(' ');
2420
+ const dtPart = parts[0].split('.');
2421
+ const tPart = parts[1]?.split(':') ?? ['0', '0', '0'];
2422
+ const parsedDate = new Date(parseInt(dtPart[2], 10), parseInt(dtPart[1], 10) - 1, parseInt(dtPart[0], 10), parseInt(tPart[0], 10), parseInt(tPart[1], 10), parseInt(tPart[2], 10));
2423
+ if (isNaN(parsedDate.getTime())) {
2424
+ return null;
2425
+ }
2426
+ return parsedDate;
2427
+ }
2428
+ /**
2429
+ * Привести дату к строке
2430
+ */
2431
+ static toString(dat) {
2432
+ if (!dat || !(dat instanceof Date)) {
2433
+ return '';
2434
+ }
2435
+ const month = dat.getMonth() + 1;
2436
+ return `${prependZero(dat.getDate(), 2)}.${prependZero(month, 2)}.${dat.getFullYear()} ${prependZero(dat.getHours(), 2)}:${prependZero(dat.getMinutes(), 2)}:${prependZero(dat.getSeconds(), 2)}`;
2437
+ }
2438
+ /**
2439
+ * Привести дату к строке без часов и минут
2440
+ */
2441
+ static toShortString(dat) {
2442
+ if (!dat || !(dat instanceof Date)) {
2443
+ return '';
2444
+ }
2445
+ const month = dat.getMonth() + 1;
2446
+ return `${prependZero(dat.getDate(), 2)}.${prependZero(month, 2)}.${dat.getFullYear()}`;
2447
+ }
2448
+ /**
2449
+ * Подготовка даты к отправке на сервер, чтобы небыло смещения часов
2450
+ */
2451
+ static convertUTC2DateLocal(date) {
2452
+ if (date && date instanceof Date) {
2453
+ const timezoneOffsetMs = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTimezoneOffset() * 60000;
2454
+ return new Date(date.getTime() - timezoneOffsetMs);
2455
+ }
2456
+ return null;
2457
+ }
2458
+ /**
2459
+ * Подготовка даты к отправке на сервер, чтобы небыло смещения часов
2460
+ */
2461
+ static convertDateLocal2UTC(date) {
2462
+ if (date && date instanceof Date) {
2463
+ const timezoneOffsetMs = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTimezoneOffset() * 60000;
2464
+ return date == null ? null : new Date(date.getTime() + timezoneOffsetMs);
2465
+ }
2466
+ return null;
2467
+ }
2468
+ static convertDateStringsToDates(input) {
2469
+ const regexIso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;
2470
+ if (typeof input === 'string' && regexIso8601.test(input)) {
2471
+ return DateUtil.convertStringToLocalDate(input);
2472
+ }
2473
+ if (typeof input !== 'object' || !input) {
2474
+ return input;
2475
+ }
2476
+ let res;
2477
+ if (input instanceof Array) {
2478
+ res = [];
2479
+ }
2480
+ else {
2481
+ res = {};
2482
+ }
2483
+ return DateUtil.fillConvertDateStringsToDates(res, input);
2484
+ }
2485
+ static convertDates(input) {
2486
+ if (typeof input !== 'object' || !input) {
2487
+ return input;
2488
+ }
2489
+ if (input instanceof Date) {
2490
+ return DateUtil.convertUTC2DateLocal(input);
2491
+ }
2492
+ let res;
2493
+ if (input instanceof Array) {
2494
+ res = [];
2495
+ }
2496
+ else {
2497
+ res = {};
2498
+ }
2499
+ return DateUtil.fillConvertDates(res, input);
2500
+ }
2501
+ static getMonthDaysCount(date) {
2502
+ return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
2503
+ }
2504
+ // Возвращает список месяцев между двумя датами
2505
+ static getRangeOfMonths(start, end) {
2506
+ if (start > end || !start || !end) {
2507
+ return null;
2508
+ }
2509
+ const resDates = [];
2510
+ let i = 0;
2511
+ let dateTmp = new Date(start.getFullYear(), start.getMonth() + i, 1);
2512
+ while (end >= dateTmp) {
2513
+ resDates.push(dateTmp);
2514
+ i++;
2515
+ dateTmp = new Date(start.getFullYear(), start.getMonth() + i, 1);
2516
+ }
2517
+ return resDates;
2518
+ }
2519
+ static truncateToMonth(date) {
2520
+ const res = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
2521
+ return res;
2522
+ }
2523
+ static truncateToDay(date) {
2524
+ const res = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
2525
+ return res;
2526
+ }
2527
+ static truncateToHour(date) {
2528
+ const res = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), 0, 0);
2529
+ return res;
2530
+ }
2531
+ static toISOString(date) {
2532
+ return new Date(date - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, -5) + 'Z';
2533
+ }
2534
+ static isValidDate(date) {
2535
+ return date instanceof Date && !isNaN(date.getTime());
2536
+ }
2537
+ static millisecondToHumanFormat(milliSeconds, maxValue = 5000, showDays = false) {
2538
+ const negative = milliSeconds < 0;
2539
+ if (negative) {
2540
+ milliSeconds = -milliSeconds;
2541
+ }
2542
+ let d;
2543
+ if (showDays) {
2544
+ d = Math.trunc(milliSeconds / (60000 * 60 * 24));
2545
+ milliSeconds = milliSeconds - 60000 * 60 * 24 * d;
2546
+ }
2547
+ const h = Math.trunc(milliSeconds / (60000 * 60));
2548
+ milliSeconds = milliSeconds - 60000 * 60 * h;
2549
+ const m = Math.trunc(milliSeconds / 60000);
2550
+ milliSeconds = milliSeconds - 60000 * m;
2551
+ const s = Math.trunc(milliSeconds / 1000);
2552
+ milliSeconds = milliSeconds - 1000 * s;
2553
+ const frac = milliSeconds;
2554
+ let result = m ? m + ' м ' : ''; // start with minutes
2555
+ if (maxValue < 60000 * 60) {
2556
+ if (s) {
2557
+ result = result + s + ' с '; // add seconds value
2558
+ }
2559
+ if (s === 0 && !m) {
2560
+ result = result + '0 c';
2561
+ }
2562
+ }
2563
+ if (maxValue < 5000) {
2564
+ result = frac ? result + frac + ' мс ' : result;
2565
+ }
2566
+ if (h) {
2567
+ result = h + ' ч ' + result;
2568
+ }
2569
+ if (d) {
2570
+ result = d + 'д ' + result;
2571
+ }
2572
+ if (negative) {
2573
+ result = '-' + result;
2574
+ }
2575
+ return result.trim();
2576
+ }
2577
+ static fillConvertDates(result, input) {
2578
+ for (const key in input) {
2579
+ if (!input.hasOwnProperty || !input.hasOwnProperty(key)) {
2580
+ continue;
2581
+ }
2582
+ if (input.hasOwnProperty(key)) {
2583
+ let value = input[key];
2584
+ if (value instanceof Date) {
2585
+ if (value !== null && value !== undefined) {
2586
+ value = DateUtil.convertUTC2DateLocal(value);
2587
+ }
2588
+ result[key] = value;
2589
+ }
2590
+ else if (typeof value === 'object') {
2591
+ result[key] = DateUtil.convertDates(value);
2592
+ }
2593
+ else {
2594
+ result[key] = value;
2595
+ }
2596
+ }
2597
+ }
2598
+ return result;
2599
+ }
2600
+ static fillConvertDateStringsToDates(result, input) {
2601
+ const regexIso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z?)?$/i;
2602
+ for (const key in input) {
2603
+ if (!input.hasOwnProperty(key)) {
2604
+ continue;
2605
+ }
2606
+ const value = input[key];
2607
+ if (typeof value === 'string' && regexIso8601.test(value)) {
2608
+ result[key] = DateUtil.convertStringToLocalDate(value);
2609
+ }
2610
+ else if (typeof value === 'object') {
2611
+ result[key] = DateUtil.convertDateStringsToDates(value);
2612
+ }
2613
+ else {
2614
+ result[key] = value;
2615
+ }
2616
+ }
2617
+ return result;
2618
+ }
2619
+ static convertStringToLocalDate(dateString) {
2620
+ const milliseconds = Date.parse(dateString);
2621
+ if (!isNaN(milliseconds)) {
2622
+ const dt = new Date(milliseconds);
2623
+ return DateUtil.convertDateLocal2UTC(dt);
2624
+ }
2625
+ return null;
2626
+ }
2627
+ }
2628
+
2364
2629
  const DATE_PICKER_CONTROL_VALUE_ACCESSOR = {
2365
2630
  provide: NG_VALUE_ACCESSOR,
2366
2631
  useExisting: forwardRef(() => DatePickerComponent),
@@ -2439,7 +2704,10 @@ class DatePickerComponent extends BasePicker {
2439
2704
  }
2440
2705
  this.changePlaceholder(str);
2441
2706
  }
2442
- onBlur() {
2707
+ onBlur(event) {
2708
+ if (event?.target?.value === DateUtil.toShortString(this.date)) {
2709
+ return;
2710
+ }
2443
2711
  if (this.allowNull && this.inputText.trim() === '') {
2444
2712
  this.setDate(null);
2445
2713
  this.emitValue(null);
@@ -2527,7 +2795,7 @@ class DatePickerComponent extends BasePicker {
2527
2795
  }
2528
2796
  }
2529
2797
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.DatePipe }, { token: TetaConfigService }], target: i0.ɵɵFactoryTarget.Component }); }
2530
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DatePickerComponent, isStandalone: true, selector: "teta-date-picker", inputs: { date: "date", showTime: "showTime", minDate: "minDate", maxDate: "maxDate", invalid: "invalid", disabled: "disabled", align: "align", verticalAlign: "verticalAlign", viewType: "viewType", appendToBody: "appendToBody", backdrop: "backdrop", allowNull: "allowNull", open: "open", firstDayOfWeek: "firstDayOfWeek", disabledDates: "disabledDates", disabledPeriods: "disabledPeriods", disabledDays: "disabledDays", minYearDate: "minYearDate", maxYearDate: "maxYearDate" }, outputs: { selectDate: "selectDate" }, host: { properties: { "class.datepicker": "this.classDatepicker", "class.datepicker-time": "this.dateTimeClass", "tabindex": "this.tabindex" } }, providers: [DATE_PICKER_CONTROL_VALUE_ACCESSOR, DatePipe], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if ({ selectedDate: selectedDate | async }; as data) {\n <teta-dropdown\n class=\"row row_auto\"\n [appendToBody]=\"appendToBody\"\n [backdrop]=\"backdrop\"\n [open]=\"open\"\n (openChange)=\"openChange($event)\"\n [viewType]=\"viewType\"\n [disabled]=\"disabled\"\n [verticalAlign]=\"verticalAlign\"\n [align]=\"align\"\n [autoCloseIgnore]=\"['esc', 'inside', 'enter']\"\n >\n <div\n tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_' + viewType\"\n [ngClass]=\"{ 'datepicker-head_invalid': invalid, 'datepicker-head_disabled': disabled }\"\n >\n <teta-input class=\"row row_auto flex\">\n <div [class]=\"'row_auto row datepicker_' + viewType\">\n <div class=\"row row_auto position-relative font-body-3 align-center\">\n <input\n [ngClass]=\"{ 'color-text-90': !disabled }\"\n [disabled]=\"disabled\"\n #input\n style=\"z-index: 1\"\n class=\"row_auto border-0\"\n (keydown)=\"checkEnter($event)\"\n [(ngModel)]=\"inputText\"\n (ngModelChange)=\"changeInput($event)\"\n (blur)=\"onBlur()\"\n [maskito]=\"maskitoOptions\"\n />\n @if (data.selectedDate || allowNull) {\n <div\n (click)=\"input.focus()\"\n class=\"position-absolute color-text-10\"\n style=\"cursor: text; user-select: none\"\n >\n {{ placeholder }}\n </div>\n }\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent (click)=\"$event.preventDefault()\">\n <teta-date-calendar\n [isDateNull]=\"data.selectedDate === null\"\n [open]=\"open\"\n [max]=\"maxDate\"\n [min]=\"minDate\"\n (setDate)=\"changeSelectedDate($event)\"\n [selectedDate]=\"data.selectedDate\"\n [viewType]=\"viewType\"\n [locale]=\"locale | async\"\n ></teta-date-calendar>\n </div>\n </teta-dropdown>\n}\n", styles: [""], dependencies: [{ kind: "component", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"] }, { kind: "directive", type: DropdownHeadDirective, selector: "[tetaDropdownHead]" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputComponent, selector: "teta-input", inputs: ["label", "hint", "viewType", "horizontal", "required"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MaskitoModule }, { kind: "directive", type: i4.MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"] }, { kind: "directive", type: i4.MaskitoCVA, selector: "input[maskito], textarea[maskito]", inputs: ["maskito"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "directive", type: DropdownContentDirective, selector: "[tetaDropdownContent]" }, { kind: "component", type: DateCalendarComponent, selector: "teta-date-calendar", inputs: ["selectedDate", "open", "locale", "viewType", "min", "isDateNull", "max"], outputs: ["setDate"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2798
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DatePickerComponent, isStandalone: true, selector: "teta-date-picker", inputs: { date: "date", showTime: "showTime", minDate: "minDate", maxDate: "maxDate", invalid: "invalid", disabled: "disabled", align: "align", verticalAlign: "verticalAlign", viewType: "viewType", appendToBody: "appendToBody", backdrop: "backdrop", allowNull: "allowNull", open: "open", firstDayOfWeek: "firstDayOfWeek", disabledDates: "disabledDates", disabledPeriods: "disabledPeriods", disabledDays: "disabledDays", minYearDate: "minYearDate", maxYearDate: "maxYearDate" }, outputs: { selectDate: "selectDate" }, host: { properties: { "class.datepicker": "this.classDatepicker", "class.datepicker-time": "this.dateTimeClass", "tabindex": "this.tabindex" } }, providers: [DATE_PICKER_CONTROL_VALUE_ACCESSOR, DatePipe], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "@if ({ selectedDate: selectedDate | async }; as data) {\n <teta-dropdown\n class=\"row row_auto\"\n [appendToBody]=\"appendToBody\"\n [backdrop]=\"backdrop\"\n [open]=\"open\"\n (openChange)=\"openChange($event)\"\n [viewType]=\"viewType\"\n [disabled]=\"disabled\"\n [verticalAlign]=\"verticalAlign\"\n [align]=\"align\"\n [autoCloseIgnore]=\"['esc', 'inside', 'enter']\"\n >\n <div\n tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_' + viewType\"\n [ngClass]=\"{ 'datepicker-head_invalid': invalid, 'datepicker-head_disabled': disabled }\"\n >\n <teta-input class=\"row row_auto flex\">\n <div [class]=\"'row_auto row datepicker_' + viewType\">\n <div class=\"row row_auto position-relative font-body-3 align-center\">\n <input\n [ngClass]=\"{ 'color-text-90': !disabled }\"\n [disabled]=\"disabled\"\n #input\n style=\"z-index: 1\"\n class=\"row_auto border-0\"\n (keydown)=\"checkEnter($event)\"\n [(ngModel)]=\"inputText\"\n (ngModelChange)=\"changeInput($event)\"\n (blur)=\"onBlur($event)\"\n [maskito]=\"maskitoOptions\"\n />\n @if (data.selectedDate || allowNull) {\n <div\n (click)=\"input.focus()\"\n class=\"position-absolute color-text-10\"\n style=\"cursor: text; user-select: none\"\n >\n {{ placeholder }}\n </div>\n }\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent (click)=\"$event.preventDefault()\">\n <teta-date-calendar\n [isDateNull]=\"data.selectedDate === null\"\n [open]=\"open\"\n [max]=\"maxDate\"\n [min]=\"minDate\"\n (setDate)=\"changeSelectedDate($event)\"\n [selectedDate]=\"data.selectedDate\"\n [viewType]=\"viewType\"\n [locale]=\"locale | async\"\n ></teta-date-calendar>\n </div>\n </teta-dropdown>\n}\n", styles: [""], dependencies: [{ kind: "component", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"] }, { kind: "directive", type: DropdownHeadDirective, selector: "[tetaDropdownHead]" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputComponent, selector: "teta-input", inputs: ["label", "hint", "viewType", "horizontal", "required"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MaskitoModule }, { kind: "directive", type: i4.MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"] }, { kind: "directive", type: i4.MaskitoCVA, selector: "input[maskito], textarea[maskito]", inputs: ["maskito"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "directive", type: DropdownContentDirective, selector: "[tetaDropdownContent]" }, { kind: "component", type: DateCalendarComponent, selector: "teta-date-calendar", inputs: ["selectedDate", "open", "locale", "viewType", "min", "isDateNull", "max"], outputs: ["setDate"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2531
2799
  }
2532
2800
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DatePickerComponent, decorators: [{
2533
2801
  type: Component,
@@ -2542,7 +2810,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
2542
2810
  DropdownContentDirective,
2543
2811
  DateCalendarComponent,
2544
2812
  AsyncPipe,
2545
- ], template: "@if ({ selectedDate: selectedDate | async }; as data) {\n <teta-dropdown\n class=\"row row_auto\"\n [appendToBody]=\"appendToBody\"\n [backdrop]=\"backdrop\"\n [open]=\"open\"\n (openChange)=\"openChange($event)\"\n [viewType]=\"viewType\"\n [disabled]=\"disabled\"\n [verticalAlign]=\"verticalAlign\"\n [align]=\"align\"\n [autoCloseIgnore]=\"['esc', 'inside', 'enter']\"\n >\n <div\n tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_' + viewType\"\n [ngClass]=\"{ 'datepicker-head_invalid': invalid, 'datepicker-head_disabled': disabled }\"\n >\n <teta-input class=\"row row_auto flex\">\n <div [class]=\"'row_auto row datepicker_' + viewType\">\n <div class=\"row row_auto position-relative font-body-3 align-center\">\n <input\n [ngClass]=\"{ 'color-text-90': !disabled }\"\n [disabled]=\"disabled\"\n #input\n style=\"z-index: 1\"\n class=\"row_auto border-0\"\n (keydown)=\"checkEnter($event)\"\n [(ngModel)]=\"inputText\"\n (ngModelChange)=\"changeInput($event)\"\n (blur)=\"onBlur()\"\n [maskito]=\"maskitoOptions\"\n />\n @if (data.selectedDate || allowNull) {\n <div\n (click)=\"input.focus()\"\n class=\"position-absolute color-text-10\"\n style=\"cursor: text; user-select: none\"\n >\n {{ placeholder }}\n </div>\n }\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent (click)=\"$event.preventDefault()\">\n <teta-date-calendar\n [isDateNull]=\"data.selectedDate === null\"\n [open]=\"open\"\n [max]=\"maxDate\"\n [min]=\"minDate\"\n (setDate)=\"changeSelectedDate($event)\"\n [selectedDate]=\"data.selectedDate\"\n [viewType]=\"viewType\"\n [locale]=\"locale | async\"\n ></teta-date-calendar>\n </div>\n </teta-dropdown>\n}\n" }]
2813
+ ], template: "@if ({ selectedDate: selectedDate | async }; as data) {\n <teta-dropdown\n class=\"row row_auto\"\n [appendToBody]=\"appendToBody\"\n [backdrop]=\"backdrop\"\n [open]=\"open\"\n (openChange)=\"openChange($event)\"\n [viewType]=\"viewType\"\n [disabled]=\"disabled\"\n [verticalAlign]=\"verticalAlign\"\n [align]=\"align\"\n [autoCloseIgnore]=\"['esc', 'inside', 'enter']\"\n >\n <div\n tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_' + viewType\"\n [ngClass]=\"{ 'datepicker-head_invalid': invalid, 'datepicker-head_disabled': disabled }\"\n >\n <teta-input class=\"row row_auto flex\">\n <div [class]=\"'row_auto row datepicker_' + viewType\">\n <div class=\"row row_auto position-relative font-body-3 align-center\">\n <input\n [ngClass]=\"{ 'color-text-90': !disabled }\"\n [disabled]=\"disabled\"\n #input\n style=\"z-index: 1\"\n class=\"row_auto border-0\"\n (keydown)=\"checkEnter($event)\"\n [(ngModel)]=\"inputText\"\n (ngModelChange)=\"changeInput($event)\"\n (blur)=\"onBlur($event)\"\n [maskito]=\"maskitoOptions\"\n />\n @if (data.selectedDate || allowNull) {\n <div\n (click)=\"input.focus()\"\n class=\"position-absolute color-text-10\"\n style=\"cursor: text; user-select: none\"\n >\n {{ placeholder }}\n </div>\n }\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent (click)=\"$event.preventDefault()\">\n <teta-date-calendar\n [isDateNull]=\"data.selectedDate === null\"\n [open]=\"open\"\n [max]=\"maxDate\"\n [min]=\"minDate\"\n (setDate)=\"changeSelectedDate($event)\"\n [selectedDate]=\"data.selectedDate\"\n [viewType]=\"viewType\"\n [locale]=\"locale | async\"\n ></teta-date-calendar>\n </div>\n </teta-dropdown>\n}\n" }]
2546
2814
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.DatePipe }, { type: TetaConfigService }], propDecorators: { date: [{
2547
2815
  type: Input
2548
2816
  }], showTime: [{
@@ -3771,31 +4039,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
3771
4039
  type: Output
3772
4040
  }] } });
3773
4041
 
3774
- const getPrecision = (a) => {
3775
- if (!isFinite(a)) {
3776
- return 0;
3777
- }
3778
- let e = 1;
3779
- let p = 0;
3780
- while (Math.round(a * e) / e !== a) {
3781
- e *= 10;
3782
- p++;
3783
- }
3784
- return p;
3785
- };
3786
- const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
3787
- const abs = Math.abs(value);
3788
- if (0 < abs && 1 > abs) {
3789
- const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
3790
- decimalLength += firstDigitIndex;
3791
- }
3792
- const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
3793
- const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
3794
- const num = value.toFixed(precision);
3795
- return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
3796
- };
3797
- const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
3798
-
3799
4042
  class NumberPipe {
3800
4043
  transform(value, decimalLength = 2, chunkDelimiter = '', decimalDelimiter = '.', chunkLength = 3) {
3801
4044
  if (value === null || value === undefined || value === '') {
@@ -6620,236 +6863,6 @@ var SelectType;
6620
6863
  SelectType[SelectType["mouse"] = 2] = "mouse";
6621
6864
  })(SelectType || (SelectType = {}));
6622
6865
 
6623
- class DateUtil {
6624
- /**
6625
- * Вычесть n-дней
6626
- */
6627
- static subtractDays(date, days = 0) {
6628
- if (date && date instanceof Date) {
6629
- const dt = new Date(date.getTime());
6630
- dt.setDate(dt.getDate() - days);
6631
- return dt;
6632
- }
6633
- return null;
6634
- }
6635
- /**
6636
- * Добавить n-дней
6637
- */
6638
- static addDays(date, days = 0) {
6639
- if (date && date instanceof Date) {
6640
- const dt = new Date(date.getTime());
6641
- dt.setDate(dt.getDate() + days);
6642
- return dt;
6643
- }
6644
- return null;
6645
- }
6646
- /**
6647
- * Получить дату из строки
6648
- */
6649
- static parseString(dat) {
6650
- if (!dat || dat.length < 1) {
6651
- return null;
6652
- }
6653
- const parts = dat.split(' ');
6654
- const dtPart = parts[0].split('.');
6655
- const tPart = parts[1]?.split(':') ?? ['0', '0', '0'];
6656
- const parsedDate = new Date(parseInt(dtPart[2], 10), parseInt(dtPart[1], 10) - 1, parseInt(dtPart[0], 10), parseInt(tPart[0], 10), parseInt(tPart[1], 10), parseInt(tPart[2], 10));
6657
- if (isNaN(parsedDate.getTime())) {
6658
- return null;
6659
- }
6660
- return parsedDate;
6661
- }
6662
- /**
6663
- * Привести дату к строке
6664
- */
6665
- static toString(dat) {
6666
- if (!dat || !(dat instanceof Date)) {
6667
- return '';
6668
- }
6669
- const month = dat.getMonth() + 1;
6670
- return `${prependZero(dat.getDate(), 2)}.${prependZero(month, 2)}.${dat.getFullYear()} ${prependZero(dat.getHours(), 2)}:${prependZero(dat.getMinutes(), 2)}:${prependZero(dat.getSeconds(), 2)}`;
6671
- }
6672
- /**
6673
- * Подготовка даты к отправке на сервер, чтобы небыло смещения часов
6674
- */
6675
- static convertUTC2DateLocal(date) {
6676
- if (date && date instanceof Date) {
6677
- const timezoneOffsetMs = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTimezoneOffset() * 60000;
6678
- return new Date(date.getTime() - timezoneOffsetMs);
6679
- }
6680
- return null;
6681
- }
6682
- /**
6683
- * Подготовка даты к отправке на сервер, чтобы небыло смещения часов
6684
- */
6685
- static convertDateLocal2UTC(date) {
6686
- if (date && date instanceof Date) {
6687
- const timezoneOffsetMs = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTimezoneOffset() * 60000;
6688
- return date == null ? null : new Date(date.getTime() + timezoneOffsetMs);
6689
- }
6690
- return null;
6691
- }
6692
- static convertDateStringsToDates(input) {
6693
- const regexIso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;
6694
- if (typeof input === 'string' && regexIso8601.test(input)) {
6695
- return DateUtil.convertStringToLocalDate(input);
6696
- }
6697
- if (typeof input !== 'object' || !input) {
6698
- return input;
6699
- }
6700
- let res;
6701
- if (input instanceof Array) {
6702
- res = [];
6703
- }
6704
- else {
6705
- res = {};
6706
- }
6707
- return DateUtil.fillConvertDateStringsToDates(res, input);
6708
- }
6709
- static convertDates(input) {
6710
- if (typeof input !== 'object' || !input) {
6711
- return input;
6712
- }
6713
- if (input instanceof Date) {
6714
- return DateUtil.convertUTC2DateLocal(input);
6715
- }
6716
- let res;
6717
- if (input instanceof Array) {
6718
- res = [];
6719
- }
6720
- else {
6721
- res = {};
6722
- }
6723
- return DateUtil.fillConvertDates(res, input);
6724
- }
6725
- static getMonthDaysCount(date) {
6726
- return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
6727
- }
6728
- // Возвращает список месяцев между двумя датами
6729
- static getRangeOfMonths(start, end) {
6730
- if (start > end || !start || !end) {
6731
- return null;
6732
- }
6733
- const resDates = [];
6734
- let i = 0;
6735
- let dateTmp = new Date(start.getFullYear(), start.getMonth() + i, 1);
6736
- while (end >= dateTmp) {
6737
- resDates.push(dateTmp);
6738
- i++;
6739
- dateTmp = new Date(start.getFullYear(), start.getMonth() + i, 1);
6740
- }
6741
- return resDates;
6742
- }
6743
- static truncateToMonth(date) {
6744
- const res = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
6745
- return res;
6746
- }
6747
- static truncateToDay(date) {
6748
- const res = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
6749
- return res;
6750
- }
6751
- static truncateToHour(date) {
6752
- const res = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), 0, 0);
6753
- return res;
6754
- }
6755
- static toISOString(date) {
6756
- return new Date(date - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, -5) + 'Z';
6757
- }
6758
- static isValidDate(date) {
6759
- return date instanceof Date && !isNaN(date.getTime());
6760
- }
6761
- static millisecondToHumanFormat(milliSeconds, maxValue = 5000, showDays = false) {
6762
- const negative = milliSeconds < 0;
6763
- if (negative) {
6764
- milliSeconds = -milliSeconds;
6765
- }
6766
- let d;
6767
- if (showDays) {
6768
- d = Math.trunc(milliSeconds / (60000 * 60 * 24));
6769
- milliSeconds = milliSeconds - 60000 * 60 * 24 * d;
6770
- }
6771
- const h = Math.trunc(milliSeconds / (60000 * 60));
6772
- milliSeconds = milliSeconds - 60000 * 60 * h;
6773
- const m = Math.trunc(milliSeconds / 60000);
6774
- milliSeconds = milliSeconds - 60000 * m;
6775
- const s = Math.trunc(milliSeconds / 1000);
6776
- milliSeconds = milliSeconds - 1000 * s;
6777
- const frac = milliSeconds;
6778
- let result = m ? m + ' м ' : ''; // start with minutes
6779
- if (maxValue < 60000 * 60) {
6780
- if (s) {
6781
- result = result + s + ' с '; // add seconds value
6782
- }
6783
- if (s === 0 && !m) {
6784
- result = result + '0 c';
6785
- }
6786
- }
6787
- if (maxValue < 5000) {
6788
- result = frac ? result + frac + ' мс ' : result;
6789
- }
6790
- if (h) {
6791
- result = h + ' ч ' + result;
6792
- }
6793
- if (d) {
6794
- result = d + 'д ' + result;
6795
- }
6796
- if (negative) {
6797
- result = '-' + result;
6798
- }
6799
- return result.trim();
6800
- }
6801
- static fillConvertDates(result, input) {
6802
- for (const key in input) {
6803
- if (!input.hasOwnProperty || !input.hasOwnProperty(key)) {
6804
- continue;
6805
- }
6806
- if (input.hasOwnProperty(key)) {
6807
- let value = input[key];
6808
- if (value instanceof Date) {
6809
- if (value !== null && value !== undefined) {
6810
- value = DateUtil.convertUTC2DateLocal(value);
6811
- }
6812
- result[key] = value;
6813
- }
6814
- else if (typeof value === 'object') {
6815
- result[key] = DateUtil.convertDates(value);
6816
- }
6817
- else {
6818
- result[key] = value;
6819
- }
6820
- }
6821
- }
6822
- return result;
6823
- }
6824
- static fillConvertDateStringsToDates(result, input) {
6825
- const regexIso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z?)?$/i;
6826
- for (const key in input) {
6827
- if (!input.hasOwnProperty(key)) {
6828
- continue;
6829
- }
6830
- const value = input[key];
6831
- if (typeof value === 'string' && regexIso8601.test(value)) {
6832
- result[key] = DateUtil.convertStringToLocalDate(value);
6833
- }
6834
- else if (typeof value === 'object') {
6835
- result[key] = DateUtil.convertDateStringsToDates(value);
6836
- }
6837
- else {
6838
- result[key] = value;
6839
- }
6840
- }
6841
- return result;
6842
- }
6843
- static convertStringToLocalDate(dateString) {
6844
- const milliseconds = Date.parse(dateString);
6845
- if (!isNaN(milliseconds)) {
6846
- const dt = new Date(milliseconds);
6847
- return DateUtil.convertDateLocal2UTC(dt);
6848
- }
6849
- return null;
6850
- }
6851
- }
6852
-
6853
6866
  class ColumnReorderEvent {
6854
6867
  constructor(source, target) {
6855
6868
  this.source = source;
@@ -8080,11 +8093,11 @@ class ColorCellComponent extends CellComponentBase {
8080
8093
  super.ngOnInit();
8081
8094
  }
8082
8095
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ColorCellComponent, deps: [{ token: TableService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
8083
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: ColorCellComponent, isStandalone: true, selector: "teta-color-cell", host: { listeners: { "focus": "focus($event)", "focusin": "focus($event)" }, properties: { "attr.tabindex": "this.tabindex" } }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"color\"\n #input\n [name]=\"column.name\"\n [disabled]=\"!editable\"\n (blur)=\"setValue()\"\n [ngModel]=\"getHexColor(row.data[column.name])\"\n (ngModelChange)=\"row.data[column.name] = $event\" />\n", styles: [":host{display:flex;align-items:center;justify-content:center}input[type=color]{height:16px;width:16px;padding:0;border:0}input[type=color]::-webkit-color-swatch,input[type=color]::-webkit-color-swatch-wrapper{border:0;padding:0}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8096
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: ColorCellComponent, isStandalone: true, selector: "teta-color-cell", host: { listeners: { "focus": "focus($event)", "focusin": "focus($event)" }, properties: { "attr.tabindex": "this.tabindex" } }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"color\"\n #input\n [name]=\"column.name\"\n [disabled]=\"!editable\"\n (blur)=\"setValue()\"\n [ngModel]=\"getHexColor(row.data[column.name])\"\n (ngModelChange)=\"row.data[column.name] = $event\" />\n", styles: [":host{display:flex;align-items:center;justify-content:center}input[type=color]{height:16px;width:16px;padding:0;border:0;&::-webkit-color-swatch,&::-webkit-color-swatch-wrapper{border:0;padding:0}}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8084
8097
  }
8085
8098
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ColorCellComponent, decorators: [{
8086
8099
  type: Component,
8087
- args: [{ selector: 'teta-color-cell', imports: [FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n type=\"color\"\n #input\n [name]=\"column.name\"\n [disabled]=\"!editable\"\n (blur)=\"setValue()\"\n [ngModel]=\"getHexColor(row.data[column.name])\"\n (ngModelChange)=\"row.data[column.name] = $event\" />\n", styles: [":host{display:flex;align-items:center;justify-content:center}input[type=color]{height:16px;width:16px;padding:0;border:0}input[type=color]::-webkit-color-swatch,input[type=color]::-webkit-color-swatch-wrapper{border:0;padding:0}\n"] }]
8100
+ args: [{ selector: 'teta-color-cell', imports: [FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n type=\"color\"\n #input\n [name]=\"column.name\"\n [disabled]=\"!editable\"\n (blur)=\"setValue()\"\n [ngModel]=\"getHexColor(row.data[column.name])\"\n (ngModelChange)=\"row.data[column.name] = $event\" />\n", styles: [":host{display:flex;align-items:center;justify-content:center}input[type=color]{height:16px;width:16px;padding:0;border:0;&::-webkit-color-swatch,&::-webkit-color-swatch-wrapper{border:0;padding:0}}\n"] }]
8088
8101
  }], ctorParameters: () => [{ type: TableService }, { type: i0.ChangeDetectorRef }], propDecorators: { input: [{
8089
8102
  type: ViewChild,
8090
8103
  args: ['input', { static: false }]
@@ -11476,7 +11489,7 @@ class LoaderDirective {
11476
11489
  this._renderer.removeChild(this._loader.parentElement, this._loader);
11477
11490
  }
11478
11491
  if (this._mask && this._mask.parentElement) {
11479
- this._renderer.removeChild(this._loader.parentElement, this._mask);
11492
+ this._renderer.removeChild(this._mask.parentElement, this._mask);
11480
11493
  }
11481
11494
  }
11482
11495
  setPosition() {