coer-elements 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- package/components/coer-alert/coer-alert.component.html +56 -0
- package/components/coer-alert/coer-alert.component.scss +100 -0
- package/components/coer-alert/coer-alert.component.ts +249 -0
- package/components/index.ts +97 -0
- package/dist_browser/Tools/Breadcrumbs.class.js +66 -0
- package/dist_browser/Tools/ControlValue.js +49 -0
- package/dist_browser/Tools/Page.class.js +212 -0
- package/dist_browser/Tools/Source.class.js +83 -0
- package/dist_browser/index.js +5 -1
- package/dist_node/Tools/Breadcrumbs.class.js +69 -0
- package/dist_node/Tools/ControlValue.js +53 -0
- package/dist_node/Tools/Page.class.js +215 -0
- package/dist_node/Tools/Source.class.js +86 -0
- package/dist_node/index.js +5 -1
- package/package.json +9 -1
- package/styles/bootstrap.scss +22 -0
- package/styles/coer.scss +95 -0
- package/styles/colors.scss +167 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
<aside class="toast-container coer-alert">
|
2
|
+
<!-- Success -->
|
3
|
+
<div id="alert-success" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
|
4
|
+
<div class="toast-header">
|
5
|
+
<i id="alert-success-icon"></i>
|
6
|
+
<strong id="alert-success-title"></strong>
|
7
|
+
<button type="button" (click)="Close('alert-success')" class="btn-close btn-close-white"></button>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="toast-body">
|
11
|
+
<pre id="alert-success-message"></pre>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
|
16
|
+
<!-- Error -->
|
17
|
+
<div id="alert-error" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
|
18
|
+
<div class="toast-header">
|
19
|
+
<i id="alert-error-icon"></i>
|
20
|
+
<strong id="alert-error-title"></strong>
|
21
|
+
<button type="button" (click)="Close('alert-error')" class="btn-close btn-close-white"></button>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="toast-body">
|
25
|
+
<pre id="alert-error-message"></pre>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
|
30
|
+
<!-- Info -->
|
31
|
+
<div id="alert-info" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
|
32
|
+
<div class="toast-header">
|
33
|
+
<i id="alert-info-icon"></i>
|
34
|
+
<strong id="alert-info-title"></strong>
|
35
|
+
<button type="button" (click)="Close('alert-info')" class="btn-close btn-close-white"></button>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="toast-body">
|
39
|
+
<pre id="alert-info-message"></pre>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
|
44
|
+
<!-- Warning -->
|
45
|
+
<div id="alert-warning" role="alert" aria-live="assertive" aria-atomic="true" class="toast">
|
46
|
+
<div class="toast-header">
|
47
|
+
<i id="alert-warning-icon"></i>
|
48
|
+
<strong id="alert-warning-title"></strong>
|
49
|
+
<button type="button" (click)="Close('alert-warning')" class="btn-close"></button>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<div class="toast-body">
|
53
|
+
<pre id="alert-warning-message"></pre>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</aside>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
@import "../../styles/colors.scss";
|
2
|
+
|
3
|
+
aside.toast-container {
|
4
|
+
position: fixed;
|
5
|
+
bottom: 0px;
|
6
|
+
right: 0px;
|
7
|
+
padding: 15px !important;
|
8
|
+
z-index: 2000 !important;
|
9
|
+
|
10
|
+
i, svg {
|
11
|
+
display: flex;
|
12
|
+
align-items: center;
|
13
|
+
}
|
14
|
+
|
15
|
+
strong {
|
16
|
+
margin: 0px auto 0px 5px;
|
17
|
+
}
|
18
|
+
|
19
|
+
div.toast,
|
20
|
+
div.toast-header {
|
21
|
+
border-top-left-radius: 10px;
|
22
|
+
border-top-right-radius: 10px;
|
23
|
+
color: $white;
|
24
|
+
}
|
25
|
+
|
26
|
+
div.toast,
|
27
|
+
div.toast-body {
|
28
|
+
border-bottom-left-radius: 10px;
|
29
|
+
border-bottom-right-radius: 10px;
|
30
|
+
color: $white;
|
31
|
+
}
|
32
|
+
|
33
|
+
div.toast-body {
|
34
|
+
min-height: 36px;
|
35
|
+
}
|
36
|
+
|
37
|
+
pre {
|
38
|
+
font-family: Roboto, RobotoFallback, "Noto Kufi Arabic", Helvetica, Arial, sans-serif;
|
39
|
+
white-space: pre-wrap;
|
40
|
+
font-size: medium;
|
41
|
+
}
|
42
|
+
|
43
|
+
button {
|
44
|
+
margin: 0px 2px !important;
|
45
|
+
width: 10px !important;
|
46
|
+
height: 10px !important;
|
47
|
+
box-shadow: none !important;
|
48
|
+
outline: none !important;
|
49
|
+
border: none !important;
|
50
|
+
}
|
51
|
+
|
52
|
+
div#alert-success div.toast-header,
|
53
|
+
div#alert-success div.toast-body {
|
54
|
+
background-color: $green;
|
55
|
+
}
|
56
|
+
|
57
|
+
div#alert-info div.toast-header,
|
58
|
+
div#alert-info div.toast-body {
|
59
|
+
background-color: $blue;
|
60
|
+
}
|
61
|
+
|
62
|
+
div#alert-error div.toast-header,
|
63
|
+
div#alert-error div.toast-body {
|
64
|
+
background-color: $red;
|
65
|
+
}
|
66
|
+
|
67
|
+
div#alert-warning div.toast-header,
|
68
|
+
div#alert-warning div.toast-body {
|
69
|
+
background-color: $yellow;
|
70
|
+
border-color: $black;
|
71
|
+
color: $black;
|
72
|
+
}
|
73
|
+
|
74
|
+
div#alert-success:hover,
|
75
|
+
div#alert-info:hover,
|
76
|
+
div#alert-error:hover,
|
77
|
+
div#alert-warning:hover {
|
78
|
+
transform: scale(1.01);
|
79
|
+
box-shadow: 2px 2px 10px lightslategray;
|
80
|
+
cursor: default;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
button.sweet-alert-button {
|
85
|
+
width: 100px !important;
|
86
|
+
height: 40px !important;
|
87
|
+
display: flex !important;
|
88
|
+
align-items: center !important;
|
89
|
+
justify-content: center !important;
|
90
|
+
margin: 0px 5px !important;
|
91
|
+
outline: none !important;
|
92
|
+
border: none !important;
|
93
|
+
box-shadow: none !important;
|
94
|
+
}
|
95
|
+
|
96
|
+
aside.toast-container > * {
|
97
|
+
border: none !important;
|
98
|
+
z-index: 2000 !important;
|
99
|
+
margin: 15px 0px 0px 0px !important;
|
100
|
+
}
|
@@ -0,0 +1,249 @@
|
|
1
|
+
import { Component } from '@angular/core';
|
2
|
+
import * as bootstrap from 'bootstrap';
|
3
|
+
import Swal from 'sweetalert2'
|
4
|
+
|
5
|
+
@Component({
|
6
|
+
selector: 'coer-alert',
|
7
|
+
templateUrl: './coer-alert.component.html',
|
8
|
+
styleUrls: ['./coer-alert.component.scss']
|
9
|
+
})
|
10
|
+
export class CoerAlert {
|
11
|
+
|
12
|
+
/** */
|
13
|
+
public Success(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
|
14
|
+
//Title
|
15
|
+
if (!title || title == '') title = 'Success';
|
16
|
+
const alertSuccessTitle = document.getElementById('alert-success-title')!;
|
17
|
+
alertSuccessTitle.textContent = title;
|
18
|
+
|
19
|
+
//Icon
|
20
|
+
icon = this.GetIcon(title, icon, 'bi-check-circle fa-beat');
|
21
|
+
const alertSuccessIcon = document.getElementById('alert-success-icon')!;
|
22
|
+
this.SetIcon(alertSuccessIcon, icon);
|
23
|
+
|
24
|
+
//Message
|
25
|
+
if (!message) message = '';
|
26
|
+
const alertSuccessMessage = document.getElementById('alert-success-message')!;
|
27
|
+
alertSuccessMessage.innerHTML = message;
|
28
|
+
|
29
|
+
//Toast
|
30
|
+
const alertSuccess = document.getElementById('alert-success')!;
|
31
|
+
this.SetAutoHide(alertSuccess, autohide);
|
32
|
+
|
33
|
+
const toast = bootstrap.Toast.getOrCreateInstance(alertSuccess);
|
34
|
+
toast.show();
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
/** */
|
39
|
+
public Error(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
|
40
|
+
//Title
|
41
|
+
if (!title || title == '') title = 'Error';
|
42
|
+
const alertErrorTitle = document.getElementById('alert-error-title')!;
|
43
|
+
alertErrorTitle.textContent = title;
|
44
|
+
|
45
|
+
//Icon
|
46
|
+
icon = this.GetIcon(title, icon, 'bi-exclamation-octagon fa-beat');
|
47
|
+
const alertErrorIcon = document.getElementById('alert-error-icon')!;
|
48
|
+
this.SetIcon(alertErrorIcon, icon);
|
49
|
+
|
50
|
+
//Message
|
51
|
+
if (!message) message = '';
|
52
|
+
const alertErrorBody = document.getElementById('alert-error-message')!;
|
53
|
+
alertErrorBody.innerHTML = message;
|
54
|
+
|
55
|
+
//Toast
|
56
|
+
const alertError = document.getElementById('alert-error')!;
|
57
|
+
this.SetAutoHide(alertError, autohide);
|
58
|
+
|
59
|
+
const toast = bootstrap.Toast.getOrCreateInstance(alertError);
|
60
|
+
toast.show();
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
/** */
|
65
|
+
public Info(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
|
66
|
+
//Title
|
67
|
+
if (!title || title == '') title = 'Info';
|
68
|
+
const alertInfoTitle = document.getElementById('alert-info-title')!;
|
69
|
+
alertInfoTitle.textContent = title;
|
70
|
+
|
71
|
+
//Icon
|
72
|
+
icon = this.GetIcon(title, icon, 'bi-info-circle fa-beat');
|
73
|
+
const alertInfoIcon = document.getElementById('alert-info-icon')!;
|
74
|
+
this.SetIcon(alertInfoIcon, icon);
|
75
|
+
|
76
|
+
//Message
|
77
|
+
if (!message) message = '';
|
78
|
+
const alertInfoBody = document.getElementById('alert-info-message')!;
|
79
|
+
alertInfoBody.innerHTML = message;
|
80
|
+
|
81
|
+
//Toast
|
82
|
+
const alertInfo = document.getElementById('alert-info')!;
|
83
|
+
this.SetAutoHide(alertInfo, autohide);
|
84
|
+
|
85
|
+
const toast = bootstrap.Toast.getOrCreateInstance(alertInfo);
|
86
|
+
toast.show();
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
/** */
|
91
|
+
public Warning(message: string | null = null, title: string | null = null, icon: string | null = null, autohide: number | null = 3000): void {
|
92
|
+
//Title
|
93
|
+
if (!title || title == '') title = 'Warning';
|
94
|
+
const alertWarningTitle = document.getElementById('alert-warning-title')!;
|
95
|
+
alertWarningTitle.textContent = title;
|
96
|
+
|
97
|
+
//Icon
|
98
|
+
icon = this.GetIcon(title, icon, 'bi-exclamation-triangle-fill fa-beat');
|
99
|
+
const alertWarningIcon = document.getElementById('alert-warning-icon')!;
|
100
|
+
this.SetIcon(alertWarningIcon, icon);
|
101
|
+
|
102
|
+
//Message
|
103
|
+
if (!message) message = '';
|
104
|
+
const alertWarningBody = document.getElementById('alert-warning-message')!;
|
105
|
+
alertWarningBody.innerHTML = message;
|
106
|
+
|
107
|
+
//Toast
|
108
|
+
const alertWarning = document.getElementById('alert-warning')!;
|
109
|
+
this.SetAutoHide(alertWarning, autohide);
|
110
|
+
|
111
|
+
const toast = bootstrap.Toast.getOrCreateInstance(alertWarning);
|
112
|
+
toast.show();
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
/** */
|
117
|
+
protected Close(alert: 'alert-success' | 'alert-error' | 'alert-info' | 'alert-warning') {
|
118
|
+
return new Promise<void>(Resolve => {
|
119
|
+
const element = document.getElementById(alert)!;
|
120
|
+
const toast = bootstrap.Toast.getOrCreateInstance(element);
|
121
|
+
toast.hide();
|
122
|
+
|
123
|
+
setTimeout(() => { Resolve() }, 200);
|
124
|
+
})
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
/** */
|
129
|
+
public Confirm(
|
130
|
+
message: string = 'Proceed?',
|
131
|
+
alertType: 'warning' | 'danger' | 'success' | 'info' = 'warning',
|
132
|
+
icon: string | null = null) {
|
133
|
+
return new Promise<boolean>(Resolve => {
|
134
|
+
let color: string;
|
135
|
+
let iconType: 'warning' | 'error' | 'success' | 'info';
|
136
|
+
switch(alertType) {
|
137
|
+
case 'danger': {
|
138
|
+
if (icon == null) icon = 'bi-exclamation-octagon';
|
139
|
+
iconType = 'error';
|
140
|
+
color = '#dc3545';
|
141
|
+
break;
|
142
|
+
};
|
143
|
+
|
144
|
+
case 'success': {
|
145
|
+
if (icon == null) icon = 'bi-check-circle';
|
146
|
+
iconType = 'info';
|
147
|
+
color = '#198754';
|
148
|
+
break;
|
149
|
+
};
|
150
|
+
|
151
|
+
case 'info': {
|
152
|
+
if (icon == null) icon = 'bi-info-circle';
|
153
|
+
iconType = 'error';
|
154
|
+
color = '#0d6efd';
|
155
|
+
break
|
156
|
+
};
|
157
|
+
|
158
|
+
default: {
|
159
|
+
if (icon == null) icon = 'bi-exclamation-triangle-fill';
|
160
|
+
iconType = 'warning';
|
161
|
+
color = '#ffc107';
|
162
|
+
break;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
switch(icon) {
|
167
|
+
case 'delete': icon = 'fa-regular fa-trash-can'; break;
|
168
|
+
}
|
169
|
+
|
170
|
+
Swal.fire({
|
171
|
+
icon: iconType,
|
172
|
+
iconColor: 'transparent',
|
173
|
+
iconHtml: `<i class="${icon}" style="color: ${color};"></i>`,
|
174
|
+
html: message,
|
175
|
+
showConfirmButton: true,
|
176
|
+
confirmButtonText: 'Yes',
|
177
|
+
confirmButtonColor: color,
|
178
|
+
focusConfirm: true,
|
179
|
+
showDenyButton: true,
|
180
|
+
denyButtonColor: color,
|
181
|
+
focusDeny: false,
|
182
|
+
reverseButtons: true,
|
183
|
+
allowOutsideClick: false,
|
184
|
+
allowEscapeKey: false,
|
185
|
+
allowEnterKey: true,
|
186
|
+
customClass: {
|
187
|
+
denyButton: 'sweet-alert-button',
|
188
|
+
confirmButton: 'sweet-alert-button'
|
189
|
+
}
|
190
|
+
}).then(({ value }) => setTimeout(() => Resolve(value)));
|
191
|
+
});
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
/** */
|
196
|
+
private SetIcon(element: HTMLElement, icon: string): void {
|
197
|
+
for (const item of [...element.classList.value.split(' ')]) {
|
198
|
+
if (item.length > 0) {
|
199
|
+
element.classList.remove(item);
|
200
|
+
element.classList.remove('q');
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
icon = icon.trim();
|
205
|
+
const hasWhiteSpaces: RegExp = / /;
|
206
|
+
if (hasWhiteSpaces.test(icon)) {
|
207
|
+
const classes = icon.split(' ');
|
208
|
+
for (const icon of classes) element.classList.add(icon);
|
209
|
+
}
|
210
|
+
|
211
|
+
else element.classList.add(icon);
|
212
|
+
}
|
213
|
+
|
214
|
+
|
215
|
+
/** */
|
216
|
+
private SetAutoHide(element: HTMLElement, autohide: number | null): void {
|
217
|
+
element.removeAttribute('data-bs-autohide');
|
218
|
+
element.removeAttribute('data-bs-delay');
|
219
|
+
|
220
|
+
if (autohide && autohide > 0) {
|
221
|
+
if (autohide < 1000) autohide = 1000;
|
222
|
+
element.setAttribute('data-bs-autohide', 'true');
|
223
|
+
element.setAttribute('data-bs-delay', String(autohide));
|
224
|
+
}
|
225
|
+
|
226
|
+
else element.setAttribute('data-bs-autohide', 'false');
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
/** */
|
231
|
+
private GetIcon(title: string, icon: string | null, iconDefault: string): string {
|
232
|
+
if (icon == null || icon == '') {
|
233
|
+
title = title.replaceAll(' ', '').toUpperCase();
|
234
|
+
|
235
|
+
switch(title) {
|
236
|
+
case 'ENABLED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
237
|
+
case 'ACTIVE': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
238
|
+
case 'ACTIVED': return 'fa-solid fa-thumbs-up fa-flip-horizontal';
|
239
|
+
case 'DISABLE': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
|
240
|
+
case 'DISABLED': return 'fa-solid fa-thumbs-down fa-flip-horizontal';
|
241
|
+
case 'DELETE': return 'fa-regular fa-trash-can';
|
242
|
+
case 'DELETED': return 'fa-regular fa-trash-can';
|
243
|
+
default: return iconDefault;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
return icon;
|
248
|
+
}
|
249
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import { NgModule } from '@angular/core';
|
2
|
+
import { CommonModule } from '@angular/common';
|
3
|
+
import { RouterModule } from '@angular/router';
|
4
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
5
|
+
//import { DirectivesModule } from 'src/app/shared/directives/directives.module';
|
6
|
+
//import { PipesModule } from 'src/app/shared/pipes/pipes.module';
|
7
|
+
|
8
|
+
//Angular Material
|
9
|
+
//import { MatButtonModule } from '@angular/material/button';
|
10
|
+
//import { MatCheckboxModule } from '@angular/material/checkbox';
|
11
|
+
//import { MatInputModule } from '@angular/material/input';
|
12
|
+
//import { MatFormFieldModule } from '@angular/material/form-field';
|
13
|
+
//import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
14
|
+
//import { MatTabsModule } from '@angular/material/tabs';
|
15
|
+
|
16
|
+
//Components
|
17
|
+
import { CoerAlert } from './coer-alert/coer-alert.component';
|
18
|
+
//import { CoerButton } from './coer-button/coer-button.component';
|
19
|
+
//import { CoerCheckbox } from './coer-checkbox/coer-checkbox.component';
|
20
|
+
//import { CoerFilebox } from './coer-filebox/coer-filebox.component';
|
21
|
+
//import { CoerForm } from './coer-form/coer-form.component';
|
22
|
+
//import { CoerGrid } from './coer-grid/coer-grid.component';
|
23
|
+
//import { CoerModal } from './coer-modal/coer-modal.component';
|
24
|
+
//import { CoerNumberBox } from './coer-numberbox/coer-numberbox.component';
|
25
|
+
//import { CoerPageTitle } from './coer-page-title/coer-page-title.component';
|
26
|
+
//import { CoerSelectbox } from './coer-selectbox/coer-selectbox.component';
|
27
|
+
//import { CoerSwitch } from './coer-switch/coer-switch.component';
|
28
|
+
//import { CoerTab } from './coer-tab/coer-tab.component';
|
29
|
+
//import { CoerTextarea } from './coer-textarea/coer-textarea.component';
|
30
|
+
//import { CoerTextBox } from './coer-textbox/coer-textbox.component';
|
31
|
+
|
32
|
+
@NgModule({
|
33
|
+
imports: [
|
34
|
+
CommonModule,
|
35
|
+
RouterModule,
|
36
|
+
FormsModule,
|
37
|
+
ReactiveFormsModule,
|
38
|
+
//PipesModule,
|
39
|
+
//MatButtonModule,
|
40
|
+
//MatCheckboxModule,
|
41
|
+
//MatInputModule,
|
42
|
+
//MatFormFieldModule,
|
43
|
+
//MatSlideToggleModule,
|
44
|
+
//MatTabsModule,
|
45
|
+
//DirectivesModule
|
46
|
+
],
|
47
|
+
declarations: [
|
48
|
+
CoerAlert,
|
49
|
+
//CoerButton,
|
50
|
+
//CoerCheckbox,
|
51
|
+
//CoerFilebox,
|
52
|
+
//CoerForm,
|
53
|
+
//CoerGrid,
|
54
|
+
//CoerModal,
|
55
|
+
//CoerNumberBox,
|
56
|
+
//CoerPageTitle,
|
57
|
+
//CoerSelectbox,
|
58
|
+
//CoerSwitch,
|
59
|
+
//CoerTextarea,
|
60
|
+
//CoerTab,
|
61
|
+
//CoerTextBox,
|
62
|
+
],
|
63
|
+
exports: [
|
64
|
+
CoerAlert,
|
65
|
+
//CoerButton,
|
66
|
+
//CoerCheckbox,
|
67
|
+
//CoerFilebox,
|
68
|
+
//CoerForm,
|
69
|
+
//CoerGrid,
|
70
|
+
//CoerModal,
|
71
|
+
//CoerNumberBox,
|
72
|
+
//CoerPageTitle,
|
73
|
+
//CoerSelectbox,
|
74
|
+
//CoerSwitch,
|
75
|
+
//CoerTextarea,
|
76
|
+
//CoerTab,
|
77
|
+
//CoerTextBox,
|
78
|
+
]
|
79
|
+
})
|
80
|
+
export class ComponentsModule { }
|
81
|
+
export * from './coer-alert/coer-alert.component';
|
82
|
+
//export * from './coer-button/coer-button.component';
|
83
|
+
//export * from './coer-checkbox/coer-checkbox.component';
|
84
|
+
//export * from './coer-filebox/coer-filebox.component';
|
85
|
+
//export * from './coer-filebox/coer-filebox.interface';
|
86
|
+
//export * from './coer-form/coer-form.component';
|
87
|
+
//export * from './coer-grid/coer-grid.component';
|
88
|
+
//export * from './coer-grid/coer-grid.interface';
|
89
|
+
//export * from './coer-grid/coer-grid.templates';
|
90
|
+
//export * from './coer-modal/coer-modal.component';
|
91
|
+
//export * from './coer-numberbox/coer-numberbox.component';
|
92
|
+
//export * from './coer-page-title/coer-page-title.component';
|
93
|
+
//export * from './coer-page-title/pageTitle.interface';
|
94
|
+
//export * from './coer-selectbox/coer-selectbox.component';
|
95
|
+
//export * from './coer-switch/coer-switch.component';
|
96
|
+
//export * from './coer-tab/coer-tab.component';
|
97
|
+
//export * from './coer-textbox/coer-textbox.component';
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { Tools } from './Tools';
|
2
|
+
var Breadcrumbs = /** @class */ (function () {
|
3
|
+
function Breadcrumbs() {
|
4
|
+
}
|
5
|
+
/** */
|
6
|
+
Breadcrumbs.Add = function (page, path) {
|
7
|
+
var breadcrumbs = this.Get();
|
8
|
+
var paths = breadcrumbs.map(function (item) { return item.path; });
|
9
|
+
if (!paths.includes(path)) {
|
10
|
+
breadcrumbs.push({ page: page, path: path });
|
11
|
+
this.Save(breadcrumbs);
|
12
|
+
}
|
13
|
+
};
|
14
|
+
/** */
|
15
|
+
Breadcrumbs.Get = function () {
|
16
|
+
var storage = sessionStorage.getItem(this.storage);
|
17
|
+
if (storage) {
|
18
|
+
storage = JSON.parse(storage);
|
19
|
+
if (storage.hasOwnProperty('breadcrumbs')) {
|
20
|
+
return Tools.BreakReference(storage.breadcrumbs);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return [];
|
24
|
+
};
|
25
|
+
/** Source */
|
26
|
+
Breadcrumbs.GetFirst = function () {
|
27
|
+
var breadcrumbs = this.Get();
|
28
|
+
return (breadcrumbs.length > 0) ? breadcrumbs.shift() : null;
|
29
|
+
};
|
30
|
+
/** */
|
31
|
+
Breadcrumbs.Save = function (breadcrumbs) {
|
32
|
+
var storage = sessionStorage.getItem(this.storage);
|
33
|
+
if (storage)
|
34
|
+
storage = JSON.parse(storage);
|
35
|
+
storage = Object.assign({}, storage, { breadcrumbs: breadcrumbs });
|
36
|
+
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
37
|
+
};
|
38
|
+
/** */
|
39
|
+
Breadcrumbs.Remove = function (path) {
|
40
|
+
var breadcrumbs = this.Get();
|
41
|
+
var index = breadcrumbs.findIndex(function (x) { return x.path.toLowerCase().trim() === path.toLowerCase().trim(); });
|
42
|
+
if (index >= 0) {
|
43
|
+
breadcrumbs = Tools.BreakReference(breadcrumbs).splice(0, index + 1);
|
44
|
+
this.Save(breadcrumbs);
|
45
|
+
}
|
46
|
+
};
|
47
|
+
/** */
|
48
|
+
Breadcrumbs.SetLast = function (page, path) {
|
49
|
+
var breadcrumbs = this.Get();
|
50
|
+
if (breadcrumbs.length > 0) {
|
51
|
+
breadcrumbs[breadcrumbs.length - 1] = { page: page, path: path };
|
52
|
+
this.Save(breadcrumbs);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
/** */
|
56
|
+
Breadcrumbs.RemoveLast = function () {
|
57
|
+
var breadcrumbs = this.Get();
|
58
|
+
if (breadcrumbs.length > 0) {
|
59
|
+
breadcrumbs.pop();
|
60
|
+
this.Save(breadcrumbs);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
Breadcrumbs.storage = 'COER-System';
|
64
|
+
return Breadcrumbs;
|
65
|
+
}());
|
66
|
+
export { Breadcrumbs };
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
2
|
+
import { forwardRef } from "@angular/core";
|
3
|
+
export var CONTROL_VALUE = function (component) {
|
4
|
+
return {
|
5
|
+
provide: NG_VALUE_ACCESSOR,
|
6
|
+
useExisting: forwardRef(function () { return component; }),
|
7
|
+
multi: true
|
8
|
+
};
|
9
|
+
};
|
10
|
+
var ControlValue = /** @class */ (function () {
|
11
|
+
function ControlValue() {
|
12
|
+
this._isTouched = false;
|
13
|
+
}
|
14
|
+
Object.defineProperty(ControlValue.prototype, "isTouched", {
|
15
|
+
get: function () {
|
16
|
+
return this._isTouched;
|
17
|
+
},
|
18
|
+
enumerable: false,
|
19
|
+
configurable: true
|
20
|
+
});
|
21
|
+
/** */
|
22
|
+
ControlValue.prototype.SetValue = function (value) {
|
23
|
+
if (typeof this._UpdateValue === 'function') {
|
24
|
+
this._UpdateValue(value);
|
25
|
+
}
|
26
|
+
this._value = value;
|
27
|
+
};
|
28
|
+
/** */
|
29
|
+
ControlValue.prototype.SetTouched = function (isTouched) {
|
30
|
+
if (typeof this._IsTouched === 'function') {
|
31
|
+
this._IsTouched(isTouched);
|
32
|
+
}
|
33
|
+
this._isTouched = isTouched;
|
34
|
+
};
|
35
|
+
/** */
|
36
|
+
ControlValue.prototype.writeValue = function (value) {
|
37
|
+
this._value = value;
|
38
|
+
};
|
39
|
+
/** */
|
40
|
+
ControlValue.prototype.registerOnChange = function (callback) {
|
41
|
+
this._UpdateValue = callback;
|
42
|
+
};
|
43
|
+
/** */
|
44
|
+
ControlValue.prototype.registerOnTouched = function (callback) {
|
45
|
+
this._IsTouched = callback;
|
46
|
+
};
|
47
|
+
return ControlValue;
|
48
|
+
}());
|
49
|
+
export { ControlValue };
|