dom-render 1.0.90 → 1.0.92
Sign up to get free protection for your applications and to get access to all the features.
- package/DomRender.js +5 -1
- package/DomRenderProxy.d.ts +1 -1
- package/DomRenderProxy.js +121 -63
- package/README.MD +15 -3
- package/components/ComponentSet.d.ts +5 -2
- package/components/ComponentSet.js +2 -3
- package/configs/Config.d.ts +5 -0
- package/configs/TargetElement.d.ts +1 -1
- package/dist/bundle.js +1337 -968
- package/events/EventManager.js +1 -0
- package/operators/Dr.d.ts +7 -3
- package/operators/Dr.js +64 -25
- package/operators/DrAppender.d.ts +7 -3
- package/operators/DrAppender.js +70 -28
- package/operators/DrFor.d.ts +7 -3
- package/operators/DrFor.js +67 -25
- package/operators/DrForOf.d.ts +7 -3
- package/operators/DrForOf.js +70 -28
- package/operators/DrForm.d.ts +7 -3
- package/operators/DrForm.js +93 -55
- package/operators/DrIf.d.ts +7 -3
- package/operators/DrIf.js +71 -35
- package/operators/DrInnerHTML.d.ts +7 -3
- package/operators/DrInnerHTML.js +62 -23
- package/operators/DrInnerText.d.ts +7 -3
- package/operators/DrInnerText.js +60 -21
- package/operators/DrPre.d.ts +6 -3
- package/operators/DrPre.js +49 -6
- package/operators/DrRepeat.d.ts +7 -3
- package/operators/DrRepeat.js +67 -25
- package/operators/DrTargetAttr.d.ts +6 -3
- package/operators/DrTargetAttr.js +72 -29
- package/operators/DrTargetElement.d.ts +6 -3
- package/operators/DrTargetElement.js +86 -64
- package/operators/DrThis.d.ts +4 -3
- package/operators/DrThis.js +77 -33
- package/operators/OperatorExecuter.d.ts +49 -0
- package/operators/OperatorExecuter.js +89 -0
- package/operators/OperatorExecuterAttrRequire.d.ts +8 -0
- package/operators/OperatorExecuterAttrRequire.js +79 -0
- package/package.json +1 -1
- package/rawsets/RawSet.d.ts +4 -4
- package/rawsets/RawSet.js +460 -317
- package/routers/HashRouter.js +1 -1
- package/routers/PathRouter.js +1 -1
- package/routers/Router.d.ts +3 -0
- package/routers/Router.js +10 -0
- package/operators/OperatorRender.d.ts +0 -45
- package/operators/OperatorRender.js +0 -21
package/dist/bundle.js
CHANGED
@@ -53,6 +53,145 @@ var __assign = function () {
|
|
53
53
|
|
54
54
|
return __assign.apply(this, arguments);
|
55
55
|
};
|
56
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
57
|
+
function adopt(value) {
|
58
|
+
return value instanceof P ? value : new P(function (resolve) {
|
59
|
+
resolve(value);
|
60
|
+
});
|
61
|
+
}
|
62
|
+
|
63
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
64
|
+
function fulfilled(value) {
|
65
|
+
try {
|
66
|
+
step(generator.next(value));
|
67
|
+
} catch (e) {
|
68
|
+
reject(e);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
function rejected(value) {
|
73
|
+
try {
|
74
|
+
step(generator["throw"](value));
|
75
|
+
} catch (e) {
|
76
|
+
reject(e);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
function step(result) {
|
81
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
82
|
+
}
|
83
|
+
|
84
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
85
|
+
});
|
86
|
+
}
|
87
|
+
function __generator(thisArg, body) {
|
88
|
+
var _ = {
|
89
|
+
label: 0,
|
90
|
+
sent: function () {
|
91
|
+
if (t[0] & 1) throw t[1];
|
92
|
+
return t[1];
|
93
|
+
},
|
94
|
+
trys: [],
|
95
|
+
ops: []
|
96
|
+
},
|
97
|
+
f,
|
98
|
+
y,
|
99
|
+
t,
|
100
|
+
g;
|
101
|
+
return g = {
|
102
|
+
next: verb(0),
|
103
|
+
"throw": verb(1),
|
104
|
+
"return": verb(2)
|
105
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
106
|
+
return this;
|
107
|
+
}), g;
|
108
|
+
|
109
|
+
function verb(n) {
|
110
|
+
return function (v) {
|
111
|
+
return step([n, v]);
|
112
|
+
};
|
113
|
+
}
|
114
|
+
|
115
|
+
function step(op) {
|
116
|
+
if (f) throw new TypeError("Generator is already executing.");
|
117
|
+
|
118
|
+
while (_) try {
|
119
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
120
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
121
|
+
|
122
|
+
switch (op[0]) {
|
123
|
+
case 0:
|
124
|
+
case 1:
|
125
|
+
t = op;
|
126
|
+
break;
|
127
|
+
|
128
|
+
case 4:
|
129
|
+
_.label++;
|
130
|
+
return {
|
131
|
+
value: op[1],
|
132
|
+
done: false
|
133
|
+
};
|
134
|
+
|
135
|
+
case 5:
|
136
|
+
_.label++;
|
137
|
+
y = op[1];
|
138
|
+
op = [0];
|
139
|
+
continue;
|
140
|
+
|
141
|
+
case 7:
|
142
|
+
op = _.ops.pop();
|
143
|
+
|
144
|
+
_.trys.pop();
|
145
|
+
|
146
|
+
continue;
|
147
|
+
|
148
|
+
default:
|
149
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
150
|
+
_ = 0;
|
151
|
+
continue;
|
152
|
+
}
|
153
|
+
|
154
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
155
|
+
_.label = op[1];
|
156
|
+
break;
|
157
|
+
}
|
158
|
+
|
159
|
+
if (op[0] === 6 && _.label < t[1]) {
|
160
|
+
_.label = t[1];
|
161
|
+
t = op;
|
162
|
+
break;
|
163
|
+
}
|
164
|
+
|
165
|
+
if (t && _.label < t[2]) {
|
166
|
+
_.label = t[2];
|
167
|
+
|
168
|
+
_.ops.push(op);
|
169
|
+
|
170
|
+
break;
|
171
|
+
}
|
172
|
+
|
173
|
+
if (t[2]) _.ops.pop();
|
174
|
+
|
175
|
+
_.trys.pop();
|
176
|
+
|
177
|
+
continue;
|
178
|
+
}
|
179
|
+
|
180
|
+
op = body.call(thisArg, _);
|
181
|
+
} catch (e) {
|
182
|
+
op = [6, e];
|
183
|
+
y = 0;
|
184
|
+
} finally {
|
185
|
+
f = t = 0;
|
186
|
+
}
|
187
|
+
|
188
|
+
if (op[0] & 5) throw op[1];
|
189
|
+
return {
|
190
|
+
value: op[0] ? op[1] : void 0,
|
191
|
+
done: true
|
192
|
+
};
|
193
|
+
}
|
194
|
+
}
|
56
195
|
function __spreadArray(to, from, pack) {
|
57
196
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
58
197
|
if (ar || !(i in from)) {
|
@@ -814,6 +953,7 @@ var EventManager = /** @class */ (function () {
|
|
814
953
|
// eslint-disable-next-line no-undef
|
815
954
|
EventManager.prototype.addDrEvents = function (obj, eventName, elements, config) {
|
816
955
|
var _this = this;
|
956
|
+
// console.log('-------?', config?.router)
|
817
957
|
var attr = EventManager.attrPrefix + 'event-' + eventName;
|
818
958
|
this.procAttr(elements, attr, function (it, attribute) {
|
819
959
|
var script = attribute;
|
@@ -979,106 +1119,165 @@ exports.ExecuteState = void 0;
|
|
979
1119
|
ExecuteState[ExecuteState["NO_EXECUTE"] = 1] = "NO_EXECUTE";
|
980
1120
|
ExecuteState[ExecuteState["STOP"] = 2] = "STOP";
|
981
1121
|
})(exports.ExecuteState || (exports.ExecuteState = {}));
|
982
|
-
var
|
983
|
-
function
|
1122
|
+
var OperatorExecuter = /** @class */ (function () {
|
1123
|
+
function OperatorExecuter(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute) {
|
1124
|
+
if (startingExecute === void 0) { startingExecute = true; }
|
984
1125
|
this.rawSet = rawSet;
|
985
1126
|
this.render = render;
|
986
1127
|
this.returnContainer = returnContainer;
|
987
1128
|
this.elementSource = elementSource;
|
988
1129
|
this.source = source;
|
989
1130
|
this.afterCallBack = afterCallBack;
|
1131
|
+
this.startingExecute = startingExecute;
|
990
1132
|
}
|
991
|
-
|
1133
|
+
OperatorExecuter.prototype.start = function () {
|
1134
|
+
var _a, _b, _c, _d, _e, _f;
|
1135
|
+
return __awaiter(this, void 0, void 0, function () {
|
1136
|
+
var attrValue, r, state;
|
1137
|
+
return __generator(this, function (_g) {
|
1138
|
+
switch (_g.label) {
|
1139
|
+
case 0:
|
1140
|
+
attrValue = this.elementSource.attr;
|
1141
|
+
if ((_a = this.source.operatorAround) === null || _a === void 0 ? void 0 : _a.beforeAttr) {
|
1142
|
+
attrValue = (_b = this.source.operatorAround.beforeAttr(attrValue, this)) !== null && _b !== void 0 ? _b : '';
|
1143
|
+
}
|
1144
|
+
r = attrValue;
|
1145
|
+
if (r && this.startingExecute) {
|
1146
|
+
r = ScriptUtils.eval(" ".concat(this.render.bindScript, "; return ").concat(attrValue), Object.assign(this.source.obj, { __render: this.render }));
|
1147
|
+
}
|
1148
|
+
if ((_c = this.source.operatorAround) === null || _c === void 0 ? void 0 : _c.before) {
|
1149
|
+
r = (_d = this.source.operatorAround) === null || _d === void 0 ? void 0 : _d.before(r, this);
|
1150
|
+
}
|
1151
|
+
return [4 /*yield*/, this.execute(r)];
|
1152
|
+
case 1:
|
1153
|
+
state = _g.sent();
|
1154
|
+
(_f = (_e = this.source.operatorAround) === null || _e === void 0 ? void 0 : _e.after) === null || _f === void 0 ? void 0 : _f.call(_e, r, this);
|
1155
|
+
return [2 /*return*/, state];
|
1156
|
+
}
|
1157
|
+
});
|
1158
|
+
});
|
1159
|
+
};
|
1160
|
+
return OperatorExecuter;
|
992
1161
|
}());
|
993
1162
|
|
994
1163
|
var DrPre = /** @class */ (function (_super) {
|
995
1164
|
__extends(DrPre, _super);
|
996
|
-
function DrPre() {
|
997
|
-
|
1165
|
+
function DrPre(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1166
|
+
var _this = this;
|
1167
|
+
source.operatorAround = undefined;
|
1168
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack) || this;
|
1169
|
+
return _this;
|
998
1170
|
}
|
999
|
-
DrPre.prototype.
|
1000
|
-
return (this
|
1171
|
+
DrPre.prototype.execute = function (value) {
|
1172
|
+
return __awaiter(this, void 0, void 0, function () {
|
1173
|
+
return __generator(this, function (_a) {
|
1174
|
+
return [2 /*return*/, (value != null) ? exports.ExecuteState.EXECUTE : exports.ExecuteState.NO_EXECUTE];
|
1175
|
+
});
|
1176
|
+
});
|
1001
1177
|
};
|
1002
1178
|
return DrPre;
|
1003
|
-
}(
|
1179
|
+
}(OperatorExecuter));
|
1180
|
+
|
1181
|
+
var OperatorExecuterAttrRequire = /** @class */ (function (_super) {
|
1182
|
+
__extends(OperatorExecuterAttrRequire, _super);
|
1183
|
+
function OperatorExecuterAttrRequire(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute) {
|
1184
|
+
if (startingExecute === void 0) { startingExecute = true; }
|
1185
|
+
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute) || this;
|
1186
|
+
}
|
1187
|
+
OperatorExecuterAttrRequire.prototype.execute = function (data) {
|
1188
|
+
return __awaiter(this, void 0, void 0, function () {
|
1189
|
+
return __generator(this, function (_a) {
|
1190
|
+
switch (_a.label) {
|
1191
|
+
case 0:
|
1192
|
+
if (!this.elementSource.attr) {
|
1193
|
+
return [2 /*return*/, exports.ExecuteState.NO_EXECUTE];
|
1194
|
+
}
|
1195
|
+
return [4 /*yield*/, this.executeAttrRequire(data)];
|
1196
|
+
case 1: return [2 /*return*/, _a.sent()];
|
1197
|
+
}
|
1198
|
+
});
|
1199
|
+
});
|
1200
|
+
};
|
1201
|
+
return OperatorExecuterAttrRequire;
|
1202
|
+
}(OperatorExecuter));
|
1004
1203
|
|
1005
1204
|
var Dr = /** @class */ (function (_super) {
|
1006
1205
|
__extends(Dr, _super);
|
1007
|
-
function Dr() {
|
1008
|
-
return _super
|
1206
|
+
function Dr(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1207
|
+
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack) || this;
|
1009
1208
|
}
|
1010
|
-
Dr.prototype.
|
1011
|
-
var _a;
|
1012
|
-
|
1013
|
-
|
1014
|
-
var
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1209
|
+
Dr.prototype.executeAttrRequire = function (data) {
|
1210
|
+
var _a, _b;
|
1211
|
+
return __awaiter(this, void 0, void 0, function () {
|
1212
|
+
var itRandom, vars, newTemp, tempalte, rr;
|
1213
|
+
var _c;
|
1214
|
+
return __generator(this, function (_d) {
|
1215
|
+
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1216
|
+
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1217
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1218
|
+
ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true);\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt)))\n // console.log('----', n.innerHTML);\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n // console.log('----', n.innerHTML);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__render.fag.append(n);\n }"), Object.assign(this.source.obj, {
|
1219
|
+
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1220
|
+
}));
|
1221
|
+
RawSet.drVarDecoding(newTemp, vars);
|
1222
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
1223
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1224
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1225
|
+
this.returnContainer.fag.append(tempalte.content);
|
1226
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1227
|
+
(_b = this.elementSource.element.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1228
|
+
(_c = this.returnContainer.raws).push.apply(_c, rr);
|
1229
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1230
|
+
});
|
1231
|
+
});
|
1031
1232
|
};
|
1032
1233
|
return Dr;
|
1033
|
-
}(
|
1234
|
+
}(OperatorExecuterAttrRequire));
|
1034
1235
|
|
1035
1236
|
var DrIf = /** @class */ (function (_super) {
|
1036
1237
|
__extends(DrIf, _super);
|
1037
|
-
function DrIf() {
|
1038
|
-
|
1238
|
+
function DrIf(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1239
|
+
var _this = this;
|
1240
|
+
source.operatorAround = undefined;
|
1241
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1242
|
+
return _this;
|
1039
1243
|
}
|
1040
|
-
DrIf.prototype.
|
1041
|
-
var _a;
|
1042
|
-
|
1043
|
-
|
1044
|
-
var
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
// }
|
1068
|
-
return exports.ExecuteState.EXECUTE;
|
1069
|
-
}
|
1070
|
-
return exports.ExecuteState.NO_EXECUTE;
|
1244
|
+
DrIf.prototype.executeAttrRequire = function (attr) {
|
1245
|
+
var _a, _b, _c, _d;
|
1246
|
+
return __awaiter(this, void 0, void 0, function () {
|
1247
|
+
var itRandom, vars, newTemp, keepgoing, tempalte, rr;
|
1248
|
+
var _e;
|
1249
|
+
return __generator(this, function (_f) {
|
1250
|
+
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1251
|
+
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1252
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1253
|
+
keepgoing = ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n if ($rawset.data === (").concat(attr, ")) {\n return false;\n }\n $rawset.data = ").concat(attr, ";\n if($rawset.data) {\n const n = $element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drIf' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', ";\n return true;\n "), Object.assign(this.source.obj, {
|
1254
|
+
__render: Object.freeze(__assign({ fag: newTemp, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1255
|
+
}));
|
1256
|
+
// TODO: 뭐지?? 지워야되는거 아닌가?
|
1257
|
+
if (keepgoing === false) {
|
1258
|
+
return [2 /*return*/, exports.ExecuteState.STOP];
|
1259
|
+
}
|
1260
|
+
RawSet.drVarDecoding(newTemp, vars);
|
1261
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
1262
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1263
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1264
|
+
this.returnContainer.fag.append(tempalte.content);
|
1265
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1266
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1267
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
1268
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1269
|
+
});
|
1270
|
+
});
|
1071
1271
|
};
|
1072
1272
|
return DrIf;
|
1073
|
-
}(
|
1273
|
+
}(OperatorExecuterAttrRequire));
|
1074
1274
|
|
1075
1275
|
var ComponentSet = /** @class */ (function () {
|
1076
|
-
function ComponentSet(obj, template, styles,
|
1077
|
-
if (styleLocale === void 0) { styleLocale = false; }
|
1276
|
+
function ComponentSet(obj, template, styles, config) {
|
1078
1277
|
this.obj = obj;
|
1079
1278
|
this.template = template;
|
1080
1279
|
this.styles = styles;
|
1081
|
-
this.
|
1280
|
+
this.config = Object.assign({ objPath: 'obj' }, config);
|
1082
1281
|
}
|
1083
1282
|
return ComponentSet;
|
1084
1283
|
}());
|
@@ -1088,40 +1287,48 @@ var DrThis = /** @class */ (function (_super) {
|
|
1088
1287
|
function DrThis() {
|
1089
1288
|
return _super !== null && _super.apply(this, arguments) || this;
|
1090
1289
|
}
|
1091
|
-
DrThis.prototype.
|
1092
|
-
var _a;
|
1093
|
-
|
1094
|
-
|
1095
|
-
var
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1290
|
+
DrThis.prototype.executeAttrRequire = function (attr) {
|
1291
|
+
var _a, _b, _c, _d, _e;
|
1292
|
+
return __awaiter(this, void 0, void 0, function () {
|
1293
|
+
var destroyOptions, componentBody, _f, _g, rr;
|
1294
|
+
var _h;
|
1295
|
+
return __generator(this, function (_j) {
|
1296
|
+
switch (_j.label) {
|
1297
|
+
case 0:
|
1298
|
+
if (!(attr && this.elementSource.attrs.drThis)) return [3 /*break*/, 5];
|
1299
|
+
if (!(attr instanceof ComponentSet)) return [3 /*break*/, 2];
|
1300
|
+
if (this.rawSet.data) {
|
1301
|
+
destroyOptions = (_b = (_a = this.elementSource.attrs.drDestroyOption) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
1302
|
+
RawSet.destroy(this.rawSet.data.obj, [], this.source.config, destroyOptions);
|
1303
|
+
}
|
1304
|
+
this.rawSet.data = attr;
|
1305
|
+
return [4 /*yield*/, RawSet.drThisCreate(this.rawSet, this.elementSource.element, "".concat(this.elementSource.attrs.drThis).concat(attr.config.objPath ? ('.' + attr.config.objPath) : ''), (_c = this.elementSource.attrs.drVarOption) !== null && _c !== void 0 ? _c : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config, attr)];
|
1306
|
+
case 1:
|
1307
|
+
componentBody = _j.sent();
|
1308
|
+
this.returnContainer.fag.append(componentBody);
|
1309
|
+
this.afterCallBack.onThisComponentSetCallBacks.push(attr);
|
1310
|
+
return [3 /*break*/, 4];
|
1311
|
+
case 2:
|
1312
|
+
_g = (_f = this.returnContainer.fag).append;
|
1313
|
+
return [4 /*yield*/, RawSet.drThisCreate(this.rawSet, this.elementSource.element, this.elementSource.attrs.drThis, (_d = this.elementSource.attrs.drVarOption) !== null && _d !== void 0 ? _d : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config)];
|
1314
|
+
case 3:
|
1315
|
+
_g.apply(_f, [_j.sent()]);
|
1316
|
+
_j.label = 4;
|
1317
|
+
case 4:
|
1318
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1319
|
+
(_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1320
|
+
(_h = this.returnContainer.raws).push.apply(_h, rr);
|
1321
|
+
return [3 /*break*/, 6];
|
1322
|
+
case 5:
|
1323
|
+
this.elementSource.element.remove();
|
1324
|
+
_j.label = 6;
|
1325
|
+
case 6: return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1111
1326
|
}
|
1112
|
-
|
1113
|
-
|
1114
|
-
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
1115
|
-
}
|
1116
|
-
else {
|
1117
|
-
this.elementSource.element.remove();
|
1118
|
-
}
|
1119
|
-
return exports.ExecuteState.EXECUTE;
|
1120
|
-
}
|
1121
|
-
return exports.ExecuteState.NO_EXECUTE;
|
1327
|
+
});
|
1328
|
+
});
|
1122
1329
|
};
|
1123
1330
|
return DrThis;
|
1124
|
-
}(
|
1331
|
+
}(OperatorExecuterAttrRequire));
|
1125
1332
|
|
1126
1333
|
// export interface Valid<T = any, E = Element> {
|
1127
1334
|
// valid(value?: T, target?: E, event?: Event): boolean;
|
@@ -1453,354 +1660,372 @@ var ValidatorArray = /** @class */ (function (_super) {
|
|
1453
1660
|
|
1454
1661
|
var DrForm = /** @class */ (function (_super) {
|
1455
1662
|
__extends(DrForm, _super);
|
1456
|
-
function DrForm() {
|
1457
|
-
return _super
|
1663
|
+
function DrForm(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1664
|
+
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1458
1665
|
}
|
1459
|
-
DrForm.prototype.
|
1666
|
+
DrForm.prototype.executeAttrRequire = function (attr) {
|
1460
1667
|
var _a;
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
childs.
|
1473
|
-
|
1474
|
-
else {
|
1475
|
-
if (data instanceof Validator) {
|
1476
|
-
data.setTarget(this.elementSource.element);
|
1668
|
+
return __awaiter(this, void 0, void 0, function () {
|
1669
|
+
var data, childs, fromName, thisName;
|
1670
|
+
var _b;
|
1671
|
+
var _this = this;
|
1672
|
+
return __generator(this, function (_c) {
|
1673
|
+
RawSet.drFormOtherMoveAttr(this.elementSource.element, 'name', 'temp-name', this.source.config);
|
1674
|
+
data = ScriptUtils.evalReturn("".concat(attr), this.source.obj);
|
1675
|
+
childs = Array.from(this.elementSource.element.querySelectorAll('[name]'));
|
1676
|
+
fromName = ScriptUtils.evalReturn((_a = this.elementSource.element.getAttribute("".concat(RawSet.DR_FORM_NAME, ":name"))) !== null && _a !== void 0 ? _a : '', this.source.obj);
|
1677
|
+
thisName = fromName !== null && fromName !== void 0 ? fromName : this.elementSource.element.getAttribute('name');
|
1678
|
+
// // 자기자신이 Input 대상일때
|
1679
|
+
if (childs.length <= 0 && thisName) {
|
1680
|
+
childs.push(this.elementSource.element);
|
1477
1681
|
}
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
var eventName = (_a = it.getAttribute("".concat(RawSet.DR_FORM_NAME, ":event"))) !== null && _a !== void 0 ? _a : 'change';
|
1482
|
-
var validatorName = it.getAttribute("".concat(RawSet.DR_FORM_NAME, ":validator"));
|
1483
|
-
var attrEventName = EventManager.attrPrefix + 'event-' + eventName;
|
1484
|
-
var varpath = (_c = ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute("".concat(RawSet.DR_FORM_NAME, ":name"))) !== null && _b !== void 0 ? _b : '', _this.source.obj)) !== null && _c !== void 0 ? _c : it.getAttribute('name');
|
1485
|
-
if (varpath != null) {
|
1486
|
-
if (validatorName) {
|
1487
|
-
ScriptUtils.eval("\n ".concat(_this.render.bindScript, "\n const validator = typeof ").concat(validatorName, " ==='function' ? new ").concat(validatorName, "() : ").concat(validatorName, ";\n ").concat(_this.elementSource.attrs.drForm, "['").concat(varpath, "'] = validator;\n "), Object.assign(_this.source.obj, {
|
1488
|
-
__render: Object.freeze(__assign({ drStripOption: _this.elementSource.attrs.drStripOption }, _this.render))
|
1489
|
-
}));
|
1490
|
-
}
|
1491
|
-
varpath = "".concat(_this.elementSource.attrs.drForm, "['").concat(varpath, "']");
|
1492
|
-
var data_1 = ScriptUtils.evalReturn("".concat(varpath), _this.source.obj);
|
1493
|
-
if (data_1 instanceof ValidatorArray) {
|
1494
|
-
it.setAttribute(attrEventName, "".concat(varpath, ".setArrayValue($target, $target.value, $event); ").concat((_d = it.getAttribute(attrEventName)) !== null && _d !== void 0 ? _d : '', ";"));
|
1495
|
-
data_1.addValidator(it.value, it);
|
1496
|
-
}
|
1497
|
-
else if (data_1 instanceof Validator) {
|
1498
|
-
// varpath += (varpath ? '.value' : 'value');
|
1499
|
-
// varpath = drAttr.drForm + '.' + varpath;
|
1500
|
-
// it.setAttribute(attrEventName, `${varpath} = $target.value; ${target}=$target; ${event}=$event;`);
|
1501
|
-
it.setAttribute(attrEventName, "".concat(varpath, ".set($target.value, $target, $event); ").concat((_e = it.getAttribute(attrEventName)) !== null && _e !== void 0 ? _e : '', ";"));
|
1502
|
-
data_1.setTarget(it);
|
1503
|
-
data_1.value = it.value;
|
1504
|
-
}
|
1505
|
-
else {
|
1506
|
-
it.setAttribute(attrEventName, "".concat(varpath, " = $target.value;"));
|
1682
|
+
else {
|
1683
|
+
if (data instanceof Validator) {
|
1684
|
+
data.setTarget(this.elementSource.element);
|
1507
1685
|
}
|
1508
1686
|
}
|
1687
|
+
childs.forEach(function (it) {
|
1688
|
+
var _a, _b, _c, _d, _e;
|
1689
|
+
var eventName = (_a = it.getAttribute("".concat(RawSet.DR_FORM_NAME, ":event"))) !== null && _a !== void 0 ? _a : 'change';
|
1690
|
+
var validatorName = it.getAttribute("".concat(RawSet.DR_FORM_NAME, ":validator"));
|
1691
|
+
var attrEventName = EventManager.attrPrefix + 'event-' + eventName;
|
1692
|
+
var varpath = (_c = ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute("".concat(RawSet.DR_FORM_NAME, ":name"))) !== null && _b !== void 0 ? _b : '', _this.source.obj)) !== null && _c !== void 0 ? _c : it.getAttribute('name');
|
1693
|
+
if (varpath != null) {
|
1694
|
+
if (validatorName) {
|
1695
|
+
ScriptUtils.eval("\n ".concat(_this.render.bindScript, "\n const validator = typeof ").concat(validatorName, " ==='function' ? new ").concat(validatorName, "() : ").concat(validatorName, ";\n ").concat(attr, "['").concat(varpath, "'] = validator;\n "), Object.assign(_this.source.obj, {
|
1696
|
+
__render: Object.freeze(__assign({ drStripOption: _this.elementSource.attrs.drStripOption }, _this.render))
|
1697
|
+
}));
|
1698
|
+
}
|
1699
|
+
varpath = "".concat(attr, "['").concat(varpath, "']");
|
1700
|
+
var data_1 = ScriptUtils.evalReturn("".concat(varpath), _this.source.obj);
|
1701
|
+
if (data_1 instanceof ValidatorArray) {
|
1702
|
+
it.setAttribute(attrEventName, "".concat(varpath, ".setArrayValue($target, $target.value, $event); ").concat((_d = it.getAttribute(attrEventName)) !== null && _d !== void 0 ? _d : '', ";"));
|
1703
|
+
data_1.addValidator(it.value, it);
|
1704
|
+
}
|
1705
|
+
else if (data_1 instanceof Validator) {
|
1706
|
+
// varpath += (varpath ? '.value' : 'value');
|
1707
|
+
// varpath = drAttr.drForm + '.' + varpath;
|
1708
|
+
// it.setAttribute(attrEventName, `${varpath} = $target.value; ${target}=$target; ${event}=$event;`);
|
1709
|
+
it.setAttribute(attrEventName, "".concat(varpath, ".set($target.value, $target, $event); ").concat((_e = it.getAttribute(attrEventName)) !== null && _e !== void 0 ? _e : '', ";"));
|
1710
|
+
data_1.setTarget(it);
|
1711
|
+
data_1.value = it.value;
|
1712
|
+
}
|
1713
|
+
else {
|
1714
|
+
it.setAttribute(attrEventName, "".concat(varpath, " = $target.value;"));
|
1715
|
+
}
|
1716
|
+
}
|
1717
|
+
});
|
1718
|
+
RawSet.drFormOtherMoveAttr(this.elementSource.element, 'temp-name', 'name', this.source.config);
|
1719
|
+
(_b = this.returnContainer.raws).push.apply(_b, RawSet.checkPointCreates(this.elementSource.element, this.source.obj, this.source.config));
|
1720
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1509
1721
|
});
|
1510
|
-
|
1511
|
-
(_a = this.returnContainer.raws).push.apply(_a, RawSet.checkPointCreates(this.elementSource.element, this.source.obj, this.source.config));
|
1512
|
-
return exports.ExecuteState.EXECUTE;
|
1513
|
-
}
|
1514
|
-
return exports.ExecuteState.NO_EXECUTE;
|
1722
|
+
});
|
1515
1723
|
};
|
1516
1724
|
return DrForm;
|
1517
|
-
}(
|
1725
|
+
}(OperatorExecuterAttrRequire));
|
1518
1726
|
|
1519
1727
|
var DrInnerText = /** @class */ (function (_super) {
|
1520
1728
|
__extends(DrInnerText, _super);
|
1521
|
-
function DrInnerText() {
|
1522
|
-
return _super
|
1729
|
+
function DrInnerText(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1730
|
+
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1523
1731
|
}
|
1524
|
-
DrInnerText.prototype.
|
1525
|
-
var _a;
|
1526
|
-
|
1527
|
-
|
1528
|
-
var
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1732
|
+
DrInnerText.prototype.executeAttrRequire = function (attr) {
|
1733
|
+
var _a, _b, _c;
|
1734
|
+
return __awaiter(this, void 0, void 0, function () {
|
1735
|
+
var newTemp, tempalte, rr;
|
1736
|
+
var _d;
|
1737
|
+
return __generator(this, function (_e) {
|
1738
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1739
|
+
ScriptUtils.eval(" \n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true); \n ").concat((_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : '', "\n n.innerText = ").concat(attr, ";\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n ").concat((_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : '', "\n "), Object.assign(this.source.obj, {
|
1740
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, fag: newTemp }, this.render))
|
1741
|
+
}));
|
1742
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1743
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1744
|
+
this.returnContainer.fag.append(tempalte.content);
|
1745
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1746
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1747
|
+
(_d = this.returnContainer.raws).push.apply(_d, rr);
|
1748
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1749
|
+
});
|
1750
|
+
});
|
1541
1751
|
};
|
1542
1752
|
return DrInnerText;
|
1543
|
-
}(
|
1753
|
+
}(OperatorExecuterAttrRequire));
|
1544
1754
|
|
1545
1755
|
var DrInnerHTML = /** @class */ (function (_super) {
|
1546
1756
|
__extends(DrInnerHTML, _super);
|
1547
|
-
function DrInnerHTML() {
|
1548
|
-
return _super
|
1757
|
+
function DrInnerHTML(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1758
|
+
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1549
1759
|
}
|
1550
|
-
DrInnerHTML.prototype.
|
1551
|
-
var _a;
|
1552
|
-
|
1553
|
-
|
1554
|
-
var
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1760
|
+
DrInnerHTML.prototype.executeAttrRequire = function (attr) {
|
1761
|
+
var _a, _b, _c;
|
1762
|
+
return __awaiter(this, void 0, void 0, function () {
|
1763
|
+
var newTemp, tempalte, rr;
|
1764
|
+
var _d;
|
1765
|
+
return __generator(this, function (_e) {
|
1766
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1767
|
+
ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true);\n ").concat((_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : '', "\n n.innerHTML = ").concat(attr, ";\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n ").concat((_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : '', "\n "), Object.assign(this.source.obj, {
|
1768
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, fag: newTemp }, this.render
|
1769
|
+
// eslint-disable-next-line no-use-before-define
|
1770
|
+
))
|
1771
|
+
}));
|
1772
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1773
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1774
|
+
this.returnContainer.fag.append(tempalte.content);
|
1775
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1776
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1777
|
+
(_d = this.returnContainer.raws).push.apply(_d, rr);
|
1778
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1779
|
+
});
|
1780
|
+
});
|
1569
1781
|
};
|
1570
1782
|
return DrInnerHTML;
|
1571
|
-
}(
|
1783
|
+
}(OperatorExecuterAttrRequire));
|
1572
1784
|
|
1573
1785
|
var DrFor = /** @class */ (function (_super) {
|
1574
1786
|
__extends(DrFor, _super);
|
1575
|
-
function DrFor() {
|
1576
|
-
|
1787
|
+
function DrFor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1788
|
+
var _this = this;
|
1789
|
+
source.operatorAround = undefined;
|
1790
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1791
|
+
return _this;
|
1577
1792
|
}
|
1578
|
-
DrFor.prototype.
|
1579
|
-
var _a;
|
1580
|
-
|
1581
|
-
|
1582
|
-
var
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1793
|
+
DrFor.prototype.executeAttrRequire = function (attr) {
|
1794
|
+
var _a, _b, _c, _d;
|
1795
|
+
return __awaiter(this, void 0, void 0, function () {
|
1796
|
+
var itRandom, vars, newTemp, tempalte, rr;
|
1797
|
+
var _e;
|
1798
|
+
return __generator(this, function (_f) {
|
1799
|
+
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1800
|
+
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1801
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1802
|
+
ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n for(").concat(attr, ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearForIt\\#/g, destIt).replace(/\\#nearForIndex\\#/g, destIt))) \n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, destIt);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', "\n "), Object.assign(this.source.obj, {
|
1803
|
+
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1804
|
+
}));
|
1805
|
+
RawSet.drVarDecoding(newTemp, vars);
|
1806
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
1807
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1808
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1809
|
+
this.returnContainer.fag.append(tempalte.content);
|
1810
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1811
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1812
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
1813
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1814
|
+
});
|
1815
|
+
});
|
1599
1816
|
};
|
1600
1817
|
return DrFor;
|
1601
|
-
}(
|
1818
|
+
}(OperatorExecuterAttrRequire));
|
1602
1819
|
|
1603
1820
|
var DrForOf = /** @class */ (function (_super) {
|
1604
1821
|
__extends(DrForOf, _super);
|
1605
|
-
function DrForOf() {
|
1606
|
-
|
1822
|
+
function DrForOf(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1823
|
+
var _this = this;
|
1824
|
+
source.operatorAround = undefined;
|
1825
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1826
|
+
return _this;
|
1607
1827
|
}
|
1608
|
-
DrForOf.prototype.
|
1609
|
-
var _a;
|
1610
|
-
|
1611
|
-
|
1612
|
-
var
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1828
|
+
DrForOf.prototype.executeAttrRequire = function (attr) {
|
1829
|
+
var _a, _b, _c, _d;
|
1830
|
+
return __awaiter(this, void 0, void 0, function () {
|
1831
|
+
var itRandom, vars, newTemp, tempalte, rr;
|
1832
|
+
var _e;
|
1833
|
+
return __generator(this, function (_f) {
|
1834
|
+
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1835
|
+
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1836
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1837
|
+
ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n var i = 0; \n const forOf = ").concat(attr, ";\n const forOfStr = `").concat(attr, "`.trim();\n if (forOf) {\n for(const it of forOf) {\n var destIt = it;\n if (/\\[(.*,?)\\],/g.test(forOfStr)) {\n if (typeof it === 'string') {\n destIt = it;\n } else {\n destIt = forOfStr.substring(1, forOfStr.length-1).split(',')[i];\n }\n } else if (forOf.isRange) {\n destIt = it;\n } else {\n destIt = forOfStr + '[' + i +']'\n }\n const n = this.__render.element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drForOf' && k !== 'drNextOption' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearForOfIt\\#/g, destIt).replace(/\\#it\\#/g, destIt).replace(/\\#nearForOfIndex\\#/g, i)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, i);\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }\n \n if('").concat(this.elementSource.attrs.drNextOption, "' !== 'null') {\n const n = this.__render.element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drForOf' && k !== 'drNextOption' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n const [name, idx] = '").concat(this.elementSource.attrs.drNextOption, "'.split(',');\n n.setAttribute('dr-for-of', name + '[' + idx + ']');\n n.setAttribute('dr-next', name + ',' + (Number(idx) + 1));\n this.__render.fag.append(n);\n }\n }\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', "\n "), Object.assign(this.source.obj, {
|
1838
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
1839
|
+
// eslint-disable-next-line no-use-before-define
|
1840
|
+
))
|
1841
|
+
}));
|
1842
|
+
RawSet.drVarDecoding(newTemp, vars);
|
1843
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
1844
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1845
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1846
|
+
this.returnContainer.fag.append(tempalte.content);
|
1847
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1848
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1849
|
+
// const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
|
1850
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
1851
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1852
|
+
});
|
1853
|
+
});
|
1632
1854
|
};
|
1633
1855
|
return DrForOf;
|
1634
|
-
}(
|
1856
|
+
}(OperatorExecuterAttrRequire));
|
1635
1857
|
|
1636
1858
|
var DrAppender = /** @class */ (function (_super) {
|
1637
1859
|
__extends(DrAppender, _super);
|
1638
|
-
function DrAppender() {
|
1639
|
-
|
1860
|
+
function DrAppender(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1861
|
+
var _this = this;
|
1862
|
+
source.operatorAround = undefined;
|
1863
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1864
|
+
return _this;
|
1640
1865
|
}
|
1641
|
-
DrAppender.prototype.
|
1642
|
-
var _a;
|
1643
|
-
|
1644
|
-
|
1645
|
-
var
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1866
|
+
DrAppender.prototype.executeAttrRequire = function (attr) {
|
1867
|
+
var _a, _b, _c, _d;
|
1868
|
+
return __awaiter(this, void 0, void 0, function () {
|
1869
|
+
var itRandom, vars, newTemp, tempalte, rr;
|
1870
|
+
var _e;
|
1871
|
+
return __generator(this, function (_f) {
|
1872
|
+
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1873
|
+
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1874
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1875
|
+
ScriptUtils.eval("\n try{\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n const ifWrap = document.createElement('div');\n ifWrap.setAttribute('dr-strip', 'true');\n ifWrap.setAttribute('dr-if', '").concat(this.elementSource.attrs.drAppender, " && ").concat(this.elementSource.attrs.drAppender, ".length > 0');\n const n = this.__render.element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drAppender' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n n.setAttribute('dr-for-of', '").concat(this.elementSource.attrs.drAppender, "[' + (").concat(this.elementSource.attrs.drAppender, ".length-1) + ']');\n n.setAttribute('dr-next', '").concat(this.elementSource.attrs.drAppender, ",' + ").concat(this.elementSource.attrs.drAppender, ".length);\n ifWrap.append(n);\n this.__render.fag.append(ifWrap);\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', "\n }catch(e){}\n "), Object.assign(this.source.obj, {
|
1876
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
1877
|
+
// eslint-disable-next-line no-use-before-define
|
1878
|
+
))
|
1879
|
+
}));
|
1880
|
+
RawSet.drVarDecoding(newTemp, vars);
|
1881
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
1882
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1883
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1884
|
+
this.returnContainer.fag.append(tempalte.content);
|
1885
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1886
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1887
|
+
// const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
|
1888
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
1889
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1890
|
+
});
|
1891
|
+
});
|
1665
1892
|
};
|
1666
1893
|
return DrAppender;
|
1667
|
-
}(
|
1894
|
+
}(OperatorExecuterAttrRequire));
|
1668
1895
|
|
1669
1896
|
var DrRepeat = /** @class */ (function (_super) {
|
1670
1897
|
__extends(DrRepeat, _super);
|
1671
|
-
function DrRepeat() {
|
1672
|
-
|
1898
|
+
function DrRepeat(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1899
|
+
var _this = this;
|
1900
|
+
source.operatorAround = undefined;
|
1901
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1902
|
+
return _this;
|
1673
1903
|
}
|
1674
|
-
DrRepeat.prototype.
|
1675
|
-
var _a;
|
1676
|
-
|
1677
|
-
|
1678
|
-
var
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1904
|
+
DrRepeat.prototype.executeAttrRequire = function (attr) {
|
1905
|
+
var _a, _b, _c, _d;
|
1906
|
+
return __awaiter(this, void 0, void 0, function () {
|
1907
|
+
var itRandom, vars, newTemp, tempalte, rr;
|
1908
|
+
var _e;
|
1909
|
+
return __generator(this, function (_f) {
|
1910
|
+
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1911
|
+
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1912
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
1913
|
+
ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n var i = 0; \n const repeat = ").concat(attr, ";\n const repeatStr = `").concat(attr, "`;\n let range = repeat;\n if (typeof repeat === 'number') {\n range = ").concat(EventManager.RANGE_VARNAME, "(repeat);\n } \n for(const it of range) {\n var destIt = it;\n if (range.isRange) {\n destIt = it;\n } else {\n destIt = repeatStr + '[' + i +']'\n }\n const n = this.__render.element.cloneNode(true);\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearRangeIt\\#/g, destIt).replace(/\\#nearRangeIndex\\#/g, destIt)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, destIt);\n \n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', "\n "), Object.assign(this.source.obj, {
|
1914
|
+
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1915
|
+
}));
|
1916
|
+
RawSet.drVarDecoding(newTemp, vars);
|
1917
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
1918
|
+
tempalte = this.source.config.window.document.createElement('template');
|
1919
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
1920
|
+
this.returnContainer.fag.append(tempalte.content);
|
1921
|
+
rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1922
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
1923
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
1924
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1925
|
+
});
|
1926
|
+
});
|
1695
1927
|
};
|
1696
1928
|
return DrRepeat;
|
1697
|
-
}(
|
1929
|
+
}(OperatorExecuterAttrRequire));
|
1698
1930
|
|
1699
1931
|
var DrTargetElement = /** @class */ (function (_super) {
|
1700
1932
|
__extends(DrTargetElement, _super);
|
1701
|
-
function DrTargetElement() {
|
1702
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
1703
|
-
}
|
1704
|
-
DrTargetElement.prototype.execRender = function () {
|
1705
|
-
var _a;
|
1933
|
+
function DrTargetElement(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1706
1934
|
var _this = this;
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1935
|
+
source.operatorAround = undefined;
|
1936
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1937
|
+
return _this;
|
1938
|
+
}
|
1939
|
+
DrTargetElement.prototype.execute = function () {
|
1940
|
+
var _a, _b, _c, _d;
|
1941
|
+
return __awaiter(this, void 0, void 0, function () {
|
1942
|
+
var targetElement, documentFragment, detectAction_1, render_1, rr;
|
1943
|
+
var _e;
|
1944
|
+
var _this = this;
|
1945
|
+
return __generator(this, function (_f) {
|
1946
|
+
switch (_f.label) {
|
1947
|
+
case 0:
|
1948
|
+
targetElement = (_b = (_a = this.source.config) === null || _a === void 0 ? void 0 : _a.targetElements) === null || _b === void 0 ? void 0 : _b.find(function (it) { return it.name.toLowerCase() === _this.elementSource.element.tagName.toLowerCase(); });
|
1949
|
+
if (!targetElement) return [3 /*break*/, 2];
|
1950
|
+
return [4 /*yield*/, targetElement.callBack(this.elementSource.element, this.source.obj, this.rawSet, this.elementSource.attrs, this.source.config)];
|
1951
|
+
case 1:
|
1952
|
+
documentFragment = _f.sent();
|
1953
|
+
if (documentFragment) {
|
1954
|
+
detectAction_1 = this.elementSource.element.getAttribute(RawSet.DR_DETECT_NAME);
|
1955
|
+
render_1 = documentFragment.render;
|
1956
|
+
this.rawSet.fragment = documentFragment;
|
1957
|
+
this.rawSet.data = render_1.component;
|
1958
|
+
if (detectAction_1 && render_1) {
|
1959
|
+
this.rawSet.detect = {
|
1960
|
+
action: function () {
|
1961
|
+
var script = "var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; ".concat(detectAction_1, " ");
|
1962
|
+
ScriptUtils.eval(script, Object.assign(_this.source.obj, {
|
1963
|
+
__render: render_1
|
1964
|
+
}));
|
1965
|
+
}
|
1966
|
+
};
|
1967
|
+
}
|
1968
|
+
rr = RawSet.checkPointCreates(documentFragment, this.source.obj, this.source.config);
|
1969
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(documentFragment, this.elementSource.element);
|
1970
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
1971
|
+
this.afterCallBack.onElementInitCallBacks.push({
|
1972
|
+
name: targetElement.name.toLowerCase(),
|
1973
|
+
obj: this.source.obj,
|
1974
|
+
targetElement: targetElement,
|
1975
|
+
creatorMetaData: targetElement.__creatorMetaData
|
1976
|
+
});
|
1977
|
+
(_d = targetElement === null || targetElement === void 0 ? void 0 : targetElement.complete) === null || _d === void 0 ? void 0 : _d.call(targetElement, this.elementSource.element, this.source.obj, this.rawSet);
|
1747
1978
|
}
|
1748
|
-
|
1979
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1980
|
+
case 2: return [2 /*return*/, exports.ExecuteState.NO_EXECUTE];
|
1749
1981
|
}
|
1750
|
-
|
1751
|
-
|
1752
|
-
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(documentFragment, this.elementSource.element);
|
1753
|
-
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
1754
|
-
this.afterCallBack.onElementInitCallBacks.push({
|
1755
|
-
name: targetElement.name.toLowerCase(),
|
1756
|
-
obj: this.source.obj,
|
1757
|
-
targetElement: targetElement,
|
1758
|
-
creatorMetaData: targetElement.__creatorMetaData
|
1759
|
-
});
|
1760
|
-
// console.log(document.body.innerHTML);
|
1761
|
-
(_e = targetElement === null || targetElement === void 0 ? void 0 : targetElement.complete) === null || _e === void 0 ? void 0 : _e.call(targetElement, this.elementSource.element, this.source.obj, this.rawSet);
|
1762
|
-
}
|
1763
|
-
return exports.ExecuteState.EXECUTE;
|
1764
|
-
}
|
1765
|
-
return exports.ExecuteState.NO_EXECUTE;
|
1982
|
+
});
|
1983
|
+
});
|
1766
1984
|
};
|
1767
1985
|
return DrTargetElement;
|
1768
|
-
}(
|
1986
|
+
}(OperatorExecuter));
|
1769
1987
|
|
1770
1988
|
var DrTargetAttr = /** @class */ (function (_super) {
|
1771
1989
|
__extends(DrTargetAttr, _super);
|
1772
|
-
function DrTargetAttr() {
|
1773
|
-
|
1990
|
+
function DrTargetAttr(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1991
|
+
var _this = this;
|
1992
|
+
source.operatorAround = undefined;
|
1993
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1994
|
+
return _this;
|
1774
1995
|
}
|
1775
|
-
DrTargetAttr.prototype.
|
1776
|
-
var _a;
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1996
|
+
DrTargetAttr.prototype.execute = function () {
|
1997
|
+
var _a, _b, _c, _d;
|
1998
|
+
return __awaiter(this, void 0, void 0, function () {
|
1999
|
+
var attributeNames, targetAttr, attrName, attrValue, documentFragment, rr;
|
2000
|
+
var _e;
|
2001
|
+
return __generator(this, function (_f) {
|
2002
|
+
attributeNames = this.elementSource.element.getAttributeNames();
|
2003
|
+
targetAttr = (_b = (_a = this.source.config) === null || _a === void 0 ? void 0 : _a.targetAttrs) === null || _b === void 0 ? void 0 : _b.find(function (it) { return attributeNames.includes(it.name); });
|
2004
|
+
if (targetAttr) {
|
2005
|
+
attrName = targetAttr.name;
|
2006
|
+
attrValue = this.rawSet.getAttributeAndDelete(this.elementSource.element, attrName);
|
2007
|
+
if (attrValue && attrName && (!this.elementSource.attrs.drForOf && !this.elementSource.attrs.drFor && !this.elementSource.attrs.drRepeat)) {
|
2008
|
+
documentFragment = targetAttr.callBack(this.elementSource.element, attrValue, this.source.obj, this.rawSet);
|
2009
|
+
if (documentFragment) {
|
2010
|
+
rr = RawSet.checkPointCreates(documentFragment, this.source.obj, this.source.config);
|
2011
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(documentFragment, this.elementSource.element);
|
2012
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
2013
|
+
this.afterCallBack.onAttrInitCallBacks.push({
|
2014
|
+
attrName: attrName,
|
2015
|
+
attrValue: attrValue,
|
2016
|
+
obj: this.source.obj
|
2017
|
+
});
|
2018
|
+
(_d = targetAttr === null || targetAttr === void 0 ? void 0 : targetAttr.complete) === null || _d === void 0 ? void 0 : _d.call(targetAttr, this.elementSource.element, attrValue, this.source.obj, this.rawSet);
|
2019
|
+
}
|
2020
|
+
}
|
2021
|
+
return [2 /*return*/, exports.ExecuteState.EXECUTE];
|
1796
2022
|
}
|
1797
|
-
|
1798
|
-
|
1799
|
-
}
|
1800
|
-
return exports.ExecuteState.NO_EXECUTE;
|
2023
|
+
return [2 /*return*/, exports.ExecuteState.NO_EXECUTE];
|
2024
|
+
});
|
2025
|
+
});
|
1801
2026
|
};
|
1802
2027
|
return DrTargetAttr;
|
1803
|
-
}(
|
2028
|
+
}(OperatorExecuter));
|
1804
2029
|
|
1805
2030
|
exports.DestroyOptionType = void 0;
|
1806
2031
|
(function (DestroyOptionType) {
|
@@ -1882,167 +2107,185 @@ var RawSet = /** @class */ (function () {
|
|
1882
2107
|
};
|
1883
2108
|
// 중요 render 처리 부분
|
1884
2109
|
RawSet.prototype.render = function (obj, config) {
|
1885
|
-
var
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2110
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
2111
|
+
return __awaiter(this, void 0, void 0, function () {
|
2112
|
+
var genNode, raws, onAttrInitCallBacks, onElementInitCallBacks, onThisComponentSetCallBacks, drAttrs, _i, _y, cNode, attribute, __render, fag, textContent, runText, newNode, r, template, r, element, drAttr, operators, _z, operators_1, operator, state, _0, onThisComponentSetCallBacks_1, it_1, _1, onElementInitCallBacks_1, it_2, oninit, param, script, _2, onAttrInitCallBacks_1, it_3;
|
2113
|
+
var _this = this;
|
2114
|
+
return __generator(this, function (_3) {
|
2115
|
+
switch (_3.label) {
|
2116
|
+
case 0:
|
2117
|
+
genNode = config.window.document.importNode(this.fragment, true);
|
2118
|
+
raws = [];
|
2119
|
+
onAttrInitCallBacks = [];
|
2120
|
+
onElementInitCallBacks = [];
|
2121
|
+
onThisComponentSetCallBacks = [];
|
2122
|
+
drAttrs = [];
|
2123
|
+
_i = 0, _y = Array.from(genNode.childNodes.values());
|
2124
|
+
_3.label = 1;
|
2125
|
+
case 1:
|
2126
|
+
if (!(_i < _y.length)) return [3 /*break*/, 7];
|
2127
|
+
cNode = _y[_i];
|
2128
|
+
attribute = {};
|
2129
|
+
if (cNode.nodeType === Node.ELEMENT_NODE) {
|
2130
|
+
attribute = DomUtils.getAttributeToObject(cNode);
|
2131
|
+
}
|
2132
|
+
__render = Object.freeze({
|
2133
|
+
rawset: this,
|
2134
|
+
scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj),
|
2135
|
+
router: config === null || config === void 0 ? void 0 : config.router,
|
2136
|
+
range: Range.range,
|
2137
|
+
element: cNode,
|
2138
|
+
attribute: attribute,
|
2139
|
+
bindScript: "\n const ".concat(EventManager.SCRIPTS_VARNAME, " = this.__render.scripts;\n const ").concat(EventManager.RAWSET_VARNAME, " = this.__render.rawset;\n const ").concat(EventManager.ELEMENT_VARNAME, " = this.__render.element;\n const ").concat(EventManager.ATTRIBUTE_VARNAME, " = this.__render.attribute;\n const ").concat(EventManager.RANGE_VARNAME, " = this.__render.range;\n const ").concat(EventManager.ROUTER_VARNAME, " = this.__render.router;\n ")
|
2140
|
+
// eslint-disable-next-line no-use-before-define
|
2141
|
+
});
|
2142
|
+
fag = config.window.document.createDocumentFragment();
|
2143
|
+
if (!(cNode.nodeType === Node.TEXT_NODE && cNode.textContent)) return [3 /*break*/, 2];
|
2144
|
+
textContent = cNode.textContent;
|
2145
|
+
runText = RawSet.exporesionGrouops(textContent)[0][1];
|
2146
|
+
newNode = void 0;
|
2147
|
+
if (textContent === null || textContent === void 0 ? void 0 : textContent.startsWith('#')) {
|
2148
|
+
r = ScriptUtils.eval("".concat(__render.bindScript, " return ").concat(runText), Object.assign(obj, { __render: __render }));
|
2149
|
+
template = config.window.document.createElement('template');
|
2150
|
+
template.innerHTML = r;
|
2151
|
+
newNode = template.content;
|
2152
|
+
}
|
2153
|
+
else {
|
2154
|
+
r = ScriptUtils.eval("".concat(__render.bindScript, " return ").concat(runText), Object.assign(obj, { __render: __render }));
|
2155
|
+
newNode = config.window.document.createTextNode(r);
|
2156
|
+
}
|
2157
|
+
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, cNode);
|
2158
|
+
// console.log('-------', this.point.start.parentNode.nodeName)
|
2159
|
+
// 중요 style value change 됐을때 다시 처리해야되기떄문에: 마지막에 completed 없는 attr 가지고 판단 하니깐
|
2160
|
+
if (this.type === exports.RawSetType.STYLE_TEXT && this.point.parent) {
|
2161
|
+
this.point.parent.removeAttribute('completed');
|
2162
|
+
}
|
2163
|
+
return [3 /*break*/, 6];
|
2164
|
+
case 2:
|
2165
|
+
if (!(cNode.nodeType === Node.ELEMENT_NODE)) return [3 /*break*/, 6];
|
2166
|
+
element = cNode;
|
2167
|
+
drAttr = {
|
2168
|
+
dr: this.getAttributeAndDelete(element, RawSet.DR_NAME),
|
2169
|
+
drIf: this.getAttributeAndDelete(element, RawSet.DR_IF_NAME),
|
2170
|
+
drFor: this.getAttributeAndDelete(element, RawSet.DR_FOR_NAME),
|
2171
|
+
drForOf: this.getAttributeAndDelete(element, RawSet.DR_FOR_OF_NAME),
|
2172
|
+
drAppender: this.getAttributeAndDelete(element, RawSet.DR_APPENDER_NAME),
|
2173
|
+
drRepeat: this.getAttributeAndDelete(element, RawSet.DR_REPEAT_NAME),
|
2174
|
+
drThis: this.getAttributeAndDelete(element, RawSet.DR_THIS_NAME),
|
2175
|
+
drForm: this.getAttributeAndDelete(element, RawSet.DR_FORM_NAME),
|
2176
|
+
drPre: this.getAttributeAndDelete(element, RawSet.DR_PRE_NAME),
|
2177
|
+
drInnerHTML: this.getAttributeAndDelete(element, RawSet.DR_INNERHTML_NAME),
|
2178
|
+
drInnerText: this.getAttributeAndDelete(element, RawSet.DR_INNERTEXT_NAME),
|
2179
|
+
drItOption: this.getAttributeAndDelete(element, RawSet.DR_IT_OPTIONNAME),
|
2180
|
+
drVarOption: this.getAttributeAndDelete(element, RawSet.DR_VAR_OPTIONNAME),
|
2181
|
+
drNextOption: this.getAttributeAndDelete(element, RawSet.DR_NEXT_OPTIONNAME),
|
2182
|
+
drAfterOption: this.getAttributeAndDelete(element, RawSet.DR_AFTER_OPTIONNAME),
|
2183
|
+
drBeforeOption: this.getAttributeAndDelete(element, RawSet.DR_BEFORE_OPTIONNAME),
|
2184
|
+
drCompleteOption: this.getAttributeAndDelete(element, RawSet.DR_COMPLETE_OPTIONNAME),
|
2185
|
+
drStripOption: this.getAttributeAndDelete(element, RawSet.DR_STRIP_OPTIONNAME),
|
2186
|
+
drDestroyOption: this.getAttributeAndDelete(element, RawSet.DR_DESTROY_OPTIONNAME)
|
2187
|
+
};
|
2188
|
+
drAttrs.push(drAttr);
|
2189
|
+
operators = [
|
2190
|
+
new DrPre(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_PRE_NAME, attr: drAttr.drPre, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_b = config.operatorAround) === null || _b === void 0 ? void 0 : _b.drPre }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2191
|
+
new Dr(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_NAME, attr: drAttr.dr, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_c = config.operatorAround) === null || _c === void 0 ? void 0 : _c.dr }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2192
|
+
new DrIf(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_IF_NAME, attr: drAttr.drIf, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_d = config.operatorAround) === null || _d === void 0 ? void 0 : _d.drIf }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2193
|
+
new DrThis(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_THIS_NAME, attr: drAttr.drThis, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_e = config.operatorAround) === null || _e === void 0 ? void 0 : _e.drThis }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2194
|
+
new DrForm(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_FOR_NAME, attr: drAttr.drForm, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_f = config.operatorAround) === null || _f === void 0 ? void 0 : _f.drForm }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2195
|
+
new DrInnerText(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_INNERTEXT_NAME, attr: drAttr.drInnerText, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_g = config.operatorAround) === null || _g === void 0 ? void 0 : _g.drInnerText }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2196
|
+
new DrInnerHTML(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_INNERHTML_NAME, attr: drAttr.drInnerHTML, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_h = config.operatorAround) === null || _h === void 0 ? void 0 : _h.drInnerHTML }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2197
|
+
new DrFor(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_FOR_NAME, attr: drAttr.drFor, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_j = config.operatorAround) === null || _j === void 0 ? void 0 : _j.drFor }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2198
|
+
new DrForOf(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_FOR_OF_NAME, attr: drAttr.drForOf, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_k = config.operatorAround) === null || _k === void 0 ? void 0 : _k.drForOf }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2199
|
+
new DrAppender(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_APPENDER_NAME, attr: drAttr.drAppender, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_l = config.operatorAround) === null || _l === void 0 ? void 0 : _l.drAppender }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2200
|
+
new DrRepeat(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_REPEAT_NAME, attr: drAttr.drRepeat, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_m = config.operatorAround) === null || _m === void 0 ? void 0 : _m.drRepeat }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2201
|
+
new DrTargetElement(this, __render, { raws: raws, fag: fag }, { element: element, attrs: drAttr }, { config: config, obj: obj }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2202
|
+
new DrTargetAttr(this, __render, { raws: raws, fag: fag }, { element: element, attrs: drAttr }, { config: config, obj: obj }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks })
|
2203
|
+
];
|
2204
|
+
_z = 0, operators_1 = operators;
|
2205
|
+
_3.label = 3;
|
2206
|
+
case 3:
|
2207
|
+
if (!(_z < operators_1.length)) return [3 /*break*/, 6];
|
2208
|
+
operator = operators_1[_z];
|
2209
|
+
return [4 /*yield*/, operator.start()];
|
2210
|
+
case 4:
|
2211
|
+
state = _3.sent();
|
2212
|
+
if (state === exports.ExecuteState.EXECUTE) {
|
2213
|
+
return [3 /*break*/, 6];
|
2214
|
+
}
|
2215
|
+
else if (state === exports.ExecuteState.STOP) {
|
2216
|
+
return [2 /*return*/, raws];
|
2217
|
+
}
|
2218
|
+
_3.label = 5;
|
2219
|
+
case 5:
|
2220
|
+
_z++;
|
2221
|
+
return [3 /*break*/, 3];
|
2222
|
+
case 6:
|
2223
|
+
_i++;
|
2224
|
+
return [3 /*break*/, 1];
|
2225
|
+
case 7:
|
2226
|
+
this.applyEvent(obj, genNode, config);
|
2227
|
+
this.replaceBody(genNode); // 중요 여기서 마지막에 연션된 값을 그려준다.
|
2228
|
+
drAttrs.forEach(function (it) {
|
2229
|
+
if (it.drCompleteOption) {
|
2230
|
+
// genNode.childNodes
|
2231
|
+
var render = Object.freeze({
|
2232
|
+
rawset: _this,
|
2233
|
+
fag: genNode,
|
2234
|
+
scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
|
2235
|
+
});
|
2236
|
+
ScriptUtils.eval("\n const ".concat(EventManager.FAG_VARNAME, " = this.__render.fag;\n const ").concat(EventManager.SCRIPTS_VARNAME, " = this.__render.scripts;\n const ").concat(EventManager.RAWSET_VARNAME, " = this.__render.rawset;\n ").concat(it.drCompleteOption), Object.assign(obj, { __render: render }));
|
2237
|
+
}
|
2238
|
+
});
|
2239
|
+
// 중요 style isolation 나중에 :scope로 대체 가능할듯.
|
2240
|
+
RawSet.generateStyleSheetsLocal();
|
2241
|
+
for (_0 = 0, onThisComponentSetCallBacks_1 = onThisComponentSetCallBacks; _0 < onThisComponentSetCallBacks_1.length; _0++) {
|
2242
|
+
it_1 = onThisComponentSetCallBacks_1[_0];
|
2243
|
+
(_p = (_o = it_1.obj) === null || _o === void 0 ? void 0 : _o.onInitRender) === null || _p === void 0 ? void 0 : _p.call(_o);
|
2244
|
+
}
|
2245
|
+
for (_1 = 0, onElementInitCallBacks_1 = onElementInitCallBacks; _1 < onElementInitCallBacks_1.length; _1++) {
|
2246
|
+
it_2 = onElementInitCallBacks_1[_1];
|
2247
|
+
if (((_r = (_q = it_2.targetElement) === null || _q === void 0 ? void 0 : _q.__render) === null || _r === void 0 ? void 0 : _r.element) && ((_t = (_s = it_2.targetElement) === null || _s === void 0 ? void 0 : _s.__render) === null || _t === void 0 ? void 0 : _t.component)) {
|
2248
|
+
oninit = it_2.targetElement.__render.element.getAttribute(RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME);
|
2249
|
+
param = [];
|
2250
|
+
if (oninit) {
|
2251
|
+
script = "".concat(it_2.targetElement.__render.renderScript, " return ").concat(oninit, " ");
|
2252
|
+
param = ScriptUtils.eval(script, Object.assign(obj, {
|
2253
|
+
__render: it_2.targetElement.__render
|
2254
|
+
}));
|
2255
|
+
if (!Array.isArray(param)) {
|
2256
|
+
param = [param];
|
2257
|
+
}
|
2258
|
+
}
|
2259
|
+
(_v = (_u = it_2.targetElement.__render.component).onInitRender) === null || _v === void 0 ? void 0 : _v.call.apply(_v, __spreadArray([_u], param, false));
|
2260
|
+
}
|
2261
|
+
(_w = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _w === void 0 ? void 0 : _w.call(config, it_2.name, obj, this, it_2.targetElement);
|
2262
|
+
}
|
2263
|
+
// TODO: 이부분도 위에 targetElement 처럼 해야될까?
|
2264
|
+
for (_2 = 0, onAttrInitCallBacks_1 = onAttrInitCallBacks; _2 < onAttrInitCallBacks_1.length; _2++) {
|
2265
|
+
it_3 = onAttrInitCallBacks_1[_2];
|
2266
|
+
(_x = config === null || config === void 0 ? void 0 : config.onAttrInit) === null || _x === void 0 ? void 0 : _x.call(config, it_3.attrName, it_3.attrValue, obj, this);
|
2267
|
+
}
|
2268
|
+
// component destroy
|
2269
|
+
if (obj.__domrender_components) {
|
2270
|
+
Object.entries(obj.__domrender_components).forEach(function (_a) {
|
2271
|
+
var _b, _c;
|
2272
|
+
var key = _a[0], value = _a[1];
|
2273
|
+
var domrenderComponentNew = value.__domrender_component_new;
|
2274
|
+
var rawSet = domrenderComponentNew === null || domrenderComponentNew === void 0 ? void 0 : domrenderComponentNew.rawSet;
|
2275
|
+
var drAttrs = domrenderComponentNew === null || domrenderComponentNew === void 0 ? void 0 : domrenderComponentNew.drAttrs;
|
2276
|
+
if (rawSet && !rawSet.isConnected) {
|
2277
|
+
// const domrenderComponent = obj.__domrender_components[key];
|
2278
|
+
// console.log('component destroy--->', key, rawSet, rawSet.isConnected, domrenderComponent.name, domrenderComponent);
|
2279
|
+
var destroyOptions = (_c = (_b = drAttrs === null || drAttrs === void 0 ? void 0 : drAttrs.drDestroyOption) === null || _b === void 0 ? void 0 : _b.split(',')) !== null && _c !== void 0 ? _c : [];
|
2280
|
+
RawSet.destroy(obj.__domrender_components[key], [domrenderComponentNew], config, destroyOptions);
|
2281
|
+
delete obj.__domrender_components[key];
|
2282
|
+
}
|
2283
|
+
});
|
2284
|
+
}
|
2285
|
+
return [2 /*return*/, raws];
|
2042
2286
|
}
|
2043
2287
|
});
|
2044
|
-
}
|
2045
|
-
return raws;
|
2288
|
+
});
|
2046
2289
|
};
|
2047
2290
|
RawSet.generateStyleSheetsLocal = function () {
|
2048
2291
|
Array.from(window.document.styleSheets).filter(function (it) { return it.ownerNode && it.ownerNode instanceof Element && it.ownerNode.hasAttribute('domstyle') && it.ownerNode.getAttribute('id') && !it.ownerNode.getAttribute('completed'); }).forEach(function (it) {
|
@@ -2406,54 +2649,95 @@ var RawSet = /** @class */ (function () {
|
|
2406
2649
|
});
|
2407
2650
|
};
|
2408
2651
|
RawSet.drThisCreate = function (rawSet, element, drThis, drVarOption, drStripOption, obj, config, set) {
|
2409
|
-
var _a, _b, _c, _d;
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2652
|
+
var _a, _b, _c, _d, _e;
|
2653
|
+
return __awaiter(this, void 0, void 0, function () {
|
2654
|
+
var fag, n, stylePromises, templatePromise, _f, i, it_5, _g, _h, _j, _k, _l, style, onCreate, renderScript, createParam, script, oninit, script, thisRandom, vars;
|
2655
|
+
return __generator(this, function (_m) {
|
2656
|
+
switch (_m.label) {
|
2657
|
+
case 0:
|
2658
|
+
fag = config.window.document.createDocumentFragment();
|
2659
|
+
n = element.cloneNode(true);
|
2660
|
+
if (!set) return [3 /*break*/, 12];
|
2661
|
+
stylePromises = [];
|
2662
|
+
if (!(set.template && set.template.startsWith('lazy://'))) return [3 /*break*/, 2];
|
2663
|
+
return [4 /*yield*/, fetch(set.template.substring(6))];
|
2664
|
+
case 1:
|
2665
|
+
_f = (_m.sent()).text();
|
2666
|
+
return [3 /*break*/, 3];
|
2667
|
+
case 2:
|
2668
|
+
_f = Promise.resolve(set.template);
|
2669
|
+
_m.label = 3;
|
2670
|
+
case 3:
|
2671
|
+
templatePromise = (_f);
|
2672
|
+
i = 0;
|
2673
|
+
_m.label = 4;
|
2674
|
+
case 4:
|
2675
|
+
if (!(set.styles && i < ((_a = set.styles.length) !== null && _a !== void 0 ? _a : 0))) return [3 /*break*/, 9];
|
2676
|
+
it_5 = set.styles[i];
|
2677
|
+
_h = (_g = stylePromises).push;
|
2678
|
+
if (!it_5.startsWith('lazy://')) return [3 /*break*/, 6];
|
2679
|
+
return [4 /*yield*/, fetch(it_5.substring(6))];
|
2680
|
+
case 5:
|
2681
|
+
_j = (_m.sent()).text();
|
2682
|
+
return [3 /*break*/, 7];
|
2683
|
+
case 6:
|
2684
|
+
_j = Promise.resolve(it_5);
|
2685
|
+
_m.label = 7;
|
2686
|
+
case 7:
|
2687
|
+
_h.apply(_g, [_j]);
|
2688
|
+
_m.label = 8;
|
2689
|
+
case 8:
|
2690
|
+
i++;
|
2691
|
+
return [3 /*break*/, 4];
|
2692
|
+
case 9:
|
2693
|
+
_k = set;
|
2694
|
+
return [4 /*yield*/, templatePromise];
|
2695
|
+
case 10:
|
2696
|
+
_k.template = _m.sent();
|
2697
|
+
_l = set;
|
2698
|
+
return [4 /*yield*/, Promise.all(stylePromises)];
|
2699
|
+
case 11:
|
2700
|
+
_l.styles = _m.sent();
|
2701
|
+
style = RawSet.generateStyleTransform((_b = set.styles) !== null && _b !== void 0 ? _b : [], rawSet.uuid, true);
|
2702
|
+
n.innerHTML = style + ((_c = set.template) !== null && _c !== void 0 ? _c : '');
|
2703
|
+
onCreate = element.getAttribute(RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME);
|
2704
|
+
renderScript = '';
|
2705
|
+
createParam = [];
|
2706
|
+
if (onCreate) {
|
2707
|
+
script = "".concat(renderScript, " return ").concat(onCreate, " ");
|
2708
|
+
createParam = ScriptUtils.eval(script, obj);
|
2709
|
+
if (!Array.isArray(createParam)) {
|
2710
|
+
createParam = [createParam];
|
2711
|
+
}
|
2712
|
+
}
|
2713
|
+
(_e = (_d = set.obj) === null || _d === void 0 ? void 0 : _d.onCreateRender) === null || _e === void 0 ? void 0 : _e.call.apply(_e, __spreadArray([_d], createParam, false));
|
2714
|
+
oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME);
|
2715
|
+
if (oninit) {
|
2716
|
+
script = "".concat(renderScript, " ").concat(oninit, " ");
|
2717
|
+
ScriptUtils.eval(script, obj);
|
2718
|
+
}
|
2719
|
+
_m.label = 12;
|
2720
|
+
case 12:
|
2721
|
+
n.querySelectorAll(eventManager.attrNames.map(function (it) { return "[".concat(it, "]"); }).join(',')).forEach(function (it) {
|
2722
|
+
it.setAttribute(EventManager.ownerVariablePathAttrName, 'this');
|
2723
|
+
});
|
2724
|
+
thisRandom = this.drThisEncoding(n, drThis);
|
2725
|
+
vars = this.drVarEncoding(n, drVarOption);
|
2726
|
+
this.drVarDecoding(n, vars);
|
2727
|
+
this.drThisDecoding(n, thisRandom);
|
2728
|
+
if (drStripOption && (drStripOption === true || drStripOption === 'true')) {
|
2729
|
+
// console.log('------childNodes', Array.from(n.childNodes))
|
2730
|
+
Array.from(n.childNodes).forEach(function (it) { return fag.append(it); });
|
2731
|
+
}
|
2732
|
+
else {
|
2733
|
+
fag.append(n);
|
2734
|
+
}
|
2735
|
+
fag.__domrender_this_variable_name = drThis;
|
2736
|
+
// console.log('set __domrender_this_variable_name', (fag as any).__domrender_this_variable_name)
|
2737
|
+
return [2 /*return*/, fag];
|
2429
2738
|
}
|
2430
|
-
}
|
2431
|
-
(_d = (_c = set.obj) === null || _c === void 0 ? void 0 : _c.onCreateRender) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray([_c], createParam, false));
|
2432
|
-
// dr-on-component-init
|
2433
|
-
// const oninit = element.getAttribute(`${EventManager.attrPrefix}on-component-init`); // dr-on-component-init
|
2434
|
-
var oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME); // dr-on-component-init
|
2435
|
-
if (oninit) {
|
2436
|
-
var script = "".concat(renderScript, " ").concat(oninit, " ");
|
2437
|
-
ScriptUtils.eval(script, obj);
|
2438
|
-
}
|
2439
|
-
}
|
2440
|
-
n.querySelectorAll(eventManager.attrNames.map(function (it) { return "[".concat(it, "]"); }).join(',')).forEach(function (it) {
|
2441
|
-
it.setAttribute(EventManager.ownerVariablePathAttrName, 'this');
|
2739
|
+
});
|
2442
2740
|
});
|
2443
|
-
var thisRandom = this.drThisEncoding(n, drThis);
|
2444
|
-
var vars = this.drVarEncoding(n, drVarOption);
|
2445
|
-
this.drVarDecoding(n, vars);
|
2446
|
-
this.drThisDecoding(n, thisRandom);
|
2447
|
-
if (drStripOption && (drStripOption === true || drStripOption === 'true')) {
|
2448
|
-
// console.log('------childNodes', Array.from(n.childNodes))
|
2449
|
-
Array.from(n.childNodes).forEach(function (it) { return fag.append(it); });
|
2450
|
-
}
|
2451
|
-
else {
|
2452
|
-
fag.append(n);
|
2453
|
-
}
|
2454
|
-
fag.__domrender_this_variable_name = drThis;
|
2455
|
-
// console.log('set __domrender_this_variable_name', (fag as any).__domrender_this_variable_name)
|
2456
|
-
return fag;
|
2457
2741
|
};
|
2458
2742
|
RawSet.createComponentTargetAttribute = function (name, getThisObj, factory) {
|
2459
2743
|
var targetAttribute = {
|
@@ -2484,115 +2768,163 @@ var RawSet = /** @class */ (function () {
|
|
2484
2768
|
styles: styles,
|
2485
2769
|
template: template,
|
2486
2770
|
callBack: function (element, obj, rawSet, attrs, config) {
|
2487
|
-
var _a, _b, _c, _d, _e, _f;
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2771
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
2772
|
+
return __awaiter(this, void 0, void 0, function () {
|
2773
|
+
var stylePromises, templatePromise, _h, i_1, it_6, _j, _k, _l, _m, _o, domrenderComponents, componentKey, attribute, renderScript, render, constructor, constructorParam, script, param, instance, i, normalAttrMap, onCreate, createParam, script, applayTemplate, innerHTMLThisRandom, componentName, innerHTMLName, oninit, script, style, data, template_1;
|
2774
|
+
return __generator(this, function (_p) {
|
2775
|
+
switch (_p.label) {
|
2776
|
+
case 0:
|
2777
|
+
stylePromises = [];
|
2778
|
+
if (!(this.template && this.template.startsWith('lazy://'))) return [3 /*break*/, 2];
|
2779
|
+
return [4 /*yield*/, fetch(this.template.substring(6))];
|
2780
|
+
case 1:
|
2781
|
+
_h = (_p.sent()).text();
|
2782
|
+
return [3 /*break*/, 3];
|
2783
|
+
case 2:
|
2784
|
+
_h = Promise.resolve(this.template);
|
2785
|
+
_p.label = 3;
|
2786
|
+
case 3:
|
2787
|
+
templatePromise = (_h);
|
2788
|
+
i_1 = 0;
|
2789
|
+
_p.label = 4;
|
2790
|
+
case 4:
|
2791
|
+
if (!(this.styles && i_1 < this.styles.length)) return [3 /*break*/, 9];
|
2792
|
+
it_6 = this.styles[i_1];
|
2793
|
+
_k = (_j = stylePromises).push;
|
2794
|
+
if (!it_6.startsWith('lazy://')) return [3 /*break*/, 6];
|
2795
|
+
return [4 /*yield*/, fetch(it_6.substring(6))];
|
2796
|
+
case 5:
|
2797
|
+
_l = (_p.sent()).text();
|
2798
|
+
return [3 /*break*/, 7];
|
2799
|
+
case 6:
|
2800
|
+
_l = Promise.resolve(it_6);
|
2801
|
+
_p.label = 7;
|
2802
|
+
case 7:
|
2803
|
+
_k.apply(_j, [_l]);
|
2804
|
+
_p.label = 8;
|
2805
|
+
case 8:
|
2806
|
+
i_1++;
|
2807
|
+
return [3 /*break*/, 4];
|
2808
|
+
case 9:
|
2809
|
+
// const templateResponse = await templatePromise;
|
2810
|
+
// const styleResponses = await Promise.all(stylePromises);
|
2811
|
+
_m = this;
|
2812
|
+
return [4 /*yield*/, templatePromise];
|
2813
|
+
case 10:
|
2814
|
+
// const templateResponse = await templatePromise;
|
2815
|
+
// const styleResponses = await Promise.all(stylePromises);
|
2816
|
+
_m.template = _p.sent();
|
2817
|
+
_o = this;
|
2818
|
+
return [4 /*yield*/, Promise.all(stylePromises)];
|
2819
|
+
case 11:
|
2820
|
+
_o.styles = _p.sent();
|
2821
|
+
// console.log('targetsub-22-', this.styles)
|
2822
|
+
// console.log('targetsub-222-', this.template, this.styles)
|
2823
|
+
// Promise.all(promises).then([])
|
2824
|
+
// console.log('callback------->', element)
|
2825
|
+
if (!obj.__domrender_components) {
|
2826
|
+
obj.__domrender_components = {};
|
2827
|
+
}
|
2828
|
+
domrenderComponents = obj.__domrender_components;
|
2829
|
+
componentKey = rawSet.uuid;
|
2830
|
+
attribute = DomUtils.getAttributeToObject(element);
|
2831
|
+
renderScript = 'var $component = this.__render.component; var $element = this.__render.element; var $router = this.__render.router; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; var $creatorMetaData = this.__render.creatorMetaData;';
|
2832
|
+
render = Object.freeze({
|
2833
|
+
renderScript: renderScript,
|
2834
|
+
element: element,
|
2835
|
+
innerHTML: element.innerHTML,
|
2836
|
+
attribute: attribute,
|
2837
|
+
rawset: rawSet,
|
2838
|
+
router: config.router,
|
2839
|
+
componentKey: componentKey,
|
2840
|
+
scripts: EventManager.setBindProperty((_a = config.scripts) !== null && _a !== void 0 ? _a : {}, obj)
|
2841
|
+
// eslint-disable-next-line no-use-before-define
|
2842
|
+
});
|
2843
|
+
constructor = element.getAttribute(RawSet.DR_ON_CONSTRUCTOR_ARGUMENTS_OPTIONNAME);
|
2844
|
+
constructorParam = [];
|
2845
|
+
// dr-constructor
|
2846
|
+
if (constructor) {
|
2847
|
+
script = "".concat(renderScript, " return ").concat(constructor, " ");
|
2848
|
+
param = (_b = ScriptUtils.eval(script, Object.assign(obj, { __render: render }))) !== null && _b !== void 0 ? _b : [];
|
2849
|
+
if (!Array.isArray(param)) {
|
2850
|
+
param = [param];
|
2851
|
+
}
|
2852
|
+
constructorParam = param;
|
2853
|
+
}
|
2854
|
+
// console.log('------22', attrs);
|
2855
|
+
domrenderComponents[componentKey] = objFactory(element, obj, rawSet, constructorParam);
|
2856
|
+
instance = domrenderComponents[componentKey];
|
2857
|
+
i = instance.__domrender_component_new = ((_c = instance.__domrender_component_new) !== null && _c !== void 0 ? _c : new Proxy({}, new DomRenderFinalProxy()));
|
2858
|
+
i.thisVariableName = rawSet.point.thisVariableName;
|
2859
|
+
i.thisFullVariableName = "this.__domrender_components.".concat(componentKey);
|
2860
|
+
i.componentKey = componentKey;
|
2861
|
+
i.rawSet = rawSet;
|
2862
|
+
i.attribute = attribute;
|
2863
|
+
i.router = config.router;
|
2864
|
+
i.scripts = render.scripts;
|
2865
|
+
i.drAttrs = attrs;
|
2866
|
+
i.innerHTML = element.innerHTML;
|
2867
|
+
i.rootCreator = new Proxy(obj, new DomRenderFinalProxy());
|
2868
|
+
i.creator = new Proxy(rawSet.point.thisVariableName ? ScriptUtils.evalReturn(rawSet.point.thisVariableName, obj) : obj, new DomRenderFinalProxy());
|
2869
|
+
this.__creatorMetaData = i;
|
2870
|
+
render = __assign({ component: instance, creatorMetaData: i }, render);
|
2871
|
+
normalAttrMap = element.getAttribute(EventManager.normalAttrMapAttrName);
|
2872
|
+
if (instance.onChangeAttrRender && normalAttrMap) {
|
2873
|
+
new Map(JSON.parse(normalAttrMap)).forEach(function (value, key) {
|
2874
|
+
var script = "".concat(renderScript, " return ").concat(value, " ");
|
2875
|
+
var cval = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2876
|
+
// element.setAttribute(key, cval);
|
2877
|
+
instance.onChangeAttrRender(key, cval);
|
2878
|
+
});
|
2879
|
+
}
|
2880
|
+
onCreate = element.getAttribute(RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME);
|
2881
|
+
this.__render = render;
|
2882
|
+
createParam = [];
|
2883
|
+
if (onCreate) {
|
2884
|
+
script = "".concat(renderScript, " return ").concat(onCreate, " ");
|
2885
|
+
createParam = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2886
|
+
if (!Array.isArray(createParam)) {
|
2887
|
+
createParam = [createParam];
|
2888
|
+
}
|
2889
|
+
}
|
2890
|
+
(_d = instance === null || instance === void 0 ? void 0 : instance.onCreateRender) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray([instance], createParam, false));
|
2891
|
+
applayTemplate = element.innerHTML;
|
2892
|
+
componentName = (_e = element.getAttribute(RawSet.DR_COMPONENT_NAME_OPTIONNAME)) !== null && _e !== void 0 ? _e : 'component';
|
2893
|
+
innerHTMLName = (_f = element.getAttribute(RawSet.DR_COMPONENT_INNER_HTML_NAME_OPTIONNAME)) !== null && _f !== void 0 ? _f : 'innerHTML';
|
2894
|
+
if (applayTemplate) {
|
2895
|
+
// if (rawSet.point.thisVariableName) {
|
2896
|
+
// 넘어온 innerHTML에 this가 있으면 해당안되게 우선 치환.
|
2897
|
+
innerHTMLThisRandom = RandomUtils.uuid();
|
2898
|
+
applayTemplate = applayTemplate.replace(/this\./g, innerHTMLThisRandom);
|
2899
|
+
// }
|
2900
|
+
applayTemplate = applayTemplate.replace(RegExp("#".concat(componentName, "#"), 'g'), 'this');
|
2901
|
+
}
|
2902
|
+
// applayTemplate = template.replace(RegExp(`#${innerHTMLName}#`, 'g'), applayTemplate);
|
2903
|
+
applayTemplate = ((_g = this.template) !== null && _g !== void 0 ? _g : '').replace(RegExp("#".concat(innerHTMLName, "#"), 'g'), applayTemplate);
|
2904
|
+
oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME);
|
2905
|
+
if (oninit) {
|
2906
|
+
script = "".concat(renderScript, " ").concat(oninit, " ");
|
2907
|
+
ScriptUtils.eval(script, Object.assign(obj, {
|
2908
|
+
__render: render
|
2909
|
+
}));
|
2910
|
+
}
|
2911
|
+
style = RawSet.generateStyleTransform(this.styles, componentKey, true);
|
2912
|
+
element.innerHTML = style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
|
2913
|
+
return [4 /*yield*/, RawSet.drThisCreate(rawSet, element, "this.__domrender_components.".concat(componentKey), '', true, obj, config)];
|
2914
|
+
case 12:
|
2915
|
+
data = _p.sent();
|
2916
|
+
// 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
|
2917
|
+
if (innerHTMLThisRandom) {
|
2918
|
+
template_1 = config.window.document.createElement('template');
|
2919
|
+
template_1.content.append(data);
|
2920
|
+
template_1.innerHTML = template_1.innerHTML.replace(RegExp(innerHTMLThisRandom, 'g'), 'this.');
|
2921
|
+
data = template_1.content;
|
2922
|
+
}
|
2923
|
+
data.render = render;
|
2924
|
+
return [2 /*return*/, data];
|
2925
|
+
}
|
2544
2926
|
});
|
2545
|
-
}
|
2546
|
-
// dr-on-create onCreateRender
|
2547
|
-
var onCreate = element.getAttribute(RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME);
|
2548
|
-
this.__render = render;
|
2549
|
-
var createParam = [];
|
2550
|
-
if (onCreate) {
|
2551
|
-
var script = "".concat(renderScript, " return ").concat(onCreate, " ");
|
2552
|
-
createParam = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2553
|
-
if (!Array.isArray(createParam)) {
|
2554
|
-
createParam = [createParam];
|
2555
|
-
}
|
2556
|
-
}
|
2557
|
-
(_d = instance === null || instance === void 0 ? void 0 : instance.onCreateRender) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray([instance], createParam, false));
|
2558
|
-
var applayTemplate = element.innerHTML;
|
2559
|
-
var innerHTMLThisRandom;
|
2560
|
-
var componentName = (_e = element.getAttribute(RawSet.DR_COMPONENT_NAME_OPTIONNAME)) !== null && _e !== void 0 ? _e : 'component';
|
2561
|
-
var innerHTMLName = (_f = element.getAttribute(RawSet.DR_COMPONENT_INNER_HTML_NAME_OPTIONNAME)) !== null && _f !== void 0 ? _f : 'innerHTML';
|
2562
|
-
if (applayTemplate) {
|
2563
|
-
// if (rawSet.point.thisVariableName) {
|
2564
|
-
// 넘어온 innerHTML에 this가 있으면 해당안되게 우선 치환.
|
2565
|
-
innerHTMLThisRandom = RandomUtils.uuid();
|
2566
|
-
applayTemplate = applayTemplate.replace(/this\./g, innerHTMLThisRandom);
|
2567
|
-
// }
|
2568
|
-
applayTemplate = applayTemplate.replace(RegExp("#".concat(componentName, "#"), 'g'), 'this');
|
2569
|
-
}
|
2570
|
-
applayTemplate = template.replace(RegExp("#".concat(innerHTMLName, "#"), 'g'), applayTemplate);
|
2571
|
-
// dr-on-component-init
|
2572
|
-
// const oninit = element.getAttribute(`${EventManager.attrPrefix}on-component-init`); // dr-on-component-init
|
2573
|
-
var oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME); // dr-on-component-init
|
2574
|
-
if (oninit) {
|
2575
|
-
var script = "".concat(renderScript, " ").concat(oninit, " ");
|
2576
|
-
ScriptUtils.eval(script, Object.assign(obj, {
|
2577
|
-
__render: render
|
2578
|
-
}));
|
2579
|
-
}
|
2580
|
-
var style = RawSet.generateStyleTransform(styles, componentKey, true);
|
2581
|
-
element.innerHTML = style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
|
2582
|
-
// const metaStart = RawSet.metaStart(componentKey);
|
2583
|
-
// const metaEnd = RawSet.metaEnd(componentKey);
|
2584
|
-
// element.innerHTML = metaStart + style + (applayTemplate ?? '') + metaEnd;
|
2585
|
-
// console.log('------>', element.innerHTML, obj)
|
2586
|
-
var data = RawSet.drThisCreate(rawSet, element, "this.__domrender_components.".concat(componentKey), '', true, obj, config);
|
2587
|
-
// 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
|
2588
|
-
if (innerHTMLThisRandom) {
|
2589
|
-
var template_1 = config.window.document.createElement('template');
|
2590
|
-
template_1.content.append(data);
|
2591
|
-
template_1.innerHTML = template_1.innerHTML.replace(RegExp(innerHTMLThisRandom, 'g'), 'this.');
|
2592
|
-
data = template_1.content;
|
2593
|
-
}
|
2594
|
-
data.render = render;
|
2595
|
-
return data;
|
2927
|
+
});
|
2596
2928
|
}
|
2597
2929
|
// complete
|
2598
2930
|
};
|
@@ -2628,7 +2960,7 @@ var RawSet = /** @class */ (function () {
|
|
2628
2960
|
}
|
2629
2961
|
}
|
2630
2962
|
};
|
2631
|
-
RawSet.
|
2963
|
+
RawSet.DR_NAME = 'dr';
|
2632
2964
|
RawSet.DR_IF_NAME = 'dr-if';
|
2633
2965
|
RawSet.DR_FOR_NAME = 'dr-for';
|
2634
2966
|
RawSet.DR_FOR_OF_NAME = 'dr-for-of';
|
@@ -2655,7 +2987,7 @@ var RawSet = /** @class */ (function () {
|
|
2655
2987
|
RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME = 'dr-on-init:arguments';
|
2656
2988
|
RawSet.DR_ON_CONSTRUCTOR_ARGUMENTS_OPTIONNAME = 'dr-on-constructor:arguments';
|
2657
2989
|
RawSet.drAttrsOriginName = {
|
2658
|
-
dr: RawSet.
|
2990
|
+
dr: RawSet.DR_NAME,
|
2659
2991
|
drIf: RawSet.DR_IF_NAME,
|
2660
2992
|
drFor: RawSet.DR_FOR_NAME,
|
2661
2993
|
drForOf: RawSet.DR_FOR_OF_NAME,
|
@@ -2676,7 +3008,7 @@ var RawSet = /** @class */ (function () {
|
|
2676
3008
|
drDestroyOption: RawSet.DR_DESTROY_OPTIONNAME
|
2677
3009
|
};
|
2678
3010
|
RawSet.DR_TAGS = [];
|
2679
|
-
RawSet.DR_ATTRIBUTES = [RawSet.
|
3011
|
+
RawSet.DR_ATTRIBUTES = [RawSet.DR_NAME, RawSet.DR_APPENDER_NAME, RawSet.DR_IF_NAME, RawSet.DR_FOR_OF_NAME, RawSet.DR_FOR_NAME, RawSet.DR_THIS_NAME, RawSet.DR_FORM_NAME, RawSet.DR_PRE_NAME, RawSet.DR_INNERHTML_NAME, RawSet.DR_INNERTEXT_NAME, RawSet.DR_REPEAT_NAME, RawSet.DR_DETECT_NAME];
|
2680
3012
|
return RawSet;
|
2681
3013
|
}());
|
2682
3014
|
|
@@ -2718,6 +3050,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
2718
3050
|
// console.log('target-------->')
|
2719
3051
|
var filter = (_b = (_a = _this.config.proxyExcludeTyps) === null || _a === void 0 ? void 0 : _a.filter(function (it) { return target instanceof it; })) !== null && _b !== void 0 ? _b : [];
|
2720
3052
|
if (filter.length === 0) {
|
3053
|
+
// console.log('--------', objProxy, target, it)
|
2721
3054
|
var proxyAfter = _this.proxy(objProxy, target, it);
|
2722
3055
|
obj[it] = proxyAfter;
|
2723
3056
|
}
|
@@ -2782,67 +3115,88 @@ var DomRenderProxy = /** @class */ (function () {
|
|
2782
3115
|
};
|
2783
3116
|
// 중요 important
|
2784
3117
|
DomRenderProxy.prototype.render = function (raws, fullPathStr) {
|
2785
|
-
var
|
2786
|
-
|
2787
|
-
var iter
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
if (it.isConnected) {
|
2801
|
-
// 중요 render될때 targetAttribute 체크 해야함.
|
2802
|
-
var targetAttrMap = (_b = (_a = it.point.node) === null || _a === void 0 ? void 0 : _a.getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, EventManager.normalAttrMapAttrName);
|
2803
|
-
if ((_c = it.detect) === null || _c === void 0 ? void 0 : _c.action) {
|
2804
|
-
it.detect.action();
|
2805
|
-
}
|
2806
|
-
else if (it.type === exports.RawSetType.TARGET_ELEMENT && it.data && fullPathStr && targetAttrMap && it.fragment.render) {
|
2807
|
-
new Map(JSON.parse(targetAttrMap)).forEach(function (v, k) {
|
2808
|
-
// it?.data.onChangeAttrRender(k, null, v);
|
2809
|
-
var isUsing = EventManager.isUsingThisVar(v, "this.".concat(fullPathStr));
|
2810
|
-
if (isUsing) {
|
2811
|
-
var render = it.fragment.render;
|
2812
|
-
// console.log('render-->', (it.fragment as any).render)
|
2813
|
-
var script = "".concat(render.renderScript, " return ").concat(v, " ");
|
2814
|
-
var cval = ScriptUtils.eval(script, Object.assign(_this._domRender_proxy, { __render: render }));
|
2815
|
-
it.data.onChangeAttrRender(k, cval);
|
3118
|
+
var _a, _b, _c;
|
3119
|
+
return __awaiter(this, void 0, void 0, function () {
|
3120
|
+
var iter, removeRawSets, rawSets, _loop_1, this_1, _i, rawSets_1, it_1;
|
3121
|
+
var _this = this;
|
3122
|
+
return __generator(this, function (_d) {
|
3123
|
+
switch (_d.label) {
|
3124
|
+
case 0:
|
3125
|
+
if (typeof raws === 'string') {
|
3126
|
+
iter = this._rawSets.get(raws);
|
3127
|
+
if (iter) {
|
3128
|
+
raws = Array.from(iter);
|
3129
|
+
}
|
3130
|
+
else {
|
3131
|
+
raws = undefined;
|
3132
|
+
}
|
2816
3133
|
}
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
3134
|
+
removeRawSets = [];
|
3135
|
+
rawSets = raws !== null && raws !== void 0 ? raws : this.getRawSets();
|
3136
|
+
_loop_1 = function (it_1) {
|
3137
|
+
var targetAttrMap, rawSets_2;
|
3138
|
+
return __generator(this, function (_e) {
|
3139
|
+
switch (_e.label) {
|
3140
|
+
case 0:
|
3141
|
+
it_1.getUsingTriggerVariables(this_1.config).forEach(function (path) { return _this.addRawSet(path, it_1); });
|
3142
|
+
if (!it_1.isConnected) return [3 /*break*/, 5];
|
3143
|
+
targetAttrMap = (_b = (_a = it_1.point.node) === null || _a === void 0 ? void 0 : _a.getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, EventManager.normalAttrMapAttrName);
|
3144
|
+
if (!((_c = it_1.detect) === null || _c === void 0 ? void 0 : _c.action)) return [3 /*break*/, 1];
|
3145
|
+
it_1.detect.action();
|
3146
|
+
return [3 /*break*/, 4];
|
3147
|
+
case 1:
|
3148
|
+
if (!(it_1.type === exports.RawSetType.TARGET_ELEMENT && it_1.data && fullPathStr && targetAttrMap && it_1.fragment.render)) return [3 /*break*/, 2];
|
3149
|
+
new Map(JSON.parse(targetAttrMap)).forEach(function (v, k) {
|
3150
|
+
var _a;
|
3151
|
+
// it?.data.onChangeAttrRender(k, null, v);
|
3152
|
+
var isUsing = EventManager.isUsingThisVar(v, "this.".concat(fullPathStr));
|
3153
|
+
if (isUsing) {
|
3154
|
+
var render = it_1.fragment.render;
|
3155
|
+
// console.log('render-->', (it.fragment as any).render)
|
3156
|
+
var script = "".concat(render.renderScript, " return ").concat(v, " ");
|
3157
|
+
var cval = ScriptUtils.eval(script, Object.assign((_a = _this._domRender_proxy) !== null && _a !== void 0 ? _a : {}, { __render: render }));
|
3158
|
+
it_1.data.onChangeAttrRender(k, cval);
|
3159
|
+
}
|
3160
|
+
// console.log('---?', v, fullPathStr, isUsing);
|
3161
|
+
});
|
3162
|
+
return [3 /*break*/, 4];
|
3163
|
+
case 2: return [4 /*yield*/, it_1.render(this_1._domRender_proxy, this_1.config)];
|
3164
|
+
case 3:
|
3165
|
+
rawSets_2 = _e.sent();
|
3166
|
+
// 그외 자식들 render
|
3167
|
+
if (rawSets_2 && rawSets_2.length > 0) {
|
3168
|
+
this_1.render(rawSets_2);
|
3169
|
+
}
|
3170
|
+
_e.label = 4;
|
3171
|
+
case 4: return [3 /*break*/, 6];
|
3172
|
+
case 5:
|
3173
|
+
removeRawSets.push(it_1);
|
3174
|
+
_e.label = 6;
|
3175
|
+
case 6: return [2 /*return*/];
|
3176
|
+
}
|
3177
|
+
});
|
3178
|
+
};
|
3179
|
+
this_1 = this;
|
3180
|
+
_i = 0, rawSets_1 = rawSets;
|
3181
|
+
_d.label = 1;
|
3182
|
+
case 1:
|
3183
|
+
if (!(_i < rawSets_1.length)) return [3 /*break*/, 4];
|
3184
|
+
it_1 = rawSets_1[_i];
|
3185
|
+
return [5 /*yield**/, _loop_1(it_1)];
|
3186
|
+
case 2:
|
3187
|
+
_d.sent();
|
3188
|
+
_d.label = 3;
|
3189
|
+
case 3:
|
3190
|
+
_i++;
|
3191
|
+
return [3 /*break*/, 1];
|
3192
|
+
case 4:
|
3193
|
+
if (removeRawSets.length > 0) {
|
3194
|
+
this.removeRawSet.apply(this, removeRawSets);
|
3195
|
+
}
|
3196
|
+
return [2 /*return*/];
|
2836
3197
|
}
|
2837
|
-
}
|
2838
|
-
else {
|
2839
|
-
removeRawSets.push(it);
|
2840
|
-
// this.removeRawSet(it)
|
2841
|
-
}
|
3198
|
+
});
|
2842
3199
|
});
|
2843
|
-
if (removeRawSets.length > 0) {
|
2844
|
-
this.removeRawSet.apply(this, removeRawSets);
|
2845
|
-
}
|
2846
3200
|
};
|
2847
3201
|
DomRenderProxy.prototype.root = function (paths, value, lastDoneExecute) {
|
2848
3202
|
var _this = this;
|
@@ -2954,14 +3308,14 @@ var DomRenderProxy = /** @class */ (function () {
|
|
2954
3308
|
// return (p in target) ? (target as any)[p].bind(target) : (target as any)[p]
|
2955
3309
|
// console.log('-->', p, Object.prototype.toString.call((target as any)[p]), (target as any)[p])
|
2956
3310
|
// return (target as any)[p]
|
2957
|
-
var
|
2958
|
-
if (
|
2959
|
-
|
3311
|
+
var it_2 = target[p];
|
3312
|
+
if (it_2 && typeof it_2 === 'object' && ('_DomRender_isProxy' in it_2) && Object.prototype.toString.call(it_2._DomRender_origin) === '[object Date]') {
|
3313
|
+
it_2 = it_2._DomRender_origin;
|
2960
3314
|
}
|
2961
3315
|
if (('onBeforeReturnGet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnGets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
2962
|
-
(_c = (_b = receiver) === null || _b === void 0 ? void 0 : _b.onBeforeReturnGet) === null || _c === void 0 ? void 0 : _c.call(_b, p,
|
3316
|
+
(_c = (_b = receiver) === null || _b === void 0 ? void 0 : _b.onBeforeReturnGet) === null || _c === void 0 ? void 0 : _c.call(_b, p, it_2, this.root([p], it_2, false));
|
2963
3317
|
}
|
2964
|
-
return
|
3318
|
+
return it_2;
|
2965
3319
|
}
|
2966
3320
|
};
|
2967
3321
|
DomRenderProxy.prototype.has = function (target, p) {
|
@@ -3112,6 +3466,16 @@ var Router = /** @class */ (function () {
|
|
3112
3466
|
this.set(path, urlExpressionOrData, dataOrTitle !== null && dataOrTitle !== void 0 ? dataOrTitle : '');
|
3113
3467
|
}
|
3114
3468
|
this.attach();
|
3469
|
+
this.dispatchPopStateEvent();
|
3470
|
+
};
|
3471
|
+
Router.prototype.pushState = function (data, title, path) {
|
3472
|
+
this.window.history.pushState(data, title, path);
|
3473
|
+
};
|
3474
|
+
Router.prototype.dispatchPopStateEvent = function () {
|
3475
|
+
this.window.dispatchEvent(new Event('popstate'));
|
3476
|
+
};
|
3477
|
+
Router.prototype.reload = function () {
|
3478
|
+
this.window.dispatchEvent(new Event('popstate'));
|
3115
3479
|
};
|
3116
3480
|
Router.prototype.getPathData = function (urlExpression, currentUrl) {
|
3117
3481
|
// console.log('getPathData-->', urlExpression, currentUrl);
|
@@ -3176,7 +3540,7 @@ var PathRouter = /** @class */ (function (_super) {
|
|
3176
3540
|
};
|
3177
3541
|
PathRouter.prototype.set = function (path, data, title) {
|
3178
3542
|
if (title === void 0) { title = ''; }
|
3179
|
-
|
3543
|
+
_super.prototype.pushState.call(this, data, title, path);
|
3180
3544
|
};
|
3181
3545
|
PathRouter.prototype.getUrl = function () {
|
3182
3546
|
var url = new URL(this.window.document.location.href);
|
@@ -3270,7 +3634,7 @@ var HashRouter = /** @class */ (function (_super) {
|
|
3270
3634
|
HashRouter.prototype.set = function (path, data, title) {
|
3271
3635
|
if (title === void 0) { title = ''; }
|
3272
3636
|
path = '#' + path;
|
3273
|
-
|
3637
|
+
_super.prototype.pushState.call(this, data, title, path);
|
3274
3638
|
};
|
3275
3639
|
HashRouter.prototype.getUrl = function () {
|
3276
3640
|
return LocationUtils.hash(this.window) || '/';
|
@@ -3485,7 +3849,7 @@ var DomRender = /** @class */ (function () {
|
|
3485
3849
|
function DomRender() {
|
3486
3850
|
}
|
3487
3851
|
DomRender.run = function (obj, target, oConfig) {
|
3488
|
-
var _a, _b, _c;
|
3852
|
+
var _a, _b, _c, _d;
|
3489
3853
|
var robj = obj;
|
3490
3854
|
if ('_DomRender_isProxy' in obj) {
|
3491
3855
|
if (target) {
|
@@ -3512,6 +3876,10 @@ var DomRender = /** @class */ (function () {
|
|
3512
3876
|
else if (config.routerType === 'hash') {
|
3513
3877
|
config.router = (_c = config.router) !== null && _c !== void 0 ? _c : new HashRouter(robj, config.window);
|
3514
3878
|
}
|
3879
|
+
else { // default
|
3880
|
+
config.routerType = 'hash';
|
3881
|
+
config.router = (_d = config.router) !== null && _d !== void 0 ? _d : new HashRouter(robj, config.window);
|
3882
|
+
}
|
3515
3883
|
domRender.run(robj);
|
3516
3884
|
return robj;
|
3517
3885
|
};
|
@@ -3531,6 +3899,21 @@ var DomRender = /** @class */ (function () {
|
|
3531
3899
|
return DomRender;
|
3532
3900
|
}());
|
3533
3901
|
|
3902
|
+
var RenderManager = /** @class */ (function () {
|
3903
|
+
function RenderManager() {
|
3904
|
+
}
|
3905
|
+
RenderManager.render = function (obj, target) {
|
3906
|
+
if (target === void 0) { target = Object.keys(obj); }
|
3907
|
+
var domRenderProxy = obj._DomRender_proxy;
|
3908
|
+
if (domRenderProxy) {
|
3909
|
+
target.forEach(function (it) {
|
3910
|
+
domRenderProxy.root([it], obj[it]);
|
3911
|
+
});
|
3912
|
+
}
|
3913
|
+
};
|
3914
|
+
return RenderManager;
|
3915
|
+
}());
|
3916
|
+
|
3534
3917
|
var Appender = /** @class */ (function () {
|
3535
3918
|
function Appender(defaultDatas) {
|
3536
3919
|
this.length = 0;
|
@@ -3584,34 +3967,6 @@ var Appender = /** @class */ (function () {
|
|
3584
3967
|
return Appender;
|
3585
3968
|
}());
|
3586
3969
|
|
3587
|
-
var RenderManager = /** @class */ (function () {
|
3588
|
-
function RenderManager() {
|
3589
|
-
}
|
3590
|
-
RenderManager.render = function (obj, target) {
|
3591
|
-
if (target === void 0) { target = Object.keys(obj); }
|
3592
|
-
var domRenderProxy = obj._DomRender_proxy;
|
3593
|
-
if (domRenderProxy) {
|
3594
|
-
target.forEach(function (it) {
|
3595
|
-
domRenderProxy.root([it], obj[it]);
|
3596
|
-
});
|
3597
|
-
}
|
3598
|
-
};
|
3599
|
-
return RenderManager;
|
3600
|
-
}());
|
3601
|
-
|
3602
|
-
var CheckedValidator = /** @class */ (function (_super) {
|
3603
|
-
__extends(CheckedValidator, _super);
|
3604
|
-
function CheckedValidator(value, target, event, autoValid) {
|
3605
|
-
if (autoValid === void 0) { autoValid = true; }
|
3606
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3607
|
-
}
|
3608
|
-
CheckedValidator.prototype.valid = function () {
|
3609
|
-
var _a, _b;
|
3610
|
-
return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
|
3611
|
-
};
|
3612
|
-
return CheckedValidator;
|
3613
|
-
}(Validator));
|
3614
|
-
|
3615
3970
|
var AllCheckedValidatorArray = /** @class */ (function (_super) {
|
3616
3971
|
__extends(AllCheckedValidatorArray, _super);
|
3617
3972
|
function AllCheckedValidatorArray(value, target, event, autoValid) {
|
@@ -3638,19 +3993,32 @@ var AllUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3638
3993
|
return AllUnCheckedValidatorArray;
|
3639
3994
|
}(ValidatorArray));
|
3640
3995
|
|
3641
|
-
var
|
3642
|
-
__extends(
|
3643
|
-
function
|
3996
|
+
var CheckedValidator = /** @class */ (function (_super) {
|
3997
|
+
__extends(CheckedValidator, _super);
|
3998
|
+
function CheckedValidator(value, target, event, autoValid) {
|
3999
|
+
if (autoValid === void 0) { autoValid = true; }
|
4000
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
4001
|
+
}
|
4002
|
+
CheckedValidator.prototype.valid = function () {
|
4003
|
+
var _a, _b;
|
4004
|
+
return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
|
4005
|
+
};
|
4006
|
+
return CheckedValidator;
|
4007
|
+
}(Validator));
|
4008
|
+
|
4009
|
+
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4010
|
+
__extends(CountEqualsCheckedValidatorArray, _super);
|
4011
|
+
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3644
4012
|
if (autoValid === void 0) { autoValid = true; }
|
3645
4013
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3646
4014
|
_this.count = count;
|
3647
4015
|
return _this;
|
3648
4016
|
}
|
3649
|
-
|
4017
|
+
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
3650
4018
|
var _a;
|
3651
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return
|
4019
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
3652
4020
|
};
|
3653
|
-
return
|
4021
|
+
return CountEqualsCheckedValidatorArray;
|
3654
4022
|
}(ValidatorArray));
|
3655
4023
|
|
3656
4024
|
var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -3668,34 +4036,34 @@ var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3668
4036
|
return CountGreaterThanCheckedValidatorArray;
|
3669
4037
|
}(ValidatorArray));
|
3670
4038
|
|
3671
|
-
var
|
3672
|
-
__extends(
|
3673
|
-
function
|
4039
|
+
var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4040
|
+
__extends(CountEqualsUnCheckedValidatorArray, _super);
|
4041
|
+
function CountEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3674
4042
|
if (autoValid === void 0) { autoValid = true; }
|
3675
4043
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3676
4044
|
_this.count = count;
|
3677
4045
|
return _this;
|
3678
4046
|
}
|
3679
|
-
|
4047
|
+
CountEqualsUnCheckedValidatorArray.prototype.valid = function () {
|
3680
4048
|
var _a;
|
3681
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
4049
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length === this.count;
|
3682
4050
|
};
|
3683
|
-
return
|
4051
|
+
return CountEqualsUnCheckedValidatorArray;
|
3684
4052
|
}(ValidatorArray));
|
3685
4053
|
|
3686
|
-
var
|
3687
|
-
__extends(
|
3688
|
-
function
|
4054
|
+
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4055
|
+
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
4056
|
+
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3689
4057
|
if (autoValid === void 0) { autoValid = true; }
|
3690
4058
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3691
4059
|
_this.count = count;
|
3692
4060
|
return _this;
|
3693
4061
|
}
|
3694
|
-
|
4062
|
+
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3695
4063
|
var _a;
|
3696
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4064
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
3697
4065
|
};
|
3698
|
-
return
|
4066
|
+
return CountGreaterThanEqualsCheckedValidatorArray;
|
3699
4067
|
}(ValidatorArray));
|
3700
4068
|
|
3701
4069
|
var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -3713,6 +4081,21 @@ var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_su
|
|
3713
4081
|
return CountGreaterThanEqualsUnCheckedValidatorArray;
|
3714
4082
|
}(ValidatorArray));
|
3715
4083
|
|
4084
|
+
var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
|
4085
|
+
__extends(CountLessThanCheckedValidatorArray, _super);
|
4086
|
+
function CountLessThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
4087
|
+
if (autoValid === void 0) { autoValid = true; }
|
4088
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4089
|
+
_this.count = count;
|
4090
|
+
return _this;
|
4091
|
+
}
|
4092
|
+
CountLessThanCheckedValidatorArray.prototype.valid = function () {
|
4093
|
+
var _a;
|
4094
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length < this.count;
|
4095
|
+
};
|
4096
|
+
return CountLessThanCheckedValidatorArray;
|
4097
|
+
}(ValidatorArray));
|
4098
|
+
|
3716
4099
|
var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3717
4100
|
__extends(CountGreaterThanUnCheckedValidatorArray, _super);
|
3718
4101
|
function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
@@ -3728,19 +4111,19 @@ var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3728
4111
|
return CountGreaterThanUnCheckedValidatorArray;
|
3729
4112
|
}(ValidatorArray));
|
3730
4113
|
|
3731
|
-
var
|
3732
|
-
__extends(
|
3733
|
-
function
|
4114
|
+
var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4115
|
+
__extends(CountLessThanEqualsCheckedValidatorArray, _super);
|
4116
|
+
function CountLessThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3734
4117
|
if (autoValid === void 0) { autoValid = true; }
|
3735
4118
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3736
4119
|
_this.count = count;
|
3737
4120
|
return _this;
|
3738
4121
|
}
|
3739
|
-
|
4122
|
+
CountLessThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3740
4123
|
var _a;
|
3741
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4124
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length <= this.count;
|
3742
4125
|
};
|
3743
|
-
return
|
4126
|
+
return CountLessThanEqualsCheckedValidatorArray;
|
3744
4127
|
}(ValidatorArray));
|
3745
4128
|
|
3746
4129
|
var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -3758,21 +4141,6 @@ var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super
|
|
3758
4141
|
return CountLessThanEqualsUnCheckedValidatorArray;
|
3759
4142
|
}(ValidatorArray));
|
3760
4143
|
|
3761
|
-
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3762
|
-
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
3763
|
-
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3764
|
-
if (autoValid === void 0) { autoValid = true; }
|
3765
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3766
|
-
_this.count = count;
|
3767
|
-
return _this;
|
3768
|
-
}
|
3769
|
-
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3770
|
-
var _a;
|
3771
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
3772
|
-
};
|
3773
|
-
return CountGreaterThanEqualsCheckedValidatorArray;
|
3774
|
-
}(ValidatorArray));
|
3775
|
-
|
3776
4144
|
var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3777
4145
|
__extends(CountUnCheckedValidatorArray, _super);
|
3778
4146
|
function CountUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
@@ -3788,20 +4156,19 @@ var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3788
4156
|
return CountUnCheckedValidatorArray;
|
3789
4157
|
}(ValidatorArray));
|
3790
4158
|
|
3791
|
-
var
|
3792
|
-
__extends(
|
3793
|
-
function
|
4159
|
+
var EmptyValidator = /** @class */ (function (_super) {
|
4160
|
+
__extends(EmptyValidator, _super);
|
4161
|
+
function EmptyValidator(value, target, event, autoValid) {
|
3794
4162
|
if (autoValid === void 0) { autoValid = true; }
|
3795
|
-
|
3796
|
-
_this.count = count;
|
3797
|
-
return _this;
|
4163
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3798
4164
|
}
|
3799
|
-
|
3800
|
-
var _a;
|
3801
|
-
|
4165
|
+
EmptyValidator.prototype.valid = function () {
|
4166
|
+
var _a, _b;
|
4167
|
+
var value = this.value;
|
4168
|
+
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
3802
4169
|
};
|
3803
|
-
return
|
3804
|
-
}(
|
4170
|
+
return EmptyValidator;
|
4171
|
+
}(Validator));
|
3805
4172
|
|
3806
4173
|
var FormValidator = /** @class */ (function (_super) {
|
3807
4174
|
__extends(FormValidator, _super);
|
@@ -3843,40 +4210,19 @@ var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3843
4210
|
return ExcludeCheckedValidatorArray;
|
3844
4211
|
}(ValidatorArray));
|
3845
4212
|
|
3846
|
-
var
|
3847
|
-
__extends(
|
3848
|
-
function
|
3849
|
-
if (autoValid === void 0) { autoValid = true; }
|
3850
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3851
|
-
}
|
3852
|
-
EmptyValidator.prototype.valid = function () {
|
3853
|
-
var _a, _b;
|
3854
|
-
var value = this.value;
|
3855
|
-
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
3856
|
-
};
|
3857
|
-
return EmptyValidator;
|
3858
|
-
}(Validator));
|
3859
|
-
|
3860
|
-
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3861
|
-
__extends(IncludeCheckedValidatorArray, _super);
|
3862
|
-
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
3863
|
-
if (allRequired === void 0) { allRequired = false; }
|
4213
|
+
var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4214
|
+
__extends(CountLessThanUnCheckedValidatorArray, _super);
|
4215
|
+
function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3864
4216
|
if (autoValid === void 0) { autoValid = true; }
|
3865
4217
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3866
|
-
_this.
|
3867
|
-
_this.allRequired = allRequired;
|
4218
|
+
_this.count = count;
|
3868
4219
|
return _this;
|
3869
4220
|
}
|
3870
|
-
|
3871
|
-
var _this = this;
|
4221
|
+
CountLessThanUnCheckedValidatorArray.prototype.valid = function () {
|
3872
4222
|
var _a;
|
3873
|
-
|
3874
|
-
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
3875
|
-
return checkedValue.length > 0 &&
|
3876
|
-
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
3877
|
-
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
4223
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length < this.count;
|
3878
4224
|
};
|
3879
|
-
return
|
4225
|
+
return CountLessThanUnCheckedValidatorArray;
|
3880
4226
|
}(ValidatorArray));
|
3881
4227
|
|
3882
4228
|
var MultipleValidator = /** @class */ (function (_super) {
|
@@ -3908,6 +4254,43 @@ var MultipleValidator = /** @class */ (function (_super) {
|
|
3908
4254
|
return MultipleValidator;
|
3909
4255
|
}(Validator));
|
3910
4256
|
|
4257
|
+
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
4258
|
+
__extends(IncludeCheckedValidatorArray, _super);
|
4259
|
+
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
4260
|
+
if (allRequired === void 0) { allRequired = false; }
|
4261
|
+
if (autoValid === void 0) { autoValid = true; }
|
4262
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4263
|
+
_this.include = include;
|
4264
|
+
_this.allRequired = allRequired;
|
4265
|
+
return _this;
|
4266
|
+
}
|
4267
|
+
IncludeCheckedValidatorArray.prototype.valid = function () {
|
4268
|
+
var _this = this;
|
4269
|
+
var _a;
|
4270
|
+
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
4271
|
+
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
4272
|
+
return checkedValue.length > 0 &&
|
4273
|
+
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
4274
|
+
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
4275
|
+
};
|
4276
|
+
return IncludeCheckedValidatorArray;
|
4277
|
+
}(ValidatorArray));
|
4278
|
+
|
4279
|
+
var NotEmptyValidator = /** @class */ (function (_super) {
|
4280
|
+
__extends(NotEmptyValidator, _super);
|
4281
|
+
function NotEmptyValidator(value, target, event, autoValid) {
|
4282
|
+
if (autoValid === void 0) { autoValid = true; }
|
4283
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
4284
|
+
}
|
4285
|
+
NotEmptyValidator.prototype.valid = function () {
|
4286
|
+
var _a, _b;
|
4287
|
+
var value = this.value;
|
4288
|
+
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
4289
|
+
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
4290
|
+
};
|
4291
|
+
return NotEmptyValidator;
|
4292
|
+
}(Validator));
|
4293
|
+
|
3911
4294
|
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
3912
4295
|
__extends(NotRegExpTestValidator, _super);
|
3913
4296
|
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
@@ -3930,32 +4313,16 @@ var NotRegExpTestValidator = /** @class */ (function (_super) {
|
|
3930
4313
|
return NotRegExpTestValidator;
|
3931
4314
|
}(Validator));
|
3932
4315
|
|
3933
|
-
var
|
3934
|
-
__extends(
|
3935
|
-
function
|
3936
|
-
if (autoValid === void 0) { autoValid = true; }
|
3937
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3938
|
-
}
|
3939
|
-
UnCheckedValidator.prototype.valid = function () {
|
3940
|
-
var _a, _b;
|
3941
|
-
return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
|
3942
|
-
};
|
3943
|
-
return UnCheckedValidator;
|
3944
|
-
}(Validator));
|
3945
|
-
|
3946
|
-
var NotEmptyValidator = /** @class */ (function (_super) {
|
3947
|
-
__extends(NotEmptyValidator, _super);
|
3948
|
-
function NotEmptyValidator(value, target, event, autoValid) {
|
4316
|
+
var PassValidator = /** @class */ (function (_super) {
|
4317
|
+
__extends(PassValidator, _super);
|
4318
|
+
function PassValidator(value, target, event, autoValid) {
|
3949
4319
|
if (autoValid === void 0) { autoValid = true; }
|
3950
4320
|
return _super.call(this, value, target, event, autoValid) || this;
|
3951
4321
|
}
|
3952
|
-
|
3953
|
-
|
3954
|
-
var value = this.value;
|
3955
|
-
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
3956
|
-
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
4322
|
+
PassValidator.prototype.valid = function () {
|
4323
|
+
return true;
|
3957
4324
|
};
|
3958
|
-
return
|
4325
|
+
return PassValidator;
|
3959
4326
|
}(Validator));
|
3960
4327
|
|
3961
4328
|
var RegExpTestValidator = /** @class */ (function (_super) {
|
@@ -3981,18 +4348,6 @@ var RegExpTestValidator = /** @class */ (function (_super) {
|
|
3981
4348
|
return RegExpTestValidator;
|
3982
4349
|
}(Validator));
|
3983
4350
|
|
3984
|
-
var PassValidator = /** @class */ (function (_super) {
|
3985
|
-
__extends(PassValidator, _super);
|
3986
|
-
function PassValidator(value, target, event, autoValid) {
|
3987
|
-
if (autoValid === void 0) { autoValid = true; }
|
3988
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3989
|
-
}
|
3990
|
-
PassValidator.prototype.valid = function () {
|
3991
|
-
return true;
|
3992
|
-
};
|
3993
|
-
return PassValidator;
|
3994
|
-
}(Validator));
|
3995
|
-
|
3996
4351
|
var RequiredValidator = /** @class */ (function (_super) {
|
3997
4352
|
__extends(RequiredValidator, _super);
|
3998
4353
|
function RequiredValidator(value, target, event, autoValid) {
|
@@ -4022,6 +4377,19 @@ var ValidMultipleValidator = /** @class */ (function (_super) {
|
|
4022
4377
|
return ValidMultipleValidator;
|
4023
4378
|
}(MultipleValidator));
|
4024
4379
|
|
4380
|
+
var UnCheckedValidator = /** @class */ (function (_super) {
|
4381
|
+
__extends(UnCheckedValidator, _super);
|
4382
|
+
function UnCheckedValidator(value, target, event, autoValid) {
|
4383
|
+
if (autoValid === void 0) { autoValid = true; }
|
4384
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
4385
|
+
}
|
4386
|
+
UnCheckedValidator.prototype.valid = function () {
|
4387
|
+
var _a, _b;
|
4388
|
+
return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
|
4389
|
+
};
|
4390
|
+
return UnCheckedValidator;
|
4391
|
+
}(Validator));
|
4392
|
+
|
4025
4393
|
var ValidValidator = /** @class */ (function (_super) {
|
4026
4394
|
__extends(ValidValidator, _super);
|
4027
4395
|
function ValidValidator(validCallBack, value, target, event, autoValid) {
|
@@ -4050,20 +4418,6 @@ var ValidValidatorArray = /** @class */ (function (_super) {
|
|
4050
4418
|
return ValidValidatorArray;
|
4051
4419
|
}(ValidatorArray));
|
4052
4420
|
|
4053
|
-
var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
4054
|
-
__extends(ValueNotEqualsValidator, _super);
|
4055
|
-
function ValueNotEqualsValidator(equalsValue, value, target, event, autoValid) {
|
4056
|
-
if (autoValid === void 0) { autoValid = true; }
|
4057
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4058
|
-
_this.equalsValue = equalsValue;
|
4059
|
-
return _this;
|
4060
|
-
}
|
4061
|
-
ValueNotEqualsValidator.prototype.valid = function () {
|
4062
|
-
return this.value !== this.equalsValue;
|
4063
|
-
};
|
4064
|
-
return ValueNotEqualsValidator;
|
4065
|
-
}(Validator));
|
4066
|
-
|
4067
4421
|
var ValueEqualsValidator = /** @class */ (function (_super) {
|
4068
4422
|
__extends(ValueEqualsValidator, _super);
|
4069
4423
|
function ValueEqualsValidator(equalsValue, value, target, event, autoValid) {
|
@@ -4078,50 +4432,19 @@ var ValueEqualsValidator = /** @class */ (function (_super) {
|
|
4078
4432
|
return ValueEqualsValidator;
|
4079
4433
|
}(Validator));
|
4080
4434
|
|
4081
|
-
var
|
4082
|
-
|
4435
|
+
var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
4436
|
+
__extends(ValueNotEqualsValidator, _super);
|
4437
|
+
function ValueNotEqualsValidator(equalsValue, value, target, event, autoValid) {
|
4438
|
+
if (autoValid === void 0) { autoValid = true; }
|
4439
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4440
|
+
_this.equalsValue = equalsValue;
|
4441
|
+
return _this;
|
4083
4442
|
}
|
4084
|
-
|
4085
|
-
|
4086
|
-
v = JSON.stringify(v);
|
4087
|
-
}
|
4088
|
-
window.localStorage.setItem(k, v);
|
4089
|
-
};
|
4090
|
-
StorageUtils.getLocalStorageItem = function (k, window) {
|
4091
|
-
return window.localStorage.getItem(k);
|
4092
|
-
};
|
4093
|
-
StorageUtils.cutLocalStorageItem = function (k, window) {
|
4094
|
-
var data = StorageUtils.getLocalStorageItem(k, window);
|
4095
|
-
StorageUtils.removeLocalStorageItem(k, window);
|
4096
|
-
return data;
|
4097
|
-
};
|
4098
|
-
StorageUtils.removeLocalStorageItem = function (k, window) {
|
4099
|
-
return window.localStorage.removeItem(k);
|
4100
|
-
};
|
4101
|
-
StorageUtils.getLocalStorageJsonItem = function (k, window) {
|
4102
|
-
var item = window.localStorage.getItem(k);
|
4103
|
-
if (item) {
|
4104
|
-
try {
|
4105
|
-
return JSON.parse(item);
|
4106
|
-
}
|
4107
|
-
catch (e) {
|
4108
|
-
return undefined;
|
4109
|
-
}
|
4110
|
-
}
|
4111
|
-
else {
|
4112
|
-
return undefined;
|
4113
|
-
}
|
4114
|
-
};
|
4115
|
-
StorageUtils.cutLocalStorageJsonItem = function (k, window) {
|
4116
|
-
var item = StorageUtils.getLocalStorageJsonItem(k, window);
|
4117
|
-
StorageUtils.removeLocalStorageItem(k, window);
|
4118
|
-
return item;
|
4119
|
-
};
|
4120
|
-
StorageUtils.clearLocalStorage = function (window) {
|
4121
|
-
window.localStorage.clear();
|
4443
|
+
ValueNotEqualsValidator.prototype.valid = function () {
|
4444
|
+
return this.value !== this.equalsValue;
|
4122
4445
|
};
|
4123
|
-
return
|
4124
|
-
}());
|
4446
|
+
return ValueNotEqualsValidator;
|
4447
|
+
}(Validator));
|
4125
4448
|
|
4126
4449
|
var ClipBoardUtils = /** @class */ (function () {
|
4127
4450
|
function ClipBoardUtils() {
|
@@ -4169,6 +4492,51 @@ var NodeUtils = /** @class */ (function () {
|
|
4169
4492
|
return NodeUtils;
|
4170
4493
|
}());
|
4171
4494
|
|
4495
|
+
var StorageUtils = /** @class */ (function () {
|
4496
|
+
function StorageUtils() {
|
4497
|
+
}
|
4498
|
+
StorageUtils.setLocalStorageItem = function (k, v, window) {
|
4499
|
+
if (typeof v === 'object') {
|
4500
|
+
v = JSON.stringify(v);
|
4501
|
+
}
|
4502
|
+
window.localStorage.setItem(k, v);
|
4503
|
+
};
|
4504
|
+
StorageUtils.getLocalStorageItem = function (k, window) {
|
4505
|
+
return window.localStorage.getItem(k);
|
4506
|
+
};
|
4507
|
+
StorageUtils.cutLocalStorageItem = function (k, window) {
|
4508
|
+
var data = StorageUtils.getLocalStorageItem(k, window);
|
4509
|
+
StorageUtils.removeLocalStorageItem(k, window);
|
4510
|
+
return data;
|
4511
|
+
};
|
4512
|
+
StorageUtils.removeLocalStorageItem = function (k, window) {
|
4513
|
+
return window.localStorage.removeItem(k);
|
4514
|
+
};
|
4515
|
+
StorageUtils.getLocalStorageJsonItem = function (k, window) {
|
4516
|
+
var item = window.localStorage.getItem(k);
|
4517
|
+
if (item) {
|
4518
|
+
try {
|
4519
|
+
return JSON.parse(item);
|
4520
|
+
}
|
4521
|
+
catch (e) {
|
4522
|
+
return undefined;
|
4523
|
+
}
|
4524
|
+
}
|
4525
|
+
else {
|
4526
|
+
return undefined;
|
4527
|
+
}
|
4528
|
+
};
|
4529
|
+
StorageUtils.cutLocalStorageJsonItem = function (k, window) {
|
4530
|
+
var item = StorageUtils.getLocalStorageJsonItem(k, window);
|
4531
|
+
StorageUtils.removeLocalStorageItem(k, window);
|
4532
|
+
return item;
|
4533
|
+
};
|
4534
|
+
StorageUtils.clearLocalStorage = function (window) {
|
4535
|
+
window.localStorage.clear();
|
4536
|
+
};
|
4537
|
+
return StorageUtils;
|
4538
|
+
}());
|
4539
|
+
|
4172
4540
|
exports.AllCheckedValidatorArray = AllCheckedValidatorArray;
|
4173
4541
|
exports.AllUnCheckedValidatorArray = AllUnCheckedValidatorArray;
|
4174
4542
|
exports.Appender = Appender;
|
@@ -4220,7 +4588,8 @@ exports.NodeUtils = NodeUtils;
|
|
4220
4588
|
exports.NonPassValidator = NonPassValidator;
|
4221
4589
|
exports.NotEmptyValidator = NotEmptyValidator;
|
4222
4590
|
exports.NotRegExpTestValidator = NotRegExpTestValidator;
|
4223
|
-
exports.
|
4591
|
+
exports.OperatorExecuter = OperatorExecuter;
|
4592
|
+
exports.OperatorExecuterAttrRequire = OperatorExecuterAttrRequire;
|
4224
4593
|
exports.PassValidator = PassValidator;
|
4225
4594
|
exports.PathRouter = PathRouter;
|
4226
4595
|
exports.RandomUtils = RandomUtils;
|