@tetacom/ng-components 1.1.35 → 1.1.37
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/component/table/contract/table-column.d.ts +5 -0
- package/directive/scrollable/scrollable/scrollable.component.d.ts +14 -10
- package/esm2022/component/property-grid/property-grid/property-grid-item/property-grid-item.component.mjs +6 -1
- package/esm2022/component/table/contract/table-column.mjs +6 -1
- package/esm2022/directive/scrollable/scrollable/scrollable.component.mjs +25 -17
- package/esm2022/util/forms-util.mjs +4 -1
- package/fesm2022/tetacom-ng-components.mjs +74 -54
- package/fesm2022/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Host, HostListener, Injectable, NgModule, forwardRef, EventEmitter, Output, PLATFORM_ID, ElementRef, TemplateRef, Injector, Pipe, ViewChild, ViewEncapsulation, ChangeDetectorRef,
|
|
2
|
+
import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Host, HostListener, Injectable, NgModule, forwardRef, EventEmitter, Output, PLATFORM_ID, ElementRef, TemplateRef, Injector, Pipe, ViewChild, ViewContainerRef, ViewEncapsulation, ChangeDetectorRef, ContentChildren, inject, CUSTOM_ELEMENTS_SCHEMA, SkipSelf, InjectionToken } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, CommonModule, isPlatformBrowser, DatePipe } from '@angular/common';
|
|
5
5
|
import * as i1$1 from '@angular/common/http';
|
|
@@ -12,7 +12,7 @@ import { MaskitoModule } from '@maskito/angular';
|
|
|
12
12
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
13
13
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
|
-
import { ReplaySubject, BehaviorSubject, combineLatest, takeWhile as takeWhile$1, filter as filter$1, map as map$1, lastValueFrom, take, shareReplay, fromEvent, tap,
|
|
15
|
+
import { ReplaySubject, BehaviorSubject, combineLatest, takeWhile as takeWhile$1, filter as filter$1, map as map$1, lastValueFrom, take, shareReplay, Subject, animationFrameScheduler, fromEvent, tap, merge, Observable, pipe, share } from 'rxjs';
|
|
16
16
|
import { maskitoDateTimeOptionsGenerator, maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator } from '@maskito/kit';
|
|
17
17
|
import * as i1$2 from '@ngneat/transloco';
|
|
18
18
|
import { TranslocoModule, TRANSLOCO_SCOPE } from '@ngneat/transloco';
|
|
@@ -4373,8 +4373,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4373
4373
|
args: ['class.scrollable_hide_scroll']
|
|
4374
4374
|
}] } });
|
|
4375
4375
|
|
|
4376
|
+
class LetDirective {
|
|
4377
|
+
tetaLet;
|
|
4378
|
+
constructor(viewContainer, templateRef) {
|
|
4379
|
+
viewContainer.createEmbeddedView(templateRef, new LetContext(this));
|
|
4380
|
+
}
|
|
4381
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
4382
|
+
return true;
|
|
4383
|
+
}
|
|
4384
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: LetDirective, deps: [{ token: ViewContainerRef }, { token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4385
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: LetDirective, selector: "[tetaLet]", inputs: { tetaLet: "tetaLet" }, ngImport: i0 });
|
|
4386
|
+
}
|
|
4387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: LetDirective, decorators: [{
|
|
4388
|
+
type: Directive,
|
|
4389
|
+
args: [{
|
|
4390
|
+
selector: '[tetaLet]'
|
|
4391
|
+
}]
|
|
4392
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef, decorators: [{
|
|
4393
|
+
type: Inject,
|
|
4394
|
+
args: [ViewContainerRef]
|
|
4395
|
+
}] }, { type: i0.TemplateRef, decorators: [{
|
|
4396
|
+
type: Inject,
|
|
4397
|
+
args: [TemplateRef]
|
|
4398
|
+
}] }]; }, propDecorators: { tetaLet: [{
|
|
4399
|
+
type: Input
|
|
4400
|
+
}] } });
|
|
4401
|
+
class LetContext {
|
|
4402
|
+
internalDirectiveInstance;
|
|
4403
|
+
constructor(internalDirectiveInstance) {
|
|
4404
|
+
this.internalDirectiveInstance = internalDirectiveInstance;
|
|
4405
|
+
}
|
|
4406
|
+
get $implicit() {
|
|
4407
|
+
return this.internalDirectiveInstance.tetaLet;
|
|
4408
|
+
}
|
|
4409
|
+
get tetaLet() {
|
|
4410
|
+
return this.internalDirectiveInstance.tetaLet;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
|
|
4376
4414
|
class ScrollableComponent {
|
|
4377
|
-
_cdr;
|
|
4378
4415
|
_scrollDirective;
|
|
4379
4416
|
_scrollableWrapper;
|
|
4380
4417
|
_scrollbarVertical;
|
|
@@ -4383,22 +4420,27 @@ class ScrollableComponent {
|
|
|
4383
4420
|
showScrollbars = false;
|
|
4384
4421
|
contentClass;
|
|
4385
4422
|
scroll = new EventEmitter();
|
|
4423
|
+
_scrollSize = new Subject();
|
|
4386
4424
|
scrollSize;
|
|
4387
4425
|
_container;
|
|
4388
4426
|
_alive = true;
|
|
4389
4427
|
_observer;
|
|
4390
|
-
constructor(
|
|
4391
|
-
this.
|
|
4428
|
+
constructor() {
|
|
4429
|
+
this.scrollSize = this._scrollSize.asObservable().pipe(throttleTime(100, animationFrameScheduler), map(() => {
|
|
4430
|
+
return {
|
|
4431
|
+
scrollHeight: this._container.nativeElement.scrollHeight,
|
|
4432
|
+
scrollWidth: this._container.nativeElement.scrollWidth,
|
|
4433
|
+
clientHeight: this._container.nativeElement.clientHeight,
|
|
4434
|
+
clientWidth: this._container.nativeElement.clientWidth,
|
|
4435
|
+
};
|
|
4436
|
+
}), shareReplay({
|
|
4437
|
+
refCount: true,
|
|
4438
|
+
bufferSize: 1,
|
|
4439
|
+
}));
|
|
4392
4440
|
this._observer = new ResizeObserver(this._observe);
|
|
4393
4441
|
}
|
|
4394
4442
|
_observe = () => {
|
|
4395
|
-
this.
|
|
4396
|
-
scrollHeight: this._container.nativeElement.scrollHeight,
|
|
4397
|
-
scrollWidth: this._container.nativeElement.scrollWidth,
|
|
4398
|
-
clientHeight: this._container.nativeElement.clientHeight,
|
|
4399
|
-
clientWidth: this._container.nativeElement.clientWidth,
|
|
4400
|
-
};
|
|
4401
|
-
this._cdr.detectChanges();
|
|
4443
|
+
this._scrollSize.next();
|
|
4402
4444
|
};
|
|
4403
4445
|
scrollVertical(event) {
|
|
4404
4446
|
this._container.nativeElement.scrollTop = event.target.scrollTop;
|
|
@@ -4427,13 +4469,16 @@ class ScrollableComponent {
|
|
|
4427
4469
|
this._observer.unobserve(this._container.nativeElement);
|
|
4428
4470
|
this._observer.disconnect();
|
|
4429
4471
|
}
|
|
4430
|
-
|
|
4431
|
-
|
|
4472
|
+
ngAfterContentChecked() {
|
|
4473
|
+
this._observe();
|
|
4474
|
+
}
|
|
4475
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4476
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ScrollableComponent, selector: "teta-scrollable", inputs: { direction: "direction", showScrollbars: "showScrollbars", contentClass: "contentClass" }, outputs: { scroll: "scroll" }, host: { properties: { "class.show-scrollbars": "this.showScrollbars" } }, queries: [{ propertyName: "_scrollDirective", first: true, predicate: ScrollableDirective, descendants: true, read: ElementRef, static: true }], viewQueries: [{ propertyName: "_scrollableWrapper", first: true, predicate: ["scrollableWrapper"], descendants: true, static: true }, { propertyName: "_scrollbarVertical", first: true, predicate: ["scrollbarVertical"], descendants: true, static: true }, { propertyName: "_scrollbarHorizontal", first: true, predicate: ["scrollbarHorizontal"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"scroll-controls\" *tetaLet='scrollSize | async as scrollSize'>\n <div #scrollbarVertical\n [class.display-none]=\"scrollSize?.scrollHeight <= scrollSize?.clientHeight\"\n class=\"scroll-scrollbar scroll-scrollbar-vertical\"\n (scroll)=\"scrollVertical($event)\">\n <div [style.height.px]=\"scrollSize?.scrollHeight\" style=\"width: 1px;\"></div>\n </div>\n <div #scrollbarHorizontal\n [class.display-none]=\"scrollSize?.scrollWidth <= scrollSize?.clientWidth\"\n class=\"scroll-scrollbar scroll-scrollbar-horizontal\"\n (scroll)=\"scrollHorizontal($event)\">\n <div [style.width.px]=\"scrollSize?.scrollWidth\" style=\"height: 1px;\"></div>\n </div>\n</div>\n\n\n<!--<div #scrollableWrapper class=\"scroll-content-wrapper\">-->\n<!-- <div class=\"scroll-content\"-->\n<!-- [class.column]=\"direction === 'column'\">-->\n<!-- <!– <div class=\"scroll-content\">–>-->\n<!-- <ng-content></ng-content>-->\n<!-- </div>-->\n<!--</div>-->\n<div #scrollableWrapper class=\"scroll-content-wrapper\"\n [ngClass]=\"contentClass\"\n [class.column]=\"direction === 'column'\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{overflow:hidden;position:relative;z-index:0;display:flex}:host:hover .scroll-controls{opacity:1}:host.show-scrollbars .scroll-controls{opacity:1}:host::-webkit-scrollbar{width:0;height:0}.scroll-content-wrapper{display:flex;overflow:auto;flex-grow:1}.scroll-content-wrapper::-webkit-scrollbar{width:0;height:0}.scroll-content{position:relative;z-index:0;flex:1;display:flex;height:auto;min-width:0}.scroll-controls{position:absolute;inset:0;z-index:1;pointer-events:none;opacity:0;transition:opacity .5s linear}.scroll-scrollbar{position:absolute;overflow:auto;pointer-events:auto}.scroll-scrollbar-vertical{right:0;top:0;bottom:12px;width:12px}.scroll-scrollbar-horizontal{right:12px;left:0;bottom:0;height:12px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: LetDirective, selector: "[tetaLet]", inputs: ["tetaLet"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4432
4477
|
}
|
|
4433
4478
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollableComponent, decorators: [{
|
|
4434
4479
|
type: Component,
|
|
4435
|
-
args: [{ selector: 'teta-scrollable', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"scroll-controls\">\n <div #scrollbarVertical\n [class.display-none]=\"scrollSize?.scrollHeight <= scrollSize?.clientHeight\"\n class=\"scroll-scrollbar scroll-scrollbar-vertical\"\n (scroll)=\"scrollVertical($event)\">\n <div [style.height.px]=\"scrollSize?.scrollHeight\" style=\"width: 1px;\"></div>\n </div>\n <div #scrollbarHorizontal\n [class.display-none]=\"scrollSize?.scrollWidth <= scrollSize?.clientWidth\"\n class=\"scroll-scrollbar scroll-scrollbar-horizontal\"\n (scroll)=\"scrollHorizontal($event)\">\n <div [style.width.px]=\"scrollSize?.scrollWidth\" style=\"height: 1px;\"></div>\n </div>\n</div>\n\n\n<!--<div #scrollableWrapper class=\"scroll-content-wrapper\">-->\n<!-- <div class=\"scroll-content\"-->\n<!-- [class.column]=\"direction === 'column'\">-->\n<!-- <!– <div class=\"scroll-content\">–>-->\n<!-- <ng-content></ng-content>-->\n<!-- </div>-->\n<!--</div>-->\n<div #scrollableWrapper class=\"scroll-content-wrapper\"\n [ngClass]=\"contentClass\"\n [class.column]=\"direction === 'column'\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{overflow:hidden;position:relative;z-index:0;display:flex}:host:hover .scroll-controls{opacity:1}:host.show-scrollbars .scroll-controls{opacity:1}:host::-webkit-scrollbar{width:0;height:0}.scroll-content-wrapper{display:flex;overflow:auto;flex-grow:1}.scroll-content-wrapper::-webkit-scrollbar{width:0;height:0}.scroll-content{position:relative;z-index:0;flex:1;display:flex;height:auto;min-width:0}.scroll-controls{position:absolute;inset:0;z-index:1;pointer-events:none;opacity:0;transition:opacity .5s linear}.scroll-scrollbar{position:absolute;overflow:auto;pointer-events:auto}.scroll-scrollbar-vertical{right:0;top:0;bottom:12px;width:12px}.scroll-scrollbar-horizontal{right:12px;left:0;bottom:0;height:12px}\n"] }]
|
|
4436
|
-
}], ctorParameters: function () { return [
|
|
4480
|
+
args: [{ selector: 'teta-scrollable', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"scroll-controls\" *tetaLet='scrollSize | async as scrollSize'>\n <div #scrollbarVertical\n [class.display-none]=\"scrollSize?.scrollHeight <= scrollSize?.clientHeight\"\n class=\"scroll-scrollbar scroll-scrollbar-vertical\"\n (scroll)=\"scrollVertical($event)\">\n <div [style.height.px]=\"scrollSize?.scrollHeight\" style=\"width: 1px;\"></div>\n </div>\n <div #scrollbarHorizontal\n [class.display-none]=\"scrollSize?.scrollWidth <= scrollSize?.clientWidth\"\n class=\"scroll-scrollbar scroll-scrollbar-horizontal\"\n (scroll)=\"scrollHorizontal($event)\">\n <div [style.width.px]=\"scrollSize?.scrollWidth\" style=\"height: 1px;\"></div>\n </div>\n</div>\n\n\n<!--<div #scrollableWrapper class=\"scroll-content-wrapper\">-->\n<!-- <div class=\"scroll-content\"-->\n<!-- [class.column]=\"direction === 'column'\">-->\n<!-- <!– <div class=\"scroll-content\">–>-->\n<!-- <ng-content></ng-content>-->\n<!-- </div>-->\n<!--</div>-->\n<div #scrollableWrapper class=\"scroll-content-wrapper\"\n [ngClass]=\"contentClass\"\n [class.column]=\"direction === 'column'\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{overflow:hidden;position:relative;z-index:0;display:flex}:host:hover .scroll-controls{opacity:1}:host.show-scrollbars .scroll-controls{opacity:1}:host::-webkit-scrollbar{width:0;height:0}.scroll-content-wrapper{display:flex;overflow:auto;flex-grow:1}.scroll-content-wrapper::-webkit-scrollbar{width:0;height:0}.scroll-content{position:relative;z-index:0;flex:1;display:flex;height:auto;min-width:0}.scroll-controls{position:absolute;inset:0;z-index:1;pointer-events:none;opacity:0;transition:opacity .5s linear}.scroll-scrollbar{position:absolute;overflow:auto;pointer-events:auto}.scroll-scrollbar-vertical{right:0;top:0;bottom:12px;width:12px}.scroll-scrollbar-horizontal{right:12px;left:0;bottom:0;height:12px}\n"] }]
|
|
4481
|
+
}], ctorParameters: function () { return []; }, propDecorators: { _scrollDirective: [{
|
|
4437
4482
|
type: ContentChild,
|
|
4438
4483
|
args: [ScrollableDirective, {
|
|
4439
4484
|
static: true,
|
|
@@ -5221,44 +5266,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
5221
5266
|
type: Input
|
|
5222
5267
|
}] } });
|
|
5223
5268
|
|
|
5224
|
-
class LetDirective {
|
|
5225
|
-
tetaLet;
|
|
5226
|
-
constructor(viewContainer, templateRef) {
|
|
5227
|
-
viewContainer.createEmbeddedView(templateRef, new LetContext(this));
|
|
5228
|
-
}
|
|
5229
|
-
static ngTemplateContextGuard(_dir, _ctx) {
|
|
5230
|
-
return true;
|
|
5231
|
-
}
|
|
5232
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: LetDirective, deps: [{ token: ViewContainerRef }, { token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5233
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: LetDirective, selector: "[tetaLet]", inputs: { tetaLet: "tetaLet" }, ngImport: i0 });
|
|
5234
|
-
}
|
|
5235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: LetDirective, decorators: [{
|
|
5236
|
-
type: Directive,
|
|
5237
|
-
args: [{
|
|
5238
|
-
selector: '[tetaLet]'
|
|
5239
|
-
}]
|
|
5240
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef, decorators: [{
|
|
5241
|
-
type: Inject,
|
|
5242
|
-
args: [ViewContainerRef]
|
|
5243
|
-
}] }, { type: i0.TemplateRef, decorators: [{
|
|
5244
|
-
type: Inject,
|
|
5245
|
-
args: [TemplateRef]
|
|
5246
|
-
}] }]; }, propDecorators: { tetaLet: [{
|
|
5247
|
-
type: Input
|
|
5248
|
-
}] } });
|
|
5249
|
-
class LetContext {
|
|
5250
|
-
internalDirectiveInstance;
|
|
5251
|
-
constructor(internalDirectiveInstance) {
|
|
5252
|
-
this.internalDirectiveInstance = internalDirectiveInstance;
|
|
5253
|
-
}
|
|
5254
|
-
get $implicit() {
|
|
5255
|
-
return this.internalDirectiveInstance.tetaLet;
|
|
5256
|
-
}
|
|
5257
|
-
get tetaLet() {
|
|
5258
|
-
return this.internalDirectiveInstance.tetaLet;
|
|
5259
|
-
}
|
|
5260
|
-
}
|
|
5261
|
-
|
|
5262
5269
|
class SelectComponent {
|
|
5263
5270
|
_cdr;
|
|
5264
5271
|
_elementRef;
|
|
@@ -7001,6 +7008,9 @@ class FormsUtil {
|
|
|
7001
7008
|
if (column.maxValue != null) {
|
|
7002
7009
|
validators.push(Validators.max(column.maxValue));
|
|
7003
7010
|
}
|
|
7011
|
+
if (column.maxLength != null) {
|
|
7012
|
+
validators.push(Validators.maxLength(column.maxLength));
|
|
7013
|
+
}
|
|
7004
7014
|
if (column.validators?.length > 0) {
|
|
7005
7015
|
validators.push(...column.validators);
|
|
7006
7016
|
}
|
|
@@ -7197,6 +7207,11 @@ class PropertyGridItemComponent {
|
|
|
7197
7207
|
value: column.maxValue,
|
|
7198
7208
|
});
|
|
7199
7209
|
}
|
|
7210
|
+
if (control?.hasError('maxlength')) {
|
|
7211
|
+
return this._transloco.translate('errors.max_length', {
|
|
7212
|
+
value: column.maxLength,
|
|
7213
|
+
});
|
|
7214
|
+
}
|
|
7200
7215
|
}
|
|
7201
7216
|
ngOnDestroy() {
|
|
7202
7217
|
this._alive = false;
|
|
@@ -8038,6 +8053,10 @@ class TableColumn extends FilterItem {
|
|
|
8038
8053
|
* Значение по умолчанию при создании записи
|
|
8039
8054
|
*/
|
|
8040
8055
|
minValue;
|
|
8056
|
+
/**
|
|
8057
|
+
* Максимальная длина
|
|
8058
|
+
*/
|
|
8059
|
+
maxLength;
|
|
8041
8060
|
/**
|
|
8042
8061
|
* Поле обязательно для заполнения
|
|
8043
8062
|
*/
|
|
@@ -8069,6 +8088,7 @@ class TableColumn extends FilterItem {
|
|
|
8069
8088
|
this.defaultValue = options?.defaultValue;
|
|
8070
8089
|
this.maxValue = options?.maxValue;
|
|
8071
8090
|
this.minValue = options?.minValue;
|
|
8091
|
+
this.maxLength = options?.maxLength;
|
|
8072
8092
|
this.required = options?.required;
|
|
8073
8093
|
this.columns = options?.columns?.map(x => new TableColumn(x)) ?? [];
|
|
8074
8094
|
this.validators = options?.validators;
|