@ts-core/angular 13.0.12 → 13.0.13
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.
|
@@ -5,6 +5,7 @@ import { PromiseHandler } from '@ts-core/common/promise';
|
|
|
5
5
|
import * as _ from 'lodash';
|
|
6
6
|
import { Assets } from '@ts-core/frontend/asset';
|
|
7
7
|
import { takeUntil, filter, debounceTime, map } from 'rxjs/operators';
|
|
8
|
+
import { ExtendedError } from '@ts-core/common/error';
|
|
8
9
|
import moment from 'moment';
|
|
9
10
|
import numeral from 'numeral';
|
|
10
11
|
import { ObservableData } from '@ts-core/common/observer';
|
|
@@ -54,7 +55,6 @@ import { MatSortModule } from '@angular/material/sort';
|
|
|
54
55
|
import * as i3$1 from '@angular/material/progress-bar';
|
|
55
56
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
56
57
|
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
|
57
|
-
import { ExtendedError } from '@ts-core/common/error';
|
|
58
58
|
import { TransportTimeoutError, TransportNoConnectionError, TransportEvent } from '@ts-core/common/transport';
|
|
59
59
|
import { NavigationStart, NavigationEnd, NavigationCancel, NavigationError, ActivatedRoute } from '@angular/router';
|
|
60
60
|
import { FilterableMapCollection, MapCollection } from '@ts-core/common/map';
|
|
@@ -145,6 +145,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
145
145
|
}], ctorParameters: function () { return []; } });
|
|
146
146
|
|
|
147
147
|
class ViewUtil {
|
|
148
|
+
static get renderer() {
|
|
149
|
+
if (_.isNil(ViewUtil._renderer)) {
|
|
150
|
+
throw new ExtendedError(`ViewUtil is not initialized: renderer in nil`);
|
|
151
|
+
}
|
|
152
|
+
return ViewUtil._renderer;
|
|
153
|
+
}
|
|
148
154
|
// --------------------------------------------------------------------------
|
|
149
155
|
//
|
|
150
156
|
// Private Methods
|
|
@@ -162,7 +168,7 @@ class ViewUtil {
|
|
|
162
168
|
//
|
|
163
169
|
// --------------------------------------------------------------------------
|
|
164
170
|
static initialize(renderer) {
|
|
165
|
-
ViewUtil.
|
|
171
|
+
ViewUtil._renderer = renderer;
|
|
166
172
|
}
|
|
167
173
|
static parseElement(element) {
|
|
168
174
|
if (element instanceof HTMLElement) {
|
|
@@ -233,7 +239,7 @@ class ViewUtil {
|
|
|
233
239
|
//
|
|
234
240
|
// --------------------------------------------------------------------------
|
|
235
241
|
static createElement(name, className, innerHTML) {
|
|
236
|
-
let element = ViewUtil.
|
|
242
|
+
let element = ViewUtil.renderer.createElement(name);
|
|
237
243
|
if (!_.isNil(name)) {
|
|
238
244
|
ViewUtil.setProperty(element, 'className', className);
|
|
239
245
|
}
|
|
@@ -243,13 +249,13 @@ class ViewUtil {
|
|
|
243
249
|
return element;
|
|
244
250
|
}
|
|
245
251
|
static appendChild(parent, child) {
|
|
246
|
-
if (!_.isNil(parent) && !_.isNil(child)
|
|
247
|
-
ViewUtil.
|
|
252
|
+
if (!_.isNil(parent) && !_.isNil(child)) {
|
|
253
|
+
ViewUtil.renderer.appendChild(parent, child);
|
|
248
254
|
}
|
|
249
255
|
}
|
|
250
256
|
static removeChild(parent, child) {
|
|
251
|
-
if (!_.isNil(parent) && !_.isNil(child)
|
|
252
|
-
ViewUtil.
|
|
257
|
+
if (!_.isNil(parent) && !_.isNil(child)) {
|
|
258
|
+
ViewUtil.renderer.removeChild(parent, child);
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
261
|
static toggleChild(container, child, value) {
|
|
@@ -286,12 +292,14 @@ class ViewUtil {
|
|
|
286
292
|
}
|
|
287
293
|
return value;
|
|
288
294
|
}
|
|
289
|
-
static setWidth(container, value, isNeedCheckLimits) {
|
|
295
|
+
static setWidth(container, value, isNeedCheckLimits = false) {
|
|
290
296
|
if (_.isNil(container) || _.isNaN(value)) {
|
|
291
297
|
return false;
|
|
292
298
|
}
|
|
293
|
-
if (isNeedCheckLimits &&
|
|
299
|
+
if (isNeedCheckLimits &&
|
|
300
|
+
(value < ViewUtil.getMinWidth(container) || value > ViewUtil.getMaxWidth(container) || value === ViewUtil.getWidth(container))) {
|
|
294
301
|
return false;
|
|
302
|
+
}
|
|
295
303
|
ViewUtil.setStyle(container, 'width', value + 'px');
|
|
296
304
|
return true;
|
|
297
305
|
}
|
|
@@ -329,13 +337,14 @@ class ViewUtil {
|
|
|
329
337
|
}
|
|
330
338
|
return value;
|
|
331
339
|
}
|
|
332
|
-
static setHeight(container, value, isNeedCheckLimits) {
|
|
340
|
+
static setHeight(container, value, isNeedCheckLimits = false) {
|
|
333
341
|
if (_.isNil(container) || _.isNaN(value)) {
|
|
334
342
|
return false;
|
|
335
343
|
}
|
|
336
344
|
if (isNeedCheckLimits &&
|
|
337
|
-
(value < ViewUtil.getMinHeight(container) || value > ViewUtil.getMaxHeight(container) || value === ViewUtil.getHeight(container)))
|
|
345
|
+
(value < ViewUtil.getMinHeight(container) || value > ViewUtil.getMaxHeight(container) || value === ViewUtil.getHeight(container))) {
|
|
338
346
|
return false;
|
|
347
|
+
}
|
|
339
348
|
ViewUtil.setStyle(container, 'height', value + 'px');
|
|
340
349
|
return true;
|
|
341
350
|
}
|
|
@@ -414,8 +423,8 @@ class ViewUtil {
|
|
|
414
423
|
return;
|
|
415
424
|
}
|
|
416
425
|
container = ViewUtil.parseElement(container);
|
|
417
|
-
if (!_.isNil(container)
|
|
418
|
-
ViewUtil.
|
|
426
|
+
if (!_.isNil(container)) {
|
|
427
|
+
ViewUtil.renderer.addClass(container, name);
|
|
419
428
|
}
|
|
420
429
|
}
|
|
421
430
|
static addClasses(container, names) {
|
|
@@ -429,8 +438,8 @@ class ViewUtil {
|
|
|
429
438
|
return;
|
|
430
439
|
}
|
|
431
440
|
container = ViewUtil.parseElement(container);
|
|
432
|
-
if (!_.isNil(container)
|
|
433
|
-
ViewUtil.
|
|
441
|
+
if (!_.isNil(container)) {
|
|
442
|
+
ViewUtil.renderer.removeClass(container, name);
|
|
434
443
|
}
|
|
435
444
|
}
|
|
436
445
|
static removeClasses(container, names) {
|
|
@@ -466,7 +475,12 @@ class ViewUtil {
|
|
|
466
475
|
if (_.isNil(name) || _.isNil(container)) {
|
|
467
476
|
return;
|
|
468
477
|
}
|
|
469
|
-
|
|
478
|
+
if (!_.isNil(value)) {
|
|
479
|
+
ViewUtil.renderer.setProperty(container, name, value);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
ViewUtil.removeProperty(container, name);
|
|
483
|
+
}
|
|
470
484
|
}
|
|
471
485
|
static removeProperty(container, name) {
|
|
472
486
|
ViewUtil.removeAttribute(container, name);
|
|
@@ -476,14 +490,19 @@ class ViewUtil {
|
|
|
476
490
|
if (_.isNil(name) || _.isNil(container)) {
|
|
477
491
|
return;
|
|
478
492
|
}
|
|
479
|
-
ViewUtil.
|
|
493
|
+
ViewUtil.renderer.removeAttribute(container, name);
|
|
480
494
|
}
|
|
481
495
|
static setAttribute(container, name, value) {
|
|
482
496
|
container = ViewUtil.parseElement(container);
|
|
483
497
|
if (_.isNil(name) || _.isNil(container)) {
|
|
484
498
|
return;
|
|
485
499
|
}
|
|
486
|
-
|
|
500
|
+
if (!_.isNil(value)) {
|
|
501
|
+
ViewUtil.renderer.setAttribute(container, name, value);
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
ViewUtil.removeAttribute(container, name);
|
|
505
|
+
}
|
|
487
506
|
}
|
|
488
507
|
static getStyle(container, name) {
|
|
489
508
|
container = ViewUtil.parseElement(container);
|
|
@@ -498,7 +517,7 @@ class ViewUtil {
|
|
|
498
517
|
return;
|
|
499
518
|
}
|
|
500
519
|
if (value !== ViewUtil.getStyle(container, name)) {
|
|
501
|
-
ViewUtil.
|
|
520
|
+
ViewUtil.renderer.setStyle(container, name, value, flags);
|
|
502
521
|
}
|
|
503
522
|
}
|
|
504
523
|
static removeStyle(container, name, flags) {
|
|
@@ -506,7 +525,7 @@ class ViewUtil {
|
|
|
506
525
|
if (_.isNil(name) || _.isNil(container)) {
|
|
507
526
|
return;
|
|
508
527
|
}
|
|
509
|
-
ViewUtil.
|
|
528
|
+
ViewUtil.renderer.removeStyle(container, name, flags);
|
|
510
529
|
}
|
|
511
530
|
// --------------------------------------------------------------------------
|
|
512
531
|
//
|
|
@@ -652,7 +671,7 @@ class ViewUtil {
|
|
|
652
671
|
// Constants
|
|
653
672
|
//
|
|
654
673
|
// --------------------------------------------------------------------------
|
|
655
|
-
ViewUtil.
|
|
674
|
+
ViewUtil._renderer = null;
|
|
656
675
|
|
|
657
676
|
class ApplicationComponent extends ApplicationBaseComponent {
|
|
658
677
|
// --------------------------------------------------------------------------
|