dom-render 1.0.74 → 1.0.77

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. package/Config.d.ts +38 -36
  2. package/Config.js +2 -2
  3. package/DomRender.d.ts +28 -27
  4. package/DomRender.js +90 -88
  5. package/DomRenderProxy.d.ts +29 -29
  6. package/DomRenderProxy.js +342 -327
  7. package/README.MD +638 -567
  8. package/RawSet.d.ts +140 -118
  9. package/RawSet.js +771 -905
  10. package/components/ComponentSet.d.ts +7 -0
  11. package/components/ComponentSet.js +14 -0
  12. package/dist/bundle.js +3789 -3214
  13. package/events/EventManager.d.ts +48 -47
  14. package/events/EventManager.js +530 -499
  15. package/iterators/Range.d.ts +22 -22
  16. package/iterators/Range.js +65 -65
  17. package/lifecycle/OnBeforeReturnGet.d.ts +3 -3
  18. package/lifecycle/OnBeforeReturnGet.js +2 -2
  19. package/lifecycle/OnBeforeReturnSet.d.ts +3 -3
  20. package/lifecycle/OnBeforeReturnSet.js +2 -2
  21. package/lifecycle/OnCreateRender.d.ts +3 -3
  22. package/lifecycle/OnCreateRender.js +2 -2
  23. package/lifecycle/OnDestroyRender.d.ts +4 -4
  24. package/lifecycle/OnDestroyRender.js +2 -2
  25. package/lifecycle/OnInitRender.d.ts +7 -7
  26. package/lifecycle/OnInitRender.js +2 -2
  27. package/lifecycle/OnProxyDomRender.d.ts +4 -0
  28. package/lifecycle/OnProxyDomRender.js +2 -0
  29. package/managers/RenderManager.d.ts +3 -3
  30. package/managers/RenderManager.js +18 -18
  31. package/messenger/DefaultMessenger.d.ts +3 -0
  32. package/messenger/DefaultMessenger.js +27 -0
  33. package/messenger/Messenger.d.ts +78 -0
  34. package/messenger/Messenger.js +201 -0
  35. package/operators/Appender.d.ts +7 -12
  36. package/operators/Appender.js +32 -39
  37. package/operators/AttrExpresion.d.ts +0 -0
  38. package/operators/AttrExpresion.js +44 -0
  39. package/operators/Dr.d.ts +4 -0
  40. package/operators/Dr.js +62 -0
  41. package/operators/DrAppender.d.ts +4 -0
  42. package/operators/DrAppender.js +65 -0
  43. package/operators/DrFor.d.ts +4 -0
  44. package/operators/DrFor.js +62 -0
  45. package/operators/DrForOf.d.ts +4 -0
  46. package/operators/DrForOf.js +65 -0
  47. package/operators/DrForm.d.ts +4 -0
  48. package/operators/DrForm.js +100 -0
  49. package/operators/DrIf.d.ts +4 -0
  50. package/operators/DrIf.js +72 -0
  51. package/operators/DrInnerHTML.d.ts +4 -0
  52. package/operators/DrInnerHTML.js +60 -0
  53. package/operators/DrInnerText.d.ts +4 -0
  54. package/operators/DrInnerText.js +58 -0
  55. package/operators/DrPre.d.ts +4 -0
  56. package/operators/DrPre.js +30 -0
  57. package/operators/DrRepeat.d.ts +4 -0
  58. package/operators/DrRepeat.js +63 -0
  59. package/operators/DrTargetAttr.d.ts +4 -0
  60. package/operators/DrTargetAttr.js +55 -0
  61. package/operators/DrTargetElement.d.ts +4 -0
  62. package/operators/DrTargetElement.js +65 -0
  63. package/operators/DrThis.d.ts +4 -0
  64. package/operators/DrThis.js +59 -0
  65. package/operators/OperatorRender.d.ts +41 -0
  66. package/operators/OperatorRender.js +21 -0
  67. package/package.json +94 -94
  68. package/routers/HashRouter.d.ts +9 -9
  69. package/routers/HashRouter.js +53 -53
  70. package/routers/PathRouter.d.ts +9 -9
  71. package/routers/PathRouter.js +52 -52
  72. package/routers/Router.d.ts +25 -25
  73. package/routers/Router.js +116 -116
  74. package/types/Types.d.ts +14 -14
  75. package/types/Types.js +36 -36
  76. package/utils/clipboard/ClipBoardUtils.d.ts +6 -6
  77. package/utils/clipboard/ClipBoardUtils.js +25 -25
  78. package/utils/dom/DomUtils.d.ts +13 -13
  79. package/utils/dom/DomUtils.js +47 -47
  80. package/utils/location/LocationUtils.d.ts +16 -16
  81. package/utils/location/LocationUtils.js +57 -57
  82. package/utils/node/NodeUtils.d.ts +10 -10
  83. package/utils/node/NodeUtils.js +27 -27
  84. package/utils/random/RandomUtils.d.ts +7 -7
  85. package/utils/random/RandomUtils.js +47 -47
  86. package/utils/script/ScriptUtils.d.ts +14 -14
  87. package/utils/script/ScriptUtils.js +89 -89
  88. package/utils/storage/StorageUtils.d.ts +9 -9
  89. package/utils/storage/StorageUtils.js +48 -48
  90. package/utils/string/StringUtils.d.ts +5 -5
  91. package/utils/string/StringUtils.js +41 -41
  92. package/utils/valid/ValidUtils.d.ts +10 -10
  93. package/utils/valid/ValidUtils.js +78 -78
  94. package/validators/AllCheckedValidatorArray.d.ts +6 -6
  95. package/validators/AllCheckedValidatorArray.js +32 -32
  96. package/validators/AllUnCheckedValidatorArray.d.ts +6 -6
  97. package/validators/AllUnCheckedValidatorArray.js +32 -32
  98. package/validators/CheckedValidator.d.ts +5 -5
  99. package/validators/CheckedValidator.js +32 -32
  100. package/validators/CountEqualsCheckedValidatorArray.d.ts +7 -7
  101. package/validators/CountEqualsCheckedValidatorArray.js +34 -34
  102. package/validators/CountEqualsUnCheckedValidatorArray.d.ts +7 -7
  103. package/validators/CountEqualsUnCheckedValidatorArray.js +34 -34
  104. package/validators/CountGreaterThanCheckedValidatorArray.d.ts +7 -7
  105. package/validators/CountGreaterThanCheckedValidatorArray.js +34 -34
  106. package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +7 -7
  107. package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +34 -34
  108. package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +7 -7
  109. package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +34 -34
  110. package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +7 -7
  111. package/validators/CountGreaterThanUnCheckedValidatorArray.js +34 -34
  112. package/validators/CountLessThanCheckedValidatorArray.d.ts +7 -7
  113. package/validators/CountLessThanCheckedValidatorArray.js +34 -34
  114. package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +7 -7
  115. package/validators/CountLessThanEqualsCheckedValidatorArray.js +34 -34
  116. package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +7 -7
  117. package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +34 -34
  118. package/validators/CountLessThanUnCheckedValidatorArray.d.ts +7 -7
  119. package/validators/CountLessThanUnCheckedValidatorArray.js +34 -34
  120. package/validators/CountUnCheckedValidatorArray.d.ts +7 -7
  121. package/validators/CountUnCheckedValidatorArray.js +34 -34
  122. package/validators/EmptyValidator.d.ts +5 -5
  123. package/validators/EmptyValidator.js +33 -33
  124. package/validators/ExcludeCheckedValidatorArray.d.ts +8 -8
  125. package/validators/ExcludeCheckedValidatorArray.js +41 -41
  126. package/validators/FormValidator.d.ts +7 -7
  127. package/validators/FormValidator.js +37 -37
  128. package/validators/IncludeCheckedValidatorArray.d.ts +8 -8
  129. package/validators/IncludeCheckedValidatorArray.js +41 -41
  130. package/validators/MultipleValidator.d.ts +8 -8
  131. package/validators/MultipleValidator.js +48 -48
  132. package/validators/NonPassValidator.d.ts +5 -5
  133. package/validators/NonPassValidator.js +31 -31
  134. package/validators/NotEmptyValidator.d.ts +5 -5
  135. package/validators/NotEmptyValidator.js +34 -34
  136. package/validators/NotRegExpTestValidator.d.ts +6 -6
  137. package/validators/NotRegExpTestValidator.js +42 -42
  138. package/validators/PassValidator.d.ts +5 -5
  139. package/validators/PassValidator.js +31 -31
  140. package/validators/RegExpTestValidator.d.ts +6 -6
  141. package/validators/RegExpTestValidator.js +43 -43
  142. package/validators/RequiredValidator.d.ts +5 -5
  143. package/validators/RequiredValidator.js +33 -33
  144. package/validators/UnCheckedValidator.d.ts +5 -5
  145. package/validators/UnCheckedValidator.js +32 -32
  146. package/validators/ValidMultipleValidator.d.ts +9 -9
  147. package/validators/ValidMultipleValidator.js +34 -34
  148. package/validators/ValidValidator.d.ts +6 -6
  149. package/validators/ValidValidator.js +33 -33
  150. package/validators/ValidValidatorArray.d.ts +7 -7
  151. package/validators/ValidValidatorArray.js +33 -33
  152. package/validators/Validator.d.ts +57 -57
  153. package/validators/Validator.js +242 -242
  154. package/validators/ValidatorArray.d.ts +17 -17
  155. package/validators/ValidatorArray.js +99 -99
  156. package/validators/ValueEqualsValidator.d.ts +6 -6
  157. package/validators/ValueEqualsValidator.js +33 -33
  158. package/validators/ValueNotEqualsValidator.d.ts +6 -6
  159. package/validators/ValueNotEqualsValidator.js +33 -33
