coer-elements 0.0.22 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/components/index.d.ts +5 -16
- package/components/lib/coer-button/coer-button.component.d.ts +3 -3
- package/components/lib/coer-checkbox/coer-checkbox.component.d.ts +1 -1
- package/components/lib/coer-filebox/coer-filebox.component.d.ts +3 -3
- package/components/lib/coer-grid/coer-grid.component.d.ts +1 -1
- package/components/lib/coer-grid/coer-grid.extension.d.ts +3 -5
- package/components/lib/coer-grid/coer-grid.templates.d.ts +1 -1
- package/components/lib/coer-modal/coer-modal.component.d.ts +2 -2
- package/components/lib/coer-numberbox/coer-numberbox.component.d.ts +1 -2
- package/components/lib/coer-page-title/coer-page-title.component.d.ts +1 -1
- package/components/lib/coer-selectbox/coer-selectbox.component.d.ts +1 -1
- package/components/lib/coer-switch/coer-switch.component.d.ts +1 -1
- package/components/lib/coer-tab/coer-tab.component.d.ts +1 -1
- package/components/lib/coer-textarea/coer-textarea.component.d.ts +1 -1
- package/components/lib/coer-textbox/coer-textbox.component.d.ts +1 -1
- package/components/lib/components.module.d.ts +25 -26
- package/components/public-api.d.ts +15 -0
- package/directives/index.d.ts +5 -3
- package/directives/public-api.d.ts +3 -0
- package/esm2022/coer-elements.mjs +2 -2
- package/esm2022/components/coer-elements-components.mjs +5 -0
- package/esm2022/components/lib/coer-button/coer-button.component.mjs +2 -2
- package/esm2022/components/lib/coer-checkbox/coer-checkbox.component.mjs +2 -3
- package/esm2022/components/lib/coer-filebox/coer-filebox.component.mjs +3 -5
- package/esm2022/components/lib/coer-form/coer-form.component.mjs +2 -3
- package/esm2022/components/lib/coer-grid/coer-grid.component.mjs +4 -7
- package/esm2022/components/lib/coer-grid/coer-grid.extension.mjs +2 -6
- package/esm2022/components/lib/coer-grid/coer-grid.templates.mjs +1 -1
- package/esm2022/components/lib/coer-modal/coer-modal.component.mjs +4 -5
- package/esm2022/components/lib/coer-numberbox/coer-numberbox.component.mjs +2 -4
- package/esm2022/components/lib/coer-page-title/coer-page-title.component.mjs +2 -2
- package/esm2022/components/lib/coer-selectbox/coer-selectbox.component.mjs +2 -3
- package/esm2022/components/lib/coer-switch/coer-switch.component.mjs +2 -3
- package/esm2022/components/lib/coer-tab/coer-tab.component.mjs +4 -4
- package/esm2022/components/lib/coer-textarea/coer-textarea.component.mjs +2 -3
- package/esm2022/components/lib/coer-textbox/coer-textbox.component.mjs +2 -3
- package/esm2022/components/lib/components.module.mjs +10 -15
- package/esm2022/components/public-api.mjs +16 -0
- package/esm2022/directives/coer-elements-directives.mjs +5 -0
- package/esm2022/directives/lib/coer-ref.directive.mjs +1 -1
- package/esm2022/directives/lib/directives.module.mjs +1 -1
- package/esm2022/directives/lib/life-cycle.directive.mjs +1 -1
- package/esm2022/directives/public-api.mjs +4 -0
- package/esm2022/index.mjs +2 -0
- package/esm2022/interfaces/coer-elements-interfaces.mjs +5 -0
- package/esm2022/interfaces/lib/app-source.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-filebox/file-image.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-filebox/file.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-button-by-row.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-checkbox.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-coer-numberbox.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-coer-selectbox.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-coer-switch.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-coer-textbox.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-column.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-data-source.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-header-button.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-header-export-button.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-header.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-import.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-input-checkbox.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-input-switch-change.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-input-textbox.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-item.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-keyup-enter.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-length.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-search.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-grid/grid-sort.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-menu/menu-option-selected.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-menu/menu-selected.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-menu/menu.interface.mjs +1 -1
- package/esm2022/interfaces/lib/coer-ref.interface.mjs +1 -1
- package/esm2022/interfaces/lib/page-title/breadcrumb.interface.mjs +1 -1
- package/esm2022/interfaces/lib/page-title/go-back.interface.mjs +1 -1
- package/esm2022/interfaces/lib/screen-size.interface.mjs +1 -1
- package/esm2022/interfaces/lib/service/http-request.interface.mjs +1 -1
- package/esm2022/interfaces/lib/service/http-response.interface.mjs +1 -1
- package/esm2022/interfaces/lib/service/patch.interface.mjs +1 -1
- package/esm2022/interfaces/public-api.mjs +39 -0
- package/esm2022/pipes/coer-elements-pipes.mjs +5 -0
- package/esm2022/pipes/lib/html.pipe.mjs +1 -1
- package/esm2022/pipes/lib/no-image.pipe.mjs +3 -3
- package/esm2022/pipes/lib/numeric-format.pipe.mjs +2 -2
- package/esm2022/pipes/lib/pipes.module.mjs +1 -1
- package/esm2022/pipes/public-api.mjs +5 -0
- package/esm2022/signals/coer-elements-signals.mjs +5 -0
- package/esm2022/signals/lib/breakpoint.signal.mjs +2 -2
- package/esm2022/signals/lib/is-loading.signal.mjs +1 -1
- package/esm2022/signals/lib/is-menu-open.signal.mjs +1 -1
- package/esm2022/signals/lib/is-modal-open.signal.mjs +1 -1
- package/esm2022/signals/lib/menu.signal.mjs +1 -1
- package/esm2022/signals/public-api.mjs +6 -0
- package/esm2022/tools/coer-elements-tools.mjs +5 -0
- package/esm2022/tools/lib/breadcrumbs.class.mjs +1 -1
- package/esm2022/tools/lib/coer-alert/coer-alert.component.mjs +228 -0
- package/esm2022/tools/lib/control-value.class.mjs +1 -1
- package/esm2022/tools/lib/date-time.class.mjs +1 -1
- package/esm2022/tools/lib/files.class.mjs +1 -1
- package/esm2022/tools/lib/menu.class.mjs +1 -1
- package/esm2022/tools/lib/page.class.mjs +4 -4
- package/esm2022/tools/lib/screen.class.mjs +1 -1
- package/esm2022/tools/lib/service.class.mjs +24 -25
- package/esm2022/tools/lib/source.class.mjs +3 -3
- package/esm2022/tools/lib/tools.mjs +1 -1
- package/esm2022/tools/public-api.mjs +12 -0
- package/fesm2022/coer-elements-components.mjs +2718 -0
- package/fesm2022/coer-elements-components.mjs.map +1 -0
- package/fesm2022/coer-elements-directives.mjs +82 -0
- package/fesm2022/coer-elements-directives.mjs.map +1 -0
- package/fesm2022/coer-elements-interfaces.mjs +6 -0
- package/fesm2022/coer-elements-interfaces.mjs.map +1 -0
- package/fesm2022/coer-elements-pipes.mjs +83 -0
- package/fesm2022/coer-elements-pipes.mjs.map +1 -0
- package/fesm2022/coer-elements-signals.mjs +19 -0
- package/fesm2022/coer-elements-signals.mjs.map +1 -0
- package/fesm2022/coer-elements-tools.mjs +1223 -0
- package/fesm2022/coer-elements-tools.mjs.map +1 -0
- package/fesm2022/coer-elements.mjs +0 -4081
- package/fesm2022/coer-elements.mjs.map +1 -1
- package/index.d.ts +1 -5
- package/interfaces/index.d.ts +5 -33
- package/interfaces/public-api.d.ts +33 -0
- package/package.json +37 -1
- package/pipes/index.d.ts +5 -4
- package/pipes/public-api.d.ts +4 -0
- package/signals/index.d.ts +5 -5
- package/signals/lib/menu.signal.d.ts +1 -1
- package/signals/public-api.d.ts +5 -0
- package/styles/angular-material.scss +8 -11
- package/styles/bootstrap.scss +3 -3
- package/tools/index.d.ts +5 -10
- package/tools/lib/breadcrumbs.class.d.ts +1 -1
- package/tools/lib/menu.class.d.ts +1 -1
- package/tools/lib/page.class.d.ts +2 -2
- package/tools/lib/screen.class.d.ts +1 -1
- package/tools/lib/service.class.d.ts +2 -2
- package/tools/lib/source.class.d.ts +1 -1
- package/tools/public-api.d.ts +11 -0
- package/esm2022/components/index.mjs +0 -17
- package/esm2022/components/lib/coer-alert/coer-alert.component.mjs +0 -227
- package/esm2022/directives/index.mjs +0 -4
- package/esm2022/interfaces/index.mjs +0 -39
- package/esm2022/pipes/index.mjs +0 -5
- package/esm2022/public_api.mjs +0 -6
- package/esm2022/signals/index.mjs +0 -6
- package/esm2022/tools/index.mjs +0 -11
- package/public_api.d.ts +0 -5
- /package/{components → tools}/lib/coer-alert/coer-alert.component.d.ts +0 -0
@@ -0,0 +1,2718 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { input, EventEmitter, computed, Component, Input, Output, output, ContentChildren, inject, viewChild, signal, viewChildren, ViewChild, NgModule } from '@angular/core';
|
3
|
+
import * as i1 from '@angular/common';
|
4
|
+
import { CommonModule } from '@angular/common';
|
5
|
+
import * as i2 from '@angular/router';
|
6
|
+
import { RouterModule } from '@angular/router';
|
7
|
+
import * as i2$1 from '@angular/forms';
|
8
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
9
|
+
import * as i3$3 from 'coer-elements/directives';
|
10
|
+
import { CoerRefDirective, DirectivesModule } from 'coer-elements/directives';
|
11
|
+
import * as i9 from 'coer-elements/pipes';
|
12
|
+
import { PipesModule } from 'coer-elements/pipes';
|
13
|
+
import * as i3 from '@angular/material/button';
|
14
|
+
import { MatButtonModule } from '@angular/material/button';
|
15
|
+
import * as i3$1 from '@angular/material/checkbox';
|
16
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
17
|
+
import * as i2$2 from '@angular/material/input';
|
18
|
+
import { MatInputModule } from '@angular/material/input';
|
19
|
+
import * as i3$2 from '@angular/material/form-field';
|
20
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
21
|
+
import * as i2$3 from '@angular/material/slide-toggle';
|
22
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
23
|
+
import * as i2$4 from '@angular/material/tabs';
|
24
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
25
|
+
import { Tools, ControlValue, CONTROL_VALUE, Screen, CoerAlert, Files, DateTime, Menu } from 'coer-elements/tools';
|
26
|
+
import { Tooltip, Modal } from 'bootstrap';
|
27
|
+
import { isModalOpenSIGNAL } from 'coer-elements/signals';
|
28
|
+
|
29
|
+
class CoerButton {
|
30
|
+
constructor() {
|
31
|
+
//Variables
|
32
|
+
this._id = Tools.GetGuid('coer-button');
|
33
|
+
this._tooltip = '';
|
34
|
+
//Inputs
|
35
|
+
this.id = '';
|
36
|
+
this.color = input('default');
|
37
|
+
this.type = input('filled');
|
38
|
+
this.icon = input('');
|
39
|
+
this.iconPosition = input('left');
|
40
|
+
this.animation = input(false);
|
41
|
+
this.isLoading = input(false);
|
42
|
+
this.isDisabled = input(false);
|
43
|
+
this.isInvisible = input(false);
|
44
|
+
this.width = input('125px');
|
45
|
+
this.minWidth = input('30px');
|
46
|
+
this.height = input('40px');
|
47
|
+
this.minHeight = input('30px');
|
48
|
+
this.marginTop = input('0px');
|
49
|
+
this.marginRight = input('0px');
|
50
|
+
this.marginBottom = input('0px');
|
51
|
+
this.marginLeft = input('0px');
|
52
|
+
this.path = input([]);
|
53
|
+
this.tooltipPosition = input('left');
|
54
|
+
//Outputs
|
55
|
+
this.onClick = new EventEmitter();
|
56
|
+
//computed
|
57
|
+
this._isEnable = computed(() => {
|
58
|
+
return !this.isLoading() && !this.isDisabled() && !this.isInvisible();
|
59
|
+
});
|
60
|
+
//computed
|
61
|
+
this._icon = computed(() => {
|
62
|
+
switch (this.icon()) {
|
63
|
+
case 'new': return 'fa-solid fa-plus fa-lg';
|
64
|
+
case 'save': return 'fa-solid fa-floppy-disk fa-lg';
|
65
|
+
case 'cancel': return 'fa-solid fa-xmark fa-lg';
|
66
|
+
case 'import': return 'fa-solid fa-file-arrow-up fa-lg';
|
67
|
+
case 'excel': return 'bi bi-filetype-xlsx fa-lg';
|
68
|
+
case 'menu': return 'fa-solid fa-bars';
|
69
|
+
case 'delete': return 'fa-solid fa-trash-can';
|
70
|
+
case 'edit': return 'fa-solid fa-pen fa-lg';
|
71
|
+
case 'go': return 'bi bi-box-arrow-right';
|
72
|
+
case 'back': return 'bi bi-box-arrow-left';
|
73
|
+
default: return '';
|
74
|
+
}
|
75
|
+
});
|
76
|
+
}
|
77
|
+
set tooltip(value) {
|
78
|
+
this._tooltip = value;
|
79
|
+
if (value && this._tooltipElement) {
|
80
|
+
this._tooltipElement.setContent({ '.tooltip-inner': this._tooltip });
|
81
|
+
}
|
82
|
+
}
|
83
|
+
ngOnInit() {
|
84
|
+
this.SetToolTip();
|
85
|
+
this.SetEvents();
|
86
|
+
}
|
87
|
+
ngOnDestroy() {
|
88
|
+
if (this._tooltipElement) {
|
89
|
+
Tools.Sleep().then(() => this._tooltipElement.dispose());
|
90
|
+
}
|
91
|
+
}
|
92
|
+
/** */
|
93
|
+
SetEvents() {
|
94
|
+
Tools.Sleep().then(() => {
|
95
|
+
this._element = document.getElementById(`${this._id}-inner-button`);
|
96
|
+
if (Tools.IsNotNull(this._element)) {
|
97
|
+
this._element.addEventListener('focus', () => {
|
98
|
+
if (!this._isEnable())
|
99
|
+
this.Blur();
|
100
|
+
});
|
101
|
+
}
|
102
|
+
});
|
103
|
+
}
|
104
|
+
SetToolTip() {
|
105
|
+
Tools.Sleep().then(() => {
|
106
|
+
const htmlElement = document.getElementById(`${this._id}-container`);
|
107
|
+
if (Tools.IsNotNull(htmlElement)) {
|
108
|
+
htmlElement.addEventListener('mouseleave', () => {
|
109
|
+
if (Tools.IsNotNull(htmlElement) && Tools.IsNotNull(this._tooltipElement)) {
|
110
|
+
this._tooltipElement.hide();
|
111
|
+
}
|
112
|
+
});
|
113
|
+
this._tooltipElement = new Tooltip(htmlElement, {
|
114
|
+
html: true,
|
115
|
+
title: this._tooltip,
|
116
|
+
placement: this.tooltipPosition
|
117
|
+
});
|
118
|
+
}
|
119
|
+
});
|
120
|
+
}
|
121
|
+
/** */
|
122
|
+
Click(event) {
|
123
|
+
if (this._isEnable()) {
|
124
|
+
this.onClick.emit(event);
|
125
|
+
}
|
126
|
+
this.Blur();
|
127
|
+
}
|
128
|
+
/** */
|
129
|
+
Focus(timeout = 0) {
|
130
|
+
Tools.Sleep(timeout).then(() => {
|
131
|
+
if (this._isEnable())
|
132
|
+
this._element.focus();
|
133
|
+
});
|
134
|
+
}
|
135
|
+
/** */
|
136
|
+
Blur() {
|
137
|
+
Tools.Sleep().then(() => {
|
138
|
+
this._element.blur();
|
139
|
+
});
|
140
|
+
}
|
141
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
142
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerButton, selector: "coer-button", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconPosition: { classPropertyName: "iconPosition", publicName: "iconPosition", isSignal: true, isRequired: false, transformFunction: null }, animation: { classPropertyName: "animation", publicName: "animation", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isInvisible: { classPropertyName: "isInvisible", publicName: "isInvisible", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, marginTop: { classPropertyName: "marginTop", publicName: "marginTop", isSignal: true, isRequired: false, transformFunction: null }, marginRight: { classPropertyName: "marginRight", publicName: "marginRight", isSignal: true, isRequired: false, transformFunction: null }, marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, marginLeft: { classPropertyName: "marginLeft", publicName: "marginLeft", isSignal: true, isRequired: false, transformFunction: null }, path: { classPropertyName: "path", publicName: "path", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onClick: "onClick" }, ngImport: i0, template: "<div [ngClass]=\"{ 'coer-button': true, 'invisible': isInvisible() }\">\r\n <a [id]=\"_id + '-container'\"\r\n [routerLink]=\"(path().length > 0 && _isEnable()) ? path() : null\"\r\n [ngClass]=\"{ 'loading': isLoading(), 'animate__animated animate__zoomIn': true, 'animate__disabled': !animation() }\"\r\n [ngStyle]=\"{ 'margin-top': marginTop(), 'margin-right': marginRight(), 'margin-bottom': marginBottom(), 'margin-left': marginLeft() }\">\r\n @if(type() =='filled' || type() == 'outline') {\r\n <button mat-button\r\n [id]=\"_id + '-inner-button'\"\r\n type=\"button\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-filled': (color() == 'primary' && type() =='filled'),\r\n 'secondary-filled': (color() == 'secondary' && type() =='filled'),\r\n 'success-filled': (color() == 'success' && type() =='filled'),\r\n 'warning-filled': (color() == 'warning' && type() =='filled'),\r\n 'danger-filled': (color() == 'danger' && type() =='filled'),\r\n 'navigation-filled': (color() == 'navigation' && type() =='filled'),\r\n 'primary-outline': (color() == 'primary' && type() =='outline'),\r\n 'secondary-outline': (color() == 'secondary' && type() =='outline'),\r\n 'success-outline': (color() == 'success' && type() =='outline'),\r\n 'warning-outline': (color() == 'warning' && type() =='outline'),\r\n 'danger-outline': (color() == 'danger' && type() =='outline'),\r\n 'navigation-outline': (color() == 'navigation'),\r\n 'readonly': isDisabled(),\r\n 'cursor-wait': isLoading()\r\n }\"\r\n [ngStyle]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'height': height(),\r\n 'min-height': minHeight()\r\n }\">\r\n <span class=\"slot\" *ngIf=\"!isLoading(); else loading\" >\r\n <span *ngIf=\"(iconPosition() == 'left')\">\r\n <i [class]=\"_icon()\"></i>\r\n </span>\r\n\r\n <span [ngClass]=\"{ 'ms-2': (iconPosition() == 'left'), 'me-2': (iconPosition() == 'right') }\">\r\n <ng-content></ng-content>\r\n </span>\r\n\r\n <span *ngIf=\"(iconPosition() == 'right')\">\r\n <i [class]=\"_icon()\"></i>\r\n </span>\r\n </span>\r\n\r\n <ng-template #loading>\r\n <span class=\"slot fa-fade\">\r\n <span class=\"me-2\"> Loading </span>\r\n <i class=\"spinner-border\"></i>\r\n </span>\r\n </ng-template>\r\n </button>\r\n }\r\n\r\n @else {\r\n @if (type() == 'icon') {\r\n <button mat-icon-button\r\n [id]=\"_id + '-inner-button'\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-filled': (color() == 'primary'),\r\n 'secondary-filled': (color() == 'secondary'),\r\n 'success-filled': (color() == 'success'),\r\n 'warning-filled': (color() == 'warning'),\r\n 'danger-filled': (color() == 'danger'),\r\n 'navigation-filled': (color() == 'navigation'),\r\n 'readonly': (isDisabled() || isLoading()),\r\n 'cursor-wait': isLoading()\r\n }\">\r\n <i [class]=\"_icon()\"></i>\r\n </button>\r\n }\r\n\r\n @else if (type() == 'icon-outline') {\r\n <button mat-icon-button\r\n [id]=\"_id + '-inner-button'\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-outline': (color() == 'primary'),\r\n 'secondary-outline': (color() == 'secondary'),\r\n 'success-outline': (color() == 'success'),\r\n 'warning-outline': (color() == 'warning'),\r\n 'danger-outline': (color() == 'danger'),\r\n 'navigation-outline': (color() == 'navigation'),\r\n 'readonly': (isDisabled() || isLoading()),\r\n 'cursor-wait': isLoading()\r\n }\">\r\n <i [class]=\"_icon()\"></i>\r\n </button>\r\n }\r\n\r\n @else if (type() == 'icon-no-border') {\r\n <button mat-icon-button\r\n [id]=\"_id + '-inner-button'\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-outline': (color() == 'primary'),\r\n 'secondary-outline': (color() == 'secondary'),\r\n 'success-outline': (color() == 'success'),\r\n 'warning-outline': (color() == 'warning'),\r\n 'danger-outline': (color() == 'danger'),\r\n 'navigation-outline': (color() == 'navigation'),\r\n 'readonly': (isDisabled() || isLoading()),\r\n 'icon-no-border': true\r\n }\">\r\n <i [class]=\"_icon()\"></i>\r\n </button>\r\n }\r\n }\r\n </a>\r\n</div>", styles: ["*{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}.text-blue{color:#0d6efd!important}.text-blue-bold{color:#0d6efd!important;font-weight:700!important}.background-blue{background-color:#0d6efd!important}.background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}.border-blue{border-color:#0d6efd!important}.text-gray{color:#6c757d!important}.text-gray-bold{color:#6c757d!important;font-weight:700!important}.background-gray{background-color:#6c757d!important}.background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}.border-gray{border-color:#6c757d!important}.text-green{color:#198754!important}.text-green-bold{color:#198754!important;font-weight:700!important}.background-green{background-color:#198754!important}.background-border-green{background-color:#198754!important;border-color:#198754!important}.border-green{border-color:#198754!important}.text-yellow{color:#ffc107!important}.text-yellow-bold{color:#ffc107!important;font-weight:700!important}.background-yellow{background-color:#ffc107!important}.background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}.border-yellow{border-color:#ffc107!important}.text-red{color:#dc3545!important}.text-red-bold{color:#dc3545!important;font-weight:700!important}.background-red{background-color:#dc3545!important}.background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}.border-red{border-color:#dc3545!important}.text-white{color:#f5f5f5!important}.text-white-bold{color:#f5f5f5!important;font-weight:700!important}.background-white{background-color:#f5f5f5!important}.background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}.border-white{border-color:#f5f5f5!important}.text-black{color:#252525!important}.text-black-bold{color:#252525!important;font-weight:700!important}.background-black{background-color:#252525!important}.background-border-black{background-color:#252525!important;border-color:#252525!important}.border-black{border-color:#252525!important}.text-orange{color:#fd6031!important}.text-orange-bold{color:#fd6031!important;font-weight:700!important}.background-orange{background-color:#fd6031!important}.background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}.border-orange{border-color:#fd6031!important}coer-button{display:contents!important}div.coer-button{display:contents!important}div.coer-button a{display:inline-block!important}div.coer-button a.animate__disabled{animation-duration:0s!important}div.coer-button button{font-size:17px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}div.coer-button .slot{width:100px!important;display:flex!important;align-items:center!important;justify-content:center!important;text-overflow:ellipsis!important;overflow:hidden!important}div.coer-button button.primary-filled{background-color:#0d6efd!important;color:#f5f5f5!important}div.coer-button button.secondary-filled{background-color:#6c757d!important;color:#f5f5f5!important}div.coer-button button.success-filled{background-color:#198754!important;color:#f5f5f5!important}div.coer-button button.warning-filled{background-color:#ffc107!important;color:#252525!important}div.coer-button button.danger-filled{background-color:#dc3545!important;color:#f5f5f5!important}div.coer-button button.navigation-filled{background-color:#fd6031!important;color:#f5f5f5!important}div.coer-button button.primary-outline{background-color:#fff!important;border:1px solid #0d6efd!important;color:#0d6efd!important}div.coer-button button.secondary-outline{background-color:#fff!important;border:1px solid #6c757d!important;color:#6c757d!important}div.coer-button button.success-outline{background-color:#fff!important;border:1px solid #198754!important;color:#198754!important}div.coer-button button.warning-outline{background-color:#fff!important;border:1px solid #ffc107!important;color:#ffc107!important}div.coer-button button.danger-outline{background-color:#fff!important;border:1px solid #dc3545!important;color:#dc3545!important}div.coer-button button.navigation-outline{background-color:#fff!important;border:1px solid #fd6031!important;color:#fd6031!important}div.coer-button button.primary-filled:not(.readonly):hover,div.coer-button button.primary-filled:not(.readonly):focus,div.coer-button button.primary-outline:not(.readonly):hover,div.coer-button button.primary-outline:not(.readonly):focus,div.coer-button button.secondary-filled:not(.readonly):hover,div.coer-button button.secondary-filled:not(.readonly):focus,div.coer-button button.secondary-outline:not(.readonly):hover,div.coer-button button.secondary-outline:not(.readonly):focus,div.coer-button button.success-filled:not(.readonly):hover,div.coer-button button.success-filled:not(.readonly):focus,div.coer-button button.success-outline:not(.readonly):hover,div.coer-button button.success-outline:not(.readonly):focus,div.coer-button button.warning-filled:not(.readonly):hover,div.coer-button button.warning-filled:not(.readonly):focus,div.coer-button button.warning-outline:not(.readonly):hover,div.coer-button button.warning-outline:not(.readonly):focus,div.coer-button button.danger-filled:not(.readonly):hover,div.coer-button button.danger-filled:not(.readonly):focus,div.coer-button button.danger-outline:not(.readonly):hover,div.coer-button button.danger-outline:not(.readonly):focus{filter:brightness(1.1)!important}div.coer-button button.primary-filled:not(.readonly):focus,div.coer-button button.primary-outline:not(.readonly):focus{box-shadow:0 0 20px #0d6efd!important}div.coer-button button.secondary-filled:not(.readonly):focus,div.coer-button button.secondary-outline:not(.readonly):focus{box-shadow:0 0 20px #6c757d!important}div.coer-button button.success-filled:not(.readonly):focus,div.coer-button button.success-outline:not(.readonly):focus{box-shadow:0 0 20px #198754!important}div.coer-button button.warning-filled:not(.readonly):focus,div.coer-button button.warning-outline:not(.readonly):focus{box-shadow:0 0 20px #ffc107!important}div.coer-button button.danger-filled:not(.readonly):focus,div.coer-button button.danger-outline:not(.readonly):focus{box-shadow:0 0 20px #dc3545!important}div.coer-button button.navigation-filled:not(.readonly):focus,div.coer-button button.navigation-outline:not(.readonly):focus{box-shadow:0 0 20px #fd6031!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button{width:40px!important;height:40px!important;padding:0!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border{width:25px!important;height:25px!important;background-color:transparent!important;border:none!important;overflow:visible!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border *{font-size:medium!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border i.bi-box-arrow-left,div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border i.bi-box-arrow-in-right{font-size:20px!important}div.coer-button button.readonly,div.coer-button button.readonly:hover,div.coer-button button.readonly:focus{background-color:#dfdede!important;border-color:#dfdede!important;color:#fff!important}div.coer-button coer-button[ishidden=true],div.coer-button coer-button[ng-reflect-invisible=true]{position:relative!important;top:10000vh;left:10000vw}div.coer-button a.loading{cursor:wait!important}div.coer-button i{vertical-align:middle!important}div.coer-button i.spinner-border{width:15px!important;height:15px!important;font-size:16px!important}div.coer-button span{font-weight:700!important}div#coer-tool-bar coer-button *{color:#fd6031!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
|
143
|
+
}
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerButton, decorators: [{
|
145
|
+
type: Component,
|
146
|
+
args: [{ selector: 'coer-button', template: "<div [ngClass]=\"{ 'coer-button': true, 'invisible': isInvisible() }\">\r\n <a [id]=\"_id + '-container'\"\r\n [routerLink]=\"(path().length > 0 && _isEnable()) ? path() : null\"\r\n [ngClass]=\"{ 'loading': isLoading(), 'animate__animated animate__zoomIn': true, 'animate__disabled': !animation() }\"\r\n [ngStyle]=\"{ 'margin-top': marginTop(), 'margin-right': marginRight(), 'margin-bottom': marginBottom(), 'margin-left': marginLeft() }\">\r\n @if(type() =='filled' || type() == 'outline') {\r\n <button mat-button\r\n [id]=\"_id + '-inner-button'\"\r\n type=\"button\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-filled': (color() == 'primary' && type() =='filled'),\r\n 'secondary-filled': (color() == 'secondary' && type() =='filled'),\r\n 'success-filled': (color() == 'success' && type() =='filled'),\r\n 'warning-filled': (color() == 'warning' && type() =='filled'),\r\n 'danger-filled': (color() == 'danger' && type() =='filled'),\r\n 'navigation-filled': (color() == 'navigation' && type() =='filled'),\r\n 'primary-outline': (color() == 'primary' && type() =='outline'),\r\n 'secondary-outline': (color() == 'secondary' && type() =='outline'),\r\n 'success-outline': (color() == 'success' && type() =='outline'),\r\n 'warning-outline': (color() == 'warning' && type() =='outline'),\r\n 'danger-outline': (color() == 'danger' && type() =='outline'),\r\n 'navigation-outline': (color() == 'navigation'),\r\n 'readonly': isDisabled(),\r\n 'cursor-wait': isLoading()\r\n }\"\r\n [ngStyle]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'height': height(),\r\n 'min-height': minHeight()\r\n }\">\r\n <span class=\"slot\" *ngIf=\"!isLoading(); else loading\" >\r\n <span *ngIf=\"(iconPosition() == 'left')\">\r\n <i [class]=\"_icon()\"></i>\r\n </span>\r\n\r\n <span [ngClass]=\"{ 'ms-2': (iconPosition() == 'left'), 'me-2': (iconPosition() == 'right') }\">\r\n <ng-content></ng-content>\r\n </span>\r\n\r\n <span *ngIf=\"(iconPosition() == 'right')\">\r\n <i [class]=\"_icon()\"></i>\r\n </span>\r\n </span>\r\n\r\n <ng-template #loading>\r\n <span class=\"slot fa-fade\">\r\n <span class=\"me-2\"> Loading </span>\r\n <i class=\"spinner-border\"></i>\r\n </span>\r\n </ng-template>\r\n </button>\r\n }\r\n\r\n @else {\r\n @if (type() == 'icon') {\r\n <button mat-icon-button\r\n [id]=\"_id + '-inner-button'\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-filled': (color() == 'primary'),\r\n 'secondary-filled': (color() == 'secondary'),\r\n 'success-filled': (color() == 'success'),\r\n 'warning-filled': (color() == 'warning'),\r\n 'danger-filled': (color() == 'danger'),\r\n 'navigation-filled': (color() == 'navigation'),\r\n 'readonly': (isDisabled() || isLoading()),\r\n 'cursor-wait': isLoading()\r\n }\">\r\n <i [class]=\"_icon()\"></i>\r\n </button>\r\n }\r\n\r\n @else if (type() == 'icon-outline') {\r\n <button mat-icon-button\r\n [id]=\"_id + '-inner-button'\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-outline': (color() == 'primary'),\r\n 'secondary-outline': (color() == 'secondary'),\r\n 'success-outline': (color() == 'success'),\r\n 'warning-outline': (color() == 'warning'),\r\n 'danger-outline': (color() == 'danger'),\r\n 'navigation-outline': (color() == 'navigation'),\r\n 'readonly': (isDisabled() || isLoading()),\r\n 'cursor-wait': isLoading()\r\n }\">\r\n <i [class]=\"_icon()\"></i>\r\n </button>\r\n }\r\n\r\n @else if (type() == 'icon-no-border') {\r\n <button mat-icon-button\r\n [id]=\"_id + '-inner-button'\"\r\n (click)=\"Click($event)\"\r\n [ngClass]=\"{\r\n 'primary-outline': (color() == 'primary'),\r\n 'secondary-outline': (color() == 'secondary'),\r\n 'success-outline': (color() == 'success'),\r\n 'warning-outline': (color() == 'warning'),\r\n 'danger-outline': (color() == 'danger'),\r\n 'navigation-outline': (color() == 'navigation'),\r\n 'readonly': (isDisabled() || isLoading()),\r\n 'icon-no-border': true\r\n }\">\r\n <i [class]=\"_icon()\"></i>\r\n </button>\r\n }\r\n }\r\n </a>\r\n</div>", styles: ["*{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}.text-blue{color:#0d6efd!important}.text-blue-bold{color:#0d6efd!important;font-weight:700!important}.background-blue{background-color:#0d6efd!important}.background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}.border-blue{border-color:#0d6efd!important}.text-gray{color:#6c757d!important}.text-gray-bold{color:#6c757d!important;font-weight:700!important}.background-gray{background-color:#6c757d!important}.background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}.border-gray{border-color:#6c757d!important}.text-green{color:#198754!important}.text-green-bold{color:#198754!important;font-weight:700!important}.background-green{background-color:#198754!important}.background-border-green{background-color:#198754!important;border-color:#198754!important}.border-green{border-color:#198754!important}.text-yellow{color:#ffc107!important}.text-yellow-bold{color:#ffc107!important;font-weight:700!important}.background-yellow{background-color:#ffc107!important}.background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}.border-yellow{border-color:#ffc107!important}.text-red{color:#dc3545!important}.text-red-bold{color:#dc3545!important;font-weight:700!important}.background-red{background-color:#dc3545!important}.background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}.border-red{border-color:#dc3545!important}.text-white{color:#f5f5f5!important}.text-white-bold{color:#f5f5f5!important;font-weight:700!important}.background-white{background-color:#f5f5f5!important}.background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}.border-white{border-color:#f5f5f5!important}.text-black{color:#252525!important}.text-black-bold{color:#252525!important;font-weight:700!important}.background-black{background-color:#252525!important}.background-border-black{background-color:#252525!important;border-color:#252525!important}.border-black{border-color:#252525!important}.text-orange{color:#fd6031!important}.text-orange-bold{color:#fd6031!important;font-weight:700!important}.background-orange{background-color:#fd6031!important}.background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}.border-orange{border-color:#fd6031!important}coer-button{display:contents!important}div.coer-button{display:contents!important}div.coer-button a{display:inline-block!important}div.coer-button a.animate__disabled{animation-duration:0s!important}div.coer-button button{font-size:17px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}div.coer-button .slot{width:100px!important;display:flex!important;align-items:center!important;justify-content:center!important;text-overflow:ellipsis!important;overflow:hidden!important}div.coer-button button.primary-filled{background-color:#0d6efd!important;color:#f5f5f5!important}div.coer-button button.secondary-filled{background-color:#6c757d!important;color:#f5f5f5!important}div.coer-button button.success-filled{background-color:#198754!important;color:#f5f5f5!important}div.coer-button button.warning-filled{background-color:#ffc107!important;color:#252525!important}div.coer-button button.danger-filled{background-color:#dc3545!important;color:#f5f5f5!important}div.coer-button button.navigation-filled{background-color:#fd6031!important;color:#f5f5f5!important}div.coer-button button.primary-outline{background-color:#fff!important;border:1px solid #0d6efd!important;color:#0d6efd!important}div.coer-button button.secondary-outline{background-color:#fff!important;border:1px solid #6c757d!important;color:#6c757d!important}div.coer-button button.success-outline{background-color:#fff!important;border:1px solid #198754!important;color:#198754!important}div.coer-button button.warning-outline{background-color:#fff!important;border:1px solid #ffc107!important;color:#ffc107!important}div.coer-button button.danger-outline{background-color:#fff!important;border:1px solid #dc3545!important;color:#dc3545!important}div.coer-button button.navigation-outline{background-color:#fff!important;border:1px solid #fd6031!important;color:#fd6031!important}div.coer-button button.primary-filled:not(.readonly):hover,div.coer-button button.primary-filled:not(.readonly):focus,div.coer-button button.primary-outline:not(.readonly):hover,div.coer-button button.primary-outline:not(.readonly):focus,div.coer-button button.secondary-filled:not(.readonly):hover,div.coer-button button.secondary-filled:not(.readonly):focus,div.coer-button button.secondary-outline:not(.readonly):hover,div.coer-button button.secondary-outline:not(.readonly):focus,div.coer-button button.success-filled:not(.readonly):hover,div.coer-button button.success-filled:not(.readonly):focus,div.coer-button button.success-outline:not(.readonly):hover,div.coer-button button.success-outline:not(.readonly):focus,div.coer-button button.warning-filled:not(.readonly):hover,div.coer-button button.warning-filled:not(.readonly):focus,div.coer-button button.warning-outline:not(.readonly):hover,div.coer-button button.warning-outline:not(.readonly):focus,div.coer-button button.danger-filled:not(.readonly):hover,div.coer-button button.danger-filled:not(.readonly):focus,div.coer-button button.danger-outline:not(.readonly):hover,div.coer-button button.danger-outline:not(.readonly):focus{filter:brightness(1.1)!important}div.coer-button button.primary-filled:not(.readonly):focus,div.coer-button button.primary-outline:not(.readonly):focus{box-shadow:0 0 20px #0d6efd!important}div.coer-button button.secondary-filled:not(.readonly):focus,div.coer-button button.secondary-outline:not(.readonly):focus{box-shadow:0 0 20px #6c757d!important}div.coer-button button.success-filled:not(.readonly):focus,div.coer-button button.success-outline:not(.readonly):focus{box-shadow:0 0 20px #198754!important}div.coer-button button.warning-filled:not(.readonly):focus,div.coer-button button.warning-outline:not(.readonly):focus{box-shadow:0 0 20px #ffc107!important}div.coer-button button.danger-filled:not(.readonly):focus,div.coer-button button.danger-outline:not(.readonly):focus{box-shadow:0 0 20px #dc3545!important}div.coer-button button.navigation-filled:not(.readonly):focus,div.coer-button button.navigation-outline:not(.readonly):focus{box-shadow:0 0 20px #fd6031!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button{width:40px!important;height:40px!important;padding:0!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border{width:25px!important;height:25px!important;background-color:transparent!important;border:none!important;overflow:visible!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border *{font-size:medium!important}div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border i.bi-box-arrow-left,div.coer-button button.mdc-icon-button.mat-mdc-icon-button.icon-no-border i.bi-box-arrow-in-right{font-size:20px!important}div.coer-button button.readonly,div.coer-button button.readonly:hover,div.coer-button button.readonly:focus{background-color:#dfdede!important;border-color:#dfdede!important;color:#fff!important}div.coer-button coer-button[ishidden=true],div.coer-button coer-button[ng-reflect-invisible=true]{position:relative!important;top:10000vh;left:10000vw}div.coer-button a.loading{cursor:wait!important}div.coer-button i{vertical-align:middle!important}div.coer-button i.spinner-border{width:15px!important;height:15px!important;font-size:16px!important}div.coer-button span{font-weight:700!important}div#coer-tool-bar coer-button *{color:#fd6031!important}\n"] }]
|
147
|
+
}], propDecorators: { id: [{
|
148
|
+
type: Input
|
149
|
+
}], tooltip: [{
|
150
|
+
type: Input
|
151
|
+
}], onClick: [{
|
152
|
+
type: Output
|
153
|
+
}] } });
|
154
|
+
|
155
|
+
class CoerCheckbox extends ControlValue {
|
156
|
+
constructor() {
|
157
|
+
super(...arguments);
|
158
|
+
//Variables
|
159
|
+
this._value = false;
|
160
|
+
this._id = Tools.GetGuid('coer-checkbox');
|
161
|
+
this._isLoading = true;
|
162
|
+
this.id = input('');
|
163
|
+
this.label = input('');
|
164
|
+
this.labelPosition = input('after');
|
165
|
+
this.isDisabled = input(false);
|
166
|
+
this.isLoading = input(false);
|
167
|
+
this.isInvisible = input(false);
|
168
|
+
this.ignoreModel = input(false);
|
169
|
+
//Outputs
|
170
|
+
this.onChange = output();
|
171
|
+
//computed
|
172
|
+
this._isEnable = computed(() => {
|
173
|
+
return !this.isLoading() && !this.isDisabled() && !this.isInvisible();
|
174
|
+
});
|
175
|
+
}
|
176
|
+
//Inputs
|
177
|
+
set value(value) {
|
178
|
+
if (Tools.IsNull(value))
|
179
|
+
value = false;
|
180
|
+
this.SetValue(value);
|
181
|
+
}
|
182
|
+
//getter
|
183
|
+
get value() {
|
184
|
+
return this._value;
|
185
|
+
}
|
186
|
+
ngAfterViewInit() {
|
187
|
+
Tools.Sleep().then(_ => this._isLoading = false);
|
188
|
+
}
|
189
|
+
//ControlValueAccessor
|
190
|
+
SetValue(value) {
|
191
|
+
if (Tools.IsNotNull(value)) {
|
192
|
+
if (!this.ignoreModel()) {
|
193
|
+
this._UpdateValue(value);
|
194
|
+
}
|
195
|
+
this._value = value;
|
196
|
+
if (!this._isLoading && this._isEnable()) {
|
197
|
+
this.onChange.emit(value);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
//ControlValueAccessor
|
202
|
+
writeValue(value) {
|
203
|
+
if (Tools.IsNotNull(value)) {
|
204
|
+
this._value = value;
|
205
|
+
if (!this._isLoading && this._isEnable()) {
|
206
|
+
this.onChange.emit(value);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
/** */
|
211
|
+
Check() {
|
212
|
+
if (!this._isLoading && this._isEnable()) {
|
213
|
+
this.SetValue(true);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
/** */
|
217
|
+
Uncheck() {
|
218
|
+
if (!this._isLoading && this._isEnable()) {
|
219
|
+
this.SetValue(false);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
223
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: CoerCheckbox, selector: "coer-checkbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isInvisible: { classPropertyName: "isInvisible", publicName: "isInvisible", isSignal: true, isRequired: false, transformFunction: null }, ignoreModel: { classPropertyName: "ignoreModel", publicName: "ignoreModel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, providers: [CONTROL_VALUE(CoerCheckbox)], usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"{ 'coer-checkbox': true, 'placeholder-glow': isLoading(), 'invisible': isInvisible() }\">\r\n <div [id]=\"_id\" [ngClass]=\"{ 'placeholder': isLoading() }\">\r\n <mat-checkbox\r\n [ngModel]=\"_value\"\r\n [indeterminate]=\"false\"\r\n [labelPosition]=\"labelPosition()\"\r\n [disabled]=\"!_isEnable()\"\r\n (change)=\"this.SetValue($event.checked)\"\r\n > {{ label() }} </mat-checkbox>\r\n </div>\r\n</div>", styles: ["div.coer-checkbox *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-checkbox .text-blue{color:#0d6efd!important}div.coer-checkbox .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-checkbox .background-blue{background-color:#0d6efd!important}div.coer-checkbox .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-checkbox .border-blue{border-color:#0d6efd!important}div.coer-checkbox .text-gray{color:#6c757d!important}div.coer-checkbox .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-checkbox .background-gray{background-color:#6c757d!important}div.coer-checkbox .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-checkbox .border-gray{border-color:#6c757d!important}div.coer-checkbox .text-green{color:#198754!important}div.coer-checkbox .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-checkbox .background-green{background-color:#198754!important}div.coer-checkbox .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-checkbox .border-green{border-color:#198754!important}div.coer-checkbox .text-yellow{color:#ffc107!important}div.coer-checkbox .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-checkbox .background-yellow{background-color:#ffc107!important}div.coer-checkbox .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-checkbox .border-yellow{border-color:#ffc107!important}div.coer-checkbox .text-red{color:#dc3545!important}div.coer-checkbox .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-checkbox .background-red{background-color:#dc3545!important}div.coer-checkbox .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-checkbox .border-red{border-color:#dc3545!important}div.coer-checkbox .text-white{color:#f5f5f5!important}div.coer-checkbox .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-checkbox .background-white{background-color:#f5f5f5!important}div.coer-checkbox .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-checkbox .border-white{border-color:#f5f5f5!important}div.coer-checkbox .text-black{color:#252525!important}div.coer-checkbox .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-checkbox .background-black{background-color:#252525!important}div.coer-checkbox .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-checkbox .border-black{border-color:#252525!important}div.coer-checkbox .text-orange{color:#fd6031!important}div.coer-checkbox .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-checkbox .background-orange{background-color:#fd6031!important}div.coer-checkbox .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-checkbox .border-orange{border-color:#fd6031!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox{padding:10px!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background{background-color:#f5f5f5!important;border-radius:5px!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__ripple{width:30px!important;height:30px!important;top:5px!important;left:5px!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mat-ripple.mat-mdc-checkbox-ripple.mat-mdc-focus-indicator *{display:none!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field label.mdc-label{padding-top:3px!important;padding-left:0!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field label.mdc-label::selection{background-color:transparent!important}div.coer-checkbox mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background{background-color:#fd6031!important;border-color:#fd6031!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox{padding:0!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mat-mdc-checkbox-touch-target,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mat-mdc-checkbox-touch-target{top:8px!important;width:39px!important;height:30px!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox input,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox input{display:none!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__ripple,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__ripple{top:-7px!important;left:-6px!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background{transform:translateY(-1px)!important;position:static!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field label.mdc-label,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field label.mdc-label{display:none!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] }); }
|
224
|
+
}
|
225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerCheckbox, decorators: [{
|
226
|
+
type: Component,
|
227
|
+
args: [{ selector: 'coer-checkbox', providers: [CONTROL_VALUE(CoerCheckbox)], template: "<div [ngClass]=\"{ 'coer-checkbox': true, 'placeholder-glow': isLoading(), 'invisible': isInvisible() }\">\r\n <div [id]=\"_id\" [ngClass]=\"{ 'placeholder': isLoading() }\">\r\n <mat-checkbox\r\n [ngModel]=\"_value\"\r\n [indeterminate]=\"false\"\r\n [labelPosition]=\"labelPosition()\"\r\n [disabled]=\"!_isEnable()\"\r\n (change)=\"this.SetValue($event.checked)\"\r\n > {{ label() }} </mat-checkbox>\r\n </div>\r\n</div>", styles: ["div.coer-checkbox *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-checkbox .text-blue{color:#0d6efd!important}div.coer-checkbox .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-checkbox .background-blue{background-color:#0d6efd!important}div.coer-checkbox .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-checkbox .border-blue{border-color:#0d6efd!important}div.coer-checkbox .text-gray{color:#6c757d!important}div.coer-checkbox .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-checkbox .background-gray{background-color:#6c757d!important}div.coer-checkbox .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-checkbox .border-gray{border-color:#6c757d!important}div.coer-checkbox .text-green{color:#198754!important}div.coer-checkbox .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-checkbox .background-green{background-color:#198754!important}div.coer-checkbox .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-checkbox .border-green{border-color:#198754!important}div.coer-checkbox .text-yellow{color:#ffc107!important}div.coer-checkbox .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-checkbox .background-yellow{background-color:#ffc107!important}div.coer-checkbox .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-checkbox .border-yellow{border-color:#ffc107!important}div.coer-checkbox .text-red{color:#dc3545!important}div.coer-checkbox .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-checkbox .background-red{background-color:#dc3545!important}div.coer-checkbox .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-checkbox .border-red{border-color:#dc3545!important}div.coer-checkbox .text-white{color:#f5f5f5!important}div.coer-checkbox .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-checkbox .background-white{background-color:#f5f5f5!important}div.coer-checkbox .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-checkbox .border-white{border-color:#f5f5f5!important}div.coer-checkbox .text-black{color:#252525!important}div.coer-checkbox .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-checkbox .background-black{background-color:#252525!important}div.coer-checkbox .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-checkbox .border-black{border-color:#252525!important}div.coer-checkbox .text-orange{color:#fd6031!important}div.coer-checkbox .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-checkbox .background-orange{background-color:#fd6031!important}div.coer-checkbox .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-checkbox .border-orange{border-color:#fd6031!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox{padding:10px!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background{background-color:#f5f5f5!important;border-radius:5px!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__ripple{width:30px!important;height:30px!important;top:5px!important;left:5px!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mat-ripple.mat-mdc-checkbox-ripple.mat-mdc-focus-indicator *{display:none!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field label.mdc-label{padding-top:3px!important;padding-left:0!important}div.coer-checkbox mat-checkbox div.mdc-form-field.mat-internal-form-field label.mdc-label::selection{background-color:transparent!important}div.coer-checkbox mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background{background-color:#fd6031!important;border-color:#fd6031!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox{padding:0!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mat-mdc-checkbox-touch-target,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mat-mdc-checkbox-touch-target{top:8px!important;width:39px!important;height:30px!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox input,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox input{display:none!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__ripple,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__ripple{top:-7px!important;left:-6px!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field div.mdc-checkbox div.mdc-checkbox__background{transform:translateY(-1px)!important;position:static!important}coer-grid table tbody tr td.check-box mat-checkbox div.mdc-form-field.mat-internal-form-field label.mdc-label,coer-grid table tbody tr td.check-box mat-checkbox.mat-mdc-checkbox-checked div.mdc-form-field.mat-internal-form-field label.mdc-label{display:none!important}\n"] }]
|
228
|
+
}], propDecorators: { value: [{
|
229
|
+
type: Input
|
230
|
+
}] } });
|
231
|
+
|
232
|
+
class CoerModal {
|
233
|
+
constructor() {
|
234
|
+
//Variables
|
235
|
+
this._id = Tools.GetGuid('coer-modal');
|
236
|
+
this._isOpen = false;
|
237
|
+
this._isModalOpen = isModalOpenSIGNAL;
|
238
|
+
this.windowWidth = Screen.WINDOW_WIDTH;
|
239
|
+
//Inputs
|
240
|
+
this.id = '';
|
241
|
+
this.title = input('');
|
242
|
+
this.icon = input('');
|
243
|
+
this.showCloseButton = input(true);
|
244
|
+
this.width = input('small');
|
245
|
+
this.height = input('auto');
|
246
|
+
this.maxHeight = input('');
|
247
|
+
//Computed
|
248
|
+
this.contentList = computed(() => Array.from(this.contentRef._results));
|
249
|
+
//Computed
|
250
|
+
this.header = computed(() => {
|
251
|
+
const header = this.contentList().find(x => x.coerRef() === 'header');
|
252
|
+
return Tools.IsNotNull(header) ? header : null;
|
253
|
+
});
|
254
|
+
//Computed
|
255
|
+
this.body = computed(() => {
|
256
|
+
const body = this.contentList().find(x => x.coerRef() === '' || x.coerRef() === 'body');
|
257
|
+
return Tools.IsNotNull(body) ? body : null;
|
258
|
+
});
|
259
|
+
//Computed
|
260
|
+
this.footer = computed(() => {
|
261
|
+
const footer = this.contentList().find(x => x.coerRef() === 'footer');
|
262
|
+
return Tools.IsNotNull(footer) ? footer : null;
|
263
|
+
});
|
264
|
+
//Computed
|
265
|
+
this._title = computed(() => {
|
266
|
+
return Tools.IsNotNull(this.header()) && this.header().title().length > 0
|
267
|
+
? this.header().title() : this.title();
|
268
|
+
});
|
269
|
+
//Computed
|
270
|
+
this._icon = computed(() => {
|
271
|
+
return Tools.IsNotNull(this.header()) && this.header().icon().length > 0
|
272
|
+
? this.header().icon() : this.icon();
|
273
|
+
});
|
274
|
+
//Outputs
|
275
|
+
this.onOpen = output();
|
276
|
+
this.onClose = output();
|
277
|
+
//Generic Tools
|
278
|
+
this.IsNull = Tools.IsNull;
|
279
|
+
this.IsNotNull = Tools.IsNotNull;
|
280
|
+
}
|
281
|
+
//getter
|
282
|
+
get isOpen() {
|
283
|
+
return this._isOpen;
|
284
|
+
}
|
285
|
+
//getter
|
286
|
+
get _width() {
|
287
|
+
switch (this.width()) {
|
288
|
+
case 'small': return '450px';
|
289
|
+
case 'full': return `${this.windowWidth - 50}px`;
|
290
|
+
default: return 'auto';
|
291
|
+
}
|
292
|
+
}
|
293
|
+
ngOnInit() {
|
294
|
+
Screen.Resize.subscribe((response) => {
|
295
|
+
this.windowWidth = response.width;
|
296
|
+
});
|
297
|
+
Tools.Sleep().then(() => {
|
298
|
+
this._modal = new Modal(document.getElementById(this._id));
|
299
|
+
});
|
300
|
+
}
|
301
|
+
/** */
|
302
|
+
Open() {
|
303
|
+
this._modal.show();
|
304
|
+
if (!this._isOpen) {
|
305
|
+
this._isOpen = true;
|
306
|
+
this._isModalOpen.set(true);
|
307
|
+
Tools.Sleep(1000).then(() => this.onOpen.emit());
|
308
|
+
}
|
309
|
+
}
|
310
|
+
/** */
|
311
|
+
Close() {
|
312
|
+
this._modal.hide();
|
313
|
+
if (this._isOpen) {
|
314
|
+
this._isOpen = false;
|
315
|
+
this._isModalOpen.set(false);
|
316
|
+
Tools.Sleep(1000).then(() => this.onClose.emit());
|
317
|
+
}
|
318
|
+
}
|
319
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerModal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
320
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerModal, selector: "coer-modal", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, showCloseButton: { classPropertyName: "showCloseButton", publicName: "showCloseButton", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onOpen: "onOpen", onClose: "onClose" }, queries: [{ propertyName: "contentRef", predicate: CoerRefDirective }], ngImport: i0, template: "<aside title='' [id]=\"_id\" class=\"modal fade\" data-bs-backdrop=\"static\" tabindex=\"-1\">\r\n <div class=\"modal-dialog modal-dialog-centered modal-dialog-scrollable\" [ngStyle]=\"{ 'max-width': _width }\">\r\n <div class=\"modal-content\">\r\n @if(IsNull(header()) || (IsNotNull(header()) && header()?.show())) {\r\n <header class=\"modal-header\">\r\n <h6 class=\"modal-title\">\r\n <i [class]=\"_icon()\"></i>\r\n <span [ngClass]=\"{ 'ms-1': _icon().length > 0 }\"> {{ _title() }} </span>\r\n </h6>\r\n\r\n @if(showCloseButton()) {\r\n <button type=\"button\" class=\"btn-close\" (click)=\"Close()\"></button>\r\n }\r\n </header>\r\n }\r\n\r\n <section class=\"modal-body\" [ngStyle]=\"{\r\n 'height': height(),\r\n 'max-height': maxHeight(),\r\n 'overflow': maxHeight() === '' ? 'visible' : 'auto'\r\n }\">\r\n @if(IsNotNull(body()) && body()?.show()) {\r\n <ng-container [ngTemplateOutlet]=\"body()!.template\"></ng-container>\r\n }\r\n\r\n @else {\r\n <ng-content></ng-content>\r\n }\r\n </section>\r\n\r\n @if(IsNotNull(footer())) {\r\n <footer class=\"modal-footer\">\r\n @if(footer()?.show()) {\r\n <ng-container [ngTemplateOutlet]=\"footer()!.template\"></ng-container>\r\n }\r\n </footer>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div [ngClass]=\"{ 'backdrop': _isModalOpen() }\"></div>\r\n</aside>", styles: [".modal-dialog{margin:auto!important;height:100vh}.modal-header{padding:8px 16px!important}.modal-title{font-weight:700!important;font-size:17px!important}.modal-body{padding-top:16px!important;padding-bottom:0!important;min-width:60px!important}div.coer-filebox .modal-body{padding:0!important}.modal-footer{border:none!important;display:flex!important;align-items:flex-end!important;justify-content:flex-end!important;max-height:64px!important;min-height:64px!important;gap:10px!important}.btn-close:focus{box-shadow:none!important}div.modal-backdrop{z-index:0!important}aside.modal div.backdrop{width:100vw;height:100vh;position:fixed;top:0;left:0;background-color:#0000005b;z-index:1500}div.modal-content{z-index:1501;overflow:visible!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
|
321
|
+
}
|
322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerModal, decorators: [{
|
323
|
+
type: Component,
|
324
|
+
args: [{ selector: 'coer-modal', template: "<aside title='' [id]=\"_id\" class=\"modal fade\" data-bs-backdrop=\"static\" tabindex=\"-1\">\r\n <div class=\"modal-dialog modal-dialog-centered modal-dialog-scrollable\" [ngStyle]=\"{ 'max-width': _width }\">\r\n <div class=\"modal-content\">\r\n @if(IsNull(header()) || (IsNotNull(header()) && header()?.show())) {\r\n <header class=\"modal-header\">\r\n <h6 class=\"modal-title\">\r\n <i [class]=\"_icon()\"></i>\r\n <span [ngClass]=\"{ 'ms-1': _icon().length > 0 }\"> {{ _title() }} </span>\r\n </h6>\r\n\r\n @if(showCloseButton()) {\r\n <button type=\"button\" class=\"btn-close\" (click)=\"Close()\"></button>\r\n }\r\n </header>\r\n }\r\n\r\n <section class=\"modal-body\" [ngStyle]=\"{\r\n 'height': height(),\r\n 'max-height': maxHeight(),\r\n 'overflow': maxHeight() === '' ? 'visible' : 'auto'\r\n }\">\r\n @if(IsNotNull(body()) && body()?.show()) {\r\n <ng-container [ngTemplateOutlet]=\"body()!.template\"></ng-container>\r\n }\r\n\r\n @else {\r\n <ng-content></ng-content>\r\n }\r\n </section>\r\n\r\n @if(IsNotNull(footer())) {\r\n <footer class=\"modal-footer\">\r\n @if(footer()?.show()) {\r\n <ng-container [ngTemplateOutlet]=\"footer()!.template\"></ng-container>\r\n }\r\n </footer>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div [ngClass]=\"{ 'backdrop': _isModalOpen() }\"></div>\r\n</aside>", styles: [".modal-dialog{margin:auto!important;height:100vh}.modal-header{padding:8px 16px!important}.modal-title{font-weight:700!important;font-size:17px!important}.modal-body{padding-top:16px!important;padding-bottom:0!important;min-width:60px!important}div.coer-filebox .modal-body{padding:0!important}.modal-footer{border:none!important;display:flex!important;align-items:flex-end!important;justify-content:flex-end!important;max-height:64px!important;min-height:64px!important;gap:10px!important}.btn-close:focus{box-shadow:none!important}div.modal-backdrop{z-index:0!important}aside.modal div.backdrop{width:100vw;height:100vh;position:fixed;top:0;left:0;background-color:#0000005b;z-index:1500}div.modal-content{z-index:1501;overflow:visible!important}\n"] }]
|
325
|
+
}], propDecorators: { contentRef: [{
|
326
|
+
type: ContentChildren,
|
327
|
+
args: [CoerRefDirective]
|
328
|
+
}], id: [{
|
329
|
+
type: Input
|
330
|
+
}] } });
|
331
|
+
|
332
|
+
class CoerFilebox {
|
333
|
+
constructor() {
|
334
|
+
//Injections
|
335
|
+
this.alert = inject(CoerAlert);
|
336
|
+
this.IsNull = Tools.IsNull;
|
337
|
+
this.IsNotNull = Tools.IsNotNull;
|
338
|
+
//Elements
|
339
|
+
this.inputFileImage = viewChild.required('inputFileImage');
|
340
|
+
this.modal = viewChild.required('modal');
|
341
|
+
//Variables
|
342
|
+
this.base64 = '';
|
343
|
+
this._image = null;
|
344
|
+
this.imageExtensions = ['png', 'jpeg', 'jpg', 'gif', 'svg'];
|
345
|
+
//Inputs
|
346
|
+
this.type = input('image');
|
347
|
+
this.multiple = input(false);
|
348
|
+
this.isLoading = input(false);
|
349
|
+
this.isDisabled = input(false);
|
350
|
+
//Outputs
|
351
|
+
this.onSelected = output();
|
352
|
+
this.onDeleteImage = output();
|
353
|
+
//computed
|
354
|
+
this._isEnable = computed(() => {
|
355
|
+
return !this.isLoading() && !this.isDisabled();
|
356
|
+
});
|
357
|
+
/** */
|
358
|
+
this.GetExtensionFile = (fileName) => {
|
359
|
+
if (fileName.includes('.')) {
|
360
|
+
let worlds = fileName.split('.');
|
361
|
+
if (worlds.length > 0) {
|
362
|
+
let extension = worlds.pop();
|
363
|
+
extension = extension.trim();
|
364
|
+
extension = extension.toLowerCase();
|
365
|
+
if (extension.length > 0)
|
366
|
+
return extension;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
this.alert.Warning('The file extension could not be recognized', 'Files');
|
370
|
+
return null;
|
371
|
+
};
|
372
|
+
}
|
373
|
+
set image(value) {
|
374
|
+
this._image = Tools.IsNotNull(value) ? value : null;
|
375
|
+
if (Tools.IsNotNull(value)) {
|
376
|
+
if (value?.value?.name) {
|
377
|
+
Files.ConvertToBase64(value?.value).then(base64 => {
|
378
|
+
return this.base64 = base64;
|
379
|
+
});
|
380
|
+
}
|
381
|
+
else
|
382
|
+
this.base64 = value?.value;
|
383
|
+
}
|
384
|
+
}
|
385
|
+
/** */
|
386
|
+
async UploadImages(event) {
|
387
|
+
const selectedFiles = Array.from(event.target.files);
|
388
|
+
const files = [];
|
389
|
+
let extension = null;
|
390
|
+
for (const file of selectedFiles) {
|
391
|
+
extension = this.GetExtensionFile(file.name) || '';
|
392
|
+
if (this.imageExtensions.includes(extension)) {
|
393
|
+
files.push({
|
394
|
+
file: file,
|
395
|
+
extension: extension,
|
396
|
+
base64: await Files.ConvertToBase64(file)
|
397
|
+
});
|
398
|
+
}
|
399
|
+
else
|
400
|
+
this.alert.Warning(`<b>.${extension}</b> extension not allowed`, 'Files');
|
401
|
+
}
|
402
|
+
//Response
|
403
|
+
this.inputFileImage().nativeElement.value = null;
|
404
|
+
this.onSelected.emit([...files]);
|
405
|
+
}
|
406
|
+
/** */
|
407
|
+
DeleteImage(event) {
|
408
|
+
event.stopPropagation();
|
409
|
+
if (this._isEnable()) {
|
410
|
+
this.onDeleteImage.emit();
|
411
|
+
}
|
412
|
+
}
|
413
|
+
/** */
|
414
|
+
ExpandImage(event) {
|
415
|
+
event.stopPropagation();
|
416
|
+
this.modal().Open();
|
417
|
+
}
|
418
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerFilebox, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
419
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerFilebox, selector: "coer-filebox", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onSelected: "onSelected", onDeleteImage: "onDeleteImage" }, viewQueries: [{ propertyName: "inputFileImage", first: true, predicate: ["inputFileImage"], descendants: true, isSignal: true }, { propertyName: "modal", first: true, predicate: ["modal"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"coer-filebox\">\r\n @if(type() == 'image') {\r\n <figure (click)=\"_isEnable() ? inputFileImage.click() : null\"\r\n [ngClass]=\"{ 'dashed': IsNull(_image?.value) }\"\r\n [ngStyle]=\"{\r\n 'margin-top': _image?.marginTop || '',\r\n 'margin-right': _image?.marginRight || '',\r\n 'margin-bottom': _image?.marginBottom || '',\r\n 'margin-left': _image?.marginLeft || ''\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"loading\">\r\n <i class=\"spinner-border\"></i>\r\n </div>\r\n\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <img [src]=\"base64 | noImage\"\r\n [ngStyle]=\"{\r\n 'width': _image?.width || '',\r\n 'max-width': _image?.maxWidth || '',\r\n 'height': _image?.height || '',\r\n 'max-height': _image?.maxHeight || '210px'\r\n }\">\r\n\r\n <input #inputFileImage\r\n type=\"file\"\r\n accept=\"image/png, image/jpeg, image/gif, image/svg+xml\"\r\n (change)=\"UploadImages($event)\"\r\n [multiple]=\"multiple()\">\r\n\r\n @if(_isEnable() && IsNotNull(_image) && IsNotNull(_image!.value)) {\r\n <div class=\"icon-container\">\r\n @if(IsNull(_image?.allowDelete) || _image!.allowDelete) {\r\n <i class=\"fa-solid fa-trash-can\" (click)=\"DeleteImage($event)\"></i>\r\n }\r\n\r\n @if(IsNull(_image?.allowExpand) || _image!.allowExpand) {\r\n <i class=\"fa-solid fa-expand\" (click)=\"ExpandImage($event)\"></i>\r\n }\r\n </div>\r\n }\r\n </figure>\r\n }\r\n\r\n <!-- Modal -->\r\n <coer-modal #modal [title]=\"_image?.name || ''\" height=\"90vh\" width=\"full\">\r\n <div class=\"modal-image\" [ngStyle]=\"{ 'background-image': 'url(' + base64 + ')' }\"></div>\r\n </coer-modal>\r\n</div>", styles: ["div.coer-filebox *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-filebox .text-blue{color:#0d6efd!important}div.coer-filebox .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-filebox .background-blue{background-color:#0d6efd!important}div.coer-filebox .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-filebox .border-blue{border-color:#0d6efd!important}div.coer-filebox .text-gray{color:#6c757d!important}div.coer-filebox .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-filebox .background-gray{background-color:#6c757d!important}div.coer-filebox .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-filebox .border-gray{border-color:#6c757d!important}div.coer-filebox .text-green{color:#198754!important}div.coer-filebox .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-filebox .background-green{background-color:#198754!important}div.coer-filebox .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-filebox .border-green{border-color:#198754!important}div.coer-filebox .text-yellow{color:#ffc107!important}div.coer-filebox .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-filebox .background-yellow{background-color:#ffc107!important}div.coer-filebox .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-filebox .border-yellow{border-color:#ffc107!important}div.coer-filebox .text-red{color:#dc3545!important}div.coer-filebox .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-filebox .background-red{background-color:#dc3545!important}div.coer-filebox .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-filebox .border-red{border-color:#dc3545!important}div.coer-filebox .text-white{color:#f5f5f5!important}div.coer-filebox .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-filebox .background-white{background-color:#f5f5f5!important}div.coer-filebox .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-filebox .border-white{border-color:#f5f5f5!important}div.coer-filebox .text-black{color:#252525!important}div.coer-filebox .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-filebox .background-black{background-color:#252525!important}div.coer-filebox .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-filebox .border-black{border-color:#252525!important}div.coer-filebox .text-orange{color:#fd6031!important}div.coer-filebox .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-filebox .background-orange{background-color:#fd6031!important}div.coer-filebox .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-filebox .border-orange{border-color:#fd6031!important}div.coer-filebox figure{position:relative;display:flex;align-items:center;justify-content:center;border-radius:3px;overflow:hidden;cursor:pointer;min-height:210px;z-index:1}div.coer-filebox .dashed{border:1px dashed #6c757d;background-color:transparent}div.coer-filebox div.loading{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:25px;background-color:#bbbbbb83!important;flex-direction:column!important;gap:10px!important;cursor:default!important}div.coer-filebox div.loading span.fa-fade{position:relative!important;top:50px!important}div.coer-filebox div.loading i.spinner-border{color:#fd6031!important;width:70px!important;height:70px!important;font-size:20px!important;position:absolute!important}div.coer-filebox span.placeholder{width:calc(100% + 32px)!important;height:100%!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-filebox div.icon-container{position:absolute;bottom:5px;right:5px;z-index:2;display:flex;align-items:center;justify-content:flex-end;gap:7px}div.coer-filebox div.icon-container i{color:#6c757d;font-size:20px}div.coer-filebox div.icon-container i:hover{zoom:1.1}div.coer-filebox div.modal-image{width:100%;height:100%;border-bottom-left-radius:5px;border-bottom-right-radius:5px;background-size:contain;background-repeat:no-repeat;background-position:center}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: CoerModal, selector: "coer-modal", inputs: ["id", "title", "icon", "showCloseButton", "width", "height", "maxHeight"], outputs: ["onOpen", "onClose"] }, { kind: "pipe", type: i9.NoImagePipe, name: "noImage" }] }); }
|
420
|
+
}
|
421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerFilebox, decorators: [{
|
422
|
+
type: Component,
|
423
|
+
args: [{ selector: 'coer-filebox', template: "<div class=\"coer-filebox\">\r\n @if(type() == 'image') {\r\n <figure (click)=\"_isEnable() ? inputFileImage.click() : null\"\r\n [ngClass]=\"{ 'dashed': IsNull(_image?.value) }\"\r\n [ngStyle]=\"{\r\n 'margin-top': _image?.marginTop || '',\r\n 'margin-right': _image?.marginRight || '',\r\n 'margin-bottom': _image?.marginBottom || '',\r\n 'margin-left': _image?.marginLeft || ''\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"loading\">\r\n <i class=\"spinner-border\"></i>\r\n </div>\r\n\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <img [src]=\"base64 | noImage\"\r\n [ngStyle]=\"{\r\n 'width': _image?.width || '',\r\n 'max-width': _image?.maxWidth || '',\r\n 'height': _image?.height || '',\r\n 'max-height': _image?.maxHeight || '210px'\r\n }\">\r\n\r\n <input #inputFileImage\r\n type=\"file\"\r\n accept=\"image/png, image/jpeg, image/gif, image/svg+xml\"\r\n (change)=\"UploadImages($event)\"\r\n [multiple]=\"multiple()\">\r\n\r\n @if(_isEnable() && IsNotNull(_image) && IsNotNull(_image!.value)) {\r\n <div class=\"icon-container\">\r\n @if(IsNull(_image?.allowDelete) || _image!.allowDelete) {\r\n <i class=\"fa-solid fa-trash-can\" (click)=\"DeleteImage($event)\"></i>\r\n }\r\n\r\n @if(IsNull(_image?.allowExpand) || _image!.allowExpand) {\r\n <i class=\"fa-solid fa-expand\" (click)=\"ExpandImage($event)\"></i>\r\n }\r\n </div>\r\n }\r\n </figure>\r\n }\r\n\r\n <!-- Modal -->\r\n <coer-modal #modal [title]=\"_image?.name || ''\" height=\"90vh\" width=\"full\">\r\n <div class=\"modal-image\" [ngStyle]=\"{ 'background-image': 'url(' + base64 + ')' }\"></div>\r\n </coer-modal>\r\n</div>", styles: ["div.coer-filebox *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-filebox .text-blue{color:#0d6efd!important}div.coer-filebox .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-filebox .background-blue{background-color:#0d6efd!important}div.coer-filebox .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-filebox .border-blue{border-color:#0d6efd!important}div.coer-filebox .text-gray{color:#6c757d!important}div.coer-filebox .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-filebox .background-gray{background-color:#6c757d!important}div.coer-filebox .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-filebox .border-gray{border-color:#6c757d!important}div.coer-filebox .text-green{color:#198754!important}div.coer-filebox .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-filebox .background-green{background-color:#198754!important}div.coer-filebox .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-filebox .border-green{border-color:#198754!important}div.coer-filebox .text-yellow{color:#ffc107!important}div.coer-filebox .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-filebox .background-yellow{background-color:#ffc107!important}div.coer-filebox .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-filebox .border-yellow{border-color:#ffc107!important}div.coer-filebox .text-red{color:#dc3545!important}div.coer-filebox .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-filebox .background-red{background-color:#dc3545!important}div.coer-filebox .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-filebox .border-red{border-color:#dc3545!important}div.coer-filebox .text-white{color:#f5f5f5!important}div.coer-filebox .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-filebox .background-white{background-color:#f5f5f5!important}div.coer-filebox .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-filebox .border-white{border-color:#f5f5f5!important}div.coer-filebox .text-black{color:#252525!important}div.coer-filebox .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-filebox .background-black{background-color:#252525!important}div.coer-filebox .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-filebox .border-black{border-color:#252525!important}div.coer-filebox .text-orange{color:#fd6031!important}div.coer-filebox .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-filebox .background-orange{background-color:#fd6031!important}div.coer-filebox .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-filebox .border-orange{border-color:#fd6031!important}div.coer-filebox figure{position:relative;display:flex;align-items:center;justify-content:center;border-radius:3px;overflow:hidden;cursor:pointer;min-height:210px;z-index:1}div.coer-filebox .dashed{border:1px dashed #6c757d;background-color:transparent}div.coer-filebox div.loading{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:25px;background-color:#bbbbbb83!important;flex-direction:column!important;gap:10px!important;cursor:default!important}div.coer-filebox div.loading span.fa-fade{position:relative!important;top:50px!important}div.coer-filebox div.loading i.spinner-border{color:#fd6031!important;width:70px!important;height:70px!important;font-size:20px!important;position:absolute!important}div.coer-filebox span.placeholder{width:calc(100% + 32px)!important;height:100%!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-filebox div.icon-container{position:absolute;bottom:5px;right:5px;z-index:2;display:flex;align-items:center;justify-content:flex-end;gap:7px}div.coer-filebox div.icon-container i{color:#6c757d;font-size:20px}div.coer-filebox div.icon-container i:hover{zoom:1.1}div.coer-filebox div.modal-image{width:100%;height:100%;border-bottom-left-radius:5px;border-bottom-right-radius:5px;background-size:contain;background-repeat:no-repeat;background-position:center}\n"] }]
|
424
|
+
}], propDecorators: { image: [{
|
425
|
+
type: Input
|
426
|
+
}] } });
|
427
|
+
|
428
|
+
class CoerForm {
|
429
|
+
constructor() {
|
430
|
+
//Injection
|
431
|
+
this.alert = inject(CoerAlert);
|
432
|
+
this.formGroup = input.required();
|
433
|
+
this.isLoading = input(false);
|
434
|
+
this.isDisabled = input(false);
|
435
|
+
/** */
|
436
|
+
this.IsInvalidControl = (formControlName) => {
|
437
|
+
return Tools.IsNotNull(this.formGroup().get(formControlName))
|
438
|
+
? (this.formGroup().get(formControlName).touched && this.formGroup().get(formControlName).invalid)
|
439
|
+
: true;
|
440
|
+
};
|
441
|
+
}
|
442
|
+
get _isDisabled() {
|
443
|
+
return this.isLoading() || this.isDisabled();
|
444
|
+
}
|
445
|
+
/** */
|
446
|
+
TouchForm() {
|
447
|
+
this.formGroup().markAllAsTouched();
|
448
|
+
}
|
449
|
+
/** */
|
450
|
+
SetControlValue(formControlName, value) {
|
451
|
+
if (Tools.IsNotNull(this.formGroup().get(formControlName))) {
|
452
|
+
this.formGroup().get(formControlName).setValue(value);
|
453
|
+
}
|
454
|
+
else {
|
455
|
+
this.alert.Warning(`${formControlName} Control`, 'Not Found');
|
456
|
+
}
|
457
|
+
}
|
458
|
+
/** */
|
459
|
+
GetControlValue(formControlName) {
|
460
|
+
return Tools.IsNotNull(this.formGroup().get(formControlName))
|
461
|
+
? this.formGroup().get(formControlName).value
|
462
|
+
: null;
|
463
|
+
}
|
464
|
+
/** Get form value */
|
465
|
+
GetValue() {
|
466
|
+
return Tools.BreakReference(this.formGroup().value);
|
467
|
+
}
|
468
|
+
/** */
|
469
|
+
Reset(properties = null) {
|
470
|
+
if (Tools.IsNull(properties))
|
471
|
+
this.formGroup().reset();
|
472
|
+
else
|
473
|
+
this.formGroup().reset(properties);
|
474
|
+
}
|
475
|
+
/**
|
476
|
+
* Mark all controls as touched.
|
477
|
+
* If form is invalid emit a warning and focus first invalid control.
|
478
|
+
*/
|
479
|
+
IsValid() {
|
480
|
+
this.TouchForm();
|
481
|
+
if (this.formGroup().invalid) {
|
482
|
+
this.alert.Warning('Please complete the required fields', 'Instructions', 'fa-solid fa-list-check');
|
483
|
+
this.Focus();
|
484
|
+
}
|
485
|
+
return {
|
486
|
+
isValid: this.formGroup().valid,
|
487
|
+
formValue: this.GetValue()
|
488
|
+
};
|
489
|
+
}
|
490
|
+
/** Focus the especified control or first invalid control */
|
491
|
+
Focus(formControl = null) {
|
492
|
+
const formControlCollection = new Map();
|
493
|
+
const formControlErrorCollection = new Map();
|
494
|
+
for (const property of Tools.GetObjectProperties(this.formGroup().controls)) {
|
495
|
+
formControlErrorCollection.set(property, this.formGroup().controls[property].errors);
|
496
|
+
const htmlElement = document.querySelector(`[formcontrolname='${property}'] input`);
|
497
|
+
if (Tools.IsNotNull(htmlElement))
|
498
|
+
formControlCollection.set(property, htmlElement);
|
499
|
+
}
|
500
|
+
if (formControlCollection.size > 0) {
|
501
|
+
if (Tools.IsNull(formControl)) {
|
502
|
+
for (const [property, error] of formControlErrorCollection) {
|
503
|
+
if (Tools.IsNotNull(error)) {
|
504
|
+
formControl = property;
|
505
|
+
break;
|
506
|
+
}
|
507
|
+
}
|
508
|
+
if (Tools.IsNull(formControl)) {
|
509
|
+
formControl = Array.from(formControlCollection.keys())[0];
|
510
|
+
}
|
511
|
+
}
|
512
|
+
const element = formControlCollection.get(formControl);
|
513
|
+
if (Tools.IsNotNull(element))
|
514
|
+
element.focus();
|
515
|
+
}
|
516
|
+
}
|
517
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerForm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
518
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: CoerForm, selector: "coer-form", inputs: { formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<form [formGroup]=\"formGroup()\" autocomplete=\"off\" class=\"coer-form\">\r\n <fieldset [disabled]=\"_isDisabled\">\r\n <ng-content></ng-content>\r\n </fieldset>\r\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
|
519
|
+
}
|
520
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerForm, decorators: [{
|
521
|
+
type: Component,
|
522
|
+
args: [{ selector: 'coer-form', template: "<form [formGroup]=\"formGroup()\" autocomplete=\"off\" class=\"coer-form\">\r\n <fieldset [disabled]=\"_isDisabled\">\r\n <ng-content></ng-content>\r\n </fieldset>\r\n</form>" }]
|
523
|
+
}] });
|
524
|
+
|
525
|
+
class CoerNumberBox extends ControlValue {
|
526
|
+
constructor() {
|
527
|
+
super(...arguments);
|
528
|
+
//Injections
|
529
|
+
this.alert = inject(CoerAlert);
|
530
|
+
//Component Value
|
531
|
+
this._value = '';
|
532
|
+
this.matFormField = viewChild.required('matFormField');
|
533
|
+
this.coerNumberbox = viewChild.required('coerNumberbox');
|
534
|
+
//Variables
|
535
|
+
this._id = Tools.GetGuid('coer-numberbox');
|
536
|
+
this._isLoadingEvent = signal(false);
|
537
|
+
this.hideCaret = false;
|
538
|
+
this.id = '';
|
539
|
+
this.label = input('');
|
540
|
+
this.placeholder = input('');
|
541
|
+
this.min = input(0);
|
542
|
+
this.max = input(2147483647);
|
543
|
+
this.decimals = input(0);
|
544
|
+
this.width = input('100%');
|
545
|
+
this.minWidth = input('190px');
|
546
|
+
this.maxWidth = input('100%');
|
547
|
+
this.marginTop = input('0px');
|
548
|
+
this.marginRight = input('0px');
|
549
|
+
this.marginBottom = input('0px');
|
550
|
+
this.marginLeft = input('0px');
|
551
|
+
this.isInvalid = input(false);
|
552
|
+
this.isValid = input(false);
|
553
|
+
this.isDisabled = input(false);
|
554
|
+
this.isReadonly = input(false);
|
555
|
+
this.isLoading = input(false);
|
556
|
+
this.selectOnFocus = input(true);
|
557
|
+
this.textPosition = input('right');
|
558
|
+
//Outputs
|
559
|
+
this.onKeyupEnter = output();
|
560
|
+
this.onInput = output();
|
561
|
+
//computed
|
562
|
+
this._isEnable = computed(() => {
|
563
|
+
return !this.isDisabled() && !this.isLoading() && !this.isReadonly();
|
564
|
+
});
|
565
|
+
//computed
|
566
|
+
this.floatLabel = computed(() => {
|
567
|
+
return this.label() == '' ? 'always' : 'auto';
|
568
|
+
});
|
569
|
+
//computed
|
570
|
+
this.paddingRight = computed(() => {
|
571
|
+
return this.isInvalid() || this.isValid()
|
572
|
+
? '18px' : '0px';
|
573
|
+
});
|
574
|
+
}
|
575
|
+
//Inputs
|
576
|
+
set value(value) {
|
577
|
+
if (Tools.IsNull(value))
|
578
|
+
value = 0;
|
579
|
+
this.SetValue(value);
|
580
|
+
}
|
581
|
+
ngOnInit() {
|
582
|
+
Tools.Sleep().then(() => {
|
583
|
+
this.element = document.getElementById(this._id);
|
584
|
+
if (this.element) {
|
585
|
+
this.element.addEventListener('focus', () => {
|
586
|
+
if (!this._isEnable())
|
587
|
+
this.Blur();
|
588
|
+
else if (this.selectOnFocus())
|
589
|
+
this.Select();
|
590
|
+
});
|
591
|
+
this.element.addEventListener('blur', () => this.Blur());
|
592
|
+
this.element.addEventListener('keyup', (event) => {
|
593
|
+
if (this._isEnable()) {
|
594
|
+
const { key } = event;
|
595
|
+
if (key === 'Enter') {
|
596
|
+
let value = this.coerNumberbox().nativeElement.value;
|
597
|
+
value = this.OnlyNumbers(value);
|
598
|
+
value = this.ValidateRangeValue(value);
|
599
|
+
this.onKeyupEnter.emit(value);
|
600
|
+
this.Blur();
|
601
|
+
}
|
602
|
+
if (key === 'ArrowUp') {
|
603
|
+
this.hideCaret = true;
|
604
|
+
this.SetValue(Number(this._value) + 1);
|
605
|
+
Tools.Sleep(500, 'ArrowUp').then(() => this.hideCaret = false);
|
606
|
+
}
|
607
|
+
if (key === 'ArrowDown') {
|
608
|
+
this.hideCaret = true;
|
609
|
+
this.SetValue(Number(this._value) - 1);
|
610
|
+
Tools.Sleep(500, 'ArrowDown').then(() => this.hideCaret = false);
|
611
|
+
}
|
612
|
+
}
|
613
|
+
});
|
614
|
+
this.element.addEventListener('input', () => {
|
615
|
+
Tools.Sleep().then(() => {
|
616
|
+
let value = this.coerNumberbox().nativeElement.value;
|
617
|
+
value = this.OnlyNumbers(value);
|
618
|
+
value = this.ValidateRangeValue(value);
|
619
|
+
if (this._isEnable())
|
620
|
+
this.onInput.emit(value);
|
621
|
+
});
|
622
|
+
});
|
623
|
+
}
|
624
|
+
});
|
625
|
+
}
|
626
|
+
//getter
|
627
|
+
get value() {
|
628
|
+
return this._value;
|
629
|
+
}
|
630
|
+
//ControlValueAccessor
|
631
|
+
SetValue(value) {
|
632
|
+
value = this.OnlyNumbers(value);
|
633
|
+
value = this.ValidateRangeValue(value);
|
634
|
+
this._UpdateValue(value);
|
635
|
+
this.coerNumberbox().nativeElement.value = value;
|
636
|
+
this._value = value;
|
637
|
+
}
|
638
|
+
//ControlValueAccessor
|
639
|
+
writeValue(value) {
|
640
|
+
value = this.OnlyNumbers(value);
|
641
|
+
value = this.ValidateRangeValue(value);
|
642
|
+
this.coerNumberbox().nativeElement.value = value;
|
643
|
+
this._value = value;
|
644
|
+
}
|
645
|
+
/** */
|
646
|
+
OnlyNumbers(value) {
|
647
|
+
let isNegative = false;
|
648
|
+
let valueString = String(value).trim();
|
649
|
+
//Negatives
|
650
|
+
if (valueString.includes('-')) {
|
651
|
+
if (this.min() < 0) {
|
652
|
+
isNegative = valueString.startsWith('-');
|
653
|
+
if (valueString == '-')
|
654
|
+
return '-';
|
655
|
+
if (valueString == '-.')
|
656
|
+
return '-0.';
|
657
|
+
if (valueString == '-0')
|
658
|
+
return '-0';
|
659
|
+
if (valueString == '-0.')
|
660
|
+
return '-0.';
|
661
|
+
}
|
662
|
+
else if (Number(value) < this.min()) {
|
663
|
+
this.alert.Warning(`Minimum ${this.min()}`, 'Out of range', 'fa-solid fa-hashtag');
|
664
|
+
valueString = '0';
|
665
|
+
}
|
666
|
+
}
|
667
|
+
const charArray = [];
|
668
|
+
for (const char of valueString) {
|
669
|
+
if (['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(char)) {
|
670
|
+
charArray.push(char);
|
671
|
+
}
|
672
|
+
else if (char == '.' && this.decimals() > 0) {
|
673
|
+
charArray.push(char);
|
674
|
+
}
|
675
|
+
}
|
676
|
+
valueString = charArray.join('');
|
677
|
+
//Decimals
|
678
|
+
if (this.decimals() > 0) {
|
679
|
+
let integerString = valueString.split('.')[0] || '';
|
680
|
+
let decimalString = valueString.split('.')[1] || '';
|
681
|
+
decimalString = decimalString.substring(0, this.decimals());
|
682
|
+
if (valueString == '.')
|
683
|
+
return '0.';
|
684
|
+
else if (valueString.includes('.') && decimalString == '') {
|
685
|
+
return (isNegative) ? `-${integerString}.` : `${integerString}.`;
|
686
|
+
}
|
687
|
+
else if (valueString.includes('.') && decimalString.endsWith('0')) {
|
688
|
+
return (isNegative) ? `-${integerString}.${decimalString}` : `${integerString}.${decimalString}`;
|
689
|
+
}
|
690
|
+
else if (integerString == '' && decimalString == '') {
|
691
|
+
return '0';
|
692
|
+
}
|
693
|
+
valueString = `${integerString}.${decimalString}`;
|
694
|
+
}
|
695
|
+
if (isNegative) {
|
696
|
+
valueString = `-${valueString}`;
|
697
|
+
}
|
698
|
+
return Number(valueString);
|
699
|
+
}
|
700
|
+
/** */
|
701
|
+
ValidateRangeValue(value) {
|
702
|
+
if (['-', '.', '-.', '-0', '-0.'].includes(String(value))) {
|
703
|
+
return String(value);
|
704
|
+
}
|
705
|
+
if (Number(value) < this.min()) {
|
706
|
+
this.alert.Warning(`Minimum ${this.min()}`, 'Out of range', 'fa-solid fa-hashtag');
|
707
|
+
value = this.min();
|
708
|
+
}
|
709
|
+
if (Number(value) > this.max()) {
|
710
|
+
this.alert.Warning(`Cannot exceed ${this.max()}`, 'Out of range', 'fa-solid fa-hashtag');
|
711
|
+
value = this.max();
|
712
|
+
}
|
713
|
+
if (this.decimals() <= 0) {
|
714
|
+
if (String(value).includes('.')) {
|
715
|
+
value = String(value).split('.')[0];
|
716
|
+
}
|
717
|
+
}
|
718
|
+
return String(value);
|
719
|
+
}
|
720
|
+
/** */
|
721
|
+
Focus(timeout = 0) {
|
722
|
+
if (this._isLoadingEvent())
|
723
|
+
return;
|
724
|
+
else
|
725
|
+
this._isLoadingEvent.set(true);
|
726
|
+
Tools.Sleep(timeout).then(() => {
|
727
|
+
if (this._isEnable()) {
|
728
|
+
this.element.focus();
|
729
|
+
}
|
730
|
+
this._isLoadingEvent.set(false);
|
731
|
+
});
|
732
|
+
}
|
733
|
+
/** */
|
734
|
+
Select(timeout = 0) {
|
735
|
+
if (this._isLoadingEvent())
|
736
|
+
return;
|
737
|
+
else
|
738
|
+
this._isLoadingEvent.set(true);
|
739
|
+
Tools.Sleep(timeout).then(() => {
|
740
|
+
if (this._isEnable()) {
|
741
|
+
this.element.focus();
|
742
|
+
this.element.select();
|
743
|
+
}
|
744
|
+
this._isLoadingEvent.set(false);
|
745
|
+
});
|
746
|
+
}
|
747
|
+
/** */
|
748
|
+
Blur() {
|
749
|
+
if (this._isLoadingEvent())
|
750
|
+
return;
|
751
|
+
else
|
752
|
+
this._isLoadingEvent.set(true);
|
753
|
+
Tools.Sleep().then(() => {
|
754
|
+
if (this.element) {
|
755
|
+
this.element.blur();
|
756
|
+
setTimeout(() => {
|
757
|
+
const element = document.querySelector(`#${this._id}-container .mdc-line-ripple--active`);
|
758
|
+
if (element)
|
759
|
+
element.classList.remove('mdc-line-ripple--active');
|
760
|
+
this._isLoadingEvent.set(false);
|
761
|
+
});
|
762
|
+
}
|
763
|
+
});
|
764
|
+
}
|
765
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerNumberBox, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
766
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerNumberBox, selector: "coer-numberbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, decimals: { classPropertyName: "decimals", publicName: "decimals", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, marginTop: { classPropertyName: "marginTop", publicName: "marginTop", isSignal: true, isRequired: false, transformFunction: null }, marginRight: { classPropertyName: "marginRight", publicName: "marginRight", isSignal: true, isRequired: false, transformFunction: null }, marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, marginLeft: { classPropertyName: "marginLeft", publicName: "marginLeft", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, selectOnFocus: { classPropertyName: "selectOnFocus", publicName: "selectOnFocus", isSignal: true, isRequired: false, transformFunction: null }, textPosition: { classPropertyName: "textPosition", publicName: "textPosition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onKeyupEnter: "onKeyupEnter", onInput: "onInput" }, providers: [CONTROL_VALUE(CoerNumberBox)], viewQueries: [{ propertyName: "matFormField", first: true, predicate: ["matFormField"], descendants: true, isSignal: true }, { propertyName: "coerNumberbox", first: true, predicate: ["coerNumberbox"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"coer-number-box\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <input #coerNumberbox matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [disabled]=\"!_isEnable()\"\r\n [value]=\"_value\"\r\n (input)=\"SetValue(coerNumberbox.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [ngClass]=\"{ 'caret-none': hideCaret }\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight(),\r\n 'text-align': textPosition()\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\">\r\n @if(isInvalid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n </span>\r\n </mat-form-field>\r\n</div>", styles: ["div.coer-number-box *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-number-box .text-blue{color:#0d6efd!important}div.coer-number-box .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-number-box .background-blue{background-color:#0d6efd!important}div.coer-number-box .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-number-box .border-blue{border-color:#0d6efd!important}div.coer-number-box .text-gray{color:#6c757d!important}div.coer-number-box .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-number-box .background-gray{background-color:#6c757d!important}div.coer-number-box .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-number-box .border-gray{border-color:#6c757d!important}div.coer-number-box .text-green{color:#198754!important}div.coer-number-box .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-number-box .background-green{background-color:#198754!important}div.coer-number-box .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-number-box .border-green{border-color:#198754!important}div.coer-number-box .text-yellow{color:#ffc107!important}div.coer-number-box .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-number-box .background-yellow{background-color:#ffc107!important}div.coer-number-box .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-number-box .border-yellow{border-color:#ffc107!important}div.coer-number-box .text-red{color:#dc3545!important}div.coer-number-box .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-number-box .background-red{background-color:#dc3545!important}div.coer-number-box .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-number-box .border-red{border-color:#dc3545!important}div.coer-number-box .text-white{color:#f5f5f5!important}div.coer-number-box .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-number-box .background-white{background-color:#f5f5f5!important}div.coer-number-box .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-number-box .border-white{border-color:#f5f5f5!important}div.coer-number-box .text-black{color:#252525!important}div.coer-number-box .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-number-box .background-black{background-color:#252525!important}div.coer-number-box .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-number-box .border-black{border-color:#252525!important}div.coer-number-box .text-orange{color:#fd6031!important}div.coer-number-box .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-number-box .background-orange{background-color:#fd6031!important}div.coer-number-box .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-number-box .border-orange{border-color:#fd6031!important}div.coer-number-box mat-form-field{position:relative!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:40px!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;height:40px!important;padding:0!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{font-weight:400!important;font-size:17px!important;color:#252525!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input.caret-none{caret-color:transparent!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-number-box mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-number-box mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;width:30px;height:40px;display:flex;align-items:center;justify-content:center}div.coer-number-box mat-form-field span.icon-container i{font-size:20px!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-number-box mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:40px!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important}div.coer-number-box mat-form-field .placeholder,div.coer-number-box mat-form-field .placeholder *,div.coer-number-box mat-form-field .placeholder-glow,div.coer-number-box mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-number-box mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:transparent!important;padding-left:9px!important;padding-right:9px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple,coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:before,coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:after{border-bottom-color:transparent!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:28px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{height:28px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{margin-top:3px!important;font-size:14px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field span.icon-container{transform:translate(-5px,-6px)!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatLabel, selector: "mat-label" }] }); }
|
767
|
+
}
|
768
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerNumberBox, decorators: [{
|
769
|
+
type: Component,
|
770
|
+
args: [{ selector: 'coer-numberbox', providers: [CONTROL_VALUE(CoerNumberBox)], template: "<div class=\"coer-number-box\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <input #coerNumberbox matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [disabled]=\"!_isEnable()\"\r\n [value]=\"_value\"\r\n (input)=\"SetValue(coerNumberbox.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [ngClass]=\"{ 'caret-none': hideCaret }\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight(),\r\n 'text-align': textPosition()\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\">\r\n @if(isInvalid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n </span>\r\n </mat-form-field>\r\n</div>", styles: ["div.coer-number-box *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-number-box .text-blue{color:#0d6efd!important}div.coer-number-box .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-number-box .background-blue{background-color:#0d6efd!important}div.coer-number-box .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-number-box .border-blue{border-color:#0d6efd!important}div.coer-number-box .text-gray{color:#6c757d!important}div.coer-number-box .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-number-box .background-gray{background-color:#6c757d!important}div.coer-number-box .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-number-box .border-gray{border-color:#6c757d!important}div.coer-number-box .text-green{color:#198754!important}div.coer-number-box .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-number-box .background-green{background-color:#198754!important}div.coer-number-box .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-number-box .border-green{border-color:#198754!important}div.coer-number-box .text-yellow{color:#ffc107!important}div.coer-number-box .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-number-box .background-yellow{background-color:#ffc107!important}div.coer-number-box .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-number-box .border-yellow{border-color:#ffc107!important}div.coer-number-box .text-red{color:#dc3545!important}div.coer-number-box .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-number-box .background-red{background-color:#dc3545!important}div.coer-number-box .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-number-box .border-red{border-color:#dc3545!important}div.coer-number-box .text-white{color:#f5f5f5!important}div.coer-number-box .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-number-box .background-white{background-color:#f5f5f5!important}div.coer-number-box .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-number-box .border-white{border-color:#f5f5f5!important}div.coer-number-box .text-black{color:#252525!important}div.coer-number-box .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-number-box .background-black{background-color:#252525!important}div.coer-number-box .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-number-box .border-black{border-color:#252525!important}div.coer-number-box .text-orange{color:#fd6031!important}div.coer-number-box .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-number-box .background-orange{background-color:#fd6031!important}div.coer-number-box .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-number-box .border-orange{border-color:#fd6031!important}div.coer-number-box mat-form-field{position:relative!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:40px!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;height:40px!important;padding:0!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{font-weight:400!important;font-size:17px!important;color:#252525!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input.caret-none{caret-color:transparent!important}div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-number-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-number-box mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-number-box mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;width:30px;height:40px;display:flex;align-items:center;justify-content:center}div.coer-number-box mat-form-field span.icon-container i{font-size:20px!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-number-box mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-number-box mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:40px!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important}div.coer-number-box mat-form-field .placeholder,div.coer-number-box mat-form-field .placeholder *,div.coer-number-box mat-form-field .placeholder-glow,div.coer-number-box mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-number-box mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:transparent!important;padding-left:9px!important;padding-right:9px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple,coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:before,coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:after{border-bottom-color:transparent!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:28px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{height:28px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{margin-top:3px!important;font-size:14px!important}coer-grid table tbody tr td.coer-numberbox mat-form-field span.icon-container{transform:translate(-5px,-6px)!important}\n"] }]
|
771
|
+
}], propDecorators: { value: [{
|
772
|
+
type: Input
|
773
|
+
}], id: [{
|
774
|
+
type: Input
|
775
|
+
}] } });
|
776
|
+
|
777
|
+
class CoerSelectbox extends ControlValue {
|
778
|
+
constructor() {
|
779
|
+
super(...arguments);
|
780
|
+
//Component Value
|
781
|
+
this._value = null;
|
782
|
+
//Variables
|
783
|
+
this._scrollByRow = 40.8;
|
784
|
+
this._coerTextBox = viewChild.required('coerTextBox');
|
785
|
+
this._id = Tools.GetGuid('coer-selectBox');
|
786
|
+
this._index = signal(-1);
|
787
|
+
this._search = signal('');
|
788
|
+
this._isOpen = signal(false);
|
789
|
+
this._isDirty = signal(false);
|
790
|
+
this._isOverMenu = signal(false);
|
791
|
+
this._isLoadingEvent = signal(false);
|
792
|
+
this._scroll = signal(0);
|
793
|
+
this.id = '';
|
794
|
+
this.label = input('');
|
795
|
+
this.dataSource = input([]);
|
796
|
+
this.propDisplay = input('name');
|
797
|
+
this.rowsByPage = input(50);
|
798
|
+
this.placeholder = input('-- Select --');
|
799
|
+
this.width = input('100%');
|
800
|
+
this.minWidth = input('190px');
|
801
|
+
this.maxWidth = input('100%');
|
802
|
+
this.marginTop = input('0px');
|
803
|
+
this.marginRight = input('0px');
|
804
|
+
this.marginBottom = input('0px');
|
805
|
+
this.marginLeft = input('0px');
|
806
|
+
this.isInvalid = input(false);
|
807
|
+
this.isValid = input(false);
|
808
|
+
this.isDisabled = input(false);
|
809
|
+
this.isReadonly = input(false);
|
810
|
+
this.isLoading = input(false);
|
811
|
+
//Outputs
|
812
|
+
this.onSelected = output();
|
813
|
+
//computed
|
814
|
+
this._isEnable = computed(() => {
|
815
|
+
return !this.isDisabled() && !this.isLoading() && !this.isReadonly();
|
816
|
+
});
|
817
|
+
//computed
|
818
|
+
this.floatLabel = computed(() => {
|
819
|
+
return this.label() == '' ? 'always' : 'auto';
|
820
|
+
});
|
821
|
+
//computed
|
822
|
+
this._dataSource = computed(() => {
|
823
|
+
let index = 0;
|
824
|
+
const search = this._search();
|
825
|
+
const propDisplay = this.propDisplay();
|
826
|
+
let dataSource = this.dataSource().map((item) => Object.assign(item, { index: index++ }));
|
827
|
+
if (this._isDirty() && !this._isLoadingEvent()) {
|
828
|
+
dataSource = [...dataSource].filter((item) => String(item[propDisplay]).trim().toUpperCase().includes(search.trim().toUpperCase()));
|
829
|
+
}
|
830
|
+
let indexRow = 0;
|
831
|
+
return Tools.BreakReference(dataSource)
|
832
|
+
.splice(0, this.rowsByPage())
|
833
|
+
.map((item) => Object.assign(item, { indexRow: indexRow++ }));
|
834
|
+
});
|
835
|
+
/** */
|
836
|
+
this.GetIndexRow = (item) => {
|
837
|
+
return item['indexRow'];
|
838
|
+
};
|
839
|
+
/** */
|
840
|
+
this.GetDisplay = (item) => {
|
841
|
+
return Tools.IsNotNull(item) ? item[this.propDisplay()] : '';
|
842
|
+
};
|
843
|
+
}
|
844
|
+
//Inputs
|
845
|
+
set value(value) {
|
846
|
+
if (Tools.IsNull(value))
|
847
|
+
value = null;
|
848
|
+
this.SetValue(value);
|
849
|
+
}
|
850
|
+
ngOnInit() {
|
851
|
+
this.SetEvents();
|
852
|
+
}
|
853
|
+
//getter
|
854
|
+
get value() {
|
855
|
+
return this._value;
|
856
|
+
}
|
857
|
+
//getter
|
858
|
+
get _displayed() {
|
859
|
+
return Tools.IsNotNull(this._value) ? this._value[this.propDisplay()] : '';
|
860
|
+
}
|
861
|
+
//getter
|
862
|
+
get _placeholder() {
|
863
|
+
let placeholder = this.placeholder();
|
864
|
+
if (this.dataSource().length <= 0) {
|
865
|
+
placeholder = '-- No Options --';
|
866
|
+
}
|
867
|
+
return Tools.IsNotNull(this._value)
|
868
|
+
? this._displayed
|
869
|
+
: placeholder;
|
870
|
+
}
|
871
|
+
//computed
|
872
|
+
get _showCancel() {
|
873
|
+
return Tools.IsNotNull(this._value)
|
874
|
+
&& this._search().length <= 0;
|
875
|
+
}
|
876
|
+
//computed
|
877
|
+
get paddingRight() {
|
878
|
+
return this.isInvalid() || this.isValid() || this._showCancel
|
879
|
+
? '40px' : '15px';
|
880
|
+
}
|
881
|
+
//computed
|
882
|
+
get widthIcons() {
|
883
|
+
return this.isInvalid() || this.isValid() || this._showCancel
|
884
|
+
? '55px' : '30px';
|
885
|
+
}
|
886
|
+
/** */
|
887
|
+
SetValue(_value) {
|
888
|
+
if (_value === undefined)
|
889
|
+
_value = null;
|
890
|
+
this._UpdateValue(_value);
|
891
|
+
this._value = _value;
|
892
|
+
this._search.set(this.GetDisplay(_value));
|
893
|
+
}
|
894
|
+
/** */
|
895
|
+
writeValue(_value) {
|
896
|
+
if (_value === undefined)
|
897
|
+
_value = null;
|
898
|
+
this._value = _value;
|
899
|
+
this._search.set(this.GetDisplay(_value));
|
900
|
+
}
|
901
|
+
/** */
|
902
|
+
SetEvents() {
|
903
|
+
Tools.Sleep().then(() => {
|
904
|
+
//Container
|
905
|
+
this._container = document.getElementById(`${this._id}-container`);
|
906
|
+
this._container.addEventListener('mouseenter', () => {
|
907
|
+
this._isOverMenu.set(true);
|
908
|
+
});
|
909
|
+
this._container.addEventListener('mouseleave', () => {
|
910
|
+
this._isOverMenu.set(false);
|
911
|
+
});
|
912
|
+
//DropDown
|
913
|
+
this._dropDownMenu = document.getElementById(`${this._id}-dropdown-menu`);
|
914
|
+
this._dropDownMenu.addEventListener('mouseenter', () => {
|
915
|
+
this._isOverMenu.set(true);
|
916
|
+
});
|
917
|
+
this._dropDownMenu.addEventListener('mouseleave', () => {
|
918
|
+
this._isOverMenu.set(false);
|
919
|
+
});
|
920
|
+
//TextBox
|
921
|
+
this._textbox = document.getElementById(this._id);
|
922
|
+
this._textbox.addEventListener('focus', () => {
|
923
|
+
if (this._isEnable())
|
924
|
+
this.Focus();
|
925
|
+
else
|
926
|
+
this.Blur();
|
927
|
+
});
|
928
|
+
this._textbox.addEventListener('keyup', (event) => {
|
929
|
+
const { key } = event;
|
930
|
+
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) {
|
931
|
+
if (key === 'ArrowUp') {
|
932
|
+
const firstIndex = (this._dataSource().length <= 0) ? -1 : 0;
|
933
|
+
if ((this._index() - 1) >= firstIndex) {
|
934
|
+
this._index.update(index => index - 1);
|
935
|
+
if (this._index() >= 3)
|
936
|
+
this._scroll.update(scroll => scroll -= this._scrollByRow);
|
937
|
+
else
|
938
|
+
this._scroll.set(0);
|
939
|
+
this._dropDownMenu.scrollTo(0, this._scroll());
|
940
|
+
}
|
941
|
+
else {
|
942
|
+
this._scroll.set(0);
|
943
|
+
this._index.set(-1);
|
944
|
+
this._textbox.focus();
|
945
|
+
this._textbox.select();
|
946
|
+
}
|
947
|
+
this._dropDownMenu.scrollTo(0, this._scroll());
|
948
|
+
}
|
949
|
+
else if (key === 'ArrowDown') {
|
950
|
+
const lastIndex = (this._dataSource().length - 1);
|
951
|
+
if ((this._index() + 1) <= lastIndex) {
|
952
|
+
this._index.update(index => index + 1);
|
953
|
+
if (this._index() >= 3)
|
954
|
+
this._scroll.update(scroll => scroll += this._scrollByRow);
|
955
|
+
}
|
956
|
+
this._dropDownMenu.scrollTo(0, this._scroll());
|
957
|
+
}
|
958
|
+
else if (['ArrowLeft', 'ArrowRight'].includes(key)) {
|
959
|
+
if (Tools.IsNotNull(this._value) && !this._isDirty()) {
|
960
|
+
this._scroll.set(0);
|
961
|
+
this._dropDownMenu.scrollTo(0, this._scroll());
|
962
|
+
this.Search(this._displayed);
|
963
|
+
}
|
964
|
+
this._isDirty.set(true);
|
965
|
+
}
|
966
|
+
}
|
967
|
+
else {
|
968
|
+
if (key == 'Delete' && this._search() == '') {
|
969
|
+
this.Unselect();
|
970
|
+
}
|
971
|
+
this._isDirty.set(true);
|
972
|
+
}
|
973
|
+
});
|
974
|
+
this._textbox.addEventListener('mouseenter', () => {
|
975
|
+
this._isOverMenu.set(true);
|
976
|
+
});
|
977
|
+
this._textbox.addEventListener('mouseleave', () => {
|
978
|
+
this._isOverMenu.set(false);
|
979
|
+
});
|
980
|
+
this._textbox.addEventListener('paste', () => {
|
981
|
+
Tools.Sleep().then(_ => {
|
982
|
+
this._search.update(search => search = search.toString().trim());
|
983
|
+
});
|
984
|
+
});
|
985
|
+
//Document
|
986
|
+
document.addEventListener('click', () => {
|
987
|
+
if (!this._isOverMenu())
|
988
|
+
this.Blur();
|
989
|
+
});
|
990
|
+
document.addEventListener('keyup', (event) => {
|
991
|
+
if (event.key === 'Enter') {
|
992
|
+
if (this._index() >= 0) {
|
993
|
+
if (Tools.IsNotNull(this._value) && this._search() == this._value[this.propDisplay()]) {
|
994
|
+
this._isLoadingEvent.set(true);
|
995
|
+
}
|
996
|
+
const dataSource = Tools.BreakReference(this._dataSource());
|
997
|
+
const _value = dataSource.find(x => x.indexRow == this._index());
|
998
|
+
this.SelectItem(_value);
|
999
|
+
this._isLoadingEvent.set(false);
|
1000
|
+
}
|
1001
|
+
this.Blur();
|
1002
|
+
}
|
1003
|
+
});
|
1004
|
+
});
|
1005
|
+
}
|
1006
|
+
/** */
|
1007
|
+
SelectItem(item) {
|
1008
|
+
if (Tools.IsNotNull(item)) {
|
1009
|
+
const _item = Tools.BreakReference(this.dataSource()[item.index]);
|
1010
|
+
if (Tools.IsNotNull(_item)) {
|
1011
|
+
this.SetValue(Tools.BreakReference(_item));
|
1012
|
+
this.Blur();
|
1013
|
+
}
|
1014
|
+
delete _item.indexRow;
|
1015
|
+
delete _item.index;
|
1016
|
+
this.onSelected.emit({ ..._item });
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
/** */
|
1020
|
+
Unselect() {
|
1021
|
+
this._search.set('');
|
1022
|
+
this.SetValue(null);
|
1023
|
+
this.Blur();
|
1024
|
+
}
|
1025
|
+
/** */
|
1026
|
+
Focus(timeout = 0) {
|
1027
|
+
if (this._isLoadingEvent())
|
1028
|
+
return;
|
1029
|
+
else
|
1030
|
+
this._isLoadingEvent.set(true);
|
1031
|
+
Tools.Sleep(timeout).then(_ => {
|
1032
|
+
if (this._isEnable()) {
|
1033
|
+
this._textbox.focus();
|
1034
|
+
this._textbox.select();
|
1035
|
+
this.Open();
|
1036
|
+
}
|
1037
|
+
Tools.Sleep().then(_ => {
|
1038
|
+
if (Tools.IsNotNull(this._value)) {
|
1039
|
+
this.Search(this._displayed);
|
1040
|
+
}
|
1041
|
+
this._isLoadingEvent.set(false);
|
1042
|
+
});
|
1043
|
+
});
|
1044
|
+
}
|
1045
|
+
/** */
|
1046
|
+
Blur() {
|
1047
|
+
if (this._isLoadingEvent())
|
1048
|
+
return;
|
1049
|
+
this._isLoadingEvent.set(true);
|
1050
|
+
this._isDirty.set(false);
|
1051
|
+
this._index.set(-1);
|
1052
|
+
this._scroll.set(0);
|
1053
|
+
this._dropDownMenu.scrollTo(0, this._scroll());
|
1054
|
+
this._search.set(this._displayed);
|
1055
|
+
Tools.Sleep().then(_ => {
|
1056
|
+
this._textbox.blur();
|
1057
|
+
this.Close();
|
1058
|
+
Tools.Sleep().then(_ => {
|
1059
|
+
const element = document.querySelector(`#${this._id}-container .mdc-line-ripple--active`);
|
1060
|
+
if (element)
|
1061
|
+
element.classList.remove('mdc-line-ripple--active');
|
1062
|
+
this._isLoadingEvent.set(false);
|
1063
|
+
});
|
1064
|
+
});
|
1065
|
+
}
|
1066
|
+
/** */
|
1067
|
+
Open() {
|
1068
|
+
if (!this._dropDownMenu.classList.contains('show')) {
|
1069
|
+
this._dropDownMenu.classList.add('show');
|
1070
|
+
}
|
1071
|
+
this._isOpen.set(true);
|
1072
|
+
}
|
1073
|
+
/** */
|
1074
|
+
Close() {
|
1075
|
+
if (this._dropDownMenu.classList.contains('show')) {
|
1076
|
+
this._dropDownMenu.classList.remove('show');
|
1077
|
+
}
|
1078
|
+
this._isOpen.set(false);
|
1079
|
+
}
|
1080
|
+
/** */
|
1081
|
+
Search(_value) {
|
1082
|
+
this._search.set(String(_value));
|
1083
|
+
Tools.Sleep(0, `${this._id}-search`).then(_ => {
|
1084
|
+
const item = this._dataSource().find(item => String(item[this.propDisplay()]).trim().toUpperCase().includes(String(_value).trim().toUpperCase()));
|
1085
|
+
if (Tools.IsNotNull(item)) {
|
1086
|
+
this._index.set(item.indexRow);
|
1087
|
+
if (this._index() >= 3) {
|
1088
|
+
this._scroll.set((this._index() - 2) * this._scrollByRow);
|
1089
|
+
}
|
1090
|
+
else {
|
1091
|
+
this._scroll.set(0);
|
1092
|
+
}
|
1093
|
+
this._dropDownMenu.scrollTo(0, this._scroll());
|
1094
|
+
}
|
1095
|
+
});
|
1096
|
+
}
|
1097
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerSelectbox, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
1098
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerSelectbox, selector: "coer-selectbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: false, transformFunction: null }, propDisplay: { classPropertyName: "propDisplay", publicName: "propDisplay", isSignal: true, isRequired: false, transformFunction: null }, rowsByPage: { classPropertyName: "rowsByPage", publicName: "rowsByPage", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, marginTop: { classPropertyName: "marginTop", publicName: "marginTop", isSignal: true, isRequired: false, transformFunction: null }, marginRight: { classPropertyName: "marginRight", publicName: "marginRight", isSignal: true, isRequired: false, transformFunction: null }, marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, marginLeft: { classPropertyName: "marginLeft", publicName: "marginLeft", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelected: "onSelected" }, providers: [CONTROL_VALUE(CoerSelectbox)], viewQueries: [{ propertyName: "_coerTextBox", first: true, predicate: ["coerTextBox"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"coer-select-box\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <input #coerTextBox matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [value]=\"_search()\"\r\n [placeholder]=\"_placeholder\"\r\n [disabled]=\"!_isEnable()\"\r\n (input)=\"Search(coerTextBox.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\" [style]=\"{ 'width': widthIcons }\">\r\n @if(_showCancel && _isEnable() && !isLoading()) {\r\n <i class=\"fa-solid fa-xmark text-secondary\" (click)=\"Unselect()\"></i>\r\n }\r\n\r\n @else if(isInvalid() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n\r\n @if(_isOpen() && _isEnable() && !isLoading()) {\r\n <i class=\"fa-solid fa-caret-up cursor-pointer text-orange\" (click)=\"Blur()\"></i>\r\n }\r\n\r\n @else if(_isEnable() && !isLoading()) {\r\n <i class=\"fa-solid fa-caret-down cursor-pointer text-secondary\"></i>\r\n }\r\n </span>\r\n </mat-form-field>\r\n\r\n <!-- Options Container -->\r\n <div class=\"btn-group\">\r\n <ul [id]=\"_id + '-dropdown-menu'\" class=\"dropdown-menu\">\r\n @for(item of _dataSource(); track GetIndexRow(item)) {\r\n <li (click)=\"SelectItem(item)\">\r\n <div [id]=\"id + '-dropdown-option-' + GetIndexRow(item)\"\r\n [ngClass]=\"{\r\n 'dropdown-item': true,\r\n 'cursor-pointer': true,\r\n 'dropdown-item-focus': _index() == GetIndexRow(item)\r\n }\"\r\n >{{ GetDisplay(item) }} </div>\r\n <hr class=\"dropdown-divider\">\r\n </li>\r\n }\r\n </ul>\r\n </div>\r\n</div>\r\n\r\n", styles: ["div.coer-select-box{position:relative!important}div.coer-select-box *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-select-box .text-blue{color:#0d6efd!important}div.coer-select-box .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-select-box .background-blue{background-color:#0d6efd!important}div.coer-select-box .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-select-box .border-blue{border-color:#0d6efd!important}div.coer-select-box .text-gray{color:#6c757d!important}div.coer-select-box .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-select-box .background-gray{background-color:#6c757d!important}div.coer-select-box .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-select-box .border-gray{border-color:#6c757d!important}div.coer-select-box .text-green{color:#198754!important}div.coer-select-box .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-select-box .background-green{background-color:#198754!important}div.coer-select-box .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-select-box .border-green{border-color:#198754!important}div.coer-select-box .text-yellow{color:#ffc107!important}div.coer-select-box .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-select-box .background-yellow{background-color:#ffc107!important}div.coer-select-box .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-select-box .border-yellow{border-color:#ffc107!important}div.coer-select-box .text-red{color:#dc3545!important}div.coer-select-box .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-select-box .background-red{background-color:#dc3545!important}div.coer-select-box .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-select-box .border-red{border-color:#dc3545!important}div.coer-select-box .text-white{color:#f5f5f5!important}div.coer-select-box .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-select-box .background-white{background-color:#f5f5f5!important}div.coer-select-box .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-select-box .border-white{border-color:#f5f5f5!important}div.coer-select-box .text-black{color:#252525!important}div.coer-select-box .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-select-box .background-black{background-color:#252525!important}div.coer-select-box .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-select-box .border-black{border-color:#252525!important}div.coer-select-box .text-orange{color:#fd6031!important}div.coer-select-box .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-select-box .background-orange{background-color:#fd6031!important}div.coer-select-box .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-select-box .border-orange{border-color:#fd6031!important}div.coer-select-box mat-form-field{position:relative!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:40px!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;height:40px!important;padding:0!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{font-weight:400!important;font-size:17px!important;color:#252525!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-select-box mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-select-box mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;height:40px;display:flex;align-items:center;justify-content:center;gap:5px}div.coer-select-box mat-form-field span.icon-container i{font-size:20px!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-xmark{font-size:22px!important;padding:2px!important}div.coer-select-box mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:40px!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-select-box mat-form-field .placeholder,div.coer-select-box mat-form-field .placeholder *,div.coer-select-box mat-form-field .placeholder-glow,div.coer-select-box mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-select-box .btn-group{position:absolute!important;top:40px;left:0!important;width:100%!important}div.coer-select-box ul.dropdown-menu{background-color:#fff!important;border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:205px!important;width:100%!important;overflow:auto!important;padding:0!important}div.coer-select-box .dropdown-divider{margin:0!important;background-color:#fff!important}div.coer-select-box ul.dropdown-menu li:not(.dropdown-item-focus):hover,div.coer-select-box ul.dropdown-menu li>div:not(.dropdown-item-focus):hover{color:#000!important;background-color:#f1f6ff!important}div.coer-select-box ul.dropdown-menu li:last-child hr.dropdown-divider,div.coer-select-box ul.dropdown-menu li:last-child hr.dropdown-divider:hover{width:0px!important;border:none!important}div.coer-select-box ul.dropdown-menu li div{display:flex!important;align-items:center!important;height:40px!important}div.coer-select-box div.dropdown-item-focus{background-color:#cde1ff}div.coer-select-box mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:transparent!important;padding-left:9px!important;padding-right:9px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple,coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:before,coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:after{border-bottom-color:transparent!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:28px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{height:28px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{margin-top:3px!important;font-size:14px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field span.icon-container{transform:translate(-5px,-6px)!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box .btn-group{top:28px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatLabel, selector: "mat-label" }] }); }
|
1099
|
+
}
|
1100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerSelectbox, decorators: [{
|
1101
|
+
type: Component,
|
1102
|
+
args: [{ selector: 'coer-selectbox', providers: [CONTROL_VALUE(CoerSelectbox)], template: "<div class=\"coer-select-box\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <input #coerTextBox matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [value]=\"_search()\"\r\n [placeholder]=\"_placeholder\"\r\n [disabled]=\"!_isEnable()\"\r\n (input)=\"Search(coerTextBox.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\" [style]=\"{ 'width': widthIcons }\">\r\n @if(_showCancel && _isEnable() && !isLoading()) {\r\n <i class=\"fa-solid fa-xmark text-secondary\" (click)=\"Unselect()\"></i>\r\n }\r\n\r\n @else if(isInvalid() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n\r\n @if(_isOpen() && _isEnable() && !isLoading()) {\r\n <i class=\"fa-solid fa-caret-up cursor-pointer text-orange\" (click)=\"Blur()\"></i>\r\n }\r\n\r\n @else if(_isEnable() && !isLoading()) {\r\n <i class=\"fa-solid fa-caret-down cursor-pointer text-secondary\"></i>\r\n }\r\n </span>\r\n </mat-form-field>\r\n\r\n <!-- Options Container -->\r\n <div class=\"btn-group\">\r\n <ul [id]=\"_id + '-dropdown-menu'\" class=\"dropdown-menu\">\r\n @for(item of _dataSource(); track GetIndexRow(item)) {\r\n <li (click)=\"SelectItem(item)\">\r\n <div [id]=\"id + '-dropdown-option-' + GetIndexRow(item)\"\r\n [ngClass]=\"{\r\n 'dropdown-item': true,\r\n 'cursor-pointer': true,\r\n 'dropdown-item-focus': _index() == GetIndexRow(item)\r\n }\"\r\n >{{ GetDisplay(item) }} </div>\r\n <hr class=\"dropdown-divider\">\r\n </li>\r\n }\r\n </ul>\r\n </div>\r\n</div>\r\n\r\n", styles: ["div.coer-select-box{position:relative!important}div.coer-select-box *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-select-box .text-blue{color:#0d6efd!important}div.coer-select-box .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-select-box .background-blue{background-color:#0d6efd!important}div.coer-select-box .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-select-box .border-blue{border-color:#0d6efd!important}div.coer-select-box .text-gray{color:#6c757d!important}div.coer-select-box .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-select-box .background-gray{background-color:#6c757d!important}div.coer-select-box .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-select-box .border-gray{border-color:#6c757d!important}div.coer-select-box .text-green{color:#198754!important}div.coer-select-box .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-select-box .background-green{background-color:#198754!important}div.coer-select-box .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-select-box .border-green{border-color:#198754!important}div.coer-select-box .text-yellow{color:#ffc107!important}div.coer-select-box .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-select-box .background-yellow{background-color:#ffc107!important}div.coer-select-box .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-select-box .border-yellow{border-color:#ffc107!important}div.coer-select-box .text-red{color:#dc3545!important}div.coer-select-box .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-select-box .background-red{background-color:#dc3545!important}div.coer-select-box .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-select-box .border-red{border-color:#dc3545!important}div.coer-select-box .text-white{color:#f5f5f5!important}div.coer-select-box .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-select-box .background-white{background-color:#f5f5f5!important}div.coer-select-box .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-select-box .border-white{border-color:#f5f5f5!important}div.coer-select-box .text-black{color:#252525!important}div.coer-select-box .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-select-box .background-black{background-color:#252525!important}div.coer-select-box .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-select-box .border-black{border-color:#252525!important}div.coer-select-box .text-orange{color:#fd6031!important}div.coer-select-box .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-select-box .background-orange{background-color:#fd6031!important}div.coer-select-box .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-select-box .border-orange{border-color:#fd6031!important}div.coer-select-box mat-form-field{position:relative!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:40px!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;height:40px!important;padding:0!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{font-weight:400!important;font-size:17px!important;color:#252525!important}div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-select-box mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-select-box mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;height:40px;display:flex;align-items:center;justify-content:center;gap:5px}div.coer-select-box mat-form-field span.icon-container i{font-size:20px!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-select-box mat-form-field span.icon-container i.fa-solid.fa-xmark{font-size:22px!important;padding:2px!important}div.coer-select-box mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:40px!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-select-box mat-form-field .placeholder,div.coer-select-box mat-form-field .placeholder *,div.coer-select-box mat-form-field .placeholder-glow,div.coer-select-box mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-select-box .btn-group{position:absolute!important;top:40px;left:0!important;width:100%!important}div.coer-select-box ul.dropdown-menu{background-color:#fff!important;border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:205px!important;width:100%!important;overflow:auto!important;padding:0!important}div.coer-select-box .dropdown-divider{margin:0!important;background-color:#fff!important}div.coer-select-box ul.dropdown-menu li:not(.dropdown-item-focus):hover,div.coer-select-box ul.dropdown-menu li>div:not(.dropdown-item-focus):hover{color:#000!important;background-color:#f1f6ff!important}div.coer-select-box ul.dropdown-menu li:last-child hr.dropdown-divider,div.coer-select-box ul.dropdown-menu li:last-child hr.dropdown-divider:hover{width:0px!important;border:none!important}div.coer-select-box ul.dropdown-menu li div{display:flex!important;align-items:center!important;height:40px!important}div.coer-select-box div.dropdown-item-focus{background-color:#cde1ff}div.coer-select-box mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:transparent!important;padding-left:9px!important;padding-right:9px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple,coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:before,coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:after{border-bottom-color:transparent!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:28px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{height:28px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{margin-top:3px!important;font-size:14px!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box mat-form-field span.icon-container{transform:translate(-5px,-6px)!important}coer-grid table tbody tr td.coer-selectbox div.coer-select-box .btn-group{top:28px!important}\n"] }]
|
1103
|
+
}], propDecorators: { value: [{
|
1104
|
+
type: Input
|
1105
|
+
}], id: [{
|
1106
|
+
type: Input
|
1107
|
+
}] } });
|
1108
|
+
|
1109
|
+
class CoerTextBox extends ControlValue {
|
1110
|
+
constructor() {
|
1111
|
+
super(...arguments);
|
1112
|
+
//Component Value
|
1113
|
+
this._value = '';
|
1114
|
+
this.matFormField = viewChild.required('matFormField');
|
1115
|
+
this.coerTextBox = viewChild.required('coerTextBox');
|
1116
|
+
//Variables
|
1117
|
+
this._id = Tools.GetGuid('coer-textBox');
|
1118
|
+
this._isLoadingEvent = signal(false);
|
1119
|
+
this.id = '';
|
1120
|
+
this.label = input('');
|
1121
|
+
this.placeholder = input('');
|
1122
|
+
this.minLength = input(0);
|
1123
|
+
this.maxLength = input(50);
|
1124
|
+
this.showSearchIcon = input(false);
|
1125
|
+
this.showClearIcon = input(false);
|
1126
|
+
this.width = input('100%');
|
1127
|
+
this.minWidth = input('190px');
|
1128
|
+
this.maxWidth = input('100%');
|
1129
|
+
this.marginTop = input('0px');
|
1130
|
+
this.marginRight = input('0px');
|
1131
|
+
this.marginBottom = input('0px');
|
1132
|
+
this.marginLeft = input('0px');
|
1133
|
+
this.isInvalid = input(false);
|
1134
|
+
this.isValid = input(false);
|
1135
|
+
this.isDisabled = input(false);
|
1136
|
+
this.isReadonly = input(false);
|
1137
|
+
this.isLoading = input(false);
|
1138
|
+
this.selectOnFocus = input(true);
|
1139
|
+
this.textPosition = input('left');
|
1140
|
+
//Outputs
|
1141
|
+
this.onKeyupEnter = output();
|
1142
|
+
this.onInput = output();
|
1143
|
+
this.onClickClear = output();
|
1144
|
+
//computed
|
1145
|
+
this._isEnable = computed(() => {
|
1146
|
+
return !this.isDisabled() && !this.isLoading() && !this.isReadonly();
|
1147
|
+
});
|
1148
|
+
//computed
|
1149
|
+
this.floatLabel = computed(() => {
|
1150
|
+
return this.label() == '' ? 'always' : 'auto';
|
1151
|
+
});
|
1152
|
+
//computed
|
1153
|
+
this.paddingRight = computed(() => {
|
1154
|
+
return this.isInvalid() || this.isValid()
|
1155
|
+
? '18px' : '0px';
|
1156
|
+
});
|
1157
|
+
}
|
1158
|
+
//Inputs
|
1159
|
+
set value(value) {
|
1160
|
+
if (Tools.IsNull(value))
|
1161
|
+
value = '';
|
1162
|
+
this.SetValue(value);
|
1163
|
+
}
|
1164
|
+
ngOnInit() {
|
1165
|
+
this.SetEvents();
|
1166
|
+
}
|
1167
|
+
//getter
|
1168
|
+
get _showSearchIcon() {
|
1169
|
+
return this.showSearchIcon()
|
1170
|
+
&& !this._showClearIcon
|
1171
|
+
&& !this.isDisabled()
|
1172
|
+
&& !this.isLoading();
|
1173
|
+
}
|
1174
|
+
//getter
|
1175
|
+
get _showClearIcon() {
|
1176
|
+
return this.showClearIcon()
|
1177
|
+
&& !this.isDisabled()
|
1178
|
+
&& !this.isLoading()
|
1179
|
+
&& this._value != undefined
|
1180
|
+
&& String(this._value).length > 0;
|
1181
|
+
}
|
1182
|
+
//getter
|
1183
|
+
get value() {
|
1184
|
+
return this._value;
|
1185
|
+
}
|
1186
|
+
/** */
|
1187
|
+
SetEvents() {
|
1188
|
+
Tools.Sleep().then(() => {
|
1189
|
+
this.element = document.getElementById(this._id);
|
1190
|
+
if (this.element) {
|
1191
|
+
this.element.addEventListener('focus', () => {
|
1192
|
+
if (!this._isEnable())
|
1193
|
+
this.Blur();
|
1194
|
+
else if (this.selectOnFocus())
|
1195
|
+
this.Select();
|
1196
|
+
});
|
1197
|
+
this.element.addEventListener('keyup', (event) => {
|
1198
|
+
if (this._isEnable()) {
|
1199
|
+
const { key } = event;
|
1200
|
+
if (key === 'Enter') {
|
1201
|
+
const value = this.coerTextBox().nativeElement.value;
|
1202
|
+
this.onKeyupEnter.emit(value);
|
1203
|
+
this.Blur();
|
1204
|
+
}
|
1205
|
+
}
|
1206
|
+
});
|
1207
|
+
this.element.addEventListener('blur', () => this.Blur());
|
1208
|
+
this.element.addEventListener('input', () => {
|
1209
|
+
Tools.Sleep().then(() => {
|
1210
|
+
const value = this.coerTextBox().nativeElement.value;
|
1211
|
+
if (this._isEnable())
|
1212
|
+
this.onInput.emit(value);
|
1213
|
+
});
|
1214
|
+
});
|
1215
|
+
this.element.addEventListener('paste', () => {
|
1216
|
+
Tools.Sleep().then(() => {
|
1217
|
+
this.SetValue(this._value.toString().trim());
|
1218
|
+
});
|
1219
|
+
});
|
1220
|
+
}
|
1221
|
+
});
|
1222
|
+
}
|
1223
|
+
/** */
|
1224
|
+
Focus(timeout = 0) {
|
1225
|
+
if (this._isLoadingEvent())
|
1226
|
+
return;
|
1227
|
+
else
|
1228
|
+
this._isLoadingEvent.set(true);
|
1229
|
+
Tools.Sleep(timeout).then(() => {
|
1230
|
+
if (this._isEnable()) {
|
1231
|
+
this.element.focus();
|
1232
|
+
}
|
1233
|
+
this._isLoadingEvent.set(false);
|
1234
|
+
});
|
1235
|
+
}
|
1236
|
+
/** */
|
1237
|
+
Select(timeout = 0) {
|
1238
|
+
if (this._isLoadingEvent())
|
1239
|
+
return;
|
1240
|
+
else
|
1241
|
+
this._isLoadingEvent.set(true);
|
1242
|
+
Tools.Sleep(timeout).then(() => {
|
1243
|
+
if (this._isEnable()) {
|
1244
|
+
this.element.focus();
|
1245
|
+
this.element.select();
|
1246
|
+
}
|
1247
|
+
this._isLoadingEvent.set(false);
|
1248
|
+
});
|
1249
|
+
}
|
1250
|
+
/** */
|
1251
|
+
Blur() {
|
1252
|
+
if (this._isLoadingEvent())
|
1253
|
+
return;
|
1254
|
+
else
|
1255
|
+
this._isLoadingEvent.set(true);
|
1256
|
+
Tools.Sleep().then(() => {
|
1257
|
+
if (this.element) {
|
1258
|
+
this.element.blur();
|
1259
|
+
Tools.Sleep().then(() => {
|
1260
|
+
const element = document.querySelector(`#${this._id}-container .mdc-line-ripple--active`);
|
1261
|
+
if (element)
|
1262
|
+
element.classList.remove('mdc-line-ripple--active');
|
1263
|
+
});
|
1264
|
+
}
|
1265
|
+
this._isLoadingEvent.set(false);
|
1266
|
+
});
|
1267
|
+
}
|
1268
|
+
/** */
|
1269
|
+
Clear() {
|
1270
|
+
this.SetValue('');
|
1271
|
+
this.Focus();
|
1272
|
+
}
|
1273
|
+
/** */
|
1274
|
+
ClickSearch() {
|
1275
|
+
Tools.Sleep().then(() => {
|
1276
|
+
if (this._isEnable()) {
|
1277
|
+
if (this.showClearIcon())
|
1278
|
+
this.Focus();
|
1279
|
+
else {
|
1280
|
+
this.onKeyupEnter.emit(this._value);
|
1281
|
+
this.Blur();
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
});
|
1285
|
+
}
|
1286
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerTextBox, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
1287
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerTextBox, selector: "coer-textbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, showSearchIcon: { classPropertyName: "showSearchIcon", publicName: "showSearchIcon", isSignal: true, isRequired: false, transformFunction: null }, showClearIcon: { classPropertyName: "showClearIcon", publicName: "showClearIcon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, marginTop: { classPropertyName: "marginTop", publicName: "marginTop", isSignal: true, isRequired: false, transformFunction: null }, marginRight: { classPropertyName: "marginRight", publicName: "marginRight", isSignal: true, isRequired: false, transformFunction: null }, marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, marginLeft: { classPropertyName: "marginLeft", publicName: "marginLeft", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, selectOnFocus: { classPropertyName: "selectOnFocus", publicName: "selectOnFocus", isSignal: true, isRequired: false, transformFunction: null }, textPosition: { classPropertyName: "textPosition", publicName: "textPosition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onKeyupEnter: "onKeyupEnter", onInput: "onInput", onClickClear: "onClickClear" }, providers: [CONTROL_VALUE(CoerTextBox)], viewQueries: [{ propertyName: "matFormField", first: true, predicate: ["matFormField"], descendants: true, isSignal: true }, { propertyName: "coerTextBox", first: true, predicate: ["coerTextBox"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"coer-text-box\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <input #coerTextBox matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [minLength]=\"minLength()\"\r\n [maxLength]=\"maxLength()\"\r\n [disabled]=\"!_isEnable()\"\r\n [value]=\"_value\"\r\n (input)=\"SetValue(coerTextBox.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight(),\r\n 'text-align': textPosition()\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\">\r\n @if(_showSearchIcon) {\r\n <i class=\"fa-solid fa-magnifying-glass cursor-pointer\" (click)=\"ClickSearch()\"></i>\r\n }\r\n\r\n @else if(_showClearIcon) {\r\n <i class=\"fa-solid fa-xmark cursor-pointer\" (click)=\"Clear(); this.onClickClear.emit();\"></i>\r\n }\r\n\r\n @else if(isInvalid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n </span>\r\n </mat-form-field> \r\n</div>", styles: ["div.coer-text-box *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-text-box .text-blue{color:#0d6efd!important}div.coer-text-box .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-text-box .background-blue{background-color:#0d6efd!important}div.coer-text-box .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-text-box .border-blue{border-color:#0d6efd!important}div.coer-text-box .text-gray{color:#6c757d!important}div.coer-text-box .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-text-box .background-gray{background-color:#6c757d!important}div.coer-text-box .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-text-box .border-gray{border-color:#6c757d!important}div.coer-text-box .text-green{color:#198754!important}div.coer-text-box .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-text-box .background-green{background-color:#198754!important}div.coer-text-box .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-text-box .border-green{border-color:#198754!important}div.coer-text-box .text-yellow{color:#ffc107!important}div.coer-text-box .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-text-box .background-yellow{background-color:#ffc107!important}div.coer-text-box .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-text-box .border-yellow{border-color:#ffc107!important}div.coer-text-box .text-red{color:#dc3545!important}div.coer-text-box .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-text-box .background-red{background-color:#dc3545!important}div.coer-text-box .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-text-box .border-red{border-color:#dc3545!important}div.coer-text-box .text-white{color:#f5f5f5!important}div.coer-text-box .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-text-box .background-white{background-color:#f5f5f5!important}div.coer-text-box .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-text-box .border-white{border-color:#f5f5f5!important}div.coer-text-box .text-black{color:#252525!important}div.coer-text-box .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-text-box .background-black{background-color:#252525!important}div.coer-text-box .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-text-box .border-black{border-color:#252525!important}div.coer-text-box .text-orange{color:#fd6031!important}div.coer-text-box .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-text-box .background-orange{background-color:#fd6031!important}div.coer-text-box .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-text-box .border-orange{border-color:#fd6031!important}div.coer-text-box mat-form-field{position:relative!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:40px!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;height:40px!important;padding:0!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{font-weight:400!important;font-size:17px!important;color:#252525!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-text-box mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-text-box mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;width:30px;height:40px;display:flex;align-items:center;justify-content:center}div.coer-text-box mat-form-field span.icon-container i{font-size:20px!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-text-box mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:40px!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-text-box mat-form-field .placeholder,div.coer-text-box mat-form-field .placeholder *,div.coer-text-box mat-form-field .placeholder-glow,div.coer-text-box mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-text-box mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:transparent!important;padding-left:9px!important;padding-right:9px!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple,coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:before,coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:after{border-bottom-color:transparent!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:28px!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{height:28px!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{margin-top:3px!important;font-size:14px!important}coer-grid table tbody tr td.coer-textbox mat-form-field span.icon-container{transform:translate(-5px,-6px)!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatLabel, selector: "mat-label" }] }); }
|
1288
|
+
}
|
1289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerTextBox, decorators: [{
|
1290
|
+
type: Component,
|
1291
|
+
args: [{ selector: 'coer-textbox', providers: [CONTROL_VALUE(CoerTextBox)], template: "<div class=\"coer-text-box\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <input #coerTextBox matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [minLength]=\"minLength()\"\r\n [maxLength]=\"maxLength()\"\r\n [disabled]=\"!_isEnable()\"\r\n [value]=\"_value\"\r\n (input)=\"SetValue(coerTextBox.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight(),\r\n 'text-align': textPosition()\r\n }\">\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\">\r\n @if(_showSearchIcon) {\r\n <i class=\"fa-solid fa-magnifying-glass cursor-pointer\" (click)=\"ClickSearch()\"></i>\r\n }\r\n\r\n @else if(_showClearIcon) {\r\n <i class=\"fa-solid fa-xmark cursor-pointer\" (click)=\"Clear(); this.onClickClear.emit();\"></i>\r\n }\r\n\r\n @else if(isInvalid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n </span>\r\n </mat-form-field> \r\n</div>", styles: ["div.coer-text-box *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-text-box .text-blue{color:#0d6efd!important}div.coer-text-box .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-text-box .background-blue{background-color:#0d6efd!important}div.coer-text-box .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-text-box .border-blue{border-color:#0d6efd!important}div.coer-text-box .text-gray{color:#6c757d!important}div.coer-text-box .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-text-box .background-gray{background-color:#6c757d!important}div.coer-text-box .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-text-box .border-gray{border-color:#6c757d!important}div.coer-text-box .text-green{color:#198754!important}div.coer-text-box .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-text-box .background-green{background-color:#198754!important}div.coer-text-box .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-text-box .border-green{border-color:#198754!important}div.coer-text-box .text-yellow{color:#ffc107!important}div.coer-text-box .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-text-box .background-yellow{background-color:#ffc107!important}div.coer-text-box .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-text-box .border-yellow{border-color:#ffc107!important}div.coer-text-box .text-red{color:#dc3545!important}div.coer-text-box .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-text-box .background-red{background-color:#dc3545!important}div.coer-text-box .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-text-box .border-red{border-color:#dc3545!important}div.coer-text-box .text-white{color:#f5f5f5!important}div.coer-text-box .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-text-box .background-white{background-color:#f5f5f5!important}div.coer-text-box .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-text-box .border-white{border-color:#f5f5f5!important}div.coer-text-box .text-black{color:#252525!important}div.coer-text-box .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-text-box .background-black{background-color:#252525!important}div.coer-text-box .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-text-box .border-black{border-color:#252525!important}div.coer-text-box .text-orange{color:#fd6031!important}div.coer-text-box .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-text-box .background-orange{background-color:#fd6031!important}div.coer-text-box .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-text-box .border-orange{border-color:#fd6031!important}div.coer-text-box mat-form-field{position:relative!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:40px!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;height:40px!important;padding:0!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{font-weight:400!important;font-size:17px!important;color:#252525!important}div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-text-box mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-text-box mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-text-box mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;width:30px;height:40px;display:flex;align-items:center;justify-content:center}div.coer-text-box mat-form-field span.icon-container i{font-size:20px!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-text-box mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-text-box mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:40px!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-text-box mat-form-field .placeholder,div.coer-text-box mat-form-field .placeholder *,div.coer-text-box mat-form-field .placeholder-glow,div.coer-text-box mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-text-box mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:transparent!important;padding-left:9px!important;padding-right:9px!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple,coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:before,coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple:after{border-bottom-color:transparent!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex{height:28px!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{height:28px!important}coer-grid table tbody tr td.coer-textbox mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix input{margin-top:3px!important;font-size:14px!important}coer-grid table tbody tr td.coer-textbox mat-form-field span.icon-container{transform:translate(-5px,-6px)!important}\n"] }]
|
1292
|
+
}], propDecorators: { value: [{
|
1293
|
+
type: Input
|
1294
|
+
}], id: [{
|
1295
|
+
type: Input
|
1296
|
+
}] } });
|
1297
|
+
|
1298
|
+
class CoerGridExtension extends ControlValue {
|
1299
|
+
constructor() {
|
1300
|
+
super(...arguments);
|
1301
|
+
//Injections
|
1302
|
+
this.alert = inject(CoerAlert);
|
1303
|
+
//Elements
|
1304
|
+
this.inputFile = viewChild.required('inputFileRef');
|
1305
|
+
this.inputSearch = viewChild.required('inputSearch');
|
1306
|
+
this.coerTextboxList = viewChildren(CoerTextBox);
|
1307
|
+
this.coerNumberboxList = viewChildren(CoerNumberBox);
|
1308
|
+
this.coerSelectboxList = viewChildren(CoerSelectbox);
|
1309
|
+
this.coerCheckboxList = viewChildren(CoerCheckbox);
|
1310
|
+
//Variables
|
1311
|
+
this._value = [];
|
1312
|
+
this.value_signal = signal([]);
|
1313
|
+
this._gridSearch = signal('');
|
1314
|
+
this._isLoading = true;
|
1315
|
+
this._isLoadingMessage = true;
|
1316
|
+
this._id = Tools.GetGuid('coer-grid');
|
1317
|
+
this._expandedGroups = [];
|
1318
|
+
this._enableAnimations = false;
|
1319
|
+
this._indexFocus = signal(0);
|
1320
|
+
this._sort = signal({ columnName: '', direction: 'none', icon: '' });
|
1321
|
+
//Generic Tools
|
1322
|
+
this.GetNumericFormat = Tools.GetNumericFormat;
|
1323
|
+
this.GetDateFormat = DateTime.GetDateFormat;
|
1324
|
+
//Inputs
|
1325
|
+
this.columns = input([]);
|
1326
|
+
this.cleanColumnName = input(true);
|
1327
|
+
this.addButton = { show: false };
|
1328
|
+
this.exportButton = { show: false };
|
1329
|
+
this.importButton = { show: false };
|
1330
|
+
this.search = { show: false, ignore: false };
|
1331
|
+
this.buttonByRow = {};
|
1332
|
+
this.checkbox = { show: false };
|
1333
|
+
this.tooltipByRow = input('');
|
1334
|
+
this.isLoading = input(false);
|
1335
|
+
this.isDisabled = input(false);
|
1336
|
+
this.rowsByPage = input(50);
|
1337
|
+
this.groupBy = input('');
|
1338
|
+
this.showColumnGrouped = input(false);
|
1339
|
+
this.rowsByGroup = input(50);
|
1340
|
+
this.isInvisible = input(false);
|
1341
|
+
this.showFooter = input(true);
|
1342
|
+
this.width = input('100%');
|
1343
|
+
this.MinWidth = input('250px');
|
1344
|
+
this.MaxWidth = input('100%');
|
1345
|
+
this.height = input('350px');
|
1346
|
+
this.minHeight = input('140px');
|
1347
|
+
this.maxHeight = input('100vh');
|
1348
|
+
this.margin = input('auto');
|
1349
|
+
this.enableSort = input(true);
|
1350
|
+
this.enableRowFocus = input(true);
|
1351
|
+
//Outputs
|
1352
|
+
this.onClickAdd = output();
|
1353
|
+
this.onClickImport = output();
|
1354
|
+
this.onClickExport = output();
|
1355
|
+
this.onClickRow = output();
|
1356
|
+
this.onDoubleClickRow = output();
|
1357
|
+
this.onClickDeleteRow = output();
|
1358
|
+
this.onClickEditRow = output();
|
1359
|
+
this.onClickGoRow = output();
|
1360
|
+
this.onKeyupEnter = output();
|
1361
|
+
this.onKeyupEnterLast = output();
|
1362
|
+
this.onSwitchChange = output();
|
1363
|
+
this.onTextboxChange = output();
|
1364
|
+
this.onSelectboxChange = output();
|
1365
|
+
this.onCheckboxChange = output();
|
1366
|
+
//computed
|
1367
|
+
this._isDisabled = computed(() => {
|
1368
|
+
return this.isDisabled() || this.isLoading() || this.isInvisible();
|
1369
|
+
});
|
1370
|
+
//computed
|
1371
|
+
this._isGrouped = computed(() => {
|
1372
|
+
return this.groupBy().length > 0;
|
1373
|
+
});
|
1374
|
+
//computed
|
1375
|
+
this.gridColumns = computed(() => {
|
1376
|
+
const SET_COLUMNS = new Set();
|
1377
|
+
//Has filter columns?
|
1378
|
+
if (this.columns().length > 0) {
|
1379
|
+
for (const { property } of this.columns()) {
|
1380
|
+
SET_COLUMNS.add(property);
|
1381
|
+
}
|
1382
|
+
}
|
1383
|
+
//Get all columns
|
1384
|
+
else
|
1385
|
+
for (const row of this.value_signal()) {
|
1386
|
+
for (const property in row) {
|
1387
|
+
SET_COLUMNS.add(property);
|
1388
|
+
}
|
1389
|
+
}
|
1390
|
+
//Remove indexRow column
|
1391
|
+
if (SET_COLUMNS.has('indexRow')) {
|
1392
|
+
SET_COLUMNS.delete('indexRow');
|
1393
|
+
}
|
1394
|
+
//Remove groupBy column
|
1395
|
+
if (this._isGrouped() && !this.showColumnGrouped() && SET_COLUMNS.has(this.groupBy())) {
|
1396
|
+
SET_COLUMNS.delete(this.groupBy());
|
1397
|
+
}
|
1398
|
+
//Set index column
|
1399
|
+
let indexColumn = 0;
|
1400
|
+
return Array.from(SET_COLUMNS).map(property => Tools.BreakReference({
|
1401
|
+
columnName: property,
|
1402
|
+
indexColumn: indexColumn++,
|
1403
|
+
width: this._GetColumnConfig(property)?.width || 'auto'
|
1404
|
+
}));
|
1405
|
+
});
|
1406
|
+
//computed
|
1407
|
+
this.gridDataSource = computed(() => {
|
1408
|
+
let list = this.gridDataSourceFiltered();
|
1409
|
+
//It's Grouped?
|
1410
|
+
if (this._isGrouped()) {
|
1411
|
+
//let indexRow = 0;
|
1412
|
+
let indexGroup = 0;
|
1413
|
+
const SET_COLUMN = new Set();
|
1414
|
+
for (const row of list) {
|
1415
|
+
SET_COLUMN.add(row[this.groupBy()]);
|
1416
|
+
}
|
1417
|
+
const DATA_SOURCE_GROPUED = [];
|
1418
|
+
for (const column of SET_COLUMN) {
|
1419
|
+
DATA_SOURCE_GROPUED.push({
|
1420
|
+
groupBy: column,
|
1421
|
+
indexGroup: indexGroup++,
|
1422
|
+
length: list.filter((item) => item[this.groupBy()] == column).length,
|
1423
|
+
rows: [...list]
|
1424
|
+
.filter((item) => item[this.groupBy()] == column)
|
1425
|
+
.splice(0, this.rowsByGroup())
|
1426
|
+
//.map((item: any) => Object.assign({ indexRow: indexRow++ }, item))
|
1427
|
+
});
|
1428
|
+
}
|
1429
|
+
//Response by group
|
1430
|
+
return [...DATA_SOURCE_GROPUED].splice(0, this.rowsByPage());
|
1431
|
+
}
|
1432
|
+
//Response
|
1433
|
+
return [{
|
1434
|
+
groupBy: 'Not Grouped',
|
1435
|
+
indexGroup: -1,
|
1436
|
+
length: -1,
|
1437
|
+
rows: [...list].splice(0, this.rowsByPage())
|
1438
|
+
}];
|
1439
|
+
});
|
1440
|
+
//computed
|
1441
|
+
this.gridDataSourceFiltered = computed(() => {
|
1442
|
+
let list = [];
|
1443
|
+
const dataSource = Tools.BreakReference(this.value_signal());
|
1444
|
+
//Ignore Filter
|
1445
|
+
if (this._gridSearch() == '' || this.search?.ignore) {
|
1446
|
+
list = dataSource;
|
1447
|
+
}
|
1448
|
+
//Filter by search
|
1449
|
+
else {
|
1450
|
+
const SET_ROW = new Set();
|
1451
|
+
let listFiltered = [];
|
1452
|
+
for (const { columnName } of this.gridColumns()) {
|
1453
|
+
listFiltered = dataSource.filter((item) => !SET_ROW.has(item['indexRow'])
|
1454
|
+
&& String(item[Tools.FirstCharToLower(columnName)]).trim().toUpperCase().includes(String(this._gridSearch()).trim().toUpperCase()));
|
1455
|
+
for (const { indexRow } of listFiltered) {
|
1456
|
+
SET_ROW.add(indexRow);
|
1457
|
+
}
|
1458
|
+
list = Tools.BreakReference(list.concat(listFiltered));
|
1459
|
+
}
|
1460
|
+
}
|
1461
|
+
return Tools.BreakReference(list);
|
1462
|
+
});
|
1463
|
+
/** Get Column Configuration */
|
1464
|
+
this._GetColumnConfig = (columnName) => {
|
1465
|
+
return this.columns().find(x => x.property.replaceAll(' ', '').toUpperCase() == columnName.replaceAll(' ', '').toUpperCase());
|
1466
|
+
};
|
1467
|
+
/** Clean Name or get alias */
|
1468
|
+
this._GetColumnName = (columnName) => {
|
1469
|
+
const columnConfig = this._GetColumnConfig(columnName);
|
1470
|
+
//Get Alias
|
1471
|
+
if (columnConfig && columnConfig.alias && columnConfig.alias.length > 0) {
|
1472
|
+
return columnConfig.alias;
|
1473
|
+
}
|
1474
|
+
//Clean headerName
|
1475
|
+
if (this.cleanColumnName() && columnName.length > 0) {
|
1476
|
+
columnName = Tools.FirstCharToLower(columnName);
|
1477
|
+
const charArray = [];
|
1478
|
+
for (const char of columnName) {
|
1479
|
+
if (char === char.toUpperCase())
|
1480
|
+
charArray.push(' ');
|
1481
|
+
charArray.push(char);
|
1482
|
+
}
|
1483
|
+
charArray[0] = charArray[0].toUpperCase();
|
1484
|
+
columnName = charArray.join('');
|
1485
|
+
}
|
1486
|
+
return columnName.trim();
|
1487
|
+
};
|
1488
|
+
/** */
|
1489
|
+
this._GetShortIcon = (columnName) => {
|
1490
|
+
return this._sort().columnName == columnName ? this._sort().icon : '';
|
1491
|
+
};
|
1492
|
+
/** */
|
1493
|
+
this._GetId = (indexRow, indexColumn, suffix = '') => {
|
1494
|
+
if (suffix.length > 0)
|
1495
|
+
suffix = `-${suffix}`;
|
1496
|
+
return `${this._id}-row${indexRow}column${indexColumn}${suffix}`;
|
1497
|
+
};
|
1498
|
+
/** */
|
1499
|
+
this._GetCellValue = (row, columnName) => {
|
1500
|
+
return row[Tools.FirstCharToLower(columnName).replaceAll(' ', '')];
|
1501
|
+
};
|
1502
|
+
/** */
|
1503
|
+
this._GetTooltip = (prefix, row, suffix = '') => {
|
1504
|
+
let column = Tools.FirstCharToLower(this.tooltipByRow()).replaceAll(' ', '');
|
1505
|
+
if (suffix.length > 0) {
|
1506
|
+
suffix = ` ${suffix}`;
|
1507
|
+
}
|
1508
|
+
return this.tooltipByRow().length > 0
|
1509
|
+
? `${prefix} ${row[column]}${suffix}`
|
1510
|
+
: `${prefix}${suffix}`;
|
1511
|
+
};
|
1512
|
+
/** */
|
1513
|
+
this._HideRow = (group) => {
|
1514
|
+
return (this._isGrouped() ? !(this._expandedGroups.some(x => x == group.groupBy)) : false);
|
1515
|
+
};
|
1516
|
+
}
|
1517
|
+
//getter
|
1518
|
+
get _height() {
|
1519
|
+
let height = this.height();
|
1520
|
+
if (height == 'full') {
|
1521
|
+
const TOOLBAR = 45;
|
1522
|
+
const PAGE_HEADER = 70;
|
1523
|
+
const GRID_HEADER = document.getElementById(`${this._id}-header`);
|
1524
|
+
const HEADER = (GRID_HEADER && GRID_HEADER.children.length > 0) ? 50 : 0;
|
1525
|
+
const MARGIN = 30;
|
1526
|
+
const PADDING = 20;
|
1527
|
+
const FOOTER = this.showFooter() ? 24.5 : 0;
|
1528
|
+
height = (Screen.WINDOW_HEIGHT - TOOLBAR - PAGE_HEADER - MARGIN - HEADER - PADDING - FOOTER) + 'px';
|
1529
|
+
}
|
1530
|
+
return height;
|
1531
|
+
}
|
1532
|
+
//getter
|
1533
|
+
get _onlyOneCheck() {
|
1534
|
+
return Tools.IsNotNull(this.checkbox.onlyOneCheck) && this.checkbox.onlyOneCheck;
|
1535
|
+
}
|
1536
|
+
ngAfterViewInit() {
|
1537
|
+
Tools.Sleep().then(() => {
|
1538
|
+
this._enableAnimations = true;
|
1539
|
+
this._isLoading = false;
|
1540
|
+
this._isLoadingMessage = false;
|
1541
|
+
});
|
1542
|
+
}
|
1543
|
+
//ControlValueAccessor
|
1544
|
+
SetValue(value) {
|
1545
|
+
let indexRow = 0;
|
1546
|
+
if (!Tools.IsNotNull(value))
|
1547
|
+
value = [];
|
1548
|
+
const dataSource = Tools.BreakReference(value).map((item) => Object.assign({ checked: false }, { ...item }, { indexRow: indexRow++ }));
|
1549
|
+
this._UpdateValue(dataSource);
|
1550
|
+
this._value = dataSource;
|
1551
|
+
this.value_signal.set(dataSource);
|
1552
|
+
}
|
1553
|
+
//ControlValueAccessor
|
1554
|
+
writeValue(value) {
|
1555
|
+
let indexRow = 0;
|
1556
|
+
if (!Tools.IsNotNull(value))
|
1557
|
+
value = [];
|
1558
|
+
const dataSource = Tools.BreakReference(value).map((item) => Object.assign({ checked: false }, { ...item }, { indexRow: indexRow++ }));
|
1559
|
+
this._value = dataSource;
|
1560
|
+
this.value_signal.set(dataSource);
|
1561
|
+
}
|
1562
|
+
/** */
|
1563
|
+
_IsCellType(property, data, type) {
|
1564
|
+
let response = false;
|
1565
|
+
const columnConfig = this._GetColumnConfig(property);
|
1566
|
+
const value = data[property];
|
1567
|
+
const row = Tools.BreakReference(data);
|
1568
|
+
if (columnConfig) {
|
1569
|
+
if (['coerTextbox', 'coerNumberbox', 'coerSelectbox', 'coerSwitch'].includes(type)) {
|
1570
|
+
const inputConfig = columnConfig;
|
1571
|
+
response = inputConfig.hasOwnProperty(type)
|
1572
|
+
&& typeof inputConfig[type] === 'function'
|
1573
|
+
&& inputConfig[type]({ property, row, value }).isInput;
|
1574
|
+
}
|
1575
|
+
else
|
1576
|
+
switch (type) {
|
1577
|
+
case 'number': {
|
1578
|
+
if (typeof columnConfig.typeNumber === 'boolean') {
|
1579
|
+
response = columnConfig.typeNumber;
|
1580
|
+
}
|
1581
|
+
else if (typeof columnConfig.typeNumber === 'function') {
|
1582
|
+
response = (data === null) ? false : columnConfig.typeNumber({ property, row, value });
|
1583
|
+
}
|
1584
|
+
break;
|
1585
|
+
}
|
1586
|
+
case 'date': {
|
1587
|
+
if (data === null)
|
1588
|
+
return false;
|
1589
|
+
if (typeof columnConfig.typeDate === 'boolean') {
|
1590
|
+
response = columnConfig.typeDate;
|
1591
|
+
}
|
1592
|
+
else if (typeof columnConfig.typeDate === 'function') {
|
1593
|
+
response = (data === null) ? false : columnConfig.typeDate({ property, row, value });
|
1594
|
+
}
|
1595
|
+
break;
|
1596
|
+
}
|
1597
|
+
case 'template': {
|
1598
|
+
if (data === null)
|
1599
|
+
return false;
|
1600
|
+
response = (typeof columnConfig.template === 'string') || (typeof columnConfig.template === 'function');
|
1601
|
+
break;
|
1602
|
+
}
|
1603
|
+
}
|
1604
|
+
}
|
1605
|
+
return response;
|
1606
|
+
}
|
1607
|
+
/** */
|
1608
|
+
_IsCellColor(property, data, color) {
|
1609
|
+
let response = false;
|
1610
|
+
const columnConfig = this._GetColumnConfig(property);
|
1611
|
+
if (columnConfig) {
|
1612
|
+
if (typeof columnConfig[color] === 'boolean') {
|
1613
|
+
response = columnConfig[color];
|
1614
|
+
}
|
1615
|
+
else if (typeof columnConfig[color] === 'function') {
|
1616
|
+
response = columnConfig[color]({
|
1617
|
+
property,
|
1618
|
+
row: Tools.BreakReference(data),
|
1619
|
+
value: data[property]
|
1620
|
+
});
|
1621
|
+
}
|
1622
|
+
}
|
1623
|
+
return response;
|
1624
|
+
}
|
1625
|
+
/** */
|
1626
|
+
GetAttribute(property, data, attribute, type) {
|
1627
|
+
const columnConfig = this._GetColumnConfig(property);
|
1628
|
+
const value = Tools.IsNotNull(data) ? data[property] : null;
|
1629
|
+
const row = Tools.BreakReference(data);
|
1630
|
+
if (columnConfig) {
|
1631
|
+
if (type === 'defaul-cell') {
|
1632
|
+
switch (attribute) {
|
1633
|
+
case 'textAlign': {
|
1634
|
+
return columnConfig?.textAlign || 'left';
|
1635
|
+
}
|
1636
|
+
case 'template': {
|
1637
|
+
const inputConfig = columnConfig;
|
1638
|
+
if (inputConfig.hasOwnProperty(attribute)) {
|
1639
|
+
if (typeof inputConfig[attribute] === 'string') {
|
1640
|
+
return inputConfig[attribute];
|
1641
|
+
}
|
1642
|
+
else if (typeof inputConfig[attribute] === 'function') {
|
1643
|
+
return inputConfig[attribute]({ property, row, value }) || '';
|
1644
|
+
}
|
1645
|
+
}
|
1646
|
+
}
|
1647
|
+
}
|
1648
|
+
}
|
1649
|
+
else if (['coerTextbox', 'coerNumberbox', 'coerSelectbox', 'coerSwitch'].includes(type)) {
|
1650
|
+
const inputConfig = columnConfig;
|
1651
|
+
if (inputConfig.hasOwnProperty(type) && typeof inputConfig[type] === 'function') {
|
1652
|
+
return inputConfig[type]({ property, row, value })[attribute] || null;
|
1653
|
+
}
|
1654
|
+
}
|
1655
|
+
}
|
1656
|
+
return null;
|
1657
|
+
}
|
1658
|
+
/** */
|
1659
|
+
ButtonByRow(property, data = null) {
|
1660
|
+
let response = false;
|
1661
|
+
const buttonByRow = this.buttonByRow;
|
1662
|
+
const row = Tools.IsNotNull(data) ? Tools.BreakReference(data) : null;
|
1663
|
+
if (buttonByRow.hasOwnProperty(property)) {
|
1664
|
+
if (row === null) {
|
1665
|
+
response = (typeof buttonByRow[property] === 'boolean') ? buttonByRow[property] : true;
|
1666
|
+
}
|
1667
|
+
else if (typeof buttonByRow[property] === 'boolean') {
|
1668
|
+
response = buttonByRow[property];
|
1669
|
+
}
|
1670
|
+
else if (typeof buttonByRow[property] === 'function') {
|
1671
|
+
response = buttonByRow[property]({ property, row, value: null });
|
1672
|
+
}
|
1673
|
+
}
|
1674
|
+
return response ? (this._value && this._value.length > 0) : false;
|
1675
|
+
}
|
1676
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerGridExtension, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
1677
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "17.3.12", type: CoerGridExtension, selector: "coer-grid-extension", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, cleanColumnName: { classPropertyName: "cleanColumnName", publicName: "cleanColumnName", isSignal: true, isRequired: false, transformFunction: null }, addButton: { classPropertyName: "addButton", publicName: "addButton", isSignal: false, isRequired: false, transformFunction: null }, exportButton: { classPropertyName: "exportButton", publicName: "exportButton", isSignal: false, isRequired: false, transformFunction: null }, importButton: { classPropertyName: "importButton", publicName: "importButton", isSignal: false, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: false, isRequired: false, transformFunction: null }, buttonByRow: { classPropertyName: "buttonByRow", publicName: "buttonByRow", isSignal: false, isRequired: false, transformFunction: null }, checkbox: { classPropertyName: "checkbox", publicName: "checkbox", isSignal: false, isRequired: false, transformFunction: null }, tooltipByRow: { classPropertyName: "tooltipByRow", publicName: "tooltipByRow", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, rowsByPage: { classPropertyName: "rowsByPage", publicName: "rowsByPage", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, showColumnGrouped: { classPropertyName: "showColumnGrouped", publicName: "showColumnGrouped", isSignal: true, isRequired: false, transformFunction: null }, rowsByGroup: { classPropertyName: "rowsByGroup", publicName: "rowsByGroup", isSignal: true, isRequired: false, transformFunction: null }, isInvisible: { classPropertyName: "isInvisible", publicName: "isInvisible", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, MinWidth: { classPropertyName: "MinWidth", publicName: "MinWidth", isSignal: true, isRequired: false, transformFunction: null }, MaxWidth: { classPropertyName: "MaxWidth", publicName: "MaxWidth", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, margin: { classPropertyName: "margin", publicName: "margin", isSignal: true, isRequired: false, transformFunction: null }, enableSort: { classPropertyName: "enableSort", publicName: "enableSort", isSignal: true, isRequired: false, transformFunction: null }, enableRowFocus: { classPropertyName: "enableRowFocus", publicName: "enableRowFocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onClickAdd: "onClickAdd", onClickImport: "onClickImport", onClickExport: "onClickExport", onClickRow: "onClickRow", onDoubleClickRow: "onDoubleClickRow", onClickDeleteRow: "onClickDeleteRow", onClickEditRow: "onClickEditRow", onClickGoRow: "onClickGoRow", onKeyupEnter: "onKeyupEnter", onKeyupEnterLast: "onKeyupEnterLast", onSwitchChange: "onSwitchChange", onTextboxChange: "onTextboxChange", onSelectboxChange: "onSelectboxChange", onCheckboxChange: "onCheckboxChange" }, viewQueries: [{ propertyName: "inputFile", first: true, predicate: ["inputFileRef"], descendants: true, isSignal: true }, { propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }, { propertyName: "coerTextboxList", predicate: CoerTextBox, descendants: true, isSignal: true }, { propertyName: "coerNumberboxList", predicate: CoerNumberBox, descendants: true, isSignal: true }, { propertyName: "coerSelectboxList", predicate: CoerSelectbox, descendants: true, isSignal: true }, { propertyName: "coerCheckboxList", predicate: CoerCheckbox, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
1678
|
+
}
|
1679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerGridExtension, decorators: [{
|
1680
|
+
type: Component,
|
1681
|
+
args: [{
|
1682
|
+
selector: 'coer-grid-extension',
|
1683
|
+
template: ''
|
1684
|
+
}]
|
1685
|
+
}], propDecorators: { addButton: [{
|
1686
|
+
type: Input
|
1687
|
+
}], exportButton: [{
|
1688
|
+
type: Input
|
1689
|
+
}], importButton: [{
|
1690
|
+
type: Input
|
1691
|
+
}], search: [{
|
1692
|
+
type: Input
|
1693
|
+
}], buttonByRow: [{
|
1694
|
+
type: Input
|
1695
|
+
}], checkbox: [{
|
1696
|
+
type: Input
|
1697
|
+
}] } });
|
1698
|
+
|
1699
|
+
class CoerSwitch extends ControlValue {
|
1700
|
+
constructor() {
|
1701
|
+
super(...arguments);
|
1702
|
+
//Variables
|
1703
|
+
this._value = false;
|
1704
|
+
this._id = Tools.GetGuid('coer-switch');
|
1705
|
+
this._tooltip = '';
|
1706
|
+
this.id = '';
|
1707
|
+
this.label = input('');
|
1708
|
+
this.labelPosition = input('after');
|
1709
|
+
this.isDisabled = input(false);
|
1710
|
+
this.isLoading = input(false);
|
1711
|
+
this.isInvisible = input(false);
|
1712
|
+
this.tooltipPosition = input('top');
|
1713
|
+
//Outputs
|
1714
|
+
this.onChange = output();
|
1715
|
+
//conmputed
|
1716
|
+
this._isEnable = computed(() => {
|
1717
|
+
return !this.isLoading() && !this.isDisabled() && !this.isInvisible();
|
1718
|
+
});
|
1719
|
+
}
|
1720
|
+
//Inputs
|
1721
|
+
set value(value) {
|
1722
|
+
if (Tools.IsNull(value))
|
1723
|
+
value = false;
|
1724
|
+
this.SetValue(value);
|
1725
|
+
}
|
1726
|
+
set tooltip(value) {
|
1727
|
+
this._tooltip = value;
|
1728
|
+
if (value && this._tooltipElement) {
|
1729
|
+
this._tooltipElement.setContent({ '.tooltip-inner': this._tooltip });
|
1730
|
+
}
|
1731
|
+
}
|
1732
|
+
ngOnInit() {
|
1733
|
+
Tools.Sleep().then(() => {
|
1734
|
+
const htmlElement = document.getElementById(this._id);
|
1735
|
+
if (htmlElement) {
|
1736
|
+
htmlElement.addEventListener('mouseleave', () => {
|
1737
|
+
if (this._tooltipElement)
|
1738
|
+
this._tooltipElement.hide();
|
1739
|
+
});
|
1740
|
+
this._tooltipElement = new Tooltip(htmlElement, {
|
1741
|
+
html: true,
|
1742
|
+
title: this._tooltip,
|
1743
|
+
placement: this.tooltipPosition()
|
1744
|
+
});
|
1745
|
+
}
|
1746
|
+
});
|
1747
|
+
}
|
1748
|
+
ngOnDestroy() {
|
1749
|
+
if (this._tooltipElement) {
|
1750
|
+
Tools.Sleep().then(() => this._tooltipElement.dispose());
|
1751
|
+
}
|
1752
|
+
}
|
1753
|
+
//getter
|
1754
|
+
get value() {
|
1755
|
+
return this._value;
|
1756
|
+
}
|
1757
|
+
/** */
|
1758
|
+
Focus() {
|
1759
|
+
Tools.Sleep().then(() => {
|
1760
|
+
if (this._isEnable())
|
1761
|
+
this.coerSwitch.focus();
|
1762
|
+
});
|
1763
|
+
}
|
1764
|
+
/** */
|
1765
|
+
Change(value) {
|
1766
|
+
this.SetValue(value);
|
1767
|
+
this.onChange.emit(value);
|
1768
|
+
}
|
1769
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerSwitch, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
1770
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: CoerSwitch, selector: "coer-switch", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, isInvisible: { classPropertyName: "isInvisible", publicName: "isInvisible", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, providers: [CONTROL_VALUE(CoerSwitch)], viewQueries: [{ propertyName: "coerSwitch", first: true, predicate: ["coerSwitch"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"{ 'coer-switch': true, 'placeholder-glow': isLoading(), 'invisible': isInvisible() }\">\r\n <div [id]=\"_id\" [ngClass]=\"{ 'placeholder': isLoading() }\">\r\n <mat-slide-toggle\r\n #coerSwitch\r\n [checked]=\"_value\"\r\n [disabled]=\"!_isEnable()\"\r\n [labelPosition]=\"labelPosition()\"\r\n (change)=\"Change($event.checked)\"\r\n >{{ label() }}</mat-slide-toggle>\r\n </div>\r\n</div>", styles: ["div.coer-switch{height:40px;display:flex!important;align-items:center!important;position:relative!important}div.coer-switch *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-switch .text-blue{color:#0d6efd!important}div.coer-switch .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-switch .background-blue{background-color:#0d6efd!important}div.coer-switch .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-switch .border-blue{border-color:#0d6efd!important}div.coer-switch .text-gray{color:#6c757d!important}div.coer-switch .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-switch .background-gray{background-color:#6c757d!important}div.coer-switch .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-switch .border-gray{border-color:#6c757d!important}div.coer-switch .text-green{color:#198754!important}div.coer-switch .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-switch .background-green{background-color:#198754!important}div.coer-switch .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-switch .border-green{border-color:#198754!important}div.coer-switch .text-yellow{color:#ffc107!important}div.coer-switch .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-switch .background-yellow{background-color:#ffc107!important}div.coer-switch .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-switch .border-yellow{border-color:#ffc107!important}div.coer-switch .text-red{color:#dc3545!important}div.coer-switch .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-switch .background-red{background-color:#dc3545!important}div.coer-switch .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-switch .border-red{border-color:#dc3545!important}div.coer-switch .text-white{color:#f5f5f5!important}div.coer-switch .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-switch .background-white{background-color:#f5f5f5!important}div.coer-switch .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-switch .border-white{border-color:#f5f5f5!important}div.coer-switch .text-black{color:#252525!important}div.coer-switch .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-switch .background-black{background-color:#252525!important}div.coer-switch .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-switch .border-black{border-color:#252525!important}div.coer-switch .text-orange{color:#fd6031!important}div.coer-switch .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-switch .background-orange{background-color:#fd6031!important}div.coer-switch .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-switch .border-orange{border-color:#fd6031!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field button div.mdc-switch__track:after{background-color:#fd6031!important;filter:opacity(.6)!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field button div.mdc-switch__handle-track div.mdc-switch__ripple{width:30px!important;height:30px!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field button.mdc-switch.mdc-switch--selected.mdc-switch--checked div.mdc-switch__handle-track div.mdc-switch__handle div.mdc-switch__icons{background-color:#fd6031!important;border-radius:20px!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field label,div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field label::selection{font-weight:400;background-color:transparent!important;font-size:17px!important}div.coer-switch .placeholder{display:flex!important;height:27px!important}div.coer-switch .placeholder,div.coer-switch .placeholder *,div.coer-switch .placeholder-glow,div.coer-switch .placeholder-glow *{cursor:wait!important}coer-grid div.coer-switch{height:20px!important;justify-content:center!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2$3.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }] }); }
|
1771
|
+
}
|
1772
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerSwitch, decorators: [{
|
1773
|
+
type: Component,
|
1774
|
+
args: [{ selector: 'coer-switch', providers: [CONTROL_VALUE(CoerSwitch)], template: "<div [ngClass]=\"{ 'coer-switch': true, 'placeholder-glow': isLoading(), 'invisible': isInvisible() }\">\r\n <div [id]=\"_id\" [ngClass]=\"{ 'placeholder': isLoading() }\">\r\n <mat-slide-toggle\r\n #coerSwitch\r\n [checked]=\"_value\"\r\n [disabled]=\"!_isEnable()\"\r\n [labelPosition]=\"labelPosition()\"\r\n (change)=\"Change($event.checked)\"\r\n >{{ label() }}</mat-slide-toggle>\r\n </div>\r\n</div>", styles: ["div.coer-switch{height:40px;display:flex!important;align-items:center!important;position:relative!important}div.coer-switch *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-switch .text-blue{color:#0d6efd!important}div.coer-switch .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-switch .background-blue{background-color:#0d6efd!important}div.coer-switch .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-switch .border-blue{border-color:#0d6efd!important}div.coer-switch .text-gray{color:#6c757d!important}div.coer-switch .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-switch .background-gray{background-color:#6c757d!important}div.coer-switch .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-switch .border-gray{border-color:#6c757d!important}div.coer-switch .text-green{color:#198754!important}div.coer-switch .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-switch .background-green{background-color:#198754!important}div.coer-switch .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-switch .border-green{border-color:#198754!important}div.coer-switch .text-yellow{color:#ffc107!important}div.coer-switch .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-switch .background-yellow{background-color:#ffc107!important}div.coer-switch .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-switch .border-yellow{border-color:#ffc107!important}div.coer-switch .text-red{color:#dc3545!important}div.coer-switch .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-switch .background-red{background-color:#dc3545!important}div.coer-switch .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-switch .border-red{border-color:#dc3545!important}div.coer-switch .text-white{color:#f5f5f5!important}div.coer-switch .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-switch .background-white{background-color:#f5f5f5!important}div.coer-switch .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-switch .border-white{border-color:#f5f5f5!important}div.coer-switch .text-black{color:#252525!important}div.coer-switch .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-switch .background-black{background-color:#252525!important}div.coer-switch .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-switch .border-black{border-color:#252525!important}div.coer-switch .text-orange{color:#fd6031!important}div.coer-switch .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-switch .background-orange{background-color:#fd6031!important}div.coer-switch .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-switch .border-orange{border-color:#fd6031!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field button div.mdc-switch__track:after{background-color:#fd6031!important;filter:opacity(.6)!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field button div.mdc-switch__handle-track div.mdc-switch__ripple{width:30px!important;height:30px!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field button.mdc-switch.mdc-switch--selected.mdc-switch--checked div.mdc-switch__handle-track div.mdc-switch__handle div.mdc-switch__icons{background-color:#fd6031!important;border-radius:20px!important}div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field label,div.coer-switch mat-slide-toggle div.mdc-form-field.mat-internal-form-field label::selection{font-weight:400;background-color:transparent!important;font-size:17px!important}div.coer-switch .placeholder{display:flex!important;height:27px!important}div.coer-switch .placeholder,div.coer-switch .placeholder *,div.coer-switch .placeholder-glow,div.coer-switch .placeholder-glow *{cursor:wait!important}coer-grid div.coer-switch{height:20px!important;justify-content:center!important}\n"] }]
|
1775
|
+
}], propDecorators: { coerSwitch: [{
|
1776
|
+
type: ViewChild,
|
1777
|
+
args: ['coerSwitch']
|
1778
|
+
}], value: [{
|
1779
|
+
type: Input
|
1780
|
+
}], id: [{
|
1781
|
+
type: Input
|
1782
|
+
}], tooltip: [{
|
1783
|
+
type: Input
|
1784
|
+
}] } });
|
1785
|
+
|
1786
|
+
class CoerGrid extends CoerGridExtension {
|
1787
|
+
constructor() {
|
1788
|
+
super(...arguments);
|
1789
|
+
//computed
|
1790
|
+
this.dataSource = computed(() => {
|
1791
|
+
return Tools.BreakReference(this.value_signal()).map(item => {
|
1792
|
+
if (item.hasOwnProperty('checked'))
|
1793
|
+
delete item.checked;
|
1794
|
+
if (item.hasOwnProperty('indexRow'))
|
1795
|
+
delete item.indexRow;
|
1796
|
+
return item;
|
1797
|
+
});
|
1798
|
+
});
|
1799
|
+
//computed
|
1800
|
+
this.selectedItems = computed(() => {
|
1801
|
+
return Tools.BreakReference(this.value_signal()).filter(item => item.checked).map(item => {
|
1802
|
+
if (item.hasOwnProperty('checked'))
|
1803
|
+
delete item.checked;
|
1804
|
+
if (item.hasOwnProperty('indexRow'))
|
1805
|
+
delete item.indexRow;
|
1806
|
+
return item;
|
1807
|
+
});
|
1808
|
+
});
|
1809
|
+
//computed
|
1810
|
+
this.gridLength = computed(() => {
|
1811
|
+
return {
|
1812
|
+
dataSource: this.value_signal()?.length || 0,
|
1813
|
+
dataSourceFiltered: this.gridDataSourceFiltered()?.length || 0,
|
1814
|
+
dataSourceSelected: this.selectedItems()?.length || 0
|
1815
|
+
};
|
1816
|
+
});
|
1817
|
+
}
|
1818
|
+
//getter
|
1819
|
+
get isValid() {
|
1820
|
+
return (this.coerTextboxList().length > 0 ? this.coerTextboxList().every(x => !x.isInvalid()) : true)
|
1821
|
+
&& (this.coerNumberboxList().length > 0 ? this.coerNumberboxList().every(x => !x.isInvalid()) : true)
|
1822
|
+
&& (this.coerSelectboxList().length > 0 ? this.coerSelectboxList().every(x => !x.isInvalid()) : true);
|
1823
|
+
}
|
1824
|
+
//computed
|
1825
|
+
//protected _columnsFiltered = computed<IGridHeader[]>(() => {
|
1826
|
+
// return this.isGrouped() && !this.showColumnGrouped
|
1827
|
+
// ? this._columns().filter(x => x.columnName.toUpperCase() != this.groupBy.toUpperCase())
|
1828
|
+
// : this._columns();
|
1829
|
+
//});
|
1830
|
+
/** */
|
1831
|
+
FocusSearch() {
|
1832
|
+
Tools.Sleep(0).then(() => {
|
1833
|
+
if (this.inputSearch)
|
1834
|
+
this.inputSearch().Focus();
|
1835
|
+
});
|
1836
|
+
}
|
1837
|
+
/** */
|
1838
|
+
SelectSearch() {
|
1839
|
+
Tools.Sleep(0).then(() => {
|
1840
|
+
if (this.inputSearch)
|
1841
|
+
this.inputSearch().Select();
|
1842
|
+
});
|
1843
|
+
}
|
1844
|
+
/** */
|
1845
|
+
GetRowBy(callback) {
|
1846
|
+
const row = this._value.find(callback);
|
1847
|
+
return (row === undefined) ? null : row;
|
1848
|
+
}
|
1849
|
+
/** */
|
1850
|
+
async Import(event = null) {
|
1851
|
+
if (this.importButton?.preventDefault) {
|
1852
|
+
this.onClickImport.emit({ data: [], file: null });
|
1853
|
+
return;
|
1854
|
+
}
|
1855
|
+
if (event === null) {
|
1856
|
+
this.inputFile().nativeElement.value = null;
|
1857
|
+
this.inputFile().nativeElement.click();
|
1858
|
+
return;
|
1859
|
+
}
|
1860
|
+
else if (event.target.files.length > 0) {
|
1861
|
+
this._isLoading = true;
|
1862
|
+
const [selectedFile] = event.target.files;
|
1863
|
+
if (Files.IsExcel(selectedFile)) {
|
1864
|
+
const { rows } = await Files.ReadExcel(selectedFile);
|
1865
|
+
if (Tools.IsNull(this.importButton?.Autofill) || this.importButton.Autofill) {
|
1866
|
+
this.SetValue(rows.concat(this._value));
|
1867
|
+
this.onClickImport.emit({ data: this._value, file: selectedFile });
|
1868
|
+
}
|
1869
|
+
else {
|
1870
|
+
this.onClickImport.emit({ data: rows, file: selectedFile });
|
1871
|
+
}
|
1872
|
+
}
|
1873
|
+
else {
|
1874
|
+
let message = 'Allowed extensions:';
|
1875
|
+
for (const extension of Files.EXCEL_EXTENSIONS) {
|
1876
|
+
message += ` <b>${extension}</b>,`;
|
1877
|
+
}
|
1878
|
+
message = message.substring(0, message.length - 1);
|
1879
|
+
this.alert.Warning(message, 'Invalid File Type', 'bi bi-filetype-xlsx fa-lg');
|
1880
|
+
this.onClickImport.emit({ data: [], file: null });
|
1881
|
+
}
|
1882
|
+
this.inputFile().nativeElement.value = null;
|
1883
|
+
Tools.Sleep(1000).then(() => this._isLoading = false);
|
1884
|
+
}
|
1885
|
+
}
|
1886
|
+
/** */
|
1887
|
+
Export(exportFile = true) {
|
1888
|
+
let item = {};
|
1889
|
+
this._isLoading = true;
|
1890
|
+
const FILE_NAME = (this.exportButton?.fileName || 'COER Report') + '.xlsx';
|
1891
|
+
let ROW_DATA_SOURCE = (this.exportButton.hasOwnProperty('onlyRowFiltered') && !this.exportButton.onlyRowFiltered)
|
1892
|
+
? this.value_signal() : this.gridDataSourceFiltered();
|
1893
|
+
const COLUMN_DATA_SOURCE = new Set();
|
1894
|
+
if (this.exportButton.hasOwnProperty('onlyColumnFiltered') && !this.exportButton.onlyColumnFiltered) {
|
1895
|
+
for (const row of this.value_signal()) {
|
1896
|
+
for (const columnName in row) {
|
1897
|
+
if (columnName == 'indexRow')
|
1898
|
+
continue;
|
1899
|
+
COLUMN_DATA_SOURCE.add(Tools.FirstCharToLower(columnName));
|
1900
|
+
}
|
1901
|
+
}
|
1902
|
+
}
|
1903
|
+
else {
|
1904
|
+
for (const { columnName } of this.gridColumns()) {
|
1905
|
+
if (columnName == 'indexRow')
|
1906
|
+
continue;
|
1907
|
+
COLUMN_DATA_SOURCE.add(Tools.FirstCharToLower(columnName));
|
1908
|
+
}
|
1909
|
+
}
|
1910
|
+
const EXPORT_DATA = [];
|
1911
|
+
for (const row of ROW_DATA_SOURCE) {
|
1912
|
+
for (const column of COLUMN_DATA_SOURCE) {
|
1913
|
+
item = Object.assign(item, { [this._GetColumnName(column)]: row[column] });
|
1914
|
+
}
|
1915
|
+
EXPORT_DATA.push(item);
|
1916
|
+
item = Tools.BreakReference({});
|
1917
|
+
}
|
1918
|
+
if (exportFile) {
|
1919
|
+
Files.ExportExcel(EXPORT_DATA, FILE_NAME);
|
1920
|
+
}
|
1921
|
+
this.onClickExport.emit(EXPORT_DATA);
|
1922
|
+
Tools.Sleep(3000).then(() => this._isLoading = false);
|
1923
|
+
}
|
1924
|
+
/** */
|
1925
|
+
InputChange(indexRow, columnName, value, input) {
|
1926
|
+
if (input === 'coer-textbox-search') {
|
1927
|
+
if (this._isLoading)
|
1928
|
+
return;
|
1929
|
+
Tools.Sleep(0, `coerGridInputChange${columnName}`).then(async (_) => {
|
1930
|
+
this._gridSearch.set(value);
|
1931
|
+
if (this.checkbox.show) {
|
1932
|
+
this._isLoadingMessage = true;
|
1933
|
+
await Tools.Sleep();
|
1934
|
+
for (const row of this._value.filter((x) => x.checked)) {
|
1935
|
+
this.CheckBy((x) => x.indexRow == row.indexRow);
|
1936
|
+
}
|
1937
|
+
await Tools.Sleep();
|
1938
|
+
this._isLoadingMessage = false;
|
1939
|
+
}
|
1940
|
+
});
|
1941
|
+
return;
|
1942
|
+
}
|
1943
|
+
const property = Tools.FirstCharToLower(columnName);
|
1944
|
+
const row = this._value[indexRow];
|
1945
|
+
row[property] = value;
|
1946
|
+
if (input === 'coer-switch') {
|
1947
|
+
this.onSwitchChange.emit({ property, row: Tools.BreakReference(row), value });
|
1948
|
+
}
|
1949
|
+
else if (input === 'coer-textbox') {
|
1950
|
+
this.onTextboxChange.emit({ property, row: Tools.BreakReference(row), value });
|
1951
|
+
}
|
1952
|
+
else if (input === 'coer-selectbox') {
|
1953
|
+
this.onSelectboxChange.emit({ property, row: Tools.BreakReference(row), value });
|
1954
|
+
}
|
1955
|
+
else if (input === 'coer-numberbox') {
|
1956
|
+
this.onTextboxChange.emit({ property, row: Tools.BreakReference(row), value });
|
1957
|
+
}
|
1958
|
+
Tools.Sleep(1000, `coerGridInputChange${indexRow}${columnName}`).then(_ => {
|
1959
|
+
this._UpdateValue(this._value);
|
1960
|
+
this.value_signal.set(this._value);
|
1961
|
+
});
|
1962
|
+
}
|
1963
|
+
/** */
|
1964
|
+
KeyupEnter(indexColumn, row, input, value) {
|
1965
|
+
if (['coer-textbox', 'coer-numberbox', 'coer-selectbox'].includes(input)) {
|
1966
|
+
this.onKeyupEnter.emit({
|
1967
|
+
id: this._GetId(indexColumn, row.indexRow, input),
|
1968
|
+
input, row: Tools.BreakReference(row), value
|
1969
|
+
});
|
1970
|
+
this.NextInput(indexColumn, row.indexRow);
|
1971
|
+
}
|
1972
|
+
else if (input == 'coer-textbox-search') {
|
1973
|
+
this.onKeyupEnter.emit({
|
1974
|
+
id: this._GetId(indexColumn, row.indexRow, input),
|
1975
|
+
input, row: null, value
|
1976
|
+
});
|
1977
|
+
}
|
1978
|
+
}
|
1979
|
+
/** */
|
1980
|
+
NextInput(indexColumn, indexRow) {
|
1981
|
+
const INPUT_TEXT = this.columns().filter(x => Tools.IsNotNull(x.coerTextbox)).map(x => x.property);
|
1982
|
+
const INPUT_NUMBER = this.columns().filter(x => Tools.IsNotNull(x.coerNumberbox)).map(x => x.property);
|
1983
|
+
const INPUT_SELECT = this.columns().filter(x => Tools.IsNotNull(x.coerSelectbox)).map(x => x.property);
|
1984
|
+
let index = 0;
|
1985
|
+
const COLUMNS = [];
|
1986
|
+
const INPUT_COLUMNS = [];
|
1987
|
+
for (const { columnName } of this.gridColumns()) {
|
1988
|
+
if (INPUT_TEXT.some(property => property.toUpperCase() == columnName.toUpperCase())) {
|
1989
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerTextbox' });
|
1990
|
+
INPUT_COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerTextbox' });
|
1991
|
+
}
|
1992
|
+
else if (INPUT_NUMBER.some(property => property.toUpperCase() == columnName.toUpperCase())) {
|
1993
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerNumberbox' });
|
1994
|
+
INPUT_COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerNumberbox' });
|
1995
|
+
}
|
1996
|
+
else if (INPUT_SELECT.some(property => property.toUpperCase() == columnName.toUpperCase())) {
|
1997
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerSelectbox' });
|
1998
|
+
INPUT_COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerSelectbox' });
|
1999
|
+
}
|
2000
|
+
else {
|
2001
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'default-cell' });
|
2002
|
+
}
|
2003
|
+
++index;
|
2004
|
+
}
|
2005
|
+
let lastRow = -1;
|
2006
|
+
for (const { rows } of this.gridDataSource()) {
|
2007
|
+
lastRow += rows.length;
|
2008
|
+
}
|
2009
|
+
let firstColumn = -1;
|
2010
|
+
if (INPUT_COLUMNS.length > 0) {
|
2011
|
+
firstColumn = [...INPUT_COLUMNS].shift().indexColumn;
|
2012
|
+
}
|
2013
|
+
let lastColumn = -1;
|
2014
|
+
if (INPUT_COLUMNS.length > 0) {
|
2015
|
+
lastColumn = [...INPUT_COLUMNS].pop().indexColumn;
|
2016
|
+
}
|
2017
|
+
//Is Last Row & Last Input Column?
|
2018
|
+
if (indexRow == lastRow && indexColumn == lastColumn) {
|
2019
|
+
this.onKeyupEnterLast.emit();
|
2020
|
+
}
|
2021
|
+
//Is Last Input Column?
|
2022
|
+
else if (indexColumn == lastColumn) {
|
2023
|
+
this.FocusInput((indexRow + 1), firstColumn);
|
2024
|
+
}
|
2025
|
+
//Next Column?
|
2026
|
+
else {
|
2027
|
+
for (index = (indexColumn + 1); index < COLUMNS.length; index++) {
|
2028
|
+
for (const input of COLUMNS) {
|
2029
|
+
if (index == input.indexColumn && ['coerTextbox', 'coerNumberbox', 'coerSelectbox'].includes(input.type)) {
|
2030
|
+
this.FocusInput(indexRow, input.indexColumn);
|
2031
|
+
return;
|
2032
|
+
}
|
2033
|
+
}
|
2034
|
+
}
|
2035
|
+
}
|
2036
|
+
}
|
2037
|
+
/** */
|
2038
|
+
FocusInput(indexRow = -1, indexColumn = -1) {
|
2039
|
+
Tools.Sleep(0, 'FocusInput').then(() => {
|
2040
|
+
if (this._isDisabled())
|
2041
|
+
return;
|
2042
|
+
if (indexRow < 0 || indexColumn < 0) {
|
2043
|
+
const INPUT_TEXT = this.columns().filter(x => Tools.IsNotNull(x.coerTextbox)).map(x => x.property);
|
2044
|
+
const INPUT_NUMBER = this.columns().filter(x => Tools.IsNotNull(x.coerNumberbox)).map(x => x.property);
|
2045
|
+
const INPUT_SELECT = this.columns().filter(x => Tools.IsNotNull(x.coerSelectbox)).map(x => x.property);
|
2046
|
+
let index = 0;
|
2047
|
+
const COLUMNS = [];
|
2048
|
+
for (const { columnName } of this.gridColumns()) {
|
2049
|
+
if (INPUT_TEXT.some(property => property.toUpperCase() == columnName.toUpperCase())) {
|
2050
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerTextbox' });
|
2051
|
+
}
|
2052
|
+
else if (INPUT_NUMBER.some(property => property.toUpperCase() == columnName.toUpperCase())) {
|
2053
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerNumberbox' });
|
2054
|
+
}
|
2055
|
+
else if (INPUT_SELECT.some(property => property.toUpperCase() == columnName.toUpperCase())) {
|
2056
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'coerSelectbox' });
|
2057
|
+
}
|
2058
|
+
else {
|
2059
|
+
COLUMNS.push({ indexColumn: index, property: columnName, type: 'default-cell' });
|
2060
|
+
}
|
2061
|
+
++index;
|
2062
|
+
}
|
2063
|
+
if (this.gridLength().dataSourceFiltered > 0) {
|
2064
|
+
const FIRST_INPUT_COLUMN = COLUMNS.find(x => ['coerTextbox', 'coerNumberbox', 'coerSelectbox'].includes(x.type));
|
2065
|
+
if (Tools.IsNotNull(FIRST_INPUT_COLUMN)) {
|
2066
|
+
this.FocusInput(0, FIRST_INPUT_COLUMN.indexColumn);
|
2067
|
+
}
|
2068
|
+
}
|
2069
|
+
}
|
2070
|
+
else {
|
2071
|
+
const id = this._GetId(indexRow, indexColumn);
|
2072
|
+
let element;
|
2073
|
+
this._indexFocus.set(indexRow);
|
2074
|
+
//Focus Textbox
|
2075
|
+
element = this.coerTextboxList().find(x => x.id == id);
|
2076
|
+
if (element) {
|
2077
|
+
element.Select();
|
2078
|
+
return;
|
2079
|
+
}
|
2080
|
+
//Focus Numberbox
|
2081
|
+
element = this.coerNumberboxList().find(x => x.id == id);
|
2082
|
+
if (element) {
|
2083
|
+
element.Select();
|
2084
|
+
return;
|
2085
|
+
}
|
2086
|
+
//Focus Selectbox
|
2087
|
+
element = this.coerSelectboxList().find(x => x.id == id);
|
2088
|
+
if (element) {
|
2089
|
+
Tools.Sleep(100).then(_ => element.Focus());
|
2090
|
+
return;
|
2091
|
+
}
|
2092
|
+
}
|
2093
|
+
});
|
2094
|
+
}
|
2095
|
+
/** */
|
2096
|
+
FocusRow(callback) {
|
2097
|
+
Tools.Sleep().then(_ => {
|
2098
|
+
if (this._value.length > 0) {
|
2099
|
+
const row = Tools.BreakReference(this._value.find(callback));
|
2100
|
+
if (Tools.IsNotNull(row))
|
2101
|
+
this._indexFocus.set(row.indexRow);
|
2102
|
+
}
|
2103
|
+
});
|
2104
|
+
}
|
2105
|
+
/** */
|
2106
|
+
async Sort(columnName) {
|
2107
|
+
if (this.enableSort()) {
|
2108
|
+
if (this._isLoading)
|
2109
|
+
return;
|
2110
|
+
this._isLoading = true;
|
2111
|
+
this._isLoadingMessage = true;
|
2112
|
+
const { direction } = this._sort();
|
2113
|
+
let dataSource = Tools.BreakReference(this._value);
|
2114
|
+
for (const checkbox of this.coerCheckboxList())
|
2115
|
+
checkbox.Uncheck();
|
2116
|
+
if (direction == 'descendant') {
|
2117
|
+
Tools.SortByDesc(dataSource, columnName);
|
2118
|
+
this._sort.set({ columnName, direction: 'ascendant', icon: 'fa-solid fa-arrow-down-short-wide' });
|
2119
|
+
}
|
2120
|
+
else {
|
2121
|
+
Tools.SortBy(dataSource, columnName);
|
2122
|
+
this._sort.set({ columnName, direction: 'descendant', icon: 'fa-solid fa-arrow-up-wide-short' });
|
2123
|
+
}
|
2124
|
+
let indexRow = 0;
|
2125
|
+
dataSource = Tools.BreakReference(dataSource).map((item) => Object.assign(item, { indexRow: indexRow++ }));
|
2126
|
+
this.SetValue(dataSource);
|
2127
|
+
this._isLoading = false;
|
2128
|
+
await Tools.Sleep();
|
2129
|
+
for (const row of dataSource.filter((x) => x.checked)) {
|
2130
|
+
this.CheckBy((x) => x.indexRow == row.indexRow);
|
2131
|
+
}
|
2132
|
+
this._isLoadingMessage = false;
|
2133
|
+
}
|
2134
|
+
return;
|
2135
|
+
}
|
2136
|
+
/** */
|
2137
|
+
ClickCheck(id, checked, all, row = null) {
|
2138
|
+
if (!this._isLoading)
|
2139
|
+
Tools.Sleep().then(async (_) => {
|
2140
|
+
this._isLoading = true;
|
2141
|
+
let element = this.coerCheckboxList().find(x => x.id() == id);
|
2142
|
+
if (Tools.IsNotNull(element)) {
|
2143
|
+
let response = { all, checked, rows: [] };
|
2144
|
+
//All Checkbox
|
2145
|
+
if (all) {
|
2146
|
+
if (checked)
|
2147
|
+
this.CheckAll();
|
2148
|
+
else
|
2149
|
+
this.UncheckAll();
|
2150
|
+
//Event
|
2151
|
+
response.rows = this.selectedItems();
|
2152
|
+
this.onCheckboxChange.emit(response);
|
2153
|
+
}
|
2154
|
+
//One Checkbox
|
2155
|
+
else {
|
2156
|
+
if (this._onlyOneCheck) {
|
2157
|
+
for (const row of this._value) {
|
2158
|
+
row.checked = false;
|
2159
|
+
}
|
2160
|
+
for (const checkbox of this.coerCheckboxList()) {
|
2161
|
+
if (checkbox.id() != id)
|
2162
|
+
checkbox.Uncheck();
|
2163
|
+
}
|
2164
|
+
}
|
2165
|
+
this._value[row.indexRow].checked = checked;
|
2166
|
+
this.SetValue(this._value);
|
2167
|
+
//Mark All checkbox
|
2168
|
+
const checkboxAll = this.coerCheckboxList().find(x => x.id() == this._GetId(0, 0, 'checkboxAll'));
|
2169
|
+
if (this.value_signal().every((x) => x.checked)) {
|
2170
|
+
checkboxAll?.Check();
|
2171
|
+
}
|
2172
|
+
else {
|
2173
|
+
checkboxAll?.Uncheck();
|
2174
|
+
}
|
2175
|
+
//Event
|
2176
|
+
response.rows = [{ ...row }];
|
2177
|
+
this.onCheckboxChange.emit(response);
|
2178
|
+
this._isLoading = false;
|
2179
|
+
}
|
2180
|
+
}
|
2181
|
+
});
|
2182
|
+
}
|
2183
|
+
/** */
|
2184
|
+
CheckAll() {
|
2185
|
+
this._isLoading = true;
|
2186
|
+
for (const row of this._value) {
|
2187
|
+
row.checked = true;
|
2188
|
+
}
|
2189
|
+
this.SetValue(this._value);
|
2190
|
+
for (const checkbox of this.coerCheckboxList()) {
|
2191
|
+
checkbox.Check();
|
2192
|
+
}
|
2193
|
+
this._isLoading = false;
|
2194
|
+
}
|
2195
|
+
/** */
|
2196
|
+
UncheckAll() {
|
2197
|
+
this._isLoading = true;
|
2198
|
+
for (const row of this._value) {
|
2199
|
+
row.checked = false;
|
2200
|
+
}
|
2201
|
+
this.SetValue(this._value);
|
2202
|
+
for (const checkbox of this.coerCheckboxList()) {
|
2203
|
+
checkbox.Uncheck();
|
2204
|
+
}
|
2205
|
+
this._isLoading = false;
|
2206
|
+
}
|
2207
|
+
/** */
|
2208
|
+
CheckBy(callback) {
|
2209
|
+
Tools.Sleep().then(_ => {
|
2210
|
+
if (this._value.length > 0) {
|
2211
|
+
const rowList = Tools.BreakReference(this._value.filter(callback));
|
2212
|
+
let element;
|
2213
|
+
for (const { indexRow } of rowList) {
|
2214
|
+
element = this.coerCheckboxList().find(x => x.id() == this._GetId(indexRow, 0, 'checkbox'));
|
2215
|
+
if (Tools.IsNotNull(element)) {
|
2216
|
+
element?.Check();
|
2217
|
+
}
|
2218
|
+
}
|
2219
|
+
}
|
2220
|
+
});
|
2221
|
+
}
|
2222
|
+
/** */
|
2223
|
+
UncheckBy(callback) {
|
2224
|
+
Tools.Sleep().then(_ => {
|
2225
|
+
if (this._value.length > 0) {
|
2226
|
+
const rowList = Tools.BreakReference(this._value.filter(callback));
|
2227
|
+
let element;
|
2228
|
+
for (const { indexRow } of rowList) {
|
2229
|
+
element = this.coerCheckboxList().find(x => x.id() == this._GetId(indexRow, 0, 'checkbox'));
|
2230
|
+
if (Tools.IsNotNull(element)) {
|
2231
|
+
element?.Uncheck();
|
2232
|
+
}
|
2233
|
+
}
|
2234
|
+
}
|
2235
|
+
});
|
2236
|
+
}
|
2237
|
+
/** */
|
2238
|
+
ClickOnRow(row) {
|
2239
|
+
if (this._isDisabled())
|
2240
|
+
return;
|
2241
|
+
if (Tools.IsNotNull(this.checkbox.checkOnRow) && this.checkbox.checkOnRow) {
|
2242
|
+
this.CheckBy((x) => x.indexRow == row.indexRow);
|
2243
|
+
}
|
2244
|
+
this.onClickRow.emit(row);
|
2245
|
+
}
|
2246
|
+
/** Inserts new elements at the start */
|
2247
|
+
Unshift(row) {
|
2248
|
+
const dataSource = Tools.BreakReference(this._value);
|
2249
|
+
dataSource.unshift(row);
|
2250
|
+
this.SetValue(dataSource);
|
2251
|
+
this.FocusInput();
|
2252
|
+
}
|
2253
|
+
/** Appends new elements to the end */
|
2254
|
+
Push(row) {
|
2255
|
+
const dataSource = Tools.BreakReference(this._value);
|
2256
|
+
dataSource.push(row);
|
2257
|
+
this.SetValue(dataSource);
|
2258
|
+
this.FocusInput();
|
2259
|
+
}
|
2260
|
+
/** Delete Row By index */
|
2261
|
+
async DeleteRow(indexRow) {
|
2262
|
+
const dataSource = Tools.BreakReference(this._value);
|
2263
|
+
dataSource.splice(indexRow, 1);
|
2264
|
+
this.SetValue(dataSource);
|
2265
|
+
}
|
2266
|
+
/** Delete row list by callback */
|
2267
|
+
async DeleteRowsBy(callback) {
|
2268
|
+
const indexList = Tools.BreakReference(this._value.filter(callback).map((item) => item.indexRow));
|
2269
|
+
let dataSource = [];
|
2270
|
+
for (const indexRow of indexList) {
|
2271
|
+
dataSource = Tools.BreakReference(this._value);
|
2272
|
+
dataSource.splice(indexRow, 1);
|
2273
|
+
this.SetValue(dataSource);
|
2274
|
+
await Tools.Sleep();
|
2275
|
+
}
|
2276
|
+
}
|
2277
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
2278
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerGrid, selector: "coer-grid", providers: [CONTROL_VALUE(CoerGrid)], usesInheritance: true, ngImport: i0, template: "<div class=\"coer-grid\" [ngStyle]=\"{ 'width': width(), 'min-Width': MinWidth(), 'max-Width': MaxWidth(), 'margin': margin() }\">\r\n <header [id]=\"_id + '-header'\" class=\"row\">\r\n <!-- Slot -->\r\n <ng-content></ng-content>\r\n\r\n <!-- Export Button -->\r\n @if(exportButton.show && gridLength().dataSource > 0) {\r\n <div class=\"col-auto\">\r\n <coer-button\r\n type=\"icon\"\r\n color=\"navigation\"\r\n icon=\"excel\"\r\n [tooltip]=\"_isLoading ? 'Loading' : (exportButton.tooltip || 'Export')\"\r\n [path]=\"(exportButton && exportButton.path) ? exportButton.path : []\"\r\n [isDisabled]=\"_isDisabled() || _isLoading || (exportButton.isDisabled || false)\"\r\n [isLoading]=\"_isLoading\"\r\n [animation]=\"_enableAnimations\"\r\n (onClick)=\"Export(!exportButton.preventDefault)\"\r\n ></coer-button>\r\n </div>\r\n }\r\n\r\n <!-- Import Button -->\r\n @if(importButton.show) {\r\n <div class=\"col-auto\">\r\n <input type=\"file\" #inputFileRef [multiple]=\"false\" (change)=\"Import($event)\">\r\n\r\n <coer-button\r\n type=\"icon\"\r\n color=\"navigation\"\r\n icon=\"import\"\r\n [tooltip]=\"importButton.tooltip || 'Import'\"\r\n [path]=\"(importButton && importButton.path) ? importButton.path : []\"\r\n [isDisabled]=\"importButton.isDisabled || false\"\r\n [animation]=\"_enableAnimations\"\r\n (onClick)=\"Import()\"\r\n ></coer-button>\r\n </div>\r\n }\r\n\r\n <!-- Add Button -->\r\n @if(addButton.show) {\r\n <div class=\"col-auto\">\r\n <coer-button\r\n type=\"icon\"\r\n color=\"navigation\"\r\n icon=\"new\"\r\n [tooltip]=\"addButton.tooltip || 'New'\"\r\n [path]=\"(addButton && addButton.path) ? addButton.path : []\"\r\n [isDisabled]=\"addButton.isDisabled || false\"\r\n [animation]=\"_enableAnimations\"\r\n (onClick)=\"onClickAdd.emit()\"\r\n ></coer-button>\r\n </div>\r\n }\r\n\r\n <!-- Search -->\r\n @if(search.show) {\r\n <div class=\"col-auto\">\r\n <coer-textbox\r\n #inputSearch\r\n [id]=\"_GetId(-1, -1, 'search')\"\r\n [ngModel]=\"_gridSearch()\"\r\n placeholder=\"Search\"\r\n [isDisabled]=\"_isDisabled() || _isLoading\"\r\n [selectOnFocus]=\"true\"\r\n width=\"250px\"\r\n [showSearchIcon]=\"true\"\r\n [showClearIcon]=\"true\"\r\n (onInput)=\"InputChange(-1, 'Search', $event, 'coer-textbox-search')\"\r\n (onClickClear)=\"InputChange(-1, 'Search', '', 'coer-textbox-search')\"\r\n (onKeyupEnter)=\"KeyupEnter(-1, { indexRow: -1 }, 'coer-textbox-search', $event);\"\r\n ></coer-textbox>\r\n </div>\r\n }\r\n </header>\r\n\r\n <section [ngClass]=\"{ 'grid-container': true, 'invisible': isInvisible() }\">\r\n <div [ngStyle]=\"{ 'height': _height, 'min-height': minHeight(), 'max-height': maxHeight() }\">\r\n @if(isLoading()) {\r\n <!-- Grid Message -->\r\n <div class=\"loading\">\r\n <i class=\"spinner-border\"></i>\r\n <span class=\"fa-fade\">Loading</span>\r\n </div>\r\n }\r\n\r\n @else if(!_isDisabled() && gridLength().dataSource <= 0) {\r\n <div class=\"no-data\"> No Data </div>\r\n }\r\n\r\n <table class=\"table table-sm table-responsive table-striped\">\r\n <thead>\r\n <tr>\r\n @if(checkbox.show && gridLength().dataSource > 0) {\r\n <!-- CheckBox Column -->\r\n <th scope=\"col\" class=\"check-box\">\r\n <div *ngIf=\"!_onlyOneCheck\" [ngClass]=\"{ 'invisible': _isLoadingMessage }\">\r\n <coer-checkbox\r\n [id]=\"_GetId(0, 0, 'checkboxAll')\"\r\n [ignoreModel]=\"true\"\r\n [isDisabled]=\"_isDisabled() || _isLoading\"\r\n (onChange)=\"ClickCheck(_GetId(0, 0, 'checkboxAll'), $event, true)\"\r\n ></coer-checkbox>\r\n </div>\r\n </th>\r\n }\r\n\r\n <!-- Dynamic Grid Column -->\r\n @for(header of gridColumns(); track header.indexColumn) {\r\n <th scope=\"col\" (dblclick)=\"Sort(header.columnName)\"\r\n [ngClass]=\"{\r\n 'no-selection': true,\r\n 'cursor-default': !enableSort() && !_isLoading,\r\n 'cursor-pointer': enableSort() && !_isLoading,\r\n 'cursor-wait': _isLoading\r\n }\"\r\n [ngStyle]=\"{\r\n 'width': header.width,\r\n 'text-align': GetAttribute(header.columnName, null, 'textAlign', 'defaul-cell')\r\n }\">\r\n <div class=\"no-selection\">\r\n {{ _GetColumnName(header.columnName) }}\r\n <i [class]=\"_GetShortIcon(header.columnName)\"></i>\r\n </div>\r\n </th>\r\n }\r\n\r\n <!-- Delete Button Column -->\r\n @if(ButtonByRow('showDeleteButton')) {\r\n <th scope=\"col\" class=\"action-button\"></th>\r\n }\r\n\r\n <!-- Edit Button Column -->\r\n @if(ButtonByRow('showEditButton')) {\r\n <th scope=\"col\" class=\"action-button\"></th>\r\n }\r\n\r\n <!-- Edit Button Column -->\r\n @if(ButtonByRow('showGoButton')) {\r\n <th scope=\"col\" class=\"action-button\"></th>\r\n }\r\n </tr>\r\n </thead>\r\n\r\n <!-- body -->\r\n @for(group of gridDataSource(); track group.indexGroup) {\r\n <tbody>\r\n <!--<tr v-if=\"_isGrouped\">\r\n <td :colspan=\"_colspan\" class=\"group\">\r\n <MesAccordion\r\n :ref=\"`accordion${group.indexGroup}-${id}`\"\r\n :title=\"`${_CleanHeaderName(groupBy)} (${group.length}): ${group.groupBy}`\"\r\n :isLoading=\"_isLoading\"\r\n @expanded=\"_ToogleAccordion(group.groupBy, true, group.indexGroup)\"\r\n @collapsed=\"_ToogleAccordion(group.groupBy, false, group.indexGroup)\"\r\n ></MesAccordion>\r\n </td>\r\n </tr>-->\r\n\r\n @for(row of group.rows; track row.indexRow) {\r\n <tr [id]=\"_GetId(row.indexRow, 0, 'row')\"\r\n [ngClass]=\"{ 'loading': isLoading(), 'd-none': _HideRow(group), 'row-focus': (row.indexRow == _indexFocus() && enableRowFocus()) }\"\r\n (click)=\"_indexFocus.set(row.indexRow)\">\r\n\r\n @if(checkbox.show) {\r\n <!-- CheckBox Column -->\r\n <td class=\"check-box\">\r\n <div [ngClass]=\"{ 'invisible': _isLoadingMessage }\">\r\n <coer-checkbox\r\n [id]=\"_GetId(row.indexRow, 0, 'checkbox')\"\r\n [ignoreModel]=\"true\"\r\n [isDisabled]=\"_isDisabled() || _isLoading\"\r\n (onChange)=\"ClickCheck(_GetId(row.indexRow, 0, 'checkbox'), $event, false, row)\"\r\n ></coer-checkbox>\r\n </div>\r\n\r\n <div [ngClass]=\"{ 'invisible': !_isLoadingMessage }\">\r\n <i class=\"spinner-border\"></i>\r\n </div>\r\n </td>\r\n }\r\n\r\n <!-- Dynamic Column -->\r\n @for(header of gridColumns(); track header.indexColumn) {\r\n @if(_IsCellType(header.columnName, row, 'template')) {\r\n <td class=\"template\"\r\n (click)=\"_isDisabled() ? null : onClickRow.emit(row)\"\r\n (dblclick)=\"_isDisabled() ? null : onDoubleClickRow.emit(row)\">\r\n <div [innerHTML]=\"GetAttribute(header.columnName, row, 'template', 'defaul-cell') | html\" class=\"template\"></div>\r\n </td>\r\n }\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerTextbox')) {\r\n <!-- coer-textbox -->\r\n <td class=\"coer-textbox\">\r\n <coer-textbox\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerTextbox') || _isDisabled() || _isLoading\"\r\n [isValid]=\"GetAttribute(header.columnName, row, 'isValid', 'coerTextbox') || false\"\r\n [isInvalid]=\"GetAttribute(header.columnName, row, 'isInvalid', 'coerTextbox') || false\"\r\n [selectOnFocus]=\"GetAttribute(header.columnName, row, 'selectOnFocus', 'coerTextbox') || true\"\r\n [placeholder]=\"GetAttribute(header.columnName, row, 'placeholder', 'coerTextbox') || ('Type ' + header.columnName + '...')\"\r\n [textPosition]=\"GetAttribute(header.columnName, row, 'textPosition', 'coerTextbox') || 'left'\"\r\n [minLength]=\"GetAttribute(header.columnName, row, 'minLength', 'coerTextbox') || 0\"\r\n [maxLength]=\"GetAttribute(header.columnName, row, 'maxLength', 'coerTextbox') || 50\"\r\n (onInput)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-textbox')\"\r\n (onKeyupEnter)=\"KeyupEnter(header.indexColumn, row, 'coer-textbox', $event)\"\r\n ></coer-textbox>\r\n </td>\r\n }\r\n\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerNumberbox')) {\r\n <!-- coer-numberbox -->\r\n <td class=\"coer-numberbox\">\r\n <coer-numberbox\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerNumberbox') || _isDisabled() || _isLoading\"\r\n [isValid]=\"GetAttribute(header.columnName, row, 'isValid', 'coerNumberbox') || false\"\r\n [isInvalid]=\"GetAttribute(header.columnName, row, 'isInvalid', 'coerNumberbox') || false\"\r\n [selectOnFocus]=\"GetAttribute(header.columnName, row, 'selectOnFocus', 'coerNumberbox') || true\"\r\n [placeholder]=\"GetAttribute(header.columnName, row, 'placeholder', 'coerNumberbox') || ''\"\r\n [textPosition]=\"GetAttribute(header.columnName, row, 'textPosition', 'coerNumberbox') || 'right'\"\r\n [min]=\"GetAttribute(header.columnName, row, 'min', 'coerNumberbox') || 0\"\r\n [max]=\"GetAttribute(header.columnName, row, 'max', 'coerNumberbox') || 2147483647\"\r\n [decimals]=\"GetAttribute(header.columnName, row, 'decimals', 'coerNumberbox') || 0\"\r\n (onInput)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-numberbox')\"\r\n (onKeyupEnter)=\"KeyupEnter(header.indexColumn, row, 'coer-numberbox', $event)\"\r\n ></coer-numberbox>\r\n </td>\r\n }\r\n\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerSelectbox')) {\r\n <!-- coer-numberbox -->\r\n <td class=\"coer-selectbox\">\r\n <coer-selectbox\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerSelectbox') || _isDisabled() || _isLoading\"\r\n [isValid]=\"GetAttribute(header.columnName, row, 'isValid', 'coerSelectbox') || false\"\r\n [isInvalid]=\"GetAttribute(header.columnName, row, 'isInvalid', 'coerSelectbox') || false\"\r\n [dataSource]=\"GetAttribute(header.columnName, row, 'dataSource', 'coerSelectbox') || []\"\r\n [placeholder]=\"GetAttribute(header.columnName, row, 'placeholder', 'coerSelectbox') || '-- Select --'\"\r\n [propDisplay]=\"GetAttribute(header.columnName, row, 'propDisplay', 'coerSelectbox') || 'name'\"\r\n (onSelected)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-selectbox'); KeyupEnter(header.indexColumn, row, 'coer-selectbox', $event)\"\r\n ></coer-selectbox>\r\n </td>\r\n }\r\n\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerSwitch')) {\r\n <!-- coer-switch -->\r\n <td>\r\n <coer-switch\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerSwitch') || _isDisabled() || _isLoading\"\r\n [tooltip]=\"GetAttribute(header.columnName, row, 'tooltip', 'coerSwitch')\"\r\n [tooltipPosition]=\"GetAttribute(header.columnName, row, 'tooltipPosition', 'coerSwitch') || 'left'\"\r\n [isInvisible]=\"_isDisabled()\"\r\n (onChange)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-switch')\"\r\n ></coer-switch>\r\n </td>\r\n }\r\n\r\n @else {\r\n <!-- Default Cell -->\r\n <td class=\"default-cell\"\r\n (click)=\"ClickOnRow(row)\"\r\n (dblclick)=\"_isDisabled() ? null : onDoubleClickRow.emit(row)\"\r\n [ngStyle]=\"{\r\n 'text-align': GetAttribute(header.columnName, row, 'textAlign', 'defaul-cell'),\r\n 'white-space': 'normal'\r\n }\">\r\n\r\n <div [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [ngClass]=\"{\r\n 'text-blue-bold': _IsCellColor(header.columnName, row, 'colorBlue'),\r\n 'text-green-bold': _IsCellColor(header.columnName, row, 'colorGreen'),\r\n 'text-yellow-bold': _IsCellColor(header.columnName, row, 'colorYellow'),\r\n 'text-red-bold': _IsCellColor(header.columnName, row, 'colorRed'),\r\n 'text-right-bold': _IsCellType(header.columnName, row, 'number')\r\n }\">\r\n\r\n @if(_IsCellType(header.columnName, row, 'number')) {\r\n <span> {{ GetNumericFormat(row[header.columnName]) }} </span>\r\n }\r\n\r\n @else if(_IsCellType(header.columnName, row, 'date')) {\r\n <span> {{ GetDateFormat(row[header.columnName]) }} </span>\r\n }\r\n\r\n @else {\r\n <span> {{ _GetCellValue(row, header.columnName) }} </span>\r\n }\r\n </div>\r\n </td>\r\n }\r\n }\r\n\r\n <!-- Delete Button -->\r\n @if(ButtonByRow('showDeleteButton')) {\r\n <td class=\"action-button\">\r\n @if(ButtonByRow('showDeleteButton', row)) {\r\n <coer-button\r\n type=\"icon-no-border\"\r\n color=\"navigation\"\r\n icon=\"delete\"\r\n [tooltip]=\"_GetTooltip('Delete', row)\"\r\n [isInvisible]=\"_isDisabled()\"\r\n [isDisabled]=\"_isLoading\"\r\n (onClick)=\"onClickDeleteRow.emit(row)\"\r\n ></coer-button>\r\n }\r\n </td>\r\n }\r\n\r\n <!-- Edit Button -->\r\n @if(ButtonByRow('showEditButton')) {\r\n <td class=\"action-button\">\r\n @if(ButtonByRow('showEditButton', row)) {\r\n <coer-button\r\n type=\"icon-no-border\"\r\n color=\"navigation\"\r\n icon=\"edit\"\r\n [tooltip]=\"_GetTooltip('Edit', row)\"\r\n [isInvisible]=\"_isDisabled()\"\r\n [isDisabled]=\"_isLoading\"\r\n (onClick)=\"onClickEditRow.emit(row)\"\r\n ></coer-button>\r\n }\r\n </td>\r\n }\r\n\r\n <!-- GO Button -->\r\n @if(ButtonByRow('showGoButton')) {\r\n <td class=\"action-button\">\r\n @if(ButtonByRow('showGoButton', row)) {\r\n <coer-button\r\n type=\"icon-no-border\"\r\n color=\"navigation\"\r\n icon=\"go\"\r\n [tooltip]=\"_GetTooltip('Go to', row, 'detail')\"\r\n [isInvisible]=\"_isDisabled()\"\r\n [isDisabled]=\"_isLoading\"\r\n (onClick)=\"onClickEditRow.emit(row)\"\r\n ></coer-button>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n }\r\n </table>\r\n </div>\r\n </section>\r\n\r\n @if(showFooter()) {\r\n <footer class=\"grid-footer\">\r\n <span>\r\n @if(_isLoadingMessage) {\r\n <span class=\"fa-fade\"> Loading </span>\r\n }\r\n\r\n @else if(gridLength().dataSourceSelected > 0) {\r\n <span>\r\n <i class=\"bi bi-check2-square ms-1\"></i>\r\n {{ gridLength().dataSourceSelected }}\r\n </span>\r\n }\r\n </span>\r\n\r\n <span class=\"me-1\"> {{ gridLength().dataSourceFiltered | numericFormat }} Rows </span>\r\n </footer>\r\n }\r\n</div>", styles: ["div.coer-grid *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-grid .text-blue{color:#0d6efd!important}div.coer-grid .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-grid .background-blue{background-color:#0d6efd!important}div.coer-grid .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-grid .border-blue{border-color:#0d6efd!important}div.coer-grid .text-gray{color:#6c757d!important}div.coer-grid .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-grid .background-gray{background-color:#6c757d!important}div.coer-grid .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-grid .border-gray{border-color:#6c757d!important}div.coer-grid .text-green{color:#198754!important}div.coer-grid .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-grid .background-green{background-color:#198754!important}div.coer-grid .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-grid .border-green{border-color:#198754!important}div.coer-grid .text-yellow{color:#ffc107!important}div.coer-grid .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-grid .background-yellow{background-color:#ffc107!important}div.coer-grid .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-grid .border-yellow{border-color:#ffc107!important}div.coer-grid .text-red{color:#dc3545!important}div.coer-grid .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-grid .background-red{background-color:#dc3545!important}div.coer-grid .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-grid .border-red{border-color:#dc3545!important}div.coer-grid .text-white{color:#f5f5f5!important}div.coer-grid .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-grid .background-white{background-color:#f5f5f5!important}div.coer-grid .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-grid .border-white{border-color:#f5f5f5!important}div.coer-grid .text-black{color:#252525!important}div.coer-grid .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-grid .background-black{background-color:#252525!important}div.coer-grid .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-grid .border-black{border-color:#252525!important}div.coer-grid .text-orange{color:#fd6031!important}div.coer-grid .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-grid .background-orange{background-color:#fd6031!important}div.coer-grid .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-grid .border-orange{border-color:#fd6031!important}div.coer-grid header{align-items:flex-end;justify-content:flex-end;padding-right:8px;margin:0}div.coer-grid header>div{padding:0 0 10px 10px;display:flex;align-items:baseline}div.coer-grid header>div a{height:40px!important}div.coer-grid table{table-layout:auto;border-collapse:separate;border-spacing:1px 0px;margin:0;font-size:14px}div.coer-grid table thead tr th{position:sticky!important;z-index:100!important;top:0!important;background-color:#6c757d!important;color:#f5f5f5!important;padding:5px!important;vertical-align:middle!important;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;min-width:50px!important;white-space:nowrap!important}div.coer-grid table tbody{border:0px!important}div.coer-grid table tbody tr:not(.row-focus):hover td{color:#000!important;background-color:#f1f6ff!important}div.coer-grid table tbody tr td{border:0px!important;padding:5px!important;vertical-align:middle!important;white-space:break-spaces;text-overflow:ellipsis;overflow:hidden}div.coer-grid table tbody tr.row-focus td{background-color:#cde1ff}div.coer-grid table tbody tr td.coer-textbox,div.coer-grid table tbody tr td.coer-numberbox,div.coer-grid table tbody tr td.coer-selectbox{padding:0!important;overflow:visible!important}div.coer-grid table tbody tr td.default-cell{cursor:pointer!important}div.coer-grid table tbody tr td.template{display:block!important;white-space:nowrap!important;cursor:pointer!important;height:31px}div.coer-grid table tbody tr td.template>div.template{display:block!important}div.coer-grid table thead tr th.action-button,div.coer-grid table thead tr td.action-button,div.coer-grid table thead tr th.check-box,div.coer-grid table thead tr td.check-box,div.coer-grid table tbody tr th.action-button,div.coer-grid table tbody tr td.action-button,div.coer-grid table tbody tr th.check-box table tbody tr td.check-box{text-align:center!important;cursor:default!important;min-width:40px!important;max-width:40px!important;width:40px!important;padding:0!important}div.coer-grid footer.grid-footer{display:flex;align-items:center;justify-content:space-between;font-size:small;color:#999;padding-top:5px}div.coer-grid section.grid-container{position:relative;overflow:auto}div.coer-grid div.loading,div.coer-grid div.no-data{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:25px;color:gray}div.coer-grid div.loading{background-color:#bbbbbb83!important;flex-direction:column!important;gap:10px!important}div.coer-grid div.loading span.fa-fade{position:relative!important;top:50px!important}div.coer-grid tr.loading{background-color:#bbbbbb83!important}div.coer-grid div.loading i.spinner-border{color:#fd6031!important;width:70px!important;height:70px!important;font-size:20px!important;position:absolute!important}div.coer-grid td.check-box i.spinner-border{width:15px!important;height:15px!important;color:#fd6031!important}div.coer-grid table thead tr th.check-box>div,div.coer-grid table tbody tr td.check-box>div{display:flex;align-items:center;justify-content:center;cursor:default!important}div.coer-grid input.form-check-input{box-shadow:none!important;margin:0}div.coer-grid input[type=checkbox]{cursor:pointer!important}div.coer-grid td.group{padding:0!important;margin:0!important}div.coer-grid td.group>*{border-top:1px solid #6c757d!important;border-bottom:1px solid #6c757d!important;padding:0!important;margin:0!important}div.coer-grid .template,div.coer-grid .template div{white-space:nowrap!important;display:flex!important;align-items:center!important;gap:5px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CoerButton, selector: "coer-button", inputs: ["id", "color", "type", "icon", "iconPosition", "animation", "isLoading", "isDisabled", "isInvisible", "width", "minWidth", "height", "minHeight", "marginTop", "marginRight", "marginBottom", "marginLeft", "path", "tooltipPosition", "tooltip"], outputs: ["onClick"] }, { kind: "component", type: CoerCheckbox, selector: "coer-checkbox", inputs: ["value", "id", "label", "labelPosition", "isDisabled", "isLoading", "isInvisible", "ignoreModel"], outputs: ["onChange"] }, { kind: "component", type: CoerNumberBox, selector: "coer-numberbox", inputs: ["value", "id", "label", "placeholder", "min", "max", "decimals", "width", "minWidth", "maxWidth", "marginTop", "marginRight", "marginBottom", "marginLeft", "isInvalid", "isValid", "isDisabled", "isReadonly", "isLoading", "selectOnFocus", "textPosition"], outputs: ["onKeyupEnter", "onInput"] }, { kind: "component", type: CoerSelectbox, selector: "coer-selectbox", inputs: ["value", "id", "label", "dataSource", "propDisplay", "rowsByPage", "placeholder", "width", "minWidth", "maxWidth", "marginTop", "marginRight", "marginBottom", "marginLeft", "isInvalid", "isValid", "isDisabled", "isReadonly", "isLoading"], outputs: ["onSelected"] }, { kind: "component", type: CoerSwitch, selector: "coer-switch", inputs: ["value", "id", "label", "labelPosition", "isDisabled", "isLoading", "isInvisible", "tooltipPosition", "tooltip"], outputs: ["onChange"] }, { kind: "component", type: CoerTextBox, selector: "coer-textbox", inputs: ["value", "id", "label", "placeholder", "minLength", "maxLength", "showSearchIcon", "showClearIcon", "width", "minWidth", "maxWidth", "marginTop", "marginRight", "marginBottom", "marginLeft", "isInvalid", "isValid", "isDisabled", "isReadonly", "isLoading", "selectOnFocus", "textPosition"], outputs: ["onKeyupEnter", "onInput", "onClickClear"] }, { kind: "pipe", type: i9.HtmlPipe, name: "html" }, { kind: "pipe", type: i9.NumericFormatPipe, name: "numericFormat" }] }); }
|
2279
|
+
}
|
2280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerGrid, decorators: [{
|
2281
|
+
type: Component,
|
2282
|
+
args: [{ selector: 'coer-grid', providers: [CONTROL_VALUE(CoerGrid)], template: "<div class=\"coer-grid\" [ngStyle]=\"{ 'width': width(), 'min-Width': MinWidth(), 'max-Width': MaxWidth(), 'margin': margin() }\">\r\n <header [id]=\"_id + '-header'\" class=\"row\">\r\n <!-- Slot -->\r\n <ng-content></ng-content>\r\n\r\n <!-- Export Button -->\r\n @if(exportButton.show && gridLength().dataSource > 0) {\r\n <div class=\"col-auto\">\r\n <coer-button\r\n type=\"icon\"\r\n color=\"navigation\"\r\n icon=\"excel\"\r\n [tooltip]=\"_isLoading ? 'Loading' : (exportButton.tooltip || 'Export')\"\r\n [path]=\"(exportButton && exportButton.path) ? exportButton.path : []\"\r\n [isDisabled]=\"_isDisabled() || _isLoading || (exportButton.isDisabled || false)\"\r\n [isLoading]=\"_isLoading\"\r\n [animation]=\"_enableAnimations\"\r\n (onClick)=\"Export(!exportButton.preventDefault)\"\r\n ></coer-button>\r\n </div>\r\n }\r\n\r\n <!-- Import Button -->\r\n @if(importButton.show) {\r\n <div class=\"col-auto\">\r\n <input type=\"file\" #inputFileRef [multiple]=\"false\" (change)=\"Import($event)\">\r\n\r\n <coer-button\r\n type=\"icon\"\r\n color=\"navigation\"\r\n icon=\"import\"\r\n [tooltip]=\"importButton.tooltip || 'Import'\"\r\n [path]=\"(importButton && importButton.path) ? importButton.path : []\"\r\n [isDisabled]=\"importButton.isDisabled || false\"\r\n [animation]=\"_enableAnimations\"\r\n (onClick)=\"Import()\"\r\n ></coer-button>\r\n </div>\r\n }\r\n\r\n <!-- Add Button -->\r\n @if(addButton.show) {\r\n <div class=\"col-auto\">\r\n <coer-button\r\n type=\"icon\"\r\n color=\"navigation\"\r\n icon=\"new\"\r\n [tooltip]=\"addButton.tooltip || 'New'\"\r\n [path]=\"(addButton && addButton.path) ? addButton.path : []\"\r\n [isDisabled]=\"addButton.isDisabled || false\"\r\n [animation]=\"_enableAnimations\"\r\n (onClick)=\"onClickAdd.emit()\"\r\n ></coer-button>\r\n </div>\r\n }\r\n\r\n <!-- Search -->\r\n @if(search.show) {\r\n <div class=\"col-auto\">\r\n <coer-textbox\r\n #inputSearch\r\n [id]=\"_GetId(-1, -1, 'search')\"\r\n [ngModel]=\"_gridSearch()\"\r\n placeholder=\"Search\"\r\n [isDisabled]=\"_isDisabled() || _isLoading\"\r\n [selectOnFocus]=\"true\"\r\n width=\"250px\"\r\n [showSearchIcon]=\"true\"\r\n [showClearIcon]=\"true\"\r\n (onInput)=\"InputChange(-1, 'Search', $event, 'coer-textbox-search')\"\r\n (onClickClear)=\"InputChange(-1, 'Search', '', 'coer-textbox-search')\"\r\n (onKeyupEnter)=\"KeyupEnter(-1, { indexRow: -1 }, 'coer-textbox-search', $event);\"\r\n ></coer-textbox>\r\n </div>\r\n }\r\n </header>\r\n\r\n <section [ngClass]=\"{ 'grid-container': true, 'invisible': isInvisible() }\">\r\n <div [ngStyle]=\"{ 'height': _height, 'min-height': minHeight(), 'max-height': maxHeight() }\">\r\n @if(isLoading()) {\r\n <!-- Grid Message -->\r\n <div class=\"loading\">\r\n <i class=\"spinner-border\"></i>\r\n <span class=\"fa-fade\">Loading</span>\r\n </div>\r\n }\r\n\r\n @else if(!_isDisabled() && gridLength().dataSource <= 0) {\r\n <div class=\"no-data\"> No Data </div>\r\n }\r\n\r\n <table class=\"table table-sm table-responsive table-striped\">\r\n <thead>\r\n <tr>\r\n @if(checkbox.show && gridLength().dataSource > 0) {\r\n <!-- CheckBox Column -->\r\n <th scope=\"col\" class=\"check-box\">\r\n <div *ngIf=\"!_onlyOneCheck\" [ngClass]=\"{ 'invisible': _isLoadingMessage }\">\r\n <coer-checkbox\r\n [id]=\"_GetId(0, 0, 'checkboxAll')\"\r\n [ignoreModel]=\"true\"\r\n [isDisabled]=\"_isDisabled() || _isLoading\"\r\n (onChange)=\"ClickCheck(_GetId(0, 0, 'checkboxAll'), $event, true)\"\r\n ></coer-checkbox>\r\n </div>\r\n </th>\r\n }\r\n\r\n <!-- Dynamic Grid Column -->\r\n @for(header of gridColumns(); track header.indexColumn) {\r\n <th scope=\"col\" (dblclick)=\"Sort(header.columnName)\"\r\n [ngClass]=\"{\r\n 'no-selection': true,\r\n 'cursor-default': !enableSort() && !_isLoading,\r\n 'cursor-pointer': enableSort() && !_isLoading,\r\n 'cursor-wait': _isLoading\r\n }\"\r\n [ngStyle]=\"{\r\n 'width': header.width,\r\n 'text-align': GetAttribute(header.columnName, null, 'textAlign', 'defaul-cell')\r\n }\">\r\n <div class=\"no-selection\">\r\n {{ _GetColumnName(header.columnName) }}\r\n <i [class]=\"_GetShortIcon(header.columnName)\"></i>\r\n </div>\r\n </th>\r\n }\r\n\r\n <!-- Delete Button Column -->\r\n @if(ButtonByRow('showDeleteButton')) {\r\n <th scope=\"col\" class=\"action-button\"></th>\r\n }\r\n\r\n <!-- Edit Button Column -->\r\n @if(ButtonByRow('showEditButton')) {\r\n <th scope=\"col\" class=\"action-button\"></th>\r\n }\r\n\r\n <!-- Edit Button Column -->\r\n @if(ButtonByRow('showGoButton')) {\r\n <th scope=\"col\" class=\"action-button\"></th>\r\n }\r\n </tr>\r\n </thead>\r\n\r\n <!-- body -->\r\n @for(group of gridDataSource(); track group.indexGroup) {\r\n <tbody>\r\n <!--<tr v-if=\"_isGrouped\">\r\n <td :colspan=\"_colspan\" class=\"group\">\r\n <MesAccordion\r\n :ref=\"`accordion${group.indexGroup}-${id}`\"\r\n :title=\"`${_CleanHeaderName(groupBy)} (${group.length}): ${group.groupBy}`\"\r\n :isLoading=\"_isLoading\"\r\n @expanded=\"_ToogleAccordion(group.groupBy, true, group.indexGroup)\"\r\n @collapsed=\"_ToogleAccordion(group.groupBy, false, group.indexGroup)\"\r\n ></MesAccordion>\r\n </td>\r\n </tr>-->\r\n\r\n @for(row of group.rows; track row.indexRow) {\r\n <tr [id]=\"_GetId(row.indexRow, 0, 'row')\"\r\n [ngClass]=\"{ 'loading': isLoading(), 'd-none': _HideRow(group), 'row-focus': (row.indexRow == _indexFocus() && enableRowFocus()) }\"\r\n (click)=\"_indexFocus.set(row.indexRow)\">\r\n\r\n @if(checkbox.show) {\r\n <!-- CheckBox Column -->\r\n <td class=\"check-box\">\r\n <div [ngClass]=\"{ 'invisible': _isLoadingMessage }\">\r\n <coer-checkbox\r\n [id]=\"_GetId(row.indexRow, 0, 'checkbox')\"\r\n [ignoreModel]=\"true\"\r\n [isDisabled]=\"_isDisabled() || _isLoading\"\r\n (onChange)=\"ClickCheck(_GetId(row.indexRow, 0, 'checkbox'), $event, false, row)\"\r\n ></coer-checkbox>\r\n </div>\r\n\r\n <div [ngClass]=\"{ 'invisible': !_isLoadingMessage }\">\r\n <i class=\"spinner-border\"></i>\r\n </div>\r\n </td>\r\n }\r\n\r\n <!-- Dynamic Column -->\r\n @for(header of gridColumns(); track header.indexColumn) {\r\n @if(_IsCellType(header.columnName, row, 'template')) {\r\n <td class=\"template\"\r\n (click)=\"_isDisabled() ? null : onClickRow.emit(row)\"\r\n (dblclick)=\"_isDisabled() ? null : onDoubleClickRow.emit(row)\">\r\n <div [innerHTML]=\"GetAttribute(header.columnName, row, 'template', 'defaul-cell') | html\" class=\"template\"></div>\r\n </td>\r\n }\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerTextbox')) {\r\n <!-- coer-textbox -->\r\n <td class=\"coer-textbox\">\r\n <coer-textbox\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerTextbox') || _isDisabled() || _isLoading\"\r\n [isValid]=\"GetAttribute(header.columnName, row, 'isValid', 'coerTextbox') || false\"\r\n [isInvalid]=\"GetAttribute(header.columnName, row, 'isInvalid', 'coerTextbox') || false\"\r\n [selectOnFocus]=\"GetAttribute(header.columnName, row, 'selectOnFocus', 'coerTextbox') || true\"\r\n [placeholder]=\"GetAttribute(header.columnName, row, 'placeholder', 'coerTextbox') || ('Type ' + header.columnName + '...')\"\r\n [textPosition]=\"GetAttribute(header.columnName, row, 'textPosition', 'coerTextbox') || 'left'\"\r\n [minLength]=\"GetAttribute(header.columnName, row, 'minLength', 'coerTextbox') || 0\"\r\n [maxLength]=\"GetAttribute(header.columnName, row, 'maxLength', 'coerTextbox') || 50\"\r\n (onInput)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-textbox')\"\r\n (onKeyupEnter)=\"KeyupEnter(header.indexColumn, row, 'coer-textbox', $event)\"\r\n ></coer-textbox>\r\n </td>\r\n }\r\n\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerNumberbox')) {\r\n <!-- coer-numberbox -->\r\n <td class=\"coer-numberbox\">\r\n <coer-numberbox\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerNumberbox') || _isDisabled() || _isLoading\"\r\n [isValid]=\"GetAttribute(header.columnName, row, 'isValid', 'coerNumberbox') || false\"\r\n [isInvalid]=\"GetAttribute(header.columnName, row, 'isInvalid', 'coerNumberbox') || false\"\r\n [selectOnFocus]=\"GetAttribute(header.columnName, row, 'selectOnFocus', 'coerNumberbox') || true\"\r\n [placeholder]=\"GetAttribute(header.columnName, row, 'placeholder', 'coerNumberbox') || ''\"\r\n [textPosition]=\"GetAttribute(header.columnName, row, 'textPosition', 'coerNumberbox') || 'right'\"\r\n [min]=\"GetAttribute(header.columnName, row, 'min', 'coerNumberbox') || 0\"\r\n [max]=\"GetAttribute(header.columnName, row, 'max', 'coerNumberbox') || 2147483647\"\r\n [decimals]=\"GetAttribute(header.columnName, row, 'decimals', 'coerNumberbox') || 0\"\r\n (onInput)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-numberbox')\"\r\n (onKeyupEnter)=\"KeyupEnter(header.indexColumn, row, 'coer-numberbox', $event)\"\r\n ></coer-numberbox>\r\n </td>\r\n }\r\n\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerSelectbox')) {\r\n <!-- coer-numberbox -->\r\n <td class=\"coer-selectbox\">\r\n <coer-selectbox\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerSelectbox') || _isDisabled() || _isLoading\"\r\n [isValid]=\"GetAttribute(header.columnName, row, 'isValid', 'coerSelectbox') || false\"\r\n [isInvalid]=\"GetAttribute(header.columnName, row, 'isInvalid', 'coerSelectbox') || false\"\r\n [dataSource]=\"GetAttribute(header.columnName, row, 'dataSource', 'coerSelectbox') || []\"\r\n [placeholder]=\"GetAttribute(header.columnName, row, 'placeholder', 'coerSelectbox') || '-- Select --'\"\r\n [propDisplay]=\"GetAttribute(header.columnName, row, 'propDisplay', 'coerSelectbox') || 'name'\"\r\n (onSelected)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-selectbox'); KeyupEnter(header.indexColumn, row, 'coer-selectbox', $event)\"\r\n ></coer-selectbox>\r\n </td>\r\n }\r\n\r\n\r\n @else if(_IsCellType(header.columnName, row, 'coerSwitch')) {\r\n <!-- coer-switch -->\r\n <td>\r\n <coer-switch\r\n [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [(ngModel)]=\"row[header.columnName]\"\r\n [isDisabled]=\"GetAttribute(header.columnName, row, 'isDisabled', 'coerSwitch') || _isDisabled() || _isLoading\"\r\n [tooltip]=\"GetAttribute(header.columnName, row, 'tooltip', 'coerSwitch')\"\r\n [tooltipPosition]=\"GetAttribute(header.columnName, row, 'tooltipPosition', 'coerSwitch') || 'left'\"\r\n [isInvisible]=\"_isDisabled()\"\r\n (onChange)=\"InputChange(row.indexRow, header.columnName, $event, 'coer-switch')\"\r\n ></coer-switch>\r\n </td>\r\n }\r\n\r\n @else {\r\n <!-- Default Cell -->\r\n <td class=\"default-cell\"\r\n (click)=\"ClickOnRow(row)\"\r\n (dblclick)=\"_isDisabled() ? null : onDoubleClickRow.emit(row)\"\r\n [ngStyle]=\"{\r\n 'text-align': GetAttribute(header.columnName, row, 'textAlign', 'defaul-cell'),\r\n 'white-space': 'normal'\r\n }\">\r\n\r\n <div [id]=\"_GetId(row.indexRow, header.indexColumn)\"\r\n [ngClass]=\"{\r\n 'text-blue-bold': _IsCellColor(header.columnName, row, 'colorBlue'),\r\n 'text-green-bold': _IsCellColor(header.columnName, row, 'colorGreen'),\r\n 'text-yellow-bold': _IsCellColor(header.columnName, row, 'colorYellow'),\r\n 'text-red-bold': _IsCellColor(header.columnName, row, 'colorRed'),\r\n 'text-right-bold': _IsCellType(header.columnName, row, 'number')\r\n }\">\r\n\r\n @if(_IsCellType(header.columnName, row, 'number')) {\r\n <span> {{ GetNumericFormat(row[header.columnName]) }} </span>\r\n }\r\n\r\n @else if(_IsCellType(header.columnName, row, 'date')) {\r\n <span> {{ GetDateFormat(row[header.columnName]) }} </span>\r\n }\r\n\r\n @else {\r\n <span> {{ _GetCellValue(row, header.columnName) }} </span>\r\n }\r\n </div>\r\n </td>\r\n }\r\n }\r\n\r\n <!-- Delete Button -->\r\n @if(ButtonByRow('showDeleteButton')) {\r\n <td class=\"action-button\">\r\n @if(ButtonByRow('showDeleteButton', row)) {\r\n <coer-button\r\n type=\"icon-no-border\"\r\n color=\"navigation\"\r\n icon=\"delete\"\r\n [tooltip]=\"_GetTooltip('Delete', row)\"\r\n [isInvisible]=\"_isDisabled()\"\r\n [isDisabled]=\"_isLoading\"\r\n (onClick)=\"onClickDeleteRow.emit(row)\"\r\n ></coer-button>\r\n }\r\n </td>\r\n }\r\n\r\n <!-- Edit Button -->\r\n @if(ButtonByRow('showEditButton')) {\r\n <td class=\"action-button\">\r\n @if(ButtonByRow('showEditButton', row)) {\r\n <coer-button\r\n type=\"icon-no-border\"\r\n color=\"navigation\"\r\n icon=\"edit\"\r\n [tooltip]=\"_GetTooltip('Edit', row)\"\r\n [isInvisible]=\"_isDisabled()\"\r\n [isDisabled]=\"_isLoading\"\r\n (onClick)=\"onClickEditRow.emit(row)\"\r\n ></coer-button>\r\n }\r\n </td>\r\n }\r\n\r\n <!-- GO Button -->\r\n @if(ButtonByRow('showGoButton')) {\r\n <td class=\"action-button\">\r\n @if(ButtonByRow('showGoButton', row)) {\r\n <coer-button\r\n type=\"icon-no-border\"\r\n color=\"navigation\"\r\n icon=\"go\"\r\n [tooltip]=\"_GetTooltip('Go to', row, 'detail')\"\r\n [isInvisible]=\"_isDisabled()\"\r\n [isDisabled]=\"_isLoading\"\r\n (onClick)=\"onClickEditRow.emit(row)\"\r\n ></coer-button>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n }\r\n </table>\r\n </div>\r\n </section>\r\n\r\n @if(showFooter()) {\r\n <footer class=\"grid-footer\">\r\n <span>\r\n @if(_isLoadingMessage) {\r\n <span class=\"fa-fade\"> Loading </span>\r\n }\r\n\r\n @else if(gridLength().dataSourceSelected > 0) {\r\n <span>\r\n <i class=\"bi bi-check2-square ms-1\"></i>\r\n {{ gridLength().dataSourceSelected }}\r\n </span>\r\n }\r\n </span>\r\n\r\n <span class=\"me-1\"> {{ gridLength().dataSourceFiltered | numericFormat }} Rows </span>\r\n </footer>\r\n }\r\n</div>", styles: ["div.coer-grid *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-grid .text-blue{color:#0d6efd!important}div.coer-grid .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-grid .background-blue{background-color:#0d6efd!important}div.coer-grid .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-grid .border-blue{border-color:#0d6efd!important}div.coer-grid .text-gray{color:#6c757d!important}div.coer-grid .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-grid .background-gray{background-color:#6c757d!important}div.coer-grid .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-grid .border-gray{border-color:#6c757d!important}div.coer-grid .text-green{color:#198754!important}div.coer-grid .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-grid .background-green{background-color:#198754!important}div.coer-grid .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-grid .border-green{border-color:#198754!important}div.coer-grid .text-yellow{color:#ffc107!important}div.coer-grid .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-grid .background-yellow{background-color:#ffc107!important}div.coer-grid .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-grid .border-yellow{border-color:#ffc107!important}div.coer-grid .text-red{color:#dc3545!important}div.coer-grid .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-grid .background-red{background-color:#dc3545!important}div.coer-grid .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-grid .border-red{border-color:#dc3545!important}div.coer-grid .text-white{color:#f5f5f5!important}div.coer-grid .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-grid .background-white{background-color:#f5f5f5!important}div.coer-grid .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-grid .border-white{border-color:#f5f5f5!important}div.coer-grid .text-black{color:#252525!important}div.coer-grid .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-grid .background-black{background-color:#252525!important}div.coer-grid .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-grid .border-black{border-color:#252525!important}div.coer-grid .text-orange{color:#fd6031!important}div.coer-grid .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-grid .background-orange{background-color:#fd6031!important}div.coer-grid .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-grid .border-orange{border-color:#fd6031!important}div.coer-grid header{align-items:flex-end;justify-content:flex-end;padding-right:8px;margin:0}div.coer-grid header>div{padding:0 0 10px 10px;display:flex;align-items:baseline}div.coer-grid header>div a{height:40px!important}div.coer-grid table{table-layout:auto;border-collapse:separate;border-spacing:1px 0px;margin:0;font-size:14px}div.coer-grid table thead tr th{position:sticky!important;z-index:100!important;top:0!important;background-color:#6c757d!important;color:#f5f5f5!important;padding:5px!important;vertical-align:middle!important;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;min-width:50px!important;white-space:nowrap!important}div.coer-grid table tbody{border:0px!important}div.coer-grid table tbody tr:not(.row-focus):hover td{color:#000!important;background-color:#f1f6ff!important}div.coer-grid table tbody tr td{border:0px!important;padding:5px!important;vertical-align:middle!important;white-space:break-spaces;text-overflow:ellipsis;overflow:hidden}div.coer-grid table tbody tr.row-focus td{background-color:#cde1ff}div.coer-grid table tbody tr td.coer-textbox,div.coer-grid table tbody tr td.coer-numberbox,div.coer-grid table tbody tr td.coer-selectbox{padding:0!important;overflow:visible!important}div.coer-grid table tbody tr td.default-cell{cursor:pointer!important}div.coer-grid table tbody tr td.template{display:block!important;white-space:nowrap!important;cursor:pointer!important;height:31px}div.coer-grid table tbody tr td.template>div.template{display:block!important}div.coer-grid table thead tr th.action-button,div.coer-grid table thead tr td.action-button,div.coer-grid table thead tr th.check-box,div.coer-grid table thead tr td.check-box,div.coer-grid table tbody tr th.action-button,div.coer-grid table tbody tr td.action-button,div.coer-grid table tbody tr th.check-box table tbody tr td.check-box{text-align:center!important;cursor:default!important;min-width:40px!important;max-width:40px!important;width:40px!important;padding:0!important}div.coer-grid footer.grid-footer{display:flex;align-items:center;justify-content:space-between;font-size:small;color:#999;padding-top:5px}div.coer-grid section.grid-container{position:relative;overflow:auto}div.coer-grid div.loading,div.coer-grid div.no-data{position:absolute;display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:25px;color:gray}div.coer-grid div.loading{background-color:#bbbbbb83!important;flex-direction:column!important;gap:10px!important}div.coer-grid div.loading span.fa-fade{position:relative!important;top:50px!important}div.coer-grid tr.loading{background-color:#bbbbbb83!important}div.coer-grid div.loading i.spinner-border{color:#fd6031!important;width:70px!important;height:70px!important;font-size:20px!important;position:absolute!important}div.coer-grid td.check-box i.spinner-border{width:15px!important;height:15px!important;color:#fd6031!important}div.coer-grid table thead tr th.check-box>div,div.coer-grid table tbody tr td.check-box>div{display:flex;align-items:center;justify-content:center;cursor:default!important}div.coer-grid input.form-check-input{box-shadow:none!important;margin:0}div.coer-grid input[type=checkbox]{cursor:pointer!important}div.coer-grid td.group{padding:0!important;margin:0!important}div.coer-grid td.group>*{border-top:1px solid #6c757d!important;border-bottom:1px solid #6c757d!important;padding:0!important;margin:0!important}div.coer-grid .template,div.coer-grid .template div{white-space:nowrap!important;display:flex!important;align-items:center!important;gap:5px!important}\n"] }]
|
2283
|
+
}] });
|
2284
|
+
|
2285
|
+
//import { navigation } from 'src/app/app-routing.sidenav';
|
2286
|
+
//import { Source } from 'src/app/modules/home/classes';
|
2287
|
+
//import { IAppNavigation, IGoBack } from 'src/app/modules/home/interfaces';
|
2288
|
+
class CoerPageTitle {
|
2289
|
+
constructor() {
|
2290
|
+
this.title = null;
|
2291
|
+
this.showNavigation = true;
|
2292
|
+
this.breadcrumbs = [];
|
2293
|
+
this.goBack = { show: false };
|
2294
|
+
this.showInformation = false;
|
2295
|
+
}
|
2296
|
+
get _icon() {
|
2297
|
+
const MENU = Menu.Get();
|
2298
|
+
if (MENU) {
|
2299
|
+
const MENU_SELECTED = MENU.tree.shift();
|
2300
|
+
if (MENU_SELECTED && MENU_SELECTED.icon) {
|
2301
|
+
return MENU_SELECTED.icon;
|
2302
|
+
}
|
2303
|
+
}
|
2304
|
+
return 'bi bi-house-door-fill';
|
2305
|
+
}
|
2306
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerPageTitle, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
2307
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CoerPageTitle, selector: "coer-page-title", inputs: { title: "title", showNavigation: "showNavigation", breadcrumbs: "breadcrumbs", goBack: "goBack", showInformation: "showInformation" }, ngImport: i0, template: "<header class=\"coer-page-title\" title=''>\r\n <h2>\r\n <span> {{ title }} </span>\r\n\r\n <!-- Button Information -->\r\n <button\r\n *ngIf=\"showInformation\">\r\n <i class=\"bi bi-info-circle\"></i>\r\n </button>\r\n </h2>\r\n\r\n <!-- Navigation -->\r\n <nav *ngIf=\"showNavigation\" aria-label=\"breadcrumb\">\r\n <ol class=\"breadcrumb\">\r\n <li class=\"breadcrumb-item\">\r\n <a><i [class]=\"_icon\"></i></a>\r\n </li>\r\n\r\n <li *ngFor=\"let nav of breadcrumbs\" class=\"breadcrumb-item\">\r\n <a [routerLink]='(nav.path && nav.path.length > 0) ? nav.path : null'\r\n [queryParams]='nav.queryParams'\r\n (click)=\"(nav.click) ? nav.click() : null\">\r\n {{ nav.page }}\r\n </a>\r\n </li>\r\n </ol>\r\n\r\n <!-- Go Back -->\r\n <a *ngIf=\"goBack.show\"\r\n [routerLink]=\"goBack.path\"\r\n [queryParams]='goBack.queryParams'\r\n (click)=\"(goBack.click) ? goBack.click() : null\">\r\n Go back\r\n </a>\r\n </nav>\r\n\r\n <!-- Tooltip\r\n <dx-tooltip coer-tooltip target=\"#btn-information\" text='Information'></dx-tooltip> -->\r\n</header>\r\n\r\n\r\n<!-- Information\r\n<dx-popup\r\n [(visible)]=\"showModal\"\r\n minWidth=\"500px\" minHeight=\"430px\"\r\n [width]=\"width\" [height]=\"height\"\r\n [hideOnOutsideClick]=\"true\"\r\n [resizeEnabled]=\"false\"\r\n [dragEnabled]=\"true\"\r\n (onHidden)=\"(showModal = false)\"\r\n >\r\n\r\n -- Header --\r\n <header *dxTemplate=\"let data of 'title'\">\r\n <div class=\"modal-header\">\r\n <h5> <i [class]=\"informationIcon\" [style]=\"{ 'color': informationIconColor }\"></i> {{ informationTitle }} </h5>\r\n <button (click)=\"(showModal = false)\" class=\"btn btn-close\"></button>\r\n </div>\r\n </header>\r\n\r\n -- Body --\r\n <section *dxTemplate=\"let data of 'content'\">\r\n <dx-scroll-view width=\"100%\" height=\"100%\">\r\n <ol class=\"list-group list-group-numbered\">\r\n <li class=\"list-group-item\">Respects the order of the columns like the template.</li>\r\n\r\n <li class=\"list-group-item\">\r\n For more information<a [href]=\"urlTemplate\">click here </a>to download the template\r\n </li>\r\n </ol>\r\n </dx-scroll-view>\r\n </section>\r\n\r\n -- Button --\r\n <dxi-toolbar-item toolbar=\"bottom\" location=\"after\">\r\n <div *dxTemplate=\"let data of 'menu-item'\" class=\"h-100\">\r\n <dx-button\r\n coer-button\r\n icon=\"fa-solid fa-xmark\" text=\"CLOSE\"\r\n width=\"125px\" height=\"40px\"\r\n (onClick)=\"(showModal = false)\"\r\n color=\"red\"\r\n ></dx-button>\r\n </div>\r\n </dxi-toolbar-item>\r\n</dx-popup> -->", styles: ["header.coer-page-title{margin:15px 30px 0}header.coer-page-title *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}header.coer-page-title .text-blue{color:#0d6efd!important}header.coer-page-title .text-blue-bold{color:#0d6efd!important;font-weight:700!important}header.coer-page-title .background-blue{background-color:#0d6efd!important}header.coer-page-title .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}header.coer-page-title .border-blue{border-color:#0d6efd!important}header.coer-page-title .text-gray{color:#6c757d!important}header.coer-page-title .text-gray-bold{color:#6c757d!important;font-weight:700!important}header.coer-page-title .background-gray{background-color:#6c757d!important}header.coer-page-title .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}header.coer-page-title .border-gray{border-color:#6c757d!important}header.coer-page-title .text-green{color:#198754!important}header.coer-page-title .text-green-bold{color:#198754!important;font-weight:700!important}header.coer-page-title .background-green{background-color:#198754!important}header.coer-page-title .background-border-green{background-color:#198754!important;border-color:#198754!important}header.coer-page-title .border-green{border-color:#198754!important}header.coer-page-title .text-yellow{color:#ffc107!important}header.coer-page-title .text-yellow-bold{color:#ffc107!important;font-weight:700!important}header.coer-page-title .background-yellow{background-color:#ffc107!important}header.coer-page-title .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}header.coer-page-title .border-yellow{border-color:#ffc107!important}header.coer-page-title .text-red{color:#dc3545!important}header.coer-page-title .text-red-bold{color:#dc3545!important;font-weight:700!important}header.coer-page-title .background-red{background-color:#dc3545!important}header.coer-page-title .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}header.coer-page-title .border-red{border-color:#dc3545!important}header.coer-page-title .text-white{color:#f5f5f5!important}header.coer-page-title .text-white-bold{color:#f5f5f5!important;font-weight:700!important}header.coer-page-title .background-white{background-color:#f5f5f5!important}header.coer-page-title .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}header.coer-page-title .border-white{border-color:#f5f5f5!important}header.coer-page-title .text-black{color:#252525!important}header.coer-page-title .text-black-bold{color:#252525!important;font-weight:700!important}header.coer-page-title .background-black{background-color:#252525!important}header.coer-page-title .background-border-black{background-color:#252525!important;border-color:#252525!important}header.coer-page-title .border-black{border-color:#252525!important}header.coer-page-title .text-orange{color:#fd6031!important}header.coer-page-title .text-orange-bold{color:#fd6031!important;font-weight:700!important}header.coer-page-title .background-orange{background-color:#fd6031!important}header.coer-page-title .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}header.coer-page-title .border-orange{border-color:#fd6031!important}header.coer-page-title h2{margin:0 0 10px;display:flex;align-items:center;justify-content:space-between;height:20px;font-size:20px}header.coer-page-title h2 span{font-size:20px!important}header.coer-page-title nav{height:25px;font-size:small;background-color:#f5f5f5;display:flex;align-items:center;justify-content:space-between}header.coer-page-title ol,header.coer-page-title a,header.coer-page-title .bi-info-circle{margin:0;padding-left:5px;text-decoration:none;color:#0d6efd!important;font-weight:400!important;cursor:pointer!important}header.coer-page-title ol::selection,header.coer-page-title a::selection{background-color:transparent!important}header.coer-page-title li{border:none}header.coer-page-title li.list-group-item a{color:#fd6031!important}header.coer-page-title button{border:none;outline:none;background-color:transparent;padding-right:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] }); }
|
2308
|
+
}
|
2309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerPageTitle, decorators: [{
|
2310
|
+
type: Component,
|
2311
|
+
args: [{ selector: 'coer-page-title', template: "<header class=\"coer-page-title\" title=''>\r\n <h2>\r\n <span> {{ title }} </span>\r\n\r\n <!-- Button Information -->\r\n <button\r\n *ngIf=\"showInformation\">\r\n <i class=\"bi bi-info-circle\"></i>\r\n </button>\r\n </h2>\r\n\r\n <!-- Navigation -->\r\n <nav *ngIf=\"showNavigation\" aria-label=\"breadcrumb\">\r\n <ol class=\"breadcrumb\">\r\n <li class=\"breadcrumb-item\">\r\n <a><i [class]=\"_icon\"></i></a>\r\n </li>\r\n\r\n <li *ngFor=\"let nav of breadcrumbs\" class=\"breadcrumb-item\">\r\n <a [routerLink]='(nav.path && nav.path.length > 0) ? nav.path : null'\r\n [queryParams]='nav.queryParams'\r\n (click)=\"(nav.click) ? nav.click() : null\">\r\n {{ nav.page }}\r\n </a>\r\n </li>\r\n </ol>\r\n\r\n <!-- Go Back -->\r\n <a *ngIf=\"goBack.show\"\r\n [routerLink]=\"goBack.path\"\r\n [queryParams]='goBack.queryParams'\r\n (click)=\"(goBack.click) ? goBack.click() : null\">\r\n Go back\r\n </a>\r\n </nav>\r\n\r\n <!-- Tooltip\r\n <dx-tooltip coer-tooltip target=\"#btn-information\" text='Information'></dx-tooltip> -->\r\n</header>\r\n\r\n\r\n<!-- Information\r\n<dx-popup\r\n [(visible)]=\"showModal\"\r\n minWidth=\"500px\" minHeight=\"430px\"\r\n [width]=\"width\" [height]=\"height\"\r\n [hideOnOutsideClick]=\"true\"\r\n [resizeEnabled]=\"false\"\r\n [dragEnabled]=\"true\"\r\n (onHidden)=\"(showModal = false)\"\r\n >\r\n\r\n -- Header --\r\n <header *dxTemplate=\"let data of 'title'\">\r\n <div class=\"modal-header\">\r\n <h5> <i [class]=\"informationIcon\" [style]=\"{ 'color': informationIconColor }\"></i> {{ informationTitle }} </h5>\r\n <button (click)=\"(showModal = false)\" class=\"btn btn-close\"></button>\r\n </div>\r\n </header>\r\n\r\n -- Body --\r\n <section *dxTemplate=\"let data of 'content'\">\r\n <dx-scroll-view width=\"100%\" height=\"100%\">\r\n <ol class=\"list-group list-group-numbered\">\r\n <li class=\"list-group-item\">Respects the order of the columns like the template.</li>\r\n\r\n <li class=\"list-group-item\">\r\n For more information<a [href]=\"urlTemplate\">click here </a>to download the template\r\n </li>\r\n </ol>\r\n </dx-scroll-view>\r\n </section>\r\n\r\n -- Button --\r\n <dxi-toolbar-item toolbar=\"bottom\" location=\"after\">\r\n <div *dxTemplate=\"let data of 'menu-item'\" class=\"h-100\">\r\n <dx-button\r\n coer-button\r\n icon=\"fa-solid fa-xmark\" text=\"CLOSE\"\r\n width=\"125px\" height=\"40px\"\r\n (onClick)=\"(showModal = false)\"\r\n color=\"red\"\r\n ></dx-button>\r\n </div>\r\n </dxi-toolbar-item>\r\n</dx-popup> -->", styles: ["header.coer-page-title{margin:15px 30px 0}header.coer-page-title *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}header.coer-page-title .text-blue{color:#0d6efd!important}header.coer-page-title .text-blue-bold{color:#0d6efd!important;font-weight:700!important}header.coer-page-title .background-blue{background-color:#0d6efd!important}header.coer-page-title .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}header.coer-page-title .border-blue{border-color:#0d6efd!important}header.coer-page-title .text-gray{color:#6c757d!important}header.coer-page-title .text-gray-bold{color:#6c757d!important;font-weight:700!important}header.coer-page-title .background-gray{background-color:#6c757d!important}header.coer-page-title .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}header.coer-page-title .border-gray{border-color:#6c757d!important}header.coer-page-title .text-green{color:#198754!important}header.coer-page-title .text-green-bold{color:#198754!important;font-weight:700!important}header.coer-page-title .background-green{background-color:#198754!important}header.coer-page-title .background-border-green{background-color:#198754!important;border-color:#198754!important}header.coer-page-title .border-green{border-color:#198754!important}header.coer-page-title .text-yellow{color:#ffc107!important}header.coer-page-title .text-yellow-bold{color:#ffc107!important;font-weight:700!important}header.coer-page-title .background-yellow{background-color:#ffc107!important}header.coer-page-title .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}header.coer-page-title .border-yellow{border-color:#ffc107!important}header.coer-page-title .text-red{color:#dc3545!important}header.coer-page-title .text-red-bold{color:#dc3545!important;font-weight:700!important}header.coer-page-title .background-red{background-color:#dc3545!important}header.coer-page-title .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}header.coer-page-title .border-red{border-color:#dc3545!important}header.coer-page-title .text-white{color:#f5f5f5!important}header.coer-page-title .text-white-bold{color:#f5f5f5!important;font-weight:700!important}header.coer-page-title .background-white{background-color:#f5f5f5!important}header.coer-page-title .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}header.coer-page-title .border-white{border-color:#f5f5f5!important}header.coer-page-title .text-black{color:#252525!important}header.coer-page-title .text-black-bold{color:#252525!important;font-weight:700!important}header.coer-page-title .background-black{background-color:#252525!important}header.coer-page-title .background-border-black{background-color:#252525!important;border-color:#252525!important}header.coer-page-title .border-black{border-color:#252525!important}header.coer-page-title .text-orange{color:#fd6031!important}header.coer-page-title .text-orange-bold{color:#fd6031!important;font-weight:700!important}header.coer-page-title .background-orange{background-color:#fd6031!important}header.coer-page-title .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}header.coer-page-title .border-orange{border-color:#fd6031!important}header.coer-page-title h2{margin:0 0 10px;display:flex;align-items:center;justify-content:space-between;height:20px;font-size:20px}header.coer-page-title h2 span{font-size:20px!important}header.coer-page-title nav{height:25px;font-size:small;background-color:#f5f5f5;display:flex;align-items:center;justify-content:space-between}header.coer-page-title ol,header.coer-page-title a,header.coer-page-title .bi-info-circle{margin:0;padding-left:5px;text-decoration:none;color:#0d6efd!important;font-weight:400!important;cursor:pointer!important}header.coer-page-title ol::selection,header.coer-page-title a::selection{background-color:transparent!important}header.coer-page-title li{border:none}header.coer-page-title li.list-group-item a{color:#fd6031!important}header.coer-page-title button{border:none;outline:none;background-color:transparent;padding-right:8px}\n"] }]
|
2312
|
+
}], propDecorators: { title: [{
|
2313
|
+
type: Input
|
2314
|
+
}], showNavigation: [{
|
2315
|
+
type: Input
|
2316
|
+
}], breadcrumbs: [{
|
2317
|
+
type: Input
|
2318
|
+
}], goBack: [{
|
2319
|
+
type: Input
|
2320
|
+
}], showInformation: [{
|
2321
|
+
type: Input
|
2322
|
+
}] } });
|
2323
|
+
|
2324
|
+
class CoerTab {
|
2325
|
+
constructor() {
|
2326
|
+
//Variables
|
2327
|
+
this._id = Tools.GetGuid('coer-tab');
|
2328
|
+
this._selectedIndex = 0;
|
2329
|
+
this.matTabGroup = viewChild.required('matTabGroup');
|
2330
|
+
this._tooltipList = [];
|
2331
|
+
//Inputs
|
2332
|
+
this.height = input('auto');
|
2333
|
+
this.minHeight = input('300px');
|
2334
|
+
this.maxHeight = input('auto');
|
2335
|
+
//Computed
|
2336
|
+
this.contentList = computed(() => Array.from(this.contentRef._results));
|
2337
|
+
//Outputs
|
2338
|
+
this.onSelectedTab = output();
|
2339
|
+
}
|
2340
|
+
set selectedIndex(value) {
|
2341
|
+
if (Tools.IsNotNull(value)) {
|
2342
|
+
this._selectedIndex = value;
|
2343
|
+
}
|
2344
|
+
}
|
2345
|
+
set alignTabs(value) {
|
2346
|
+
if (Tools.IsNotNull(this._matTabGroup)) {
|
2347
|
+
if (Tools.IsNotNull(value)) {
|
2348
|
+
this._matTabGroup.removeAttribute('mat-align-tabs');
|
2349
|
+
Tools.Sleep().then(() => {
|
2350
|
+
this._matTabGroup.setAttribute('mat-align-tabs', value);
|
2351
|
+
});
|
2352
|
+
}
|
2353
|
+
}
|
2354
|
+
else
|
2355
|
+
Tools.Sleep().then(() => this.alignTabs = value);
|
2356
|
+
}
|
2357
|
+
ngOnInit() {
|
2358
|
+
this._matTabGroup = this.matTabGroup()._elementRef.nativeElement;
|
2359
|
+
}
|
2360
|
+
ngOnDestroy() {
|
2361
|
+
for (const _tooltip of this._tooltipList) {
|
2362
|
+
_tooltip.tooltip?.dispose();
|
2363
|
+
}
|
2364
|
+
}
|
2365
|
+
/** */
|
2366
|
+
SelectedIndexChange(selectedIndex) {
|
2367
|
+
this._selectedIndex = selectedIndex;
|
2368
|
+
this.onSelectedTab.emit(this.contentList()[selectedIndex]);
|
2369
|
+
}
|
2370
|
+
/** */
|
2371
|
+
GetTitle(tab) {
|
2372
|
+
const ref = this.contentList().find(x => x.coerRef() == tab.coerRef());
|
2373
|
+
return (ref.title().length > 0) ? ref.title() : ref.coerRef();
|
2374
|
+
}
|
2375
|
+
/** */
|
2376
|
+
GetIcon(tab) {
|
2377
|
+
return this.contentList().find(x => x.coerRef() == tab.coerRef()).icon();
|
2378
|
+
}
|
2379
|
+
/** */
|
2380
|
+
SelectTabBy(callback) {
|
2381
|
+
const index = this.contentList().findIndex(callback);
|
2382
|
+
if (index >= 0)
|
2383
|
+
this._selectedIndex = index;
|
2384
|
+
}
|
2385
|
+
/** */
|
2386
|
+
SetToolTip(tab) {
|
2387
|
+
const id = `${this._id}-${tab.coerRef()}`;
|
2388
|
+
if (!this._tooltipList.some(x => x.id == id) && tab.tooltip().length > 0) {
|
2389
|
+
this._tooltipList.push({ id });
|
2390
|
+
Tools.Sleep().then(() => {
|
2391
|
+
const htmlElement = document.getElementById(id);
|
2392
|
+
if (htmlElement) {
|
2393
|
+
const tooltip = new Tooltip(htmlElement, {
|
2394
|
+
html: true,
|
2395
|
+
title: tab.tooltip(),
|
2396
|
+
placement: 'top'
|
2397
|
+
});
|
2398
|
+
htmlElement.addEventListener('mouseleave', () => {
|
2399
|
+
if (htmlElement)
|
2400
|
+
tooltip.hide();
|
2401
|
+
});
|
2402
|
+
const index = this._tooltipList.findIndex(x => x.id == id);
|
2403
|
+
if (index >= 0)
|
2404
|
+
this._tooltipList[index].tooltip = tooltip;
|
2405
|
+
}
|
2406
|
+
});
|
2407
|
+
}
|
2408
|
+
return id;
|
2409
|
+
}
|
2410
|
+
/** */
|
2411
|
+
RemoveTooltip(element) {
|
2412
|
+
const id = element.getAttribute('id');
|
2413
|
+
const index = this._tooltipList.findIndex(x => x.id == id);
|
2414
|
+
if (index >= 0)
|
2415
|
+
this._tooltipList.splice(index, 1);
|
2416
|
+
}
|
2417
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerTab, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
2418
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerTab, selector: "coer-tab", inputs: { height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: false, isRequired: false, transformFunction: null }, alignTabs: { classPropertyName: "alignTabs", publicName: "alignTabs", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onSelectedTab: "onSelectedTab" }, queries: [{ propertyName: "contentRef", predicate: CoerRefDirective }], viewQueries: [{ propertyName: "matTabGroup", first: true, predicate: ["matTabGroup"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"coer-tab\">\r\n <mat-tab-group #matTabGroup\r\n mat-stretch-tabs=\"false\"\r\n [selectedIndex]=\"_selectedIndex\"\r\n (selectedIndexChange)=\"SelectedIndexChange($event)\">\r\n\r\n @for(tab of contentList(); track tab.coerRef()) {\r\n @if(tab.show()) {\r\n <mat-tab [label]=\"tab.coerRef()\" [disabled]=\"tab.isDisabled()\">\r\n <ng-template mat-tab-label>\r\n <span [id]=\"SetToolTip(tab)\" class=\"tab\" lifecycle (onDestroy)=\"RemoveTooltip($event)\">\r\n <i [class]=\"GetIcon(tab)\"></i>\r\n <span [class]=\"GetIcon(tab).length > 0 ? 'ms-2' : ''\">\r\n {{ GetTitle(tab) }}\r\n </span>\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template matTabContent>\r\n <div class=\"tab-content\"\r\n [ngStyle]=\"{\r\n 'height': height(),\r\n 'min-height': minHeight(),\r\n 'max-height': maxHeight()\r\n }\">\r\n\r\n <ng-container [ngTemplateOutlet]=\"tab.template\"></ng-container>\r\n </div>\r\n </ng-template>\r\n </mat-tab>\r\n }\r\n }\r\n </mat-tab-group>\r\n</div>", styles: ["div.coer-tab *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-tab .text-blue{color:#0d6efd!important}div.coer-tab .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-tab .background-blue{background-color:#0d6efd!important}div.coer-tab .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-tab .border-blue{border-color:#0d6efd!important}div.coer-tab .text-gray{color:#6c757d!important}div.coer-tab .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-tab .background-gray{background-color:#6c757d!important}div.coer-tab .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-tab .border-gray{border-color:#6c757d!important}div.coer-tab .text-green{color:#198754!important}div.coer-tab .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-tab .background-green{background-color:#198754!important}div.coer-tab .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-tab .border-green{border-color:#198754!important}div.coer-tab .text-yellow{color:#ffc107!important}div.coer-tab .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-tab .background-yellow{background-color:#ffc107!important}div.coer-tab .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-tab .border-yellow{border-color:#ffc107!important}div.coer-tab .text-red{color:#dc3545!important}div.coer-tab .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-tab .background-red{background-color:#dc3545!important}div.coer-tab .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-tab .border-red{border-color:#dc3545!important}div.coer-tab .text-white{color:#f5f5f5!important}div.coer-tab .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-tab .background-white{background-color:#f5f5f5!important}div.coer-tab .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-tab .border-white{border-color:#f5f5f5!important}div.coer-tab .text-black{color:#252525!important}div.coer-tab .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-tab .background-black{background-color:#252525!important}div.coer-tab .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-tab .border-black{border-color:#252525!important}div.coer-tab .text-orange{color:#fd6031!important}div.coer-tab .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-tab .background-orange{background-color:#fd6031!important}div.coer-tab .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-tab .border-orange{border-color:#fd6031!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header{background-color:#f5f5f562!important;border-bottom:1px solid whitesmoke!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header div.mat-mdc-tab-label-container div.mat-mdc-tab-list div.mat-mdc-tab-labels div.mdc-tab.mat-mdc-tab{padding:0!important;height:35px!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header div.mat-mdc-tab-label-container div.mat-mdc-tab-list div.mat-mdc-tab-labels div.mdc-tab--active.mdc-tab-indicator--active *{color:#fd6031!important;border-color:#fd6031!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header span.tab{padding:10px 20px!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper{overflow:visible!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper mat-tab-body{overflow:visible!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper mat-tab-body div.mat-mdc-tab-body-content{width:auto!important;overflow:visible!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper mat-tab-body div.mat-mdc-tab-body-content div.tab-content{padding:5px}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2$4.MatTabContent, selector: "[matTabContent]" }, { kind: "directive", type: i2$4.MatTabLabel, selector: "[mat-tab-label], [matTabLabel]" }, { kind: "component", type: i2$4.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i2$4.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i3$3.LifeCycleDirective, selector: "[lifecycle]", outputs: ["OnChanges", "onInit", "afterViewInit", "onDestroy"] }] }); }
|
2419
|
+
}
|
2420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerTab, decorators: [{
|
2421
|
+
type: Component,
|
2422
|
+
args: [{ selector: 'coer-tab', template: "<div class=\"coer-tab\">\r\n <mat-tab-group #matTabGroup\r\n mat-stretch-tabs=\"false\"\r\n [selectedIndex]=\"_selectedIndex\"\r\n (selectedIndexChange)=\"SelectedIndexChange($event)\">\r\n\r\n @for(tab of contentList(); track tab.coerRef()) {\r\n @if(tab.show()) {\r\n <mat-tab [label]=\"tab.coerRef()\" [disabled]=\"tab.isDisabled()\">\r\n <ng-template mat-tab-label>\r\n <span [id]=\"SetToolTip(tab)\" class=\"tab\" lifecycle (onDestroy)=\"RemoveTooltip($event)\">\r\n <i [class]=\"GetIcon(tab)\"></i>\r\n <span [class]=\"GetIcon(tab).length > 0 ? 'ms-2' : ''\">\r\n {{ GetTitle(tab) }}\r\n </span>\r\n </span>\r\n </ng-template>\r\n\r\n <ng-template matTabContent>\r\n <div class=\"tab-content\"\r\n [ngStyle]=\"{\r\n 'height': height(),\r\n 'min-height': minHeight(),\r\n 'max-height': maxHeight()\r\n }\">\r\n\r\n <ng-container [ngTemplateOutlet]=\"tab.template\"></ng-container>\r\n </div>\r\n </ng-template>\r\n </mat-tab>\r\n }\r\n }\r\n </mat-tab-group>\r\n</div>", styles: ["div.coer-tab *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-tab .text-blue{color:#0d6efd!important}div.coer-tab .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-tab .background-blue{background-color:#0d6efd!important}div.coer-tab .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-tab .border-blue{border-color:#0d6efd!important}div.coer-tab .text-gray{color:#6c757d!important}div.coer-tab .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-tab .background-gray{background-color:#6c757d!important}div.coer-tab .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-tab .border-gray{border-color:#6c757d!important}div.coer-tab .text-green{color:#198754!important}div.coer-tab .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-tab .background-green{background-color:#198754!important}div.coer-tab .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-tab .border-green{border-color:#198754!important}div.coer-tab .text-yellow{color:#ffc107!important}div.coer-tab .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-tab .background-yellow{background-color:#ffc107!important}div.coer-tab .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-tab .border-yellow{border-color:#ffc107!important}div.coer-tab .text-red{color:#dc3545!important}div.coer-tab .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-tab .background-red{background-color:#dc3545!important}div.coer-tab .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-tab .border-red{border-color:#dc3545!important}div.coer-tab .text-white{color:#f5f5f5!important}div.coer-tab .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-tab .background-white{background-color:#f5f5f5!important}div.coer-tab .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-tab .border-white{border-color:#f5f5f5!important}div.coer-tab .text-black{color:#252525!important}div.coer-tab .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-tab .background-black{background-color:#252525!important}div.coer-tab .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-tab .border-black{border-color:#252525!important}div.coer-tab .text-orange{color:#fd6031!important}div.coer-tab .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-tab .background-orange{background-color:#fd6031!important}div.coer-tab .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-tab .border-orange{border-color:#fd6031!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header{background-color:#f5f5f562!important;border-bottom:1px solid whitesmoke!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header div.mat-mdc-tab-label-container div.mat-mdc-tab-list div.mat-mdc-tab-labels div.mdc-tab.mat-mdc-tab{padding:0!important;height:35px!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header div.mat-mdc-tab-label-container div.mat-mdc-tab-list div.mat-mdc-tab-labels div.mdc-tab--active.mdc-tab-indicator--active *{color:#fd6031!important;border-color:#fd6031!important}div.coer-tab mat-tab-group mat-tab-header.mat-mdc-tab-header span.tab{padding:10px 20px!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper{overflow:visible!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper mat-tab-body{overflow:visible!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper mat-tab-body div.mat-mdc-tab-body-content{width:auto!important;overflow:visible!important}div.coer-tab mat-tab-group div.mat-mdc-tab-body-wrapper mat-tab-body div.mat-mdc-tab-body-content div.tab-content{padding:5px}\n"] }]
|
2423
|
+
}], propDecorators: { contentRef: [{
|
2424
|
+
type: ContentChildren,
|
2425
|
+
args: [CoerRefDirective]
|
2426
|
+
}], selectedIndex: [{
|
2427
|
+
type: Input
|
2428
|
+
}], alignTabs: [{
|
2429
|
+
type: Input
|
2430
|
+
}] } });
|
2431
|
+
|
2432
|
+
class CoerTextarea extends ControlValue {
|
2433
|
+
constructor() {
|
2434
|
+
super(...arguments);
|
2435
|
+
//Component Value
|
2436
|
+
this._value = '';
|
2437
|
+
this.matFormField = viewChild.required('matFormField');
|
2438
|
+
this.coerTextBox = viewChild.required('coerTextArea');
|
2439
|
+
//Variables
|
2440
|
+
this._id = Tools.GetGuid('coer-textArea');
|
2441
|
+
this._isLoadingEvent = signal(false);
|
2442
|
+
this.id = '';
|
2443
|
+
this.label = input('');
|
2444
|
+
this.placeholder = input('');
|
2445
|
+
this.minLength = input(0);
|
2446
|
+
this.maxLength = input(2500);
|
2447
|
+
this.width = input('100%');
|
2448
|
+
this.minWidth = input('190px');
|
2449
|
+
this.maxWidth = input('100%');
|
2450
|
+
this.marginTop = input('0px');
|
2451
|
+
this.marginRight = input('0px');
|
2452
|
+
this.marginBottom = input('0px');
|
2453
|
+
this.marginLeft = input('0px');
|
2454
|
+
this.isInvalid = input(false);
|
2455
|
+
this.isValid = input(false);
|
2456
|
+
this.isDisabled = input(false);
|
2457
|
+
this.isReadonly = input(false);
|
2458
|
+
this.isLoading = input(false);
|
2459
|
+
this.showFooter = input(true);
|
2460
|
+
this.resize = input(false);
|
2461
|
+
this.textPosition = input('left');
|
2462
|
+
//Outputs
|
2463
|
+
this.onInput = output();
|
2464
|
+
//computed
|
2465
|
+
this._isEnable = computed(() => {
|
2466
|
+
return !this.isDisabled() && !this.isLoading() && !this.isReadonly();
|
2467
|
+
});
|
2468
|
+
//computed
|
2469
|
+
this.floatLabel = computed(() => {
|
2470
|
+
return this.label() == '' ? 'always' : 'auto';
|
2471
|
+
});
|
2472
|
+
//computed
|
2473
|
+
this.paddingRight = computed(() => {
|
2474
|
+
return this.isInvalid() || this.isValid()
|
2475
|
+
? '18px' : '0px';
|
2476
|
+
});
|
2477
|
+
}
|
2478
|
+
//Inputs
|
2479
|
+
set value(value) {
|
2480
|
+
if (Tools.IsNull(value))
|
2481
|
+
value = '';
|
2482
|
+
this.SetValue(value);
|
2483
|
+
}
|
2484
|
+
ngOnInit() {
|
2485
|
+
this.SetEvents();
|
2486
|
+
}
|
2487
|
+
//getter
|
2488
|
+
get value() {
|
2489
|
+
return this._value;
|
2490
|
+
}
|
2491
|
+
//getter
|
2492
|
+
get footer() {
|
2493
|
+
return `${Tools.IsNotNull(this._value) ? String(this._value).length : '0'} / ${this.maxLength()}`;
|
2494
|
+
}
|
2495
|
+
/** */
|
2496
|
+
SetEvents() {
|
2497
|
+
Tools.Sleep().then(() => {
|
2498
|
+
this.element = document.getElementById(this._id);
|
2499
|
+
if (this.element) {
|
2500
|
+
this.element.addEventListener('focus', () => {
|
2501
|
+
if (!this._isEnable())
|
2502
|
+
this.Blur();
|
2503
|
+
});
|
2504
|
+
this.element.addEventListener('blur', () => this.Blur());
|
2505
|
+
this.element.addEventListener('input', () => {
|
2506
|
+
Tools.Sleep().then(() => {
|
2507
|
+
const value = this.coerTextBox().nativeElement.value;
|
2508
|
+
if (this._isEnable())
|
2509
|
+
this.onInput.emit(value);
|
2510
|
+
});
|
2511
|
+
});
|
2512
|
+
this.element.addEventListener('paste', () => {
|
2513
|
+
Tools.Sleep().then(() => {
|
2514
|
+
this.SetValue(this._value.toString().trim());
|
2515
|
+
});
|
2516
|
+
});
|
2517
|
+
}
|
2518
|
+
});
|
2519
|
+
}
|
2520
|
+
/** */
|
2521
|
+
Focus(timeout = 0) {
|
2522
|
+
if (this._isLoadingEvent())
|
2523
|
+
return;
|
2524
|
+
else
|
2525
|
+
this._isLoadingEvent.set(true);
|
2526
|
+
Tools.Sleep(timeout).then(() => {
|
2527
|
+
if (this._isEnable()) {
|
2528
|
+
this.element.focus();
|
2529
|
+
}
|
2530
|
+
this._isLoadingEvent.set(false);
|
2531
|
+
});
|
2532
|
+
}
|
2533
|
+
/** */
|
2534
|
+
Select(timeout = 0) {
|
2535
|
+
if (this._isLoadingEvent())
|
2536
|
+
return;
|
2537
|
+
else
|
2538
|
+
this._isLoadingEvent.set(true);
|
2539
|
+
Tools.Sleep(timeout).then(() => {
|
2540
|
+
if (this._isEnable()) {
|
2541
|
+
this.element.focus();
|
2542
|
+
this.element.select();
|
2543
|
+
}
|
2544
|
+
this._isLoadingEvent.set(false);
|
2545
|
+
});
|
2546
|
+
}
|
2547
|
+
/** */
|
2548
|
+
Blur() {
|
2549
|
+
if (this._isLoadingEvent())
|
2550
|
+
return;
|
2551
|
+
else
|
2552
|
+
this._isLoadingEvent.set(true);
|
2553
|
+
Tools.Sleep().then(() => {
|
2554
|
+
if (this.element) {
|
2555
|
+
this.element.blur();
|
2556
|
+
Tools.Sleep().then(() => {
|
2557
|
+
const element = document.querySelector(`#${this._id}-container .mdc-line-ripple--active`);
|
2558
|
+
if (element)
|
2559
|
+
element.classList.remove('mdc-line-ripple--active');
|
2560
|
+
});
|
2561
|
+
}
|
2562
|
+
this._isLoadingEvent.set(false);
|
2563
|
+
});
|
2564
|
+
}
|
2565
|
+
/** */
|
2566
|
+
Clear() {
|
2567
|
+
this.SetValue('');
|
2568
|
+
this.Focus();
|
2569
|
+
}
|
2570
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerTextarea, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
2571
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: CoerTextarea, selector: "coer-textarea", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, marginTop: { classPropertyName: "marginTop", publicName: "marginTop", isSignal: true, isRequired: false, transformFunction: null }, marginRight: { classPropertyName: "marginRight", publicName: "marginRight", isSignal: true, isRequired: false, transformFunction: null }, marginBottom: { classPropertyName: "marginBottom", publicName: "marginBottom", isSignal: true, isRequired: false, transformFunction: null }, marginLeft: { classPropertyName: "marginLeft", publicName: "marginLeft", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isReadonly: { classPropertyName: "isReadonly", publicName: "isReadonly", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null }, textPosition: { classPropertyName: "textPosition", publicName: "textPosition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onInput: "onInput" }, providers: [CONTROL_VALUE(CoerTextarea)], viewQueries: [{ propertyName: "matFormField", first: true, predicate: ["matFormField"], descendants: true, isSignal: true }, { propertyName: "coerTextBox", first: true, predicate: ["coerTextArea"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"coer-textarea\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <textarea #coerTextArea matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [minLength]=\"minLength()\"\r\n [maxLength]=\"maxLength()\"\r\n [disabled]=\"!_isEnable()\"\r\n [value]=\"_value\"\r\n (input)=\"SetValue(coerTextArea.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight(),\r\n 'text-align': textPosition(),\r\n 'resize': (!resize() || !_isEnable()) ? 'none' : ''\r\n }\"></textarea>\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\">\r\n @if(isInvalid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n </span>\r\n </mat-form-field>\r\n\r\n @if(showFooter()) {\r\n <footer> {{ footer }} </footer>\r\n }\r\n</div>", styles: ["div.coer-textarea *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-textarea .text-blue{color:#0d6efd!important}div.coer-textarea .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-textarea .background-blue{background-color:#0d6efd!important}div.coer-textarea .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-textarea .border-blue{border-color:#0d6efd!important}div.coer-textarea .text-gray{color:#6c757d!important}div.coer-textarea .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-textarea .background-gray{background-color:#6c757d!important}div.coer-textarea .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-textarea .border-gray{border-color:#6c757d!important}div.coer-textarea .text-green{color:#198754!important}div.coer-textarea .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-textarea .background-green{background-color:#198754!important}div.coer-textarea .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-textarea .border-green{border-color:#198754!important}div.coer-textarea .text-yellow{color:#ffc107!important}div.coer-textarea .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-textarea .background-yellow{background-color:#ffc107!important}div.coer-textarea .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-textarea .border-yellow{border-color:#ffc107!important}div.coer-textarea .text-red{color:#dc3545!important}div.coer-textarea .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-textarea .background-red{background-color:#dc3545!important}div.coer-textarea .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-textarea .border-red{border-color:#dc3545!important}div.coer-textarea .text-white{color:#f5f5f5!important}div.coer-textarea .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-textarea .background-white{background-color:#f5f5f5!important}div.coer-textarea .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-textarea .border-white{border-color:#f5f5f5!important}div.coer-textarea .text-black{color:#252525!important}div.coer-textarea .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-textarea .background-black{background-color:#252525!important}div.coer-textarea .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-textarea .border-black{border-color:#252525!important}div.coer-textarea .text-orange{color:#fd6031!important}div.coer-textarea .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-textarea .background-orange{background-color:#fd6031!important}div.coer-textarea .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-textarea .border-orange{border-color:#fd6031!important}div.coer-textarea mat-form-field{position:relative!important}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;padding:0!important}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix textarea{font-weight:400!important;font-size:17px!important;color:#252525!important;min-height:80px}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-textarea mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-textarea mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;width:30px;height:40px;display:flex;align-items:center;justify-content:center}div.coer-textarea mat-form-field span.icon-container i{font-size:20px!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-textarea mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:100%!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-textarea mat-form-field .placeholder,div.coer-textarea mat-form-field .placeholder *,div.coer-textarea mat-form-field .placeholder-glow,div.coer-textarea mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-textarea footer{padding-top:2px;text-align:right;font-size:10px;color:#6c757d}div.coer-textarea mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$2.MatLabel, selector: "mat-label" }] }); }
|
2572
|
+
}
|
2573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CoerTextarea, decorators: [{
|
2574
|
+
type: Component,
|
2575
|
+
args: [{ selector: 'coer-textarea', providers: [CONTROL_VALUE(CoerTextarea)], template: "<div class=\"coer-textarea\">\r\n <mat-form-field\r\n [id]=\"_id + '-container'\"\r\n [floatLabel]=\"floatLabel()\"\r\n [ngClass]=\"{\r\n 'readonly': isReadonly() && !isLoading()\r\n }\"\r\n [style]=\"{\r\n 'width': width(),\r\n 'min-width': minWidth(),\r\n 'max-width': maxWidth(),\r\n 'margin-top': marginTop(),\r\n 'margin-right': marginRight(),\r\n 'margin-bottom': marginBottom(),\r\n 'margin-left': marginLeft()\r\n }\">\r\n <mat-label>{{ label() }}</mat-label>\r\n\r\n <textarea #coerTextArea matInput\r\n [id]=\"_id\"\r\n type=\"text\"\r\n [placeholder]=\"placeholder()\"\r\n [minLength]=\"minLength()\"\r\n [maxLength]=\"maxLength()\"\r\n [disabled]=\"!_isEnable()\"\r\n [value]=\"_value\"\r\n (input)=\"SetValue(coerTextArea.value)\"\r\n (blur)=\"SetTouched(true)\"\r\n [style]=\"{\r\n 'cursor': isLoading() ? 'wait' : null,\r\n 'margin-top': (floatLabel() == 'auto') ? '15px' : '9px',\r\n 'padding-right': paddingRight(),\r\n 'text-align': textPosition(),\r\n 'resize': (!resize() || !_isEnable()) ? 'none' : ''\r\n }\"></textarea>\r\n\r\n @if(isLoading()) {\r\n <div class=\"placeholder-glow\">\r\n <span class=\"placeholder\"></span>\r\n </div>\r\n }\r\n\r\n <span ngClass=\"icon-container\">\r\n @if(isInvalid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-exclamation\"></i>\r\n }\r\n\r\n @else if(isValid() && !isDisabled() && !isLoading()) {\r\n <i class=\"fa-solid fa-circle-check text-green\"></i>\r\n }\r\n </span>\r\n </mat-form-field>\r\n\r\n @if(showFooter()) {\r\n <footer> {{ footer }} </footer>\r\n }\r\n</div>", styles: ["div.coer-textarea *{--blue: #0d6efd;--gray: #6c757d;--green: #198754;--yellow: #ffc107;--red: #dc3545;--white: #f5f5f5;--black: #252525;--orange: #fd6031}div.coer-textarea .text-blue{color:#0d6efd!important}div.coer-textarea .text-blue-bold{color:#0d6efd!important;font-weight:700!important}div.coer-textarea .background-blue{background-color:#0d6efd!important}div.coer-textarea .background-border-blue{background-color:#0d6efd!important;border-color:#0d6efd!important}div.coer-textarea .border-blue{border-color:#0d6efd!important}div.coer-textarea .text-gray{color:#6c757d!important}div.coer-textarea .text-gray-bold{color:#6c757d!important;font-weight:700!important}div.coer-textarea .background-gray{background-color:#6c757d!important}div.coer-textarea .background-border-gray{background-color:#6c757d!important;border-color:#6c757d!important}div.coer-textarea .border-gray{border-color:#6c757d!important}div.coer-textarea .text-green{color:#198754!important}div.coer-textarea .text-green-bold{color:#198754!important;font-weight:700!important}div.coer-textarea .background-green{background-color:#198754!important}div.coer-textarea .background-border-green{background-color:#198754!important;border-color:#198754!important}div.coer-textarea .border-green{border-color:#198754!important}div.coer-textarea .text-yellow{color:#ffc107!important}div.coer-textarea .text-yellow-bold{color:#ffc107!important;font-weight:700!important}div.coer-textarea .background-yellow{background-color:#ffc107!important}div.coer-textarea .background-border-yellow{background-color:#ffc107!important;border-color:#ffc107!important}div.coer-textarea .border-yellow{border-color:#ffc107!important}div.coer-textarea .text-red{color:#dc3545!important}div.coer-textarea .text-red-bold{color:#dc3545!important;font-weight:700!important}div.coer-textarea .background-red{background-color:#dc3545!important}div.coer-textarea .background-border-red{background-color:#dc3545!important;border-color:#dc3545!important}div.coer-textarea .border-red{border-color:#dc3545!important}div.coer-textarea .text-white{color:#f5f5f5!important}div.coer-textarea .text-white-bold{color:#f5f5f5!important;font-weight:700!important}div.coer-textarea .background-white{background-color:#f5f5f5!important}div.coer-textarea .background-border-white{background-color:#f5f5f5!important;border-color:#f5f5f5!important}div.coer-textarea .border-white{border-color:#f5f5f5!important}div.coer-textarea .text-black{color:#252525!important}div.coer-textarea .text-black-bold{color:#252525!important;font-weight:700!important}div.coer-textarea .background-black{background-color:#252525!important}div.coer-textarea .background-border-black{background-color:#252525!important;border-color:#252525!important}div.coer-textarea .border-black{border-color:#252525!important}div.coer-textarea .text-orange{color:#fd6031!important}div.coer-textarea .text-orange-bold{color:#fd6031!important;font-weight:700!important}div.coer-textarea .background-orange{background-color:#fd6031!important}div.coer-textarea .background-border-orange{background-color:#fd6031!important;border-color:#fd6031!important}div.coer-textarea .border-orange{border-color:#fd6031!important}div.coer-textarea mat-form-field{position:relative!important}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix{width:100%!important;padding:0!important}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label{overflow:visible!important;position:absolute!important;top:20px!important}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix label.mdc-floating-label--float-above mat-label{color:#fd6031;font-weight:700;position:relative;left:-10px;top:2px}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mat-mdc-form-field-flex div.mat-mdc-form-field-infix textarea{font-weight:400!important;font-size:17px!important;color:#252525!important;min-height:80px}div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active,div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:before,div.coer-textarea mat-form-field div.mat-mdc-text-field-wrapper.mdc-text-field div.mdc-line-ripple.mdc-line-ripple--active:after{border-bottom-color:#fd6031!important}div.coer-textarea mat-form-field div.mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align{height:0px!important}div.coer-textarea mat-form-field span.icon-container{position:absolute!important;top:1px!important;right:-14px!important;z-index:5!important;width:30px;height:40px;display:flex;align-items:center;justify-content:center}div.coer-textarea mat-form-field span.icon-container i{font-size:20px!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-xmark,div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass{color:#caced1!important;cursor:pointer!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-xmark:hover,div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-magnifying-glass:hover{color:#6c757d!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-circle-check{color:#198754!important}div.coer-textarea mat-form-field span.icon-container i.fa-solid.fa-circle-exclamation{color:#dc3545!important}div.coer-textarea mat-form-field span.placeholder{width:calc(100% + 32px)!important;height:100%!important;position:absolute!important;z-index:1!important;top:0!important;left:-16px!important;cursor:wait!important}div.coer-textarea mat-form-field .placeholder,div.coer-textarea mat-form-field .placeholder *,div.coer-textarea mat-form-field .placeholder-glow,div.coer-textarea mat-form-field .placeholder-glow *{cursor:wait!important}div.coer-textarea footer{padding-top:2px;text-align:right;font-size:10px;color:#6c757d}div.coer-textarea mat-form-field.readonly div.mat-mdc-text-field-wrapper.mdc-text-field{background-color:#bbbbbb83!important}\n"] }]
|
2576
|
+
}], propDecorators: { value: [{
|
2577
|
+
type: Input
|
2578
|
+
}], id: [{
|
2579
|
+
type: Input
|
2580
|
+
}] } });
|
2581
|
+
|
2582
|
+
class ComponentsModule {
|
2583
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
2584
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, declarations: [CoerButton,
|
2585
|
+
CoerCheckbox,
|
2586
|
+
CoerFilebox,
|
2587
|
+
CoerForm,
|
2588
|
+
CoerGrid,
|
2589
|
+
CoerModal,
|
2590
|
+
CoerNumberBox,
|
2591
|
+
CoerPageTitle,
|
2592
|
+
CoerSelectbox,
|
2593
|
+
CoerSwitch,
|
2594
|
+
CoerTab,
|
2595
|
+
CoerTextarea,
|
2596
|
+
CoerTextBox], imports: [CommonModule,
|
2597
|
+
RouterModule,
|
2598
|
+
FormsModule,
|
2599
|
+
ReactiveFormsModule,
|
2600
|
+
MatButtonModule,
|
2601
|
+
MatCheckboxModule,
|
2602
|
+
MatInputModule,
|
2603
|
+
MatFormFieldModule,
|
2604
|
+
MatSlideToggleModule,
|
2605
|
+
MatTabsModule,
|
2606
|
+
DirectivesModule,
|
2607
|
+
PipesModule], exports: [CoerButton,
|
2608
|
+
CoerCheckbox,
|
2609
|
+
CoerFilebox,
|
2610
|
+
CoerForm,
|
2611
|
+
CoerGrid,
|
2612
|
+
CoerModal,
|
2613
|
+
CoerNumberBox,
|
2614
|
+
CoerPageTitle,
|
2615
|
+
CoerSelectbox,
|
2616
|
+
CoerSwitch,
|
2617
|
+
CoerTab,
|
2618
|
+
CoerTextarea,
|
2619
|
+
CoerTextBox] }); }
|
2620
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, imports: [CommonModule,
|
2621
|
+
RouterModule,
|
2622
|
+
FormsModule,
|
2623
|
+
ReactiveFormsModule,
|
2624
|
+
MatButtonModule,
|
2625
|
+
MatCheckboxModule,
|
2626
|
+
MatInputModule,
|
2627
|
+
MatFormFieldModule,
|
2628
|
+
MatSlideToggleModule,
|
2629
|
+
MatTabsModule,
|
2630
|
+
DirectivesModule,
|
2631
|
+
PipesModule] }); }
|
2632
|
+
}
|
2633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ComponentsModule, decorators: [{
|
2634
|
+
type: NgModule,
|
2635
|
+
args: [{
|
2636
|
+
imports: [
|
2637
|
+
CommonModule,
|
2638
|
+
RouterModule,
|
2639
|
+
FormsModule,
|
2640
|
+
ReactiveFormsModule,
|
2641
|
+
MatButtonModule,
|
2642
|
+
MatCheckboxModule,
|
2643
|
+
MatInputModule,
|
2644
|
+
MatFormFieldModule,
|
2645
|
+
MatSlideToggleModule,
|
2646
|
+
MatTabsModule,
|
2647
|
+
DirectivesModule,
|
2648
|
+
PipesModule
|
2649
|
+
],
|
2650
|
+
declarations: [
|
2651
|
+
CoerButton,
|
2652
|
+
CoerCheckbox,
|
2653
|
+
CoerFilebox,
|
2654
|
+
CoerForm,
|
2655
|
+
CoerGrid,
|
2656
|
+
CoerModal,
|
2657
|
+
CoerNumberBox,
|
2658
|
+
CoerPageTitle,
|
2659
|
+
CoerSelectbox,
|
2660
|
+
CoerSwitch,
|
2661
|
+
CoerTab,
|
2662
|
+
CoerTextarea,
|
2663
|
+
CoerTextBox,
|
2664
|
+
],
|
2665
|
+
exports: [
|
2666
|
+
CoerButton,
|
2667
|
+
CoerCheckbox,
|
2668
|
+
CoerFilebox,
|
2669
|
+
CoerForm,
|
2670
|
+
CoerGrid,
|
2671
|
+
CoerModal,
|
2672
|
+
CoerNumberBox,
|
2673
|
+
CoerPageTitle,
|
2674
|
+
CoerSelectbox,
|
2675
|
+
CoerSwitch,
|
2676
|
+
CoerTab,
|
2677
|
+
CoerTextarea,
|
2678
|
+
CoerTextBox,
|
2679
|
+
]
|
2680
|
+
}]
|
2681
|
+
}] });
|
2682
|
+
|
2683
|
+
const GridTemplates = {
|
2684
|
+
/** Template for boolean property */
|
2685
|
+
isActiveTemplate: (item) => {
|
2686
|
+
if (item.value) {
|
2687
|
+
return `
|
2688
|
+
<span class='text-green-bold'>
|
2689
|
+
<i class="fa-solid fa-circle-check"></i> Active
|
2690
|
+
</span>
|
2691
|
+
`;
|
2692
|
+
}
|
2693
|
+
else {
|
2694
|
+
return `
|
2695
|
+
<span class='text-gray-bold'>
|
2696
|
+
<i class="fa-solid fa-circle-minus"></i> Disabled
|
2697
|
+
</span>
|
2698
|
+
`;
|
2699
|
+
}
|
2700
|
+
},
|
2701
|
+
/** Template for boolean property */
|
2702
|
+
coerSwitchTemplate: (item) => ({
|
2703
|
+
isInput: true,
|
2704
|
+
tooltip: `${item.value ? 'Active' : 'Disabled'}`
|
2705
|
+
}),
|
2706
|
+
/** Template for text property */
|
2707
|
+
coerTextboxTemplate: (item) => ({
|
2708
|
+
isInput: true,
|
2709
|
+
isInvalid: item.value.length <= 0
|
2710
|
+
})
|
2711
|
+
};
|
2712
|
+
|
2713
|
+
/**
|
2714
|
+
* Generated bundle index. Do not edit.
|
2715
|
+
*/
|
2716
|
+
|
2717
|
+
export { CoerButton, CoerCheckbox, CoerFilebox, CoerForm, CoerGrid, CoerModal, CoerNumberBox, CoerPageTitle, CoerSelectbox, CoerSwitch, CoerTab, CoerTextBox, CoerTextarea, ComponentsModule, GridTemplates };
|
2718
|
+
//# sourceMappingURL=coer-elements-components.mjs.map
|