@dooboostore/dom-render 1.0.98
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/DomRender.d.ts +24 -0
- package/DomRender.js +115 -0
- package/DomRenderProxy.d.ts +38 -0
- package/DomRenderProxy.js +586 -0
- package/README.MD +938 -0
- package/components/ComponentBase.d.ts +41 -0
- package/components/ComponentBase.js +210 -0
- package/components/ComponentSet.d.ts +22 -0
- package/components/ComponentSet.js +23 -0
- package/components/appender/Appender.d.ts +23 -0
- package/components/appender/Appender.js +59 -0
- package/components/checkbox/CheckBox.d.ts +47 -0
- package/components/checkbox/CheckBox.js +118 -0
- package/components/choose/Choose.d.ts +39 -0
- package/components/choose/Choose.js +110 -0
- package/components/details/Details.d.ts +57 -0
- package/components/details/Details.js +199 -0
- package/components/dialog/Dialog.d.ts +1 -0
- package/components/dialog/Dialog.js +85 -0
- package/components/dialog/example/ImageEditorDialog.d.ts +1 -0
- package/components/dialog/example/ImageEditorDialog.js +116 -0
- package/components/forOf/ForOf.d.ts +18 -0
- package/components/forOf/ForOf.js +32 -0
- package/components/if/If.d.ts +21 -0
- package/components/if/If.js +40 -0
- package/components/index.d.ts +27 -0
- package/components/index.js +13 -0
- package/components/input/Input.d.ts +34 -0
- package/components/input/Input.js +86 -0
- package/components/promise/PromiseSwitch.d.ts +55 -0
- package/components/promise/PromiseSwitch.js +181 -0
- package/components/radio/Radio.d.ts +45 -0
- package/components/radio/Radio.js +123 -0
- package/components/select/Select.d.ts +23 -0
- package/components/select/Select.js +52 -0
- package/components/this/This.d.ts +24 -0
- package/components/this/This.js +62 -0
- package/components/timer/Timer.d.ts +26 -0
- package/components/timer/Timer.js +102 -0
- package/configs/Config.d.ts +34 -0
- package/configs/Config.js +2 -0
- package/configs/TargetAttr.d.ts +7 -0
- package/configs/TargetAttr.js +2 -0
- package/configs/TargetElement.d.ts +16 -0
- package/configs/TargetElement.js +2 -0
- package/css/parse/index.d.ts +49 -0
- package/css/parse/index.js +498 -0
- package/css/stringify/compiler.d.ts +34 -0
- package/css/stringify/compiler.js +36 -0
- package/css/stringify/compress.d.ts +104 -0
- package/css/stringify/compress.js +147 -0
- package/css/stringify/identity.d.ts +109 -0
- package/css/stringify/identity.js +183 -0
- package/css/stringify/index.d.ts +24 -0
- package/css/stringify/index.js +27 -0
- package/css/stringify/types.d.ts +15 -0
- package/css/stringify/types.js +2 -0
- package/css/types.d.ts +10 -0
- package/css/types.js +2 -0
- package/decorators/DomRenderNoProxy.d.ts +4 -0
- package/decorators/DomRenderNoProxy.js +15 -0
- package/events/EventManager.d.ts +68 -0
- package/events/EventManager.js +477 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/iterators/Range.d.ts +24 -0
- package/iterators/Range.js +70 -0
- package/lifecycle/OnBeforeReturnGet.d.ts +4 -0
- package/lifecycle/OnBeforeReturnGet.js +2 -0
- package/lifecycle/OnBeforeReturnSet.d.ts +5 -0
- package/lifecycle/OnBeforeReturnSet.js +4 -0
- package/lifecycle/OnChangeAttrRender.d.ts +9 -0
- package/lifecycle/OnChangeAttrRender.js +4 -0
- package/lifecycle/OnChildRenderedByProperty.d.ts +5 -0
- package/lifecycle/OnChildRenderedByProperty.js +4 -0
- package/lifecycle/OnCreateRender.d.ts +5 -0
- package/lifecycle/OnCreateRender.js +4 -0
- package/lifecycle/OnCreateRenderData.d.ts +10 -0
- package/lifecycle/OnCreateRenderData.js +4 -0
- package/lifecycle/OnCreateRendered.d.ts +8 -0
- package/lifecycle/OnCreateRendered.js +4 -0
- package/lifecycle/OnCreatedThisChild.d.ts +6 -0
- package/lifecycle/OnCreatedThisChild.js +4 -0
- package/lifecycle/OnDestroyRender.d.ts +9 -0
- package/lifecycle/OnDestroyRender.js +4 -0
- package/lifecycle/OnInitRender.d.ts +6 -0
- package/lifecycle/OnInitRender.js +4 -0
- package/lifecycle/OnProxyDomRender.d.ts +5 -0
- package/lifecycle/OnProxyDomRender.js +2 -0
- package/lifecycle/dr-this/OnDrThisBind.d.ts +5 -0
- package/lifecycle/dr-this/OnDrThisBind.js +4 -0
- package/lifecycle/dr-this/OnDrThisUnBind.d.ts +5 -0
- package/lifecycle/dr-this/OnDrThisUnBind.js +4 -0
- package/managers/RenderManager.d.ts +2 -0
- package/managers/RenderManager.js +12 -0
- package/messenger/DefaultMessenger.d.ts +4 -0
- package/messenger/DefaultMessenger.js +4 -0
- package/messenger/Messenger.d.ts +79 -0
- package/messenger/Messenger.js +185 -0
- package/operators/Appender.d.ts +15 -0
- package/operators/Appender.js +90 -0
- package/operators/Dr.d.ts +9 -0
- package/operators/Dr.js +53 -0
- package/operators/DrAppender.d.ts +9 -0
- package/operators/DrAppender.js +69 -0
- package/operators/DrFor.d.ts +9 -0
- package/operators/DrFor.js +58 -0
- package/operators/DrForOf.d.ts +9 -0
- package/operators/DrForOf.js +120 -0
- package/operators/DrForm.d.ts +9 -0
- package/operators/DrForm.js +79 -0
- package/operators/DrIf.d.ts +9 -0
- package/operators/DrIf.js +70 -0
- package/operators/DrInnerHTML.d.ts +9 -0
- package/operators/DrInnerHTML.js +48 -0
- package/operators/DrInnerText.d.ts +9 -0
- package/operators/DrInnerText.js +46 -0
- package/operators/DrPre.d.ts +8 -0
- package/operators/DrPre.js +22 -0
- package/operators/DrRepeat.d.ts +9 -0
- package/operators/DrRepeat.js +70 -0
- package/operators/DrStripElement.d.ts +9 -0
- package/operators/DrStripElement.js +50 -0
- package/operators/DrTargetAttr.d.ts +8 -0
- package/operators/DrTargetAttr.js +45 -0
- package/operators/DrTargetElement.d.ts +13 -0
- package/operators/DrTargetElement.js +91 -0
- package/operators/DrTargetElementIsElement.d.ts +13 -0
- package/operators/DrTargetElementIsElement.js +79 -0
- package/operators/DrThis.d.ts +7 -0
- package/operators/DrThis.js +72 -0
- package/operators/DrThisProperty.d.ts +11 -0
- package/operators/DrThisProperty.js +93 -0
- package/operators/OperatorExecuter.d.ts +50 -0
- package/operators/OperatorExecuter.js +50 -0
- package/operators/OperatorExecuterAttrRequire.d.ts +9 -0
- package/operators/OperatorExecuterAttrRequire.js +25 -0
- package/package.json +70 -0
- package/rawsets/AttrInitCallBack.d.ts +6 -0
- package/rawsets/AttrInitCallBack.js +2 -0
- package/rawsets/Attrs.d.ts +27 -0
- package/rawsets/Attrs.js +2 -0
- package/rawsets/CreatorMetaData.d.ts +20 -0
- package/rawsets/CreatorMetaData.js +2 -0
- package/rawsets/DestroyOptionType.d.ts +5 -0
- package/rawsets/DestroyOptionType.js +6 -0
- package/rawsets/ElementInitCallBack.d.ts +9 -0
- package/rawsets/ElementInitCallBack.js +2 -0
- package/rawsets/RawSet.d.ts +180 -0
- package/rawsets/RawSet.js +1450 -0
- package/rawsets/RawSetOperatorType.d.ts +4 -0
- package/rawsets/RawSetOperatorType.js +5 -0
- package/rawsets/RawSetType.d.ts +8 -0
- package/rawsets/RawSetType.js +9 -0
- package/rawsets/Render.d.ts +27 -0
- package/rawsets/Render.js +2 -0
- package/routers/HashRouter.d.ts +24 -0
- package/routers/HashRouter.js +86 -0
- package/routers/PathRouter.d.ts +23 -0
- package/routers/PathRouter.js +73 -0
- package/routers/Router.d.ts +68 -0
- package/routers/Router.js +132 -0
- package/types/Types.d.ts +12 -0
- package/types/Types.js +26 -0
- package/validators/AllCheckedValidatorArray.d.ts +7 -0
- package/validators/AllCheckedValidatorArray.js +11 -0
- package/validators/AllUnCheckedValidatorArray.d.ts +7 -0
- package/validators/AllUnCheckedValidatorArray.js +11 -0
- package/validators/CheckedValidator.d.ts +6 -0
- package/validators/CheckedValidator.js +11 -0
- package/validators/CountEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanUnCheckedValidatorArray.js +12 -0
- package/validators/CountUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountUnCheckedValidatorArray.js +12 -0
- package/validators/EmptyValidator.d.ts +6 -0
- package/validators/EmptyValidator.js +12 -0
- package/validators/ExcludeCheckedValidatorArray.d.ts +9 -0
- package/validators/ExcludeCheckedValidatorArray.js +17 -0
- package/validators/FormValidator.d.ts +8 -0
- package/validators/FormValidator.js +16 -0
- package/validators/IncludeCheckedValidatorArray.d.ts +9 -0
- package/validators/IncludeCheckedValidatorArray.js +17 -0
- package/validators/MultipleValidator.d.ts +9 -0
- package/validators/MultipleValidator.js +25 -0
- package/validators/NonPassValidator.d.ts +6 -0
- package/validators/NonPassValidator.js +10 -0
- package/validators/NotEmptyValidator.d.ts +6 -0
- package/validators/NotEmptyValidator.js +13 -0
- package/validators/NotRegExpTestValidator.d.ts +7 -0
- package/validators/NotRegExpTestValidator.js +20 -0
- package/validators/PassValidator.d.ts +6 -0
- package/validators/PassValidator.js +10 -0
- package/validators/RegExpTestValidator.d.ts +7 -0
- package/validators/RegExpTestValidator.js +21 -0
- package/validators/RequiredValidator.d.ts +6 -0
- package/validators/RequiredValidator.js +12 -0
- package/validators/UnCheckedValidator.d.ts +6 -0
- package/validators/UnCheckedValidator.js +11 -0
- package/validators/ValidMultipleValidator.d.ts +10 -0
- package/validators/ValidMultipleValidator.js +12 -0
- package/validators/ValidValidator.d.ts +7 -0
- package/validators/ValidValidator.js +11 -0
- package/validators/ValidValidatorArray.d.ts +8 -0
- package/validators/ValidValidatorArray.js +11 -0
- package/validators/Validator.d.ts +58 -0
- package/validators/Validator.js +203 -0
- package/validators/ValidatorArray.d.ts +18 -0
- package/validators/ValidatorArray.js +77 -0
- package/validators/ValueEqualsValidator.d.ts +7 -0
- package/validators/ValueEqualsValidator.js +11 -0
- package/validators/ValueNotEqualsValidator.d.ts +7 -0
- package/validators/ValueNotEqualsValidator.js +11 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// export interface Valid<T = any, E = Element> {
|
|
2
|
+
// valid(value?: T, target?: E, event?: Event): boolean;
|
|
3
|
+
// }
|
|
4
|
+
export class Validator {
|
|
5
|
+
constructor(_value, target, event, autoValid = true, autoValidAction = true) {
|
|
6
|
+
this._value = _value;
|
|
7
|
+
this.setTarget(target);
|
|
8
|
+
this.setEvent(event);
|
|
9
|
+
this.setAutoValid(autoValid);
|
|
10
|
+
this.setAutoValidAction(autoValidAction);
|
|
11
|
+
}
|
|
12
|
+
getValidAction() {
|
|
13
|
+
return this._validAction;
|
|
14
|
+
}
|
|
15
|
+
setValidAction(value) {
|
|
16
|
+
this._validAction = value;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
getAutoValid() {
|
|
20
|
+
return this._autoValid;
|
|
21
|
+
}
|
|
22
|
+
setAutoValid(autoValid) {
|
|
23
|
+
this._autoValid = autoValid;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
getAutoValidAction() {
|
|
27
|
+
return this._autoValidAction;
|
|
28
|
+
}
|
|
29
|
+
setAutoValidAction(autoValid) {
|
|
30
|
+
this._autoValidAction = autoValid;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
getEvent() {
|
|
34
|
+
return this._event;
|
|
35
|
+
}
|
|
36
|
+
setEvent(event) {
|
|
37
|
+
if (event) {
|
|
38
|
+
this._event = this.domRenderFinal(event);
|
|
39
|
+
}
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
getTarget() {
|
|
43
|
+
return this._target;
|
|
44
|
+
}
|
|
45
|
+
targetFocus() {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
(_b = (_a = this._target) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
48
|
+
}
|
|
49
|
+
targetReset() {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
(_b = (_a = this._target) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52
|
+
}
|
|
53
|
+
targetDispatchEvent(event) {
|
|
54
|
+
var _a;
|
|
55
|
+
return (_a = this._target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
|
|
56
|
+
}
|
|
57
|
+
setTarget(target) {
|
|
58
|
+
if (target) {
|
|
59
|
+
this._target = this.domRenderFinal(target);
|
|
60
|
+
}
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
domRenderFinal(obj) {
|
|
64
|
+
obj._DomRender_isFinal = true;
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
get value() {
|
|
68
|
+
var _a;
|
|
69
|
+
if (this._value === undefined || this._value === null) {
|
|
70
|
+
this._value = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.value;
|
|
71
|
+
}
|
|
72
|
+
return this._value;
|
|
73
|
+
}
|
|
74
|
+
set value(value) {
|
|
75
|
+
// console.log('---?set?', value, this)
|
|
76
|
+
this._value = value;
|
|
77
|
+
this.tickValue(value);
|
|
78
|
+
}
|
|
79
|
+
tickValue(value) {
|
|
80
|
+
this.changeValue(value);
|
|
81
|
+
const target = this.getTarget();
|
|
82
|
+
if (target && (target === null || target === void 0 ? void 0 : target.value) !== undefined && (target === null || target === void 0 ? void 0 : target.value) !== null) {
|
|
83
|
+
try {
|
|
84
|
+
target.value = this._value;
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
console.error('set value function is blocked ');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (this.getAutoValidAction()) {
|
|
91
|
+
this.validAction();
|
|
92
|
+
}
|
|
93
|
+
else if (this.getAutoValid()) {
|
|
94
|
+
this.valid();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
set(value, target, event) {
|
|
98
|
+
this.setTarget(target);
|
|
99
|
+
this.setEvent(event);
|
|
100
|
+
this.value = value;
|
|
101
|
+
}
|
|
102
|
+
changeValue(value) {
|
|
103
|
+
}
|
|
104
|
+
get checked() {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
|
|
107
|
+
}
|
|
108
|
+
set checked(checked) {
|
|
109
|
+
const target = this.getTarget();
|
|
110
|
+
if (target) {
|
|
111
|
+
target.checked = checked;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
get selectedIndex() {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.selectedIndex) !== null && _b !== void 0 ? _b : -1;
|
|
117
|
+
}
|
|
118
|
+
set selectedIndex(selectedIndex) {
|
|
119
|
+
const target = this.getTarget();
|
|
120
|
+
if (target) {
|
|
121
|
+
target.selectedIndex = selectedIndex;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
querySelector(selector) {
|
|
125
|
+
var _a;
|
|
126
|
+
return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
|
|
127
|
+
}
|
|
128
|
+
querySelectorALL(selector) {
|
|
129
|
+
var _a;
|
|
130
|
+
return (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector);
|
|
131
|
+
}
|
|
132
|
+
validAction() {
|
|
133
|
+
var _a;
|
|
134
|
+
const valid = this.valid();
|
|
135
|
+
(_a = this.getValidAction()) === null || _a === void 0 ? void 0 : _a(valid, this.value, this.getTarget(), this.getEvent());
|
|
136
|
+
return valid;
|
|
137
|
+
}
|
|
138
|
+
inValid() {
|
|
139
|
+
return !this.valid();
|
|
140
|
+
}
|
|
141
|
+
;
|
|
142
|
+
allValid() {
|
|
143
|
+
return this.valid() && this.childInValid();
|
|
144
|
+
}
|
|
145
|
+
allValidAction() {
|
|
146
|
+
return this.validAction() && this.childInValidAction();
|
|
147
|
+
}
|
|
148
|
+
allInValid() {
|
|
149
|
+
return !this.allValid();
|
|
150
|
+
}
|
|
151
|
+
allInValidAction() {
|
|
152
|
+
return !this.allValidAction();
|
|
153
|
+
}
|
|
154
|
+
childValid() {
|
|
155
|
+
return !this.childInValid();
|
|
156
|
+
}
|
|
157
|
+
childValue() {
|
|
158
|
+
const data = {};
|
|
159
|
+
this.childValidators().filter(([k, v]) => {
|
|
160
|
+
data[k] = v.value;
|
|
161
|
+
});
|
|
162
|
+
return data;
|
|
163
|
+
}
|
|
164
|
+
childValidAction() {
|
|
165
|
+
return !this.childInValidAction();
|
|
166
|
+
}
|
|
167
|
+
childInValid() {
|
|
168
|
+
const inValid = this.childValidators().filter(([k, v]) => !v.valid());
|
|
169
|
+
return inValid.length > 0;
|
|
170
|
+
}
|
|
171
|
+
childInValidValidator() {
|
|
172
|
+
const inValid = this.childValidators().filter(([k, v]) => !v.valid());
|
|
173
|
+
return inValid;
|
|
174
|
+
}
|
|
175
|
+
childInValidAction() {
|
|
176
|
+
const inValid = this.childValidators().filter(([k, v]) => !v.validAction());
|
|
177
|
+
return inValid.length > 0;
|
|
178
|
+
}
|
|
179
|
+
childValidator(name) {
|
|
180
|
+
var _a;
|
|
181
|
+
return (_a = Object.entries(this).find(([k, v]) => (k === name && (v instanceof Validator)))) === null || _a === void 0 ? void 0 : _a[1];
|
|
182
|
+
}
|
|
183
|
+
childValidators() {
|
|
184
|
+
return Object.entries(this).filter(([k, v]) => (v instanceof Validator));
|
|
185
|
+
}
|
|
186
|
+
childValidValidator() {
|
|
187
|
+
return this.childValidators().filter(it => it[1].valid());
|
|
188
|
+
}
|
|
189
|
+
syncValue() {
|
|
190
|
+
var _a;
|
|
191
|
+
this.value = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.value;
|
|
192
|
+
}
|
|
193
|
+
allSyncValue() {
|
|
194
|
+
this.childValidators().forEach(([k, e]) => {
|
|
195
|
+
e.syncValue();
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
get length() {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
return (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=Validator.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Validator } from './Validator';
|
|
2
|
+
export 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>[];
|
|
12
|
+
getValidator(e: E): Validator<T, E>;
|
|
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
|
+
}
|
|
18
|
+
//# sourceMappingURL=ValidatorArray.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Validator } from './Validator';
|
|
2
|
+
import { NonPassValidator } from './NonPassValidator';
|
|
3
|
+
export class ValidatorArray extends Validator {
|
|
4
|
+
constructor(value, target, event, autoValid = true) {
|
|
5
|
+
super(value, target, event, autoValid);
|
|
6
|
+
this._makeValidatorFactory = (value, target, event) => {
|
|
7
|
+
return new NonPassValidator(value, target, event);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
getMakeValidatorFactory() {
|
|
11
|
+
return this._makeValidatorFactory;
|
|
12
|
+
}
|
|
13
|
+
setMakeValidatorFactory(value) {
|
|
14
|
+
this._makeValidatorFactory = value;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
setArrayValue(target, value, event) {
|
|
18
|
+
var _a;
|
|
19
|
+
(_a = this.value) === null || _a === void 0 ? void 0 : _a.filter(it => {
|
|
20
|
+
if (it.getTarget()) {
|
|
21
|
+
return it.getTarget() === target;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}).forEach(it => {
|
|
27
|
+
it.set(value, target, event);
|
|
28
|
+
});
|
|
29
|
+
this.tickValue(this.value);
|
|
30
|
+
}
|
|
31
|
+
addValidator(value, target, event) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if (!this.value) {
|
|
34
|
+
this.value = [];
|
|
35
|
+
}
|
|
36
|
+
if (value instanceof Validator) {
|
|
37
|
+
(_a = this.value) === null || _a === void 0 ? void 0 : _a.push(value);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
(_b = this.value) === null || _b === void 0 ? void 0 : _b.push(this.makeValidator(value, target, event));
|
|
41
|
+
}
|
|
42
|
+
this.tickValue(this.value);
|
|
43
|
+
}
|
|
44
|
+
allChecked(checked) {
|
|
45
|
+
var _a;
|
|
46
|
+
this.checked = checked;
|
|
47
|
+
(_a = this.value) === null || _a === void 0 ? void 0 : _a.forEach(it => {
|
|
48
|
+
it.checked = checked;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
getValidators() {
|
|
52
|
+
return this._value;
|
|
53
|
+
}
|
|
54
|
+
getValidator(e) {
|
|
55
|
+
var _a;
|
|
56
|
+
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.filter(it => it.getTarget() === e)[0];
|
|
57
|
+
}
|
|
58
|
+
getValidatorByValue(value) {
|
|
59
|
+
const validatorByValue = this.getValidatorByValues(value)[0];
|
|
60
|
+
return validatorByValue;
|
|
61
|
+
}
|
|
62
|
+
getValidatorByValues(value) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
return (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.filter(it => it.value === value)) !== null && _b !== void 0 ? _b : [];
|
|
65
|
+
}
|
|
66
|
+
removeElement(e) {
|
|
67
|
+
const value = this.value;
|
|
68
|
+
if (value) {
|
|
69
|
+
this.value = value.filter(it => it.getTarget() !== e);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
makeValidator(value, target, event) {
|
|
73
|
+
return this._makeValidatorFactory(value, target, event);
|
|
74
|
+
}
|
|
75
|
+
;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ValidatorArray.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Validator } from './Validator';
|
|
2
|
+
export declare class ValueEqualsValidator<T = any, E = Element> extends Validator<T, E> {
|
|
3
|
+
equalsValue: T;
|
|
4
|
+
constructor(equalsValue: T, value?: T, target?: E, event?: Event, autoValid?: boolean);
|
|
5
|
+
valid(): boolean;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ValueEqualsValidator.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Validator } from './Validator';
|
|
2
|
+
export class ValueEqualsValidator extends Validator {
|
|
3
|
+
constructor(equalsValue, value, target, event, autoValid = true) {
|
|
4
|
+
super(value, target, event, autoValid);
|
|
5
|
+
this.equalsValue = equalsValue;
|
|
6
|
+
}
|
|
7
|
+
valid() {
|
|
8
|
+
return this.value === this.equalsValue;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ValueEqualsValidator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Validator } from './Validator';
|
|
2
|
+
export declare class ValueNotEqualsValidator<T = any, E = Element> extends Validator<T, E> {
|
|
3
|
+
equalsValue: T;
|
|
4
|
+
constructor(equalsValue: T, value?: T, target?: E, event?: Event, autoValid?: boolean);
|
|
5
|
+
valid(): boolean;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ValueNotEqualsValidator.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Validator } from './Validator';
|
|
2
|
+
export class ValueNotEqualsValidator extends Validator {
|
|
3
|
+
constructor(equalsValue, value, target, event, autoValid = true) {
|
|
4
|
+
super(value, target, event, autoValid);
|
|
5
|
+
this.equalsValue = equalsValue;
|
|
6
|
+
}
|
|
7
|
+
valid() {
|
|
8
|
+
return this.value !== this.equalsValue;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ValueNotEqualsValidator.js.map
|