dom-render 1.0.96 → 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 +12 -14
- 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 +1075 -328
- 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/DrThisProperty.js +6 -4
- 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 +1 -1
- package/rawsets/CreatorMetaData.d.ts +1 -1
- package/rawsets/ElementInitCallBack.d.ts +1 -1
- package/rawsets/RawSet.d.ts +6 -2
- package/rawsets/RawSet.js +93 -54
- 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;
|
@@ -1978,8 +2057,10 @@ exports.RawSetType = void 0;
|
|
1978
2057
|
var DrThisProperty = /** @class */ (function (_super) {
|
1979
2058
|
__extends(DrThisProperty, _super);
|
1980
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;
|
@@ -1998,7 +2079,7 @@ var DrThisProperty = /** @class */ (function (_super) {
|
|
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);
|
@@ -2024,7 +2105,7 @@ var DrThisProperty = /** @class */ (function (_super) {
|
|
2024
2105
|
var cNode = _c[_i];
|
2025
2106
|
var element = cNode.cloneNode(true);
|
2026
2107
|
element.removeAttribute(RawSet.DR_THIS_PROPERTY_NAME);
|
2027
|
-
element.setAttribute(RawSet.DR_THIS_NAME, "this."
|
2108
|
+
element.setAttribute(RawSet.DR_THIS_NAME, "this." + fullPath);
|
2028
2109
|
element.setAttribute(RawSet.DR_KEY_OPTIONNAME, key);
|
2029
2110
|
// rawSet.point.end.after(element);
|
2030
2111
|
var fg = config.window.document.createDocumentFragment();
|
@@ -2052,6 +2133,605 @@ exports.RawSetOperatorType = void 0;
|
|
2052
2133
|
RawSetOperatorType["DR_THIS_PROPERTY"] = "this-property";
|
2053
2134
|
})(exports.RawSetOperatorType || (exports.RawSetOperatorType = {}));
|
2054
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
|
+
|
2055
2735
|
var RawSet = /** @class */ (function () {
|
2056
2736
|
function RawSet(uuid, type, point, fragment, detect, data) {
|
2057
2737
|
this.uuid = uuid;
|
@@ -2077,7 +2757,7 @@ var RawSet = /** @class */ (function () {
|
|
2077
2757
|
var _a, _b, _c;
|
2078
2758
|
var script = '';
|
2079
2759
|
if (cNode.nodeType === Node.TEXT_NODE) {
|
2080
|
-
script = "`"
|
2760
|
+
script = "`" + ((_a = cNode.textContent) !== null && _a !== void 0 ? _a : '') + "`";
|
2081
2761
|
// console.log('???????', script)
|
2082
2762
|
}
|
2083
2763
|
else if (cNode.nodeType === Node.ELEMENT_NODE) {
|
@@ -2106,11 +2786,11 @@ var RawSet = /** @class */ (function () {
|
|
2106
2786
|
EventManager.VARNAMES.forEach(function (it) {
|
2107
2787
|
// script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), `this?.___${it}`);
|
2108
2788
|
// script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), `this.___${it}`);
|
2109
|
-
script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), "this.___"
|
2789
|
+
script = script.replace(RegExp(it.replace('$', '\\$'), 'g'), "this.___" + it);
|
2110
2790
|
// console.log('scripts-->', script)
|
2111
2791
|
});
|
2112
2792
|
// console.log('----------', script);
|
2113
|
-
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); });
|
2114
2794
|
}
|
2115
2795
|
});
|
2116
2796
|
// console.log('usingTriggerVariable----------->', usingTriggerVariables)
|
@@ -2147,7 +2827,7 @@ var RawSet = /** @class */ (function () {
|
|
2147
2827
|
range: Range.range,
|
2148
2828
|
element: cNode,
|
2149
2829
|
attribute: attribute,
|
2150
|
-
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 "
|
2151
2831
|
// eslint-disable-next-line no-use-before-define
|
2152
2832
|
});
|
2153
2833
|
fag = config.window.document.createDocumentFragment();
|
@@ -2156,13 +2836,13 @@ var RawSet = /** @class */ (function () {
|
|
2156
2836
|
runText = RawSet.exporesionGrouops(textContent)[0][1];
|
2157
2837
|
newNode = void 0;
|
2158
2838
|
if (textContent === null || textContent === void 0 ? void 0 : textContent.startsWith('#')) {
|
2159
|
-
r = ScriptUtils.eval(
|
2839
|
+
r = ScriptUtils.eval(__render.bindScript + " return " + runText, Object.assign(obj, { __render: __render }));
|
2160
2840
|
template = config.window.document.createElement('template');
|
2161
2841
|
template.innerHTML = r;
|
2162
2842
|
newNode = template.content;
|
2163
2843
|
}
|
2164
2844
|
else {
|
2165
|
-
r = ScriptUtils.eval(
|
2845
|
+
r = ScriptUtils.eval(__render.bindScript + " return " + runText, Object.assign(obj, { __render: __render }));
|
2166
2846
|
newNode = config.window.document.createTextNode(r);
|
2167
2847
|
}
|
2168
2848
|
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, cNode);
|
@@ -2247,11 +2927,12 @@ var RawSet = /** @class */ (function () {
|
|
2247
2927
|
fag: genNode,
|
2248
2928
|
scripts: EventManager.setBindProperty(config === null || config === void 0 ? void 0 : config.scripts, obj)
|
2249
2929
|
});
|
2250
|
-
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 }));
|
2251
2931
|
}
|
2252
2932
|
});
|
2253
2933
|
// 중요 style isolation 나중에 :scope로 대체 가능할듯.
|
2254
|
-
|
2934
|
+
// 2023.9.4일 없앰 style 처음들어올때 처리하는걸로 바꿈
|
2935
|
+
// RawSet.generateStyleSheetsLocal(config);
|
2255
2936
|
for (_1 = 0, onThisComponentSetCallBacks_1 = onThisComponentSetCallBacks; _1 < onThisComponentSetCallBacks_1.length; _1++) {
|
2256
2937
|
it_1 = onThisComponentSetCallBacks_1[_1];
|
2257
2938
|
(_q = (_p = it_1.obj) === null || _p === void 0 ? void 0 : _p.onInitRender) === null || _q === void 0 ? void 0 : _q.call(_p);
|
@@ -2262,7 +2943,7 @@ var RawSet = /** @class */ (function () {
|
|
2262
2943
|
oninit = it_2.targetElement.__render.element.getAttribute(RawSet.DR_ON_INIT_ARGUMENTS_OPTIONNAME);
|
2263
2944
|
param = [];
|
2264
2945
|
if (oninit) {
|
2265
|
-
script =
|
2946
|
+
script = it_2.targetElement.__render.renderScript + " return " + oninit + " ";
|
2266
2947
|
param = ScriptUtils.eval(script, Object.assign(obj, {
|
2267
2948
|
__render: it_2.targetElement.__render
|
2268
2949
|
}));
|
@@ -2301,8 +2982,13 @@ var RawSet = /** @class */ (function () {
|
|
2301
2982
|
});
|
2302
2983
|
});
|
2303
2984
|
};
|
2304
|
-
|
2305
|
-
|
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) {
|
2306
2992
|
var _a;
|
2307
2993
|
var styleElement = it.ownerNode;
|
2308
2994
|
var split = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-');
|
@@ -2319,8 +3005,8 @@ var RawSet = /** @class */ (function () {
|
|
2319
3005
|
};
|
2320
3006
|
RawSet.generateCSS = function (id, cssRule) {
|
2321
3007
|
var _this = this;
|
2322
|
-
var start = "#"
|
2323
|
-
var end = "#"
|
3008
|
+
var start = "#" + id + "-start";
|
3009
|
+
var end = "#" + id + "-end";
|
2324
3010
|
if (cssRule.constructor.name === 'CSSStyleRule') {
|
2325
3011
|
var rule = cssRule;
|
2326
3012
|
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
|
@@ -2329,14 +3015,14 @@ var RawSet = /** @class */ (function () {
|
|
2329
3015
|
if (!rule.selectorText.startsWith(':root')) {
|
2330
3016
|
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2331
3017
|
// rule.selectorText = `${start} ~ ${rule.selectorText}:not(${start} ~ ${end} ~ *)`;
|
2332
|
-
var selectorText = ":is("
|
3018
|
+
var selectorText = ":is(" + start + " ~ *:not(" + start + " ~ " + end + " ~ *))";
|
2333
3019
|
if (rule.selectorText.startsWith('.')) {
|
2334
|
-
rule.selectorText = ""
|
3020
|
+
rule.selectorText = "" + selectorText + rule.selectorText + ", " + selectorText + " " + rule.selectorText;
|
2335
3021
|
// rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
|
2336
3022
|
}
|
2337
3023
|
else {
|
2338
|
-
var divText =
|
2339
|
-
rule.selectorText =
|
3024
|
+
var divText = start + " ~ " + rule.selectorText + ":not(" + start + " ~ " + end + " ~ *)";
|
3025
|
+
rule.selectorText = selectorText + " " + rule.selectorText + ", " + divText;
|
2340
3026
|
// rule.selectorText = `${selectorText} ${rule.selectorText}`;
|
2341
3027
|
// rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
|
2342
3028
|
}
|
@@ -2351,13 +3037,40 @@ var RawSet = /** @class */ (function () {
|
|
2351
3037
|
}
|
2352
3038
|
};
|
2353
3039
|
// 중요 스타일 적용 부분
|
2354
|
-
RawSet.generateStyleTransform = function (styleBody,
|
3040
|
+
RawSet.generateStyleTransform = function (styleBody, componentKey, styleTagWrap) {
|
3041
|
+
var _a;
|
2355
3042
|
if (styleTagWrap === void 0) { styleTagWrap = true; }
|
2356
3043
|
if (Array.isArray(styleBody)) {
|
2357
3044
|
styleBody = styleBody.join('\n');
|
2358
3045
|
}
|
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
|
+
});
|
2359
3072
|
if (styleTagWrap) {
|
2360
|
-
styleBody = "<style id='"
|
3073
|
+
styleBody = "<style id='" + componentKey + "-style' domstyle>" + after + "</style>";
|
2361
3074
|
}
|
2362
3075
|
return styleBody;
|
2363
3076
|
};
|
@@ -2378,13 +3091,13 @@ var RawSet = /** @class */ (function () {
|
|
2378
3091
|
var data = element.getAttribute(RawSet.DR_APPENDER_NAME);
|
2379
3092
|
// if (data && !/\[[0-9]+\]/g.test(data)) {
|
2380
3093
|
if (data && !/\[.+\]/g.test(data)) {
|
2381
|
-
var currentIndex = ScriptUtils.evalReturn(
|
3094
|
+
var currentIndex = ScriptUtils.evalReturn(data + "?.length -1", obj);
|
2382
3095
|
// console.log('------?', currentIndex)
|
2383
3096
|
// if (currentIndex === undefined || isNaN(currentIndex)) {
|
2384
3097
|
// return undefined;
|
2385
3098
|
// }
|
2386
3099
|
// const currentIndex = ScriptUtils.evalReturn(`${data}.length`, obj);
|
2387
|
-
data =
|
3100
|
+
data = data + "[" + currentIndex + "]";
|
2388
3101
|
element.setAttribute(RawSet.DR_APPENDER_NAME, data);
|
2389
3102
|
// element.setAttribute(RawSet.DR_IF_NAME, data);
|
2390
3103
|
// element.setAttribute('dr-id', data);
|
@@ -2406,9 +3119,8 @@ var RawSet = /** @class */ (function () {
|
|
2406
3119
|
// 중요 important
|
2407
3120
|
RawSet.checkPointCreates = function (element, obj, config) {
|
2408
3121
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2409
|
-
//
|
3122
|
+
// const NodeFilter = (config.window as any).NodeFilter;
|
2410
3123
|
var thisVariableName = element.__domrender_this_variable_name;
|
2411
|
-
// console.log('checkPointCreates thisVariableName', thisVariableName);
|
2412
3124
|
var nodeIterator = config.window.document.createNodeIterator(element, NodeFilter.SHOW_ALL, {
|
2413
3125
|
acceptNode: function (node) {
|
2414
3126
|
var _a, _b, _c, _d, _e;
|
@@ -2529,7 +3241,7 @@ var RawSet = /** @class */ (function () {
|
|
2529
3241
|
var element = node;
|
2530
3242
|
var start = config.window.document.createElement('meta');
|
2531
3243
|
var end = config.window.document.createElement('meta');
|
2532
|
-
start.setAttribute('id',
|
3244
|
+
start.setAttribute('id', id + "-start");
|
2533
3245
|
var keys = element.getAttribute(RawSet.DR_KEY_OPTIONNAME);
|
2534
3246
|
var thisPropertyType = element.getAttribute(RawSet.DR_THIS_PROPERTY_NAME);
|
2535
3247
|
if (thisPropertyType) {
|
@@ -2539,19 +3251,19 @@ var RawSet = /** @class */ (function () {
|
|
2539
3251
|
element.removeAttribute(RawSet.DR_KEY_OPTIONNAME);
|
2540
3252
|
start.setAttribute(RawSet.DR_KEY_OPTIONNAME, keys);
|
2541
3253
|
}
|
2542
|
-
end.setAttribute('id',
|
3254
|
+
end.setAttribute('id', id + "-end");
|
2543
3255
|
return { start: start, end: end };
|
2544
3256
|
}
|
2545
3257
|
else if (type === exports.RawSetType.STYLE_TEXT) {
|
2546
3258
|
return {
|
2547
|
-
start: config.window.document.createTextNode("/*start text "
|
2548
|
-
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 + "*/")
|
2549
3261
|
};
|
2550
3262
|
}
|
2551
3263
|
else { // text
|
2552
3264
|
return {
|
2553
|
-
start: config.window.document.createComment("start text "
|
2554
|
-
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)
|
2555
3267
|
};
|
2556
3268
|
}
|
2557
3269
|
};
|
@@ -2598,13 +3310,13 @@ var RawSet = /** @class */ (function () {
|
|
2598
3310
|
RawSet.drItOtherEncoding = function (element) {
|
2599
3311
|
var random = RandomUtils.uuid();
|
2600
3312
|
var regex = /#it#/g;
|
2601
|
-
element.querySelectorAll("["
|
3313
|
+
element.querySelectorAll("[" + RawSet.DR_IT_OPTIONNAME + "], [" + RawSet.DR_FOR_OF_NAME + "], [" + RawSet.DR_REPEAT_NAME + "]").forEach(function (it) {
|
2602
3314
|
it.innerHTML = it.innerHTML.replace(regex, random);
|
2603
3315
|
});
|
2604
3316
|
return random;
|
2605
3317
|
};
|
2606
3318
|
RawSet.drItOtherDecoding = function (element, random) {
|
2607
|
-
element.querySelectorAll("["
|
3319
|
+
element.querySelectorAll("[" + RawSet.DR_IT_OPTIONNAME + "], [" + RawSet.DR_FOR_OF_NAME + "], [" + RawSet.DR_REPEAT_NAME + "]").forEach(function (it) {
|
2608
3320
|
it.innerHTML = it.innerHTML.replace(RegExp(random, 'g'), '#it#');
|
2609
3321
|
});
|
2610
3322
|
};
|
@@ -2617,35 +3329,35 @@ var RawSet = /** @class */ (function () {
|
|
2617
3329
|
// element.querySelectorAll(`[${RawSet.DR_PRE_NAME}]`).forEach(it => {
|
2618
3330
|
// let message = it.innerHTML;
|
2619
3331
|
// })
|
2620
|
-
element.querySelectorAll("["
|
3332
|
+
element.querySelectorAll("[" + RawSet.DR_PRE_NAME + "]").forEach(function (it) {
|
2621
3333
|
it.innerHTML = it.innerHTML.replace(/this/g, thisRandom);
|
2622
3334
|
});
|
2623
|
-
element.querySelectorAll("["
|
3335
|
+
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) {
|
2624
3336
|
var message = it.innerHTML;
|
2625
3337
|
StringUtils.regexExec(/([^(dr\-)])?this(?=.?)/g, message).reverse().forEach(function (it) {
|
2626
3338
|
var _a;
|
2627
|
-
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);
|
2628
3340
|
});
|
2629
3341
|
it.innerHTML = message;
|
2630
3342
|
});
|
2631
3343
|
var message = element.innerHTML;
|
2632
3344
|
StringUtils.regexExec(/([^(dr\-)])?this(?=.?)/g, message).reverse().forEach(function (it) {
|
2633
3345
|
var _a;
|
2634
|
-
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);
|
2635
3347
|
});
|
2636
3348
|
element.innerHTML = message;
|
2637
3349
|
return thisRandom;
|
2638
3350
|
};
|
2639
3351
|
RawSet.drThisDecoding = function (element, thisRandom) {
|
2640
|
-
element.querySelectorAll("["
|
3352
|
+
element.querySelectorAll("[" + RawSet.DR_PRE_NAME + "]").forEach(function (it) {
|
2641
3353
|
it.innerHTML = it.innerHTML.replace(RegExp(thisRandom, 'g'), 'this');
|
2642
3354
|
});
|
2643
|
-
element.querySelectorAll("["
|
3355
|
+
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) {
|
2644
3356
|
it.innerHTML = it.innerHTML.replace(RegExp(thisRandom, 'g'), 'this');
|
2645
3357
|
});
|
2646
3358
|
};
|
2647
3359
|
RawSet.drFormOtherMoveAttr = function (element, as, to, config) {
|
2648
|
-
element.querySelectorAll("["
|
3360
|
+
element.querySelectorAll("[" + RawSet.DR_FORM_NAME + "]").forEach(function (subElement) {
|
2649
3361
|
var _a;
|
2650
3362
|
var nodeIterator = config.window.document.createNodeIterator(subElement, NodeFilter.SHOW_ELEMENT, {
|
2651
3363
|
acceptNode: function (node) {
|
@@ -2683,7 +3395,7 @@ var RawSet = /** @class */ (function () {
|
|
2683
3395
|
};
|
2684
3396
|
});
|
2685
3397
|
// element.querySelectorAll(`[${RawSet.DR_THIS_NAME}]`).forEach(it => {
|
2686
|
-
element.querySelectorAll("["
|
3398
|
+
element.querySelectorAll("[" + RawSet.DR_VAR_OPTIONNAME + "]").forEach(function (it) {
|
2687
3399
|
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) {
|
2688
3400
|
it.innerHTML = it.innerHTML.replace(vit.regex, vit.random);
|
2689
3401
|
});
|
@@ -2694,7 +3406,7 @@ var RawSet = /** @class */ (function () {
|
|
2694
3406
|
return vars;
|
2695
3407
|
};
|
2696
3408
|
RawSet.drVarDecoding = function (element, vars) {
|
2697
|
-
element.querySelectorAll("["
|
3409
|
+
element.querySelectorAll("[" + RawSet.DR_THIS_NAME + "]").forEach(function (it) {
|
2698
3410
|
vars.filter(function (vit) { return vit.value && vit.name; }).forEach(function (vit) {
|
2699
3411
|
it.innerHTML = it.innerHTML.replace(RegExp(vit.random, 'g'), vit.value);
|
2700
3412
|
});
|
@@ -2756,7 +3468,7 @@ var RawSet = /** @class */ (function () {
|
|
2756
3468
|
renderScript = '';
|
2757
3469
|
createParam = [];
|
2758
3470
|
if (onCreate) {
|
2759
|
-
script =
|
3471
|
+
script = renderScript + " return " + onCreate + " ";
|
2760
3472
|
createParam = ScriptUtils.eval(script, obj);
|
2761
3473
|
if (!Array.isArray(createParam)) {
|
2762
3474
|
createParam = [createParam];
|
@@ -2765,14 +3477,16 @@ var RawSet = /** @class */ (function () {
|
|
2765
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));
|
2766
3478
|
oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME);
|
2767
3479
|
if (oninit) {
|
2768
|
-
script =
|
3480
|
+
script = renderScript + " " + oninit + " ";
|
2769
3481
|
ScriptUtils.eval(script, obj);
|
2770
3482
|
}
|
2771
3483
|
_m.label = 12;
|
2772
3484
|
case 12:
|
2773
|
-
n.querySelectorAll(eventManager.attrNames.map(function (it) { return "["
|
3485
|
+
n.querySelectorAll(eventManager.attrNames.map(function (it) { return "[" + it + "]"; }).join(',')).forEach(function (it) {
|
2774
3486
|
it.setAttribute(EventManager.ownerVariablePathAttrName, 'this');
|
2775
3487
|
});
|
3488
|
+
// attribute
|
3489
|
+
n.getAttributeNames().forEach(function (it) { return n.setAttribute(it, n.getAttribute(it).replace(/#this#/g, drThis)); });
|
2776
3490
|
thisRandom = this.drThisEncoding(n, drThis);
|
2777
3491
|
vars = this.drVarEncoding(n, drVarOption);
|
2778
3492
|
this.drVarDecoding(n, vars);
|
@@ -2822,10 +3536,11 @@ var RawSet = /** @class */ (function () {
|
|
2822
3536
|
callBack: function (element, obj, rawSet, attrs, config) {
|
2823
3537
|
var _a, _b, _c, _d, _e, _f, _g;
|
2824
3538
|
return __awaiter(this, void 0, void 0, function () {
|
2825
|
-
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;
|
2826
3540
|
return __generator(this, function (_p) {
|
2827
3541
|
switch (_p.label) {
|
2828
3542
|
case 0:
|
3543
|
+
componentKey = rawSet.uuid;
|
2829
3544
|
stylePromises = [];
|
2830
3545
|
if (!(this.template && this.template.startsWith('lazy://'))) return [3 /*break*/, 2];
|
2831
3546
|
return [4 /*yield*/, fetch(this.template.substring(6))];
|
@@ -2878,7 +3593,6 @@ var RawSet = /** @class */ (function () {
|
|
2878
3593
|
obj.__domrender_components = {};
|
2879
3594
|
}
|
2880
3595
|
domrenderComponents = obj.__domrender_components;
|
2881
|
-
componentKey = rawSet.uuid;
|
2882
3596
|
attribute = DomUtils.getAttributeToObject(element);
|
2883
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;';
|
2884
3598
|
render = Object.freeze({
|
@@ -2896,7 +3610,7 @@ var RawSet = /** @class */ (function () {
|
|
2896
3610
|
constructorParam = [];
|
2897
3611
|
// dr-constructor
|
2898
3612
|
if (constructor) {
|
2899
|
-
script =
|
3613
|
+
script = renderScript + " return " + constructor + " ";
|
2900
3614
|
param = (_b = ScriptUtils.eval(script, Object.assign(obj, { __render: render }))) !== null && _b !== void 0 ? _b : [];
|
2901
3615
|
if (!Array.isArray(param)) {
|
2902
3616
|
param = [param];
|
@@ -2908,7 +3622,7 @@ var RawSet = /** @class */ (function () {
|
|
2908
3622
|
instance = domrenderComponents[componentKey];
|
2909
3623
|
i = instance.__domrender_component_new = ((_c = instance.__domrender_component_new) !== null && _c !== void 0 ? _c : new Proxy({}, new DomRenderFinalProxy()));
|
2910
3624
|
i.thisVariableName = rawSet.point.thisVariableName;
|
2911
|
-
i.thisFullVariableName = "this.__domrender_components."
|
3625
|
+
i.thisFullVariableName = "this.__domrender_components." + componentKey;
|
2912
3626
|
i.componentKey = componentKey;
|
2913
3627
|
i.rawSet = rawSet;
|
2914
3628
|
i.attribute = attribute;
|
@@ -2923,7 +3637,7 @@ var RawSet = /** @class */ (function () {
|
|
2923
3637
|
normalAttrMap = element.getAttribute(EventManager.normalAttrMapAttrName);
|
2924
3638
|
if (instance.onChangeAttrRender && normalAttrMap) {
|
2925
3639
|
new Map(JSON.parse(normalAttrMap)).forEach(function (value, key) {
|
2926
|
-
var script =
|
3640
|
+
var script = renderScript + " return " + value + " ";
|
2927
3641
|
var cval = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2928
3642
|
// element.setAttribute(key, cval);
|
2929
3643
|
instance.onChangeAttrRender(key, cval);
|
@@ -2933,7 +3647,7 @@ var RawSet = /** @class */ (function () {
|
|
2933
3647
|
this.__render = render;
|
2934
3648
|
createParam = [];
|
2935
3649
|
if (onCreate) {
|
2936
|
-
script =
|
3650
|
+
script = renderScript + " return " + onCreate + " ";
|
2937
3651
|
createParam = ScriptUtils.eval(script, Object.assign(obj, { __render: render }));
|
2938
3652
|
if (!Array.isArray(createParam)) {
|
2939
3653
|
createParam = [createParam];
|
@@ -2949,20 +3663,20 @@ var RawSet = /** @class */ (function () {
|
|
2949
3663
|
innerHTMLThisRandom = RandomUtils.uuid();
|
2950
3664
|
applayTemplate = applayTemplate.replace(/this\./g, innerHTMLThisRandom);
|
2951
3665
|
// }
|
2952
|
-
applayTemplate = applayTemplate.replace(RegExp("#"
|
3666
|
+
applayTemplate = applayTemplate.replace(RegExp("#" + componentName + "#", 'g'), 'this');
|
2953
3667
|
}
|
2954
3668
|
// applayTemplate = template.replace(RegExp(`#${innerHTMLName}#`, 'g'), applayTemplate);
|
2955
|
-
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);
|
2956
3670
|
oninit = element.getAttribute(RawSet.DR_ON_CREATED_CALLBACK_OPTIONNAME);
|
2957
3671
|
if (oninit) {
|
2958
|
-
script =
|
3672
|
+
script = renderScript + " " + oninit + " ";
|
2959
3673
|
ScriptUtils.eval(script, Object.assign(obj, {
|
2960
3674
|
__render: render
|
2961
3675
|
}));
|
2962
3676
|
}
|
2963
3677
|
style = RawSet.generateStyleTransform(this.styles, componentKey, true);
|
2964
3678
|
element.innerHTML = style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
|
2965
|
-
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)];
|
2966
3680
|
case 12:
|
2967
3681
|
data = _p.sent();
|
2968
3682
|
// 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
|
@@ -3093,9 +3807,9 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3093
3807
|
};
|
3094
3808
|
DomRenderProxy.prototype.run = function (objProxy) {
|
3095
3809
|
var _this = this;
|
3096
|
-
var _a;
|
3810
|
+
var _a, _b;
|
3097
3811
|
this._domRender_proxy = objProxy;
|
3098
|
-
(_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);
|
3099
3813
|
var obj = objProxy._DomRender_origin;
|
3100
3814
|
if (obj) {
|
3101
3815
|
Object.keys(obj).forEach(function (it) {
|
@@ -3121,7 +3835,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3121
3835
|
};
|
3122
3836
|
DomRenderProxy.prototype.initRender = function (target) {
|
3123
3837
|
var _this = this;
|
3124
|
-
var _a, _b, _c, _d
|
3838
|
+
var _a, _b, _c, _d;
|
3125
3839
|
var onCreate = (_b = (_a = target).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME);
|
3126
3840
|
var createParam = [];
|
3127
3841
|
if (onCreate) {
|
@@ -3131,7 +3845,6 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3131
3845
|
}
|
3132
3846
|
}
|
3133
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));
|
3134
|
-
(_e = target.innerHTML) !== null && _e !== void 0 ? _e : '';
|
3135
3848
|
this._targets.add(target);
|
3136
3849
|
var rawSets = RawSet.checkPointCreates(target, this._domRender_proxy, this.config);
|
3137
3850
|
// console.log('initRender -------rawSet', rawSets)
|
@@ -3210,11 +3923,11 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3210
3923
|
new Map(JSON.parse(targetAttrMap)).forEach(function (v, k) {
|
3211
3924
|
var _a;
|
3212
3925
|
// it?.data.onChangeAttrRender(k, null, v);
|
3213
|
-
var isUsing = EventManager.isUsingThisVar(v, "this."
|
3926
|
+
var isUsing = EventManager.isUsingThisVar(v, "this." + fullPathStr);
|
3214
3927
|
if (isUsing) {
|
3215
3928
|
var render = it_1.fragment.render;
|
3216
3929
|
// console.log('render-->', (it.fragment as any).render)
|
3217
|
-
var script =
|
3930
|
+
var script = render.renderScript + " return " + v + " ";
|
3218
3931
|
var cval = ScriptUtils.eval(script, Object.assign((_a = _this._domRender_proxy) !== null && _a !== void 0 ? _a : {}, { __render: render }));
|
3219
3932
|
it_1.data.onChangeAttrRender(k, cval);
|
3220
3933
|
}
|
@@ -3286,7 +3999,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3286
3999
|
// const firstPathStr = paths.slice(1).reverse().join('.');
|
3287
4000
|
var strings = paths.reverse();
|
3288
4001
|
// array같은경우도 키값으로 접근하기때문에 특정 인덱스를 찾아서 그부분만 바꿔줄수 있다.
|
3289
|
-
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);
|
3290
4003
|
// console.log('-------fullPathStr', fullPathStr, lastDoneExecute);
|
3291
4004
|
if (lastDoneExecute) {
|
3292
4005
|
// const firstData = ScriptUtils.evalReturn('this.' + firstPathStr, this._domRender_proxy);
|
@@ -3295,7 +4008,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3295
4008
|
// }
|
3296
4009
|
var iterable_1 = this._rawSets.get(fullPathStr_1);
|
3297
4010
|
// array check
|
3298
|
-
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('');
|
3299
4012
|
var last_1 = strings[strings.length - 1];
|
3300
4013
|
var data_1 = ScriptUtils.evalReturn('this' + front_1, this._domRender_proxy);
|
3301
4014
|
// console.log('-------!!!!!', fullPathStr, iterable, data, front, last);
|
@@ -3350,14 +4063,12 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3350
4063
|
return _this.render(Array.from(iterable_1), fullPathStr_1);
|
3351
4064
|
}
|
3352
4065
|
}).then(function (it) {
|
3353
|
-
console.log('target1------->,', it);
|
3354
4066
|
_this._targets.forEach(function (it) {
|
3355
|
-
console.log('target2------->,', it);
|
3356
4067
|
// return;
|
3357
4068
|
if (it.nodeType === Node.DOCUMENT_FRAGMENT_NODE || it.nodeType === Node.ELEMENT_NODE) {
|
3358
4069
|
var targets = eventManager.findAttrElements(it, _this.config);
|
3359
4070
|
// console.log('------>', targets);
|
3360
|
-
eventManager.changeVar(_this._domRender_proxy, targets, "this."
|
4071
|
+
eventManager.changeVar(_this._domRender_proxy, targets, "this." + fullPathStr_1, _this.config);
|
3361
4072
|
}
|
3362
4073
|
});
|
3363
4074
|
});
|
@@ -3367,7 +4078,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3367
4078
|
return fullPaths;
|
3368
4079
|
};
|
3369
4080
|
DomRenderProxy.prototype.set = function (target, p, value, receiver) {
|
3370
|
-
var _a, _b;
|
4081
|
+
var _a, _b, _c;
|
3371
4082
|
// console.log('set-->', p, value, target, receiver);
|
3372
4083
|
if (typeof p === 'string' && p !== '__domrender_components' && excludeGetSetPropertys.includes(p)) {
|
3373
4084
|
target[p] = value;
|
@@ -3389,12 +4100,12 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3389
4100
|
}
|
3390
4101
|
// console.log('full path:', fullPath);
|
3391
4102
|
if (('onBeforeReturnSet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnSets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
3392
|
-
(_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);
|
3393
4104
|
}
|
3394
4105
|
return true;
|
3395
4106
|
};
|
3396
4107
|
DomRenderProxy.prototype.get = function (target, p, receiver) {
|
3397
|
-
var _a, _b;
|
4108
|
+
var _a, _b, _c;
|
3398
4109
|
// console.log('get-->', target, p, receiver);
|
3399
4110
|
if (p === '_DomRender_origin') {
|
3400
4111
|
return this._domRender_origin;
|
@@ -3425,7 +4136,7 @@ var DomRenderProxy = /** @class */ (function () {
|
|
3425
4136
|
it_2 = it_2._DomRender_origin;
|
3426
4137
|
}
|
3427
4138
|
if (('onBeforeReturnGet' in receiver) && typeof p === 'string' && !((_a = this.config.proxyExcludeOnBeforeReturnGets) !== null && _a !== void 0 ? _a : []).concat(excludeGetSetPropertys).includes(p)) {
|
3428
|
-
(_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));
|
3429
4140
|
}
|
3430
4141
|
return it_2;
|
3431
4142
|
}
|
@@ -3541,7 +4252,7 @@ var Router = /** @class */ (function () {
|
|
3541
4252
|
var _this = this;
|
3542
4253
|
var proxy = this.rootObj._DomRender_proxy;
|
3543
4254
|
if (proxy) {
|
3544
|
-
var key = "___"
|
4255
|
+
var key = "___" + EventManager.ROUTER_VARNAME;
|
3545
4256
|
proxy.render(key);
|
3546
4257
|
}
|
3547
4258
|
this.attachCallbacks.forEach(function (it) {
|
@@ -3968,7 +4679,7 @@ var DomRender = /** @class */ (function () {
|
|
3968
4679
|
function DomRender() {
|
3969
4680
|
}
|
3970
4681
|
DomRender.run = function (obj, target, oConfig) {
|
3971
|
-
var _a, _b, _c
|
4682
|
+
var _a, _b, _c;
|
3972
4683
|
var robj = obj;
|
3973
4684
|
if ('_DomRender_isProxy' in obj) {
|
3974
4685
|
if (target) {
|
@@ -3995,10 +4706,7 @@ var DomRender = /** @class */ (function () {
|
|
3995
4706
|
else if (config.routerType === 'hash') {
|
3996
4707
|
config.router = (_c = config.router) !== null && _c !== void 0 ? _c : new HashRouter(robj, config.window);
|
3997
4708
|
}
|
3998
|
-
else
|
3999
|
-
config.routerType = 'hash';
|
4000
|
-
config.router = (_d = config.router) !== null && _d !== void 0 ? _d : new HashRouter(robj, config.window);
|
4001
|
-
}
|
4709
|
+
else ;
|
4002
4710
|
domRender.run(robj);
|
4003
4711
|
return robj;
|
4004
4712
|
};
|
@@ -4133,21 +4841,6 @@ var CheckedValidator = /** @class */ (function (_super) {
|
|
4133
4841
|
return CheckedValidator;
|
4134
4842
|
}(Validator));
|
4135
4843
|
|
4136
|
-
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4137
|
-
__extends(CountEqualsCheckedValidatorArray, _super);
|
4138
|
-
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
4139
|
-
if (autoValid === void 0) { autoValid = true; }
|
4140
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4141
|
-
_this.count = count;
|
4142
|
-
return _this;
|
4143
|
-
}
|
4144
|
-
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
4145
|
-
var _a;
|
4146
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
4147
|
-
};
|
4148
|
-
return CountEqualsCheckedValidatorArray;
|
4149
|
-
}(ValidatorArray));
|
4150
|
-
|
4151
4844
|
var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4152
4845
|
__extends(CountEqualsUnCheckedValidatorArray, _super);
|
4153
4846
|
function CountEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
@@ -4163,34 +4856,34 @@ var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4163
4856
|
return CountEqualsUnCheckedValidatorArray;
|
4164
4857
|
}(ValidatorArray));
|
4165
4858
|
|
4166
|
-
var
|
4167
|
-
__extends(
|
4168
|
-
function
|
4859
|
+
var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
4860
|
+
__extends(CountGreaterThanCheckedValidatorArray, _super);
|
4861
|
+
function CountGreaterThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
4169
4862
|
if (autoValid === void 0) { autoValid = true; }
|
4170
4863
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4171
4864
|
_this.count = count;
|
4172
4865
|
return _this;
|
4173
4866
|
}
|
4174
|
-
|
4867
|
+
CountGreaterThanCheckedValidatorArray.prototype.valid = function () {
|
4175
4868
|
var _a;
|
4176
|
-
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;
|
4177
4870
|
};
|
4178
|
-
return
|
4871
|
+
return CountGreaterThanCheckedValidatorArray;
|
4179
4872
|
}(ValidatorArray));
|
4180
4873
|
|
4181
|
-
var
|
4182
|
-
__extends(
|
4183
|
-
function
|
4874
|
+
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4875
|
+
__extends(CountEqualsCheckedValidatorArray, _super);
|
4876
|
+
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
4184
4877
|
if (autoValid === void 0) { autoValid = true; }
|
4185
4878
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4186
4879
|
_this.count = count;
|
4187
4880
|
return _this;
|
4188
4881
|
}
|
4189
|
-
|
4882
|
+
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
4190
4883
|
var _a;
|
4191
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return
|
4884
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
4192
4885
|
};
|
4193
|
-
return
|
4886
|
+
return CountEqualsCheckedValidatorArray;
|
4194
4887
|
}(ValidatorArray));
|
4195
4888
|
|
4196
4889
|
var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -4208,19 +4901,34 @@ var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4208
4901
|
return CountGreaterThanUnCheckedValidatorArray;
|
4209
4902
|
}(ValidatorArray));
|
4210
4903
|
|
4211
|
-
var
|
4212
|
-
__extends(
|
4213
|
-
function
|
4904
|
+
var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4905
|
+
__extends(CountGreaterThanEqualsUnCheckedValidatorArray, _super);
|
4906
|
+
function CountGreaterThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
4214
4907
|
if (autoValid === void 0) { autoValid = true; }
|
4215
4908
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4216
4909
|
_this.count = count;
|
4217
4910
|
return _this;
|
4218
4911
|
}
|
4219
|
-
|
4912
|
+
CountGreaterThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
|
4220
4913
|
var _a;
|
4221
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
4914
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
4222
4915
|
};
|
4223
|
-
return
|
4916
|
+
return CountGreaterThanEqualsUnCheckedValidatorArray;
|
4917
|
+
}(ValidatorArray));
|
4918
|
+
|
4919
|
+
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4920
|
+
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
4921
|
+
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
4922
|
+
if (autoValid === void 0) { autoValid = true; }
|
4923
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4924
|
+
_this.count = count;
|
4925
|
+
return _this;
|
4926
|
+
}
|
4927
|
+
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
4928
|
+
var _a;
|
4929
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
4930
|
+
};
|
4931
|
+
return CountGreaterThanEqualsCheckedValidatorArray;
|
4224
4932
|
}(ValidatorArray));
|
4225
4933
|
|
4226
4934
|
var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -4238,20 +4946,6 @@ var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4238
4946
|
return CountLessThanCheckedValidatorArray;
|
4239
4947
|
}(ValidatorArray));
|
4240
4948
|
|
4241
|
-
var EmptyValidator = /** @class */ (function (_super) {
|
4242
|
-
__extends(EmptyValidator, _super);
|
4243
|
-
function EmptyValidator(value, target, event, autoValid) {
|
4244
|
-
if (autoValid === void 0) { autoValid = true; }
|
4245
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
4246
|
-
}
|
4247
|
-
EmptyValidator.prototype.valid = function () {
|
4248
|
-
var _a;
|
4249
|
-
var value = this.value;
|
4250
|
-
return value === undefined || value === null || ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) <= 0;
|
4251
|
-
};
|
4252
|
-
return EmptyValidator;
|
4253
|
-
}(Validator));
|
4254
|
-
|
4255
4949
|
var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
4256
4950
|
__extends(CountLessThanUnCheckedValidatorArray, _super);
|
4257
4951
|
function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
@@ -4267,20 +4961,19 @@ var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4267
4961
|
return CountLessThanUnCheckedValidatorArray;
|
4268
4962
|
}(ValidatorArray));
|
4269
4963
|
|
4270
|
-
var
|
4271
|
-
__extends(
|
4272
|
-
function
|
4964
|
+
var EmptyValidator = /** @class */ (function (_super) {
|
4965
|
+
__extends(EmptyValidator, _super);
|
4966
|
+
function EmptyValidator(value, target, event, autoValid) {
|
4273
4967
|
if (autoValid === void 0) { autoValid = true; }
|
4274
|
-
|
4275
|
-
_this.count = count;
|
4276
|
-
return _this;
|
4968
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
4277
4969
|
}
|
4278
|
-
|
4279
|
-
var _a;
|
4280
|
-
|
4970
|
+
EmptyValidator.prototype.valid = function () {
|
4971
|
+
var _a, _b;
|
4972
|
+
var value = this.value;
|
4973
|
+
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
4281
4974
|
};
|
4282
|
-
return
|
4283
|
-
}(
|
4975
|
+
return EmptyValidator;
|
4976
|
+
}(Validator));
|
4284
4977
|
|
4285
4978
|
var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
4286
4979
|
__extends(ExcludeCheckedValidatorArray, _super);
|
@@ -4304,35 +4997,6 @@ var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
|
4304
4997
|
return ExcludeCheckedValidatorArray;
|
4305
4998
|
}(ValidatorArray));
|
4306
4999
|
|
4307
|
-
var MultipleValidator = /** @class */ (function (_super) {
|
4308
|
-
__extends(MultipleValidator, _super);
|
4309
|
-
function MultipleValidator(validators, value, target, event, autoValid) {
|
4310
|
-
if (autoValid === void 0) { autoValid = true; }
|
4311
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4312
|
-
_this.validators = validators.map(function (it) {
|
4313
|
-
it.setAutoValid(false);
|
4314
|
-
it.setAutoValidAction(false);
|
4315
|
-
return it;
|
4316
|
-
});
|
4317
|
-
_this.validators.forEach(function (it) {
|
4318
|
-
it.set(_this.value, _this.getTarget(), _this.getEvent());
|
4319
|
-
});
|
4320
|
-
return _this;
|
4321
|
-
}
|
4322
|
-
MultipleValidator.prototype.changeValue = function (value) {
|
4323
|
-
var _this = this;
|
4324
|
-
this.validators.forEach(function (it) { return it.set(_this.value, _this.getTarget(), _this.getEvent()); });
|
4325
|
-
};
|
4326
|
-
MultipleValidator.prototype.validAction = function () {
|
4327
|
-
return !(this.validators.filter(function (it) { return !it.validAction(); }).length > 0);
|
4328
|
-
};
|
4329
|
-
MultipleValidator.prototype.valid = function () {
|
4330
|
-
// console.log('mm', this.validators)
|
4331
|
-
return !(this.validators.filter(function (it) { return !it.valid(); }).length > 0);
|
4332
|
-
};
|
4333
|
-
return MultipleValidator;
|
4334
|
-
}(Validator));
|
4335
|
-
|
4336
5000
|
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
4337
5001
|
__extends(IncludeCheckedValidatorArray, _super);
|
4338
5002
|
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
@@ -4373,119 +5037,122 @@ var FormValidator = /** @class */ (function (_super) {
|
|
4373
5037
|
return FormValidator;
|
4374
5038
|
}(Validator));
|
4375
5039
|
|
4376
|
-
var
|
4377
|
-
__extends(
|
4378
|
-
function
|
4379
|
-
if (autoValid === void 0) { autoValid = true; }
|
4380
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
4381
|
-
}
|
4382
|
-
NotEmptyValidator.prototype.valid = function () {
|
4383
|
-
var _a;
|
4384
|
-
var value = this.value;
|
4385
|
-
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
4386
|
-
return value !== undefined && value !== null && ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) > 0;
|
4387
|
-
};
|
4388
|
-
return NotEmptyValidator;
|
4389
|
-
}(Validator));
|
4390
|
-
|
4391
|
-
var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
4392
|
-
__extends(CountLessThanEqualsCheckedValidatorArray, _super);
|
4393
|
-
function CountLessThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
5040
|
+
var MultipleValidator = /** @class */ (function (_super) {
|
5041
|
+
__extends(MultipleValidator, _super);
|
5042
|
+
function MultipleValidator(validators, value, target, event, autoValid) {
|
4394
5043
|
if (autoValid === void 0) { autoValid = true; }
|
4395
5044
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4396
|
-
_this.
|
5045
|
+
_this.validators = validators.map(function (it) {
|
5046
|
+
it.setAutoValid(false);
|
5047
|
+
it.setAutoValidAction(false);
|
5048
|
+
return it;
|
5049
|
+
});
|
5050
|
+
_this.validators.forEach(function (it) {
|
5051
|
+
it.set(_this.value, _this.getTarget(), _this.getEvent());
|
5052
|
+
});
|
4397
5053
|
return _this;
|
4398
5054
|
}
|
4399
|
-
|
4400
|
-
var
|
4401
|
-
|
5055
|
+
MultipleValidator.prototype.changeValue = function (value) {
|
5056
|
+
var _this = this;
|
5057
|
+
this.validators.forEach(function (it) { return it.set(_this.value, _this.getTarget(), _this.getEvent()); });
|
4402
5058
|
};
|
4403
|
-
|
4404
|
-
|
5059
|
+
MultipleValidator.prototype.validAction = function () {
|
5060
|
+
return !(this.validators.filter(function (it) { return !it.validAction(); }).length > 0);
|
5061
|
+
};
|
5062
|
+
MultipleValidator.prototype.valid = function () {
|
5063
|
+
// console.log('mm', this.validators)
|
5064
|
+
return !(this.validators.filter(function (it) { return !it.valid(); }).length > 0);
|
5065
|
+
};
|
5066
|
+
return MultipleValidator;
|
5067
|
+
}(Validator));
|
4405
5068
|
|
4406
|
-
var
|
4407
|
-
__extends(
|
4408
|
-
function
|
5069
|
+
var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
5070
|
+
__extends(CountUnCheckedValidatorArray, _super);
|
5071
|
+
function CountUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
4409
5072
|
if (autoValid === void 0) { autoValid = true; }
|
4410
5073
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4411
5074
|
_this.count = count;
|
4412
5075
|
return _this;
|
4413
5076
|
}
|
4414
|
-
|
5077
|
+
CountUnCheckedValidatorArray.prototype.valid = function () {
|
4415
5078
|
var _a;
|
4416
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length
|
5079
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
4417
5080
|
};
|
4418
|
-
return
|
5081
|
+
return CountUnCheckedValidatorArray;
|
4419
5082
|
}(ValidatorArray));
|
4420
5083
|
|
4421
|
-
var
|
4422
|
-
__extends(
|
4423
|
-
function
|
5084
|
+
var RegExpTestValidator = /** @class */ (function (_super) {
|
5085
|
+
__extends(RegExpTestValidator, _super);
|
5086
|
+
function RegExpTestValidator(regexp, value, target, event, autoValid) {
|
4424
5087
|
if (autoValid === void 0) { autoValid = true; }
|
4425
5088
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4426
5089
|
_this.regexp = DomRenderProxy.final(regexp);
|
4427
5090
|
return _this;
|
4428
5091
|
}
|
4429
|
-
|
5092
|
+
RegExpTestValidator.prototype.valid = function () {
|
4430
5093
|
var _a;
|
4431
5094
|
var value = this.value;
|
4432
5095
|
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
5096
|
+
// console.log('regexp-->', value, this.regexp, regExp.test(value))
|
4433
5097
|
if (value) {
|
4434
|
-
return
|
5098
|
+
return regExp.test(value);
|
4435
5099
|
}
|
4436
5100
|
else {
|
4437
|
-
return
|
5101
|
+
return false;
|
4438
5102
|
}
|
4439
5103
|
};
|
4440
|
-
return
|
5104
|
+
return RegExpTestValidator;
|
4441
5105
|
}(Validator));
|
4442
5106
|
|
4443
|
-
var
|
4444
|
-
__extends(
|
4445
|
-
function
|
5107
|
+
var RequiredValidator = /** @class */ (function (_super) {
|
5108
|
+
__extends(RequiredValidator, _super);
|
5109
|
+
function RequiredValidator(value, target, event, autoValid) {
|
4446
5110
|
if (autoValid === void 0) { autoValid = true; }
|
4447
5111
|
return _super.call(this, value, target, event, autoValid) || this;
|
4448
5112
|
}
|
4449
|
-
|
4450
|
-
|
5113
|
+
RequiredValidator.prototype.valid = function () {
|
5114
|
+
var value = this.value;
|
5115
|
+
// console.log('required', value, value !== undefined && value !== null)
|
5116
|
+
return value !== undefined && value !== null;
|
4451
5117
|
};
|
4452
|
-
return
|
5118
|
+
return RequiredValidator;
|
4453
5119
|
}(Validator));
|
4454
5120
|
|
4455
|
-
var
|
4456
|
-
__extends(
|
4457
|
-
function
|
5121
|
+
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
5122
|
+
__extends(NotRegExpTestValidator, _super);
|
5123
|
+
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
4458
5124
|
if (autoValid === void 0) { autoValid = true; }
|
4459
5125
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4460
5126
|
_this.regexp = DomRenderProxy.final(regexp);
|
4461
5127
|
return _this;
|
4462
5128
|
}
|
4463
|
-
|
5129
|
+
NotRegExpTestValidator.prototype.valid = function () {
|
4464
5130
|
var _a;
|
4465
5131
|
var value = this.value;
|
4466
5132
|
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
4467
|
-
// console.log('regexp-->', value, this.regexp, regExp.test(value))
|
4468
5133
|
if (value) {
|
4469
|
-
return regExp.test(value);
|
5134
|
+
return !regExp.test(value);
|
4470
5135
|
}
|
4471
5136
|
else {
|
4472
|
-
return
|
5137
|
+
return true;
|
4473
5138
|
}
|
4474
5139
|
};
|
4475
|
-
return
|
5140
|
+
return NotRegExpTestValidator;
|
4476
5141
|
}(Validator));
|
4477
5142
|
|
4478
|
-
var
|
4479
|
-
__extends(
|
4480
|
-
function
|
5143
|
+
var NotEmptyValidator = /** @class */ (function (_super) {
|
5144
|
+
__extends(NotEmptyValidator, _super);
|
5145
|
+
function NotEmptyValidator(value, target, event, autoValid) {
|
4481
5146
|
if (autoValid === void 0) { autoValid = true; }
|
4482
5147
|
return _super.call(this, value, target, event, autoValid) || this;
|
4483
5148
|
}
|
4484
|
-
|
5149
|
+
NotEmptyValidator.prototype.valid = function () {
|
4485
5150
|
var _a, _b;
|
4486
|
-
|
5151
|
+
var value = this.value;
|
5152
|
+
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
5153
|
+
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
4487
5154
|
};
|
4488
|
-
return
|
5155
|
+
return NotEmptyValidator;
|
4489
5156
|
}(Validator));
|
4490
5157
|
|
4491
5158
|
var ValidMultipleValidator = /** @class */ (function (_super) {
|
@@ -4503,18 +5170,17 @@ var ValidMultipleValidator = /** @class */ (function (_super) {
|
|
4503
5170
|
return ValidMultipleValidator;
|
4504
5171
|
}(MultipleValidator));
|
4505
5172
|
|
4506
|
-
var
|
4507
|
-
__extends(
|
4508
|
-
function
|
5173
|
+
var UnCheckedValidator = /** @class */ (function (_super) {
|
5174
|
+
__extends(UnCheckedValidator, _super);
|
5175
|
+
function UnCheckedValidator(value, target, event, autoValid) {
|
4509
5176
|
if (autoValid === void 0) { autoValid = true; }
|
4510
5177
|
return _super.call(this, value, target, event, autoValid) || this;
|
4511
5178
|
}
|
4512
|
-
|
4513
|
-
var
|
4514
|
-
|
4515
|
-
return value !== undefined && value !== null;
|
5179
|
+
UnCheckedValidator.prototype.valid = function () {
|
5180
|
+
var _a, _b;
|
5181
|
+
return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
|
4516
5182
|
};
|
4517
|
-
return
|
5183
|
+
return UnCheckedValidator;
|
4518
5184
|
}(Validator));
|
4519
5185
|
|
4520
5186
|
var ValidValidator = /** @class */ (function (_super) {
|
@@ -4545,6 +5211,20 @@ var ValidValidatorArray = /** @class */ (function (_super) {
|
|
4545
5211
|
return ValidValidatorArray;
|
4546
5212
|
}(ValidatorArray));
|
4547
5213
|
|
5214
|
+
var ValueEqualsValidator = /** @class */ (function (_super) {
|
5215
|
+
__extends(ValueEqualsValidator, _super);
|
5216
|
+
function ValueEqualsValidator(equalsValue, value, target, event, autoValid) {
|
5217
|
+
if (autoValid === void 0) { autoValid = true; }
|
5218
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
5219
|
+
_this.equalsValue = equalsValue;
|
5220
|
+
return _this;
|
5221
|
+
}
|
5222
|
+
ValueEqualsValidator.prototype.valid = function () {
|
5223
|
+
return this.value === this.equalsValue;
|
5224
|
+
};
|
5225
|
+
return ValueEqualsValidator;
|
5226
|
+
}(Validator));
|
5227
|
+
|
4548
5228
|
var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
4549
5229
|
__extends(ValueNotEqualsValidator, _super);
|
4550
5230
|
function ValueNotEqualsValidator(equalsValue, value, target, event, autoValid) {
|
@@ -4559,41 +5239,47 @@ var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
|
4559
5239
|
return ValueNotEqualsValidator;
|
4560
5240
|
}(Validator));
|
4561
5241
|
|
4562
|
-
var
|
4563
|
-
__extends(
|
4564
|
-
function
|
5242
|
+
var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
5243
|
+
__extends(CountLessThanEqualsUnCheckedValidatorArray, _super);
|
5244
|
+
function CountLessThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
4565
5245
|
if (autoValid === void 0) { autoValid = true; }
|
4566
5246
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
4567
|
-
_this.
|
5247
|
+
_this.count = count;
|
4568
5248
|
return _this;
|
4569
5249
|
}
|
4570
|
-
|
4571
|
-
|
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;
|
4572
5253
|
};
|
4573
|
-
return
|
4574
|
-
}(
|
5254
|
+
return CountLessThanEqualsUnCheckedValidatorArray;
|
5255
|
+
}(ValidatorArray));
|
4575
5256
|
|
4576
|
-
var
|
4577
|
-
|
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;
|
4578
5264
|
}
|
4579
|
-
|
4580
|
-
|
4581
|
-
return
|
4582
|
-
};
|
4583
|
-
ClipBoardUtils.read = function (clipboard) {
|
4584
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4585
|
-
return clipboard.read();
|
4586
|
-
};
|
4587
|
-
ClipBoardUtils.writeText = function (data, clipboard) {
|
4588
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4589
|
-
return clipboard.writeText(data);
|
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;
|
4590
5268
|
};
|
4591
|
-
|
4592
|
-
|
4593
|
-
|
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;
|
4594
5280
|
};
|
4595
|
-
return
|
4596
|
-
}());
|
5281
|
+
return PassValidator;
|
5282
|
+
}(Validator));
|
4597
5283
|
|
4598
5284
|
var NodeUtils = /** @class */ (function () {
|
4599
5285
|
function NodeUtils() {
|
@@ -4628,17 +5314,34 @@ var StorageUtils = /** @class */ (function () {
|
|
4628
5314
|
}
|
4629
5315
|
window.localStorage.setItem(k, v);
|
4630
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
|
+
};
|
4631
5323
|
StorageUtils.getLocalStorageItem = function (k, window) {
|
4632
5324
|
return window.localStorage.getItem(k);
|
4633
5325
|
};
|
5326
|
+
StorageUtils.getSessionStorageItem = function (k, window) {
|
5327
|
+
return window.sessionStorage.getItem(k);
|
5328
|
+
};
|
4634
5329
|
StorageUtils.cutLocalStorageItem = function (k, window) {
|
4635
5330
|
var data = StorageUtils.getLocalStorageItem(k, window);
|
4636
5331
|
StorageUtils.removeLocalStorageItem(k, window);
|
4637
5332
|
return data;
|
4638
5333
|
};
|
5334
|
+
StorageUtils.cutSessionStorageItem = function (k, window) {
|
5335
|
+
var data = StorageUtils.getSessionStorageItem(k, window);
|
5336
|
+
StorageUtils.removeSessionStorageItem(k, window);
|
5337
|
+
return data;
|
5338
|
+
};
|
4639
5339
|
StorageUtils.removeLocalStorageItem = function (k, window) {
|
4640
5340
|
return window.localStorage.removeItem(k);
|
4641
5341
|
};
|
5342
|
+
StorageUtils.removeSessionStorageItem = function (k, window) {
|
5343
|
+
return window.sessionStorage.removeItem(k);
|
5344
|
+
};
|
4642
5345
|
StorageUtils.getLocalStorageJsonItem = function (k, window) {
|
4643
5346
|
var item = window.localStorage.getItem(k);
|
4644
5347
|
if (item) {
|
@@ -4653,17 +5356,61 @@ var StorageUtils = /** @class */ (function () {
|
|
4653
5356
|
return undefined;
|
4654
5357
|
}
|
4655
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
|
+
};
|
4656
5373
|
StorageUtils.cutLocalStorageJsonItem = function (k, window) {
|
4657
5374
|
var item = StorageUtils.getLocalStorageJsonItem(k, window);
|
4658
5375
|
StorageUtils.removeLocalStorageItem(k, window);
|
4659
5376
|
return item;
|
4660
5377
|
};
|
5378
|
+
StorageUtils.cutSessionStorageJsonItem = function (k, window) {
|
5379
|
+
var item = StorageUtils.getSessionStorageJsonItem(k, window);
|
5380
|
+
StorageUtils.removeSessionStorageItem(k, window);
|
5381
|
+
return item;
|
5382
|
+
};
|
4661
5383
|
StorageUtils.clearLocalStorage = function (window) {
|
4662
5384
|
window.localStorage.clear();
|
4663
5385
|
};
|
5386
|
+
StorageUtils.clearSessionStorage = function (window) {
|
5387
|
+
window.sessionStorage.clear();
|
5388
|
+
};
|
4664
5389
|
return StorageUtils;
|
4665
5390
|
}());
|
4666
5391
|
|
5392
|
+
var ClipBoardUtils = /** @class */ (function () {
|
5393
|
+
function ClipBoardUtils() {
|
5394
|
+
}
|
5395
|
+
ClipBoardUtils.readText = function (clipboard) {
|
5396
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5397
|
+
return clipboard.readText();
|
5398
|
+
};
|
5399
|
+
ClipBoardUtils.read = function (clipboard) {
|
5400
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5401
|
+
return clipboard.read();
|
5402
|
+
};
|
5403
|
+
ClipBoardUtils.writeText = function (data, clipboard) {
|
5404
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5405
|
+
return clipboard.writeText(data);
|
5406
|
+
};
|
5407
|
+
ClipBoardUtils.write = function (data, clipboard) {
|
5408
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
5409
|
+
return clipboard.write(data);
|
5410
|
+
};
|
5411
|
+
return ClipBoardUtils;
|
5412
|
+
}());
|
5413
|
+
|
4667
5414
|
exports.AllCheckedValidatorArray = AllCheckedValidatorArray;
|
4668
5415
|
exports.AllUnCheckedValidatorArray = AllUnCheckedValidatorArray;
|
4669
5416
|
exports.Appender = Appender;
|