dom-render 1.0.91 → 1.0.92
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.js +5 -1
- package/DomRenderProxy.d.ts +1 -1
- package/DomRenderProxy.js +121 -63
- package/README.MD +14 -2
- package/configs/TargetElement.d.ts +1 -1
- package/dist/bundle.js +1189 -835
- package/events/EventManager.js +1 -0
- package/operators/Dr.d.ts +1 -1
- package/operators/Dr.js +58 -17
- package/operators/DrAppender.d.ts +1 -1
- package/operators/DrAppender.js +61 -21
- package/operators/DrFor.d.ts +1 -1
- package/operators/DrFor.js +58 -17
- package/operators/DrForOf.d.ts +1 -1
- package/operators/DrForOf.js +61 -20
- package/operators/DrForm.d.ts +1 -1
- package/operators/DrForm.js +87 -46
- package/operators/DrIf.d.ts +1 -1
- package/operators/DrIf.js +62 -23
- package/operators/DrInnerHTML.d.ts +1 -1
- package/operators/DrInnerHTML.js +56 -15
- package/operators/DrInnerText.d.ts +1 -1
- package/operators/DrInnerText.js +54 -13
- package/operators/DrPre.d.ts +1 -1
- package/operators/DrPre.js +41 -1
- package/operators/DrRepeat.d.ts +1 -1
- package/operators/DrRepeat.js +58 -17
- package/operators/DrTargetAttr.d.ts +1 -1
- package/operators/DrTargetAttr.js +64 -23
- package/operators/DrTargetElement.d.ts +1 -1
- package/operators/DrTargetElement.js +78 -34
- package/operators/DrThis.d.ts +1 -1
- package/operators/DrThis.js +73 -23
- package/operators/OperatorExecuter.d.ts +3 -2
- package/operators/OperatorExecuter.js +60 -14
- package/operators/OperatorExecuterAttrRequire.d.ts +2 -2
- package/operators/OperatorExecuterAttrRequire.js +48 -24
- package/package.json +1 -1
- package/rawsets/RawSet.d.ts +3 -3
- package/rawsets/RawSet.js +458 -315
- package/routers/HashRouter.js +1 -1
- package/routers/PathRouter.js +1 -1
- package/routers/Router.d.ts +3 -0
- package/routers/Router.js +10 -0
package/operators/DrForm.js
CHANGED
@@ -25,6 +25,42 @@ var __assign = (this && this.__assign) || function () {
|
|
25
25
|
};
|
26
26
|
return __assign.apply(this, arguments);
|
27
27
|
};
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
35
|
+
});
|
36
|
+
};
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
41
|
+
function step(op) {
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
43
|
+
while (_) try {
|
44
|
+
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;
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
46
|
+
switch (op[0]) {
|
47
|
+
case 0: case 1: t = op; break;
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
51
|
+
default:
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
56
|
+
if (t[2]) _.ops.pop();
|
57
|
+
_.trys.pop(); continue;
|
58
|
+
}
|
59
|
+
op = body.call(thisArg, _);
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
62
|
+
}
|
63
|
+
};
|
28
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
65
|
exports.DrForm = void 0;
|
30
66
|
var ScriptUtils_1 = require("../utils/script/ScriptUtils");
|
@@ -41,56 +77,61 @@ var DrForm = /** @class */ (function (_super) {
|
|
41
77
|
}
|
42
78
|
DrForm.prototype.executeAttrRequire = function (attr) {
|
43
79
|
var _a;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
data.setTarget(this.elementSource.element);
|
58
|
-
}
|
59
|
-
}
|
60
|
-
childs.forEach(function (it) {
|
61
|
-
var _a, _b, _c, _d, _e;
|
62
|
-
var eventName = (_a = it.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":event"))) !== null && _a !== void 0 ? _a : 'change';
|
63
|
-
var validatorName = it.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":validator"));
|
64
|
-
var attrEventName = EventManager_1.EventManager.attrPrefix + 'event-' + eventName;
|
65
|
-
var varpath = (_c = ScriptUtils_1.ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":name"))) !== null && _b !== void 0 ? _b : '', _this.source.obj)) !== null && _c !== void 0 ? _c : it.getAttribute('name');
|
66
|
-
if (varpath != null) {
|
67
|
-
if (validatorName) {
|
68
|
-
ScriptUtils_1.ScriptUtils.eval("\n ".concat(_this.render.bindScript, "\n const validator = typeof ").concat(validatorName, " ==='function' ? new ").concat(validatorName, "() : ").concat(validatorName, ";\n ").concat(attr, "['").concat(varpath, "'] = validator;\n "), Object.assign(_this.source.obj, {
|
69
|
-
__render: Object.freeze(__assign({ drStripOption: _this.elementSource.attrs.drStripOption }, _this.render))
|
70
|
-
}));
|
71
|
-
}
|
72
|
-
varpath = "".concat(attr, "['").concat(varpath, "']");
|
73
|
-
var data_1 = ScriptUtils_1.ScriptUtils.evalReturn("".concat(varpath), _this.source.obj);
|
74
|
-
if (data_1 instanceof ValidatorArray_1.ValidatorArray) {
|
75
|
-
it.setAttribute(attrEventName, "".concat(varpath, ".setArrayValue($target, $target.value, $event); ").concat((_d = it.getAttribute(attrEventName)) !== null && _d !== void 0 ? _d : '', ";"));
|
76
|
-
data_1.addValidator(it.value, it);
|
77
|
-
}
|
78
|
-
else if (data_1 instanceof Validator_1.Validator) {
|
79
|
-
// varpath += (varpath ? '.value' : 'value');
|
80
|
-
// varpath = drAttr.drForm + '.' + varpath;
|
81
|
-
// it.setAttribute(attrEventName, `${varpath} = $target.value; ${target}=$target; ${event}=$event;`);
|
82
|
-
it.setAttribute(attrEventName, "".concat(varpath, ".set($target.value, $target, $event); ").concat((_e = it.getAttribute(attrEventName)) !== null && _e !== void 0 ? _e : '', ";"));
|
83
|
-
data_1.setTarget(it);
|
84
|
-
data_1.value = it.value;
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
81
|
+
var data, childs, fromName, thisName;
|
82
|
+
var _b;
|
83
|
+
var _this = this;
|
84
|
+
return __generator(this, function (_c) {
|
85
|
+
RawSet_1.RawSet.drFormOtherMoveAttr(this.elementSource.element, 'name', 'temp-name', this.source.config);
|
86
|
+
data = ScriptUtils_1.ScriptUtils.evalReturn("".concat(attr), this.source.obj);
|
87
|
+
childs = Array.from(this.elementSource.element.querySelectorAll('[name]'));
|
88
|
+
fromName = ScriptUtils_1.ScriptUtils.evalReturn((_a = this.elementSource.element.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":name"))) !== null && _a !== void 0 ? _a : '', this.source.obj);
|
89
|
+
thisName = fromName !== null && fromName !== void 0 ? fromName : this.elementSource.element.getAttribute('name');
|
90
|
+
// // 자기자신이 Input 대상일때
|
91
|
+
if (childs.length <= 0 && thisName) {
|
92
|
+
childs.push(this.elementSource.element);
|
85
93
|
}
|
86
94
|
else {
|
87
|
-
|
95
|
+
if (data instanceof Validator_1.Validator) {
|
96
|
+
data.setTarget(this.elementSource.element);
|
97
|
+
}
|
88
98
|
}
|
89
|
-
|
99
|
+
childs.forEach(function (it) {
|
100
|
+
var _a, _b, _c, _d, _e;
|
101
|
+
var eventName = (_a = it.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":event"))) !== null && _a !== void 0 ? _a : 'change';
|
102
|
+
var validatorName = it.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":validator"));
|
103
|
+
var attrEventName = EventManager_1.EventManager.attrPrefix + 'event-' + eventName;
|
104
|
+
var varpath = (_c = ScriptUtils_1.ScriptUtils.evalReturn((_b = _this.elementSource.element.getAttribute("".concat(RawSet_1.RawSet.DR_FORM_NAME, ":name"))) !== null && _b !== void 0 ? _b : '', _this.source.obj)) !== null && _c !== void 0 ? _c : it.getAttribute('name');
|
105
|
+
if (varpath != null) {
|
106
|
+
if (validatorName) {
|
107
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(_this.render.bindScript, "\n const validator = typeof ").concat(validatorName, " ==='function' ? new ").concat(validatorName, "() : ").concat(validatorName, ";\n ").concat(attr, "['").concat(varpath, "'] = validator;\n "), Object.assign(_this.source.obj, {
|
108
|
+
__render: Object.freeze(__assign({ drStripOption: _this.elementSource.attrs.drStripOption }, _this.render))
|
109
|
+
}));
|
110
|
+
}
|
111
|
+
varpath = "".concat(attr, "['").concat(varpath, "']");
|
112
|
+
var data_1 = ScriptUtils_1.ScriptUtils.evalReturn("".concat(varpath), _this.source.obj);
|
113
|
+
if (data_1 instanceof ValidatorArray_1.ValidatorArray) {
|
114
|
+
it.setAttribute(attrEventName, "".concat(varpath, ".setArrayValue($target, $target.value, $event); ").concat((_d = it.getAttribute(attrEventName)) !== null && _d !== void 0 ? _d : '', ";"));
|
115
|
+
data_1.addValidator(it.value, it);
|
116
|
+
}
|
117
|
+
else if (data_1 instanceof Validator_1.Validator) {
|
118
|
+
// varpath += (varpath ? '.value' : 'value');
|
119
|
+
// varpath = drAttr.drForm + '.' + varpath;
|
120
|
+
// it.setAttribute(attrEventName, `${varpath} = $target.value; ${target}=$target; ${event}=$event;`);
|
121
|
+
it.setAttribute(attrEventName, "".concat(varpath, ".set($target.value, $target, $event); ").concat((_e = it.getAttribute(attrEventName)) !== null && _e !== void 0 ? _e : '', ";"));
|
122
|
+
data_1.setTarget(it);
|
123
|
+
data_1.value = it.value;
|
124
|
+
}
|
125
|
+
else {
|
126
|
+
it.setAttribute(attrEventName, "".concat(varpath, " = $target.value;"));
|
127
|
+
}
|
128
|
+
}
|
129
|
+
});
|
130
|
+
RawSet_1.RawSet.drFormOtherMoveAttr(this.elementSource.element, 'temp-name', 'name', this.source.config);
|
131
|
+
(_b = this.returnContainer.raws).push.apply(_b, RawSet_1.RawSet.checkPointCreates(this.elementSource.element, this.source.obj, this.source.config));
|
132
|
+
return [2 /*return*/, OperatorExecuter_1.ExecuteState.EXECUTE];
|
133
|
+
});
|
90
134
|
});
|
91
|
-
RawSet_1.RawSet.drFormOtherMoveAttr(this.elementSource.element, 'temp-name', 'name', this.source.config);
|
92
|
-
(_a = this.returnContainer.raws).push.apply(_a, RawSet_1.RawSet.checkPointCreates(this.elementSource.element, this.source.obj, this.source.config));
|
93
|
-
return OperatorExecuter_1.ExecuteState.EXECUTE;
|
94
135
|
};
|
95
136
|
return DrForm;
|
96
137
|
}(OperatorExecuterAttrRequire_1.OperatorExecuterAttrRequire));
|
package/operators/DrIf.d.ts
CHANGED
@@ -4,5 +4,5 @@ import { Render } from '../rawsets/Render';
|
|
4
4
|
import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
|
5
5
|
export declare class DrIf extends OperatorExecuterAttrRequire<string> {
|
6
6
|
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
7
|
-
executeAttrRequire(attr: string): ExecuteState
|
7
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
8
8
|
}
|
package/operators/DrIf.js
CHANGED
@@ -25,6 +25,42 @@ var __assign = (this && this.__assign) || function () {
|
|
25
25
|
};
|
26
26
|
return __assign.apply(this, arguments);
|
27
27
|
};
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
35
|
+
});
|
36
|
+
};
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
41
|
+
function step(op) {
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
43
|
+
while (_) try {
|
44
|
+
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;
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
46
|
+
switch (op[0]) {
|
47
|
+
case 0: case 1: t = op; break;
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
51
|
+
default:
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
56
|
+
if (t[2]) _.ops.pop();
|
57
|
+
_.trys.pop(); continue;
|
58
|
+
}
|
59
|
+
op = body.call(thisArg, _);
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
62
|
+
}
|
63
|
+
};
|
28
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
65
|
exports.DrIf = void 0;
|
30
66
|
var OperatorExecuterAttrRequire_1 = require("./OperatorExecuterAttrRequire");
|
@@ -40,29 +76,32 @@ var DrIf = /** @class */ (function (_super) {
|
|
40
76
|
return _this;
|
41
77
|
}
|
42
78
|
DrIf.prototype.executeAttrRequire = function (attr) {
|
43
|
-
var _a;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
79
|
+
var _a, _b, _c, _d;
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
81
|
+
var itRandom, vars, newTemp, keepgoing, tempalte, rr;
|
82
|
+
var _e;
|
83
|
+
return __generator(this, function (_f) {
|
84
|
+
itRandom = RawSet_1.RawSet.drItOtherEncoding(this.elementSource.element);
|
85
|
+
vars = RawSet_1.RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
86
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
87
|
+
keepgoing = ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n ").concat((_b = this.elementSource.attrs.drBeforeOption) !== null && _b !== void 0 ? _b : '', "\n if ($rawset.data === (").concat(attr, ")) {\n return false;\n }\n $rawset.data = ").concat(attr, ";\n if($rawset.data) {\n const n = $element.cloneNode(true);\n Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drIf' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v));\n var destIt = ").concat(this.elementSource.attrs.drItOption, ";\n if (destIt !== undefined) {\n n.getAttributeNames().forEach(it => n.setAttribute(it, n.getAttribute(it).replace(/\\#it\\#/g, destIt)))\n n.innerHTML = n.innerHTML.replace(/\\#it\\#/g, destIt);\n }\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n }\n ").concat((_c = this.elementSource.attrs.drAfterOption) !== null && _c !== void 0 ? _c : '', ";\n return true;\n "), Object.assign(this.source.obj, {
|
88
|
+
__render: Object.freeze(__assign({ fag: newTemp, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet_1.RawSet.drAttrsOriginName, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
89
|
+
}));
|
90
|
+
// TODO: 뭐지?? 지워야되는거 아닌가?
|
91
|
+
if (keepgoing === false) {
|
92
|
+
return [2 /*return*/, OperatorExecuter_1.ExecuteState.STOP];
|
93
|
+
}
|
94
|
+
RawSet_1.RawSet.drVarDecoding(newTemp, vars);
|
95
|
+
RawSet_1.RawSet.drItOtherDecoding(newTemp, itRandom);
|
96
|
+
tempalte = this.source.config.window.document.createElement('template');
|
97
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
98
|
+
this.returnContainer.fag.append(tempalte.content);
|
99
|
+
rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
100
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
101
|
+
(_e = this.returnContainer.raws).push.apply(_e, rr);
|
102
|
+
return [2 /*return*/, OperatorExecuter_1.ExecuteState.EXECUTE];
|
103
|
+
});
|
104
|
+
});
|
66
105
|
};
|
67
106
|
return DrIf;
|
68
107
|
}(OperatorExecuterAttrRequire_1.OperatorExecuterAttrRequire));
|
@@ -4,5 +4,5 @@ import { Render } from '../rawsets/Render';
|
|
4
4
|
import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
|
5
5
|
export declare class DrInnerHTML extends OperatorExecuterAttrRequire<string> {
|
6
6
|
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
7
|
-
executeAttrRequire(attr: string): ExecuteState
|
7
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
8
8
|
}
|
package/operators/DrInnerHTML.js
CHANGED
@@ -25,6 +25,42 @@ var __assign = (this && this.__assign) || function () {
|
|
25
25
|
};
|
26
26
|
return __assign.apply(this, arguments);
|
27
27
|
};
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
35
|
+
});
|
36
|
+
};
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
41
|
+
function step(op) {
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
43
|
+
while (_) try {
|
44
|
+
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;
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
46
|
+
switch (op[0]) {
|
47
|
+
case 0: case 1: t = op; break;
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
51
|
+
default:
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
56
|
+
if (t[2]) _.ops.pop();
|
57
|
+
_.trys.pop(); continue;
|
58
|
+
}
|
59
|
+
op = body.call(thisArg, _);
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
62
|
+
}
|
63
|
+
};
|
28
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
65
|
exports.DrInnerHTML = void 0;
|
30
66
|
var OperatorExecuterAttrRequire_1 = require("./OperatorExecuterAttrRequire");
|
@@ -37,21 +73,26 @@ var DrInnerHTML = /** @class */ (function (_super) {
|
|
37
73
|
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
38
74
|
}
|
39
75
|
DrInnerHTML.prototype.executeAttrRequire = function (attr) {
|
40
|
-
var _a;
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
76
|
+
var _a, _b, _c;
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
78
|
+
var newTemp, tempalte, rr;
|
79
|
+
var _d;
|
80
|
+
return __generator(this, function (_e) {
|
81
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
82
|
+
ScriptUtils_1.ScriptUtils.eval("\n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true);\n ").concat((_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : '', "\n n.innerHTML = ").concat(attr, ";\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n ").concat((_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : '', "\n "), Object.assign(this.source.obj, {
|
83
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, fag: newTemp }, this.render
|
84
|
+
// eslint-disable-next-line no-use-before-define
|
85
|
+
))
|
86
|
+
}));
|
87
|
+
tempalte = this.source.config.window.document.createElement('template');
|
88
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
89
|
+
this.returnContainer.fag.append(tempalte.content);
|
90
|
+
rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
91
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
92
|
+
(_d = this.returnContainer.raws).push.apply(_d, rr);
|
93
|
+
return [2 /*return*/, OperatorExecuter_1.ExecuteState.EXECUTE];
|
94
|
+
});
|
95
|
+
});
|
55
96
|
};
|
56
97
|
return DrInnerHTML;
|
57
98
|
}(OperatorExecuterAttrRequire_1.OperatorExecuterAttrRequire));
|
@@ -4,5 +4,5 @@ import { Render } from '../rawsets/Render';
|
|
4
4
|
import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
|
5
5
|
export declare class DrInnerText extends OperatorExecuterAttrRequire<string> {
|
6
6
|
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
7
|
-
executeAttrRequire(attr: string): ExecuteState
|
7
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
8
8
|
}
|
package/operators/DrInnerText.js
CHANGED
@@ -25,6 +25,42 @@ var __assign = (this && this.__assign) || function () {
|
|
25
25
|
};
|
26
26
|
return __assign.apply(this, arguments);
|
27
27
|
};
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
35
|
+
});
|
36
|
+
};
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
41
|
+
function step(op) {
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
43
|
+
while (_) try {
|
44
|
+
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;
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
46
|
+
switch (op[0]) {
|
47
|
+
case 0: case 1: t = op; break;
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
51
|
+
default:
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
56
|
+
if (t[2]) _.ops.pop();
|
57
|
+
_.trys.pop(); continue;
|
58
|
+
}
|
59
|
+
op = body.call(thisArg, _);
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
62
|
+
}
|
63
|
+
};
|
28
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
65
|
exports.DrInnerText = void 0;
|
30
66
|
var OperatorExecuterAttrRequire_1 = require("./OperatorExecuterAttrRequire");
|
@@ -37,19 +73,24 @@ var DrInnerText = /** @class */ (function (_super) {
|
|
37
73
|
return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, false) || this;
|
38
74
|
}
|
39
75
|
DrInnerText.prototype.executeAttrRequire = function (attr) {
|
40
|
-
var _a;
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
76
|
+
var _a, _b, _c;
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
78
|
+
var newTemp, tempalte, rr;
|
79
|
+
var _d;
|
80
|
+
return __generator(this, function (_e) {
|
81
|
+
newTemp = this.source.config.window.document.createElement('temp');
|
82
|
+
ScriptUtils_1.ScriptUtils.eval(" \n ".concat(this.render.bindScript, "\n const n = $element.cloneNode(true); \n ").concat((_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : '', "\n n.innerText = ").concat(attr, ";\n if (this.__render.drStripOption === 'true') {\n Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));\n } else {\n this.__render.fag.append(n);\n }\n ").concat((_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : '', "\n "), Object.assign(this.source.obj, {
|
83
|
+
__render: Object.freeze(__assign({ drStripOption: this.elementSource.attrs.drStripOption, fag: newTemp }, this.render))
|
84
|
+
}));
|
85
|
+
tempalte = this.source.config.window.document.createElement('template');
|
86
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
87
|
+
this.returnContainer.fag.append(tempalte.content);
|
88
|
+
rr = RawSet_1.RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
89
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
90
|
+
(_d = this.returnContainer.raws).push.apply(_d, rr);
|
91
|
+
return [2 /*return*/, OperatorExecuter_1.ExecuteState.EXECUTE];
|
92
|
+
});
|
93
|
+
});
|
53
94
|
};
|
54
95
|
return DrInnerText;
|
55
96
|
}(OperatorExecuterAttrRequire_1.OperatorExecuterAttrRequire));
|
package/operators/DrPre.d.ts
CHANGED
@@ -3,5 +3,5 @@ import { RawSet } from '../rawsets/RawSet';
|
|
3
3
|
import { Render } from '../rawsets/Render';
|
4
4
|
export declare class DrPre extends OperatorExecuter<null> {
|
5
5
|
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
6
|
-
execute(value: null): ExecuteState
|
6
|
+
execute(value: null): Promise<ExecuteState>;
|
7
7
|
}
|
package/operators/DrPre.js
CHANGED
@@ -14,6 +14,42 @@ var __extends = (this && this.__extends) || (function () {
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
15
|
};
|
16
16
|
})();
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24
|
+
});
|
25
|
+
};
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
30
|
+
function step(op) {
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
32
|
+
while (_) try {
|
33
|
+
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;
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
35
|
+
switch (op[0]) {
|
36
|
+
case 0: case 1: t = op; break;
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
40
|
+
default:
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
45
|
+
if (t[2]) _.ops.pop();
|
46
|
+
_.trys.pop(); continue;
|
47
|
+
}
|
48
|
+
op = body.call(thisArg, _);
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
51
|
+
}
|
52
|
+
};
|
17
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
54
|
exports.DrPre = void 0;
|
19
55
|
var OperatorExecuter_1 = require("./OperatorExecuter");
|
@@ -26,7 +62,11 @@ var DrPre = /** @class */ (function (_super) {
|
|
26
62
|
return _this;
|
27
63
|
}
|
28
64
|
DrPre.prototype.execute = function (value) {
|
29
|
-
return (
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
66
|
+
return __generator(this, function (_a) {
|
67
|
+
return [2 /*return*/, (value != null) ? OperatorExecuter_1.ExecuteState.EXECUTE : OperatorExecuter_1.ExecuteState.NO_EXECUTE];
|
68
|
+
});
|
69
|
+
});
|
30
70
|
};
|
31
71
|
return DrPre;
|
32
72
|
}(OperatorExecuter_1.OperatorExecuter));
|
package/operators/DrRepeat.d.ts
CHANGED
@@ -4,5 +4,5 @@ import { Render } from '../rawsets/Render';
|
|
4
4
|
import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
|
5
5
|
export declare class DrRepeat extends OperatorExecuterAttrRequire<string> {
|
6
6
|
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
7
|
-
executeAttrRequire(attr: string): ExecuteState
|
7
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
8
8
|
}
|