@@ -1,242 +1,242 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Validator = void 0;
4
- // export interface Valid<T = any, E = Element> {
5
- // valid(value?: T, target?: E, event?: Event): boolean;
6
- // }
7
- var Validator = /** @class */ (function () {
8
- function Validator(_value, target, event, autoValid, autoValidAction) {
9
- if (autoValid === void 0) { autoValid = true; }
10
- if (autoValidAction === void 0) { autoValidAction = true; }
11
- this._value = _value;
12
- this.setTarget(target);
13
- this.setEvent(event);
14
- this.setAutoValid(autoValid);
15
- this.setAutoValidAction(autoValidAction);
16
- }
17
- Validator.prototype.getValidAction = function () {
18
- return this._validAction;
19
- };
20
- Validator.prototype.setValidAction = function (value) {
21
- this._validAction = value;
22
- return this;
23
- };
24
- Validator.prototype.getAutoValid = function () {
25
- return this._autoValid;
26
- };
27
- Validator.prototype.setAutoValid = function (autoValid) {
28
- this._autoValid = autoValid;
29
- return this;
30
- };
31
- Validator.prototype.getAutoValidAction = function () {
32
- return this._autoValidAction;
33
- };
34
- Validator.prototype.setAutoValidAction = function (autoValid) {
35
- this._autoValidAction = autoValid;
36
- return this;
37
- };
38
- Validator.prototype.getEvent = function () {
39
- return this._event;
40
- };
41
- Validator.prototype.setEvent = function (event) {
42
- if (event) {
43
- this._event = this.domRenderFinal(event);
44
- }
45
- return this;
46
- };
47
- Validator.prototype.getTarget = function () {
48
- return this._target;
49
- };
50
- Validator.prototype.targetFocus = function () {
51
- var _a, _b;
52
- (_b = (_a = this._target) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
53
- };
54
- Validator.prototype.targetReset = function () {
55
- var _a, _b;
56
- (_b = (_a = this._target) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a);
57
- };
58
- Validator.prototype.targetDispatchEvent = function (event) {
59
- var _a;
60
- return (_a = this._target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
61
- };
62
- Validator.prototype.setTarget = function (target) {
63
- if (target) {
64
- this._target = this.domRenderFinal(target);
65
- }
66
- return this;
67
- };
68
- Validator.prototype.domRenderFinal = function (obj) {
69
- obj._DomRender_isFinal = true;
70
- return obj;
71
- };
72
- Object.defineProperty(Validator.prototype, "value", {
73
- get: function () {
74
- var _a;
75
- if (this._value === undefined || this._value === null) {
76
- this._value = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.value;
77
- }
78
- return this._value;
79
- },
80
- set: function (value) {
81
- // console.log('---?set?', value, this)
82
- this._value = value;
83
- this.tickValue(value);
84
- },
85
- enumerable: false,
86
- configurable: true
87
- });
88
- Validator.prototype.tickValue = function (value) {
89
- this.changeValue(value);
90
- var target = this.getTarget();
91
- if (target && (target === null || target === void 0 ? void 0 : target.value) !== undefined && (target === null || target === void 0 ? void 0 : target.value) !== null) {
92
- try {
93
- target.value = this._value;
94
- }
95
- catch (e) {
96
- console.log('set value function is blocked ');
97
- }
98
- }
99
- if (this.getAutoValidAction()) {
100
- this.validAction();
101
- }
102
- else if (this.getAutoValid()) {
103
- this.valid();
104
- }
105
- };
106
- Validator.prototype.set = function (value, target, event) {
107
- this.setTarget(target);
108
- this.setEvent(event);
109
- this.value = value;
110
- };
111
- Validator.prototype.changeValue = function (value) {
112
- };
113
- Object.defineProperty(Validator.prototype, "checked", {
114
- get: function () {
115
- var _a, _b;
116
- return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
117
- },
118
- set: function (checked) {
119
- var target = this.getTarget();
120
- if (target) {
121
- target.checked = checked;
122
- }
123
- },
124
- enumerable: false,
125
- configurable: true
126
- });
127
- Object.defineProperty(Validator.prototype, "selectedIndex", {
128
- get: function () {
129
- var _a, _b;
130
- return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.selectedIndex) !== null && _b !== void 0 ? _b : -1;
131
- },
132
- set: function (selectedIndex) {
133
- var target = this.getTarget();
134
- if (target) {
135
- target.selectedIndex = selectedIndex;
136
- }
137
- },
138
- enumerable: false,
139
- configurable: true
140
- });
141
- Validator.prototype.querySelector = function (selector) {
142
- var _a;
143
- return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
144
- };
145
- Validator.prototype.querySelectorALL = function (selector) {
146
- var _a;
147
- return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector);
148
- };
149
- Validator.prototype.validAction = function () {
150
- var _a;
151
- var valid = this.valid();
152
- (_a = this.getValidAction()) === null || _a === void 0 ? void 0 : _a(valid, this.value, this.getTarget(), this.getEvent());
153
- return valid;
154
- };
155
- Validator.prototype.inValid = function () {
156
- return !this.valid();
157
- };
158
- ;
159
- Validator.prototype.allValid = function () {
160
- return this.valid() && this.childInValid();
161
- };
162
- Validator.prototype.allValidAction = function () {
163
- return this.validAction() && this.childInValidAction();
164
- };
165
- Validator.prototype.allInValid = function () {
166
- return !this.allValid();
167
- };
168
- Validator.prototype.allInValidAction = function () {
169
- return !this.allValidAction();
170
- };
171
- Validator.prototype.childValid = function () {
172
- return !this.childInValid();
173
- };
174
- Validator.prototype.childValue = function () {
175
- var data = {};
176
- this.childValidators().filter(function (_a) {
177
- var k = _a[0], v = _a[1];
178
- data[k] = v.value;
179
- });
180
- return data;
181
- };
182
- Validator.prototype.childValidAction = function () {
183
- return !this.childInValidAction();
184
- };
185
- Validator.prototype.childInValid = function () {
186
- var inValid = this.childValidators().filter(function (_a) {
187
- var k = _a[0], v = _a[1];
188
- return !v.valid();
189
- });
190
- return inValid.length > 0;
191
- };
192
- Validator.prototype.childInValidValidator = function () {
193
- var inValid = this.childValidators().filter(function (_a) {
194
- var k = _a[0], v = _a[1];
195
- return !v.valid();
196
- });
197
- return inValid;
198
- };
199
- Validator.prototype.childInValidAction = function () {
200
- var inValid = this.childValidators().filter(function (_a) {
201
- var k = _a[0], v = _a[1];
202
- return !v.validAction();
203
- });
204
- return inValid.length > 0;
205
- };
206
- Validator.prototype.childValidator = function (name) {
207
- var _a;
208
- return (_a = Object.entries(this).find(function (_a) {
209
- var k = _a[0], v = _a[1];
210
- return (k === name && (v instanceof Validator));
211
- })) === null || _a === void 0 ? void 0 : _a[1];
212
- };
213
- Validator.prototype.childValidators = function () {
214
- return Object.entries(this).filter(function (_a) {
215
- var k = _a[0], v = _a[1];
216
- return (v instanceof Validator);
217
- });
218
- };
219
- Validator.prototype.childValidValidator = function () {
220
- return this.childValidators().filter(function (it) { return it[1].valid(); });
221
- };
222
- Validator.prototype.syncValue = function () {
223
- var _a;
224
- this.value = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.value;
225
- };
226
- Validator.prototype.allSyncValue = function () {
227
- this.childValidators().forEach(function (_a) {
228
- var k = _a[0], e = _a[1];
229
- e.syncValue();
230
- });
231
- };
232
- Object.defineProperty(Validator.prototype, "length", {
233
- get: function () {
234
- var _a, _b;
235
- return (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
236
- },
237
- enumerable: false,
238
- configurable: true
239
- });
240
- return Validator;
241
- }());
242
- exports.Validator = Validator;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Validator = void 0;
4
+ // export interface Valid<T = any, E = Element> {
5
+ // valid(value?: T, target?: E, event?: Event): boolean;
6
+ // }
7
+ var Validator = /** @class */ (function () {
8
+ function Validator(_value, target, event, autoValid, autoValidAction) {
9
+ if (autoValid === void 0) { autoValid = true; }
10
+ if (autoValidAction === void 0) { autoValidAction = true; }
11
+ this._value = _value;
12
+ this.setTarget(target);
13
+ this.setEvent(event);
14
+ this.setAutoValid(autoValid);
15
+ this.setAutoValidAction(autoValidAction);
16
+ }
17
+ Validator.prototype.getValidAction = function () {
18
+ return this._validAction;
19
+ };
20
+ Validator.prototype.setValidAction = function (value) {
21
+ this._validAction = value;
22
+ return this;
23
+ };
24
+ Validator.prototype.getAutoValid = function () {
25
+ return this._autoValid;
26
+ };
27
+ Validator.prototype.setAutoValid = function (autoValid) {
28
+ this._autoValid = autoValid;
29
+ return this;
30
+ };
31
+ Validator.prototype.getAutoValidAction = function () {
32
+ return this._autoValidAction;
33
+ };
34
+ Validator.prototype.setAutoValidAction = function (autoValid) {
35
+ this._autoValidAction = autoValid;
36
+ return this;
37
+ };
38
+ Validator.prototype.getEvent = function () {
39
+ return this._event;
40
+ };
41
+ Validator.prototype.setEvent = function (event) {
42
+ if (event) {
43
+ this._event = this.domRenderFinal(event);
44
+ }
45
+ return this;
46
+ };
47
+ Validator.prototype.getTarget = function () {
48
+ return this._target;
49
+ };
50
+ Validator.prototype.targetFocus = function () {
51
+ var _a, _b;
52
+ (_b = (_a = this._target) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
53
+ };
54
+ Validator.prototype.targetReset = function () {
55
+ var _a, _b;
56
+ (_b = (_a = this._target) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a);
57
+ };
58
+ Validator.prototype.targetDispatchEvent = function (event) {
59
+ var _a;
60
+ return (_a = this._target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
61
+ };
62
+ Validator.prototype.setTarget = function (target) {
63
+ if (target) {
64
+ this._target = this.domRenderFinal(target);
65
+ }
66
+ return this;
67
+ };
68
+ Validator.prototype.domRenderFinal = function (obj) {
69
+ obj._DomRender_isFinal = true;
70
+ return obj;
71
+ };
72
+ Object.defineProperty(Validator.prototype, "value", {
73
+ get: function () {
74
+ var _a;
75
+ if (this._value === undefined || this._value === null) {
76
+ this._value = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.value;
77
+ }
78
+ return this._value;
79
+ },
80
+ set: function (value) {
81
+ // console.log('---?set?', value, this)
82
+ this._value = value;
83
+ this.tickValue(value);
84
+ },
85
+ enumerable: false,
86
+ configurable: true
87
+ });
88
+ Validator.prototype.tickValue = function (value) {
89
+ this.changeValue(value);
90
+ var target = this.getTarget();
91
+ if (target && (target === null || target === void 0 ? void 0 : target.value) !== undefined && (target === null || target === void 0 ? void 0 : target.value) !== null) {
92
+ try {
93
+ target.value = this._value;
94
+ }
95
+ catch (e) {
96
+ console.log('set value function is blocked ');
97
+ }
98
+ }
99
+ if (this.getAutoValidAction()) {
100
+ this.validAction();
101
+ }
102
+ else if (this.getAutoValid()) {
103
+ this.valid();
104
+ }
105
+ };
106
+ Validator.prototype.set = function (value, target, event) {
107
+ this.setTarget(target);
108
+ this.setEvent(event);
109
+ this.value = value;
110
+ };
111
+ Validator.prototype.changeValue = function (value) {
112
+ };
113
+ Object.defineProperty(Validator.prototype, "checked", {
114
+ get: function () {
115
+ var _a, _b;
116
+ return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
117
+ },
118
+ set: function (checked) {
119
+ var target = this.getTarget();
120
+ if (target) {
121
+ target.checked = checked;
122
+ }
123
+ },
124
+ enumerable: false,
125
+ configurable: true
126
+ });
127
+ Object.defineProperty(Validator.prototype, "selectedIndex", {
128
+ get: function () {
129
+ var _a, _b;
130
+ return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.selectedIndex) !== null && _b !== void 0 ? _b : -1;
131
+ },
132
+ set: function (selectedIndex) {
133
+ var target = this.getTarget();
134
+ if (target) {
135
+ target.selectedIndex = selectedIndex;
136
+ }
137
+ },
138
+ enumerable: false,
139
+ configurable: true
140
+ });
141
+ Validator.prototype.querySelector = function (selector) {
142
+ var _a;
143
+ return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
144
+ };
145
+ Validator.prototype.querySelectorALL = function (selector) {
146
+ var _a;
147
+ return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector);
148
+ };
149
+ Validator.prototype.validAction = function () {
150
+ var _a;
151
+ var valid = this.valid();
152
+ (_a = this.getValidAction()) === null || _a === void 0 ? void 0 : _a(valid, this.value, this.getTarget(), this.getEvent());
153
+ return valid;
154
+ };
155
+ Validator.prototype.inValid = function () {
156
+ return !this.valid();
157
+ };
158
+ ;
159
+ Validator.prototype.allValid = function () {
160
+ return this.valid() && this.childInValid();
161
+ };
162
+ Validator.prototype.allValidAction = function () {
163
+ return this.validAction() && this.childInValidAction();
164
+ };
165
+ Validator.prototype.allInValid = function () {
166
+ return !this.allValid();
167
+ };
168
+ Validator.prototype.allInValidAction = function () {
169
+ return !this.allValidAction();
170
+ };
171
+ Validator.prototype.childValid = function () {
172
+ return !this.childInValid();
173
+ };
174
+ Validator.prototype.childValue = function () {
175
+ var data = {};
176
+ this.childValidators().filter(function (_a) {
177
+ var k = _a[0], v = _a[1];
178
+ data[k] = v.value;
179
+ });
180
+ return data;
181
+ };
182
+ Validator.prototype.childValidAction = function () {
183
+ return !this.childInValidAction();
184
+ };
185
+ Validator.prototype.childInValid = function () {
186
+ var inValid = this.childValidators().filter(function (_a) {
187
+ var k = _a[0], v = _a[1];
188
+ return !v.valid();
189
+ });
190
+ return inValid.length > 0;
191
+ };
192
+ Validator.prototype.childInValidValidator = function () {
193
+ var inValid = this.childValidators().filter(function (_a) {
194
+ var k = _a[0], v = _a[1];
195
+ return !v.valid();
196
+ });
197
+ return inValid;
198
+ };
199
+ Validator.prototype.childInValidAction = function () {
200
+ var inValid = this.childValidators().filter(function (_a) {
201
+ var k = _a[0], v = _a[1];
202
+ return !v.validAction();
203
+ });
204
+ return inValid.length > 0;
205
+ };
206
+ Validator.prototype.childValidator = function (name) {
207
+ var _a;
208
+ return (_a = Object.entries(this).find(function (_a) {
209
+ var k = _a[0], v = _a[1];
210
+ return (k === name && (v instanceof Validator));
211
+ })) === null || _a === void 0 ? void 0 : _a[1];
212
+ };
213
+ Validator.prototype.childValidators = function () {
214
+ return Object.entries(this).filter(function (_a) {
215
+ var k = _a[0], v = _a[1];
216
+ return (v instanceof Validator);
217
+ });
218
+ };
219
+ Validator.prototype.childValidValidator = function () {
220
+ return this.childValidators().filter(function (it) { return it[1].valid(); });
221
+ };
222
+ Validator.prototype.syncValue = function () {
223
+ var _a;
224
+ this.value = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.value;
225
+ };
226
+ Validator.prototype.allSyncValue = function () {
227
+ this.childValidators().forEach(function (_a) {
228
+ var k = _a[0], e = _a[1];
229
+ e.syncValue();
230
+ });
231
+ };
232
+ Object.defineProperty(Validator.prototype, "length", {
233
+ get: function () {
234
+ var _a, _b;
235
+ return (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
236
+ },
237
+ enumerable: false,
238
+ configurable: true
239
+ });
240
+ return Validator;
241
+ }());
242
+ exports.Validator = Validator;
@@ -1,17 +1,17 @@
1
- import { Validator } from './Validator';
2
- export declare type MakeValidator<T = any, E = Element> = (value: T, target: E, event?: Event) => Validator<T, E>;
3
- export declare abstract class ValidatorArray<T = any, E = Element> extends Validator<Validator<T, E>[], E> {
4
- private _makeValidatorFactory;
5
- constructor(value?: Validator<T, E>[], target?: E, event?: Event, autoValid?: boolean);
6
- getMakeValidatorFactory(): MakeValidator<T, E>;
7
- setMakeValidatorFactory(value: MakeValidator<T, E>): this;
8
- setArrayValue(target: E, value: T, event?: Event): void;
9
- addValidator(value: T, target: E, event?: Event): void;
10
- allChecked(checked: boolean): void;
11
- getValidators(): Validator<T, E>[] | undefined;
12
- getValidator(e: E): Validator<T, E> | undefined;
13
- getValidatorByValue(value: T): Validator<T, E>;
14
- getValidatorByValues(value: T): Validator<T, E>[];
15
- removeElement(e: E): void;
16
- makeValidator(value: T, target: E, event?: Event): Validator<T, E>;
17
- }
1
+ import { Validator } from './Validator';
2
+ export declare type MakeValidator<T = any, E = Element> = (value: T, target: E, event?: Event) => Validator<T, E>;
3
+ export declare abstract class ValidatorArray<T = any, E = Element> extends Validator<Validator<T, E>[], E> {
4
+ private _makeValidatorFactory;
5
+ constructor(value?: Validator<T, E>[], target?: E, event?: Event, autoValid?: boolean);
6
+ getMakeValidatorFactory(): MakeValidator<T, E>;
7
+ setMakeValidatorFactory(value: MakeValidator<T, E>): this;
8
+ setArrayValue(target: E, value: T, event?: Event): void;
9
+ addValidator(value: T, target: E, event?: Event): void;
10
+ allChecked(checked: boolean): void;
11
+ getValidators(): Validator<T, E>[] | undefined;
12
+ getValidator(e: E): Validator<T, E> | undefined;
13
+ getValidatorByValue(value: T): Validator<T, E>;
14
+ getValidatorByValues(value: T): Validator<T, E>[];
15
+ removeElement(e: E): void;
16
+ makeValidator(value: T, target: E, event?: Event): Validator<T, E>;
17
+ }