@morozeckiy/dd-lib 0.1.1 → 0.1.2
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/esm2022/lib/common/lib-common-button.mjs +62 -0
- package/esm2022/lib/common/lib-common-input-text.mjs +172 -0
- package/esm2022/lib/core/dialog/dialog-config.mjs +15 -0
- package/esm2022/lib/core/dialog/dialog-container.component.mjs +40 -0
- package/esm2022/lib/core/dialog/dialog-ref.mjs +19 -0
- package/esm2022/lib/core/dialog/dialog.service.mjs +106 -0
- package/esm2022/lib/core/directives/auto-height.directive.mjs +36 -0
- package/esm2022/lib/core/directives/click-outside.directive.mjs +42 -0
- package/esm2022/lib/core/directives/counter.directive.mjs +64 -0
- package/esm2022/lib/core/directives/declension.directive.mjs +40 -0
- package/esm2022/lib/core/directives/resize-textarea.directive.mjs +26 -0
- package/esm2022/lib/core/directives/triangle.directive.mjs +75 -0
- package/esm2022/lib/core/index.mjs +26 -0
- package/esm2022/lib/core/pipes/filter-tabs.pipe.mjs +31 -0
- package/esm2022/lib/core/pipes/filter.pipe.mjs +49 -0
- package/esm2022/lib/core/pipes/highlight.pipe.mjs +23 -0
- package/esm2022/lib/core/pipes/reverse.pipe.mjs +17 -0
- package/esm2022/lib/core/pipes/safe.pipe.mjs +34 -0
- package/esm2022/lib/core/services/date.service.mjs +113 -0
- package/esm2022/lib/core/services/destroy.service.mjs +15 -0
- package/esm2022/lib/core/services/fetcher.service.mjs +92 -0
- package/esm2022/lib/core/services/interceptors.service.mjs +27 -0
- package/esm2022/lib/core/services/svg-icons.service.mjs +26 -0
- package/esm2022/lib/core/services/theme-constructor.service.mjs +64 -0
- package/esm2022/lib/core/services/validators.service.mjs +73 -0
- package/esm2022/lib/core/tools.mjs +128 -0
- package/esm2022/lib/core/tooltip/tooltip.component.mjs +27 -0
- package/esm2022/lib/core/tooltip/tooltip.directive.mjs +137 -0
- package/esm2022/lib/lib-accordion/lib-accordion.component.mjs +15 -0
- package/esm2022/lib/lib-back-button/lib-back-button.component.mjs +37 -0
- package/esm2022/lib/lib-button/lib-button.component.mjs +30 -0
- package/esm2022/lib/lib-calendar/lib-calendar.component.mjs +222 -0
- package/esm2022/lib/lib-card/lib-card.component.mjs +34 -0
- package/esm2022/lib/lib-checkbox/lib-checkbox.component.mjs +66 -0
- package/esm2022/lib/lib-comment-input/lib-comment-input.component.mjs +20 -0
- package/esm2022/lib/lib-file-upload/lib-file-upload.component.mjs +34 -0
- package/esm2022/lib/lib-filter-button/lib-filter-button.component.mjs +42 -0
- package/esm2022/lib/lib-image-loader/lib-image-loader.component.mjs +14 -0
- package/esm2022/lib/lib-input/lib-input.component.mjs +55 -0
- package/esm2022/lib/lib-loader/lib-loader.component.mjs +16 -0
- package/esm2022/lib/lib-period/lib-period.component.mjs +114 -0
- package/esm2022/lib/lib-radio/lib-radio.component.mjs +76 -0
- package/esm2022/lib/lib-search-input/lib-search-input.component.mjs +91 -0
- package/esm2022/lib/lib-select/lib-select.component.mjs +137 -0
- package/esm2022/lib/lib-skeleton/lib-skeleton.component.mjs +45 -0
- package/esm2022/lib/lib-sort/lib-sort.component.mjs +44 -0
- package/esm2022/lib/lib-step/lib-step.component.mjs +19 -0
- package/esm2022/lib/lib-svg/lib-svg.component.mjs +75 -0
- package/esm2022/lib/lib-svg-icon/lib-svg-icon.component.mjs +55 -0
- package/esm2022/lib/lib-tabs-fragment/lib-tabs-fragment.component.mjs +79 -0
- package/esm2022/lib/lib-textarea/lib-textarea.component.mjs +50 -0
- package/esm2022/lib/toast/toast-base/toast-base.component.mjs +29 -0
- package/esm2022/lib/toast/toast-placeholder/toast-placeholder.component.mjs +29 -0
- package/esm2022/lib/toast/toast.service.mjs +124 -0
- package/esm2022/lib/utils/decorators.mjs +102 -0
- package/esm2022/morozeckiy-dd-lib.mjs +5 -0
- package/esm2022/public-api.mjs +35 -0
- package/fesm2022/morozeckiy-dd-lib.mjs +3004 -0
- package/fesm2022/morozeckiy-dd-lib.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/common/lib-common-button.d.ts +20 -0
- package/lib/common/lib-common-input-text.d.ts +53 -0
- package/lib/core/dialog/dialog-config.d.ts +14 -0
- package/lib/core/dialog/dialog-container.component.d.ts +18 -0
- package/lib/core/dialog/dialog-ref.d.ts +18 -0
- package/lib/core/dialog/dialog.service.d.ts +28 -0
- package/lib/core/directives/auto-height.directive.d.ts +11 -0
- package/lib/core/directives/click-outside.directive.d.ts +11 -0
- package/lib/core/directives/counter.directive.d.ts +11 -0
- package/lib/core/directives/declension.directive.d.ts +13 -0
- package/lib/core/directives/resize-textarea.directive.d.ts +10 -0
- package/lib/core/directives/triangle.directive.d.ts +16 -0
- package/lib/core/index.d.ts +20 -0
- package/lib/core/pipes/filter-tabs.pipe.d.ts +7 -0
- package/lib/core/pipes/filter.pipe.d.ts +12 -0
- package/lib/core/pipes/highlight.pipe.d.ts +7 -0
- package/lib/core/pipes/reverse.pipe.d.ts +7 -0
- package/lib/core/pipes/safe.pipe.d.ts +10 -0
- package/lib/core/services/date.service.d.ts +41 -0
- package/lib/core/services/destroy.service.d.ts +8 -0
- package/lib/core/services/fetcher.service.d.ts +29 -0
- package/lib/core/services/interceptors.service.d.ts +12 -0
- package/lib/core/services/svg-icons.service.d.ts +9 -0
- package/lib/core/services/theme-constructor.service.d.ts +27 -0
- package/lib/core/services/validators.service.d.ts +18 -0
- package/lib/core/tools.d.ts +16 -0
- package/lib/core/tooltip/tooltip.component.d.ts +12 -0
- package/lib/core/tooltip/tooltip.directive.d.ts +22 -0
- package/lib/lib-accordion/lib-accordion.component.d.ts +8 -0
- package/lib/lib-back-button/lib-back-button.component.d.ts +13 -0
- package/lib/lib-button/lib-button.component.d.ts +10 -0
- package/lib/lib-calendar/lib-calendar.component.d.ts +76 -0
- package/lib/lib-card/lib-card.component.d.ts +16 -0
- package/lib/lib-checkbox/lib-checkbox.component.d.ts +23 -0
- package/lib/lib-comment-input/lib-comment-input.component.d.ts +8 -0
- package/lib/lib-file-upload/lib-file-upload.component.d.ts +12 -0
- package/lib/lib-filter-button/lib-filter-button.component.d.ts +13 -0
- package/lib/lib-image-loader/lib-image-loader.component.d.ts +6 -0
- package/lib/lib-input/lib-input.component.d.ts +13 -0
- package/lib/lib-loader/lib-loader.component.d.ts +6 -0
- package/lib/lib-period/lib-period.component.d.ts +41 -0
- package/lib/lib-radio/lib-radio.component.d.ts +25 -0
- package/lib/lib-search-input/lib-search-input.component.d.ts +29 -0
- package/lib/lib-select/lib-select.component.d.ts +30 -0
- package/lib/lib-skeleton/lib-skeleton.component.d.ts +16 -0
- package/lib/lib-sort/lib-sort.component.d.ts +18 -0
- package/lib/lib-step/lib-step.component.d.ts +7 -0
- package/{src/lib/lib-svg/lib-svg.component.ts → lib/lib-svg/lib-svg.component.d.ts} +38 -66
- package/lib/lib-svg-icon/lib-svg-icon.component.d.ts +18 -0
- package/lib/lib-tabs-fragment/lib-tabs-fragment.component.d.ts +29 -0
- package/lib/lib-textarea/lib-textarea.component.d.ts +13 -0
- package/lib/toast/toast-base/toast-base.component.d.ts +21 -0
- package/lib/toast/toast-placeholder/toast-placeholder.component.d.ts +12 -0
- package/lib/toast/toast.service.d.ts +35 -0
- package/lib/utils/decorators.d.ts +4 -0
- package/package.json +16 -3
- package/public-api.d.ts +30 -0
- package/ekgip-dd-lib-0.0.1.tgz +0 -0
- package/ng-package.json +0 -8
- package/src/lib/common/lib-common-button.ts +0 -34
- package/src/lib/common/lib-common-input-text.ts +0 -154
- package/src/lib/core/dialog/dialog-config.ts +0 -19
- package/src/lib/core/dialog/dialog-container.component.ts +0 -38
- package/src/lib/core/dialog/dialog-ref.ts +0 -28
- package/src/lib/core/dialog/dialog.service.ts +0 -144
- package/src/lib/core/directives/auto-height.directive.ts +0 -29
- package/src/lib/core/directives/click-outside.directive.ts +0 -33
- package/src/lib/core/directives/counter.directive.ts +0 -54
- package/src/lib/core/directives/declension.directive.ts +0 -29
- package/src/lib/core/directives/resize-textarea.directive.ts +0 -16
- package/src/lib/core/directives/triangle.directive.ts +0 -56
- package/src/lib/core/index.ts +0 -27
- package/src/lib/core/pipes/filter-tabs.pipe.ts +0 -25
- package/src/lib/core/pipes/filter.pipe.ts +0 -36
- package/src/lib/core/pipes/highlight.pipe.ts +0 -17
- package/src/lib/core/pipes/reverse.pipe.ts +0 -11
- package/src/lib/core/pipes/safe.pipe.ts +0 -37
- package/src/lib/core/services/date.service.ts +0 -153
- package/src/lib/core/services/destroy.service.ts +0 -10
- package/src/lib/core/services/fetcher.service.ts +0 -109
- package/src/lib/core/services/interceptors.service.ts +0 -26
- package/src/lib/core/services/svg-icons.service.ts +0 -25
- package/src/lib/core/services/theme-constructor.service.ts +0 -68
- package/src/lib/core/services/validators.service.ts +0 -73
- package/src/lib/core/tools.ts +0 -159
- package/src/lib/core/tooltip/tooltip.component.html +0 -10
- package/src/lib/core/tooltip/tooltip.component.scss +0 -59
- package/src/lib/core/tooltip/tooltip.component.ts +0 -27
- package/src/lib/core/tooltip/tooltip.directive.ts +0 -137
- package/src/lib/core/utils.ts +0 -28
- package/src/lib/lib-accordion/lib-accordion.component.html +0 -15
- package/src/lib/lib-accordion/lib-accordion.component.scss +0 -23
- package/src/lib/lib-accordion/lib-accordion.component.ts +0 -17
- package/src/lib/lib-back-button/lib-back-button.component.html +0 -4
- package/src/lib/lib-back-button/lib-back-button.component.scss +0 -3
- package/src/lib/lib-back-button/lib-back-button.component.ts +0 -31
- package/src/lib/lib-button/lib-button.component.html +0 -30
- package/src/lib/lib-button/lib-button.component.scss +0 -89
- package/src/lib/lib-button/lib-button.component.ts +0 -33
- package/src/lib/lib-calendar/lib-calendar.component.html +0 -64
- package/src/lib/lib-calendar/lib-calendar.component.scss +0 -88
- package/src/lib/lib-calendar/lib-calendar.component.ts +0 -227
- package/src/lib/lib-card/lib-card.component.html +0 -23
- package/src/lib/lib-card/lib-card.component.scss +0 -64
- package/src/lib/lib-card/lib-card.component.ts +0 -32
- package/src/lib/lib-checkbox/lib-checkbox.component.html +0 -15
- package/src/lib/lib-checkbox/lib-checkbox.component.scss +0 -80
- package/src/lib/lib-checkbox/lib-checkbox.component.ts +0 -67
- package/src/lib/lib-comment-input/lib-comment-input.component.html +0 -32
- package/src/lib/lib-comment-input/lib-comment-input.component.scss +0 -28
- package/src/lib/lib-comment-input/lib-comment-input.component.ts +0 -20
- package/src/lib/lib-file-upload/lib-file-upload.component.html +0 -14
- package/src/lib/lib-file-upload/lib-file-upload.component.scss +0 -3
- package/src/lib/lib-file-upload/lib-file-upload.component.ts +0 -26
- package/src/lib/lib-filter-button/lib-filter-button.component.html +0 -46
- package/src/lib/lib-filter-button/lib-filter-button.component.scss +0 -62
- package/src/lib/lib-filter-button/lib-filter-button.component.ts +0 -45
- package/src/lib/lib-image-loader/lib-image-loader.component.html +0 -17
- package/src/lib/lib-image-loader/lib-image-loader.component.scss +0 -6
- package/src/lib/lib-image-loader/lib-image-loader.component.ts +0 -16
- package/src/lib/lib-input/lib-input.component.html +0 -32
- package/src/lib/lib-input/lib-input.component.scss +0 -72
- package/src/lib/lib-input/lib-input.component.ts +0 -62
- package/src/lib/lib-loader/lib-loader.component.html +0 -29
- package/src/lib/lib-loader/lib-loader.component.scss +0 -26
- package/src/lib/lib-loader/lib-loader.component.ts +0 -13
- package/src/lib/lib-period/lib-period.component.html +0 -41
- package/src/lib/lib-period/lib-period.component.scss +0 -77
- package/src/lib/lib-period/lib-period.component.ts +0 -131
- package/src/lib/lib-radio/lib-radio.component.html +0 -22
- package/src/lib/lib-radio/lib-radio.component.scss +0 -113
- package/src/lib/lib-radio/lib-radio.component.ts +0 -78
- package/src/lib/lib-search-input/lib-search-input.component.html +0 -48
- package/src/lib/lib-search-input/lib-search-input.component.scss +0 -86
- package/src/lib/lib-search-input/lib-search-input.component.ts +0 -94
- package/src/lib/lib-select/lib-select.component.html +0 -83
- package/src/lib/lib-select/lib-select.component.scss +0 -130
- package/src/lib/lib-select/lib-select.component.ts +0 -152
- package/src/lib/lib-skeleton/lib-skeleton.component.html +0 -11
- package/src/lib/lib-skeleton/lib-skeleton.component.scss +0 -36
- package/src/lib/lib-skeleton/lib-skeleton.component.ts +0 -41
- package/src/lib/lib-sort/lib-sort.component.html +0 -21
- package/src/lib/lib-sort/lib-sort.component.scss +0 -21
- package/src/lib/lib-sort/lib-sort.component.ts +0 -52
- package/src/lib/lib-step/lib-step.component.html +0 -4
- package/src/lib/lib-step/lib-step.component.scss +0 -23
- package/src/lib/lib-step/lib-step.component.ts +0 -14
- package/src/lib/lib-svg/lib-svg.component.html +0 -15
- package/src/lib/lib-svg/lib-svg.component.scss +0 -81
- package/src/lib/lib-svg-icon/lib-svg-icon.component.css +0 -0
- package/src/lib/lib-svg-icon/lib-svg-icon.component.ts +0 -58
- package/src/lib/lib-tabs-fragment/lib-tabs-fragment.component.html +0 -12
- package/src/lib/lib-tabs-fragment/lib-tabs-fragment.component.scss +0 -19
- package/src/lib/lib-tabs-fragment/lib-tabs-fragment.component.ts +0 -88
- package/src/lib/lib-textarea/lib-textarea.component.html +0 -37
- package/src/lib/lib-textarea/lib-textarea.component.scss +0 -77
- package/src/lib/lib-textarea/lib-textarea.component.ts +0 -49
- package/src/lib/toast/toast-base/toast-base.component.html +0 -7
- package/src/lib/toast/toast-base/toast-base.component.scss +0 -44
- package/src/lib/toast/toast-base/toast-base.component.ts +0 -38
- package/src/lib/toast/toast-placeholder/toast-placeholder.component.ts +0 -20
- package/src/lib/toast/toast.service.ts +0 -130
- package/src/lib/utils/decorators.ts +0 -124
- package/src/public-api.ts +0 -35
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morozeckiy/dd-lib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "https://gitlab.com/Morozeckiy/dd-lib",
|
|
6
6
|
"publishConfig": {
|
|
@@ -13,5 +13,18 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"tslib": "^2.3.0"
|
|
15
15
|
},
|
|
16
|
-
"sideEffects": false
|
|
17
|
-
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"module": "fesm2022/morozeckiy-dd-lib.mjs",
|
|
18
|
+
"typings": "index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"default": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"esm2022": "./esm2022/morozeckiy-dd-lib.mjs",
|
|
26
|
+
"esm": "./esm2022/morozeckiy-dd-lib.mjs",
|
|
27
|
+
"default": "./fesm2022/morozeckiy-dd-lib.mjs"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const t = true;
|
|
2
|
+
export * from './lib/common/lib-common-button';
|
|
3
|
+
export * from './lib/common/lib-common-input-text';
|
|
4
|
+
export * from './lib/lib-loader/lib-loader.component';
|
|
5
|
+
export * from './lib/lib-button/lib-button.component';
|
|
6
|
+
export * from './lib/lib-accordion/lib-accordion.component';
|
|
7
|
+
export * from './lib/lib-back-button/lib-back-button.component';
|
|
8
|
+
export * from './lib/lib-calendar/lib-calendar.component';
|
|
9
|
+
export * from './lib/lib-card/lib-card.component';
|
|
10
|
+
export * from './lib/lib-checkbox/lib-checkbox.component';
|
|
11
|
+
export * from './lib/lib-comment-input/lib-comment-input.component';
|
|
12
|
+
export * from './lib/lib-file-upload/lib-file-upload.component';
|
|
13
|
+
export * from './lib/lib-filter-button/lib-filter-button.component';
|
|
14
|
+
export * from './lib/lib-image-loader/lib-image-loader.component';
|
|
15
|
+
export * from './lib/lib-input/lib-input.component';
|
|
16
|
+
export * from './lib/lib-period/lib-period.component';
|
|
17
|
+
export * from './lib/lib-radio/lib-radio.component';
|
|
18
|
+
export * from './lib/lib-search-input/lib-search-input.component';
|
|
19
|
+
export * from './lib/lib-select/lib-select.component';
|
|
20
|
+
export * from './lib/lib-skeleton/lib-skeleton.component';
|
|
21
|
+
export * from './lib/lib-sort/lib-sort.component';
|
|
22
|
+
export * from './lib/lib-step/lib-step.component';
|
|
23
|
+
export * from './lib/lib-svg/lib-svg.component';
|
|
24
|
+
export * from './lib/lib-svg-icon/lib-svg-icon.component';
|
|
25
|
+
export * from './lib/lib-tabs-fragment/lib-tabs-fragment.component';
|
|
26
|
+
export * from './lib/lib-textarea/lib-textarea.component';
|
|
27
|
+
export * from './lib/utils/decorators';
|
|
28
|
+
export * from './lib/toast/toast.service';
|
|
29
|
+
export * from './lib/toast/toast-placeholder/toast-placeholder.component';
|
|
30
|
+
export * from './lib/core/index';
|
package/ekgip-dd-lib-0.0.1.tgz
DELETED
|
Binary file
|
package/ng-package.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
template: '',
|
|
5
|
-
})
|
|
6
|
-
export abstract class LibCommonButtonComponent {
|
|
7
|
-
@Input() public width: string | undefined;
|
|
8
|
-
@Input() public height: string | undefined;
|
|
9
|
-
@Input() public size: 'md' | 'lg' | '' = '';
|
|
10
|
-
@Input() public fontSize: number | null | undefined;
|
|
11
|
-
@Input() public autofocus = false;
|
|
12
|
-
@Input() public btnColor: 'white' | 'green' | 'red' | 'transparent' | 'dark' = 'green';
|
|
13
|
-
@Input() public active = false;
|
|
14
|
-
@Input() public disabled: boolean | null = false;
|
|
15
|
-
|
|
16
|
-
@Input() public showLoader: null | boolean | undefined = false;
|
|
17
|
-
@Input() public buttonType: 'submit' | 'reset' | 'button' = 'button';
|
|
18
|
-
|
|
19
|
-
@ViewChild('contentData', { static: false }) public content: ElementRef | undefined;
|
|
20
|
-
@ViewChild('btn', { static: false }) public button: ElementRef | undefined;
|
|
21
|
-
|
|
22
|
-
@Output() public clickEvent = new EventEmitter<null>();
|
|
23
|
-
|
|
24
|
-
public onClick(event: Event): void {
|
|
25
|
-
if (this.disabled || this.showLoader || this.active) {
|
|
26
|
-
event.stopPropagation();
|
|
27
|
-
event.preventDefault();
|
|
28
|
-
} else {
|
|
29
|
-
this.clickEvent.emit();
|
|
30
|
-
const el = document.activeElement as HTMLElement;
|
|
31
|
-
el?.blur();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectorRef,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
forwardRef,
|
|
7
|
-
Input,
|
|
8
|
-
Output,
|
|
9
|
-
ViewChild,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { AbstractControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
12
|
-
|
|
13
|
-
@Component({
|
|
14
|
-
selector: 'dd-lib-common-input',
|
|
15
|
-
template: '',
|
|
16
|
-
providers: [
|
|
17
|
-
{
|
|
18
|
-
provide: NG_VALUE_ACCESSOR,
|
|
19
|
-
useExisting: forwardRef(() => LibCommonInputTextComponent),
|
|
20
|
-
multi: true,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
})
|
|
24
|
-
export abstract class LibCommonInputTextComponent {
|
|
25
|
-
@ViewChild('searchInput') protected inputSearchElement: ElementRef<HTMLInputElement> | undefined;
|
|
26
|
-
@ViewChild('input') protected inputElement: ElementRef<HTMLInputElement> | undefined;
|
|
27
|
-
@ViewChild('textarea') protected textAreaElement: ElementRef<HTMLTextAreaElement> | undefined;
|
|
28
|
-
@Input() public name: string | undefined;
|
|
29
|
-
@Input() public label: string | undefined;
|
|
30
|
-
@Input() public formControlName: string | undefined;
|
|
31
|
-
@Input() public type: 'password' | 'email' | 'number' | 'text' | undefined;
|
|
32
|
-
@Input() public contextClass: string | undefined; // класс разметки для deep стилей
|
|
33
|
-
@Input() public minlength: string | number | undefined;
|
|
34
|
-
@Input() public maxlength = 700;
|
|
35
|
-
@Input() public placeholder?: string;
|
|
36
|
-
@Input() public autocomplete?: string;
|
|
37
|
-
@Input() public tabIndex?: string | number;
|
|
38
|
-
@Input() public readOnly?: boolean;
|
|
39
|
-
@Input() public required = false;
|
|
40
|
-
@Input() public disabled = false;
|
|
41
|
-
@Input() public commitOnInput = true; // коммитить по input или по change
|
|
42
|
-
@Input() public clearable = false;
|
|
43
|
-
@Input() public uppercase = false;
|
|
44
|
-
@Input() public invalid = false;
|
|
45
|
-
@Input() public errorText: string | undefined;
|
|
46
|
-
@Output() public cleared = new EventEmitter<void>();
|
|
47
|
-
@Output() public focus = new EventEmitter<any>();
|
|
48
|
-
@Output() public blur = new EventEmitter<any>();
|
|
49
|
-
public get id() {
|
|
50
|
-
return this._ID;
|
|
51
|
-
}
|
|
52
|
-
public focused = false;
|
|
53
|
-
public touched = false;
|
|
54
|
-
public control: AbstractControl | undefined | null;
|
|
55
|
-
public value: string | undefined = '';
|
|
56
|
-
public changeDetection: ChangeDetectorRef;
|
|
57
|
-
|
|
58
|
-
protected destroyed = false;
|
|
59
|
-
protected onTouchedCallback: (() => void) | undefined;
|
|
60
|
-
private _ID = '';
|
|
61
|
-
|
|
62
|
-
protected constructor(changeDetection: ChangeDetectorRef) {
|
|
63
|
-
this.changeDetection = changeDetection;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public handleInput(_e: Event): void {
|
|
67
|
-
if (this.commitOnInput) {
|
|
68
|
-
this.commit(this.value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public notifyFocusEvent(e: Event): void {
|
|
73
|
-
// this.focusManager.notifyFocusMayChanged(this, e.type === 'focus');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// public writeValue(value: string | number | null): void {
|
|
77
|
-
// this.value = value === null || value === undefined ? '' : '' + value;
|
|
78
|
-
// if (!this.destroyed) {
|
|
79
|
-
// this.changeDetection.detectChanges();
|
|
80
|
-
// }
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
// public clearValue(e: Event): void {
|
|
84
|
-
// if (!this.disabled) {
|
|
85
|
-
// this.writeValue(null);
|
|
86
|
-
// this.commit(null);
|
|
87
|
-
// this.cleared.emit();
|
|
88
|
-
// this.returnFocus(e);
|
|
89
|
-
// }
|
|
90
|
-
// e.stopPropagation();
|
|
91
|
-
// }
|
|
92
|
-
|
|
93
|
-
public handleBlur(): void {
|
|
94
|
-
this.focused = false;
|
|
95
|
-
if (this.onTouchedCallback) {
|
|
96
|
-
this.onTouchedCallback();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this.blur.emit();
|
|
100
|
-
this.changeDetection.detectChanges();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public handleFocus(): void {
|
|
104
|
-
this.focused = this.touched = true;
|
|
105
|
-
if (this.onTouchedCallback) {
|
|
106
|
-
this.onTouchedCallback();
|
|
107
|
-
}
|
|
108
|
-
this.focus.emit();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public returnFocus(e?: Event): void {
|
|
112
|
-
if (
|
|
113
|
-
this.inputElement &&
|
|
114
|
-
this.inputElement.nativeElement &&
|
|
115
|
-
(!e || e.target !== this.inputElement.nativeElement)
|
|
116
|
-
) {
|
|
117
|
-
this.inputElement.nativeElement.focus();
|
|
118
|
-
// HelperService.resetSelection(this.inputElement.nativeElement);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public loseFocus(): void {
|
|
123
|
-
this.inputElement?.nativeElement.blur();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public forceChange(): void {
|
|
127
|
-
if (this.inputElement) {
|
|
128
|
-
// this.inputElement.nativeElement.dispatchEvent(HelperService.createEvent('change', true, false));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public registerOnChange(fn: any): void {
|
|
133
|
-
this.commit = fn;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
public registerOnTouched(fn: any): void {
|
|
137
|
-
this.onTouchedCallback = fn;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
public setDisabledState(isDisabled: boolean): void {
|
|
141
|
-
this.disabled = isDisabled;
|
|
142
|
-
if (!this.destroyed) {
|
|
143
|
-
this.changeDetection.detectChanges();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
public handleChange(): void {
|
|
148
|
-
if (!this.commitOnInput) {
|
|
149
|
-
this.commit(this.value);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public commit(_value: string | null | undefined): void {}
|
|
154
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, ViewContainerRef } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
export const DIALOG_CONFIG = new InjectionToken<DialogConfig>('Default options');
|
|
4
|
-
|
|
5
|
-
export class DialogConfig<D = any> {
|
|
6
|
-
public hasBackdrop = true;
|
|
7
|
-
public backdropClass = 'modal-overlay';
|
|
8
|
-
public dialogClass = '';
|
|
9
|
-
public closeOnBackdropClick = true;
|
|
10
|
-
public closeOnEsc = true;
|
|
11
|
-
public hasScroll = false;
|
|
12
|
-
public autoFocus = true;
|
|
13
|
-
public viewContainerRef: ViewContainerRef | undefined;
|
|
14
|
-
public context: D | undefined;
|
|
15
|
-
|
|
16
|
-
constructor(config: Partial<DialogConfig>) {
|
|
17
|
-
Object.assign(this, config);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentRef, ElementRef, EmbeddedViewRef, ViewChild } from '@angular/core';
|
|
2
|
-
import { CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
3
|
-
import { DialogConfig } from './dialog-config';
|
|
4
|
-
import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'dd-dialog-container',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [CdkPortalOutlet],
|
|
10
|
-
template: '<ng-template cdkPortalOutlet></ng-template>',
|
|
11
|
-
})
|
|
12
|
-
export class DialogContainerComponent {
|
|
13
|
-
@ViewChild(CdkPortalOutlet, { static: true }) public portalOutlet: CdkPortalOutlet | undefined;
|
|
14
|
-
|
|
15
|
-
protected focusTrap: FocusTrap | undefined;
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
protected config: DialogConfig,
|
|
19
|
-
protected elementRef: ElementRef,
|
|
20
|
-
protected focusTrapFactory: FocusTrapFactory,
|
|
21
|
-
) {}
|
|
22
|
-
|
|
23
|
-
public ngOnInit(): void {
|
|
24
|
-
if (this.config.autoFocus) {
|
|
25
|
-
this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
|
|
26
|
-
// this.focusTrap.blurPreviouslyFocusedElement();
|
|
27
|
-
this.focusTrap.focusInitialElement();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T> {
|
|
32
|
-
return this.portalOutlet!.attachComponentPortal(portal);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C> {
|
|
36
|
-
return this.portalOutlet!.attachTemplatePortal(portal);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ComponentRef } from '@angular/core';
|
|
2
|
-
import { Observable, Subject } from 'rxjs';
|
|
3
|
-
import { OverlayRef } from '@angular/cdk/overlay';
|
|
4
|
-
|
|
5
|
-
export class DDDialogRef<T> {
|
|
6
|
-
public componentRef: ComponentRef<T> | undefined;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Stream of backdrop click events.
|
|
10
|
-
* */
|
|
11
|
-
public readonly onBackdropClick: Observable<MouseEvent>;
|
|
12
|
-
protected onClose$: Subject<any> = new Subject();
|
|
13
|
-
public readonly onClose: Observable<any> = this.onClose$.asObservable();
|
|
14
|
-
|
|
15
|
-
constructor(protected overlayRef: OverlayRef) {
|
|
16
|
-
this.onBackdropClick = this.overlayRef.backdropClick();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Hides dialog.
|
|
21
|
-
* */
|
|
22
|
-
public close(res?: any) {
|
|
23
|
-
this.overlayRef.detach();
|
|
24
|
-
this.overlayRef.dispose();
|
|
25
|
-
this.onClose$.next(res);
|
|
26
|
-
this.onClose$.complete();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ComponentFactoryResolver,
|
|
3
|
-
Inject,
|
|
4
|
-
Injectable,
|
|
5
|
-
Injector,
|
|
6
|
-
TemplateRef,
|
|
7
|
-
Type,
|
|
8
|
-
ViewContainerRef,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { DDDialogRef as DialogRef } from './dialog-ref';
|
|
11
|
-
import { DIALOG_CONFIG, DialogConfig } from './dialog-config';
|
|
12
|
-
import { DOCUMENT } from '@angular/common';
|
|
13
|
-
import {
|
|
14
|
-
GlobalPositionStrategy,
|
|
15
|
-
Overlay,
|
|
16
|
-
OverlayRef,
|
|
17
|
-
PositionStrategy,
|
|
18
|
-
ScrollStrategy,
|
|
19
|
-
} from '@angular/cdk/overlay';
|
|
20
|
-
import { ComponentPortal, PortalInjector, TemplatePortal } from '@angular/cdk/portal';
|
|
21
|
-
import { DialogContainerComponent } from './dialog-container.component';
|
|
22
|
-
import { fromEvent } from 'rxjs';
|
|
23
|
-
import { filter, takeUntil } from 'rxjs/operators';
|
|
24
|
-
|
|
25
|
-
@Injectable({ providedIn: 'root' })
|
|
26
|
-
export class DialogService {
|
|
27
|
-
public dialogRef: DialogRef<any> | undefined;
|
|
28
|
-
|
|
29
|
-
constructor(
|
|
30
|
-
@Inject(DOCUMENT) protected document: Document,
|
|
31
|
-
@Inject(DIALOG_CONFIG) protected globalConfig: DialogConfig,
|
|
32
|
-
protected overlay: Overlay,
|
|
33
|
-
protected injector: Injector,
|
|
34
|
-
protected cfr: ComponentFactoryResolver,
|
|
35
|
-
) {}
|
|
36
|
-
|
|
37
|
-
public open<T, R = any>(
|
|
38
|
-
content: Type<T> | TemplateRef<T>,
|
|
39
|
-
userConfig: Partial<DialogConfig<Partial<R> | string>> = {},
|
|
40
|
-
): DialogRef<T> {
|
|
41
|
-
const config = new DialogConfig({ ...this.globalConfig, ...userConfig });
|
|
42
|
-
const overlayRef = this.createOverlay(config);
|
|
43
|
-
const dialogRef = new DialogRef<T>(overlayRef);
|
|
44
|
-
this.dialogRef = dialogRef;
|
|
45
|
-
const container = this.createContainer(config, overlayRef);
|
|
46
|
-
this.createContent(config, content, container, dialogRef);
|
|
47
|
-
|
|
48
|
-
this.registerCloseListeners(config, overlayRef, dialogRef);
|
|
49
|
-
|
|
50
|
-
return dialogRef;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
protected createOverlay(config: DialogConfig): OverlayRef {
|
|
54
|
-
const positionStrategy = this.createPositionStrategy();
|
|
55
|
-
const scrollStrategy = this.createScrollStrategy(config.hasScroll);
|
|
56
|
-
|
|
57
|
-
return this.overlay.create({
|
|
58
|
-
positionStrategy,
|
|
59
|
-
scrollStrategy,
|
|
60
|
-
hasBackdrop: config.hasBackdrop,
|
|
61
|
-
backdropClass: config.backdropClass,
|
|
62
|
-
panelClass: config.dialogClass,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
protected createPositionStrategy(): PositionStrategy {
|
|
67
|
-
return new GlobalPositionStrategy().centerVertically().centerHorizontally();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
protected createScrollStrategy(hasScroll: boolean): ScrollStrategy {
|
|
71
|
-
if (hasScroll) {
|
|
72
|
-
return this.overlay.scrollStrategies.noop();
|
|
73
|
-
} else {
|
|
74
|
-
return this.overlay.scrollStrategies.block();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
protected createContainer(config: DialogConfig, overlayRef: OverlayRef): DialogContainerComponent {
|
|
79
|
-
const injector = new PortalInjector(this.createInjector(config), new WeakMap([[DialogConfig, config]]));
|
|
80
|
-
const containerPortal = new ComponentPortal(DialogContainerComponent, null, injector, this.cfr);
|
|
81
|
-
const containerRef = overlayRef.attach(containerPortal);
|
|
82
|
-
return containerRef.instance;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
protected createInjector(config: DialogConfig): Injector {
|
|
86
|
-
return (config.viewContainerRef && config.viewContainerRef.injector) || this.injector;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
protected createContent<T>(
|
|
90
|
-
config: DialogConfig,
|
|
91
|
-
content: Type<T> | TemplateRef<T>,
|
|
92
|
-
container: DialogContainerComponent,
|
|
93
|
-
dialogRef: DialogRef<T>,
|
|
94
|
-
) {
|
|
95
|
-
if (content instanceof TemplateRef) {
|
|
96
|
-
const portal = this.createTemplatePortal(config, content, dialogRef);
|
|
97
|
-
container.attachTemplatePortal(portal);
|
|
98
|
-
} else {
|
|
99
|
-
const portal = this.createComponentPortal(config, content, dialogRef);
|
|
100
|
-
dialogRef.componentRef = container.attachComponentPortal(portal);
|
|
101
|
-
|
|
102
|
-
if (config.context) {
|
|
103
|
-
Object.assign(dialogRef.componentRef.instance as any, { ...config.context });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
protected createTemplatePortal<T>(
|
|
109
|
-
config: DialogConfig,
|
|
110
|
-
content: TemplateRef<T>,
|
|
111
|
-
dialogRef: DialogRef<T>,
|
|
112
|
-
): TemplatePortal {
|
|
113
|
-
return new TemplatePortal(
|
|
114
|
-
content,
|
|
115
|
-
{} as ViewContainerRef,
|
|
116
|
-
{ $implicit: config.context, dialogRef } as any,
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
protected createComponentPortal<T>(
|
|
121
|
-
config: DialogConfig,
|
|
122
|
-
content: Type<T>,
|
|
123
|
-
dialogRef: DialogRef<T>,
|
|
124
|
-
): ComponentPortal<T> {
|
|
125
|
-
const injector = this.createInjector(config);
|
|
126
|
-
const portalInjector = new PortalInjector(injector, new WeakMap([[DialogRef, dialogRef]]));
|
|
127
|
-
return new ComponentPortal(content, config.viewContainerRef, portalInjector);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
protected registerCloseListeners<T>(config: DialogConfig, overlayRef: OverlayRef, dialogRef: DialogRef<T>) {
|
|
131
|
-
if (config.closeOnBackdropClick) {
|
|
132
|
-
overlayRef.backdropClick().subscribe(() => dialogRef.close());
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (config.closeOnEsc) {
|
|
136
|
-
fromEvent<KeyboardEvent>(this.document, 'keyup')
|
|
137
|
-
.pipe(
|
|
138
|
-
filter((event: KeyboardEvent) => event.keyCode === 27),
|
|
139
|
-
takeUntil(dialogRef.onClose),
|
|
140
|
-
)
|
|
141
|
-
.subscribe(() => dialogRef.close());
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: '[ddAutoHeight]',
|
|
5
|
-
standalone: true,
|
|
6
|
-
})
|
|
7
|
-
export class AutoHeightDirective implements OnInit {
|
|
8
|
-
// уровень до родителя
|
|
9
|
-
@Input() public ddAutoHeight: number | undefined;
|
|
10
|
-
|
|
11
|
-
constructor(private el: ElementRef, private rdr: Renderer2) {}
|
|
12
|
-
|
|
13
|
-
public ngOnInit(): void {
|
|
14
|
-
setTimeout(() => {
|
|
15
|
-
if (this.ddAutoHeight) {
|
|
16
|
-
let i = 1;
|
|
17
|
-
let parent: any;
|
|
18
|
-
while (i <= this.ddAutoHeight) {
|
|
19
|
-
parent = parent ? parent.parentNode : this.el.nativeElement.parentNode;
|
|
20
|
-
i++;
|
|
21
|
-
}
|
|
22
|
-
const height = parent.clientHeight;
|
|
23
|
-
if (height) {
|
|
24
|
-
this.rdr.setStyle(this.el.nativeElement, 'height', height + 'px');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}, 0);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, EventEmitter, HostListener, Input, Output } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
standalone: true,
|
|
5
|
-
selector: '[ddClickOutside]',
|
|
6
|
-
})
|
|
7
|
-
export class ClickOutsideDirective {
|
|
8
|
-
@Input() public elements!: string[] | undefined;
|
|
9
|
-
@Output() public ddClickOutside = new EventEmitter();
|
|
10
|
-
|
|
11
|
-
constructor(private el: ElementRef) {}
|
|
12
|
-
|
|
13
|
-
@HostListener('document:click', ['$event'])
|
|
14
|
-
public onClick(targetElement: Event) {
|
|
15
|
-
let clickedElemInside = false;
|
|
16
|
-
if (this.elements?.length) {
|
|
17
|
-
this.elements.forEach(el => {
|
|
18
|
-
if (el) {
|
|
19
|
-
const elem = document.getElementById(el) as any;
|
|
20
|
-
if (elem && !clickedElemInside) {
|
|
21
|
-
clickedElemInside = elem.contains(targetElement.target);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const clickedInside = this.el.nativeElement.contains(targetElement.target);
|
|
28
|
-
|
|
29
|
-
if (!clickedElemInside) {
|
|
30
|
-
this.ddClickOutside.emit(clickedInside);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Input, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
-
import { DecimalPipe } from '@angular/common';
|
|
3
|
-
|
|
4
|
-
@Directive({
|
|
5
|
-
selector: '[ddCounter]',
|
|
6
|
-
standalone: true,
|
|
7
|
-
})
|
|
8
|
-
export class CounterDirective implements OnChanges {
|
|
9
|
-
@Input() public ddCounter: number | undefined;
|
|
10
|
-
@Input() public needPositive = false;
|
|
11
|
-
|
|
12
|
-
constructor(private el: ElementRef) {}
|
|
13
|
-
|
|
14
|
-
public ngOnChanges(change: SimpleChanges): void {
|
|
15
|
-
this.el.nativeElement.innerHTML = 0;
|
|
16
|
-
let interval: any;
|
|
17
|
-
if (change['ddCounter']?.currentValue) {
|
|
18
|
-
/** получаем шаг для инкремента делением конечного числа на 20*/
|
|
19
|
-
let step = Math.floor(change['ddCounter'].currentValue / 20);
|
|
20
|
-
/** бывают маленькие и отрицательные числа*/
|
|
21
|
-
step = step >= 1 || step <= -1 ? step : 1;
|
|
22
|
-
let x = 0;
|
|
23
|
-
if (change['ddCounter'].currentValue > 0) {
|
|
24
|
-
interval = setInterval(() => {
|
|
25
|
-
if (x + step >= change['ddCounter'].currentValue) {
|
|
26
|
-
/** Если шаг увеличивает значение больше чем исходные число, приравниваем к исходнику и заканчиваем*/
|
|
27
|
-
const transformNumberFirst = new DecimalPipe('ru').transform(change['ddCounter'].currentValue);
|
|
28
|
-
this.el.nativeElement.innerHTML = this.needPositive
|
|
29
|
-
? '+' + transformNumberFirst
|
|
30
|
-
: transformNumberFirst;
|
|
31
|
-
clearInterval(interval);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
x += step;
|
|
35
|
-
const transformNumber = new DecimalPipe('ru').transform(x);
|
|
36
|
-
this.el.nativeElement.innerHTML = this.needPositive ? '+' + transformNumber : transformNumber;
|
|
37
|
-
}, 1);
|
|
38
|
-
} else if (change['ddCounter'].currentValue < 0) {
|
|
39
|
-
interval = setInterval(() => {
|
|
40
|
-
if (x - step <= change['ddCounter'].currentValue) {
|
|
41
|
-
this.el.nativeElement.innerHTML = new DecimalPipe('ru').transform(change['ddCounter'].currentValue);
|
|
42
|
-
clearInterval(interval);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
x += step;
|
|
46
|
-
this.el.nativeElement.innerHTML = new DecimalPipe('ru').transform(x);
|
|
47
|
-
}, 10);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
setTimeout(() => {
|
|
51
|
-
clearInterval(interval);
|
|
52
|
-
}, 4000);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Input, OnInit } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: '[ddDeclension]',
|
|
5
|
-
standalone: true,
|
|
6
|
-
})
|
|
7
|
-
export class DeclensionDirective implements OnInit {
|
|
8
|
-
@Input() public ddDeclension!: string[];
|
|
9
|
-
@Input() public count = 0;
|
|
10
|
-
@Input() public whitespace = true;
|
|
11
|
-
@Input() public needCount = true;
|
|
12
|
-
|
|
13
|
-
constructor(private el: ElementRef) {}
|
|
14
|
-
|
|
15
|
-
public ngOnInit(): void {
|
|
16
|
-
const declension = { 1: this.ddDeclension[0], 2: this.ddDeclension[1], 5: this.ddDeclension[2] };
|
|
17
|
-
let x = this.count >= 10 && this.count <= 20 ? 5 : this.count % 10;
|
|
18
|
-
if (this.count > 999) {
|
|
19
|
-
x = this.count % 100;
|
|
20
|
-
}
|
|
21
|
-
const keys: [1, 2, 5] = (Object.keys(declension).map(Number) as [1, 2, 5]).sort();
|
|
22
|
-
const text = !x
|
|
23
|
-
? `${declension[keys.pop() || 1]}`
|
|
24
|
-
: keys.reduce((result, key) => (x >= +key ? declension[key] : result), '');
|
|
25
|
-
this.el.nativeElement.innerHTML = `${this.whitespace ? ' ' : ''}${
|
|
26
|
-
this.needCount ? this.count : ''
|
|
27
|
-
} ${text}`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, HostListener, Renderer2 } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: '[ddResizeTextarea]',
|
|
5
|
-
standalone: true,
|
|
6
|
-
})
|
|
7
|
-
export class ResizeTextareaDirective {
|
|
8
|
-
constructor(private el: ElementRef, private rdr: Renderer2) {}
|
|
9
|
-
|
|
10
|
-
@HostListener('input', ['$event'])
|
|
11
|
-
public onKeyup(): void {
|
|
12
|
-
const h = this.el.nativeElement.scrollHeight;
|
|
13
|
-
this.rdr.setStyle(this.el.nativeElement, 'max-height', h + 'px');
|
|
14
|
-
this.rdr.setStyle(this.el.nativeElement, 'height', h + 'px');
|
|
15
|
-
}
|
|
16
|
-
}
|