dom-render 1.0.73 → 1.0.76
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/Config.d.ts +38 -36
- package/Config.js +2 -2
- package/DomRender.d.ts +28 -4
- package/DomRender.js +90 -39
- package/DomRenderProxy.d.ts +29 -29
- package/DomRenderProxy.js +338 -327
- package/README.MD +638 -511
- package/RawSet.d.ts +140 -117
- package/RawSet.js +765 -882
- package/components/ComponentSet.d.ts +7 -0
- package/components/ComponentSet.js +14 -0
- package/dist/bundle.js +3796 -3133
- package/events/EventManager.d.ts +47 -47
- package/events/EventManager.js +499 -499
- package/iterators/Range.d.ts +22 -22
- package/iterators/Range.js +65 -65
- package/lifecycle/OnBeforeReturnGet.d.ts +3 -3
- package/lifecycle/OnBeforeReturnGet.js +2 -2
- package/lifecycle/OnBeforeReturnSet.d.ts +3 -3
- package/lifecycle/OnBeforeReturnSet.js +2 -2
- package/lifecycle/OnCreateRender.d.ts +3 -3
- package/lifecycle/OnCreateRender.js +2 -2
- package/lifecycle/OnDestroyRender.d.ts +4 -0
- package/lifecycle/OnDestroyRender.js +2 -0
- package/lifecycle/OnInitRender.d.ts +7 -7
- package/lifecycle/OnInitRender.js +2 -2
- package/lifecycle/OnProxyDomRender.d.ts +4 -0
- package/lifecycle/OnProxyDomRender.js +2 -0
- package/managers/RenderManager.d.ts +3 -3
- package/managers/RenderManager.js +18 -18
- package/messenger/DefaultMessenger.d.ts +3 -0
- package/messenger/DefaultMessenger.js +27 -0
- package/messenger/Messenger.d.ts +78 -0
- package/messenger/Messenger.js +201 -0
- package/operators/Appender.d.ts +7 -12
- package/operators/Appender.js +32 -39
- package/operators/AttrExpresion.d.ts +4 -0
- package/operators/AttrExpresion.js +68 -0
- package/operators/Dr.d.ts +4 -0
- package/operators/Dr.js +62 -0
- package/operators/DrAppender.d.ts +4 -0
- package/operators/DrAppender.js +65 -0
- package/operators/DrFor.d.ts +4 -0
- package/operators/DrFor.js +62 -0
- package/operators/DrForOf.d.ts +4 -0
- package/operators/DrForOf.js +65 -0
- package/operators/DrForm.d.ts +4 -0
- package/operators/DrForm.js +100 -0
- package/operators/DrIf.d.ts +4 -0
- package/operators/DrIf.js +72 -0
- package/operators/DrInnerHTML.d.ts +4 -0
- package/operators/DrInnerHTML.js +60 -0
- package/operators/DrInnerText.d.ts +4 -0
- package/operators/DrInnerText.js +58 -0
- package/operators/DrPre.d.ts +4 -0
- package/operators/DrPre.js +30 -0
- package/operators/DrRepeat.d.ts +4 -0
- package/operators/DrRepeat.js +63 -0
- package/operators/DrTargetAttr.d.ts +4 -0
- package/operators/DrTargetAttr.js +55 -0
- package/operators/DrTargetElement.d.ts +4 -0
- package/operators/DrTargetElement.js +65 -0
- package/operators/DrThis.d.ts +4 -0
- package/operators/DrThis.js +59 -0
- package/operators/OperatorRender.d.ts +41 -0
- package/operators/OperatorRender.js +21 -0
- package/package.json +94 -94
- package/routers/HashRouter.d.ts +9 -9
- package/routers/HashRouter.js +53 -53
- package/routers/PathRouter.d.ts +9 -9
- package/routers/PathRouter.js +52 -52
- package/routers/Router.d.ts +25 -22
- package/routers/Router.js +116 -94
- package/types/Types.d.ts +14 -14
- package/types/Types.js +36 -36
- package/utils/clipboard/ClipBoardUtils.d.ts +6 -6
- package/utils/clipboard/ClipBoardUtils.js +25 -25
- package/utils/dom/DomUtils.d.ts +13 -13
- package/utils/dom/DomUtils.js +47 -47
- package/utils/location/LocationUtils.d.ts +16 -16
- package/utils/location/LocationUtils.js +57 -57
- package/utils/node/NodeUtils.d.ts +10 -10
- package/utils/node/NodeUtils.js +27 -27
- package/utils/random/RandomUtils.d.ts +7 -7
- package/utils/random/RandomUtils.js +47 -47
- package/utils/script/ScriptUtils.d.ts +14 -14
- package/utils/script/ScriptUtils.js +89 -89
- package/utils/storage/StorageUtils.d.ts +9 -9
- package/utils/storage/StorageUtils.js +48 -48
- package/utils/string/StringUtils.d.ts +5 -5
- package/utils/string/StringUtils.js +41 -41
- package/utils/valid/ValidUtils.d.ts +10 -10
- package/utils/valid/ValidUtils.js +78 -78
- package/validators/AllCheckedValidatorArray.d.ts +6 -6
- package/validators/AllCheckedValidatorArray.js +32 -32
- package/validators/AllUnCheckedValidatorArray.d.ts +6 -6
- package/validators/AllUnCheckedValidatorArray.js +32 -32
- package/validators/CheckedValidator.d.ts +5 -5
- package/validators/CheckedValidator.js +32 -32
- package/validators/CountEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanUnCheckedValidatorArray.js +34 -34
- package/validators/CountUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountUnCheckedValidatorArray.js +34 -34
- package/validators/EmptyValidator.d.ts +5 -5
- package/validators/EmptyValidator.js +33 -33
- package/validators/ExcludeCheckedValidatorArray.d.ts +8 -8
- package/validators/ExcludeCheckedValidatorArray.js +41 -41
- package/validators/FormValidator.d.ts +7 -7
- package/validators/FormValidator.js +37 -37
- package/validators/IncludeCheckedValidatorArray.d.ts +8 -8
- package/validators/IncludeCheckedValidatorArray.js +41 -41
- package/validators/MultipleValidator.d.ts +8 -8
- package/validators/MultipleValidator.js +48 -48
- package/validators/NonPassValidator.d.ts +5 -5
- package/validators/NonPassValidator.js +31 -31
- package/validators/NotEmptyValidator.d.ts +5 -5
- package/validators/NotEmptyValidator.js +34 -34
- package/validators/NotRegExpTestValidator.d.ts +6 -6
- package/validators/NotRegExpTestValidator.js +42 -42
- package/validators/PassValidator.d.ts +5 -5
- package/validators/PassValidator.js +31 -31
- package/validators/RegExpTestValidator.d.ts +6 -6
- package/validators/RegExpTestValidator.js +43 -43
- package/validators/RequiredValidator.d.ts +5 -5
- package/validators/RequiredValidator.js +33 -33
- package/validators/UnCheckedValidator.d.ts +5 -5
- package/validators/UnCheckedValidator.js +32 -32
- package/validators/ValidMultipleValidator.d.ts +9 -9
- package/validators/ValidMultipleValidator.js +34 -34
- package/validators/ValidValidator.d.ts +6 -6
- package/validators/ValidValidator.js +33 -33
- package/validators/ValidValidatorArray.d.ts +7 -7
- package/validators/ValidValidatorArray.js +33 -33
- package/validators/Validator.d.ts +57 -57
- package/validators/Validator.js +242 -242
- package/validators/ValidatorArray.d.ts +17 -17
- package/validators/ValidatorArray.js +99 -99
- package/validators/ValueEqualsValidator.d.ts +6 -6
- package/validators/ValueEqualsValidator.js +33 -33
- package/validators/ValueNotEqualsValidator.d.ts +6 -6
- package/validators/ValueNotEqualsValidator.js +33 -33
package/operators/Appender.js
CHANGED
@@ -1,39 +1,32 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
var Appender = /** @class */ (function () {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
var
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
// (this.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
this
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
};
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
delete this[i];
|
34
|
-
}
|
35
|
-
this.length = 0;
|
36
|
-
};
|
37
|
-
return AppenderContainer;
|
38
|
-
}());
|
39
|
-
exports.AppenderContainer = AppenderContainer;
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Appender = void 0;
|
4
|
+
var Appender = /** @class */ (function () {
|
5
|
+
// [keys: string]: any;
|
6
|
+
function Appender() {
|
7
|
+
this.length = 0;
|
8
|
+
// (this.childs as any).isAppender = true;
|
9
|
+
}
|
10
|
+
Appender.prototype.push = function () {
|
11
|
+
var items = [];
|
12
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
13
|
+
items[_i] = arguments[_i];
|
14
|
+
}
|
15
|
+
// console.log('----2>', this.length)
|
16
|
+
items.index = this.length;
|
17
|
+
this[this.length++] = items;
|
18
|
+
// console.log('---22->', this.length)
|
19
|
+
// const appender = this.childs[this.lastIndex];
|
20
|
+
// appender.values = items;
|
21
|
+
// this.childs.push(new Appender(appender.index + 1));
|
22
|
+
};
|
23
|
+
Appender.prototype.clear = function () {
|
24
|
+
// console.log('length', this.length);
|
25
|
+
for (var i = 0; i < this.length; i++) {
|
26
|
+
delete this[i];
|
27
|
+
}
|
28
|
+
this.length = 0;
|
29
|
+
};
|
30
|
+
return Appender;
|
31
|
+
}());
|
32
|
+
exports.Appender = Appender;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.AttrExpresion = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var AttrExpresion = /** @class */ (function (_super) {
|
34
|
+
__extends(AttrExpresion, _super);
|
35
|
+
function AttrExpresion() {
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
37
|
+
}
|
38
|
+
AttrExpresion.prototype.execRender = function () {
|
39
|
+
var _a;
|
40
|
+
var _this = this;
|
41
|
+
var _b;
|
42
|
+
var targetAttrs = this.elementSource.element.getAttributeNames()
|
43
|
+
.filter(function (it) { return RawSet_1.RawSet.isExporesion(_this.elementSource.element.getAttribute(it)); })
|
44
|
+
.map(function (it) { return ({ name: it, expresion: RawSet_1.RawSet.exporesionGrouops(_this.elementSource.element.getAttribute(it))[0][1] }); })
|
45
|
+
.filter(function (it) { return it.name.length > 0 && it.expresion.length > 0; })
|
46
|
+
.map(function (it) {
|
47
|
+
return "n.setAttribute('".concat(it.name, "', ").concat(it.expresion, ")");
|
48
|
+
});
|
49
|
+
// console.log('-----', targetAttrs)
|
50
|
+
if ((targetAttrs === null || targetAttrs === void 0 ? void 0 : targetAttrs.length) > 0) {
|
51
|
+
var newTemp = this.source.config.window.document.createElement('temp');
|
52
|
+
// console.log('------>', targetAttrs, targetAttrs.join(';'))
|
53
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true);\n ").concat(targetAttrs.join(';'), ";\n this.__render.fag.append(n);\n "), Object.assign(this.source.obj, {
|
54
|
+
__render: Object.freeze(__assign({ fag: newTemp, targetAttrs: targetAttrs }, this.render))
|
55
|
+
}));
|
56
|
+
var tempalte = this.source.config.window.document.createElement('template');
|
57
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
58
|
+
this.returnContainer.fag.append(tempalte.content);
|
59
|
+
var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
60
|
+
(_b = this.elementSource.element.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
61
|
+
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
62
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
63
|
+
}
|
64
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
65
|
+
};
|
66
|
+
return AttrExpresion;
|
67
|
+
}(OperatorRender_1.OperatorRender));
|
68
|
+
exports.AttrExpresion = AttrExpresion;
|
package/operators/Dr.js
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.Dr = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var Dr = /** @class */ (function (_super) {
|
34
|
+
__extends(Dr, _super);
|
35
|
+
function Dr() {
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
37
|
+
}
|
38
|
+
Dr.prototype.execRender = function () {
|
39
|
+
var _a;
|
40
|
+
var _b, _c;
|
41
|
+
if (this.elementSource.attrs.dr !== null && this.elementSource.attrs.dr.length >= 0) {
|
42
|
+
var itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
|
43
|
+
var vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_b = this.elementSource.attrs.drVarOption) !== null && _b !== void 0 ? _b : '');
|
44
|
+
var newTemp = this.source.config.window.document.createElement('temp');
|
45
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true);\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt)))\n // console.log('----', n.innerHTML);\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n // console.log('----', n.innerHTML);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__fag.append(it));\n } else {\n this.__render.fag.append(n);\n }"), Object.assign(this.source.obj, {
|
46
|
+
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
47
|
+
}));
|
48
|
+
RawSet_1.RawSet.drVarDecoding(newTemp, vars);
|
49
|
+
RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
|
50
|
+
var tempalte = this.source.config.window.document.createElement('template');
|
51
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
52
|
+
this.returnContainer.fag.append(tempalte.content);
|
53
|
+
var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
54
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
55
|
+
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
56
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
57
|
+
}
|
58
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
59
|
+
};
|
60
|
+
return Dr;
|
61
|
+
}(OperatorRender_1.OperatorRender));
|
62
|
+
exports.Dr = Dr;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DrAppender = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var DrAppender = /** @class */ (function (_super) {
|
34
|
+
__extends(DrAppender, _super);
|
35
|
+
function DrAppender() {
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
37
|
+
}
|
38
|
+
DrAppender.prototype.execRender = function () {
|
39
|
+
var _a;
|
40
|
+
var _b, _c, _d, _e;
|
41
|
+
if (this.elementSource.attrs.drAppender) {
|
42
|
+
var itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
|
43
|
+
var vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_b = this.elementSource.attrs.drVarOption) !== null && _b !== void 0 ? _b : '');
|
44
|
+
var newTemp = this.source.config.window.document.createElement('temp');
|
45
|
+
ScriptUtils_1.ScriptUtils.eval("\n try{\n ".concat(this.render.bindScript, "\n ").concat((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '', "\n const ifWrap = document.createElement('div');\n ifWrap.setAttribute('dr-strip', 'true');\n ifWrap.setAttribute('dr-if', '").concat(this.elementSource.attrs.drAppender, " && ").concat(this.elementSource.attrs.drAppender, ".length > 0');\n const n = this.__render.element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drAppender' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n n.setAttribute('dr-for-of', '").concat(this.elementSource.attrs.drAppender, "[' + (").concat(this.elementSource.attrs.drAppender, ".length-1) + ']');\n n.setAttribute('dr-next', '").concat(this.elementSource.attrs.drAppender, ",' + ").concat(this.elementSource.attrs.drAppender, ".length);\n ifWrap.append(n);\n \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 this.__render.fag.append(ifWrap);\n ").concat((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '', "\n }catch(e){}\n "), Object.assign(this.source.obj, {
|
46
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet_1.RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
47
|
+
// eslint-disable-next-line no-use-before-define
|
48
|
+
))
|
49
|
+
}));
|
50
|
+
RawSet_1.RawSet.drVarDecoding(newTemp, vars);
|
51
|
+
RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
|
52
|
+
var tempalte = this.source.config.window.document.createElement('template');
|
53
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
54
|
+
this.returnContainer.fag.append(tempalte.content);
|
55
|
+
var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
56
|
+
(_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
57
|
+
// const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
|
58
|
+
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
59
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
60
|
+
}
|
61
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
62
|
+
};
|
63
|
+
return DrAppender;
|
64
|
+
}(OperatorRender_1.OperatorRender));
|
65
|
+
exports.DrAppender = DrAppender;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DrFor = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var DrFor = /** @class */ (function (_super) {
|
34
|
+
__extends(DrFor, _super);
|
35
|
+
function DrFor() {
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
37
|
+
}
|
38
|
+
DrFor.prototype.execRender = function () {
|
39
|
+
var _a;
|
40
|
+
var _b, _c, _d, _e;
|
41
|
+
if (this.elementSource.attrs.drFor) {
|
42
|
+
var itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
|
43
|
+
var vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_b = this.elementSource.attrs.drVarOption) !== null && _b !== void 0 ? _b : '');
|
44
|
+
var newTemp = this.source.config.window.document.createElement('temp');
|
45
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '', "\n for(").concat(this.elementSource.attrs.drFor, ") {\n const n = this.__render.element.cloneNode(true);\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearForIt\\#/g, destIt).replace(/\\#nearForIndex\\#/g, destIt))) \n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, destIt);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }\n ").concat((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '', "\n "), Object.assign(this.source.obj, {
|
46
|
+
__render: Object.freeze(__assign({ fag: newTemp, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
47
|
+
}));
|
48
|
+
RawSet_1.RawSet.drVarDecoding(newTemp, vars);
|
49
|
+
RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
|
50
|
+
var tempalte = this.source.config.window.document.createElement('template');
|
51
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
52
|
+
this.returnContainer.fag.append(tempalte.content);
|
53
|
+
var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
54
|
+
(_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
55
|
+
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
56
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
57
|
+
}
|
58
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
59
|
+
};
|
60
|
+
return DrFor;
|
61
|
+
}(OperatorRender_1.OperatorRender));
|
62
|
+
exports.DrFor = DrFor;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DrForOf = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var DrForOf = /** @class */ (function (_super) {
|
34
|
+
__extends(DrForOf, _super);
|
35
|
+
function DrForOf() {
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
37
|
+
}
|
38
|
+
DrForOf.prototype.execRender = function () {
|
39
|
+
var _a;
|
40
|
+
var _b, _c, _d, _e;
|
41
|
+
if (this.elementSource.attrs.drForOf) {
|
42
|
+
var itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
|
43
|
+
var vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_b = this.elementSource.attrs.drVarOption) !== null && _b !== void 0 ? _b : '');
|
44
|
+
var newTemp = this.source.config.window.document.createElement('temp');
|
45
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '', "\n var i = 0; \n const forOf = ").concat(this.elementSource.attrs.drForOf, ";\n const forOfStr = `").concat(this.elementSource.attrs.drForOf, "`.trim();\n if (forOf) {\n for(const it of forOf) {\n var destIt = it;\n if (/\\[(.*,?)\\],/g.test(forOfStr)) {\n if (typeof it === 'string') {\n destIt = it;\n } else {\n destIt = forOfStr.substring(1, forOfStr.length-1).split(',')[i];\n }\n } else if (forOf.isRange) {\n destIt = it;\n } else {\n destIt = forOfStr + '[' + i +']'\n }\n const n = this.__render.element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drForOf' && k !== 'drNextOption' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt).replace(/\\#nearForOfIt\\#/g, destIt).replace(/\\#it\\#/g, destIt).replace(/\\#nearForOfIndex\\#/g, i)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt).replace(/\\#index\\#/g, i);\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n i++;\n }\n \n if('").concat(this.elementSource.attrs.drNextOption, "' !== 'null') {\n const n = this.__render.element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drForOf' && k !== 'drNextOption' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n const [name, idx] = '").concat(this.elementSource.attrs.drNextOption, "'.split(',');\n n.setAttribute('dr-for-of', name + '[' + idx + ']');\n n.setAttribute('dr-next', name + ',' + (Number(idx) + 1));\n this.__render.fag.append(n);\n }\n }\n ").concat((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '', "\n "), Object.assign(this.source.obj, {
|
46
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet_1.RawSet.drAttrsOriginName, fag: newTemp }, this.render
|
47
|
+
// eslint-disable-next-line no-use-before-define
|
48
|
+
))
|
49
|
+
}));
|
50
|
+
RawSet_1.RawSet.drVarDecoding(newTemp, vars);
|
51
|
+
RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
|
52
|
+
var tempalte = this.source.config.window.document.createElement('template');
|
53
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
54
|
+
this.returnContainer.fag.append(tempalte.content);
|
55
|
+
var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
56
|
+
(_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
57
|
+
// const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
|
58
|
+
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
59
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
60
|
+
}
|
61
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
62
|
+
};
|
63
|
+
return DrForOf;
|
64
|
+
}(OperatorRender_1.OperatorRender));
|
65
|
+
exports.DrForOf = DrForOf;
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DrForm = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var Validator_1 = require("../validators/Validator");
|
34
|
+
var EventManager_1 = require("../events/EventManager");
|
35
|
+
var ValidatorArray_1 = require("../validators/ValidatorArray");
|
36
|
+
var DrForm = /** @class */ (function (_super) {
|
37
|
+
__extends(DrForm, _super);
|
38
|
+
function DrForm() {
|
39
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
40
|
+
}
|
41
|
+
DrForm.prototype.execRender = function () {
|
42
|
+
var _a;
|
43
|
+
var _this = this;
|
44
|
+
var _b;
|
45
|
+
if (this.elementSource.attrs.drForm) {
|
46
|
+
RawSet_1.RawSet.drFormOtherMoveAttr(this.elementSource.element, 'name', 'temp-name', this.source.config);
|
47
|
+
var data = ScriptUtils_1.ScriptUtils.evalReturn("".concat(this.elementSource.attrs.drForm), this.source.obj);
|
48
|
+
var childs = Array.from(this.elementSource.element.querySelectorAll('[name]'));
|
49
|
+
var fromName = ScriptUtils_1.ScriptUtils.evalReturn((_b = this.elementSource.element.getAttribute('dr-form:name')) !== null && _b !== void 0 ? _b : '', this.source.obj);
|
50
|
+
var thisName = fromName !== null && fromName !== void 0 ? fromName : this.elementSource.element.getAttribute('name');
|
51
|
+
// console.log('dr-form:name', thisName, element.getAttribute('dr-form:name'), obj, element);
|
52
|
+
// // 자기자신이 Input 대상일때
|
53
|
+
if (childs.length <= 0 && thisName) {
|
54
|
+
childs.push(this.elementSource.element);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
if (data instanceof Validator_1.Validator) {
|
58
|
+
data.setTarget(this.elementSource.element);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
childs.forEach(function (it) {
|
62
|
+
var _a, _b, _c, _d, _e;
|
63
|
+
var eventName = (_a = it.getAttribute('dr-form:event')) !== null && _a !== void 0 ? _a : 'change';
|
64
|
+
var validatorName = it.getAttribute('dr-form:validator');
|
65
|
+
var attrEventName = EventManager_1.EventManager.attrPrefix + 'event-' + eventName;
|
66
|
+
var varpath = (_c = ScriptUtils_1.ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute('dr-form:name')) !== null && _b !== void 0 ? _b : '', _this.source.obj)) !== null && _c !== void 0 ? _c : it.getAttribute('name');
|
67
|
+
if (varpath != null) {
|
68
|
+
if (validatorName) {
|
69
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(_this.render.bindScript, "\n const validator = typeof ").concat(validatorName, " ==='function' ? new ").concat(validatorName, "() : ").concat(validatorName, ";\n ").concat(_this.elementSource.attrs.drForm, "['").concat(varpath, "'] = validator;\n "), Object.assign(_this.source.obj, {
|
70
|
+
__render: Object.freeze(__assign({ drStripOption: _this.elementSource.attrs.drStripOption }, _this.render))
|
71
|
+
}));
|
72
|
+
}
|
73
|
+
varpath = "".concat(_this.elementSource.attrs.drForm, "['").concat(varpath, "']");
|
74
|
+
var data_1 = ScriptUtils_1.ScriptUtils.evalReturn("".concat(varpath), _this.source.obj);
|
75
|
+
if (data_1 instanceof ValidatorArray_1.ValidatorArray) {
|
76
|
+
it.setAttribute(attrEventName, "".concat(varpath, ".setArrayValue($target, $target.value, $event); ").concat((_d = it.getAttribute(attrEventName)) !== null && _d !== void 0 ? _d : '', ";"));
|
77
|
+
data_1.addValidator(it.value, it);
|
78
|
+
}
|
79
|
+
else if (data_1 instanceof Validator_1.Validator) {
|
80
|
+
// varpath += (varpath ? '.value' : 'value');
|
81
|
+
// varpath = drAttr.drForm + '.' + varpath;
|
82
|
+
// it.setAttribute(attrEventName, `${varpath} = $target.value; ${target}=$target; ${event}=$event;`);
|
83
|
+
it.setAttribute(attrEventName, "".concat(varpath, ".set($target.value, $target, $event); ").concat((_e = it.getAttribute(attrEventName)) !== null && _e !== void 0 ? _e : '', ";"));
|
84
|
+
data_1.setTarget(it);
|
85
|
+
data_1.value = it.value;
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
it.setAttribute(attrEventName, "".concat(varpath, " = $target.value;"));
|
89
|
+
}
|
90
|
+
}
|
91
|
+
});
|
92
|
+
RawSet_1.RawSet.drFormOtherMoveAttr(this.elementSource.element, 'temp-name', 'name', this.source.config);
|
93
|
+
(_a = this.returnContainer.raws).push.apply(_a, RawSet_1.RawSet.checkPointCreates(this.elementSource.element, this.source.config));
|
94
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
95
|
+
}
|
96
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
97
|
+
};
|
98
|
+
return DrForm;
|
99
|
+
}(OperatorRender_1.OperatorRender));
|
100
|
+
exports.DrForm = DrForm;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DrIf = void 0;
|
30
|
+
var OperatorRender_1 = require("./OperatorRender");
|
31
|
+
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
32
|
+
var RawSet_1 = require("../RawSet");
|
33
|
+
var DrIf = /** @class */ (function (_super) {
|
34
|
+
__extends(DrIf, _super);
|
35
|
+
function DrIf() {
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
37
|
+
}
|
38
|
+
DrIf.prototype.execRender = function () {
|
39
|
+
var _a;
|
40
|
+
var _b, _c, _d, _e;
|
41
|
+
if (this.elementSource.attrs.drIf) {
|
42
|
+
var itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
|
43
|
+
var vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_b = this.elementSource.attrs.drVarOption) !== null && _b !== void 0 ? _b : '');
|
44
|
+
var newTemp = this.source.config.window.document.createElement('temp');
|
45
|
+
// Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drIf' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v)); <-- 이부분은 다른 attr에도 적용을 할지말지 생각해야됨 엘리먼트 존재유무에 따라서 적용을 할지말지 결정해야됨
|
46
|
+
var keepgoing = ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : '', "\n if ($rawset.data === (").concat(this.elementSource.attrs.drIf, ")) {\n return false;\n }\n $rawset.data = ").concat(this.elementSource.attrs.drIf, "\n if($rawset.data) {\n const n = $element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drIf' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }\n ").concat((_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : '', ";\n return true;\n "), Object.assign(this.source.obj, {
|
47
|
+
__render: Object.freeze(__assign({ fag: newTemp, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet_1.RawSet.drAttrsOriginName, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
48
|
+
}));
|
49
|
+
// console.log('keepgoing', keepgoing);
|
50
|
+
if (keepgoing === false) {
|
51
|
+
return OperatorRender_1.ExecuteState.STOP;
|
52
|
+
}
|
53
|
+
RawSet_1.RawSet.drVarDecoding(newTemp, vars);
|
54
|
+
RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
|
55
|
+
// const bypass = (newTemp.innerHTML ?? '').trim().length <= 0;
|
56
|
+
var tempalte = this.source.config.window.document.createElement('template');
|
57
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
58
|
+
// console.log(tempalte.innerHTML)
|
59
|
+
this.returnContainer.fag.append(tempalte.content);
|
60
|
+
var rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.config);
|
61
|
+
(_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
62
|
+
(_a = this.returnContainer.raws).push.apply(_a, rr);
|
63
|
+
// if (bypass) {
|
64
|
+
// continue;
|
65
|
+
// }
|
66
|
+
return OperatorRender_1.ExecuteState.EXECUTE;
|
67
|
+
}
|
68
|
+
return OperatorRender_1.ExecuteState.NO_EXECUTE;
|
69
|
+
};
|
70
|
+
return DrIf;
|
71
|
+
}(OperatorRender_1.OperatorRender));
|
72
|
+
exports.DrIf = DrIf;
|