zek 17.3.92 → 17.3.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/directives/delayed-input.directive.mjs +57 -0
- package/esm2022/lib/directives/index.mjs +2 -0
- package/esm2022/lib/models/tree.mjs +2 -0
- package/esm2022/lib/models/tree.model.mjs +4 -1
- package/esm2022/lib/modules/alert/toast/toast.mjs +3 -6
- package/esm2022/lib/modules/progress/progress.mjs +3 -6
- package/esm2022/lib/services/auth.service.mjs +76 -91
- package/esm2022/lib/services/web.api.mjs +1 -1
- package/esm2022/lib/utils/array-helper.mjs +91 -27
- package/esm2022/lib/utils/index.mjs +2 -1
- package/esm2022/lib/utils/interval-helper.mjs +32 -0
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/zek.mjs +256 -126
- package/fesm2022/zek.mjs.map +1 -1
- package/lib/directives/delayed-input.directive.d.ts +15 -0
- package/lib/directives/index.d.ts +1 -0
- package/lib/models/tree.d.ts +22 -0
- package/lib/models/tree.model.d.ts +3 -0
- package/lib/services/auth.service.d.ts +15 -14
- package/lib/services/web.api.d.ts +1 -1
- package/lib/utils/array-helper.d.ts +12 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/interval-helper.d.ts +12 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2022/lib/models/flatten-tree.mjs +0 -2
- package/lib/models/flatten-tree.d.ts +0 -6
package/fesm2022/zek.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, InjectionToken, Inject, Directive, EventEmitter, Input, Output, ViewChild, Pipe, Component, forwardRef, NgModule,
|
|
2
|
+
import { Injectable, inject, InjectionToken, Inject, Directive, EventEmitter, Input, Output, ViewChild, HostListener, Pipe, Component, forwardRef, NgModule, ViewEncapsulation, ChangeDetectionStrategy, Optional } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/router';
|
|
4
4
|
import { Router, NavigationStart, ActivatedRoute, RouterModule } from '@angular/router';
|
|
5
|
-
import {
|
|
5
|
+
import { Subject, of, tap, catchError, firstValueFrom, interval, BehaviorSubject, timer } from 'rxjs';
|
|
6
6
|
import * as i2 from '@ngx-translate/core';
|
|
7
7
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
8
8
|
import * as i1$1 from '@angular/common/http';
|
|
9
9
|
import { HttpParams, HttpHeaders, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
10
|
+
import { debounceTime, finalize, map, takeWhile } from 'rxjs/operators';
|
|
10
11
|
import * as i1$2 from '@angular/common';
|
|
11
12
|
import { CommonModule, DatePipe } from '@angular/common';
|
|
12
13
|
import * as i2$1 from '@angular/forms';
|
|
13
14
|
import { NG_VALUE_ACCESSOR, FormsModule, NG_VALIDATORS } from '@angular/forms';
|
|
14
15
|
import * as i1$3 from '@angular/platform-browser';
|
|
15
|
-
import { finalize, map, takeWhile } from 'rxjs/operators';
|
|
16
16
|
|
|
17
17
|
var PrintType;
|
|
18
18
|
(function (PrintType) {
|
|
@@ -99,53 +99,74 @@ class ArrayHelper {
|
|
|
99
99
|
}
|
|
100
100
|
static flatten(array, indent = 0) {
|
|
101
101
|
let result = [];
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
if (!Array.isArray(array)) {
|
|
103
|
+
const flattenedItem = {
|
|
104
|
+
...array, // shallow copy the current item
|
|
105
|
+
indent, // add the current indent level
|
|
106
|
+
count: Array.isArray(array.children) ? array.children.length : 0 // set count based on children
|
|
107
|
+
};
|
|
108
|
+
delete flattenedItem.children;
|
|
109
|
+
delete flattenedItem.childrenIds;
|
|
110
|
+
result.push(flattenedItem);
|
|
111
|
+
if (flattenedItem.count) {
|
|
112
|
+
result.push(...this.flatten(array.children, indent + 1)); // Use spread operator for efficiency
|
|
106
113
|
}
|
|
114
|
+
return result;
|
|
107
115
|
}
|
|
108
116
|
else {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
item.indent = indent;
|
|
112
|
-
item.count = Array.isArray(array.children)
|
|
113
|
-
? array.children.length
|
|
114
|
-
: 0;
|
|
115
|
-
delete item.children;
|
|
116
|
-
delete item.childrenIds;
|
|
117
|
-
result.push(item);
|
|
118
|
-
// If there are children, recursively flatten them
|
|
119
|
-
if (Array.isArray(array.children)) {
|
|
120
|
-
for (const child of array.children) {
|
|
121
|
-
result = result.concat(this.flatten(child, indent + 1));
|
|
122
|
-
}
|
|
117
|
+
for (const item of array) {
|
|
118
|
+
result.push(...this.flatten(item, indent));
|
|
123
119
|
}
|
|
124
120
|
}
|
|
125
121
|
return result;
|
|
126
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated use flattenDropDownList2
|
|
125
|
+
*/
|
|
127
126
|
static flattenDropDownList(tree, indent = 0) {
|
|
128
127
|
let result = [];
|
|
129
128
|
// If the input is an array of trees, we process each one
|
|
130
|
-
if (Array.isArray(tree)) {
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
if (!Array.isArray(tree)) {
|
|
130
|
+
// Add the current tree node to the result
|
|
131
|
+
let item = {
|
|
132
|
+
key: tree.key,
|
|
133
|
+
value: ' '.repeat(indent) + tree.value,
|
|
134
|
+
indent: indent,
|
|
135
|
+
count: Array.isArray(tree.children) ? tree.children.length : 0
|
|
136
|
+
};
|
|
137
|
+
result.push(item);
|
|
138
|
+
// If there are children, recursively flatten them
|
|
139
|
+
if (Array.isArray(tree.children)) {
|
|
140
|
+
result.push(...this.flattenDropDownList(tree.children, indent + 1)); // Use spread operator for efficiency
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
else {
|
|
144
|
+
for (const item of tree) {
|
|
145
|
+
result.push(...this.flattenDropDownList(item, indent));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
static flattenTreeNodeDropDownList(tree, indent = 0) {
|
|
151
|
+
let result = [];
|
|
152
|
+
// If the input is an array of trees, we process each one
|
|
153
|
+
if (!Array.isArray(tree)) {
|
|
136
154
|
// Add the current tree node to the result
|
|
137
155
|
let item = {
|
|
138
|
-
|
|
139
|
-
|
|
156
|
+
id: tree.id,
|
|
157
|
+
name: ' '.repeat(indent) + tree.name,
|
|
140
158
|
indent: indent,
|
|
141
159
|
count: Array.isArray(tree.children) ? tree.children.length : 0
|
|
142
160
|
};
|
|
143
161
|
result.push(item);
|
|
144
162
|
// If there are children, recursively flatten them
|
|
145
163
|
if (Array.isArray(tree.children)) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
result.push(...this.flattenTreeNodeDropDownList(tree.children, indent + 1)); // Use spread operator for efficiency
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
for (const item of tree) {
|
|
169
|
+
result.push(...this.flattenTreeNodeDropDownList(item, indent));
|
|
149
170
|
}
|
|
150
171
|
}
|
|
151
172
|
return result;
|
|
@@ -170,6 +191,49 @@ class ArrayHelper {
|
|
|
170
191
|
static enumToKeyPairExArray(value) {
|
|
171
192
|
return this.enumToKeyPairBaseArray(value);
|
|
172
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Method to create a tree from a flat array of nodes
|
|
196
|
+
* @param array
|
|
197
|
+
* @param safe if tue and some nodes not have parent thand adds as a root node. if false than thoose nodes skipped.
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
static createTree(array, safe = true) {
|
|
201
|
+
const tree = [];
|
|
202
|
+
// Map to store nodes by their id for easy access
|
|
203
|
+
const map = {};
|
|
204
|
+
// Step 1: Loop over the array to build the nodes
|
|
205
|
+
for (const item of array) {
|
|
206
|
+
const node = {
|
|
207
|
+
id: item.id,
|
|
208
|
+
parentId: item.parentId ?? null,
|
|
209
|
+
name: item.name ?? null,
|
|
210
|
+
children: null
|
|
211
|
+
};
|
|
212
|
+
map[node.id] = node;
|
|
213
|
+
}
|
|
214
|
+
for (const item of array) {
|
|
215
|
+
const node = map[item.id];
|
|
216
|
+
// Step 2: Check if it's a root or child and assign to parent or tree
|
|
217
|
+
if (typeof node.parentId === 'undefined' || node.parentId === null) {
|
|
218
|
+
// Root node, add directly to the tree
|
|
219
|
+
tree.push(node);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// Non-root node, find its parent and add to its children
|
|
223
|
+
let parentNode = map[node.parentId];
|
|
224
|
+
if (parentNode) {
|
|
225
|
+
if (!Array.isArray(parentNode.children))
|
|
226
|
+
parentNode.children = [];
|
|
227
|
+
parentNode.children.push(node);
|
|
228
|
+
}
|
|
229
|
+
else if (safe) {
|
|
230
|
+
//if save=true and parent node not exists, then we add as a root node
|
|
231
|
+
tree.push(node);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return tree;
|
|
236
|
+
}
|
|
173
237
|
}
|
|
174
238
|
|
|
175
239
|
class Base64Helper {
|
|
@@ -1355,6 +1419,38 @@ const firstBy = (function () {
|
|
|
1355
1419
|
return tb;
|
|
1356
1420
|
})();
|
|
1357
1421
|
|
|
1422
|
+
class IntervalHelper {
|
|
1423
|
+
static { this._timeouts = []; }
|
|
1424
|
+
static create(callback, ms) {
|
|
1425
|
+
const id = setInterval(() => {
|
|
1426
|
+
callback();
|
|
1427
|
+
}, ms);
|
|
1428
|
+
const timeout = {
|
|
1429
|
+
id: +id,
|
|
1430
|
+
callback: callback.toString(),
|
|
1431
|
+
interval: ms,
|
|
1432
|
+
createdAt: new Date()
|
|
1433
|
+
};
|
|
1434
|
+
this._timeouts.push(timeout);
|
|
1435
|
+
return timeout;
|
|
1436
|
+
}
|
|
1437
|
+
static clear(id) {
|
|
1438
|
+
const index = this._timeouts.findIndex(x => x.id === id);
|
|
1439
|
+
if (index !== -1) {
|
|
1440
|
+
clearInterval(id);
|
|
1441
|
+
this._timeouts.splice(index, 1);
|
|
1442
|
+
return true;
|
|
1443
|
+
}
|
|
1444
|
+
return false;
|
|
1445
|
+
}
|
|
1446
|
+
static clearAll() {
|
|
1447
|
+
for (const timeout of this._timeouts) {
|
|
1448
|
+
this.clear(timeout.id);
|
|
1449
|
+
}
|
|
1450
|
+
this._timeouts = [];
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1358
1454
|
class TmpHelper {
|
|
1359
1455
|
static { this._obj = {}; }
|
|
1360
1456
|
static get(key, remove = true) {
|
|
@@ -1434,57 +1530,60 @@ class ValidationHelper {
|
|
|
1434
1530
|
}
|
|
1435
1531
|
|
|
1436
1532
|
class AuthService {
|
|
1533
|
+
static { this.USER_KEY = 'user'; }
|
|
1534
|
+
static { this.REFRESH_TOKEN_INTERVAL = 15 * 60 * 1000; }
|
|
1437
1535
|
constructor() {
|
|
1438
|
-
this._isInitialized = false;
|
|
1439
1536
|
this._auth = false;
|
|
1440
1537
|
this._user = null;
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
// access_token
|
|
1444
|
-
get user() {
|
|
1445
|
-
if (!this._isInitialized) {
|
|
1446
|
-
const user = StorageHelper.get(AuthService.USER_KEY);
|
|
1538
|
+
const user = StorageHelper.get(AuthService.USER_KEY);
|
|
1539
|
+
if (user) {
|
|
1447
1540
|
this._init(user);
|
|
1448
1541
|
}
|
|
1542
|
+
}
|
|
1543
|
+
get _isAuthenticated() {
|
|
1544
|
+
const expired = this.getExpired();
|
|
1545
|
+
return new Date() < expired;
|
|
1546
|
+
}
|
|
1547
|
+
get user() {
|
|
1449
1548
|
return this._user;
|
|
1450
1549
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
}
|
|
1550
|
+
get isAuthenticated() {
|
|
1551
|
+
return this._auth;
|
|
1552
|
+
}
|
|
1553
|
+
_starTimer() {
|
|
1554
|
+
this._stopTimer();
|
|
1555
|
+
let interval = this.getExpired().getTime() - new Date().getTime() + 1000;
|
|
1556
|
+
if (interval < 1000)
|
|
1557
|
+
interval = 1000;
|
|
1558
|
+
if (interval > 0 && this._user) {
|
|
1559
|
+
this._timerId = setTimeout(() => {
|
|
1560
|
+
this._onTick();
|
|
1561
|
+
}, interval);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
_stopTimer() {
|
|
1565
|
+
if (typeof this._timerId === 'number') {
|
|
1566
|
+
clearTimeout(this._timerId);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
_onTick() {
|
|
1570
|
+
const newValue = this._isAuthenticated;
|
|
1571
|
+
if (this._auth !== newValue && !newValue) {
|
|
1572
|
+
this.logout();
|
|
1463
1573
|
}
|
|
1464
|
-
this._user = user;
|
|
1465
|
-
this._isInitialized = true;
|
|
1466
|
-
this._starRefreshTokenTimer();
|
|
1467
1574
|
}
|
|
1468
1575
|
_starRefreshTokenTimer() {
|
|
1469
1576
|
this._stopRefreshTokenTimer();
|
|
1470
|
-
const
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1473
|
-
if (timeout < 0) {
|
|
1577
|
+
const interval = AuthService.REFRESH_TOKEN_INTERVAL;
|
|
1578
|
+
if (interval > 0 && this._user) {
|
|
1579
|
+
this._refreshTimerId = setInterval(() => {
|
|
1474
1580
|
this.emitOnRefreshToken();
|
|
1475
|
-
}
|
|
1476
|
-
const minRefreshTime = 60000; //1 min;
|
|
1477
|
-
if (timeout < minRefreshTime) {
|
|
1478
|
-
timeout = minRefreshTime;
|
|
1479
|
-
}
|
|
1480
|
-
this._timerId = setInterval(() => {
|
|
1481
|
-
this.emitOnRefreshToken();
|
|
1482
|
-
}, timeout);
|
|
1581
|
+
}, interval);
|
|
1483
1582
|
}
|
|
1484
1583
|
}
|
|
1485
1584
|
_stopRefreshTokenTimer() {
|
|
1486
|
-
if (typeof this.
|
|
1487
|
-
clearInterval(this.
|
|
1585
|
+
if (typeof this._refreshTimerId === 'number') {
|
|
1586
|
+
clearInterval(this._refreshTimerId);
|
|
1488
1587
|
}
|
|
1489
1588
|
}
|
|
1490
1589
|
emitOnRefreshToken() {
|
|
@@ -1492,29 +1591,6 @@ class AuthService {
|
|
|
1492
1591
|
this._onRefreshTokenSubject.next();
|
|
1493
1592
|
}
|
|
1494
1593
|
}
|
|
1495
|
-
get _isAuthenticated() {
|
|
1496
|
-
const expired = this.getExpired();
|
|
1497
|
-
return new Date() < expired;
|
|
1498
|
-
}
|
|
1499
|
-
/**
|
|
1500
|
-
* Dynamic property. gets auth user and checks expired;
|
|
1501
|
-
*/
|
|
1502
|
-
get isAuthenticated() {
|
|
1503
|
-
const newValue = this._isAuthenticated;
|
|
1504
|
-
if (this._auth !== newValue) {
|
|
1505
|
-
this._auth = newValue;
|
|
1506
|
-
//if user is signed in and expired we need to logout (remove from localStorage)
|
|
1507
|
-
if (!newValue) {
|
|
1508
|
-
this.logout(); //this executes emitOnSignedIn so we don't need here execute emitOnSignedIn
|
|
1509
|
-
}
|
|
1510
|
-
else {
|
|
1511
|
-
//this line need if you already logged in and refresh page. (System will init user from storage and verify)
|
|
1512
|
-
this.emitOnSignedIn();
|
|
1513
|
-
}
|
|
1514
|
-
return newValue;
|
|
1515
|
-
}
|
|
1516
|
-
return newValue;
|
|
1517
|
-
}
|
|
1518
1594
|
emitOnSignedIn() {
|
|
1519
1595
|
if (this._onSignedInSubject) {
|
|
1520
1596
|
this._onSignedInSubject.next(this._auth);
|
|
@@ -1522,7 +1598,7 @@ class AuthService {
|
|
|
1522
1598
|
}
|
|
1523
1599
|
get onSignedIn() {
|
|
1524
1600
|
if (!this._onSignedInSubject) {
|
|
1525
|
-
this._onSignedInSubject = new
|
|
1601
|
+
this._onSignedInSubject = new Subject(); //(this.isAuthenticated);
|
|
1526
1602
|
this._onSignedInObservable = this._onSignedInSubject.asObservable();
|
|
1527
1603
|
}
|
|
1528
1604
|
if (!this._onSignedInObservable)
|
|
@@ -1538,41 +1614,46 @@ class AuthService {
|
|
|
1538
1614
|
throw new Error("onRefreshTokenObservable is undefined");
|
|
1539
1615
|
return this._onRefreshTokenObservable;
|
|
1540
1616
|
}
|
|
1541
|
-
|
|
1617
|
+
login(user) {
|
|
1542
1618
|
StorageHelper.set(AuthService.USER_KEY, user);
|
|
1543
|
-
this._isInitialized = false; //user get method will init user
|
|
1544
1619
|
this._init(user);
|
|
1545
|
-
this._auth = ObjectHelper.isDefined(user);
|
|
1546
|
-
this.emitOnSignedIn();
|
|
1547
1620
|
}
|
|
1548
|
-
|
|
1549
|
-
|
|
1621
|
+
_init(user) {
|
|
1622
|
+
if (user) {
|
|
1623
|
+
//convert string to local date/time
|
|
1624
|
+
user.expired = ObjectHelper.isDefined(user.expired) ? DateHelper.parseDate(user.expired) : user.expired;
|
|
1625
|
+
if (Array.isArray(user.roles)) {
|
|
1626
|
+
user.roles = user.roles.map(function (e) { return e ? e.toUpperCase() : e; });
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
this._user = user;
|
|
1630
|
+
// if (!this._auth) {
|
|
1631
|
+
// this._auth = true;
|
|
1632
|
+
// this.emitOnSignedIn();
|
|
1633
|
+
// }
|
|
1634
|
+
this._auth = true;
|
|
1635
|
+
this.emitOnSignedIn();
|
|
1636
|
+
//restart timers for new timeouts
|
|
1637
|
+
this._starTimer();
|
|
1638
|
+
this._starRefreshTokenTimer();
|
|
1550
1639
|
}
|
|
1551
1640
|
logout() {
|
|
1552
|
-
|
|
1641
|
+
StorageHelper.set(AuthService.USER_KEY, null);
|
|
1642
|
+
this._user = null;
|
|
1643
|
+
if (this._auth) {
|
|
1644
|
+
this._auth = false;
|
|
1645
|
+
this.emitOnSignedIn();
|
|
1646
|
+
}
|
|
1647
|
+
this._stopTimer();
|
|
1648
|
+
this._stopRefreshTokenTimer();
|
|
1553
1649
|
}
|
|
1650
|
+
/**
|
|
1651
|
+
*
|
|
1652
|
+
* @returns user expiry date. if user is null returns min JS date
|
|
1653
|
+
*/
|
|
1554
1654
|
getExpired() {
|
|
1555
|
-
return this.user?.expired ?? new Date(0);
|
|
1655
|
+
return this.user?.expired ?? new Date(0);
|
|
1556
1656
|
}
|
|
1557
|
-
// protected getRefreshTokenExpired(): Date | null | undefined {
|
|
1558
|
-
// const user = this.user;
|
|
1559
|
-
// if (user) {
|
|
1560
|
-
// return user.refreshTokenTime;
|
|
1561
|
-
// }
|
|
1562
|
-
// return null;
|
|
1563
|
-
// }
|
|
1564
|
-
// isInRole(allowedRoles: string[]): boolean {
|
|
1565
|
-
// if (!allowedRoles || allowedRoles.length === 0) {
|
|
1566
|
-
// return true;
|
|
1567
|
-
// }
|
|
1568
|
-
// const tmp = this.getUser();
|
|
1569
|
-
// const roles = tmp ? tmp.roles : null;
|
|
1570
|
-
// if (!roles || roles.length === 0) {
|
|
1571
|
-
// return false;
|
|
1572
|
-
// }
|
|
1573
|
-
// let isInRole = allowedRoles.some(role => roles.indexOf(role) !== -1);
|
|
1574
|
-
// return isInRole;
|
|
1575
|
-
// }
|
|
1576
1657
|
hasPermission(permission) {
|
|
1577
1658
|
if (!permission) {
|
|
1578
1659
|
return true;
|
|
@@ -1635,7 +1716,7 @@ class AuthService {
|
|
|
1635
1716
|
}
|
|
1636
1717
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: AuthService, decorators: [{
|
|
1637
1718
|
type: Injectable
|
|
1638
|
-
}] });
|
|
1719
|
+
}], ctorParameters: () => [] });
|
|
1639
1720
|
|
|
1640
1721
|
const zekAuthGuard = (route, state) => {
|
|
1641
1722
|
const auth = inject(AuthService);
|
|
@@ -2735,6 +2816,9 @@ class PagedList {
|
|
|
2735
2816
|
}
|
|
2736
2817
|
}
|
|
2737
2818
|
|
|
2819
|
+
/**
|
|
2820
|
+
* @deprecated use ITreeNode
|
|
2821
|
+
*/
|
|
2738
2822
|
class Tree extends KeyPairChecked {
|
|
2739
2823
|
}
|
|
2740
2824
|
|
|
@@ -3049,6 +3133,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
3049
3133
|
args: ['disapproveModal', { static: false }]
|
|
3050
3134
|
}] } });
|
|
3051
3135
|
|
|
3136
|
+
class ZekDelayedInputDirective {
|
|
3137
|
+
constructor() {
|
|
3138
|
+
this._inputSubject$ = new Subject();
|
|
3139
|
+
this.delayedInput = new EventEmitter();
|
|
3140
|
+
this._delay = 500;
|
|
3141
|
+
}
|
|
3142
|
+
get delay() {
|
|
3143
|
+
return this._delay;
|
|
3144
|
+
}
|
|
3145
|
+
set delay(v) {
|
|
3146
|
+
const tmp = MathHelper.clamp(Convert.toNumber(v), 1, 3600000);
|
|
3147
|
+
if (this._delay !== tmp) {
|
|
3148
|
+
this._delay = tmp;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
ngOnInit() {
|
|
3152
|
+
this.initSubscription();
|
|
3153
|
+
}
|
|
3154
|
+
initSubscription() {
|
|
3155
|
+
// Emit values after the specified debounce time
|
|
3156
|
+
this._inputSubject$.pipe(debounceTime(this.delay)).subscribe((value) => {
|
|
3157
|
+
this.delayedInput.emit(value);
|
|
3158
|
+
});
|
|
3159
|
+
}
|
|
3160
|
+
// ngOnChanges(changes: SimpleChanges) {
|
|
3161
|
+
// if (changes['delayTime']) {
|
|
3162
|
+
// // Reset the subscription when delayTime changes
|
|
3163
|
+
// this._inputSubject$ = new Subject<string>(); // Replace the Subject
|
|
3164
|
+
// this.initSubscription(); // Reinitialize with the new delayTime
|
|
3165
|
+
// }
|
|
3166
|
+
// }
|
|
3167
|
+
onInput(value) {
|
|
3168
|
+
this._inputSubject$.next(value); // Push new value to the Subject
|
|
3169
|
+
}
|
|
3170
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekDelayedInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3171
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.4", type: ZekDelayedInputDirective, isStandalone: true, selector: "[zek-delayed-input]", inputs: { delay: "delay" }, outputs: { delayedInput: "delayedInput" }, host: { listeners: { "input": "onInput($event.target.value)" } }, ngImport: i0 }); }
|
|
3172
|
+
}
|
|
3173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ZekDelayedInputDirective, decorators: [{
|
|
3174
|
+
type: Directive,
|
|
3175
|
+
args: [{
|
|
3176
|
+
standalone: true,
|
|
3177
|
+
selector: '[zek-delayed-input]'
|
|
3178
|
+
}]
|
|
3179
|
+
}], propDecorators: { delayedInput: [{
|
|
3180
|
+
type: Output
|
|
3181
|
+
}], delay: [{
|
|
3182
|
+
type: Input
|
|
3183
|
+
}], onInput: [{
|
|
3184
|
+
type: HostListener,
|
|
3185
|
+
args: ['input', ['$event.target.value']]
|
|
3186
|
+
}] } });
|
|
3187
|
+
|
|
3052
3188
|
class AgePipe {
|
|
3053
3189
|
transform(value, now) {
|
|
3054
3190
|
if (typeof value === 'undefined' || value === null || value === '' || value !== value)
|
|
@@ -3109,15 +3245,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
3109
3245
|
type: Input
|
|
3110
3246
|
}] } });
|
|
3111
3247
|
|
|
3112
|
-
function clamp$1(v, min = 10, max = 3600000) {
|
|
3113
|
-
return Math.max(min, Math.min(max, v));
|
|
3114
|
-
}
|
|
3115
3248
|
class ZekToast {
|
|
3116
3249
|
get delay() {
|
|
3117
3250
|
return this._delay;
|
|
3118
3251
|
}
|
|
3119
3252
|
set delay(v) {
|
|
3120
|
-
const tmp = clamp
|
|
3253
|
+
const tmp = MathHelper.clamp(Convert.toNumber(v) || 0, 10, 3600000);
|
|
3121
3254
|
if (this._delay !== tmp) {
|
|
3122
3255
|
this._delay = tmp;
|
|
3123
3256
|
}
|
|
@@ -5528,9 +5661,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
5528
5661
|
args: ['modelChange']
|
|
5529
5662
|
}] } });
|
|
5530
5663
|
|
|
5531
|
-
function clamp(v, min = 0, max = 100) {
|
|
5532
|
-
return Math.max(min, Math.min(max, v));
|
|
5533
|
-
}
|
|
5534
5664
|
class ZekProgress {
|
|
5535
5665
|
constructor() {
|
|
5536
5666
|
this._value = 0;
|
|
@@ -5546,7 +5676,7 @@ class ZekProgress {
|
|
|
5546
5676
|
return this._value;
|
|
5547
5677
|
}
|
|
5548
5678
|
set value(v) {
|
|
5549
|
-
const tmp = clamp(Convert.toNumber(v) || 0);
|
|
5679
|
+
const tmp = MathHelper.clamp(Convert.toNumber(v) || 0, 0, 100);
|
|
5550
5680
|
if (this._value !== tmp) {
|
|
5551
5681
|
this._value = tmp;
|
|
5552
5682
|
}
|
|
@@ -7298,5 +7428,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
7298
7428
|
* Generated bundle index. Do not edit.
|
|
7299
7429
|
*/
|
|
7300
7430
|
|
|
7301
|
-
export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDeleteModal, ZekDisapproveModal, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
|
|
7431
|
+
export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, IntervalHelper, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDelayedInputDirective, ZekDeleteModal, ZekDisapproveModal, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
|
|
7302
7432
|
//# sourceMappingURL=zek.mjs.map
|