dom-render 1.0.95 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DomRender.d.ts +1 -1
- package/DomRender.js +3 -3
- package/DomRenderProxy.js +24 -30
- package/README.MD +41 -0
- package/components/ComponentSet.d.ts +1 -1
- package/configs/Config.d.ts +1 -1
- package/configs/TargetAttr.d.ts +1 -1
- package/configs/TargetElement.d.ts +1 -1
- package/css/parse/index.d.ts +1 -0
- package/css/parse/index.js +512 -0
- package/css/stringify/compiler.d.ts +32 -0
- package/css/stringify/compiler.js +40 -0
- package/css/stringify/compress.d.ts +75 -0
- package/css/stringify/compress.js +156 -0
- package/css/stringify/identity.d.ts +85 -0
- package/css/stringify/identity.js +194 -0
- package/css/stringify/index.d.ts +14 -0
- package/css/stringify/index.js +44 -0
- package/dist/bundle.js +1138 -385
- package/events/EventManager.js +27 -27
- package/iterators/Range.d.ts +1 -0
- package/iterators/Range.js +15 -0
- package/messenger/Messenger.d.ts +4 -4
- package/operators/Dr.js +2 -2
- package/operators/DrAppender.js +5 -3
- package/operators/DrFor.js +5 -3
- package/operators/DrForOf.js +5 -3
- package/operators/DrForm.js +12 -12
- package/operators/DrIf.js +5 -3
- package/operators/DrInnerHTML.js +2 -2
- package/operators/DrInnerText.js +2 -2
- package/operators/DrPre.js +4 -2
- package/operators/DrRepeat.js +5 -3
- package/operators/DrTargetAttr.js +4 -2
- package/operators/DrTargetElement.js +5 -3
- package/operators/DrThis.js +2 -2
- package/operators/{DrDictionary.d.ts → DrThisProperty.d.ts} +1 -2
- package/operators/{DrDictionary.js → DrThisProperty.js} +19 -42
- package/operators/OperatorExecuter.d.ts +5 -5
- package/operators/OperatorExecuter.js +2 -2
- package/operators/OperatorExecuterAttrRequire.js +1 -1
- package/package.json +3 -3
- package/rawsets/AttrInitCallBack.d.ts +1 -1
- package/rawsets/Attrs.d.ts +4 -3
- package/rawsets/CreatorMetaData.d.ts +1 -1
- package/rawsets/ElementInitCallBack.d.ts +1 -1
- package/rawsets/RawSet.d.ts +19 -7
- package/rawsets/RawSet.js +144 -73
- package/rawsets/RawSetOperatorType.d.ts +3 -0
- package/rawsets/RawSetOperatorType.js +7 -0
- package/rawsets/Render.d.ts +1 -1
- package/routers/Router.d.ts +1 -1
- package/routers/Router.js +1 -1
- package/utils/dom/DomUtils.d.ts +1 -1
- package/utils/node/NodeUtils.d.ts +1 -1
- package/utils/script/ScriptUtils.js +2 -2
- package/utils/storage/StorageUtils.d.ts +7 -0
- package/utils/storage/StorageUtils.js +39 -0
- package/utils/string/StringUtils.d.ts +1 -0
- package/utils/string/StringUtils.js +17 -0
- package/validators/EmptyValidator.js +2 -2
- package/validators/NotEmptyValidator.js +2 -2
- package/validators/ValidMultipleValidator.d.ts +1 -1
- package/validators/Validator.d.ts +2 -2
- package/validators/ValidatorArray.d.ts +1 -1
package/dist/bundle.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
try{if(!exports){exports = {};} }catch(e){var exports = {}};
|
4
4
|
|
5
|
-
|
5
|
+
/*! *****************************************************************************
|
6
6
|
Copyright (c) Microsoft Corporation.
|
7
7
|
|
8
8
|
Permission to use, copy, modify, and/or distribute this software for any
|
@@ -16,8 +16,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
16
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
17
17
|
PERFORMANCE OF THIS SOFTWARE.
|
18
18
|
***************************************************************************** */
|
19
|
-
/* global Reflect, Promise */
|
20
19
|
|
20
|
+
/* global Reflect, Promise */
|
21
21
|
var extendStatics = function (d, b) {
|
22
22
|
extendStatics = Object.setPrototypeOf || {
|
23
23
|
__proto__: []
|
@@ -26,24 +26,31 @@ var extendStatics = function (d, b) {
|
|
26
26
|
} || function (d, b) {
|
27
27
|
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
28
28
|
};
|
29
|
+
|
29
30
|
return extendStatics(d, b);
|
30
31
|
};
|
32
|
+
|
31
33
|
function __extends(d, b) {
|
32
34
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
33
35
|
extendStatics(d, b);
|
36
|
+
|
34
37
|
function __() {
|
35
38
|
this.constructor = d;
|
36
39
|
}
|
40
|
+
|
37
41
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
38
42
|
}
|
39
43
|
var __assign = function () {
|
40
44
|
__assign = Object.assign || function __assign(t) {
|
41
45
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
42
46
|
s = arguments[i];
|
47
|
+
|
43
48
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
44
49
|
}
|
50
|
+
|
45
51
|
return t;
|
46
52
|
};
|
53
|
+
|
47
54
|
return __assign.apply(this, arguments);
|
48
55
|
};
|
49
56
|
function __awaiter(thisArg, _arguments, P, generator) {
|
@@ -52,6 +59,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
52
59
|
resolve(value);
|
53
60
|
});
|
54
61
|
}
|
62
|
+
|
55
63
|
return new (P || (P = Promise))(function (resolve, reject) {
|
56
64
|
function fulfilled(value) {
|
57
65
|
try {
|
@@ -60,6 +68,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
60
68
|
reject(e);
|
61
69
|
}
|
62
70
|
}
|
71
|
+
|
63
72
|
function rejected(value) {
|
64
73
|
try {
|
65
74
|
step(generator["throw"](value));
|
@@ -67,26 +76,28 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
67
76
|
reject(e);
|
68
77
|
}
|
69
78
|
}
|
79
|
+
|
70
80
|
function step(result) {
|
71
81
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
72
82
|
}
|
83
|
+
|
73
84
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
74
85
|
});
|
75
86
|
}
|
76
87
|
function __generator(thisArg, body) {
|
77
88
|
var _ = {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
},
|
83
|
-
trys: [],
|
84
|
-
ops: []
|
89
|
+
label: 0,
|
90
|
+
sent: function () {
|
91
|
+
if (t[0] & 1) throw t[1];
|
92
|
+
return t[1];
|
85
93
|
},
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
94
|
+
trys: [],
|
95
|
+
ops: []
|
96
|
+
},
|
97
|
+
f,
|
98
|
+
y,
|
99
|
+
t,
|
100
|
+
g;
|
90
101
|
return g = {
|
91
102
|
next: verb(0),
|
92
103
|
"throw": verb(1),
|
@@ -94,59 +105,78 @@ function __generator(thisArg, body) {
|
|
94
105
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
95
106
|
return this;
|
96
107
|
}), g;
|
108
|
+
|
97
109
|
function verb(n) {
|
98
110
|
return function (v) {
|
99
111
|
return step([n, v]);
|
100
112
|
};
|
101
113
|
}
|
114
|
+
|
102
115
|
function step(op) {
|
103
116
|
if (f) throw new TypeError("Generator is already executing.");
|
104
|
-
|
117
|
+
|
118
|
+
while (_) try {
|
105
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;
|
106
120
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
121
|
+
|
107
122
|
switch (op[0]) {
|
108
123
|
case 0:
|
109
124
|
case 1:
|
110
125
|
t = op;
|
111
126
|
break;
|
127
|
+
|
112
128
|
case 4:
|
113
129
|
_.label++;
|
114
130
|
return {
|
115
131
|
value: op[1],
|
116
132
|
done: false
|
117
133
|
};
|
134
|
+
|
118
135
|
case 5:
|
119
136
|
_.label++;
|
120
137
|
y = op[1];
|
121
138
|
op = [0];
|
122
139
|
continue;
|
140
|
+
|
123
141
|
case 7:
|
124
142
|
op = _.ops.pop();
|
143
|
+
|
125
144
|
_.trys.pop();
|
145
|
+
|
126
146
|
continue;
|
147
|
+
|
127
148
|
default:
|
128
149
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
129
150
|
_ = 0;
|
130
151
|
continue;
|
131
152
|
}
|
153
|
+
|
132
154
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
133
155
|
_.label = op[1];
|
134
156
|
break;
|
135
157
|
}
|
158
|
+
|
136
159
|
if (op[0] === 6 && _.label < t[1]) {
|
137
160
|
_.label = t[1];
|
138
161
|
t = op;
|
139
162
|
break;
|
140
163
|
}
|
164
|
+
|
141
165
|
if (t && _.label < t[2]) {
|
142
166
|
_.label = t[2];
|
167
|
+
|
143
168
|
_.ops.push(op);
|
169
|
+
|
144
170
|
break;
|
145
171
|
}
|
172
|
+
|
146
173
|
if (t[2]) _.ops.pop();
|
174
|
+
|
147
175
|
_.trys.pop();
|
176
|
+
|
148
177
|
continue;
|
149
178
|
}
|
179
|
+
|
150
180
|
op = body.call(thisArg, _);
|
151
181
|
} catch (e) {
|
152
182
|
op = [6, e];
|
@@ -154,6 +184,7 @@ function __generator(thisArg, body) {
|
|
154
184
|
} finally {
|
155
185
|
f = t = 0;
|
156
186
|
}
|
187
|
+
|
157
188
|
if (op[0] & 5) throw op[1];
|
158
189
|
return {
|
159
190
|
value: op[0] ? op[1] : void 0,
|
@@ -304,6 +335,23 @@ var StringUtils = /** @class */ (function () {
|
|
304
335
|
}
|
305
336
|
return usingVars;
|
306
337
|
};
|
338
|
+
StringUtils.regexExecArrayReplace = function (origin, regexpExecArrayOrRegex, replace) {
|
339
|
+
var regexpExecArrays = Array.isArray(regexpExecArrayOrRegex) ? regexpExecArrayOrRegex : StringUtils.regexExec(regexpExecArrayOrRegex, origin);
|
340
|
+
regexpExecArrays.reverse().forEach(function (it) {
|
341
|
+
var r = typeof replace === 'string' ? replace : replace(it);
|
342
|
+
origin = origin.substr(0, it.index) + origin.substr(it.index).replace(it[0], r);
|
343
|
+
});
|
344
|
+
return origin;
|
345
|
+
};
|
346
|
+
// public static regexGroups(regex: RegExp, text: string) {
|
347
|
+
// const usingVars = [];
|
348
|
+
// let varExec = regex.exec(text)
|
349
|
+
// while (varExec) {
|
350
|
+
// usingVars.push(varExec)
|
351
|
+
// varExec = regex.exec(varExec.input)
|
352
|
+
// }
|
353
|
+
// return usingVars;
|
354
|
+
// }
|
307
355
|
// public static betweenRegexpStr(start: string, end: string, data: string, flag = 'gm') {
|
308
356
|
// const startEspace = StringUtils.escapeSpecialCharacterRegExp(start);
|
309
357
|
// const reg = RegExp(`(${start}(?:(${start})??[^${startEspace}]*?${end}))`,flag);
|
@@ -359,7 +407,7 @@ var ScriptUtils = /** @class */ (function () {
|
|
359
407
|
}, new GetDetectProxy());
|
360
408
|
try {
|
361
409
|
// eslint-disable-next-line no-new-func,no-unused-expressions
|
362
|
-
Function("\"use strict\"; "
|
410
|
+
Function("\"use strict\"; " + script + "; ").bind(destUser)();
|
363
411
|
}
|
364
412
|
catch (e) {
|
365
413
|
console.error(e);
|
@@ -375,7 +423,7 @@ var ScriptUtils = /** @class */ (function () {
|
|
375
423
|
};
|
376
424
|
ScriptUtils.eval = function (script, thisTarget) {
|
377
425
|
// eslint-disable-next-line no-new-func,no-unused-expressions
|
378
|
-
return Function("\"use strict\"; "
|
426
|
+
return Function("\"use strict\"; " + script + " ").bind(thisTarget)();
|
379
427
|
};
|
380
428
|
ScriptUtils.loadElement = function (name, attribute, document) {
|
381
429
|
return new Promise(function (resolve, reject) {
|
@@ -478,10 +526,22 @@ var RangeIterator = /** @class */ (function () {
|
|
478
526
|
r = new RangeResult(this._current, false);
|
479
527
|
this._current += this._step;
|
480
528
|
}
|
529
|
+
else if (this._first < this._last && this._current === this._last) {
|
530
|
+
r = new RangeResult(this._current, false);
|
531
|
+
this._current += this._step;
|
532
|
+
}
|
481
533
|
else if (this._first > this._last && this._current > this._last) {
|
482
534
|
r = new RangeResult(this._current, false);
|
483
535
|
this._current -= this._step;
|
484
536
|
}
|
537
|
+
else if (this._first > this._last && this._current === this._last) {
|
538
|
+
r = new RangeResult(this._current, false);
|
539
|
+
this._current -= this._step;
|
540
|
+
}
|
541
|
+
else if (this._current === this._last) {
|
542
|
+
r = new RangeResult(this._current, false);
|
543
|
+
this._current -= this._step;
|
544
|
+
}
|
485
545
|
else {
|
486
546
|
r = new RangeResult(undefined, true);
|
487
547
|
}
|
@@ -500,6 +560,9 @@ var Range = /** @class */ (function () {
|
|
500
560
|
Range.prototype[Symbol.iterator] = function () {
|
501
561
|
return new RangeIterator(this.first, this.last, this.step);
|
502
562
|
};
|
563
|
+
Range.prototype.map = function (callbackfn, thisArg) {
|
564
|
+
return Array.from(this).map(callbackfn);
|
565
|
+
};
|
503
566
|
Range.range = function (first, last, step) {
|
504
567
|
if (step === void 0) { step = 1; }
|
505
568
|
if (typeof first === 'number' && last === undefined) {
|
@@ -570,21 +633,21 @@ var EventManager = /** @class */ (function () {
|
|
570
633
|
EventManager.onInitAttrName,
|
571
634
|
this.eventParam
|
572
635
|
];
|
573
|
-
this.bindScript = "\n const "
|
636
|
+
this.bindScript = "\n const " + EventManager.VALUE_VARNAME + " = this.__render.value;\n const " + EventManager.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + EventManager.RANGE_VARNAME + " = this.__render.range;\n const " + EventManager.ROUTER_VARNAME + " = this.__render.router;\n const " + EventManager.ATTRIBUTE_VARNAME + " = this.__render.attribute;\n const " + EventManager.ELEMENT_VARNAME + " = this.__render.element;\n const " + EventManager.TARGET_VARNAME + " = this.__render.target;\n const " + EventManager.EVENT_VARNAME + " = this.__render.event;\n ";
|
574
637
|
this.eventNames.forEach(function (it) {
|
575
638
|
_this.attrNames.push(EventManager.attrPrefix + 'event-' + it);
|
576
639
|
});
|
577
640
|
if (typeof window !== 'undefined') {
|
578
641
|
EventManager.WINDOW_EVENTS.forEach(function (eventName) {
|
579
642
|
window === null || window === void 0 ? void 0 : window.addEventListener(eventName, function (event) {
|
580
|
-
var targetAttr = "dr-window-event-"
|
581
|
-
document.querySelectorAll("["
|
643
|
+
var targetAttr = "dr-window-event-" + eventName;
|
644
|
+
document.querySelectorAll("[" + targetAttr + "]").forEach(function (it) {
|
582
645
|
var _a;
|
583
646
|
var script = it.getAttribute(targetAttr);
|
584
647
|
if (script) {
|
585
648
|
var obj = it.obj;
|
586
649
|
var config = (_a = obj === null || obj === void 0 ? void 0 : obj._DomRender_proxy) === null || _a === void 0 ? void 0 : _a.config;
|
587
|
-
ScriptUtils.eval(
|
650
|
+
ScriptUtils.eval(_this.bindScript + " " + script + " ", Object.assign(obj, {
|
588
651
|
__render: Object.freeze({
|
589
652
|
target: DomRenderFinalProxy.final(event.target),
|
590
653
|
element: it,
|
@@ -612,7 +675,7 @@ var EventManager = /** @class */ (function () {
|
|
612
675
|
var elements = new Set();
|
613
676
|
var addAttributes = (_b = (_a = config === null || config === void 0 ? void 0 : config.applyEvents) === null || _a === void 0 ? void 0 : _a.map(function (it) { return it.attrName; })) !== null && _b !== void 0 ? _b : [];
|
614
677
|
addAttributes.concat(this.attrNames).forEach(function (attrName) {
|
615
|
-
fragment === null || fragment === void 0 ? void 0 : fragment.querySelectorAll("["
|
678
|
+
fragment === null || fragment === void 0 ? void 0 : fragment.querySelectorAll("[" + attrName + "]").forEach(function (it) {
|
616
679
|
elements.add(it);
|
617
680
|
});
|
618
681
|
});
|
@@ -648,7 +711,7 @@ var EventManager = /** @class */ (function () {
|
|
648
711
|
this.procAttr(childNodes, EventManager.normalAttrMapAttrName, function (it, attribute) {
|
649
712
|
var map = new Map(JSON.parse(attribute));
|
650
713
|
map.forEach(function (v, k) {
|
651
|
-
var data = ScriptUtils.eval("const $element = this.element; return "
|
714
|
+
var data = ScriptUtils.eval("const $element = this.element; return " + v + " ", Object.assign(obj, {
|
652
715
|
__render: Object.freeze({
|
653
716
|
element: it,
|
654
717
|
attribute: DomUtils.getAttributeToObject(it)
|
@@ -667,7 +730,7 @@ var EventManager = /** @class */ (function () {
|
|
667
730
|
this.procAttr(childNodes, EventManager.valueLinkAttrName, function (it, varName) {
|
668
731
|
if (varName) {
|
669
732
|
var ownerVariablePathName = it.getAttribute(EventManager.ownerVariablePathAttrName);
|
670
|
-
var mapScript_1 = it.getAttribute(
|
733
|
+
var mapScript_1 = it.getAttribute(EventManager.valueLinkAttrName + ":map");
|
671
734
|
// const inMapScript = it.getAttribute(`${valueLinkAttrName}:in-map`);
|
672
735
|
var bindObj_1 = obj;
|
673
736
|
if (ownerVariablePathName) {
|
@@ -678,7 +741,7 @@ var EventManager = /** @class */ (function () {
|
|
678
741
|
if (typeof getValue === 'function' && getValue) {
|
679
742
|
var setValue = it.value;
|
680
743
|
if (mapScript_1) {
|
681
|
-
setValue = ScriptUtils.eval(
|
744
|
+
setValue = ScriptUtils.eval(_this.getBindScript(config) + " return " + mapScript_1, Object.assign(bindObj_1, { __render: Object.freeze(__assign({ element: it, target: bindObj_1, range: Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
|
682
745
|
}
|
683
746
|
getValue(setValue);
|
684
747
|
// 여기서 value가 먼저냐 value-link가 먼저냐 선을 정해야되는거네...
|
@@ -686,14 +749,14 @@ var EventManager = /** @class */ (function () {
|
|
686
749
|
else if (getValue) {
|
687
750
|
var setValue = getValue;
|
688
751
|
if (mapScript_1) {
|
689
|
-
setValue = ScriptUtils.eval(
|
752
|
+
setValue = ScriptUtils.eval(_this.getBindScript(config) + " return " + mapScript_1, Object.assign(bindObj_1, { __render: Object.freeze(__assign({ element: it, target: bindObj_1, range: Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
|
690
753
|
}
|
691
754
|
it.value = setValue;
|
692
755
|
}
|
693
756
|
it.addEventListener('input', function (event) {
|
694
757
|
var value = it.value;
|
695
758
|
if (mapScript_1) {
|
696
|
-
value = ScriptUtils.eval(
|
759
|
+
value = ScriptUtils.eval(_this.getBindScript(config) + " return " + mapScript_1, Object.assign(bindObj_1, {
|
697
760
|
__render: Object.freeze(__assign({ event: event, element: it, attribute: DomUtils.getAttributeToObject(it), target: event.target, range: Range.range, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables))
|
698
761
|
}));
|
699
762
|
}
|
@@ -713,7 +776,7 @@ var EventManager = /** @class */ (function () {
|
|
713
776
|
script = 'return ' + script;
|
714
777
|
}
|
715
778
|
if (script) {
|
716
|
-
ScriptUtils.eval(
|
779
|
+
ScriptUtils.eval(_this.getBindScript(config) + "; " + script + " ", Object.assign(obj, {
|
717
780
|
__render: Object.freeze(__assign({ element: it, attribute: DomUtils.getAttributeToObject(it) }, config === null || config === void 0 ? void 0 : config.eventVariables))
|
718
781
|
}));
|
719
782
|
// console.log('onInit--->', obj, varName, it)
|
@@ -744,20 +807,20 @@ var EventManager = /** @class */ (function () {
|
|
744
807
|
if (ownerVariablePathName) {
|
745
808
|
bindObj = ScriptUtils.evalReturn(ownerVariablePathName, obj);
|
746
809
|
}
|
747
|
-
var mapScript = it.getAttribute(
|
810
|
+
var mapScript = it.getAttribute(EventManager.valueLinkAttrName + ":map");
|
748
811
|
if (attribute && attribute === varName) {
|
749
812
|
var getValue = _this.getValue(obj, attribute, bindObj);
|
750
813
|
if (typeof getValue === 'function' && getValue) {
|
751
814
|
var setValue = it.value;
|
752
815
|
if (mapScript) {
|
753
|
-
setValue = ScriptUtils.eval(
|
816
|
+
setValue = ScriptUtils.eval(_this.getBindScript(config) + " return " + mapScript, Object.assign(bindObj, { __render: Object.freeze(__assign({ element: it, target: bindObj, range: Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
|
754
817
|
}
|
755
818
|
getValue(setValue);
|
756
819
|
}
|
757
820
|
else { // if (getValue !== undefined && getValue !== null)
|
758
821
|
var setValue = getValue;
|
759
822
|
if (mapScript) {
|
760
|
-
setValue = ScriptUtils.eval(
|
823
|
+
setValue = ScriptUtils.eval(_this.getBindScript(config) + " return " + mapScript, Object.assign(bindObj, { __render: Object.freeze(__assign({ element: it, target: bindObj, range: Range.range, value: setValue, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables)) }));
|
761
824
|
}
|
762
825
|
it.value = setValue;
|
763
826
|
}
|
@@ -770,7 +833,7 @@ var EventManager = /** @class */ (function () {
|
|
770
833
|
script = 'return ' + script;
|
771
834
|
}
|
772
835
|
if (EventManager.isUsingThisVar(script, varName) || varName === undefined) {
|
773
|
-
var data = ScriptUtils.eval("const $element = this.__render.element; "
|
836
|
+
var data = ScriptUtils.eval("const $element = this.__render.element; " + script + " ", Object.assign(obj, {
|
774
837
|
__render: Object.freeze({
|
775
838
|
element: it,
|
776
839
|
attribute: DomUtils.getAttributeToObject(it)
|
@@ -822,7 +885,7 @@ var EventManager = /** @class */ (function () {
|
|
822
885
|
script = 'return ' + script;
|
823
886
|
}
|
824
887
|
if (EventManager.isUsingThisVar(script, varName) || varName === undefined) {
|
825
|
-
var data = ScriptUtils.eval("const $element = this.__render.element; "
|
888
|
+
var data = ScriptUtils.eval("const $element = this.__render.element; " + script + " ", Object.assign(obj, {
|
826
889
|
__render: Object.freeze({
|
827
890
|
element: it,
|
828
891
|
attribute: DomUtils.getAttributeToObject(it)
|
@@ -851,7 +914,7 @@ var EventManager = /** @class */ (function () {
|
|
851
914
|
script = 'return ' + script;
|
852
915
|
}
|
853
916
|
if (EventManager.isUsingThisVar(script, varName) || varName === undefined) {
|
854
|
-
var data = ScriptUtils.eval("const $element = this.element; "
|
917
|
+
var data = ScriptUtils.eval("const $element = this.element; " + script + " ", Object.assign(obj, {
|
855
918
|
__render: Object.freeze({
|
856
919
|
element: it,
|
857
920
|
attribute: DomUtils.getAttributeToObject(it)
|
@@ -886,7 +949,7 @@ var EventManager = /** @class */ (function () {
|
|
886
949
|
var isUsing = EventManager.isUsingThisVar(v, varName);
|
887
950
|
// console.log('---isUsing--> varName:', varName, 'k:', k, 'v:', v, 'isUsing:', isUsing);
|
888
951
|
if (isUsing) {
|
889
|
-
var data = ScriptUtils.eval("const $element = this.element; return "
|
952
|
+
var data = ScriptUtils.eval("const $element = this.element; return " + v + " ", Object.assign(obj, {
|
890
953
|
__render: Object.freeze({
|
891
954
|
element: it,
|
892
955
|
attribute: DomUtils.getAttributeToObject(it)
|
@@ -906,15 +969,15 @@ var EventManager = /** @class */ (function () {
|
|
906
969
|
var script = attribute;
|
907
970
|
it.addEventListener(eventName, function (event) {
|
908
971
|
var filter = true;
|
909
|
-
var filterScript = it.getAttribute(
|
972
|
+
var filterScript = it.getAttribute(attr + ":filter");
|
910
973
|
var thisTarget = Object.assign(obj, {
|
911
974
|
__render: Object.freeze(__assign({ event: event, element: it, target: event.target, range: Range.range, attribute: DomUtils.getAttributeToObject(it), router: config === null || config === void 0 ? void 0 : config.router, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj) }, config === null || config === void 0 ? void 0 : config.eventVariables))
|
912
975
|
});
|
913
976
|
if (filterScript) {
|
914
|
-
filter = ScriptUtils.eval(
|
977
|
+
filter = ScriptUtils.eval(_this.getBindScript(config) + " return " + filterScript, thisTarget);
|
915
978
|
}
|
916
979
|
if (filter) {
|
917
|
-
ScriptUtils.eval(
|
980
|
+
ScriptUtils.eval(_this.getBindScript(config) + " " + script + " ", thisTarget);
|
918
981
|
}
|
919
982
|
});
|
920
983
|
});
|
@@ -937,7 +1000,7 @@ var EventManager = /** @class */ (function () {
|
|
937
1000
|
});
|
938
1001
|
bind.split(',').forEach(function (eventName) {
|
939
1002
|
it.addEventListener(eventName.trim(), function (event) {
|
940
|
-
ScriptUtils.eval("const $params = this.__render.params; "
|
1003
|
+
ScriptUtils.eval("const $params = this.__render.params; " + _this.getBindScript(config) + " " + script_1 + " ", Object.assign(obj, {
|
941
1004
|
__render: Object.freeze(__assign({ event: event, element: it, attribute: DomUtils.getAttributeToObject(it), target: event.target, range: Range.range, scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj), params: params_1 }, config === null || config === void 0 ? void 0 : config.eventVariables))
|
942
1005
|
}));
|
943
1006
|
});
|
@@ -958,7 +1021,7 @@ var EventManager = /** @class */ (function () {
|
|
958
1021
|
if (it.nodeType === 1) {
|
959
1022
|
var e = it;
|
960
1023
|
sets.add(e);
|
961
|
-
e.querySelectorAll("["
|
1024
|
+
e.querySelectorAll("[" + attrName + "]").forEach(function (it) {
|
962
1025
|
sets.add(it);
|
963
1026
|
});
|
964
1027
|
}
|
@@ -981,7 +1044,7 @@ var EventManager = /** @class */ (function () {
|
|
981
1044
|
};
|
982
1045
|
EventManager.prototype.setValue = function (obj, name, value) {
|
983
1046
|
name = name.replaceAll('this.', 'this.this.');
|
984
|
-
ScriptUtils.eval(
|
1047
|
+
ScriptUtils.eval(name + " = this.value;", {
|
985
1048
|
this: obj,
|
986
1049
|
value: value
|
987
1050
|
});
|
@@ -995,7 +1058,7 @@ var EventManager = /** @class */ (function () {
|
|
995
1058
|
}
|
996
1059
|
EventManager.VARNAMES.forEach(function (it) {
|
997
1060
|
// raws = raws!.replace(RegExp(it.replace('$', '\\$'), 'g'), `this?.___${it}`);
|
998
|
-
raws = raws.replace(RegExp(it.replace('$', '\\$'), 'g'), "this.___"
|
1061
|
+
raws = raws.replace(RegExp(it.replace('$', '\\$'), 'g'), "this.___" + it);
|
999
1062
|
});
|
1000
1063
|
var variablePaths = ScriptUtils.getVariablePaths(raws !== null && raws !== void 0 ? raws : '');
|
1001
1064
|
return variablePaths.has(varName);
|
@@ -1020,10 +1083,10 @@ var EventManager = /** @class */ (function () {
|
|
1020
1083
|
if (config === null || config === void 0 ? void 0 : config.eventVariables) {
|
1021
1084
|
var bindScript = Object.entries(config.eventVariables).filter(function (_a) {
|
1022
1085
|
var key = _a[0]; _a[1];
|
1023
|
-
return !_this.bindScript.includes("const "
|
1086
|
+
return !_this.bindScript.includes("const " + key);
|
1024
1087
|
}).map(function (_a) {
|
1025
1088
|
var key = _a[0]; _a[1];
|
1026
|
-
return "const "
|
1089
|
+
return "const " + key + " = this.__render." + key + ";";
|
1027
1090
|
}).join(';');
|
1028
1091
|
return this.bindScript + '' + bindScript;
|
1029
1092
|
}
|
@@ -1090,7 +1153,7 @@ var OperatorExecuter = /** @class */ (function () {
|
|
1090
1153
|
}
|
1091
1154
|
r = attrValue;
|
1092
1155
|
if (r && this.startingExecute) {
|
1093
|
-
r = ScriptUtils.eval(" "
|
1156
|
+
r = ScriptUtils.eval(" " + this.render.bindScript + "; return " + attrValue, Object.assign(this.source.obj, { __render: this.render }));
|
1094
1157
|
}
|
1095
1158
|
if ((_c = this.source.operatorAround) === null || _c === void 0 ? void 0 : _c.before) {
|
1096
1159
|
r = (_d = this.source.operatorAround) === null || _d === void 0 ? void 0 : _d.before(r, this);
|
@@ -1110,8 +1173,10 @@ var OperatorExecuter = /** @class */ (function () {
|
|
1110
1173
|
var DrPre = /** @class */ (function (_super) {
|
1111
1174
|
__extends(DrPre, _super);
|
1112
1175
|
function DrPre(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1176
|
+
var _this = this;
|
1113
1177
|
source.operatorAround = undefined;
|
1114
|
-
|
1178
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack) || this;
|
1179
|
+
return _this;
|
1115
1180
|
}
|
1116
1181
|
DrPre.prototype.execute = function (value) {
|
1117
1182
|
return __awaiter(this, void 0, void 0, function () {
|
@@ -1160,7 +1225,7 @@ var Dr = /** @class */ (function (_super) {
|
|
1160
1225
|
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1161
1226
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1162
1227
|
newTemp = this.source.config.window.document.createElement('temp');
|
1163
|
-
ScriptUtils.eval("\n "
|
1228
|
+
ScriptUtils.eval("\n " + this.render.bindScript + "\n const n = $element.cloneNode(true);\n var destIt = " + 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, {
|
1164
1229
|
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1165
1230
|
}));
|
1166
1231
|
RawSet.drVarDecoding(newTemp, vars);
|
@@ -1181,8 +1246,10 @@ var Dr = /** @class */ (function (_super) {
|
|
1181
1246
|
var DrIf = /** @class */ (function (_super) {
|
1182
1247
|
__extends(DrIf, _super);
|
1183
1248
|
function DrIf(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1249
|
+
var _this = this;
|
1184
1250
|
source.operatorAround = undefined;
|
1185
|
-
|
1251
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1252
|
+
return _this;
|
1186
1253
|
}
|
1187
1254
|
DrIf.prototype.executeAttrRequire = function (attr) {
|
1188
1255
|
var _a, _b, _c, _d;
|
@@ -1193,7 +1260,7 @@ var DrIf = /** @class */ (function (_super) {
|
|
1193
1260
|
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1194
1261
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1195
1262
|
newTemp = this.source.config.window.document.createElement('temp');
|
1196
|
-
keepgoing = ScriptUtils.eval("\n "
|
1263
|
+
keepgoing = ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '') + "\n if ($rawset.data === (" + attr + ")) {\n return false;\n }\n $rawset.data = " + 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 = " + 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 " + ((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '') + ";\n return true;\n ", Object.assign(this.source.obj, {
|
1197
1264
|
__render: Object.freeze(__assign({ fag: newTemp, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1198
1265
|
}));
|
1199
1266
|
// TODO: 뭐지?? 지워야되는거 아닌가?
|
@@ -1245,7 +1312,7 @@ var DrThis = /** @class */ (function (_super) {
|
|
1245
1312
|
RawSet.destroy(this.rawSet.data.obj, [], this.source.config, destroyOptions);
|
1246
1313
|
}
|
1247
1314
|
this.rawSet.data = attr;
|
1248
|
-
return [4 /*yield*/, RawSet.drThisCreate(this.rawSet, this.elementSource.element, ""
|
1315
|
+
return [4 /*yield*/, RawSet.drThisCreate(this.rawSet, this.elementSource.element, "" + this.elementSource.attrs.drThis + (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)];
|
1249
1316
|
case 1:
|
1250
1317
|
componentBody = _j.sent();
|
1251
1318
|
this.returnContainer.fag.append(componentBody);
|
@@ -1616,9 +1683,9 @@ var DrForm = /** @class */ (function (_super) {
|
|
1616
1683
|
var _this = this;
|
1617
1684
|
return __generator(this, function (_c) {
|
1618
1685
|
RawSet.drFormOtherMoveAttr(this.elementSource.element, 'name', 'temp-name', this.source.config);
|
1619
|
-
data = ScriptUtils.evalReturn(""
|
1686
|
+
data = ScriptUtils.evalReturn("" + attr, this.source.obj);
|
1620
1687
|
childs = Array.from(this.elementSource.element.querySelectorAll('[name]'));
|
1621
|
-
fromName = ScriptUtils.evalReturn((_a = this.elementSource.element.getAttribute(
|
1688
|
+
fromName = ScriptUtils.evalReturn((_a = this.elementSource.element.getAttribute(RawSet.DR_FORM_NAME + ":name")) !== null && _a !== void 0 ? _a : '', this.source.obj);
|
1622
1689
|
thisName = fromName !== null && fromName !== void 0 ? fromName : this.elementSource.element.getAttribute('name');
|
1623
1690
|
// // 자기자신이 Input 대상일때
|
1624
1691
|
if (childs.length <= 0 && thisName) {
|
@@ -1631,32 +1698,32 @@ var DrForm = /** @class */ (function (_super) {
|
|
1631
1698
|
}
|
1632
1699
|
childs.forEach(function (it) {
|
1633
1700
|
var _a, _b, _c, _d, _e;
|
1634
|
-
var eventName = (_a = it.getAttribute(
|
1635
|
-
var validatorName = it.getAttribute(
|
1701
|
+
var eventName = (_a = it.getAttribute(RawSet.DR_FORM_NAME + ":event")) !== null && _a !== void 0 ? _a : 'change';
|
1702
|
+
var validatorName = it.getAttribute(RawSet.DR_FORM_NAME + ":validator");
|
1636
1703
|
var attrEventName = EventManager.attrPrefix + 'event-' + eventName;
|
1637
|
-
var varpath = (_c = ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute(
|
1704
|
+
var varpath = (_c = ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute(RawSet.DR_FORM_NAME + ":name")) !== null && _b !== void 0 ? _b : '', _this.source.obj)) !== null && _c !== void 0 ? _c : it.getAttribute('name');
|
1638
1705
|
if (varpath != null) {
|
1639
1706
|
if (validatorName) {
|
1640
|
-
ScriptUtils.eval("\n "
|
1707
|
+
ScriptUtils.eval("\n " + _this.render.bindScript + "\n const validator = typeof " + validatorName + " ==='function' ? new " + validatorName + "() : " + validatorName + ";\n " + attr + "['" + varpath + "'] = validator;\n ", Object.assign(_this.source.obj, {
|
1641
1708
|
__render: Object.freeze(__assign({ drStripOption: _this.elementSource.attrs.drStripOption }, _this.render))
|
1642
1709
|
}));
|
1643
1710
|
}
|
1644
|
-
varpath =
|
1645
|
-
var data_1 = ScriptUtils.evalReturn(""
|
1711
|
+
varpath = attr + "['" + varpath + "']";
|
1712
|
+
var data_1 = ScriptUtils.evalReturn("" + varpath, _this.source.obj);
|
1646
1713
|
if (data_1 instanceof ValidatorArray) {
|
1647
|
-
it.setAttribute(attrEventName,
|
1714
|
+
it.setAttribute(attrEventName, varpath + ".setArrayValue($target, $target.value, $event); " + ((_d = it.getAttribute(attrEventName)) !== null && _d !== void 0 ? _d : '') + ";");
|
1648
1715
|
data_1.addValidator(it.value, it);
|
1649
1716
|
}
|
1650
1717
|
else if (data_1 instanceof Validator) {
|
1651
1718
|
// varpath += (varpath ? '.value' : 'value');
|
1652
1719
|
// varpath = drAttr.drForm + '.' + varpath;
|
1653
1720
|
// it.setAttribute(attrEventName, `${varpath} = $target.value; ${target}=$target; ${event}=$event;`);
|
1654
|
-
it.setAttribute(attrEventName,
|
1721
|
+
it.setAttribute(attrEventName, varpath + ".set($target.value, $target, $event); " + ((_e = it.getAttribute(attrEventName)) !== null && _e !== void 0 ? _e : '') + ";");
|
1655
1722
|
data_1.setTarget(it);
|
1656
1723
|
data_1.value = it.value;
|
1657
1724
|
}
|
1658
1725
|
else {
|
1659
|
-
it.setAttribute(attrEventName,
|
1726
|
+
it.setAttribute(attrEventName, varpath + " = $target.value;");
|
1660
1727
|
}
|
1661
1728
|
}
|
1662
1729
|
});
|
@@ -1681,7 +1748,7 @@ var DrInnerText = /** @class */ (function (_super) {
|
|
1681
1748
|
var _d;
|
1682
1749
|
return __generator(this, function (_e) {
|
1683
1750
|
newTemp = this.source.config.window.document.createElement('temp');
|
1684
|
-
ScriptUtils.eval(" \n "
|
1751
|
+
ScriptUtils.eval(" \n " + this.render.bindScript + "\n const n = $element.cloneNode(true); \n " + ((_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : '') + "\n n.innerText = " + 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 " + ((_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : '') + "\n ", Object.assign(this.source.obj, {
|
1685
1752
|
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, fag: newTemp }, this.render))
|
1686
1753
|
}));
|
1687
1754
|
tempalte = this.source.config.window.document.createElement('template');
|
@@ -1709,7 +1776,7 @@ var DrInnerHTML = /** @class */ (function (_super) {
|
|
1709
1776
|
var _d;
|
1710
1777
|
return __generator(this, function (_e) {
|
1711
1778
|
newTemp = this.source.config.window.document.createElement('temp');
|
1712
|
-
ScriptUtils.eval("\n "
|
1779
|
+
ScriptUtils.eval("\n " + this.render.bindScript + "\n const n = $element.cloneNode(true);\n " + ((_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : '') + "\n n.innerHTML = " + 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 " + ((_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : '') + "\n ", Object.assign(this.source.obj, {
|
1713
1780
|
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, fag: newTemp }, this.render
|
1714
1781
|
// eslint-disable-next-line no-use-before-define
|
1715
1782
|
))
|
@@ -1730,8 +1797,10 @@ var DrInnerHTML = /** @class */ (function (_super) {
|
|
1730
1797
|
var DrFor = /** @class */ (function (_super) {
|
1731
1798
|
__extends(DrFor, _super);
|
1732
1799
|
function DrFor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1800
|
+
var _this = this;
|
1733
1801
|
source.operatorAround = undefined;
|
1734
|
-
|
1802
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1803
|
+
return _this;
|
1735
1804
|
}
|
1736
1805
|
DrFor.prototype.executeAttrRequire = function (attr) {
|
1737
1806
|
var _a, _b, _c, _d;
|
@@ -1742,7 +1811,7 @@ var DrFor = /** @class */ (function (_super) {
|
|
1742
1811
|
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1743
1812
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1744
1813
|
newTemp = this.source.config.window.document.createElement('temp');
|
1745
|
-
ScriptUtils.eval("\n "
|
1814
|
+
ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '') + "\n for(" + attr + ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = " + 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 " + ((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '') + "\n ", Object.assign(this.source.obj, {
|
1746
1815
|
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1747
1816
|
}));
|
1748
1817
|
RawSet.drVarDecoding(newTemp, vars);
|
@@ -1763,8 +1832,10 @@ var DrFor = /** @class */ (function (_super) {
|
|
1763
1832
|
var DrForOf = /** @class */ (function (_super) {
|
1764
1833
|
__extends(DrForOf, _super);
|
1765
1834
|
function DrForOf(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1835
|
+
var _this = this;
|
1766
1836
|
source.operatorAround = undefined;
|
1767
|
-
|
1837
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1838
|
+
return _this;
|
1768
1839
|
}
|
1769
1840
|
DrForOf.prototype.executeAttrRequire = function (attr) {
|
1770
1841
|
var _a, _b, _c, _d;
|
@@ -1775,7 +1846,7 @@ var DrForOf = /** @class */ (function (_super) {
|
|
1775
1846
|
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1776
1847
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1777
1848
|
newTemp = this.source.config.window.document.createElement('temp');
|
1778
|
-
ScriptUtils.eval("\n "
|
1849
|
+
ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '') + "\n var i = 0; \n const forOf = " + attr + ";\n const forOfStr = `" + 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('" + 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] = '" + 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 " + ((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '') + "\n ", Object.assign(this.source.obj, {
|
1779
1850
|
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
1780
1851
|
// eslint-disable-next-line no-use-before-define
|
1781
1852
|
))
|
@@ -1799,8 +1870,10 @@ var DrForOf = /** @class */ (function (_super) {
|
|
1799
1870
|
var DrAppender = /** @class */ (function (_super) {
|
1800
1871
|
__extends(DrAppender, _super);
|
1801
1872
|
function DrAppender(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1873
|
+
var _this = this;
|
1802
1874
|
source.operatorAround = undefined;
|
1803
|
-
|
1875
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1876
|
+
return _this;
|
1804
1877
|
}
|
1805
1878
|
DrAppender.prototype.executeAttrRequire = function (attr) {
|
1806
1879
|
var _a, _b, _c, _d;
|
@@ -1811,7 +1884,7 @@ var DrAppender = /** @class */ (function (_super) {
|
|
1811
1884
|
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1812
1885
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1813
1886
|
newTemp = this.source.config.window.document.createElement('temp');
|
1814
|
-
ScriptUtils.eval("\n try{\n "
|
1887
|
+
ScriptUtils.eval("\n try{\n " + this.render.bindScript + "\n " + ((_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', '" + this.elementSource.attrs.drAppender + " && " + 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', '" + this.elementSource.attrs.drAppender + "[' + (" + this.elementSource.attrs.drAppender + ".length-1) + ']');\n n.setAttribute('dr-next', '" + this.elementSource.attrs.drAppender + ",' + " + this.elementSource.attrs.drAppender + ".length);\n ifWrap.append(n);\n this.__render.fag.append(ifWrap);\n " + ((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '') + "\n }catch(e){}\n ", Object.assign(this.source.obj, {
|
1815
1888
|
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
1816
1889
|
// eslint-disable-next-line no-use-before-define
|
1817
1890
|
))
|
@@ -1835,8 +1908,10 @@ var DrAppender = /** @class */ (function (_super) {
|
|
1835
1908
|
var DrRepeat = /** @class */ (function (_super) {
|
1836
1909
|
__extends(DrRepeat, _super);
|
1837
1910
|
function DrRepeat(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1911
|
+
var _this = this;
|
1838
1912
|
source.operatorAround = undefined;
|
1839
|
-
|
1913
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1914
|
+
return _this;
|
1840
1915
|
}
|
1841
1916
|
DrRepeat.prototype.executeAttrRequire = function (attr) {
|
1842
1917
|
var _a, _b, _c, _d;
|
@@ -1847,7 +1922,7 @@ var DrRepeat = /** @class */ (function (_super) {
|
|
1847
1922
|
itRandom = RawSet.drItOtherEncoding(this.elementSource.element);
|
1848
1923
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1849
1924
|
newTemp = this.source.config.window.document.createElement('temp');
|
1850
|
-
ScriptUtils.eval("\n "
|
1925
|
+
ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '') + "\n var i = 0; \n const repeat = " + attr + ";\n const repeatStr = `" + attr + "`;\n let range = repeat;\n if (typeof repeat === 'number') {\n range = " + 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 " + ((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '') + "\n ", Object.assign(this.source.obj, {
|
1851
1926
|
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
1852
1927
|
}));
|
1853
1928
|
RawSet.drVarDecoding(newTemp, vars);
|
@@ -1868,8 +1943,10 @@ var DrRepeat = /** @class */ (function (_super) {
|
|
1868
1943
|
var DrTargetElement = /** @class */ (function (_super) {
|
1869
1944
|
__extends(DrTargetElement, _super);
|
1870
1945
|
function DrTargetElement(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
1946
|
+
var _this = this;
|
1871
1947
|
source.operatorAround = undefined;
|
1872
|
-
|
1948
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
1949
|
+
return _this;
|
1873
1950
|
}
|
1874
1951
|
DrTargetElement.prototype.execute = function () {
|
1875
1952
|
var _a, _b, _c, _d;
|
@@ -1893,7 +1970,7 @@ var DrTargetElement = /** @class */ (function (_super) {
|
|
1893
1970
|
if (detectAction_1 && render_1) {
|
1894
1971
|
this.rawSet.detect = {
|
1895
1972
|
action: function () {
|
1896
|
-
var script = "var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; "
|
1973
|
+
var script = "var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; " + detectAction_1 + " ";
|
1897
1974
|
ScriptUtils.eval(script, Object.assign(_this.source.obj, {
|
1898
1975
|
__render: render_1
|
1899
1976
|
}));
|
@@ -1923,8 +2000,10 @@ var DrTargetElement = /** @class */ (function (_super) {
|
|
1923
2000
|
var DrTargetAttr = /** @class */ (function (_super) {
|
1924
2001
|
__extends(DrTargetAttr, _super);
|
1925
2002
|
function DrTargetAttr(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
2003
|
+
var _this = this;
|
1926
2004
|
source.operatorAround = undefined;
|
1927
|
-
|
2005
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
2006
|
+
return _this;
|
1928
2007
|
}
|
1929
2008
|
DrTargetAttr.prototype.execute = function () {
|
1930
2009
|
var _a, _b, _c, _d;
|
@@ -1975,13 +2054,15 @@ exports.RawSetType = void 0;
|
|
1975
2054
|
RawSetType["UNKOWN"] = "UNKOWN";
|
1976
2055
|
})(exports.RawSetType || (exports.RawSetType = {}));
|
1977
2056
|
|
1978
|
-
var
|
1979
|
-
__extends(
|
1980
|
-
function
|
2057
|
+
var DrThisProperty = /** @class */ (function (_super) {
|
2058
|
+
__extends(DrThisProperty, _super);
|
2059
|
+
function DrThisProperty(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
2060
|
+
var _this = this;
|
1981
2061
|
source.operatorAround = undefined;
|
1982
|
-
|
2062
|
+
_this = _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
2063
|
+
return _this;
|
1983
2064
|
}
|
1984
|
-
|
2065
|
+
DrThisProperty.prototype.executeAttrRequire = function (attr) {
|
1985
2066
|
var _a, _b, _c, _d, _e;
|
1986
2067
|
return __awaiter(this, void 0, void 0, function () {
|
1987
2068
|
var itRandom, vars, newTemp, dictionaryKey, tempalte, rr;
|
@@ -1991,14 +2072,14 @@ var DrDictionary = /** @class */ (function (_super) {
|
|
1991
2072
|
vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
1992
2073
|
newTemp = this.source.config.window.document.createElement('temp');
|
1993
2074
|
ScriptUtils.evalReturn(attr, this.source.obj);
|
1994
|
-
dictionaryKey = (_b = this.elementSource.attrs.
|
2075
|
+
dictionaryKey = (_b = this.elementSource.attrs.drKeyOption) !== null && _b !== void 0 ? _b : '';
|
1995
2076
|
// console.log('--->', attr, dictionaryKey)
|
1996
2077
|
// if (!(dictioanry instanceof Dictionary)) {
|
1997
2078
|
// return ExecuteState.STOP;
|
1998
2079
|
// }
|
1999
2080
|
// await new Promise(resolve => setTimeout(resolve, 1000));
|
2000
2081
|
// console.log('!!!!!!!!!!!!!!', this.rawSet);
|
2001
|
-
ScriptUtils.eval("\n "
|
2082
|
+
ScriptUtils.eval("\n " + this.render.bindScript + "\n " + ((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '') + "\n var i = 0; \n const dictionary = " + attr + ";\n const dictionaryKey = '" + dictionaryKey + "';\n const dictionaryStr = `" + attr + "`.trim();\n // console.log('----@#!@#@!#', this.__render.oldChild);\n if (dictionary) {\n for(const it in dictionary) {\n var destIt = dictionaryStr + '[\"' + it + '\"]';\n const n = this.__render.element.cloneNode(true);\n n.setAttribute('dr-this', destIt);\n n.setAttribute('dr-key', it);\n // n.setAttribute('dr-dictionary-key', it);\n this.__render.fag.append(n);\n i++;\n }\n this.__render.rawset.point.start.setAttribute('dr-has-keys',Object.keys(dictionary).join(','));\n }\n " + ((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '') + "\n ", Object.assign(this.source.obj, {
|
2002
2083
|
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render))
|
2003
2084
|
}));
|
2004
2085
|
RawSet.drVarDecoding(newTemp, vars);
|
@@ -2014,29 +2095,7 @@ var DrDictionary = /** @class */ (function (_super) {
|
|
2014
2095
|
});
|
2015
2096
|
});
|
2016
2097
|
};
|
2017
|
-
|
2018
|
-
var _a, _b, _c;
|
2019
|
-
var next = rawSet.point.start.nextSibling;
|
2020
|
-
var oldChild = new Map();
|
2021
|
-
var currentKey = '';
|
2022
|
-
while (next) {
|
2023
|
-
if (next === rawSet.point.end) {
|
2024
|
-
break;
|
2025
|
-
}
|
2026
|
-
var dictionaryKey = (_b = (_a = next).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, 'dictionary-key');
|
2027
|
-
if (dictionaryKey) {
|
2028
|
-
currentKey = dictionaryKey;
|
2029
|
-
oldChild.set(dictionaryKey, []);
|
2030
|
-
}
|
2031
|
-
// console.log('next-------->', currentKey, next);
|
2032
|
-
if (currentKey) {
|
2033
|
-
(_c = oldChild.get(currentKey)) === null || _c === void 0 ? void 0 : _c.push(next);
|
2034
|
-
}
|
2035
|
-
next = next.nextSibling;
|
2036
|
-
}
|
2037
|
-
return oldChild;
|
2038
|
-
};
|
2039
|
-
DrDictionary.append = function (obj, fullPath, key, rawSet, config) {
|
2098
|
+
DrThisProperty.append = function (obj, fullPath, key, rawSet, config) {
|
2040
2099
|
var _this = this;
|
2041
2100
|
var _a, _b;
|
2042
2101
|
var genNode = config.window.document.importNode(rawSet.fragment, true);
|
@@ -2045,33 +2104,634 @@ var DrDictionary = /** @class */ (function (_super) {
|
|
2045
2104
|
for (var _i = 0, _c = Array.from(genNode.childNodes.values()); _i < _c.length; _i++) {
|
2046
2105
|
var cNode = _c[_i];
|
2047
2106
|
var element = cNode.cloneNode(true);
|
2048
|
-
element.removeAttribute(
|
2049
|
-
element.setAttribute(
|
2107
|
+
element.removeAttribute(RawSet.DR_THIS_PROPERTY_NAME);
|
2108
|
+
element.setAttribute(RawSet.DR_THIS_NAME, "this." + fullPath);
|
2109
|
+
element.setAttribute(RawSet.DR_KEY_OPTIONNAME, key);
|
2050
2110
|
// rawSet.point.end.after(element);
|
2051
2111
|
var fg = config.window.document.createDocumentFragment();
|
2052
2112
|
fg.append(element);
|
2053
2113
|
rawSets.push.apply(rawSets, RawSet.checkPointCreates(fg, obj, config));
|
2054
2114
|
rawSet.point.end.before(fg);
|
2055
2115
|
var start = rawSet.point.start;
|
2056
|
-
var keys = (_b = (_a = start.getAttribute(
|
2116
|
+
var keys = (_b = (_a = start.getAttribute(RawSet.DR_HAS_KEYS_OPTIONNAME)) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
2057
2117
|
keys.push(key);
|
2058
|
-
start.setAttribute(
|
2118
|
+
start.setAttribute(RawSet.DR_HAS_KEYS_OPTIONNAME, keys.join(','));
|
2059
2119
|
rawSets.forEach(function (it) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
2060
2120
|
switch (_a.label) {
|
2061
2121
|
case 0: return [4 /*yield*/, it.render(obj, config)];
|
2062
2122
|
case 1: return [2 /*return*/, _a.sent()];
|
2063
2123
|
}
|
2064
2124
|
}); }); });
|
2065
|
-
// console.log('WWW', fg, Array.from(fg.childNodes));
|
2066
|
-
// console.log('--------------------------rawSets', rawSets);
|
2067
2125
|
}
|
2068
2126
|
return rawSets;
|
2069
|
-
// rawSet.
|
2070
|
-
// rawSet.point.end.before()
|
2071
2127
|
};
|
2072
|
-
return
|
2128
|
+
return DrThisProperty;
|
2073
2129
|
}(OperatorExecuterAttrRequire));
|
2074
2130
|
|
2131
|
+
exports.RawSetOperatorType = void 0;
|
2132
|
+
(function (RawSetOperatorType) {
|
2133
|
+
RawSetOperatorType["DR_THIS_PROPERTY"] = "this-property";
|
2134
|
+
})(exports.RawSetOperatorType || (exports.RawSetOperatorType = {}));
|
2135
|
+
|
2136
|
+
// http://www.w3.org/TR/CSS21/grammar.html
|
2137
|
+
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
2138
|
+
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
2139
|
+
function cssParse (css, options) {
|
2140
|
+
options = options || {};
|
2141
|
+
/**
|
2142
|
+
* Positional.
|
2143
|
+
*/
|
2144
|
+
|
2145
|
+
var lineno = 1;
|
2146
|
+
var column = 1;
|
2147
|
+
/**
|
2148
|
+
* Update lineno and column based on `str`.
|
2149
|
+
*/
|
2150
|
+
|
2151
|
+
function updatePosition(str) {
|
2152
|
+
var lines = str.match(/\n/g);
|
2153
|
+
if (lines) lineno += lines.length;
|
2154
|
+
var i = str.lastIndexOf('\n');
|
2155
|
+
column = ~i ? str.length - i : column + str.length;
|
2156
|
+
}
|
2157
|
+
/**
|
2158
|
+
* Mark position and patch `node.position`.
|
2159
|
+
*/
|
2160
|
+
|
2161
|
+
|
2162
|
+
function position() {
|
2163
|
+
var start = {
|
2164
|
+
line: lineno,
|
2165
|
+
column: column
|
2166
|
+
};
|
2167
|
+
return function (node) {
|
2168
|
+
node.position = new Position(start);
|
2169
|
+
whitespace();
|
2170
|
+
return node;
|
2171
|
+
};
|
2172
|
+
}
|
2173
|
+
/**
|
2174
|
+
* Store position information for a node
|
2175
|
+
*/
|
2176
|
+
|
2177
|
+
|
2178
|
+
function Position(start) {
|
2179
|
+
this.start = start;
|
2180
|
+
this.end = {
|
2181
|
+
line: lineno,
|
2182
|
+
column: column
|
2183
|
+
};
|
2184
|
+
this.source = options.source;
|
2185
|
+
}
|
2186
|
+
/**
|
2187
|
+
* Non-enumerable source string
|
2188
|
+
*/
|
2189
|
+
|
2190
|
+
|
2191
|
+
Position.prototype.content = css;
|
2192
|
+
/**
|
2193
|
+
* Error `msg`.
|
2194
|
+
*/
|
2195
|
+
|
2196
|
+
var errorsList = [];
|
2197
|
+
|
2198
|
+
function error(msg) {
|
2199
|
+
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);
|
2200
|
+
err.reason = msg;
|
2201
|
+
err.filename = options.source;
|
2202
|
+
err.line = lineno;
|
2203
|
+
err.column = column;
|
2204
|
+
err.source = css;
|
2205
|
+
|
2206
|
+
if (options.silent) {
|
2207
|
+
errorsList.push(err);
|
2208
|
+
} else {
|
2209
|
+
throw err;
|
2210
|
+
}
|
2211
|
+
}
|
2212
|
+
/**
|
2213
|
+
* Parse stylesheet.
|
2214
|
+
*/
|
2215
|
+
|
2216
|
+
|
2217
|
+
function stylesheet() {
|
2218
|
+
var rulesList = rules();
|
2219
|
+
return {
|
2220
|
+
type: 'stylesheet',
|
2221
|
+
stylesheet: {
|
2222
|
+
source: options.source,
|
2223
|
+
rules: rulesList,
|
2224
|
+
parsingErrors: errorsList
|
2225
|
+
}
|
2226
|
+
};
|
2227
|
+
}
|
2228
|
+
/**
|
2229
|
+
* Opening brace.
|
2230
|
+
*/
|
2231
|
+
|
2232
|
+
|
2233
|
+
function open() {
|
2234
|
+
return match(/^{\s*/);
|
2235
|
+
}
|
2236
|
+
/**
|
2237
|
+
* Closing brace.
|
2238
|
+
*/
|
2239
|
+
|
2240
|
+
|
2241
|
+
function close() {
|
2242
|
+
return match(/^}/);
|
2243
|
+
}
|
2244
|
+
/**
|
2245
|
+
* Parse ruleset.
|
2246
|
+
*/
|
2247
|
+
|
2248
|
+
|
2249
|
+
function rules() {
|
2250
|
+
var node;
|
2251
|
+
var rules = [];
|
2252
|
+
whitespace();
|
2253
|
+
comments(rules);
|
2254
|
+
|
2255
|
+
while (css.length && css.charAt(0) != '}' && (node = atrule() || rule())) {
|
2256
|
+
if (node !== false) {
|
2257
|
+
rules.push(node);
|
2258
|
+
comments(rules);
|
2259
|
+
}
|
2260
|
+
}
|
2261
|
+
|
2262
|
+
return rules;
|
2263
|
+
}
|
2264
|
+
/**
|
2265
|
+
* Match `re` and return captures.
|
2266
|
+
*/
|
2267
|
+
|
2268
|
+
|
2269
|
+
function match(re) {
|
2270
|
+
var m = re.exec(css);
|
2271
|
+
if (!m) return;
|
2272
|
+
var str = m[0];
|
2273
|
+
updatePosition(str);
|
2274
|
+
css = css.slice(str.length);
|
2275
|
+
return m;
|
2276
|
+
}
|
2277
|
+
/**
|
2278
|
+
* Parse whitespace.
|
2279
|
+
*/
|
2280
|
+
|
2281
|
+
|
2282
|
+
function whitespace() {
|
2283
|
+
match(/^\s*/);
|
2284
|
+
}
|
2285
|
+
/**
|
2286
|
+
* Parse comments;
|
2287
|
+
*/
|
2288
|
+
|
2289
|
+
|
2290
|
+
function comments(rules) {
|
2291
|
+
var c;
|
2292
|
+
rules = rules || [];
|
2293
|
+
|
2294
|
+
while (c = comment()) {
|
2295
|
+
if (c !== false) {
|
2296
|
+
rules.push(c);
|
2297
|
+
}
|
2298
|
+
}
|
2299
|
+
|
2300
|
+
return rules;
|
2301
|
+
}
|
2302
|
+
/**
|
2303
|
+
* Parse comment.
|
2304
|
+
*/
|
2305
|
+
|
2306
|
+
|
2307
|
+
function comment() {
|
2308
|
+
var pos = position();
|
2309
|
+
if ('/' != css.charAt(0) || '*' != css.charAt(1)) return;
|
2310
|
+
var i = 2;
|
2311
|
+
|
2312
|
+
while ("" != css.charAt(i) && ('*' != css.charAt(i) || '/' != css.charAt(i + 1))) ++i;
|
2313
|
+
|
2314
|
+
i += 2;
|
2315
|
+
|
2316
|
+
if ("" === css.charAt(i - 1)) {
|
2317
|
+
return error('End of comment missing');
|
2318
|
+
}
|
2319
|
+
|
2320
|
+
var str = css.slice(2, i - 2);
|
2321
|
+
column += 2;
|
2322
|
+
updatePosition(str);
|
2323
|
+
css = css.slice(i);
|
2324
|
+
column += 2;
|
2325
|
+
return pos({
|
2326
|
+
type: 'comment',
|
2327
|
+
comment: str
|
2328
|
+
});
|
2329
|
+
}
|
2330
|
+
/**
|
2331
|
+
* Parse selector.
|
2332
|
+
*/
|
2333
|
+
|
2334
|
+
|
2335
|
+
function selector() {
|
2336
|
+
var m = match(/^([^{]+)/);
|
2337
|
+
if (!m) return;
|
2338
|
+
/* @fix Remove all comments from selectors
|
2339
|
+
* http://ostermiller.org/findcomment.html */
|
2340
|
+
|
2341
|
+
return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) {
|
2342
|
+
return m.replace(/,/g, '\u200C');
|
2343
|
+
}).split(/\s*(?![^(]*\)),\s*/).map(function (s) {
|
2344
|
+
return s.replace(/\u200C/g, ',');
|
2345
|
+
});
|
2346
|
+
}
|
2347
|
+
/**
|
2348
|
+
* Parse declaration.
|
2349
|
+
*/
|
2350
|
+
|
2351
|
+
|
2352
|
+
function declaration() {
|
2353
|
+
var pos = position(); // prop
|
2354
|
+
|
2355
|
+
var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
|
2356
|
+
if (!prop) return;
|
2357
|
+
prop = trim(prop[0]); // :
|
2358
|
+
|
2359
|
+
if (!match(/^:\s*/)) return error("property missing ':'"); // val
|
2360
|
+
|
2361
|
+
var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
|
2362
|
+
var ret = pos({
|
2363
|
+
type: 'declaration',
|
2364
|
+
property: prop.replace(commentre, ''),
|
2365
|
+
value: val ? trim(val[0]).replace(commentre, '') : ''
|
2366
|
+
}); // ;
|
2367
|
+
|
2368
|
+
match(/^[;\s]*/);
|
2369
|
+
return ret;
|
2370
|
+
}
|
2371
|
+
/**
|
2372
|
+
* Parse declarations.
|
2373
|
+
*/
|
2374
|
+
|
2375
|
+
|
2376
|
+
function declarations() {
|
2377
|
+
var decls = [];
|
2378
|
+
if (!open()) return error("missing '{'");
|
2379
|
+
comments(decls); // declarations
|
2380
|
+
|
2381
|
+
var decl;
|
2382
|
+
|
2383
|
+
while (decl = declaration()) {
|
2384
|
+
if (decl !== false) {
|
2385
|
+
decls.push(decl);
|
2386
|
+
comments(decls);
|
2387
|
+
}
|
2388
|
+
}
|
2389
|
+
|
2390
|
+
if (!close()) return error("missing '}'");
|
2391
|
+
return decls;
|
2392
|
+
}
|
2393
|
+
/**
|
2394
|
+
* Parse keyframe.
|
2395
|
+
*/
|
2396
|
+
|
2397
|
+
|
2398
|
+
function keyframe() {
|
2399
|
+
var m;
|
2400
|
+
var vals = [];
|
2401
|
+
var pos = position();
|
2402
|
+
|
2403
|
+
while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
|
2404
|
+
vals.push(m[1]);
|
2405
|
+
match(/^,\s*/);
|
2406
|
+
}
|
2407
|
+
|
2408
|
+
if (!vals.length) return;
|
2409
|
+
return pos({
|
2410
|
+
type: 'keyframe',
|
2411
|
+
values: vals,
|
2412
|
+
declarations: declarations()
|
2413
|
+
});
|
2414
|
+
}
|
2415
|
+
/**
|
2416
|
+
* Parse keyframes.
|
2417
|
+
*/
|
2418
|
+
|
2419
|
+
|
2420
|
+
function atkeyframes() {
|
2421
|
+
var pos = position();
|
2422
|
+
var m = match(/^@([-\w]+)?keyframes\s*/);
|
2423
|
+
if (!m) return;
|
2424
|
+
var vendor = m[1]; // identifier
|
2425
|
+
|
2426
|
+
var m = match(/^([-\w]+)\s*/);
|
2427
|
+
if (!m) return error("@keyframes missing name");
|
2428
|
+
var name = m[1];
|
2429
|
+
if (!open()) return error("@keyframes missing '{'");
|
2430
|
+
var frame;
|
2431
|
+
var frames = comments();
|
2432
|
+
|
2433
|
+
while (frame = keyframe()) {
|
2434
|
+
frames.push(frame);
|
2435
|
+
frames = frames.concat(comments());
|
2436
|
+
}
|
2437
|
+
|
2438
|
+
if (!close()) return error("@keyframes missing '}'");
|
2439
|
+
return pos({
|
2440
|
+
type: 'keyframes',
|
2441
|
+
name: name,
|
2442
|
+
vendor: vendor,
|
2443
|
+
keyframes: frames
|
2444
|
+
});
|
2445
|
+
}
|
2446
|
+
/**
|
2447
|
+
* Parse supports.
|
2448
|
+
*/
|
2449
|
+
|
2450
|
+
|
2451
|
+
function atsupports() {
|
2452
|
+
var pos = position();
|
2453
|
+
var m = match(/^@supports *([^{]+)/);
|
2454
|
+
if (!m) return;
|
2455
|
+
var supports = trim(m[1]);
|
2456
|
+
if (!open()) return error("@supports missing '{'");
|
2457
|
+
var style = comments().concat(rules());
|
2458
|
+
if (!close()) return error("@supports missing '}'");
|
2459
|
+
return pos({
|
2460
|
+
type: 'supports',
|
2461
|
+
supports: supports,
|
2462
|
+
rules: style
|
2463
|
+
});
|
2464
|
+
}
|
2465
|
+
/**
|
2466
|
+
* Parse host.
|
2467
|
+
*/
|
2468
|
+
|
2469
|
+
|
2470
|
+
function athost() {
|
2471
|
+
var pos = position();
|
2472
|
+
var m = match(/^@host\s*/);
|
2473
|
+
if (!m) return;
|
2474
|
+
if (!open()) return error("@host missing '{'");
|
2475
|
+
var style = comments().concat(rules());
|
2476
|
+
if (!close()) return error("@host missing '}'");
|
2477
|
+
return pos({
|
2478
|
+
type: 'host',
|
2479
|
+
rules: style
|
2480
|
+
});
|
2481
|
+
}
|
2482
|
+
/**
|
2483
|
+
* Parse media.
|
2484
|
+
*/
|
2485
|
+
|
2486
|
+
|
2487
|
+
function atmedia() {
|
2488
|
+
var pos = position();
|
2489
|
+
var m = match(/^@media *([^{]+)/);
|
2490
|
+
if (!m) return;
|
2491
|
+
var media = trim(m[1]);
|
2492
|
+
if (!open()) return error("@media missing '{'");
|
2493
|
+
var style = comments().concat(rules());
|
2494
|
+
if (!close()) return error("@media missing '}'");
|
2495
|
+
return pos({
|
2496
|
+
type: 'media',
|
2497
|
+
media: media,
|
2498
|
+
rules: style
|
2499
|
+
});
|
2500
|
+
}
|
2501
|
+
/**
|
2502
|
+
* Parse custom-media.
|
2503
|
+
*/
|
2504
|
+
|
2505
|
+
|
2506
|
+
function atcustommedia() {
|
2507
|
+
var pos = position();
|
2508
|
+
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
|
2509
|
+
if (!m) return;
|
2510
|
+
return pos({
|
2511
|
+
type: 'custom-media',
|
2512
|
+
name: trim(m[1]),
|
2513
|
+
media: trim(m[2])
|
2514
|
+
});
|
2515
|
+
}
|
2516
|
+
/**
|
2517
|
+
* Parse paged media.
|
2518
|
+
*/
|
2519
|
+
|
2520
|
+
|
2521
|
+
function atpage() {
|
2522
|
+
var pos = position();
|
2523
|
+
var m = match(/^@page */);
|
2524
|
+
if (!m) return;
|
2525
|
+
var sel = selector() || [];
|
2526
|
+
if (!open()) return error("@page missing '{'");
|
2527
|
+
var decls = comments(); // declarations
|
2528
|
+
|
2529
|
+
var decl;
|
2530
|
+
|
2531
|
+
while (decl = declaration()) {
|
2532
|
+
decls.push(decl);
|
2533
|
+
decls = decls.concat(comments());
|
2534
|
+
}
|
2535
|
+
|
2536
|
+
if (!close()) return error("@page missing '}'");
|
2537
|
+
return pos({
|
2538
|
+
type: 'page',
|
2539
|
+
selectors: sel,
|
2540
|
+
declarations: decls
|
2541
|
+
});
|
2542
|
+
}
|
2543
|
+
/**
|
2544
|
+
* Parse document.
|
2545
|
+
*/
|
2546
|
+
|
2547
|
+
|
2548
|
+
function atdocument() {
|
2549
|
+
var pos = position();
|
2550
|
+
var m = match(/^@([-\w]+)?document *([^{]+)/);
|
2551
|
+
if (!m) return;
|
2552
|
+
var vendor = trim(m[1]);
|
2553
|
+
var doc = trim(m[2]);
|
2554
|
+
if (!open()) return error("@document missing '{'");
|
2555
|
+
var style = comments().concat(rules());
|
2556
|
+
if (!close()) return error("@document missing '}'");
|
2557
|
+
return pos({
|
2558
|
+
type: 'document',
|
2559
|
+
document: doc,
|
2560
|
+
vendor: vendor,
|
2561
|
+
rules: style
|
2562
|
+
});
|
2563
|
+
}
|
2564
|
+
/**
|
2565
|
+
* Parse font-face.
|
2566
|
+
*/
|
2567
|
+
|
2568
|
+
|
2569
|
+
function atfontface() {
|
2570
|
+
var pos = position();
|
2571
|
+
var m = match(/^@font-face\s*/);
|
2572
|
+
if (!m) return;
|
2573
|
+
if (!open()) return error("@font-face missing '{'");
|
2574
|
+
var decls = comments(); // declarations
|
2575
|
+
|
2576
|
+
var decl;
|
2577
|
+
|
2578
|
+
while (decl = declaration()) {
|
2579
|
+
decls.push(decl);
|
2580
|
+
decls = decls.concat(comments());
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
if (!close()) return error("@font-face missing '}'");
|
2584
|
+
return pos({
|
2585
|
+
type: 'font-face',
|
2586
|
+
declarations: decls
|
2587
|
+
});
|
2588
|
+
}
|
2589
|
+
/**
|
2590
|
+
* Parse import
|
2591
|
+
*/
|
2592
|
+
|
2593
|
+
|
2594
|
+
var atimport = _compileAtrule('import');
|
2595
|
+
/**
|
2596
|
+
* Parse charset
|
2597
|
+
*/
|
2598
|
+
|
2599
|
+
|
2600
|
+
var atcharset = _compileAtrule('charset');
|
2601
|
+
/**
|
2602
|
+
* Parse namespace
|
2603
|
+
*/
|
2604
|
+
|
2605
|
+
|
2606
|
+
var atnamespace = _compileAtrule('namespace');
|
2607
|
+
/**
|
2608
|
+
* Parse non-block at-rules
|
2609
|
+
*/
|
2610
|
+
|
2611
|
+
|
2612
|
+
function _compileAtrule(name) {
|
2613
|
+
var re = new RegExp('^@' + name + '\\s*([^;]+);');
|
2614
|
+
return function () {
|
2615
|
+
var pos = position();
|
2616
|
+
var m = match(re);
|
2617
|
+
if (!m) return;
|
2618
|
+
var ret = {
|
2619
|
+
type: name
|
2620
|
+
};
|
2621
|
+
ret[name] = m[1].trim();
|
2622
|
+
return pos(ret);
|
2623
|
+
};
|
2624
|
+
}
|
2625
|
+
/**
|
2626
|
+
* Parse at rule.
|
2627
|
+
*/
|
2628
|
+
|
2629
|
+
|
2630
|
+
function atrule() {
|
2631
|
+
if (css[0] != '@') return;
|
2632
|
+
return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface();
|
2633
|
+
}
|
2634
|
+
/**
|
2635
|
+
* Parse rule.
|
2636
|
+
*/
|
2637
|
+
|
2638
|
+
|
2639
|
+
function rule() {
|
2640
|
+
var pos = position();
|
2641
|
+
var sel = selector();
|
2642
|
+
if (!sel) return error('selector missing');
|
2643
|
+
comments();
|
2644
|
+
return pos({
|
2645
|
+
type: 'rule',
|
2646
|
+
selectors: sel,
|
2647
|
+
declarations: declarations()
|
2648
|
+
});
|
2649
|
+
}
|
2650
|
+
|
2651
|
+
return addParent(stylesheet());
|
2652
|
+
}
|
2653
|
+
/**
|
2654
|
+
* Trim `str`.
|
2655
|
+
*/
|
2656
|
+
|
2657
|
+
function trim(str) {
|
2658
|
+
return str ? str.replace(/^\s+|\s+$/g, '') : '';
|
2659
|
+
}
|
2660
|
+
/**
|
2661
|
+
* Adds non-enumerable parent node reference to each node.
|
2662
|
+
*/
|
2663
|
+
|
2664
|
+
|
2665
|
+
function addParent(obj, parent) {
|
2666
|
+
var isNode = obj && typeof obj.type === 'string';
|
2667
|
+
var childParent = isNode ? obj : parent;
|
2668
|
+
|
2669
|
+
for (var k in obj) {
|
2670
|
+
var value = obj[k];
|
2671
|
+
|
2672
|
+
if (Array.isArray(value)) {
|
2673
|
+
value.forEach(function (v) {
|
2674
|
+
addParent(v, childParent);
|
2675
|
+
});
|
2676
|
+
} else if (value && typeof value === 'object') {
|
2677
|
+
addParent(value, childParent);
|
2678
|
+
}
|
2679
|
+
}
|
2680
|
+
|
2681
|
+
if (isNode) {
|
2682
|
+
Object.defineProperty(obj, 'parent', {
|
2683
|
+
configurable: true,
|
2684
|
+
writable: true,
|
2685
|
+
enumerable: false,
|
2686
|
+
value: parent || null
|
2687
|
+
});
|
2688
|
+
}
|
2689
|
+
|
2690
|
+
return obj;
|
2691
|
+
}
|
2692
|
+
|
2693
|
+
/**
|
2694
|
+
* Module dependencies.
|
2695
|
+
*/
|
2696
|
+
var Compressed = require('./compress');
|
2697
|
+
|
2698
|
+
var Identity = require('./identity');
|
2699
|
+
/**
|
2700
|
+
* Stringfy the given AST `node`.
|
2701
|
+
*
|
2702
|
+
* Options:
|
2703
|
+
*
|
2704
|
+
* - `compress` space-optimized output
|
2705
|
+
* - `sourcemap` return an object with `.code` and `.map`
|
2706
|
+
*
|
2707
|
+
* @param {Object} node
|
2708
|
+
* @param {Object} [options]
|
2709
|
+
* @return {String}
|
2710
|
+
* @api public
|
2711
|
+
*/
|
2712
|
+
|
2713
|
+
|
2714
|
+
function cssStringify (node, options) {
|
2715
|
+
options = options || {};
|
2716
|
+
var compiler = options.compress ? new Compressed(options) : new Identity(options); // source maps
|
2717
|
+
// if (options.sourcemap) {
|
2718
|
+
// var sourcemaps = require('./source-map-support');
|
2719
|
+
// sourcemaps(compiler);
|
2720
|
+
//
|
2721
|
+
// var code = compiler.compile(node);
|
2722
|
+
// compiler.applySourceMaps();
|
2723
|
+
//
|
2724
|
+
// var map = options.sourcemap === 'generator'
|
2725
|
+
// ? compiler.map
|
2726
|
+
// : compiler.map.toJSON();
|
2727
|
+
//
|
2728
|
+
// return { code: code, map: map };
|
2729
|
+
// }
|
2730
|
+
|
2731
|
+
var code = compiler.compile(node);
|
2732
|
+
return code;
|
2733
|
+
}
|
2734
|
+
|
2075
2735
|
var RawSet = /** @class */ (function () {
|
2076
2736
|
function RawSet(uuid, type, point, fragment, detect, data) {
|
2077
2737
|
this.uuid = uuid;
|
@@ -2080,6 +2740,7 @@ var RawSet = /** @class */ (function () {
|
|
2080
2740
|
this.fragment = fragment;
|
2081
2741
|
this.detect = detect;
|
2082
2742
|
this.data = data;
|
2743
|
+
point.start.rawSet = this;
|
2083
2744
|
// console.log('rawset constructor->', (this.point.node as Element).getAttributeNames());
|
2084
2745
|
}
|
2085
2746
|
Object.defineProperty(RawSet.prototype, "isConnected", {
|
@@ -2096,7 +2757,7 @@ var RawSet = /** @class */ (function () {
|
|
2096
2757
|
var _a, _b, _c;
|
2097
2758
|
var script = '';
|
2098
2759
|
if (cNode.nodeType === Node.TEXT_NODE) {
|
2099
|
-
script = "`"
|
2760
|
+
script = "`" + ((_a = cNode.textContent) !== null && _a !== void 0 ? _a : '') + "`";
|
2100
2761
|
// console.log('???????', script)
|
2101
2762
|
}
|
2102
2763
|
else if (cNode.nodeType === Node.ELEMENT_NODE) {
|
@@ -2125,11 +2786,11 @@ var RawSet = /** @class */ (function () {
|
|
2125
2786
|
EventManager.VARNAMES.forEach(function (it) {
|
2126
2787
|
// script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), `this?.___${it}`);
|
2127
2788
|
// script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), `this.___${it}`);
|
2128
|
-
script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), "this.___"
|
2789
|
+
script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), "this.___" + it);
|
2129
2790
|
// console.log('scripts-->', script)
|
2130
2791
|
});
|
2131
2792
|
// console.log('----------', script);
|
2132
|
-
Array.from(ScriptUtils.getVariablePaths(script)).filter(function (it) { return !it.startsWith("___"
|
2793
|
+
Array.from(ScriptUtils.getVariablePaths(script)).filter(function (it) { return !it.startsWith("___" + EventManager.SCRIPTS_VARNAME); }).forEach(function (it) { return usingTriggerVariables.add(it); });
|
2133
2794
|
}
|
2134
2795
|
});
|
2135
2796
|
// console.log('usingTriggerVariable----------->', usingTriggerVariables)
|
@@ -2166,7 +2827,7 @@ var RawSet = /** @class */ (function () {
|
|
2166
2827
|
range: Range.range,
|
2167
2828
|
element: cNode,
|
2168
2829
|
attribute: attribute,
|
2169
|
-
bindScript: "\n const "
|
2830
|
+
bindScript: "\n const " + EventManager.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + EventManager.RAWSET_VARNAME + " = this.__render.rawset;\n const " + EventManager.ELEMENT_VARNAME + " = this.__render.element;\n const " + EventManager.ATTRIBUTE_VARNAME + " = this.__render.attribute;\n const " + EventManager.RANGE_VARNAME + " = this.__render.range;\n const " + EventManager.ROUTER_VARNAME + " = this.__render.router;\n "
|
2170
2831
|
// eslint-disable-next-line no-use-before-define
|
2171
2832
|
});
|
2172
2833
|
fag = config.window.document.createDocumentFragment();
|
@@ -2175,13 +2836,13 @@ var RawSet = /** @class */ (function () {
|
|
2175
2836
|
runText = RawSet.exporesionGrouops(textContent)[0][1];
|
2176
2837
|
newNode = void 0;
|
2177
2838
|
if (textContent === null || textContent === void 0 ? void 0 : textContent.startsWith('#')) {
|
2178
|
-
r = ScriptUtils.eval(
|
2839
|
+
r = ScriptUtils.eval(__render.bindScript + " return " + runText, Object.assign(obj, { __render: __render }));
|
2179
2840
|
template = config.window.document.createElement('template');
|
2180
2841
|
template.innerHTML = r;
|
2181
2842
|
newNode = template.content;
|
2182
2843
|
}
|
2183
2844
|
else {
|
2184
|
-
r = ScriptUtils.eval(
|
2845
|
+
r = ScriptUtils.eval(__render.bindScript + " return " + runText, Object.assign(obj, { __render: __render }));
|
2185
2846
|
newNode = config.window.document.createTextNode(r);
|
2186
2847
|
}
|
2187
2848
|
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, cNode);
|
@@ -2199,7 +2860,7 @@ var RawSet = /** @class */ (function () {
|
|
2199
2860
|
drIf: this.getAttributeAndDelete(element, RawSet.DR_IF_NAME),
|
2200
2861
|
drFor: this.getAttributeAndDelete(element, RawSet.DR_FOR_NAME),
|
2201
2862
|
drForOf: this.getAttributeAndDelete(element, RawSet.DR_FOR_OF_NAME),
|
2202
|
-
|
2863
|
+
drThisProperty: this.getAttributeAndDelete(element, RawSet.DR_THIS_PROPERTY_NAME),
|
2203
2864
|
drAppender: this.getAttributeAndDelete(element, RawSet.DR_APPENDER_NAME),
|
2204
2865
|
drRepeat: this.getAttributeAndDelete(element, RawSet.DR_REPEAT_NAME),
|
2205
2866
|
drThis: this.getAttributeAndDelete(element, RawSet.DR_THIS_NAME),
|
@@ -2215,7 +2876,7 @@ var RawSet = /** @class */ (function () {
|
|
2215
2876
|
drCompleteOption: this.getAttributeAndDelete(element, RawSet.DR_COMPLETE_OPTIONNAME),
|
2216
2877
|
drStripOption: this.getAttributeAndDelete(element, RawSet.DR_STRIP_OPTIONNAME),
|
2217
2878
|
drDestroyOption: this.getAttributeAndDelete(element, RawSet.DR_DESTROY_OPTIONNAME),
|
2218
|
-
|
2879
|
+
drKeyOption: this.getAttributeAndDelete(element, RawSet.DR_KEY_OPTIONNAME)
|
2219
2880
|
};
|
2220
2881
|
drAttrs.push(drAttr);
|
2221
2882
|
operators = [
|
@@ -2228,7 +2889,7 @@ var RawSet = /** @class */ (function () {
|
|
2228
2889
|
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 }),
|
2229
2890
|
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 }),
|
2230
2891
|
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 }),
|
2231
|
-
new
|
2892
|
+
new DrThisProperty(this, __render, { raws: raws, fag: fag }, { element: element, attrName: RawSet.DR_THIS_PROPERTY_NAME, attr: drAttr.drThisProperty, attrs: drAttr }, { config: config, obj: obj, operatorAround: (_l = config.operatorAround) === null || _l === void 0 ? void 0 : _l.drThisProperty }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2232
2893
|
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: (_m = config.operatorAround) === null || _m === void 0 ? void 0 : _m.drAppender }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2233
2894
|
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: (_o = config.operatorAround) === null || _o === void 0 ? void 0 : _o.drRepeat }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
2234
2895
|
new DrTargetElement(this, __render, { raws: raws, fag: fag }, { element: element, attrs: drAttr }, { config: config, obj: obj }, { onAttrInitCallBacks: onAttrInitCallBacks, onElementInitCallBacks: onElementInitCallBacks, onThisComponentSetCallBacks: onThisComponentSetCallBacks }),
|
@@ -2266,11 +2927,12 @@ var RawSet = /** @class */ (function () {
|
|
2266
2927
|
fag: genNode,
|
2267
2928
|
scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
|
2268
2929
|
});
|
2269
|
-
ScriptUtils.eval("\n const "
|
2930
|
+
ScriptUtils.eval("\n const " + EventManager.FAG_VARNAME + " = this.__render.fag;\n const " + EventManager.SCRIPTS_VARNAME + " = this.__render.scripts;\n const " + EventManager.RAWSET_VARNAME + " = this.__render.rawset;\n " + it.drCompleteOption, Object.assign(obj, { __render: render }));
|
2270
2931
|
}
|
2271
2932
|
});
|
2272
2933
|
// 중요 style isolation 나중에 :scope로 대체 가능할듯.
|
2273
|
-
|
2934
|
+
// 2023.9.4일 없앰 style 처음들어올때 처리하는걸로 바꿈
|
2935
|
+
// RawSet.generateStyleSheetsLocal(config);
|
2274
2936
|
for (_1 = 0, onThisComponentSetCallBacks_1 = onThisComponentSetCallBacks; _1 < onThisComponentSetCallBacks_1.length; _1++) {
|
2275
2937
|
it_1 = onThisComponentSetCallBacks_1[_1];
|
2276
2938
|
(_q = (_p = it_1.obj) === null || _p === void 0 ? void 0 : _p.onInitRender) === null || _q === void 0 ? void 0 : _q.call(_p);
|
@@ -2281,7 +2943,7 @@ var RawSet = /** @class */ (function () {
|
|
2281
2943
|
oninit = it_2.targetElement.__render.element.getAttribute(RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME);
|
2282
2944
|
param = [];
|
2283
2945
|
if (oninit) {
|
2284
|
-
script =
|
2946
|
+
script = it_2.targetElement.__render.renderScript + " return " + oninit + " ";
|
2285
2947
|
param = ScriptUtils.eval(script, Object.assign(obj, {
|
2286
2948
|
__render: it_2.targetElement.__render
|
2287
2949
|
}));
|
@@ -2320,8 +2982,13 @@ var RawSet = /** @class */ (function () {
|
|
2320
2982
|
});
|
2321
2983
|
});
|
2322
2984
|
};
|
2323
|
-
|
2324
|
-
|
2985
|
+
/**
|
2986
|
+
* @deprecated
|
2987
|
+
* @param config
|
2988
|
+
*/
|
2989
|
+
RawSet.generateStyleSheetsLocal = function (config) {
|
2990
|
+
// console.log('config.window.document.styleSheets---------', config.window.document.styleSheets);
|
2991
|
+
Array.from(config.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) {
|
2325
2992
|
var _a;
|
2326
2993
|
var styleElement = it.ownerNode;
|
2327
2994
|
var split = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-');
|
@@ -2338,8 +3005,8 @@ var RawSet = /** @class */ (function () {
|
|
2338
3005
|
};
|
2339
3006
|
RawSet.generateCSS = function (id, cssRule) {
|
2340
3007
|
var _this = this;
|
2341
|
-
var start = "#"
|
2342
|
-
var end = "#"
|
3008
|
+
var start = "#" + id + "-start";
|
3009
|
+
var end = "#" + id + "-end";
|
2343
3010
|
if (cssRule.constructor.name === 'CSSStyleRule') {
|
2344
3011
|
var rule = cssRule;
|
2345
3012
|
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
|
@@ -2348,14 +3015,14 @@ var RawSet = /** @class */ (function () {
|
|
2348
3015
|
if (!rule.selectorText.startsWith(':root')) {
|
2349
3016
|
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2350
3017
|
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2351
|
-
var selectorText = ":is("
|
3018
|
+
var selectorText = ":is(" + start + " ~ *:not(" + start + " ~ " + end + " ~ *))";
|
2352
3019
|
if (rule.selectorText.startsWith('.')) {
|
2353
|
-
rule.selectorText = ""
|
3020
|
+
rule.selectorText = "" + selectorText + rule.selectorText + ", " + selectorText + " " + rule.selectorText;
|
2354
3021
|
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
|
2355
3022
|
}
|
2356
3023
|
else {
|
2357
|
-
var divText =
|
2358
|
-
rule.selectorText =
|
3024
|
+
var divText = start + " ~ " + rule.selectorText + ":not(" + start + " ~ " + end + " ~ *)";
|
3025
|
+
rule.selectorText = selectorText + " " + rule.selectorText + ", " + divText;
|
2359
3026
|
// rule.selectorText = `${selectorText} ${rule.selectorText}`;
|
2360
3027
|
// rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
|
2361
3028
|
}
|
@@ -2370,15 +3037,42 @@ var RawSet = /** @class */ (function () {
|
|
2370
3037
|
}
|
2371
3038
|
};
|
2372
3039
|
// 중요 스타일 적용 부분
|
2373
|
-
RawSet.generateStyleTransform = function (styleBody,
|
3040
|
+
RawSet.generateStyleTransform = function (styleBody, componentKey, styleTagWrap) {
|
3041
|
+
var _a;
|
2374
3042
|
if (styleTagWrap === void 0) { styleTagWrap = true; }
|
2375
3043
|
if (Array.isArray(styleBody)) {
|
2376
3044
|
styleBody = styleBody.join('\n');
|
2377
3045
|
}
|
2378
|
-
|
2379
|
-
|
2380
|
-
}
|
2381
|
-
|
3046
|
+
var start = "#" + componentKey + "-start";
|
3047
|
+
var end = "#" + componentKey + "-end";
|
3048
|
+
var before = StringUtils.regexExecArrayReplace(styleBody, /(\$\{.*?\}\$)/g, function (data) {
|
3049
|
+
return "var(--domrender-" + data[0] + ")";
|
3050
|
+
});
|
3051
|
+
var cssobject = cssParse(before);
|
3052
|
+
(_a = cssobject.stylesheet) === null || _a === void 0 ? void 0 : _a.rules.forEach(function (rule) {
|
3053
|
+
var _a, _b;
|
3054
|
+
var isRoot = (_a = rule.selectors) === null || _a === void 0 ? void 0 : _a.find(function (it) { return it.startsWith(':root'); });
|
3055
|
+
if (rule.type === 'rule' && !isRoot) { // && !!isRoot
|
3056
|
+
rule.selectors = (_b = rule.selectors) === null || _b === void 0 ? void 0 : _b.map(function (sit) {
|
3057
|
+
var selectorText = ":is(" + start + " ~ *:not(" + start + " ~ " + end + " ~ *))";
|
3058
|
+
if (sit.startsWith('.')) {
|
3059
|
+
return "" + selectorText + sit + ", " + selectorText + " " + sit;
|
3060
|
+
}
|
3061
|
+
else {
|
3062
|
+
var divText = start + " ~ " + sit + ":not(" + start + " ~ " + end + " ~ *)";
|
3063
|
+
return selectorText + " " + sit + ", " + divText;
|
3064
|
+
}
|
3065
|
+
});
|
3066
|
+
}
|
3067
|
+
});
|
3068
|
+
var stringify = cssStringify(cssobject);
|
3069
|
+
var after = StringUtils.regexExecArrayReplace(stringify, /(var\(--domrender-(\$\{.*?\}\$)?\))/g, function (data) {
|
3070
|
+
return data[2];
|
3071
|
+
});
|
3072
|
+
if (styleTagWrap) {
|
3073
|
+
styleBody = "<style id='" + componentKey + "-style' domstyle>" + after + "</style>";
|
3074
|
+
}
|
3075
|
+
return styleBody;
|
2382
3076
|
};
|
2383
3077
|
RawSet.prototype.applyEvent = function (obj, fragment, config) {
|
2384
3078
|
if (fragment === void 0) { fragment = this.fragment; }
|
@@ -2397,13 +3091,13 @@ var RawSet = /** @class */ (function () {
|
|
2397
3091
|
var data = element.getAttribute(RawSet.DR_APPENDER_NAME);
|
2398
3092
|
// if (data && !/\[[0-9]+\]/g.test(data)) {
|
2399
3093
|
if (data && !/\[.+\]/g.test(data)) {
|
2400
|
-
var currentIndex = ScriptUtils.evalReturn(
|
3094
|
+
var currentIndex = ScriptUtils.evalReturn(data + "?.length -1", obj);
|
2401
3095
|
// console.log('------?', currentIndex)
|
2402
3096
|
// if (currentIndex === undefined || isNaN(currentIndex)) {
|
2403
3097
|
// return undefined;
|
2404
3098
|
// }
|
2405
3099
|
// const currentIndex = ScriptUtils.evalReturn(`${data}.length`, obj);
|
2406
|
-
data =
|
3100
|
+
data = data + "[" + currentIndex + "]";
|
2407
3101
|
element.setAttribute(RawSet.DR_APPENDER_NAME, data);
|
2408
3102
|
// element.setAttribute(RawSet.DR_IF_NAME, data);
|
2409
3103
|
// element.setAttribute('dr-id', data);
|
@@ -2425,9 +3119,8 @@ var RawSet = /** @class */ (function () {
|
|
2425
3119
|
// 중요 important
|
2426
3120
|
RawSet.checkPointCreates = function (element, obj, config) {
|
2427
3121
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2428
|
-
//
|
3122
|
+
// const NodeFilter = (config.window as any).NodeFilter;
|
2429
3123
|
var thisVariableName = element.__domrender_this_variable_name;
|
2430
|
-
// console.log('checkPointCreates thisVariableName', thisVariableName);
|
2431
3124
|
var nodeIterator = config.window.document.createNodeIterator(element, NodeFilter.SHOW_ALL, {
|
2432
3125
|
acceptNode: function (node) {
|
2433
3126
|
var _a, _b, _c, _d, _e;
|
@@ -2548,34 +3241,37 @@ var RawSet = /** @class */ (function () {
|
|
2548
3241
|
var element = node;
|
2549
3242
|
var start = config.window.document.createElement('meta');
|
2550
3243
|
var end = config.window.document.createElement('meta');
|
2551
|
-
start.setAttribute('id',
|
2552
|
-
var
|
2553
|
-
var
|
2554
|
-
if (
|
2555
|
-
start.setAttribute('type',
|
3244
|
+
start.setAttribute('id', id + "-start");
|
3245
|
+
var keys = element.getAttribute(RawSet.DR_KEY_OPTIONNAME);
|
3246
|
+
var thisPropertyType = element.getAttribute(RawSet.DR_THIS_PROPERTY_NAME);
|
3247
|
+
if (thisPropertyType) {
|
3248
|
+
start.setAttribute('type', exports.RawSetOperatorType.DR_THIS_PROPERTY);
|
2556
3249
|
}
|
2557
|
-
if (
|
2558
|
-
|
3250
|
+
if (keys) {
|
3251
|
+
element.removeAttribute(RawSet.DR_KEY_OPTIONNAME);
|
3252
|
+
start.setAttribute(RawSet.DR_KEY_OPTIONNAME, keys);
|
2559
3253
|
}
|
2560
|
-
end.setAttribute('id',
|
2561
|
-
return {
|
2562
|
-
start: start,
|
2563
|
-
end: end
|
2564
|
-
};
|
3254
|
+
end.setAttribute('id', id + "-end");
|
3255
|
+
return { start: start, end: end };
|
2565
3256
|
}
|
2566
3257
|
else if (type === exports.RawSetType.STYLE_TEXT) {
|
2567
3258
|
return {
|
2568
|
-
start: config.window.document.createTextNode("/*start text "
|
2569
|
-
end: config.window.document.createTextNode("/*end text "
|
3259
|
+
start: config.window.document.createTextNode("/*start text " + id + "*/"),
|
3260
|
+
end: config.window.document.createTextNode("/*end text " + id + "*/")
|
2570
3261
|
};
|
2571
3262
|
}
|
2572
3263
|
else { // text
|
2573
3264
|
return {
|
2574
|
-
start: config.window.document.createComment("start text "
|
2575
|
-
end: config.window.document.createComment("end text "
|
3265
|
+
start: config.window.document.createComment("start text " + id),
|
3266
|
+
end: config.window.document.createComment("end text " + id)
|
2576
3267
|
};
|
2577
3268
|
}
|
2578
3269
|
};
|
3270
|
+
RawSet.prototype.remove = function () {
|
3271
|
+
this.childAllRemove();
|
3272
|
+
this.point.end.remove();
|
3273
|
+
this.point.start.remove();
|
3274
|
+
};
|
2579
3275
|
RawSet.prototype.childAllRemove = function () {
|
2580
3276
|
var next = this.point.start.nextSibling;
|
2581
3277
|
while (next) {
|
@@ -2586,16 +3282,41 @@ var RawSet = /** @class */ (function () {
|
|
2586
3282
|
next = this.point.start.nextSibling;
|
2587
3283
|
}
|
2588
3284
|
};
|
3285
|
+
RawSet.prototype.childs = function (stopNext) {
|
3286
|
+
var childs = [];
|
3287
|
+
var next = this.point.start.nextSibling;
|
3288
|
+
while (next && next !== this.point.end) {
|
3289
|
+
if (stopNext === null || stopNext === void 0 ? void 0 : stopNext(next)) {
|
3290
|
+
return;
|
3291
|
+
}
|
3292
|
+
childs.push(next);
|
3293
|
+
next = next.nextSibling;
|
3294
|
+
}
|
3295
|
+
return childs;
|
3296
|
+
};
|
3297
|
+
RawSet.prototype.getHasRawSet = function (key) {
|
3298
|
+
var rawSet;
|
3299
|
+
this.childs(function (node) {
|
3300
|
+
var _a, _b;
|
3301
|
+
var drKey = (_b = (_a = node).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, 'dr-key');
|
3302
|
+
if (drKey && drKey === key) {
|
3303
|
+
rawSet = node.rawSet;
|
3304
|
+
return true;
|
3305
|
+
}
|
3306
|
+
return false;
|
3307
|
+
});
|
3308
|
+
return rawSet;
|
3309
|
+
};
|
2589
3310
|
RawSet.drItOtherEncoding = function (element) {
|
2590
3311
|
var random = RandomUtils.uuid();
|
2591
3312
|
var regex = /#it#/g;
|
2592
|
-
element.querySelectorAll("["
|
3313
|
+
element.querySelectorAll("[" + RawSet.DR_IT_OPTIONNAME + "], [" + RawSet.DR_FOR_OF_NAME + "], [" + RawSet.DR_REPEAT_NAME + "]").forEach(function (it) {
|
2593
3314
|
it.innerHTML = it.innerHTML.replace(regex, random);
|
2594
3315
|
});
|
2595
3316
|
return random;
|
2596
3317
|
};
|
2597
3318
|
RawSet.drItOtherDecoding = function (element, random) {
|
2598
|
-
element.querySelectorAll("["
|
3319
|
+
element.querySelectorAll("[" + RawSet.DR_IT_OPTIONNAME + "], [" + RawSet.DR_FOR_OF_NAME + "], [" + RawSet.DR_REPEAT_NAME + "]").forEach(function (it) {
|
2599
3320
|
it.innerHTML = it.innerHTML.replace(RegExp(random, 'g'), '#it#');
|
2600
3321
|
});
|
2601
3322
|
};
|
@@ -2608,35 +3329,35 @@ var RawSet = /** @class */ (function () {
|
|
2608
3329
|
// element.querySelectorAll(`[${RawSet.DR_PRE_NAME}]`).forEach(it => {
|
2609
3330
|
// let message = it.innerHTML;
|
2610
3331
|
// })
|
2611
|
-
element.querySelectorAll("["
|
3332
|
+
element.querySelectorAll("[" + RawSet.DR_PRE_NAME + "]").forEach(function (it) {
|
2612
3333
|
it.innerHTML = it.innerHTML.replace(/this/g, thisRandom);
|
2613
3334
|
});
|
2614
|
-
element.querySelectorAll("["
|
3335
|
+
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) {
|
2615
3336
|
var message = it.innerHTML;
|
2616
3337
|
StringUtils.regexExec(/([^(dr\-)])?this(?=.?)/g, message).reverse().forEach(function (it) {
|
2617
3338
|
var _a;
|
2618
|
-
message = message.substr(0, it.index) + message.substr(it.index).replace(it[0], ""
|
3339
|
+
message = message.substr(0, it.index) + message.substr(it.index).replace(it[0], "" + ((_a = it[1]) !== null && _a !== void 0 ? _a : '') + drThis);
|
2619
3340
|
});
|
2620
3341
|
it.innerHTML = message;
|
2621
3342
|
});
|
2622
3343
|
var message = element.innerHTML;
|
2623
3344
|
StringUtils.regexExec(/([^(dr\-)])?this(?=.?)/g, message).reverse().forEach(function (it) {
|
2624
3345
|
var _a;
|
2625
|
-
message = message.substr(0, it.index) + message.substr(it.index).replace(it[0], ""
|
3346
|
+
message = message.substr(0, it.index) + message.substr(it.index).replace(it[0], "" + ((_a = it[1]) !== null && _a !== void 0 ? _a : '') + drThis);
|
2626
3347
|
});
|
2627
3348
|
element.innerHTML = message;
|
2628
3349
|
return thisRandom;
|
2629
3350
|
};
|
2630
3351
|
RawSet.drThisDecoding = function (element, thisRandom) {
|
2631
|
-
element.querySelectorAll("["
|
3352
|
+
element.querySelectorAll("[" + RawSet.DR_PRE_NAME + "]").forEach(function (it) {
|
2632
3353
|
it.innerHTML = it.innerHTML.replace(RegExp(thisRandom, 'g'), 'this');
|
2633
3354
|
});
|
2634
|
-
element.querySelectorAll("["
|
3355
|
+
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) {
|
2635
3356
|
it.innerHTML = it.innerHTML.replace(RegExp(thisRandom, 'g'), 'this');
|
2636
3357
|
});
|
2637
3358
|
};
|
2638
3359
|
RawSet.drFormOtherMoveAttr = function (element, as, to, config) {
|
2639
|
-
element.querySelectorAll("["
|
3360
|
+
element.querySelectorAll("[" + RawSet.DR_FORM_NAME + "]").forEach(function (subElement) {
|
2640
3361
|
var _a;
|
2641
3362
|
var nodeIterator = config.window.document.createNodeIterator(subElement, NodeFilter.SHOW_ELEMENT, {
|
2642
3363
|
acceptNode: function (node) {
|
@@ -2674,7 +3395,7 @@ var RawSet = /** @class */ (function () {
|
|
2674
3395
|
};
|
2675
3396
|
});
|
2676
3397
|
// element.querySelectorAll(`[${RawSet.DR_THIS_NAME}]`).forEach(it => {
|
2677
|
-
element.querySelectorAll("["
|
3398
|
+
element.querySelectorAll("[" + RawSet.DR_VAR_OPTIONNAME + "]").forEach(function (it) {
|
2678
3399
|
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) {
|
2679
3400
|
it.innerHTML = it.innerHTML.replace(vit.regex, vit.random);
|
2680
3401
|
});
|
@@ -2685,7 +3406,7 @@ var RawSet = /** @class */ (function () {
|
|
2685
3406
|
return vars;
|
2686
3407
|
};
|
2687
3408
|
RawSet.drVarDecoding = function (element, vars) {
|
2688
|
-
element.querySelectorAll("["
|
3409
|
+
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) {
|
2689
3410
|
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) {
|
2690
3411
|
it.innerHTML = it.innerHTML.replace(RegExp(vit.random, 'g'), vit.value);
|
2691
3412
|
});
|
@@ -2747,7 +3468,7 @@ var RawSet = /** @class */ (function () {
|
|
2747
3468
|
renderScript = '';
|
2748
3469
|
createParam = [];
|
2749
3470
|
if (onCreate) {
|
2750
|
-
script =
|
3471
|
+
script = renderScript + " return " + onCreate + " ";
|
2751
3472
|
createParam = ScriptUtils.eval(script, obj);
|
2752
3473
|
if (!Array.isArray(createParam)) {
|
2753
3474
|
createParam = [createParam];
|
@@ -2756,14 +3477,16 @@ var RawSet = /** @class */ (function () {
|
|
2756
3477
|
(_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));
|
2757
3478
|
oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME);
|
2758
3479
|
if (oninit) {
|
2759
|
-
script =
|
3480
|
+
script = renderScript + " " + oninit + " ";
|
2760
3481
|
ScriptUtils.eval(script, obj);
|
2761
3482
|
}
|
2762
3483
|
_m.label = 12;
|
2763
3484
|
case 12:
|
2764
|
-
n.querySelectorAll(eventManager.attrNames.map(function (it) { return "["
|
3485
|
+
n.querySelectorAll(eventManager.attrNames.map(function (it) { return "[" + it + "]"; }).join(',')).forEach(function (it) {
|
2765
3486
|
it.setAttribute(EventManager.ownerVariablePathAttrName, 'this');
|
2766
3487
|
});
|
3488
|
+
// attribute
|
3489
|
+
n.getAttributeNames().forEach(function (it) { return n.setAttribute(it, n.getAttribute(it).replace(/#this#/g, drThis)); });
|
2767
3490
|
thisRandom = this.drThisEncoding(n, drThis);
|
2768
3491
|
vars = this.drVarEncoding(n, drVarOption);
|
2769
3492
|
this.drVarDecoding(n, vars);
|
@@ -2813,10 +3536,11 @@ var RawSet = /** @class */ (function () {
|
|
2813
3536
|
callBack: function (element, obj, rawSet, attrs, config) {
|
2814
3537
|
var _a, _b, _c, _d, _e, _f, _g;
|
2815
3538
|
return __awaiter(this, void 0, void 0, function () {
|
2816
|
-
var stylePromises, templatePromise, _h, i_1, it_6, _j, _k, _l, _m, _o, domrenderComponents,
|
3539
|
+
var componentKey, stylePromises, templatePromise, _h, i_1, it_6, _j, _k, _l, _m, _o, domrenderComponents, attribute, renderScript, render, constructor, constructorParam, script, param, instance, i, normalAttrMap, onCreate, createParam, script, applayTemplate, innerHTMLThisRandom, componentName, innerHTMLName, oninit, script, style, data, template_1;
|
2817
3540
|
return __generator(this, function (_p) {
|
2818
3541
|
switch (_p.label) {
|
2819
3542
|
case 0:
|
3543
|
+
componentKey = rawSet.uuid;
|
2820
3544
|
stylePromises = [];
|
2821
3545
|
if (!(this.template && this.template.startsWith('lazy://'))) return [3 /*break*/, 2];
|
2822
3546
|
return [4 /*yield*/, fetch(this.template.substring(6))];
|
@@ -2869,7 +3593,6 @@ var RawSet = /** @class */ (function () {
|
|
2869
3593
|
obj.__domrender_components = {};
|
2870
3594
|
}
|
2871
3595
|
domrenderComponents = obj.__domrender_components;
|
2872
|
-
componentKey = rawSet.uuid;
|
2873
3596
|
attribute = DomUtils.getAttributeToObject(element);
|
2874
3597
|
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;';
|
2875
3598
|
render = Object.freeze({
|
@@ -2887,7 +3610,7 @@ var RawSet = /** @class */ (function () {
|
|
2887
3610
|
constructorParam = [];
|
2888
3611
|
// dr-constructor
|
2889
3612
|
if (constructor) {
|
2890
|
-
script =
|
3613
|
+
script = renderScript + " return " + constructor + " ";
|
2891
3614
|
param = (_b = ScriptUtils.eval(script, Object.assign(obj, { __render: render }))) !== null && _b !== void 0 ? _b : [];
|
2892
3615
|
if (!Array.isArray(param)) {
|
2893
3616
|
param = [param];
|
@@ -2899,7 +3622,7 @@ var RawSet = /** @class */ (function () {
|
|
2899
3622
|
instance = domrenderComponents[componentKey];
|
2900
3623
|
i = instance.__domrender_component_new = ((_c = instance.__domrender_component_new) !== null && _c !== void 0 ? _c : new Proxy({}, new DomRenderFinalProxy()));
|
2901
3624
|
i.thisVariableName = rawSet.point.thisVariableName;
|
2902
|
-
i.thisFullVariableName = "this.__domrender_components."
|
3625
|
+
i.thisFullVariableName = "this.__domrender_components." + componentKey;
|
2903
3626
|
i.componentKey = componentKey;
|
2904
3627
|
i.rawSet = rawSet;
|
2905
3628
|
i.attribute = attribute;
|
@@ -2914,7 +3637,7 @@ var RawSet = /** @class */ (function () {
|
|
2914
3637
|
normalAttrMap = element.getAttribute(EventManager.normalAttrMapAttrName);
|
2915
3638
|
if (instance.onChangeAttrRender && normalAttrMap) {
|
2916
3639
|
new Map(JSON.parse(normalAttrMap)).forEach(function (value, key) {
|
2917
|
-
var script =
|
3640
|
+
var script = renderScript + " return " + value + " ";
|
2918
3641
|
var cval = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2919
3642
|
// element.setAttribute(key, cval);
|
2920
3643
|
instance.onChangeAttrRender(key, cval);
|
@@ -2924,7 +3647,7 @@ var RawSet = /** @class */ (function () {
|
|
2924
3647
|
this.__render = render;
|
2925
3648
|
createParam = [];
|
2926
3649
|
if (onCreate) {
|
2927
|
-
script =
|
3650
|
+
script = renderScript + " return " + onCreate + " ";
|
2928
3651
|
createParam = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2929
3652
|
if (!Array.isArray(createParam)) {
|
2930
3653
|
createParam = [createParam];
|
@@ -2940,20 +3663,20 @@ var RawSet = /** @class */ (function () {
|
|
2940
3663
|
innerHTMLThisRandom = RandomUtils.uuid();
|
2941
3664
|
applayTemplate = applayTemplate.replace(/this\./g, innerHTMLThisRandom);
|
2942
3665
|
// }
|
2943
|
-
applayTemplate = applayTemplate.replace(RegExp("#"
|
3666
|
+
applayTemplate = applayTemplate.replace(RegExp("#" + componentName + "#", 'g'), 'this');
|
2944
3667
|
}
|
2945
3668
|
// applayTemplate = template.replace(RegExp(`#${innerHTMLName}#`, 'g'), applayTemplate);
|
2946
|
-
applayTemplate = ((_g = this.template) !== null && _g !== void 0 ? _g : '').replace(RegExp("#"
|
3669
|
+
applayTemplate = ((_g = this.template) !== null && _g !== void 0 ? _g : '').replace(RegExp("#" + innerHTMLName + "#", 'g'), applayTemplate);
|
2947
3670
|
oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME);
|
2948
3671
|
if (oninit) {
|
2949
|
-
script =
|
3672
|
+
script = renderScript + " " + oninit + " ";
|
2950
3673
|
ScriptUtils.eval(script, Object.assign(obj, {
|
2951
3674
|
__render: render
|
2952
3675
|
}));
|
2953
3676
|
}
|
2954
3677
|
style = RawSet.generateStyleTransform(this.styles, componentKey, true);
|
2955
3678
|
element.innerHTML = style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
|
2956
|
-
return [4 /*yield*/, RawSet.drThisCreate(rawSet, element, "this.__domrender_components."
|
3679
|
+
return [4 /*yield*/, RawSet.drThisCreate(rawSet, element, "this.__domrender_components." + componentKey, '', true, obj, config)];
|
2957
3680
|
case 12:
|
2958
3681
|
data = _p.sent();
|
2959
3682
|
// 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
|
@@ -3007,7 +3730,7 @@ var RawSet = /** @class */ (function () {
|
|
3007
3730
|
RawSet.DR_IF_NAME = 'dr-if';
|
3008
3731
|
RawSet.DR_FOR_NAME = 'dr-for';
|
3009
3732
|
RawSet.DR_FOR_OF_NAME = 'dr-for-of';
|
3010
|
-
RawSet.
|
3733
|
+
RawSet.DR_THIS_PROPERTY_NAME = 'dr-this-property';
|
3011
3734
|
RawSet.DR_REPEAT_NAME = 'dr-repeat';
|
3012
3735
|
RawSet.DR_THIS_NAME = 'dr-this';
|
3013
3736
|
RawSet.DR_FORM_NAME = 'dr-form';
|
@@ -3026,7 +3749,8 @@ var RawSet = /** @class */ (function () {
|
|
3026
3749
|
RawSet.DR_DESTROY_OPTIONNAME = 'dr-destroy';
|
3027
3750
|
RawSet.DR_COMPONENT_NAME_OPTIONNAME = 'dr-component-name';
|
3028
3751
|
RawSet.DR_COMPONENT_INNER_HTML_NAME_OPTIONNAME = 'dr-component-inner-html-name';
|
3029
|
-
RawSet.
|
3752
|
+
RawSet.DR_KEY_OPTIONNAME = 'dr-key';
|
3753
|
+
RawSet.DR_HAS_KEYS_OPTIONNAME = 'dr-has-keys';
|
3030
3754
|
RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME = 'dr-on-create:arguments';
|
3031
3755
|
RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME = 'dr-on-create:callback';
|
3032
3756
|
RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME = 'dr-on-init:arguments';
|
@@ -3036,7 +3760,7 @@ var RawSet = /** @class */ (function () {
|
|
3036
3760
|
drIf: RawSet.DR_IF_NAME,
|
3037
3761
|
drFor: RawSet.DR_FOR_NAME,
|
3038
3762
|
drForOf: RawSet.DR_FOR_OF_NAME,
|
3039
|
-
|
3763
|
+
drThisProperty: RawSet.DR_THIS_PROPERTY_NAME,
|
3040
3764
|
drAppender: RawSet.DR_APPENDER_NAME,
|
3041
3765
|
drRepeat: RawSet.DR_REPEAT_NAME,
|
3042
3766
|
drThis: RawSet.DR_THIS_NAME,
|
@@ -3052,10 +3776,11 @@ var RawSet = /** @class */ (function () {
|
|
3052
3776
|
drCompleteOption: RawSet.DR_COMPLETE_OPTIONNAME,
|
3053
3777
|
drStripOption: RawSet.DR_STRIP_OPTIONNAME,
|
3054
3778
|
drDestroyOption: RawSet.DR_DESTROY_OPTIONNAME,
|
3055
|
-
|
3779
|
+
drHasKeysOption: RawSet.DR_HAS_KEYS_OPTIONNAME,
|
3780
|
+
drKeyOption: RawSet.DR_KEY_OPTIONNAME
|
3056
3781
|
};
|
3057
3782
|
RawSet.DR_TAGS = [];
|
3058
|
-
RawSet.DR_ATTRIBUTES = [RawSet.DR_NAME, RawSet.DR_APPENDER_NAME, RawSet.DR_IF_NAME, RawSet.DR_FOR_OF_NAME, RawSet.
|
3783
|
+
RawSet.DR_ATTRIBUTES = [RawSet.DR_NAME, RawSet.DR_APPENDER_NAME, RawSet.DR_IF_NAME, RawSet.DR_FOR_OF_NAME, RawSet.DR_THIS_PROPERTY_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];
|
3059
3784
|
return RawSet;
|
3060
3785
|
}());
|
3061
3786
|
|
@@ -3082,9 +3807,9 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3082
3807
|
};
|
3083
3808
|
DomRenderProxy.prototype.run = function (objProxy) {
|
3084
3809
|
var _this = this;
|
3085
|
-
var _a;
|
3810
|
+
var _a, _b;
|
3086
3811
|
this._domRender_proxy = objProxy;
|
3087
|
-
(_a = objProxy === null ||
|
3812
|
+
(_b = (_a = objProxy) === null || _a === void 0 ? void 0 : _a.onProxyDomRender) === null || _b === void 0 ? void 0 : _b.call(_a, this.config);
|
3088
3813
|
var obj = objProxy._DomRender_origin;
|
3089
3814
|
if (obj) {
|
3090
3815
|
Object.keys(obj).forEach(function (it) {
|
@@ -3110,7 +3835,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3110
3835
|
};
|
3111
3836
|
DomRenderProxy.prototype.initRender = function (target) {
|
3112
3837
|
var _this = this;
|
3113
|
-
var _a, _b, _c, _d
|
3838
|
+
var _a, _b, _c, _d;
|
3114
3839
|
var onCreate = (_b = (_a = target).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME);
|
3115
3840
|
var createParam = [];
|
3116
3841
|
if (onCreate) {
|
@@ -3120,7 +3845,6 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3120
3845
|
}
|
3121
3846
|
}
|
3122
3847
|
(_d = (_c = this._domRender_proxy) === null || _c === void 0 ? void 0 : _c.onCreateRender) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray([_c], createParam, false));
|
3123
|
-
(_e = target.innerHTML) !== null && _e !== void 0 ? _e : '';
|
3124
3848
|
this._targets.add(target);
|
3125
3849
|
var rawSets = RawSet.checkPointCreates(target, this._domRender_proxy, this.config);
|
3126
3850
|
// console.log('initRender -------rawSet', rawSets)
|
@@ -3199,11 +3923,11 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3199
3923
|
new Map(JSON.parse(targetAttrMap)).forEach(function (v, k) {
|
3200
3924
|
var _a;
|
3201
3925
|
// it?.data.onChangeAttrRender(k, null, v);
|
3202
|
-
var isUsing = EventManager.isUsingThisVar(v, "this."
|
3926
|
+
var isUsing = EventManager.isUsingThisVar(v, "this." + fullPathStr);
|
3203
3927
|
if (isUsing) {
|
3204
3928
|
var render = it_1.fragment.render;
|
3205
3929
|
// console.log('render-->', (it.fragment as any).render)
|
3206
|
-
var script =
|
3930
|
+
var script = render.renderScript + " return " + v + " ";
|
3207
3931
|
var cval = ScriptUtils.eval(script, Object.assign((_a = _this._domRender_proxy) !== null && _a !== void 0 ? _a : {}, { __render: render }));
|
3208
3932
|
it_1.data.onChangeAttrRender(k, cval);
|
3209
3933
|
}
|
@@ -3275,7 +3999,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3275
3999
|
// const firstPathStr = paths.slice(1).reverse().join('.');
|
3276
4000
|
var strings = paths.reverse();
|
3277
4001
|
// array같은경우도 키값으로 접근하기때문에 특정 인덱스를 찾아서 그부분만 바꿔줄수 있다.
|
3278
|
-
var fullPathStr_1 = strings.map(function (it) { return isNaN(Number(it)) ? '.' + it : "["
|
4002
|
+
var fullPathStr_1 = strings.map(function (it) { return isNaN(Number(it)) ? '.' + it : "[" + it + "]"; }).join('').slice(1);
|
3279
4003
|
// console.log('-------fullPathStr', fullPathStr, lastDoneExecute);
|
3280
4004
|
if (lastDoneExecute) {
|
3281
4005
|
// const firstData = ScriptUtils.evalReturn('this.' + firstPathStr, this._domRender_proxy);
|
@@ -3284,12 +4008,13 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3284
4008
|
// }
|
3285
4009
|
var iterable_1 = this._rawSets.get(fullPathStr_1);
|
3286
4010
|
// array check
|
3287
|
-
var front_1 = strings.slice(0, strings.length - 1).map(function (it) { return isNaN(Number(it)) ? '.' + it : "["
|
4011
|
+
var front_1 = strings.slice(0, strings.length - 1).map(function (it) { return isNaN(Number(it)) ? '.' + it : "[" + it + "]"; }).join('');
|
3288
4012
|
var last_1 = strings[strings.length - 1];
|
3289
4013
|
var data_1 = ScriptUtils.evalReturn('this' + front_1, this._domRender_proxy);
|
3290
4014
|
// console.log('-------!!!!!', fullPathStr, iterable, data, front, last);
|
3291
4015
|
new Promise(function (resolve) {
|
3292
4016
|
var firstPathStr = front_1.slice(1);
|
4017
|
+
// check dictionary
|
3293
4018
|
// console.log('-promise-------', firstPathStr, this)
|
3294
4019
|
var firstTargets = _this._rawSets.get(firstPathStr);
|
3295
4020
|
var firstTargetDictionary = [];
|
@@ -3297,7 +4022,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3297
4022
|
var _a, _b;
|
3298
4023
|
// console.log('----forEach---', it);
|
3299
4024
|
var type = (_b = (_a = it.point.start).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, 'type');
|
3300
|
-
if (type ===
|
4025
|
+
if (type === exports.RawSetOperatorType.DR_THIS_PROPERTY) {
|
3301
4026
|
firstTargetDictionary.push(it);
|
3302
4027
|
}
|
3303
4028
|
});
|
@@ -3307,10 +4032,15 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3307
4032
|
var skip_1 = false;
|
3308
4033
|
firstTargetDictionary.forEach(function (it) {
|
3309
4034
|
var _a, _b;
|
3310
|
-
var
|
4035
|
+
var startElement = it.point.start;
|
4036
|
+
var keys = (_b = (_a = startElement.getAttribute(RawSet.DR_HAS_KEYS_OPTIONNAME)) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
4037
|
+
if (value === undefined) {
|
4038
|
+
var rawSet = it.getHasRawSet(last_1);
|
4039
|
+
rawSet === null || rawSet === void 0 ? void 0 : rawSet.remove();
|
4040
|
+
startElement.setAttribute(RawSet.DR_HAS_KEYS_OPTIONNAME, keys.filter(function (it) { return it !== last_1; }).join(','));
|
4041
|
+
}
|
3311
4042
|
if (!keys.includes(last_1)) {
|
3312
|
-
var raws =
|
3313
|
-
// console.log('----append---', raws);
|
4043
|
+
var raws = DrThisProperty.append(_this._domRender_proxy, fullPathStr_1, last_1, it, _this.config);
|
3314
4044
|
if (raws) {
|
3315
4045
|
rawSets_3.push.apply(rawSets_3, raws);
|
3316
4046
|
}
|
@@ -3322,18 +4052,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3322
4052
|
if (skip_1 === false || rawSets_3.length > 0) {
|
3323
4053
|
return _this.render(rawSets_3);
|
3324
4054
|
}
|
3325
|
-
// console.log('rawSets-->#$$$$$$$$$$$', this._rawSets);
|
3326
|
-
// rawSets.forEach(it => this.addRawSet(fullPathStr, it));
|
3327
|
-
// DrDictionary.append(this._domRender_proxy, fullPathStr, it, this.config);
|
3328
|
-
// it.render(this._domRender_proxy, this.config);
|
3329
4055
|
}
|
3330
|
-
/* if (data instanceof Dictionary) {
|
3331
|
-
const a = this._rawSets.get(firstPathStr);
|
3332
|
-
// a?.forEach(it => {
|
3333
|
-
// if (it.type === RawSetType.TARGET_ATTR)
|
3334
|
-
// })
|
3335
|
-
console.log('dictionary-->', data, last, value, this._rawSets, a);
|
3336
|
-
} else */
|
3337
4056
|
if (last_1 === 'length' && Array.isArray(data_1)) {
|
3338
4057
|
var aIterable = _this._rawSets.get(firstPathStr);
|
3339
4058
|
if (aIterable) {
|
@@ -3344,14 +4063,12 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3344
4063
|
return _this.render(Array.from(iterable_1), fullPathStr_1);
|
3345
4064
|
}
|
3346
4065
|
}).then(function (it) {
|
3347
|
-
console.log('target1------->,', it);
|
3348
4066
|
_this._targets.forEach(function (it) {
|
3349
|
-
console.log('target2------->,', it);
|
3350
4067
|
// return;
|
3351
4068
|
if (it.nodeType === Node.DOCUMENT_FRAGMENT_NODE || it.nodeType === Node.ELEMENT_NODE) {
|
3352
4069
|
var targets = eventManager.findAttrElements(it, _this.config);
|
3353
4070
|
// console.log('------>', targets);
|
3354
|
-
eventManager.changeVar(_this._domRender_proxy, targets, "this."
|
4071
|
+
eventManager.changeVar(_this._domRender_proxy, targets, "this." + fullPathStr_1, _this.config);
|
3355
4072
|
}
|
3356
4073
|
});
|
3357
4074
|
});
|
@@ -3361,7 +4078,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3361
4078
|
return fullPaths;
|
3362
4079
|
};
|
3363
4080
|
DomRenderProxy.prototype.set = function (target, p, value, receiver) {
|
3364
|
-
var _a, _b;
|
4081
|
+
var _a, _b, _c;
|
3365
4082
|
// console.log('set-->', p, value, target, receiver);
|
3366
4083
|
if (typeof p === 'string' && p !== '__domrender_components' && excludeGetSetPropertys.includes(p)) {
|
3367
4084
|
target[p] = value;
|
@@ -3383,12 +4100,12 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3383
4100
|
}
|
3384
4101
|
// console.log('full path:', fullPath);
|
3385
4102
|
if (('onBeforeReturnSet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnSets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
3386
|
-
(_b = receiver === null ||
|
4103
|
+
(_c = (_b = receiver) === null || _b === void 0 ? void 0 : _b.onBeforeReturnSet) === null || _c === void 0 ? void 0 : _c.call(_b, p, value, fullPath);
|
3387
4104
|
}
|
3388
4105
|
return true;
|
3389
4106
|
};
|
3390
4107
|
DomRenderProxy.prototype.get = function (target, p, receiver) {
|
3391
|
-
var _a, _b;
|
4108
|
+
var _a, _b, _c;
|
3392
4109
|
// console.log('get-->', target, p, receiver);
|
3393
4110
|
if (p === '_DomRender_origin') {
|
3394
4111
|
return this._domRender_origin;
|
@@ -3419,7 +4136,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3419
4136
|
it_2 = it_2._DomRender_origin;
|
3420
4137
|
}
|
3421
4138
|
if (('onBeforeReturnGet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnGets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
3422
|
-
(_b = receiver === null ||
|
4139
|
+
(_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));
|
3423
4140
|
}
|
3424
4141
|
return it_2;
|
3425
4142
|
}
|
@@ -3535,7 +4252,7 @@ var Router = /** @class */ (function () {
|
|
3535
4252
|
var _this = this;
|
3536
4253
|
var proxy = this.rootObj._DomRender_proxy;
|
3537
4254
|
if (proxy) {
|
3538
|
-
var key = "___"
|
4255
|
+
var key = "___" + EventManager.ROUTER_VARNAME;
|
3539
4256
|
proxy.render(key);
|
3540
4257
|
}
|
3541
4258
|
this.attachCallbacks.forEach(function (it) {
|
@@ -3962,7 +4679,7 @@ var DomRender = /** @class */ (function () {
|
|
3962
4679
|
function DomRender() {
|
3963
4680
|
}
|
3964
4681
|
DomRender.run = function (obj, target, oConfig) {
|
3965
|
-
var _a, _b, _c
|
4682
|
+
var _a, _b, _c;
|
3966
4683
|
var robj = obj;
|
3967
4684
|
if ('_DomRender_isProxy' in obj) {
|
3968
4685
|
if (target) {
|
@@ -3989,10 +4706,7 @@ var DomRender = /** @class */ (function () {
|
|
3989
4706
|
else if (config.routerType === 'hash') {
|
3990
4707
|
config.router = (_c = config.router) !== null && _c !== void 0 ? _c : new HashRouter(robj, config.window);
|
3991
4708
|
}
|
3992
|
-
else
|
3993
|
-
config.routerType = 'hash';
|
3994
|
-
config.router = (_d = config.router) !== null && _d !== void 0 ? _d : new HashRouter(robj, config.window);
|
3995
|
-
}
|
4709
|
+
else ;
|
3996
4710
|
domRender.run(robj);
|
3997
4711
|
return robj;
|
3998
4712
|
};
|
@@ -4088,19 +4802,6 @@ var Appender = /** @class */ (function () {
|
|
4088
4802
|
return Appender;
|
4089
4803
|
}());
|
4090
4804
|
|
4091
|
-
var AllUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4092
|
-
__extends(AllUnCheckedValidatorArray, _super);
|
4093
|
-
function AllUnCheckedValidatorArray(value, target, event, autoValid) {
|
4094
|
-
if (autoValid === void 0) { autoValid = true; }
|
4095
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
4096
|
-
}
|
4097
|
-
AllUnCheckedValidatorArray.prototype.valid = function () {
|
4098
|
-
var _a;
|
4099
|
-
return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length > 0);
|
4100
|
-
};
|
4101
|
-
return AllUnCheckedValidatorArray;
|
4102
|
-
}(ValidatorArray));
|
4103
|
-
|
4104
4805
|
var AllCheckedValidatorArray = /** @class */ (function (_super) {
|
4105
4806
|
__extends(AllCheckedValidatorArray, _super);
|
4106
4807
|
function AllCheckedValidatorArray(value, target, event, autoValid) {
|
@@ -4114,19 +4815,17 @@ var AllCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4114
4815
|
return AllCheckedValidatorArray;
|
4115
4816
|
}(ValidatorArray));
|
4116
4817
|
|
4117
|
-
var
|
4118
|
-
__extends(
|
4119
|
-
function
|
4818
|
+
var AllUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4819
|
+
__extends(AllUnCheckedValidatorArray, _super);
|
4820
|
+
function AllUnCheckedValidatorArray(value, target, event, autoValid) {
|
4120
4821
|
if (autoValid === void 0) { autoValid = true; }
|
4121
|
-
|
4122
|
-
_this.count = count;
|
4123
|
-
return _this;
|
4822
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
4124
4823
|
}
|
4125
|
-
|
4824
|
+
AllUnCheckedValidatorArray.prototype.valid = function () {
|
4126
4825
|
var _a;
|
4127
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4826
|
+
return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length > 0);
|
4128
4827
|
};
|
4129
|
-
return
|
4828
|
+
return AllUnCheckedValidatorArray;
|
4130
4829
|
}(ValidatorArray));
|
4131
4830
|
|
4132
4831
|
var CheckedValidator = /** @class */ (function (_super) {
|
@@ -4157,49 +4856,49 @@ var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4157
4856
|
return CountEqualsUnCheckedValidatorArray;
|
4158
4857
|
}(ValidatorArray));
|
4159
4858
|
|
4160
|
-
var
|
4161
|
-
__extends(
|
4162
|
-
function
|
4859
|
+
var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
4860
|
+
__extends(CountGreaterThanCheckedValidatorArray, _super);
|
4861
|
+
function CountGreaterThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
4163
4862
|
if (autoValid === void 0) { autoValid = true; }
|
4164
4863
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4165
4864
|
_this.count = count;
|
4166
4865
|
return _this;
|
4167
4866
|
}
|
4168
|
-
|
4867
|
+
CountGreaterThanCheckedValidatorArray.prototype.valid = function () {
|
4169
4868
|
var _a;
|
4170
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4869
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length > this.count;
|
4171
4870
|
};
|
4172
|
-
return
|
4871
|
+
return CountGreaterThanCheckedValidatorArray;
|
4173
4872
|
}(ValidatorArray));
|
4174
4873
|
|
4175
|
-
var
|
4176
|
-
__extends(
|
4177
|
-
function
|
4874
|
+
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4875
|
+
__extends(CountEqualsCheckedValidatorArray, _super);
|
4876
|
+
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
4178
4877
|
if (autoValid === void 0) { autoValid = true; }
|
4179
4878
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4180
4879
|
_this.count = count;
|
4181
4880
|
return _this;
|
4182
4881
|
}
|
4183
|
-
|
4882
|
+
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
4184
4883
|
var _a;
|
4185
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4884
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
4186
4885
|
};
|
4187
|
-
return
|
4886
|
+
return CountEqualsCheckedValidatorArray;
|
4188
4887
|
}(ValidatorArray));
|
4189
4888
|
|
4190
|
-
var
|
4191
|
-
__extends(
|
4192
|
-
function
|
4889
|
+
var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4890
|
+
__extends(CountGreaterThanUnCheckedValidatorArray, _super);
|
4891
|
+
function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
4193
4892
|
if (autoValid === void 0) { autoValid = true; }
|
4194
4893
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4195
4894
|
_this.count = count;
|
4196
4895
|
return _this;
|
4197
4896
|
}
|
4198
|
-
|
4897
|
+
CountGreaterThanUnCheckedValidatorArray.prototype.valid = function () {
|
4199
4898
|
var _a;
|
4200
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4899
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > this.count;
|
4201
4900
|
};
|
4202
|
-
return
|
4901
|
+
return CountGreaterThanUnCheckedValidatorArray;
|
4203
4902
|
}(ValidatorArray));
|
4204
4903
|
|
4205
4904
|
var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -4217,34 +4916,34 @@ var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_su
|
|
4217
4916
|
return CountGreaterThanEqualsUnCheckedValidatorArray;
|
4218
4917
|
}(ValidatorArray));
|
4219
4918
|
|
4220
|
-
var
|
4221
|
-
__extends(
|
4222
|
-
function
|
4919
|
+
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4920
|
+
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
4921
|
+
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
4223
4922
|
if (autoValid === void 0) { autoValid = true; }
|
4224
4923
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4225
4924
|
_this.count = count;
|
4226
4925
|
return _this;
|
4227
4926
|
}
|
4228
|
-
|
4927
|
+
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
4229
4928
|
var _a;
|
4230
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return
|
4929
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
4231
4930
|
};
|
4232
|
-
return
|
4931
|
+
return CountGreaterThanEqualsCheckedValidatorArray;
|
4233
4932
|
}(ValidatorArray));
|
4234
4933
|
|
4235
|
-
var
|
4236
|
-
__extends(
|
4237
|
-
function
|
4934
|
+
var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
|
4935
|
+
__extends(CountLessThanCheckedValidatorArray, _super);
|
4936
|
+
function CountLessThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
4238
4937
|
if (autoValid === void 0) { autoValid = true; }
|
4239
4938
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4240
4939
|
_this.count = count;
|
4241
4940
|
return _this;
|
4242
4941
|
}
|
4243
|
-
|
4942
|
+
CountLessThanCheckedValidatorArray.prototype.valid = function () {
|
4244
4943
|
var _a;
|
4245
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return
|
4944
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length < this.count;
|
4246
4945
|
};
|
4247
|
-
return
|
4946
|
+
return CountLessThanCheckedValidatorArray;
|
4248
4947
|
}(ValidatorArray));
|
4249
4948
|
|
4250
4949
|
var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -4269,28 +4968,13 @@ var EmptyValidator = /** @class */ (function (_super) {
|
|
4269
4968
|
return _super.call(this, value, target, event, autoValid) || this;
|
4270
4969
|
}
|
4271
4970
|
EmptyValidator.prototype.valid = function () {
|
4272
|
-
var _a;
|
4971
|
+
var _a, _b;
|
4273
4972
|
var value = this.value;
|
4274
|
-
return value === undefined || value === null || ((_a = value === null ||
|
4973
|
+
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
4275
4974
|
};
|
4276
4975
|
return EmptyValidator;
|
4277
4976
|
}(Validator));
|
4278
4977
|
|
4279
|
-
var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4280
|
-
__extends(CountUnCheckedValidatorArray, _super);
|
4281
|
-
function CountUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
4282
|
-
if (autoValid === void 0) { autoValid = true; }
|
4283
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4284
|
-
_this.count = count;
|
4285
|
-
return _this;
|
4286
|
-
}
|
4287
|
-
CountUnCheckedValidatorArray.prototype.valid = function () {
|
4288
|
-
var _a;
|
4289
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
4290
|
-
};
|
4291
|
-
return CountUnCheckedValidatorArray;
|
4292
|
-
}(ValidatorArray));
|
4293
|
-
|
4294
4978
|
var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
4295
4979
|
__extends(ExcludeCheckedValidatorArray, _super);
|
4296
4980
|
function ExcludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
@@ -4313,19 +4997,26 @@ var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4313
4997
|
return ExcludeCheckedValidatorArray;
|
4314
4998
|
}(ValidatorArray));
|
4315
4999
|
|
4316
|
-
var
|
4317
|
-
__extends(
|
4318
|
-
function
|
5000
|
+
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
5001
|
+
__extends(IncludeCheckedValidatorArray, _super);
|
5002
|
+
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
5003
|
+
if (allRequired === void 0) { allRequired = false; }
|
4319
5004
|
if (autoValid === void 0) { autoValid = true; }
|
4320
5005
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4321
|
-
_this.
|
5006
|
+
_this.include = include;
|
5007
|
+
_this.allRequired = allRequired;
|
4322
5008
|
return _this;
|
4323
5009
|
}
|
4324
|
-
|
5010
|
+
IncludeCheckedValidatorArray.prototype.valid = function () {
|
5011
|
+
var _this = this;
|
4325
5012
|
var _a;
|
4326
|
-
|
5013
|
+
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
5014
|
+
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
5015
|
+
return checkedValue.length > 0 &&
|
5016
|
+
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
5017
|
+
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
4327
5018
|
};
|
4328
|
-
return
|
5019
|
+
return IncludeCheckedValidatorArray;
|
4329
5020
|
}(ValidatorArray));
|
4330
5021
|
|
4331
5022
|
var FormValidator = /** @class */ (function (_super) {
|
@@ -4346,50 +5037,6 @@ var FormValidator = /** @class */ (function (_super) {
|
|
4346
5037
|
return FormValidator;
|
4347
5038
|
}(Validator));
|
4348
5039
|
|
4349
|
-
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
4350
|
-
__extends(NotRegExpTestValidator, _super);
|
4351
|
-
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
4352
|
-
if (autoValid === void 0) { autoValid = true; }
|
4353
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4354
|
-
_this.regexp = DomRenderProxy.final(regexp);
|
4355
|
-
return _this;
|
4356
|
-
}
|
4357
|
-
NotRegExpTestValidator.prototype.valid = function () {
|
4358
|
-
var _a;
|
4359
|
-
var value = this.value;
|
4360
|
-
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
4361
|
-
if (value) {
|
4362
|
-
return !regExp.test(value);
|
4363
|
-
}
|
4364
|
-
else {
|
4365
|
-
return true;
|
4366
|
-
}
|
4367
|
-
};
|
4368
|
-
return NotRegExpTestValidator;
|
4369
|
-
}(Validator));
|
4370
|
-
|
4371
|
-
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
4372
|
-
__extends(IncludeCheckedValidatorArray, _super);
|
4373
|
-
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
4374
|
-
if (allRequired === void 0) { allRequired = false; }
|
4375
|
-
if (autoValid === void 0) { autoValid = true; }
|
4376
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4377
|
-
_this.include = include;
|
4378
|
-
_this.allRequired = allRequired;
|
4379
|
-
return _this;
|
4380
|
-
}
|
4381
|
-
IncludeCheckedValidatorArray.prototype.valid = function () {
|
4382
|
-
var _this = this;
|
4383
|
-
var _a;
|
4384
|
-
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
4385
|
-
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
4386
|
-
return checkedValue.length > 0 &&
|
4387
|
-
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
4388
|
-
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
4389
|
-
};
|
4390
|
-
return IncludeCheckedValidatorArray;
|
4391
|
-
}(ValidatorArray));
|
4392
|
-
|
4393
5040
|
var MultipleValidator = /** @class */ (function (_super) {
|
4394
5041
|
__extends(MultipleValidator, _super);
|
4395
5042
|
function MultipleValidator(validators, value, target, event, autoValid) {
|
@@ -4419,17 +5066,20 @@ var MultipleValidator = /** @class */ (function (_super) {
|
|
4419
5066
|
return MultipleValidator;
|
4420
5067
|
}(Validator));
|
4421
5068
|
|
4422
|
-
var
|
4423
|
-
__extends(
|
4424
|
-
function
|
5069
|
+
var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
5070
|
+
__extends(CountUnCheckedValidatorArray, _super);
|
5071
|
+
function CountUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
4425
5072
|
if (autoValid === void 0) { autoValid = true; }
|
4426
|
-
|
5073
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
5074
|
+
_this.count = count;
|
5075
|
+
return _this;
|
4427
5076
|
}
|
4428
|
-
|
4429
|
-
|
5077
|
+
CountUnCheckedValidatorArray.prototype.valid = function () {
|
5078
|
+
var _a;
|
5079
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
4430
5080
|
};
|
4431
|
-
return
|
4432
|
-
}(
|
5081
|
+
return CountUnCheckedValidatorArray;
|
5082
|
+
}(ValidatorArray));
|
4433
5083
|
|
4434
5084
|
var RegExpTestValidator = /** @class */ (function (_super) {
|
4435
5085
|
__extends(RegExpTestValidator, _super);
|
@@ -4468,6 +5118,28 @@ var RequiredValidator = /** @class */ (function (_super) {
|
|
4468
5118
|
return RequiredValidator;
|
4469
5119
|
}(Validator));
|
4470
5120
|
|
5121
|
+
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
5122
|
+
__extends(NotRegExpTestValidator, _super);
|
5123
|
+
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
5124
|
+
if (autoValid === void 0) { autoValid = true; }
|
5125
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
5126
|
+
_this.regexp = DomRenderProxy.final(regexp);
|
5127
|
+
return _this;
|
5128
|
+
}
|
5129
|
+
NotRegExpTestValidator.prototype.valid = function () {
|
5130
|
+
var _a;
|
5131
|
+
var value = this.value;
|
5132
|
+
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
5133
|
+
if (value) {
|
5134
|
+
return !regExp.test(value);
|
5135
|
+
}
|
5136
|
+
else {
|
5137
|
+
return true;
|
5138
|
+
}
|
5139
|
+
};
|
5140
|
+
return NotRegExpTestValidator;
|
5141
|
+
}(Validator));
|
5142
|
+
|
4471
5143
|
var NotEmptyValidator = /** @class */ (function (_super) {
|
4472
5144
|
__extends(NotEmptyValidator, _super);
|
4473
5145
|
function NotEmptyValidator(value, target, event, autoValid) {
|
@@ -4475,10 +5147,10 @@ var NotEmptyValidator = /** @class */ (function (_super) {
|
|
4475
5147
|
return _super.call(this, value, target, event, autoValid) || this;
|
4476
5148
|
}
|
4477
5149
|
NotEmptyValidator.prototype.valid = function () {
|
4478
|
-
var _a;
|
5150
|
+
var _a, _b;
|
4479
5151
|
var value = this.value;
|
4480
5152
|
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
4481
|
-
return value !== undefined && value !== null && ((_a = value === null ||
|
5153
|
+
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
4482
5154
|
};
|
4483
5155
|
return NotEmptyValidator;
|
4484
5156
|
}(Validator));
|
@@ -4567,26 +5239,70 @@ var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
|
4567
5239
|
return ValueNotEqualsValidator;
|
4568
5240
|
}(Validator));
|
4569
5241
|
|
4570
|
-
var
|
4571
|
-
|
5242
|
+
var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
5243
|
+
__extends(CountLessThanEqualsUnCheckedValidatorArray, _super);
|
5244
|
+
function CountLessThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
5245
|
+
if (autoValid === void 0) { autoValid = true; }
|
5246
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
5247
|
+
_this.count = count;
|
5248
|
+
return _this;
|
4572
5249
|
}
|
4573
|
-
|
4574
|
-
|
4575
|
-
return
|
5250
|
+
CountLessThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
|
5251
|
+
var _a;
|
5252
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length <= this.count;
|
4576
5253
|
};
|
4577
|
-
|
4578
|
-
|
4579
|
-
|
5254
|
+
return CountLessThanEqualsUnCheckedValidatorArray;
|
5255
|
+
}(ValidatorArray));
|
5256
|
+
|
5257
|
+
var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
5258
|
+
__extends(CountLessThanEqualsCheckedValidatorArray, _super);
|
5259
|
+
function CountLessThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
5260
|
+
if (autoValid === void 0) { autoValid = true; }
|
5261
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
5262
|
+
_this.count = count;
|
5263
|
+
return _this;
|
5264
|
+
}
|
5265
|
+
CountLessThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
5266
|
+
var _a;
|
5267
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length <= this.count;
|
4580
5268
|
};
|
4581
|
-
|
4582
|
-
|
4583
|
-
|
5269
|
+
return CountLessThanEqualsCheckedValidatorArray;
|
5270
|
+
}(ValidatorArray));
|
5271
|
+
|
5272
|
+
var PassValidator = /** @class */ (function (_super) {
|
5273
|
+
__extends(PassValidator, _super);
|
5274
|
+
function PassValidator(value, target, event, autoValid) {
|
5275
|
+
if (autoValid === void 0) { autoValid = true; }
|
5276
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
5277
|
+
}
|
5278
|
+
PassValidator.prototype.valid = function () {
|
5279
|
+
return true;
|
4584
5280
|
};
|
4585
|
-
|
4586
|
-
|
4587
|
-
|
5281
|
+
return PassValidator;
|
5282
|
+
}(Validator));
|
5283
|
+
|
5284
|
+
var NodeUtils = /** @class */ (function () {
|
5285
|
+
function NodeUtils() {
|
5286
|
+
}
|
5287
|
+
// https://stackoverflow.com/questions/3955229/remove-all-child-elements-of-a-dom-node-in-javascript
|
5288
|
+
NodeUtils.removeAllChildNode = function (node) {
|
5289
|
+
while (node === null || node === void 0 ? void 0 : node.firstChild) {
|
5290
|
+
node.firstChild.remove();
|
5291
|
+
}
|
4588
5292
|
};
|
4589
|
-
|
5293
|
+
NodeUtils.appendChild = function (parentNode, childNode) {
|
5294
|
+
return parentNode.appendChild(childNode);
|
5295
|
+
};
|
5296
|
+
NodeUtils.replaceNode = function (targetNode, newNode) {
|
5297
|
+
var _a;
|
5298
|
+
// console.log('repalceNode', targetNode, newNode, targetNode.parentNode)
|
5299
|
+
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, targetNode);
|
5300
|
+
};
|
5301
|
+
NodeUtils.addNode = function (targetNode, newNode) {
|
5302
|
+
var _a;
|
5303
|
+
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(newNode, targetNode.nextSibling);
|
5304
|
+
};
|
5305
|
+
return NodeUtils;
|
4590
5306
|
}());
|
4591
5307
|
|
4592
5308
|
var StorageUtils = /** @class */ (function () {
|
@@ -4598,17 +5314,34 @@ var StorageUtils = /** @class */ (function () {
|
|
4598
5314
|
}
|
4599
5315
|
window.localStorage.setItem(k, v);
|
4600
5316
|
};
|
5317
|
+
StorageUtils.setSessionStorageItem = function (k, v, window) {
|
5318
|
+
if (typeof v === 'object') {
|
5319
|
+
v = JSON.stringify(v);
|
5320
|
+
}
|
5321
|
+
window.sessionStorage.setItem(k, v);
|
5322
|
+
};
|
4601
5323
|
StorageUtils.getLocalStorageItem = function (k, window) {
|
4602
5324
|
return window.localStorage.getItem(k);
|
4603
5325
|
};
|
5326
|
+
StorageUtils.getSessionStorageItem = function (k, window) {
|
5327
|
+
return window.sessionStorage.getItem(k);
|
5328
|
+
};
|
4604
5329
|
StorageUtils.cutLocalStorageItem = function (k, window) {
|
4605
5330
|
var data = StorageUtils.getLocalStorageItem(k, window);
|
4606
5331
|
StorageUtils.removeLocalStorageItem(k, window);
|
4607
5332
|
return data;
|
4608
5333
|
};
|
5334
|
+
StorageUtils.cutSessionStorageItem = function (k, window) {
|
5335
|
+
var data = StorageUtils.getSessionStorageItem(k, window);
|
5336
|
+
StorageUtils.removeSessionStorageItem(k, window);
|
5337
|
+
return data;
|
5338
|
+
};
|
4609
5339
|
StorageUtils.removeLocalStorageItem = function (k, window) {
|
4610
5340
|
return window.localStorage.removeItem(k);
|
4611
5341
|
};
|
5342
|
+
StorageUtils.removeSessionStorageItem = function (k, window) {
|
5343
|
+
return window.sessionStorage.removeItem(k);
|
5344
|
+
};
|
4612
5345
|
StorageUtils.getLocalStorageJsonItem = function (k, window) {
|
4613
5346
|
var item = window.localStorage.getItem(k);
|
4614
5347
|
if (item) {
|
@@ -4623,39 +5356,59 @@ var StorageUtils = /** @class */ (function () {
|
|
4623
5356
|
return undefined;
|
4624
5357
|
}
|
4625
5358
|
};
|
5359
|
+
StorageUtils.getSessionStorageJsonItem = function (k, window) {
|
5360
|
+
var item = window.sessionStorage.getItem(k);
|
5361
|
+
if (item) {
|
5362
|
+
try {
|
5363
|
+
return JSON.parse(item);
|
5364
|
+
}
|
5365
|
+
catch (e) {
|
5366
|
+
return undefined;
|
5367
|
+
}
|
5368
|
+
}
|
5369
|
+
else {
|
5370
|
+
return undefined;
|
5371
|
+
}
|
5372
|
+
};
|
4626
5373
|
StorageUtils.cutLocalStorageJsonItem = function (k, window) {
|
4627
5374
|
var item = StorageUtils.getLocalStorageJsonItem(k, window);
|
4628
5375
|
StorageUtils.removeLocalStorageItem(k, window);
|
4629
5376
|
return item;
|
4630
5377
|
};
|
5378
|
+
StorageUtils.cutSessionStorageJsonItem = function (k, window) {
|
5379
|
+
var item = StorageUtils.getSessionStorageJsonItem(k, window);
|
5380
|
+
StorageUtils.removeSessionStorageItem(k, window);
|
5381
|
+
return item;
|
5382
|
+
};
|
4631
5383
|
StorageUtils.clearLocalStorage = function (window) {
|
4632
5384
|
window.localStorage.clear();
|
4633
5385
|
};
|
5386
|
+
StorageUtils.clearSessionStorage = function (window) {
|
5387
|
+
window.sessionStorage.clear();
|
5388
|
+
};
|
4634
5389
|
return StorageUtils;
|
4635
5390
|
}());
|
4636
5391
|
|
4637
|
-
var
|
4638
|
-
function
|
5392
|
+
var ClipBoardUtils = /** @class */ (function () {
|
5393
|
+
function ClipBoardUtils() {
|
4639
5394
|
}
|
4640
|
-
|
4641
|
-
|
4642
|
-
|
4643
|
-
node.firstChild.remove();
|
4644
|
-
}
|
5395
|
+
ClipBoardUtils.readText = function (clipboard) {
|
5396
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5397
|
+
return clipboard.readText();
|
4645
5398
|
};
|
4646
|
-
|
4647
|
-
|
5399
|
+
ClipBoardUtils.read = function (clipboard) {
|
5400
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5401
|
+
return clipboard.read();
|
4648
5402
|
};
|
4649
|
-
|
4650
|
-
|
4651
|
-
|
4652
|
-
return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, targetNode);
|
5403
|
+
ClipBoardUtils.writeText = function (data, clipboard) {
|
5404
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5405
|
+
return clipboard.writeText(data);
|
4653
5406
|
};
|
4654
|
-
|
4655
|
-
|
4656
|
-
return
|
5407
|
+
ClipBoardUtils.write = function (data, clipboard) {
|
5408
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5409
|
+
return clipboard.write(data);
|
4657
5410
|
};
|
4658
|
-
return
|
5411
|
+
return ClipBoardUtils;
|
4659
5412
|
}());
|
4660
5413
|
|
4661
5414
|
exports.AllCheckedValidatorArray = AllCheckedValidatorArray;
|
@@ -4685,7 +5438,6 @@ exports.DomRenderProxy = DomRenderProxy;
|
|
4685
5438
|
exports.DomUtils = DomUtils;
|
4686
5439
|
exports.Dr = Dr;
|
4687
5440
|
exports.DrAppender = DrAppender;
|
4688
|
-
exports.DrDictionary = DrDictionary;
|
4689
5441
|
exports.DrFor = DrFor;
|
4690
5442
|
exports.DrForOf = DrForOf;
|
4691
5443
|
exports.DrForm = DrForm;
|
@@ -4697,6 +5449,7 @@ exports.DrRepeat = DrRepeat;
|
|
4697
5449
|
exports.DrTargetAttr = DrTargetAttr;
|
4698
5450
|
exports.DrTargetElement = DrTargetElement;
|
4699
5451
|
exports.DrThis = DrThis;
|
5452
|
+
exports.DrThisProperty = DrThisProperty;
|
4700
5453
|
exports.EmptyValidator = EmptyValidator;
|
4701
5454
|
exports.EventManager = EventManager;
|
4702
5455
|
exports.ExcludeCheckedValidatorArray = ExcludeCheckedValidatorArray;
|