dom-render 1.0.83 → 1.0.84
Sign up to get free protection for your applications and to get access to all the features.
- package/README.MD +2 -2
- package/RawSet.d.ts +1 -0
- package/RawSet.js +35 -23
- package/dist/bundle.js +234 -222
- package/package.json +1 -1
package/README.MD
CHANGED
@@ -7,7 +7,7 @@ DOM-RENDER
|
|
7
7
|
|
8
8
|
# 🚀 Quick start
|
9
9
|
```html
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/dom-render@1.0.
|
10
|
+
<script src="https://cdn.jsdelivr.net/npm/dom-render@1.0.84/dist/bundle.js"></script>
|
11
11
|
```
|
12
12
|
```html
|
13
13
|
<!DOCTYPE html>
|
@@ -18,7 +18,7 @@ DOM-RENDER
|
|
18
18
|
</head>
|
19
19
|
<body id="app">
|
20
20
|
${this.name}$
|
21
|
-
<script src="https://cdn.jsdelivr.net/npm/dom-render@1.0.
|
21
|
+
<script src="https://cdn.jsdelivr.net/npm/dom-render@1.0.84/dist/bundle.js"></script>
|
22
22
|
<script>
|
23
23
|
let data = {
|
24
24
|
name: 'my name is dom-render'
|
package/RawSet.d.ts
CHANGED
@@ -115,6 +115,7 @@ export declare class RawSet {
|
|
115
115
|
get isConnected(): boolean;
|
116
116
|
getUsingTriggerVariables(config?: Config): Set<string>;
|
117
117
|
render(obj: any, config: Config): RawSet[];
|
118
|
+
generateCSS(id: string, cssRule: CSSRule): void;
|
118
119
|
applyEvent(obj: any, fragment?: DocumentFragment, config?: Config): void;
|
119
120
|
getAttribute(element: Element, attr: string): string | null;
|
120
121
|
getAttributeAndDelete(element: Element, attr: string): string | null;
|
package/RawSet.js
CHANGED
@@ -241,29 +241,8 @@ var RawSet = /** @class */ (function () {
|
|
241
241
|
var id = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-')[0];
|
242
242
|
if (id) {
|
243
243
|
// console.log('------->', id)
|
244
|
-
|
245
|
-
|
246
|
-
Array.from(it.cssRules).filter(function (it) { return it.constructor.name === 'CSSStyleRule'; }).forEach(function (it) {
|
247
|
-
var rule = it;
|
248
|
-
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
|
249
|
-
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ ${rule.selectorText})`;
|
250
|
-
// console.log('-----', rule, rule.selectorText)
|
251
|
-
if (!rule.selectorText.startsWith(':root')) {
|
252
|
-
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
253
|
-
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
254
|
-
var selectorText = ":is(".concat(start_1, " ~ *:not(").concat(start_1, " ~ ").concat(end_1, " ~ *))");
|
255
|
-
if (rule.selectorText.startsWith('.')) {
|
256
|
-
rule.selectorText = "".concat(selectorText).concat(rule.selectorText, ", ").concat(selectorText, " ").concat(rule.selectorText);
|
257
|
-
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
|
258
|
-
}
|
259
|
-
else {
|
260
|
-
var divText = "".concat(start_1, " ~ ").concat(rule.selectorText, ":not(").concat(start_1, " ~ ").concat(end_1, " ~ *)");
|
261
|
-
rule.selectorText = "".concat(selectorText, " ").concat(rule.selectorText, ", ").concat(divText);
|
262
|
-
// rule.selectorText = `${selectorText} ${rule.selectorText}`;
|
263
|
-
// rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
|
264
|
-
}
|
265
|
-
}
|
266
|
-
// console.log(rule.selectorText);
|
244
|
+
Array.from(it.cssRules).forEach(function (it) {
|
245
|
+
_this.generateCSS(id, it);
|
267
246
|
});
|
268
247
|
}
|
269
248
|
it.ownerNode.setAttribute('completed', 'true');
|
@@ -294,6 +273,39 @@ var RawSet = /** @class */ (function () {
|
|
294
273
|
}
|
295
274
|
return raws;
|
296
275
|
};
|
276
|
+
RawSet.prototype.generateCSS = function (id, cssRule) {
|
277
|
+
var _this = this;
|
278
|
+
var start = "#".concat(id, "-start");
|
279
|
+
var end = "#".concat(id, "-end");
|
280
|
+
if (cssRule.constructor.name === 'CSSStyleRule') {
|
281
|
+
var rule = cssRule;
|
282
|
+
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
|
283
|
+
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ ${rule.selectorText})`;
|
284
|
+
// console.log('-----', rule, rule.selectorText)
|
285
|
+
if (!rule.selectorText.startsWith(':root')) {
|
286
|
+
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
287
|
+
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
288
|
+
var selectorText = ":is(".concat(start, " ~ *:not(").concat(start, " ~ ").concat(end, " ~ *))");
|
289
|
+
if (rule.selectorText.startsWith('.')) {
|
290
|
+
rule.selectorText = "".concat(selectorText).concat(rule.selectorText, ", ").concat(selectorText, " ").concat(rule.selectorText);
|
291
|
+
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
|
292
|
+
}
|
293
|
+
else {
|
294
|
+
var divText = "".concat(start, " ~ ").concat(rule.selectorText, ":not(").concat(start, " ~ ").concat(end, " ~ *)");
|
295
|
+
rule.selectorText = "".concat(selectorText, " ").concat(rule.selectorText, ", ").concat(divText);
|
296
|
+
// rule.selectorText = `${selectorText} ${rule.selectorText}`;
|
297
|
+
// rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
// console.log(rule.selectorText);
|
301
|
+
}
|
302
|
+
else if (cssRule.constructor.name === 'CSSMediaRule') {
|
303
|
+
var rule = cssRule;
|
304
|
+
Array.from(rule.cssRules).forEach(function (it) {
|
305
|
+
_this.generateCSS(id, it);
|
306
|
+
});
|
307
|
+
}
|
308
|
+
};
|
297
309
|
RawSet.prototype.applyEvent = function (obj, fragment, config) {
|
298
310
|
if (fragment === void 0) { fragment = this.fragment; }
|
299
311
|
EventManager_1.eventManager.applyEvent(obj, EventManager_1.eventManager.findAttrElements(fragment, config), config);
|
package/dist/bundle.js
CHANGED
@@ -1999,29 +1999,8 @@ var RawSet = /** @class */ (function () {
|
|
1999
1999
|
var id = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-')[0];
|
2000
2000
|
if (id) {
|
2001
2001
|
// console.log('------->', id)
|
2002
|
-
|
2003
|
-
|
2004
|
-
Array.from(it.cssRules).filter(function (it) { return it.constructor.name === 'CSSStyleRule'; }).forEach(function (it) {
|
2005
|
-
var rule = it;
|
2006
|
-
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
|
2007
|
-
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ ${rule.selectorText})`;
|
2008
|
-
// console.log('-----', rule, rule.selectorText)
|
2009
|
-
if (!rule.selectorText.startsWith(':root')) {
|
2010
|
-
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2011
|
-
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2012
|
-
var selectorText = ":is(".concat(start_1, " ~ *:not(").concat(start_1, " ~ ").concat(end_1, " ~ *))");
|
2013
|
-
if (rule.selectorText.startsWith('.')) {
|
2014
|
-
rule.selectorText = "".concat(selectorText).concat(rule.selectorText, ", ").concat(selectorText, " ").concat(rule.selectorText);
|
2015
|
-
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
|
2016
|
-
}
|
2017
|
-
else {
|
2018
|
-
var divText = "".concat(start_1, " ~ ").concat(rule.selectorText, ":not(").concat(start_1, " ~ ").concat(end_1, " ~ *)");
|
2019
|
-
rule.selectorText = "".concat(selectorText, " ").concat(rule.selectorText, ", ").concat(divText);
|
2020
|
-
// rule.selectorText = `${selectorText} ${rule.selectorText}`;
|
2021
|
-
// rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
|
2022
|
-
}
|
2023
|
-
}
|
2024
|
-
// console.log(rule.selectorText);
|
2002
|
+
Array.from(it.cssRules).forEach(function (it) {
|
2003
|
+
_this.generateCSS(id, it);
|
2025
2004
|
});
|
2026
2005
|
}
|
2027
2006
|
it.ownerNode.setAttribute('completed', 'true');
|
@@ -2052,6 +2031,39 @@ var RawSet = /** @class */ (function () {
|
|
2052
2031
|
}
|
2053
2032
|
return raws;
|
2054
2033
|
};
|
2034
|
+
RawSet.prototype.generateCSS = function (id, cssRule) {
|
2035
|
+
var _this = this;
|
2036
|
+
var start = "#".concat(id, "-start");
|
2037
|
+
var end = "#".concat(id, "-end");
|
2038
|
+
if (cssRule.constructor.name === 'CSSStyleRule') {
|
2039
|
+
var rule = cssRule;
|
2040
|
+
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
|
2041
|
+
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ ${rule.selectorText})`;
|
2042
|
+
// console.log('-----', rule, rule.selectorText)
|
2043
|
+
if (!rule.selectorText.startsWith(':root')) {
|
2044
|
+
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2045
|
+
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2046
|
+
var selectorText = ":is(".concat(start, " ~ *:not(").concat(start, " ~ ").concat(end, " ~ *))");
|
2047
|
+
if (rule.selectorText.startsWith('.')) {
|
2048
|
+
rule.selectorText = "".concat(selectorText).concat(rule.selectorText, ", ").concat(selectorText, " ").concat(rule.selectorText);
|
2049
|
+
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
|
2050
|
+
}
|
2051
|
+
else {
|
2052
|
+
var divText = "".concat(start, " ~ ").concat(rule.selectorText, ":not(").concat(start, " ~ ").concat(end, " ~ *)");
|
2053
|
+
rule.selectorText = "".concat(selectorText, " ").concat(rule.selectorText, ", ").concat(divText);
|
2054
|
+
// rule.selectorText = `${selectorText} ${rule.selectorText}`;
|
2055
|
+
// rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
|
2056
|
+
}
|
2057
|
+
}
|
2058
|
+
// console.log(rule.selectorText);
|
2059
|
+
}
|
2060
|
+
else if (cssRule.constructor.name === 'CSSMediaRule') {
|
2061
|
+
var rule = cssRule;
|
2062
|
+
Array.from(rule.cssRules).forEach(function (it) {
|
2063
|
+
_this.generateCSS(id, it);
|
2064
|
+
});
|
2065
|
+
}
|
2066
|
+
};
|
2055
2067
|
RawSet.prototype.applyEvent = function (obj, fragment, config) {
|
2056
2068
|
if (fragment === void 0) { fragment = this.fragment; }
|
2057
2069
|
eventManager.applyEvent(obj, eventManager.findAttrElements(fragment, config), config);
|
@@ -3430,21 +3442,6 @@ var DomRender = /** @class */ (function () {
|
|
3430
3442
|
return DomRender;
|
3431
3443
|
}());
|
3432
3444
|
|
3433
|
-
var RenderManager = /** @class */ (function () {
|
3434
|
-
function RenderManager() {
|
3435
|
-
}
|
3436
|
-
RenderManager.render = function (obj, target) {
|
3437
|
-
if (target === void 0) { target = Object.keys(obj); }
|
3438
|
-
var domRenderProxy = obj._DomRender_proxy;
|
3439
|
-
if (domRenderProxy) {
|
3440
|
-
target.forEach(function (it) {
|
3441
|
-
domRenderProxy.root([it], obj[it]);
|
3442
|
-
});
|
3443
|
-
}
|
3444
|
-
};
|
3445
|
-
return RenderManager;
|
3446
|
-
}());
|
3447
|
-
|
3448
3445
|
var Appender = /** @class */ (function () {
|
3449
3446
|
function Appender(defaultDatas) {
|
3450
3447
|
this.length = 0;
|
@@ -3498,6 +3495,21 @@ var Appender = /** @class */ (function () {
|
|
3498
3495
|
return Appender;
|
3499
3496
|
}());
|
3500
3497
|
|
3498
|
+
var RenderManager = /** @class */ (function () {
|
3499
|
+
function RenderManager() {
|
3500
|
+
}
|
3501
|
+
RenderManager.render = function (obj, target) {
|
3502
|
+
if (target === void 0) { target = Object.keys(obj); }
|
3503
|
+
var domRenderProxy = obj._DomRender_proxy;
|
3504
|
+
if (domRenderProxy) {
|
3505
|
+
target.forEach(function (it) {
|
3506
|
+
domRenderProxy.root([it], obj[it]);
|
3507
|
+
});
|
3508
|
+
}
|
3509
|
+
};
|
3510
|
+
return RenderManager;
|
3511
|
+
}());
|
3512
|
+
|
3501
3513
|
var AllCheckedValidatorArray = /** @class */ (function (_super) {
|
3502
3514
|
__extends(AllCheckedValidatorArray, _super);
|
3503
3515
|
function AllCheckedValidatorArray(value, target, event, autoValid) {
|
@@ -3537,36 +3549,6 @@ var AllUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3537
3549
|
return AllUnCheckedValidatorArray;
|
3538
3550
|
}(ValidatorArray));
|
3539
3551
|
|
3540
|
-
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3541
|
-
__extends(CountEqualsCheckedValidatorArray, _super);
|
3542
|
-
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3543
|
-
if (autoValid === void 0) { autoValid = true; }
|
3544
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3545
|
-
_this.count = count;
|
3546
|
-
return _this;
|
3547
|
-
}
|
3548
|
-
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
3549
|
-
var _a;
|
3550
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
3551
|
-
};
|
3552
|
-
return CountEqualsCheckedValidatorArray;
|
3553
|
-
}(ValidatorArray));
|
3554
|
-
|
3555
|
-
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3556
|
-
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
3557
|
-
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3558
|
-
if (autoValid === void 0) { autoValid = true; }
|
3559
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3560
|
-
_this.count = count;
|
3561
|
-
return _this;
|
3562
|
-
}
|
3563
|
-
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3564
|
-
var _a;
|
3565
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
3566
|
-
};
|
3567
|
-
return CountGreaterThanEqualsCheckedValidatorArray;
|
3568
|
-
}(ValidatorArray));
|
3569
|
-
|
3570
3552
|
var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
3571
3553
|
__extends(CountGreaterThanCheckedValidatorArray, _super);
|
3572
3554
|
function CountGreaterThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
@@ -3582,21 +3564,6 @@ var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3582
3564
|
return CountGreaterThanCheckedValidatorArray;
|
3583
3565
|
}(ValidatorArray));
|
3584
3566
|
|
3585
|
-
var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3586
|
-
__extends(CountGreaterThanUnCheckedValidatorArray, _super);
|
3587
|
-
function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3588
|
-
if (autoValid === void 0) { autoValid = true; }
|
3589
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3590
|
-
_this.count = count;
|
3591
|
-
return _this;
|
3592
|
-
}
|
3593
|
-
CountGreaterThanUnCheckedValidatorArray.prototype.valid = function () {
|
3594
|
-
var _a;
|
3595
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > this.count;
|
3596
|
-
};
|
3597
|
-
return CountGreaterThanUnCheckedValidatorArray;
|
3598
|
-
}(ValidatorArray));
|
3599
|
-
|
3600
3567
|
var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3601
3568
|
__extends(CountEqualsUnCheckedValidatorArray, _super);
|
3602
3569
|
function CountEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
@@ -3612,49 +3579,49 @@ var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3612
3579
|
return CountEqualsUnCheckedValidatorArray;
|
3613
3580
|
}(ValidatorArray));
|
3614
3581
|
|
3615
|
-
var
|
3616
|
-
__extends(
|
3617
|
-
function
|
3582
|
+
var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3583
|
+
__extends(CountGreaterThanUnCheckedValidatorArray, _super);
|
3584
|
+
function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3618
3585
|
if (autoValid === void 0) { autoValid = true; }
|
3619
3586
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3620
3587
|
_this.count = count;
|
3621
3588
|
return _this;
|
3622
3589
|
}
|
3623
|
-
|
3590
|
+
CountGreaterThanUnCheckedValidatorArray.prototype.valid = function () {
|
3624
3591
|
var _a;
|
3625
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length
|
3592
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > this.count;
|
3626
3593
|
};
|
3627
|
-
return
|
3594
|
+
return CountGreaterThanUnCheckedValidatorArray;
|
3628
3595
|
}(ValidatorArray));
|
3629
3596
|
|
3630
|
-
var
|
3631
|
-
__extends(
|
3632
|
-
function
|
3597
|
+
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3598
|
+
__extends(CountEqualsCheckedValidatorArray, _super);
|
3599
|
+
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3633
3600
|
if (autoValid === void 0) { autoValid = true; }
|
3634
3601
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3635
3602
|
_this.count = count;
|
3636
3603
|
return _this;
|
3637
3604
|
}
|
3638
|
-
|
3605
|
+
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
3639
3606
|
var _a;
|
3640
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3607
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
3641
3608
|
};
|
3642
|
-
return
|
3609
|
+
return CountEqualsCheckedValidatorArray;
|
3643
3610
|
}(ValidatorArray));
|
3644
3611
|
|
3645
|
-
var
|
3646
|
-
__extends(
|
3647
|
-
function
|
3612
|
+
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3613
|
+
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
3614
|
+
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3648
3615
|
if (autoValid === void 0) { autoValid = true; }
|
3649
3616
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3650
3617
|
_this.count = count;
|
3651
3618
|
return _this;
|
3652
3619
|
}
|
3653
|
-
|
3620
|
+
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3654
3621
|
var _a;
|
3655
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3622
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
3656
3623
|
};
|
3657
|
-
return
|
3624
|
+
return CountGreaterThanEqualsCheckedValidatorArray;
|
3658
3625
|
}(ValidatorArray));
|
3659
3626
|
|
3660
3627
|
var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -3672,70 +3639,63 @@ var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super
|
|
3672
3639
|
return CountLessThanEqualsUnCheckedValidatorArray;
|
3673
3640
|
}(ValidatorArray));
|
3674
3641
|
|
3675
|
-
var
|
3676
|
-
__extends(
|
3677
|
-
function
|
3642
|
+
var EmptyValidator = /** @class */ (function (_super) {
|
3643
|
+
__extends(EmptyValidator, _super);
|
3644
|
+
function EmptyValidator(value, target, event, autoValid) {
|
3645
|
+
if (autoValid === void 0) { autoValid = true; }
|
3646
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3647
|
+
}
|
3648
|
+
EmptyValidator.prototype.valid = function () {
|
3649
|
+
var _a, _b;
|
3650
|
+
var value = this.value;
|
3651
|
+
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
3652
|
+
};
|
3653
|
+
return EmptyValidator;
|
3654
|
+
}(Validator));
|
3655
|
+
|
3656
|
+
var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
|
3657
|
+
__extends(CountLessThanCheckedValidatorArray, _super);
|
3658
|
+
function CountLessThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
3678
3659
|
if (autoValid === void 0) { autoValid = true; }
|
3679
3660
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3680
3661
|
_this.count = count;
|
3681
3662
|
return _this;
|
3682
3663
|
}
|
3683
|
-
|
3664
|
+
CountLessThanCheckedValidatorArray.prototype.valid = function () {
|
3684
3665
|
var _a;
|
3685
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return
|
3666
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length < this.count;
|
3686
3667
|
};
|
3687
|
-
return
|
3668
|
+
return CountLessThanCheckedValidatorArray;
|
3688
3669
|
}(ValidatorArray));
|
3689
3670
|
|
3690
|
-
var
|
3691
|
-
__extends(
|
3692
|
-
function
|
3671
|
+
var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3672
|
+
__extends(CountLessThanEqualsCheckedValidatorArray, _super);
|
3673
|
+
function CountLessThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3693
3674
|
if (autoValid === void 0) { autoValid = true; }
|
3694
3675
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3695
3676
|
_this.count = count;
|
3696
3677
|
return _this;
|
3697
3678
|
}
|
3698
|
-
|
3679
|
+
CountLessThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3699
3680
|
var _a;
|
3700
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return
|
3681
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length <= this.count;
|
3701
3682
|
};
|
3702
|
-
return
|
3683
|
+
return CountLessThanEqualsCheckedValidatorArray;
|
3703
3684
|
}(ValidatorArray));
|
3704
3685
|
|
3705
|
-
var
|
3706
|
-
__extends(
|
3707
|
-
function
|
3708
|
-
if (autoValid === void 0) { autoValid = true; }
|
3709
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3710
|
-
}
|
3711
|
-
EmptyValidator.prototype.valid = function () {
|
3712
|
-
var _a, _b;
|
3713
|
-
var value = this.value;
|
3714
|
-
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
3715
|
-
};
|
3716
|
-
return EmptyValidator;
|
3717
|
-
}(Validator));
|
3718
|
-
|
3719
|
-
var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3720
|
-
__extends(ExcludeCheckedValidatorArray, _super);
|
3721
|
-
function ExcludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
3722
|
-
if (allRequired === void 0) { allRequired = false; }
|
3686
|
+
var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3687
|
+
__extends(CountGreaterThanEqualsUnCheckedValidatorArray, _super);
|
3688
|
+
function CountGreaterThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3723
3689
|
if (autoValid === void 0) { autoValid = true; }
|
3724
3690
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3725
|
-
_this.
|
3726
|
-
_this.allRequired = allRequired;
|
3691
|
+
_this.count = count;
|
3727
3692
|
return _this;
|
3728
3693
|
}
|
3729
|
-
|
3730
|
-
var _this = this;
|
3694
|
+
CountGreaterThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
|
3731
3695
|
var _a;
|
3732
|
-
|
3733
|
-
var unCheckedValue = valus.filter(function (it) { return !it.checked; }).map(function (it) { return it.value; });
|
3734
|
-
return unCheckedValue.length > 0 &&
|
3735
|
-
(!(unCheckedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
3736
|
-
(this.allRequired ? unCheckedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
3696
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
3737
3697
|
};
|
3738
|
-
return
|
3698
|
+
return CountGreaterThanEqualsUnCheckedValidatorArray;
|
3739
3699
|
}(ValidatorArray));
|
3740
3700
|
|
3741
3701
|
var FormValidator = /** @class */ (function (_super) {
|
@@ -3756,9 +3716,9 @@ var FormValidator = /** @class */ (function (_super) {
|
|
3756
3716
|
return FormValidator;
|
3757
3717
|
}(Validator));
|
3758
3718
|
|
3759
|
-
var
|
3760
|
-
__extends(
|
3761
|
-
function
|
3719
|
+
var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3720
|
+
__extends(ExcludeCheckedValidatorArray, _super);
|
3721
|
+
function ExcludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
3762
3722
|
if (allRequired === void 0) { allRequired = false; }
|
3763
3723
|
if (autoValid === void 0) { autoValid = true; }
|
3764
3724
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
@@ -3766,16 +3726,16 @@ var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3766
3726
|
_this.allRequired = allRequired;
|
3767
3727
|
return _this;
|
3768
3728
|
}
|
3769
|
-
|
3729
|
+
ExcludeCheckedValidatorArray.prototype.valid = function () {
|
3770
3730
|
var _this = this;
|
3771
3731
|
var _a;
|
3772
3732
|
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
3773
|
-
var
|
3774
|
-
return
|
3775
|
-
(!(
|
3776
|
-
(this.allRequired ?
|
3733
|
+
var unCheckedValue = valus.filter(function (it) { return !it.checked; }).map(function (it) { return it.value; });
|
3734
|
+
return unCheckedValue.length > 0 &&
|
3735
|
+
(!(unCheckedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
3736
|
+
(this.allRequired ? unCheckedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
3777
3737
|
};
|
3778
|
-
return
|
3738
|
+
return ExcludeCheckedValidatorArray;
|
3779
3739
|
}(ValidatorArray));
|
3780
3740
|
|
3781
3741
|
var MultipleValidator = /** @class */ (function (_super) {
|
@@ -3807,21 +3767,6 @@ var MultipleValidator = /** @class */ (function (_super) {
|
|
3807
3767
|
return MultipleValidator;
|
3808
3768
|
}(Validator));
|
3809
3769
|
|
3810
|
-
var NotEmptyValidator = /** @class */ (function (_super) {
|
3811
|
-
__extends(NotEmptyValidator, _super);
|
3812
|
-
function NotEmptyValidator(value, target, event, autoValid) {
|
3813
|
-
if (autoValid === void 0) { autoValid = true; }
|
3814
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3815
|
-
}
|
3816
|
-
NotEmptyValidator.prototype.valid = function () {
|
3817
|
-
var _a, _b;
|
3818
|
-
var value = this.value;
|
3819
|
-
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
3820
|
-
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
3821
|
-
};
|
3822
|
-
return NotEmptyValidator;
|
3823
|
-
}(Validator));
|
3824
|
-
|
3825
3770
|
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
3826
3771
|
__extends(NotRegExpTestValidator, _super);
|
3827
3772
|
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
@@ -3844,6 +3789,43 @@ var NotRegExpTestValidator = /** @class */ (function (_super) {
|
|
3844
3789
|
return NotRegExpTestValidator;
|
3845
3790
|
}(Validator));
|
3846
3791
|
|
3792
|
+
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3793
|
+
__extends(IncludeCheckedValidatorArray, _super);
|
3794
|
+
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
3795
|
+
if (allRequired === void 0) { allRequired = false; }
|
3796
|
+
if (autoValid === void 0) { autoValid = true; }
|
3797
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3798
|
+
_this.include = include;
|
3799
|
+
_this.allRequired = allRequired;
|
3800
|
+
return _this;
|
3801
|
+
}
|
3802
|
+
IncludeCheckedValidatorArray.prototype.valid = function () {
|
3803
|
+
var _this = this;
|
3804
|
+
var _a;
|
3805
|
+
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
3806
|
+
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
3807
|
+
return checkedValue.length > 0 &&
|
3808
|
+
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
3809
|
+
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
3810
|
+
};
|
3811
|
+
return IncludeCheckedValidatorArray;
|
3812
|
+
}(ValidatorArray));
|
3813
|
+
|
3814
|
+
var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3815
|
+
__extends(CountLessThanUnCheckedValidatorArray, _super);
|
3816
|
+
function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3817
|
+
if (autoValid === void 0) { autoValid = true; }
|
3818
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3819
|
+
_this.count = count;
|
3820
|
+
return _this;
|
3821
|
+
}
|
3822
|
+
CountLessThanUnCheckedValidatorArray.prototype.valid = function () {
|
3823
|
+
var _a;
|
3824
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length < this.count;
|
3825
|
+
};
|
3826
|
+
return CountLessThanUnCheckedValidatorArray;
|
3827
|
+
}(ValidatorArray));
|
3828
|
+
|
3847
3829
|
var PassValidator = /** @class */ (function (_super) {
|
3848
3830
|
__extends(PassValidator, _super);
|
3849
3831
|
function PassValidator(value, target, event, autoValid) {
|
@@ -3856,18 +3838,19 @@ var PassValidator = /** @class */ (function (_super) {
|
|
3856
3838
|
return PassValidator;
|
3857
3839
|
}(Validator));
|
3858
3840
|
|
3859
|
-
var
|
3860
|
-
__extends(
|
3861
|
-
function
|
3841
|
+
var NotEmptyValidator = /** @class */ (function (_super) {
|
3842
|
+
__extends(NotEmptyValidator, _super);
|
3843
|
+
function NotEmptyValidator(value, target, event, autoValid) {
|
3862
3844
|
if (autoValid === void 0) { autoValid = true; }
|
3863
3845
|
return _super.call(this, value, target, event, autoValid) || this;
|
3864
3846
|
}
|
3865
|
-
|
3847
|
+
NotEmptyValidator.prototype.valid = function () {
|
3848
|
+
var _a, _b;
|
3866
3849
|
var value = this.value;
|
3867
|
-
// console.log('
|
3868
|
-
return value !== undefined && value !== null;
|
3850
|
+
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
3851
|
+
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
3869
3852
|
};
|
3870
|
-
return
|
3853
|
+
return NotEmptyValidator;
|
3871
3854
|
}(Validator));
|
3872
3855
|
|
3873
3856
|
var RegExpTestValidator = /** @class */ (function (_super) {
|
@@ -3893,19 +3876,50 @@ var RegExpTestValidator = /** @class */ (function (_super) {
|
|
3893
3876
|
return RegExpTestValidator;
|
3894
3877
|
}(Validator));
|
3895
3878
|
|
3896
|
-
var
|
3897
|
-
__extends(
|
3898
|
-
function
|
3879
|
+
var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3880
|
+
__extends(CountUnCheckedValidatorArray, _super);
|
3881
|
+
function CountUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3882
|
+
if (autoValid === void 0) { autoValid = true; }
|
3883
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3884
|
+
_this.count = count;
|
3885
|
+
return _this;
|
3886
|
+
}
|
3887
|
+
CountUnCheckedValidatorArray.prototype.valid = function () {
|
3888
|
+
var _a;
|
3889
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
3890
|
+
};
|
3891
|
+
return CountUnCheckedValidatorArray;
|
3892
|
+
}(ValidatorArray));
|
3893
|
+
|
3894
|
+
var RequiredValidator = /** @class */ (function (_super) {
|
3895
|
+
__extends(RequiredValidator, _super);
|
3896
|
+
function RequiredValidator(value, target, event, autoValid) {
|
3899
3897
|
if (autoValid === void 0) { autoValid = true; }
|
3900
3898
|
return _super.call(this, value, target, event, autoValid) || this;
|
3901
3899
|
}
|
3902
|
-
|
3903
|
-
var
|
3904
|
-
|
3900
|
+
RequiredValidator.prototype.valid = function () {
|
3901
|
+
var value = this.value;
|
3902
|
+
// console.log('required', value, value !== undefined && value !== null)
|
3903
|
+
return value !== undefined && value !== null;
|
3905
3904
|
};
|
3906
|
-
return
|
3905
|
+
return RequiredValidator;
|
3907
3906
|
}(Validator));
|
3908
3907
|
|
3908
|
+
var ValidMultipleValidator = /** @class */ (function (_super) {
|
3909
|
+
__extends(ValidMultipleValidator, _super);
|
3910
|
+
function ValidMultipleValidator(validMultipleCallback, validators, value, target, event, autoValid) {
|
3911
|
+
if (autoValid === void 0) { autoValid = true; }
|
3912
|
+
var _this = _super.call(this, validators, value, target, event, autoValid) || this;
|
3913
|
+
_this.validMultipleCallback = validMultipleCallback;
|
3914
|
+
_this.validators = validators;
|
3915
|
+
return _this;
|
3916
|
+
}
|
3917
|
+
ValidMultipleValidator.prototype.valid = function () {
|
3918
|
+
return this.validMultipleCallback(this.validators, this.value, this.getTarget(), this.getEvent());
|
3919
|
+
};
|
3920
|
+
return ValidMultipleValidator;
|
3921
|
+
}(MultipleValidator));
|
3922
|
+
|
3909
3923
|
var ValidValidator = /** @class */ (function (_super) {
|
3910
3924
|
__extends(ValidValidator, _super);
|
3911
3925
|
function ValidValidator(validCallBack, value, target, event, autoValid) {
|
@@ -3934,33 +3948,17 @@ var ValidValidatorArray = /** @class */ (function (_super) {
|
|
3934
3948
|
return ValidValidatorArray;
|
3935
3949
|
}(ValidatorArray));
|
3936
3950
|
|
3937
|
-
var
|
3938
|
-
__extends(
|
3939
|
-
function
|
3940
|
-
if (autoValid === void 0) { autoValid = true; }
|
3941
|
-
var _this = _super.call(this, validators, value, target, event, autoValid) || this;
|
3942
|
-
_this.validMultipleCallback = validMultipleCallback;
|
3943
|
-
_this.validators = validators;
|
3944
|
-
return _this;
|
3945
|
-
}
|
3946
|
-
ValidMultipleValidator.prototype.valid = function () {
|
3947
|
-
return this.validMultipleCallback(this.validators, this.value, this.getTarget(), this.getEvent());
|
3948
|
-
};
|
3949
|
-
return ValidMultipleValidator;
|
3950
|
-
}(MultipleValidator));
|
3951
|
-
|
3952
|
-
var ValueEqualsValidator = /** @class */ (function (_super) {
|
3953
|
-
__extends(ValueEqualsValidator, _super);
|
3954
|
-
function ValueEqualsValidator(equalsValue, value, target, event, autoValid) {
|
3951
|
+
var UnCheckedValidator = /** @class */ (function (_super) {
|
3952
|
+
__extends(UnCheckedValidator, _super);
|
3953
|
+
function UnCheckedValidator(value, target, event, autoValid) {
|
3955
3954
|
if (autoValid === void 0) { autoValid = true; }
|
3956
|
-
|
3957
|
-
_this.equalsValue = equalsValue;
|
3958
|
-
return _this;
|
3955
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3959
3956
|
}
|
3960
|
-
|
3961
|
-
|
3957
|
+
UnCheckedValidator.prototype.valid = function () {
|
3958
|
+
var _a, _b;
|
3959
|
+
return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
|
3962
3960
|
};
|
3963
|
-
return
|
3961
|
+
return UnCheckedValidator;
|
3964
3962
|
}(Validator));
|
3965
3963
|
|
3966
3964
|
var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
@@ -3977,27 +3975,19 @@ var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
|
3977
3975
|
return ValueNotEqualsValidator;
|
3978
3976
|
}(Validator));
|
3979
3977
|
|
3980
|
-
var
|
3981
|
-
|
3978
|
+
var ValueEqualsValidator = /** @class */ (function (_super) {
|
3979
|
+
__extends(ValueEqualsValidator, _super);
|
3980
|
+
function ValueEqualsValidator(equalsValue, value, target, event, autoValid) {
|
3981
|
+
if (autoValid === void 0) { autoValid = true; }
|
3982
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3983
|
+
_this.equalsValue = equalsValue;
|
3984
|
+
return _this;
|
3982
3985
|
}
|
3983
|
-
|
3984
|
-
|
3985
|
-
return clipboard.readText();
|
3986
|
-
};
|
3987
|
-
ClipBoardUtils.read = function (clipboard) {
|
3988
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
3989
|
-
return clipboard.read();
|
3990
|
-
};
|
3991
|
-
ClipBoardUtils.writeText = function (data, clipboard) {
|
3992
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
3993
|
-
return clipboard.writeText(data);
|
3994
|
-
};
|
3995
|
-
ClipBoardUtils.write = function (data, clipboard) {
|
3996
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
3997
|
-
return clipboard.write(data);
|
3986
|
+
ValueEqualsValidator.prototype.valid = function () {
|
3987
|
+
return this.value === this.equalsValue;
|
3998
3988
|
};
|
3999
|
-
return
|
4000
|
-
}());
|
3989
|
+
return ValueEqualsValidator;
|
3990
|
+
}(Validator));
|
4001
3991
|
|
4002
3992
|
var NodeUtils = /** @class */ (function () {
|
4003
3993
|
function NodeUtils() {
|
@@ -4023,6 +4013,28 @@ var NodeUtils = /** @class */ (function () {
|
|
4023
4013
|
return NodeUtils;
|
4024
4014
|
}());
|
4025
4015
|
|
4016
|
+
var ClipBoardUtils = /** @class */ (function () {
|
4017
|
+
function ClipBoardUtils() {
|
4018
|
+
}
|
4019
|
+
ClipBoardUtils.readText = function (clipboard) {
|
4020
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4021
|
+
return clipboard.readText();
|
4022
|
+
};
|
4023
|
+
ClipBoardUtils.read = function (clipboard) {
|
4024
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4025
|
+
return clipboard.read();
|
4026
|
+
};
|
4027
|
+
ClipBoardUtils.writeText = function (data, clipboard) {
|
4028
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4029
|
+
return clipboard.writeText(data);
|
4030
|
+
};
|
4031
|
+
ClipBoardUtils.write = function (data, clipboard) {
|
4032
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4033
|
+
return clipboard.write(data);
|
4034
|
+
};
|
4035
|
+
return ClipBoardUtils;
|
4036
|
+
}());
|
4037
|
+
|
4026
4038
|
var StorageUtils = /** @class */ (function () {
|
4027
4039
|
function StorageUtils() {
|
4028
4040
|
}
|