dom-render 1.0.84 → 1.0.87
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 +5 -5
- package/DomRender.js +10 -5
- package/DomRenderProxy.d.ts +2 -2
- package/DomRenderProxy.js +2 -0
- package/README.MD +7 -7
- package/RawSet.d.ts +22 -11
- package/RawSet.js +129 -86
- package/configs/Config.d.ts +26 -0
- package/{Config.js → configs/Config.js} +0 -0
- package/configs/TargetAttr.d.ts +6 -0
- package/configs/TargetAttr.js +2 -0
- package/configs/TargetElement.d.ts +11 -0
- package/configs/TargetElement.js +2 -0
- package/dist/bundle.js +371 -321
- package/events/EventManager.d.ts +1 -1
- package/lifecycle/OnProxyDomRender.d.ts +1 -1
- package/messenger/Messenger.d.ts +1 -1
- package/operators/DrTargetElement.js +1 -1
- package/operators/DrThis.js +2 -2
- package/operators/OperatorRender.d.ts +1 -1
- package/package.json +1 -1
- package/Config.d.ts +0 -38
package/dist/bundle.js
CHANGED
@@ -1101,11 +1101,11 @@ var DrThis = /** @class */ (function (_super) {
|
|
1101
1101
|
RawSet.destroy(this.rawSet.data.obj, [], this.source.config, destroyOptions);
|
1102
1102
|
}
|
1103
1103
|
this.rawSet.data = r;
|
1104
|
-
this.returnContainer.fag.append(RawSet.drThisCreate(this.elementSource.element, "".concat(this.elementSource.attrs.drThis, ".obj"), (_d = this.elementSource.attrs.drVarOption) !== null && _d !== void 0 ? _d : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config, r));
|
1104
|
+
this.returnContainer.fag.append(RawSet.drThisCreate(this.rawSet, this.elementSource.element, "".concat(this.elementSource.attrs.drThis, ".obj"), (_d = this.elementSource.attrs.drVarOption) !== null && _d !== void 0 ? _d : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config, r));
|
1105
1105
|
this.afterCallBack.onThisComponentSetCallBacks.push(r);
|
1106
1106
|
}
|
1107
1107
|
else {
|
1108
|
-
this.returnContainer.fag.append(RawSet.drThisCreate(this.elementSource.element, this.elementSource.attrs.drThis, (_e = this.elementSource.attrs.drVarOption) !== null && _e !== void 0 ? _e : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config));
|
1108
|
+
this.returnContainer.fag.append(RawSet.drThisCreate(this.rawSet, this.elementSource.element, this.elementSource.attrs.drThis, (_e = this.elementSource.attrs.drVarOption) !== null && _e !== void 0 ? _e : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config));
|
1109
1109
|
}
|
1110
1110
|
var rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
1111
1111
|
(_f = this.elementSource.element.parentNode) === null || _f === void 0 ? void 0 : _f.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
@@ -1705,7 +1705,7 @@ var DrTargetElement = /** @class */ (function (_super) {
|
|
1705
1705
|
var _b, _c, _d, _e;
|
1706
1706
|
var targetElement = (_c = (_b = this.source.config) === null || _b === void 0 ? void 0 : _b.targetElements) === null || _c === void 0 ? void 0 : _c.find(function (it) { return it.name.toLowerCase() === _this.elementSource.element.tagName.toLowerCase(); });
|
1707
1707
|
if (targetElement) {
|
1708
|
-
var documentFragment = targetElement.callBack(this.elementSource.element, this.source.obj, this.rawSet, this.elementSource.attrs);
|
1708
|
+
var documentFragment = targetElement.callBack(this.elementSource.element, this.source.obj, this.rawSet, this.elementSource.attrs, this.source.config);
|
1709
1709
|
if (documentFragment) {
|
1710
1710
|
// const targetAttrMap = this.elementSource.element.getAttribute(EventManager.normalAttrMapAttrName);
|
1711
1711
|
var detectAction_1 = this.elementSource.element.getAttribute(RawSet.DR_DETECT_NAME);
|
@@ -1808,6 +1808,7 @@ exports.DestroyOptionType = void 0;
|
|
1808
1808
|
exports.RawSetType = void 0;
|
1809
1809
|
(function (RawSetType) {
|
1810
1810
|
RawSetType["TEXT"] = "TEXT";
|
1811
|
+
RawSetType["STYLE_TEXT"] = "STYLE_TEXT";
|
1811
1812
|
RawSetType["TARGET_ELEMENT"] = "TARGET_ELEMENT";
|
1812
1813
|
RawSetType["TARGET_ATTR"] = "TARGET_ATTR";
|
1813
1814
|
RawSetType["UNKOWN"] = "UNKOWN";
|
@@ -1904,21 +1905,28 @@ var RawSet = /** @class */ (function () {
|
|
1904
1905
|
});
|
1905
1906
|
var fag = config.window.document.createDocumentFragment();
|
1906
1907
|
if (cNode.nodeType === Node.TEXT_NODE && cNode.textContent) {
|
1908
|
+
// console.log('text-->', this, obj, config)
|
1909
|
+
// console.log('text-->', Array.from(this.fragment.childNodes))
|
1907
1910
|
var textContent = cNode.textContent;
|
1908
1911
|
var runText = RawSet.exporesionGrouops(textContent)[0][1];
|
1909
1912
|
// console.log('--->', RawSet.exporesionGrouops(textContent), textContent,runText, runText[0][1])
|
1910
|
-
var
|
1913
|
+
var newNode = void 0;
|
1911
1914
|
if (textContent === null || textContent === void 0 ? void 0 : textContent.startsWith('#')) {
|
1912
1915
|
var r = ScriptUtils.eval("".concat(__render.bindScript, " return ").concat(runText), Object.assign(obj, { __render: __render }));
|
1913
1916
|
var template = config.window.document.createElement('template');
|
1914
1917
|
template.innerHTML = r;
|
1915
|
-
|
1918
|
+
newNode = template.content;
|
1916
1919
|
}
|
1917
1920
|
else {
|
1918
1921
|
var r = ScriptUtils.eval("".concat(__render.bindScript, " return ").concat(runText), Object.assign(obj, { __render: __render }));
|
1919
|
-
|
1922
|
+
newNode = config.window.document.createTextNode(r);
|
1923
|
+
}
|
1924
|
+
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, cNode);
|
1925
|
+
// console.log('-------', this.point.start.parentNode.nodeName)
|
1926
|
+
// 중요 style value change 됐을때 다시 처리해야되기떄문에: 마지막에 completed 없는 attr 가지고 판단 하니깐
|
1927
|
+
if (this.type === exports.RawSetType.STYLE_TEXT && this.point.parent) {
|
1928
|
+
this.point.parent.removeAttribute('completed');
|
1920
1929
|
}
|
1921
|
-
(_a = cNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(n, cNode);
|
1922
1930
|
}
|
1923
1931
|
else if (cNode.nodeType === Node.ELEMENT_NODE) {
|
1924
1932
|
var element = cNode;
|
@@ -1973,7 +1981,7 @@ var RawSet = /** @class */ (function () {
|
|
1973
1981
|
}
|
1974
1982
|
}
|
1975
1983
|
this.applyEvent(obj, genNode, config);
|
1976
|
-
this.replaceBody(genNode);
|
1984
|
+
this.replaceBody(genNode); // 중요 여기서 마지막에 연션된 값을 그려준다.
|
1977
1985
|
drAttrs.forEach(function (it) {
|
1978
1986
|
if (it.drCompleteOption) {
|
1979
1987
|
// genNode.childNodes
|
@@ -1986,25 +1994,16 @@ var RawSet = /** @class */ (function () {
|
|
1986
1994
|
}));
|
1987
1995
|
}
|
1988
1996
|
});
|
1997
|
+
// 중요 style isolation 나중에 :scope로 대체 가능할듯.
|
1998
|
+
RawSet.generateStyleSheetsLocal();
|
1999
|
+
// console.log('-22222-')
|
2000
|
+
// alert(1);
|
1989
2001
|
for (var _p = 0, onThisComponentSetCallBacks_1 = onThisComponentSetCallBacks; _p < onThisComponentSetCallBacks_1.length; _p++) {
|
1990
2002
|
var it_1 = onThisComponentSetCallBacks_1[_p];
|
1991
2003
|
(_c = (_b = it_1.obj).onInitRender) === null || _c === void 0 ? void 0 : _c.call(_b);
|
1992
2004
|
}
|
1993
2005
|
for (var _q = 0, onElementInitCallBacks_1 = onElementInitCallBacks; _q < onElementInitCallBacks_1.length; _q++) {
|
1994
2006
|
var it_2 = onElementInitCallBacks_1[_q];
|
1995
|
-
// 중요 style isolation 나중에 :scope로 대체 가능할듯.
|
1996
|
-
Array.from(window.document.styleSheets).filter(function (it) { return it.ownerNode && it.ownerNode instanceof Element && it.ownerNode.getAttribute('id') && !it.ownerNode.getAttribute('completed'); }).forEach(function (it) {
|
1997
|
-
var _a;
|
1998
|
-
var styleElement = it.ownerNode;
|
1999
|
-
var id = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-')[0];
|
2000
|
-
if (id) {
|
2001
|
-
// console.log('------->', id)
|
2002
|
-
Array.from(it.cssRules).forEach(function (it) {
|
2003
|
-
_this.generateCSS(id, it);
|
2004
|
-
});
|
2005
|
-
}
|
2006
|
-
it.ownerNode.setAttribute('completed', 'true');
|
2007
|
-
});
|
2008
2007
|
(_g = (_f = (_e = (_d = it_2.targetElement) === null || _d === void 0 ? void 0 : _d.__render) === null || _e === void 0 ? void 0 : _e.component) === null || _f === void 0 ? void 0 : _f.onInitRender) === null || _g === void 0 ? void 0 : _g.call(_f, Object.freeze({ render: (_h = it_2.targetElement) === null || _h === void 0 ? void 0 : _h.__render, creatorMetaData: (_j = it_2.targetElement) === null || _j === void 0 ? void 0 : _j.__creatorMetaData }));
|
2009
2008
|
(_k = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _k === void 0 ? void 0 : _k.call(config, it_2.name, obj, this, it_2.targetElement);
|
2010
2009
|
}
|
@@ -2031,7 +2030,23 @@ var RawSet = /** @class */ (function () {
|
|
2031
2030
|
}
|
2032
2031
|
return raws;
|
2033
2032
|
};
|
2034
|
-
RawSet.
|
2033
|
+
RawSet.generateStyleSheetsLocal = function () {
|
2034
|
+
Array.from(window.document.styleSheets).filter(function (it) { return it.ownerNode && it.ownerNode instanceof Element && it.ownerNode.hasAttribute('domstyle') && it.ownerNode.getAttribute('id') && !it.ownerNode.getAttribute('completed'); }).forEach(function (it) {
|
2035
|
+
var _a;
|
2036
|
+
var styleElement = it.ownerNode;
|
2037
|
+
var split = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-');
|
2038
|
+
split === null || split === void 0 ? void 0 : split.pop();
|
2039
|
+
var id = split === null || split === void 0 ? void 0 : split.join('-');
|
2040
|
+
if (id) {
|
2041
|
+
// console.log('------->', id)
|
2042
|
+
Array.from(it.cssRules).forEach(function (it) {
|
2043
|
+
RawSet.generateCSS(id, it);
|
2044
|
+
});
|
2045
|
+
}
|
2046
|
+
it.ownerNode.setAttribute('completed', 'true');
|
2047
|
+
});
|
2048
|
+
};
|
2049
|
+
RawSet.generateCSS = function (id, cssRule) {
|
2035
2050
|
var _this = this;
|
2036
2051
|
var start = "#".concat(id, "-start");
|
2037
2052
|
var end = "#".concat(id, "-end");
|
@@ -2064,6 +2079,17 @@ var RawSet = /** @class */ (function () {
|
|
2064
2079
|
});
|
2065
2080
|
}
|
2066
2081
|
};
|
2082
|
+
// 중요 스타일 적용 부분
|
2083
|
+
RawSet.generateStyleTransform = function (styleBody, id, styleTagWrap) {
|
2084
|
+
if (styleTagWrap === void 0) { styleTagWrap = true; }
|
2085
|
+
if (Array.isArray(styleBody)) {
|
2086
|
+
styleBody = styleBody.join('\n');
|
2087
|
+
}
|
2088
|
+
if (styleTagWrap) {
|
2089
|
+
styleBody = "<style id='".concat(id, "-style' domstyle>").concat(styleBody, "</style>");
|
2090
|
+
}
|
2091
|
+
return styleBody;
|
2092
|
+
};
|
2067
2093
|
RawSet.prototype.applyEvent = function (obj, fragment, config) {
|
2068
2094
|
if (fragment === void 0) { fragment = this.fragment; }
|
2069
2095
|
eventManager.applyEvent(obj, eventManager.findAttrElements(fragment, config), config);
|
@@ -2104,17 +2130,19 @@ var RawSet = /** @class */ (function () {
|
|
2104
2130
|
RawSet.prototype.replaceBody = function (genNode) {
|
2105
2131
|
var _a;
|
2106
2132
|
this.childAllRemove();
|
2107
|
-
(_a = this.point.start.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(genNode, this.point.start.nextSibling);
|
2133
|
+
(_a = this.point.start.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(genNode, this.point.start.nextSibling); // 중요 start checkpoint 다음인 end checkpoint 앞에 넣는다. 즉 중간 껴넣기 (나중에 meta tag로 변경을 해도될듯하긴한데..)
|
2108
2134
|
};
|
2109
2135
|
// 중요 important
|
2110
2136
|
RawSet.checkPointCreates = function (element, obj, config) {
|
2111
2137
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2138
|
+
// console.log('start==========')
|
2112
2139
|
var thisVariableName = element.__domrender_this_variable_name;
|
2113
2140
|
// console.log('checkPointCreates thisVariableName', thisVariableName);
|
2114
2141
|
var nodeIterator = config.window.document.createNodeIterator(element, NodeFilter.SHOW_ALL, {
|
2115
2142
|
acceptNode: function (node) {
|
2116
2143
|
var _a, _b, _c, _d, _e;
|
2117
2144
|
if (node.nodeType === Node.TEXT_NODE) {
|
2145
|
+
// console.log('text--->', node.textContent)
|
2118
2146
|
// console.log('????????', node.parentElement, node.parentElement?.getAttribute('dr-pre'));
|
2119
2147
|
// console.log('???????/',node.textContent, node.parentElement?.getAttribute('dr-pre'))
|
2120
2148
|
// TODO: 나중에
|
@@ -2159,49 +2187,60 @@ var RawSet = /** @class */ (function () {
|
|
2159
2187
|
// const a = StringUtils.regexExec(/[$#]\{.*?\}/g, text);
|
2160
2188
|
// const a = StringUtils.betweenRegexpStr('[$#]\\{', '\\}', text); // <--TODO: 나중에..
|
2161
2189
|
var groups = RawSet.exporesionGrouops(text);
|
2162
|
-
var map = groups.map(function (it) { return ({ uuid: RandomUtils.
|
2190
|
+
var map = groups.map(function (it) { return ({ uuid: RandomUtils.getRandomString(40), content: it[0], regexArr: it }); });
|
2163
2191
|
var lasterIndex = 0;
|
2164
2192
|
for (var i = 0; i < map.length; i++) {
|
2165
2193
|
var it_4 = map[i];
|
2166
2194
|
var regexArr = it_4.regexArr;
|
2167
2195
|
var preparedText = regexArr.input.substring(lasterIndex, regexArr.index);
|
2168
|
-
|
2169
|
-
|
2196
|
+
// const start = config.window.document.createElement('meta');
|
2197
|
+
// start.setAttribute('id', `${it.uuid}-start`);
|
2198
|
+
// const end = config.window.document.createElement('meta');
|
2199
|
+
// end.setAttribute('id', `${it.uuid}-end`);
|
2200
|
+
var type = void 0;
|
2201
|
+
if (currentNode.parentNode && currentNode.parentNode.nodeName.toUpperCase() === 'STYLE') {
|
2202
|
+
type = exports.RawSetType.STYLE_TEXT;
|
2203
|
+
}
|
2204
|
+
else {
|
2205
|
+
type = exports.RawSetType.TEXT;
|
2206
|
+
}
|
2207
|
+
var startEndPoint = RawSet.createStartEndPoint(it_4.uuid, type, config);
|
2170
2208
|
// layout setting
|
2171
|
-
template.content.append(document.createTextNode(preparedText)); //
|
2172
|
-
template.content.append(start);
|
2173
|
-
template.content.append(end);
|
2174
|
-
// content
|
2209
|
+
template.content.append(document.createTextNode(preparedText)); // 앞 부분 넣고
|
2210
|
+
template.content.append(startEndPoint.start); // add start checkpoint
|
2211
|
+
template.content.append(startEndPoint.end); // add end checkpoint
|
2212
|
+
// content 안쪽 RawSet render 할때 start 와 end 사이에 fragment 연산해서 들어간다.
|
2175
2213
|
var fragment = config.window.document.createDocumentFragment();
|
2176
2214
|
fragment.append(config.window.document.createTextNode(it_4.content));
|
2177
|
-
pars.push(new RawSet(it_4.uuid,
|
2178
|
-
start: start,
|
2215
|
+
pars.push(new RawSet(it_4.uuid, type, {
|
2216
|
+
start: startEndPoint.start,
|
2179
2217
|
node: currentNode,
|
2180
|
-
end: end,
|
2218
|
+
end: startEndPoint.end,
|
2219
|
+
parent: currentNode.parentNode,
|
2181
2220
|
thisVariableName: thisVariableName
|
2182
2221
|
}, fragment));
|
2183
2222
|
lasterIndex = regexArr.index + it_4.content.length;
|
2184
2223
|
}
|
2185
2224
|
template.content.append(config.window.document.createTextNode(text.substring(lasterIndex, text.length)));
|
2186
|
-
(_b = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(template.content, currentNode);
|
2225
|
+
(_b = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _b === void 0 ? void 0 : _b.replaceChild(template.content, currentNode); // <-- 여기서 text를 fragment로 replace했기때문에 추적 변경이 가능하다.
|
2187
2226
|
}
|
2188
2227
|
else if (currentNode.nodeType === Node.ELEMENT_NODE) {
|
2189
|
-
var uuid = RandomUtils.
|
2228
|
+
var uuid = RandomUtils.getRandomString(40);
|
2190
2229
|
var element_3 = currentNode;
|
2191
2230
|
var fragment = config.window.document.createDocumentFragment();
|
2192
|
-
var
|
2193
|
-
var
|
2194
|
-
// console.log('start--', uuid)
|
2231
|
+
var type = exports.RawSetType.TARGET_ELEMENT;
|
2232
|
+
var startEndPoint = RawSet.createStartEndPoint(uuid, type, config);
|
2195
2233
|
var isElement = ((_d = (_c = config.targetElements) === null || _c === void 0 ? void 0 : _c.map(function (it) { return it.name.toLowerCase(); })) !== null && _d !== void 0 ? _d : []).includes(element_3.tagName.toLowerCase());
|
2196
2234
|
var targetAttrNames_2 = ((_f = (_e = config.targetAttrs) === null || _e === void 0 ? void 0 : _e.map(function (it) { return it.name; })) !== null && _f !== void 0 ? _f : []).concat(RawSet.DR_ATTRIBUTES);
|
2197
2235
|
var isAttr = element_3.getAttributeNames().filter(function (it) { return targetAttrNames_2.includes(it.toLowerCase()); }).length > 0;
|
2198
|
-
(_g = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _g === void 0 ? void 0 : _g.insertBefore(start, currentNode);
|
2199
|
-
(_h = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _h === void 0 ? void 0 : _h.insertBefore(end, currentNode.nextSibling);
|
2236
|
+
(_g = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _g === void 0 ? void 0 : _g.insertBefore(startEndPoint.start, currentNode);
|
2237
|
+
(_h = currentNode === null || currentNode === void 0 ? void 0 : currentNode.parentNode) === null || _h === void 0 ? void 0 : _h.insertBefore(startEndPoint.end, currentNode.nextSibling);
|
2200
2238
|
fragment.append(currentNode);
|
2201
|
-
pars.push(new RawSet(uuid, isElement ?
|
2202
|
-
start: start,
|
2239
|
+
pars.push(new RawSet(uuid, isElement ? type : (isAttr ? exports.RawSetType.TARGET_ATTR : exports.RawSetType.UNKOWN), {
|
2240
|
+
start: startEndPoint.start,
|
2203
2241
|
node: currentNode,
|
2204
|
-
end: end,
|
2242
|
+
end: startEndPoint.end,
|
2243
|
+
parent: currentNode.parentNode,
|
2205
2244
|
thisVariableName: thisVariableName
|
2206
2245
|
}, fragment));
|
2207
2246
|
}
|
@@ -2213,6 +2252,30 @@ var RawSet = /** @class */ (function () {
|
|
2213
2252
|
// console.log('check-->', pars)
|
2214
2253
|
return pars;
|
2215
2254
|
};
|
2255
|
+
RawSet.createStartEndPoint = function (id, type, config) {
|
2256
|
+
if (type === exports.RawSetType.TARGET_ELEMENT) {
|
2257
|
+
var start = config.window.document.createElement('meta');
|
2258
|
+
var end = config.window.document.createElement('meta');
|
2259
|
+
start.setAttribute('id', "".concat(id, "-start"));
|
2260
|
+
end.setAttribute('id', "".concat(id, "-end"));
|
2261
|
+
return {
|
2262
|
+
start: start,
|
2263
|
+
end: end,
|
2264
|
+
};
|
2265
|
+
}
|
2266
|
+
else if (type === exports.RawSetType.STYLE_TEXT) {
|
2267
|
+
return {
|
2268
|
+
start: config.window.document.createTextNode("/*start text ".concat(id, "*/")),
|
2269
|
+
end: config.window.document.createTextNode("/*end text ".concat(id, "*/"))
|
2270
|
+
};
|
2271
|
+
}
|
2272
|
+
else { // text
|
2273
|
+
return {
|
2274
|
+
start: config.window.document.createComment("start text ".concat(id)),
|
2275
|
+
end: config.window.document.createComment("end text ".concat(id))
|
2276
|
+
};
|
2277
|
+
}
|
2278
|
+
};
|
2216
2279
|
RawSet.prototype.childAllRemove = function () {
|
2217
2280
|
var next = this.point.start.nextSibling;
|
2218
2281
|
while (next) {
|
@@ -2328,16 +2391,18 @@ var RawSet = /** @class */ (function () {
|
|
2328
2391
|
});
|
2329
2392
|
});
|
2330
2393
|
};
|
2331
|
-
RawSet.drThisCreate = function (element, drThis, drVarOption, drStripOption, obj, config, set) {
|
2394
|
+
RawSet.drThisCreate = function (rawSet, element, drThis, drVarOption, drStripOption, obj, config, set) {
|
2332
2395
|
var _a, _b, _c, _d;
|
2333
2396
|
var fag = config.window.document.createDocumentFragment();
|
2334
2397
|
var n = element.cloneNode(true);
|
2398
|
+
// console.log('--------',n, n.innerHTML)
|
2335
2399
|
if (set) {
|
2336
|
-
|
2337
|
-
var style = RawSet.
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2400
|
+
// const id = RandomUtils.getRandomString(20);
|
2401
|
+
var style = RawSet.generateStyleTransform((_a = set.styles) !== null && _a !== void 0 ? _a : [], rawSet.uuid, true);
|
2402
|
+
n.innerHTML = style + ((_b = set.template) !== null && _b !== void 0 ? _b : '');
|
2403
|
+
// const metaStart = RawSet.metaStart(id);
|
2404
|
+
// const metaEnd = RawSet.metaEnd(id);
|
2405
|
+
// n.innerHTML = metaStart + style + (set.template ?? '') + metaEnd;
|
2341
2406
|
// dr-on-create onCreateRender
|
2342
2407
|
var onCreate = element.getAttribute("".concat(EventManager.attrPrefix, "on-create"));
|
2343
2408
|
var renderScript = '';
|
@@ -2365,6 +2430,7 @@ var RawSet = /** @class */ (function () {
|
|
2365
2430
|
this.drVarDecoding(n, vars);
|
2366
2431
|
this.drThisDecoding(n, thisRandom);
|
2367
2432
|
if (drStripOption && (drStripOption === true || drStripOption === 'true')) {
|
2433
|
+
// console.log('------childNodes', Array.from(n.childNodes))
|
2368
2434
|
Array.from(n.childNodes).forEach(function (it) { return fag.append(it); });
|
2369
2435
|
}
|
2370
2436
|
else {
|
@@ -2395,21 +2461,22 @@ var RawSet = /** @class */ (function () {
|
|
2395
2461
|
};
|
2396
2462
|
return targetAttribute;
|
2397
2463
|
};
|
2398
|
-
RawSet.createComponentTargetElement = function (name, objFactory, template, styles
|
2464
|
+
RawSet.createComponentTargetElement = function (name, objFactory, template, styles) {
|
2399
2465
|
if (template === void 0) { template = ''; }
|
2400
2466
|
if (styles === void 0) { styles = []; }
|
2401
2467
|
var targetElement = {
|
2402
2468
|
name: name,
|
2403
2469
|
styles: styles,
|
2404
2470
|
template: template,
|
2405
|
-
callBack: function (element, obj, rawSet, attrs) {
|
2471
|
+
callBack: function (element, obj, rawSet, attrs, config) {
|
2406
2472
|
var _a, _b, _c, _d, _e, _f;
|
2407
2473
|
// console.log('callback------->', element)
|
2408
2474
|
if (!obj.__domrender_components) {
|
2409
2475
|
obj.__domrender_components = {};
|
2410
2476
|
}
|
2411
2477
|
var domrenderComponents = obj.__domrender_components;
|
2412
|
-
|
2478
|
+
// const componentKey = '_' + RandomUtils.getRandomString(20);
|
2479
|
+
var componentKey = rawSet.uuid;
|
2413
2480
|
var attribute = DomUtils.getAttributeToObject(element);
|
2414
2481
|
var 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;';
|
2415
2482
|
var render = Object.freeze({
|
@@ -2492,12 +2559,13 @@ var RawSet = /** @class */ (function () {
|
|
2492
2559
|
__render: render
|
2493
2560
|
}));
|
2494
2561
|
}
|
2495
|
-
var style = RawSet.
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2562
|
+
var style = RawSet.generateStyleTransform(styles, componentKey, true);
|
2563
|
+
element.innerHTML = style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
|
2564
|
+
// const metaStart = RawSet.metaStart(componentKey);
|
2565
|
+
// const metaEnd = RawSet.metaEnd(componentKey);
|
2566
|
+
// element.innerHTML = metaStart + style + (applayTemplate ?? '') + metaEnd;
|
2499
2567
|
// console.log('------>', element.innerHTML, obj)
|
2500
|
-
var data = RawSet.drThisCreate(element, "this.__domrender_components.".concat(componentKey), '', true, obj, config);
|
2568
|
+
var data = RawSet.drThisCreate(rawSet, element, "this.__domrender_components.".concat(componentKey), '', true, obj, config);
|
2501
2569
|
// 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
|
2502
2570
|
if (innerHTMLThisRandom) {
|
2503
2571
|
var template_1 = config.window.document.createElement('template');
|
@@ -2521,38 +2589,13 @@ var RawSet = /** @class */ (function () {
|
|
2521
2589
|
var reg = /(?:[$#]\{(?:(([$#]\{)??[^$#]?[^{]*?)\}[$#]))/g;
|
2522
2590
|
return StringUtils.regexExec(reg, data !== null && data !== void 0 ? data : '');
|
2523
2591
|
};
|
2524
|
-
//
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
|
2531
|
-
// color: blue;
|
2532
|
-
// }
|
2533
|
-
// </style>
|
2534
|
-
if (Array.isArray(styleBody)) {
|
2535
|
-
styleBody = styleBody.join('\n');
|
2536
|
-
}
|
2537
|
-
if (locale) {
|
2538
|
-
styleBody = styleBody.replace(/([^}]+){/gm, function (a, b) {
|
2539
|
-
if (typeof b === 'string') {
|
2540
|
-
b = b.trim();
|
2541
|
-
}
|
2542
|
-
return "#".concat(id, " ~ ").concat(b, ":not(#").concat(id, " ~ style[domstyle] ~ *), #").concat(id, " ~ * ").concat(b, " {");
|
2543
|
-
});
|
2544
|
-
}
|
2545
|
-
if (styleTagWrap) {
|
2546
|
-
styleBody = "<style id='".concat(id, "-style' domstyle>").concat(styleBody, "</style>");
|
2547
|
-
}
|
2548
|
-
return styleBody;
|
2549
|
-
};
|
2550
|
-
RawSet.metaStart = function (id) {
|
2551
|
-
return "<meta id='".concat(id, "-start' />");
|
2552
|
-
};
|
2553
|
-
RawSet.metaEnd = function (id) {
|
2554
|
-
return "<meta id='".concat(id, "-end' />");
|
2555
|
-
};
|
2592
|
+
// public static metaStart(id: string) {
|
2593
|
+
// return `<meta id='${id}-start' />`;
|
2594
|
+
// }
|
2595
|
+
//
|
2596
|
+
// public static metaEnd(id: string) {
|
2597
|
+
// return `<meta id='${id}-end' />`;
|
2598
|
+
// }
|
2556
2599
|
RawSet.destroy = function (obj, parameter, config, destroyOptions) {
|
2557
2600
|
var _a;
|
2558
2601
|
if (destroyOptions === void 0) { destroyOptions = []; }
|
@@ -2743,7 +2786,9 @@ var DomRenderProxy = /** @class */ (function () {
|
|
2743
2786
|
// ------------------->
|
2744
2787
|
}
|
2745
2788
|
else {
|
2789
|
+
// console.log('---rawSets->', it)
|
2746
2790
|
var rawSets = it.render(_this._domRender_proxy, _this.config);
|
2791
|
+
// console.log('---rawSets->', rawSets)
|
2747
2792
|
// 대상 attribute 있으면
|
2748
2793
|
// const targetAttrs = (it.point.node as Element).getAttribute(EventManager.normalAttrMapAttrName);
|
2749
2794
|
// if (it?.data.onChangeAttrRender && it.type === RawSetType.TARGET_ELEMENT && targetAttrs) {
|
@@ -3400,7 +3445,7 @@ var DefaultMessenger = /** @class */ (function (_super) {
|
|
3400
3445
|
var DomRender = /** @class */ (function () {
|
3401
3446
|
function DomRender() {
|
3402
3447
|
}
|
3403
|
-
DomRender.run = function (obj, target,
|
3448
|
+
DomRender.run = function (obj, target, oConfig) {
|
3404
3449
|
var _a, _b, _c;
|
3405
3450
|
var robj = obj;
|
3406
3451
|
if ('_DomRender_isProxy' in obj) {
|
@@ -3410,9 +3455,13 @@ var DomRender = /** @class */ (function () {
|
|
3410
3455
|
robj = obj;
|
3411
3456
|
return robj;
|
3412
3457
|
}
|
3458
|
+
var config = oConfig;
|
3413
3459
|
if (!config) {
|
3414
3460
|
config = { window: window };
|
3415
3461
|
}
|
3462
|
+
if (config && !config.window) {
|
3463
|
+
config.window = window;
|
3464
|
+
}
|
3416
3465
|
config.routerType = config.routerType || 'none';
|
3417
3466
|
config.messenger = DomRenderFinalProxy.final((_a = config.messenger) !== null && _a !== void 0 ? _a : new DefaultMessenger(config));
|
3418
3467
|
var domRender = new DomRenderProxy(obj, target, config);
|
@@ -3427,12 +3476,13 @@ var DomRender = /** @class */ (function () {
|
|
3427
3476
|
domRender.run(robj);
|
3428
3477
|
return robj;
|
3429
3478
|
};
|
3430
|
-
DomRender.createComponent = function (param
|
3479
|
+
DomRender.createComponent = function (param) {
|
3431
3480
|
var _a, _b;
|
3432
|
-
|
3481
|
+
// console.log('===>', typeof param.type, param.type.name, param.type.constructor.name)
|
3482
|
+
var component = RawSet.createComponentTargetElement((_a = param.tagName) !== null && _a !== void 0 ? _a : (typeof param.type === 'function' ? param.type.name : param.type.constructor.name), function (e, o, r2, counstructorParam) {
|
3433
3483
|
var _a;
|
3434
|
-
return new ((_a = param.type).bind.apply(_a, __spreadArray([void 0], counstructorParam, false)))();
|
3435
|
-
}, (_b = param.template) !== null && _b !== void 0 ? _b : '', Array.isArray(param.styles) ? param.styles : (param.styles ? [param.styles] : undefined)
|
3484
|
+
return typeof param.type === 'function' ? new ((_a = param.type).bind.apply(_a, __spreadArray([void 0], counstructorParam, false)))() : param.type;
|
3485
|
+
}, (_b = param.template) !== null && _b !== void 0 ? _b : '', Array.isArray(param.styles) ? param.styles : (param.styles ? [param.styles] : undefined));
|
3436
3486
|
return component;
|
3437
3487
|
};
|
3438
3488
|
DomRender.createAttribute = function (attrName, getThisObj, factory) {
|
@@ -3442,6 +3492,21 @@ var DomRender = /** @class */ (function () {
|
|
3442
3492
|
return DomRender;
|
3443
3493
|
}());
|
3444
3494
|
|
3495
|
+
var RenderManager = /** @class */ (function () {
|
3496
|
+
function RenderManager() {
|
3497
|
+
}
|
3498
|
+
RenderManager.render = function (obj, target) {
|
3499
|
+
if (target === void 0) { target = Object.keys(obj); }
|
3500
|
+
var domRenderProxy = obj._DomRender_proxy;
|
3501
|
+
if (domRenderProxy) {
|
3502
|
+
target.forEach(function (it) {
|
3503
|
+
domRenderProxy.root([it], obj[it]);
|
3504
|
+
});
|
3505
|
+
}
|
3506
|
+
};
|
3507
|
+
return RenderManager;
|
3508
|
+
}());
|
3509
|
+
|
3445
3510
|
var Appender = /** @class */ (function () {
|
3446
3511
|
function Appender(defaultDatas) {
|
3447
3512
|
this.length = 0;
|
@@ -3495,32 +3560,32 @@ var Appender = /** @class */ (function () {
|
|
3495
3560
|
return Appender;
|
3496
3561
|
}());
|
3497
3562
|
|
3498
|
-
var
|
3499
|
-
|
3563
|
+
var AllUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3564
|
+
__extends(AllUnCheckedValidatorArray, _super);
|
3565
|
+
function AllUnCheckedValidatorArray(value, target, event, autoValid) {
|
3566
|
+
if (autoValid === void 0) { autoValid = true; }
|
3567
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3500
3568
|
}
|
3501
|
-
|
3502
|
-
|
3503
|
-
|
3504
|
-
if (domRenderProxy) {
|
3505
|
-
target.forEach(function (it) {
|
3506
|
-
domRenderProxy.root([it], obj[it]);
|
3507
|
-
});
|
3508
|
-
}
|
3569
|
+
AllUnCheckedValidatorArray.prototype.valid = function () {
|
3570
|
+
var _a;
|
3571
|
+
return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length > 0);
|
3509
3572
|
};
|
3510
|
-
return
|
3511
|
-
}());
|
3573
|
+
return AllUnCheckedValidatorArray;
|
3574
|
+
}(ValidatorArray));
|
3512
3575
|
|
3513
|
-
var
|
3514
|
-
__extends(
|
3515
|
-
function
|
3576
|
+
var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
3577
|
+
__extends(CountGreaterThanCheckedValidatorArray, _super);
|
3578
|
+
function CountGreaterThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
3516
3579
|
if (autoValid === void 0) { autoValid = true; }
|
3517
|
-
|
3580
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3581
|
+
_this.count = count;
|
3582
|
+
return _this;
|
3518
3583
|
}
|
3519
|
-
|
3584
|
+
CountGreaterThanCheckedValidatorArray.prototype.valid = function () {
|
3520
3585
|
var _a;
|
3521
|
-
return
|
3586
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length > this.count;
|
3522
3587
|
};
|
3523
|
-
return
|
3588
|
+
return CountGreaterThanCheckedValidatorArray;
|
3524
3589
|
}(ValidatorArray));
|
3525
3590
|
|
3526
3591
|
var CheckedValidator = /** @class */ (function (_super) {
|
@@ -3536,32 +3601,19 @@ var CheckedValidator = /** @class */ (function (_super) {
|
|
3536
3601
|
return CheckedValidator;
|
3537
3602
|
}(Validator));
|
3538
3603
|
|
3539
|
-
var
|
3540
|
-
__extends(
|
3541
|
-
function
|
3542
|
-
if (autoValid === void 0) { autoValid = true; }
|
3543
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3544
|
-
}
|
3545
|
-
AllUnCheckedValidatorArray.prototype.valid = function () {
|
3546
|
-
var _a;
|
3547
|
-
return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length > 0);
|
3548
|
-
};
|
3549
|
-
return AllUnCheckedValidatorArray;
|
3550
|
-
}(ValidatorArray));
|
3551
|
-
|
3552
|
-
var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
|
3553
|
-
__extends(CountGreaterThanCheckedValidatorArray, _super);
|
3554
|
-
function CountGreaterThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
3604
|
+
var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3605
|
+
__extends(CountEqualsCheckedValidatorArray, _super);
|
3606
|
+
function CountEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3555
3607
|
if (autoValid === void 0) { autoValid = true; }
|
3556
3608
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3557
3609
|
_this.count = count;
|
3558
3610
|
return _this;
|
3559
3611
|
}
|
3560
|
-
|
3612
|
+
CountEqualsCheckedValidatorArray.prototype.valid = function () {
|
3561
3613
|
var _a;
|
3562
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3614
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length === this.count;
|
3563
3615
|
};
|
3564
|
-
return
|
3616
|
+
return CountEqualsCheckedValidatorArray;
|
3565
3617
|
}(ValidatorArray));
|
3566
3618
|
|
3567
3619
|
var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
@@ -3579,123 +3631,129 @@ var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3579
3631
|
return CountEqualsUnCheckedValidatorArray;
|
3580
3632
|
}(ValidatorArray));
|
3581
3633
|
|
3582
|
-
var
|
3583
|
-
__extends(
|
3584
|
-
function
|
3634
|
+
var AllCheckedValidatorArray = /** @class */ (function (_super) {
|
3635
|
+
__extends(AllCheckedValidatorArray, _super);
|
3636
|
+
function AllCheckedValidatorArray(value, target, event, autoValid) {
|
3585
3637
|
if (autoValid === void 0) { autoValid = true; }
|
3586
|
-
|
3587
|
-
_this.count = count;
|
3588
|
-
return _this;
|
3638
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3589
3639
|
}
|
3590
|
-
|
3640
|
+
AllCheckedValidatorArray.prototype.valid = function () {
|
3591
3641
|
var _a;
|
3592
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >
|
3642
|
+
return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > 0);
|
3593
3643
|
};
|
3594
|
-
return
|
3644
|
+
return AllCheckedValidatorArray;
|
3595
3645
|
}(ValidatorArray));
|
3596
3646
|
|
3597
|
-
var
|
3598
|
-
__extends(
|
3599
|
-
function
|
3647
|
+
var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
|
3648
|
+
__extends(CountLessThanCheckedValidatorArray, _super);
|
3649
|
+
function CountLessThanCheckedValidatorArray(count, value, target, event, autoValid) {
|
3600
3650
|
if (autoValid === void 0) { autoValid = true; }
|
3601
3651
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3602
3652
|
_this.count = count;
|
3603
3653
|
return _this;
|
3604
3654
|
}
|
3605
|
-
|
3655
|
+
CountLessThanCheckedValidatorArray.prototype.valid = function () {
|
3606
3656
|
var _a;
|
3607
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3657
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length < this.count;
|
3608
3658
|
};
|
3609
|
-
return
|
3659
|
+
return CountLessThanCheckedValidatorArray;
|
3610
3660
|
}(ValidatorArray));
|
3611
3661
|
|
3612
|
-
var
|
3613
|
-
__extends(
|
3614
|
-
function
|
3662
|
+
var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3663
|
+
__extends(CountGreaterThanUnCheckedValidatorArray, _super);
|
3664
|
+
function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3615
3665
|
if (autoValid === void 0) { autoValid = true; }
|
3616
3666
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3617
3667
|
_this.count = count;
|
3618
3668
|
return _this;
|
3619
3669
|
}
|
3620
|
-
|
3670
|
+
CountGreaterThanUnCheckedValidatorArray.prototype.valid = function () {
|
3621
3671
|
var _a;
|
3622
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3672
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > this.count;
|
3623
3673
|
};
|
3624
|
-
return
|
3674
|
+
return CountGreaterThanUnCheckedValidatorArray;
|
3625
3675
|
}(ValidatorArray));
|
3626
3676
|
|
3627
|
-
var
|
3628
|
-
__extends(
|
3629
|
-
function
|
3677
|
+
var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3678
|
+
__extends(CountGreaterThanEqualsUnCheckedValidatorArray, _super);
|
3679
|
+
function CountGreaterThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3630
3680
|
if (autoValid === void 0) { autoValid = true; }
|
3631
3681
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3632
3682
|
_this.count = count;
|
3633
3683
|
return _this;
|
3634
3684
|
}
|
3635
|
-
|
3685
|
+
CountGreaterThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
|
3636
3686
|
var _a;
|
3637
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length
|
3687
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
3638
3688
|
};
|
3639
|
-
return
|
3689
|
+
return CountGreaterThanEqualsUnCheckedValidatorArray;
|
3640
3690
|
}(ValidatorArray));
|
3641
3691
|
|
3642
|
-
var
|
3643
|
-
__extends(
|
3644
|
-
function
|
3692
|
+
var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3693
|
+
__extends(CountLessThanEqualsCheckedValidatorArray, _super);
|
3694
|
+
function CountLessThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3645
3695
|
if (autoValid === void 0) { autoValid = true; }
|
3646
|
-
|
3696
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3697
|
+
_this.count = count;
|
3698
|
+
return _this;
|
3647
3699
|
}
|
3648
|
-
|
3649
|
-
var _a
|
3650
|
-
|
3651
|
-
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
3700
|
+
CountLessThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3701
|
+
var _a;
|
3702
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length <= this.count;
|
3652
3703
|
};
|
3653
|
-
return
|
3654
|
-
}(
|
3704
|
+
return CountLessThanEqualsCheckedValidatorArray;
|
3705
|
+
}(ValidatorArray));
|
3655
3706
|
|
3656
|
-
var
|
3657
|
-
__extends(
|
3658
|
-
function
|
3707
|
+
var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3708
|
+
__extends(CountUnCheckedValidatorArray, _super);
|
3709
|
+
function CountUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3659
3710
|
if (autoValid === void 0) { autoValid = true; }
|
3660
3711
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3661
3712
|
_this.count = count;
|
3662
3713
|
return _this;
|
3663
3714
|
}
|
3664
|
-
|
3715
|
+
CountUnCheckedValidatorArray.prototype.valid = function () {
|
3665
3716
|
var _a;
|
3666
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3717
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
3667
3718
|
};
|
3668
|
-
return
|
3719
|
+
return CountUnCheckedValidatorArray;
|
3669
3720
|
}(ValidatorArray));
|
3670
3721
|
|
3671
|
-
var
|
3672
|
-
__extends(
|
3673
|
-
function
|
3722
|
+
var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
|
3723
|
+
__extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
|
3724
|
+
function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
|
3674
3725
|
if (autoValid === void 0) { autoValid = true; }
|
3675
3726
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3676
3727
|
_this.count = count;
|
3677
3728
|
return _this;
|
3678
3729
|
}
|
3679
|
-
|
3730
|
+
CountGreaterThanEqualsCheckedValidatorArray.prototype.valid = function () {
|
3680
3731
|
var _a;
|
3681
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length
|
3732
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length >= this.count;
|
3682
3733
|
};
|
3683
|
-
return
|
3734
|
+
return CountGreaterThanEqualsCheckedValidatorArray;
|
3684
3735
|
}(ValidatorArray));
|
3685
3736
|
|
3686
|
-
var
|
3687
|
-
__extends(
|
3688
|
-
function
|
3737
|
+
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3738
|
+
__extends(IncludeCheckedValidatorArray, _super);
|
3739
|
+
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
3740
|
+
if (allRequired === void 0) { allRequired = false; }
|
3689
3741
|
if (autoValid === void 0) { autoValid = true; }
|
3690
3742
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3691
|
-
_this.
|
3743
|
+
_this.include = include;
|
3744
|
+
_this.allRequired = allRequired;
|
3692
3745
|
return _this;
|
3693
3746
|
}
|
3694
|
-
|
3747
|
+
IncludeCheckedValidatorArray.prototype.valid = function () {
|
3748
|
+
var _this = this;
|
3695
3749
|
var _a;
|
3696
|
-
|
3750
|
+
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
3751
|
+
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
3752
|
+
return checkedValue.length > 0 &&
|
3753
|
+
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
3754
|
+
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
3697
3755
|
};
|
3698
|
-
return
|
3756
|
+
return IncludeCheckedValidatorArray;
|
3699
3757
|
}(ValidatorArray));
|
3700
3758
|
|
3701
3759
|
var FormValidator = /** @class */ (function (_super) {
|
@@ -3716,6 +3774,21 @@ var FormValidator = /** @class */ (function (_super) {
|
|
3716
3774
|
return FormValidator;
|
3717
3775
|
}(Validator));
|
3718
3776
|
|
3777
|
+
var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3778
|
+
__extends(CountLessThanUnCheckedValidatorArray, _super);
|
3779
|
+
function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3780
|
+
if (autoValid === void 0) { autoValid = true; }
|
3781
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3782
|
+
_this.count = count;
|
3783
|
+
return _this;
|
3784
|
+
}
|
3785
|
+
CountLessThanUnCheckedValidatorArray.prototype.valid = function () {
|
3786
|
+
var _a;
|
3787
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length < this.count;
|
3788
|
+
};
|
3789
|
+
return CountLessThanUnCheckedValidatorArray;
|
3790
|
+
}(ValidatorArray));
|
3791
|
+
|
3719
3792
|
var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3720
3793
|
__extends(ExcludeCheckedValidatorArray, _super);
|
3721
3794
|
function ExcludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
@@ -3738,6 +3811,50 @@ var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
|
|
3738
3811
|
return ExcludeCheckedValidatorArray;
|
3739
3812
|
}(ValidatorArray));
|
3740
3813
|
|
3814
|
+
var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3815
|
+
__extends(CountLessThanEqualsUnCheckedValidatorArray, _super);
|
3816
|
+
function CountLessThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3817
|
+
if (autoValid === void 0) { autoValid = true; }
|
3818
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3819
|
+
_this.count = count;
|
3820
|
+
return _this;
|
3821
|
+
}
|
3822
|
+
CountLessThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
|
3823
|
+
var _a;
|
3824
|
+
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length <= this.count;
|
3825
|
+
};
|
3826
|
+
return CountLessThanEqualsUnCheckedValidatorArray;
|
3827
|
+
}(ValidatorArray));
|
3828
|
+
|
3829
|
+
var EmptyValidator = /** @class */ (function (_super) {
|
3830
|
+
__extends(EmptyValidator, _super);
|
3831
|
+
function EmptyValidator(value, target, event, autoValid) {
|
3832
|
+
if (autoValid === void 0) { autoValid = true; }
|
3833
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3834
|
+
}
|
3835
|
+
EmptyValidator.prototype.valid = function () {
|
3836
|
+
var _a, _b;
|
3837
|
+
var value = this.value;
|
3838
|
+
return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
|
3839
|
+
};
|
3840
|
+
return EmptyValidator;
|
3841
|
+
}(Validator));
|
3842
|
+
|
3843
|
+
var NotEmptyValidator = /** @class */ (function (_super) {
|
3844
|
+
__extends(NotEmptyValidator, _super);
|
3845
|
+
function NotEmptyValidator(value, target, event, autoValid) {
|
3846
|
+
if (autoValid === void 0) { autoValid = true; }
|
3847
|
+
return _super.call(this, value, target, event, autoValid) || this;
|
3848
|
+
}
|
3849
|
+
NotEmptyValidator.prototype.valid = function () {
|
3850
|
+
var _a, _b;
|
3851
|
+
var value = this.value;
|
3852
|
+
// console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
|
3853
|
+
return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
3854
|
+
};
|
3855
|
+
return NotEmptyValidator;
|
3856
|
+
}(Validator));
|
3857
|
+
|
3741
3858
|
var MultipleValidator = /** @class */ (function (_super) {
|
3742
3859
|
__extends(MultipleValidator, _super);
|
3743
3860
|
function MultipleValidator(validators, value, target, event, autoValid) {
|
@@ -3767,65 +3884,6 @@ var MultipleValidator = /** @class */ (function (_super) {
|
|
3767
3884
|
return MultipleValidator;
|
3768
3885
|
}(Validator));
|
3769
3886
|
|
3770
|
-
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
3771
|
-
__extends(NotRegExpTestValidator, _super);
|
3772
|
-
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
3773
|
-
if (autoValid === void 0) { autoValid = true; }
|
3774
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3775
|
-
_this.regexp = DomRenderProxy.final(regexp);
|
3776
|
-
return _this;
|
3777
|
-
}
|
3778
|
-
NotRegExpTestValidator.prototype.valid = function () {
|
3779
|
-
var _a;
|
3780
|
-
var value = this.value;
|
3781
|
-
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
3782
|
-
if (value) {
|
3783
|
-
return !regExp.test(value);
|
3784
|
-
}
|
3785
|
-
else {
|
3786
|
-
return true;
|
3787
|
-
}
|
3788
|
-
};
|
3789
|
-
return NotRegExpTestValidator;
|
3790
|
-
}(Validator));
|
3791
|
-
|
3792
|
-
var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
|
3793
|
-
__extends(IncludeCheckedValidatorArray, _super);
|
3794
|
-
function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
|
3795
|
-
if (allRequired === void 0) { allRequired = false; }
|
3796
|
-
if (autoValid === void 0) { autoValid = true; }
|
3797
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3798
|
-
_this.include = include;
|
3799
|
-
_this.allRequired = allRequired;
|
3800
|
-
return _this;
|
3801
|
-
}
|
3802
|
-
IncludeCheckedValidatorArray.prototype.valid = function () {
|
3803
|
-
var _this = this;
|
3804
|
-
var _a;
|
3805
|
-
var valus = (_a = this.value) !== null && _a !== void 0 ? _a : [];
|
3806
|
-
var checkedValue = valus.filter(function (it) { return it.checked; }).map(function (it) { return it.value; });
|
3807
|
-
return checkedValue.length > 0 &&
|
3808
|
-
(!(checkedValue.filter(function (it) { return !_this.include.includes(it); }).length > 0)) &&
|
3809
|
-
(this.allRequired ? checkedValue.filter(function (it) { return _this.include.includes(it); }).length === this.include.length : true);
|
3810
|
-
};
|
3811
|
-
return IncludeCheckedValidatorArray;
|
3812
|
-
}(ValidatorArray));
|
3813
|
-
|
3814
|
-
var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
|
3815
|
-
__extends(CountLessThanUnCheckedValidatorArray, _super);
|
3816
|
-
function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
|
3817
|
-
if (autoValid === void 0) { autoValid = true; }
|
3818
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3819
|
-
_this.count = count;
|
3820
|
-
return _this;
|
3821
|
-
}
|
3822
|
-
CountLessThanUnCheckedValidatorArray.prototype.valid = function () {
|
3823
|
-
var _a;
|
3824
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length < this.count;
|
3825
|
-
};
|
3826
|
-
return CountLessThanUnCheckedValidatorArray;
|
3827
|
-
}(ValidatorArray));
|
3828
|
-
|
3829
3887
|
var PassValidator = /** @class */ (function (_super) {
|
3830
3888
|
__extends(PassValidator, _super);
|
3831
3889
|
function PassValidator(value, target, event, autoValid) {
|
@@ -3838,71 +3896,53 @@ var PassValidator = /** @class */ (function (_super) {
|
|
3838
3896
|
return PassValidator;
|
3839
3897
|
}(Validator));
|
3840
3898
|
|
3841
|
-
var
|
3842
|
-
__extends(
|
3843
|
-
function
|
3899
|
+
var RequiredValidator = /** @class */ (function (_super) {
|
3900
|
+
__extends(RequiredValidator, _super);
|
3901
|
+
function RequiredValidator(value, target, event, autoValid) {
|
3844
3902
|
if (autoValid === void 0) { autoValid = true; }
|
3845
3903
|
return _super.call(this, value, target, event, autoValid) || this;
|
3846
3904
|
}
|
3847
|
-
|
3848
|
-
var _a, _b;
|
3905
|
+
RequiredValidator.prototype.valid = function () {
|
3849
3906
|
var value = this.value;
|
3850
|
-
// console.log('
|
3851
|
-
return value !== undefined && value !== null
|
3907
|
+
// console.log('required', value, value !== undefined && value !== null)
|
3908
|
+
return value !== undefined && value !== null;
|
3852
3909
|
};
|
3853
|
-
return
|
3910
|
+
return RequiredValidator;
|
3854
3911
|
}(Validator));
|
3855
3912
|
|
3856
|
-
var
|
3857
|
-
__extends(
|
3858
|
-
function
|
3913
|
+
var NotRegExpTestValidator = /** @class */ (function (_super) {
|
3914
|
+
__extends(NotRegExpTestValidator, _super);
|
3915
|
+
function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
|
3859
3916
|
if (autoValid === void 0) { autoValid = true; }
|
3860
3917
|
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3861
3918
|
_this.regexp = DomRenderProxy.final(regexp);
|
3862
3919
|
return _this;
|
3863
3920
|
}
|
3864
|
-
|
3921
|
+
NotRegExpTestValidator.prototype.valid = function () {
|
3865
3922
|
var _a;
|
3866
3923
|
var value = this.value;
|
3867
3924
|
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
3868
|
-
// console.log('regexp-->', value, this.regexp, regExp.test(value))
|
3869
3925
|
if (value) {
|
3870
|
-
return regExp.test(value);
|
3926
|
+
return !regExp.test(value);
|
3871
3927
|
}
|
3872
3928
|
else {
|
3873
|
-
return
|
3929
|
+
return true;
|
3874
3930
|
}
|
3875
3931
|
};
|
3876
|
-
return
|
3932
|
+
return NotRegExpTestValidator;
|
3877
3933
|
}(Validator));
|
3878
3934
|
|
3879
|
-
var
|
3880
|
-
__extends(
|
3881
|
-
function
|
3882
|
-
if (autoValid === void 0) { autoValid = true; }
|
3883
|
-
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3884
|
-
_this.count = count;
|
3885
|
-
return _this;
|
3886
|
-
}
|
3887
|
-
CountUnCheckedValidatorArray.prototype.valid = function () {
|
3888
|
-
var _a;
|
3889
|
-
return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length >= this.count;
|
3890
|
-
};
|
3891
|
-
return CountUnCheckedValidatorArray;
|
3892
|
-
}(ValidatorArray));
|
3893
|
-
|
3894
|
-
var RequiredValidator = /** @class */ (function (_super) {
|
3895
|
-
__extends(RequiredValidator, _super);
|
3896
|
-
function RequiredValidator(value, target, event, autoValid) {
|
3935
|
+
var UnCheckedValidator = /** @class */ (function (_super) {
|
3936
|
+
__extends(UnCheckedValidator, _super);
|
3937
|
+
function UnCheckedValidator(value, target, event, autoValid) {
|
3897
3938
|
if (autoValid === void 0) { autoValid = true; }
|
3898
3939
|
return _super.call(this, value, target, event, autoValid) || this;
|
3899
3940
|
}
|
3900
|
-
|
3901
|
-
var
|
3902
|
-
|
3903
|
-
return value !== undefined && value !== null;
|
3941
|
+
UnCheckedValidator.prototype.valid = function () {
|
3942
|
+
var _a, _b;
|
3943
|
+
return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
|
3904
3944
|
};
|
3905
|
-
return
|
3945
|
+
return UnCheckedValidator;
|
3906
3946
|
}(Validator));
|
3907
3947
|
|
3908
3948
|
var ValidMultipleValidator = /** @class */ (function (_super) {
|
@@ -3934,6 +3974,29 @@ var ValidValidator = /** @class */ (function (_super) {
|
|
3934
3974
|
return ValidValidator;
|
3935
3975
|
}(Validator));
|
3936
3976
|
|
3977
|
+
var RegExpTestValidator = /** @class */ (function (_super) {
|
3978
|
+
__extends(RegExpTestValidator, _super);
|
3979
|
+
function RegExpTestValidator(regexp, value, target, event, autoValid) {
|
3980
|
+
if (autoValid === void 0) { autoValid = true; }
|
3981
|
+
var _this = _super.call(this, value, target, event, autoValid) || this;
|
3982
|
+
_this.regexp = DomRenderProxy.final(regexp);
|
3983
|
+
return _this;
|
3984
|
+
}
|
3985
|
+
RegExpTestValidator.prototype.valid = function () {
|
3986
|
+
var _a;
|
3987
|
+
var value = this.value;
|
3988
|
+
var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
|
3989
|
+
// console.log('regexp-->', value, this.regexp, regExp.test(value))
|
3990
|
+
if (value) {
|
3991
|
+
return regExp.test(value);
|
3992
|
+
}
|
3993
|
+
else {
|
3994
|
+
return false;
|
3995
|
+
}
|
3996
|
+
};
|
3997
|
+
return RegExpTestValidator;
|
3998
|
+
}(Validator));
|
3999
|
+
|
3937
4000
|
var ValidValidatorArray = /** @class */ (function (_super) {
|
3938
4001
|
__extends(ValidValidatorArray, _super);
|
3939
4002
|
function ValidValidatorArray(validCallBack, value, target, event, autoValid) {
|
@@ -3948,19 +4011,6 @@ var ValidValidatorArray = /** @class */ (function (_super) {
|
|
3948
4011
|
return ValidValidatorArray;
|
3949
4012
|
}(ValidatorArray));
|
3950
4013
|
|
3951
|
-
var UnCheckedValidator = /** @class */ (function (_super) {
|
3952
|
-
__extends(UnCheckedValidator, _super);
|
3953
|
-
function UnCheckedValidator(value, target, event, autoValid) {
|
3954
|
-
if (autoValid === void 0) { autoValid = true; }
|
3955
|
-
return _super.call(this, value, target, event, autoValid) || this;
|
3956
|
-
}
|
3957
|
-
UnCheckedValidator.prototype.valid = function () {
|
3958
|
-
var _a, _b;
|
3959
|
-
return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
|
3960
|
-
};
|
3961
|
-
return UnCheckedValidator;
|
3962
|
-
}(Validator));
|
3963
|
-
|
3964
4014
|
var ValueNotEqualsValidator = /** @class */ (function (_super) {
|
3965
4015
|
__extends(ValueNotEqualsValidator, _super);
|
3966
4016
|
function ValueNotEqualsValidator(equalsValue, value, target, event, autoValid) {
|
@@ -3989,6 +4039,28 @@ var ValueEqualsValidator = /** @class */ (function (_super) {
|
|
3989
4039
|
return ValueEqualsValidator;
|
3990
4040
|
}(Validator));
|
3991
4041
|
|
4042
|
+
var ClipBoardUtils = /** @class */ (function () {
|
4043
|
+
function ClipBoardUtils() {
|
4044
|
+
}
|
4045
|
+
ClipBoardUtils.readText = function (clipboard) {
|
4046
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4047
|
+
return clipboard.readText();
|
4048
|
+
};
|
4049
|
+
ClipBoardUtils.read = function (clipboard) {
|
4050
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4051
|
+
return clipboard.read();
|
4052
|
+
};
|
4053
|
+
ClipBoardUtils.writeText = function (data, clipboard) {
|
4054
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4055
|
+
return clipboard.writeText(data);
|
4056
|
+
};
|
4057
|
+
ClipBoardUtils.write = function (data, clipboard) {
|
4058
|
+
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4059
|
+
return clipboard.write(data);
|
4060
|
+
};
|
4061
|
+
return ClipBoardUtils;
|
4062
|
+
}());
|
4063
|
+
|
3992
4064
|
var NodeUtils = /** @class */ (function () {
|
3993
4065
|
function NodeUtils() {
|
3994
4066
|
}
|
@@ -4013,28 +4085,6 @@ var NodeUtils = /** @class */ (function () {
|
|
4013
4085
|
return NodeUtils;
|
4014
4086
|
}());
|
4015
4087
|
|
4016
|
-
var ClipBoardUtils = /** @class */ (function () {
|
4017
|
-
function ClipBoardUtils() {
|
4018
|
-
}
|
4019
|
-
ClipBoardUtils.readText = function (clipboard) {
|
4020
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4021
|
-
return clipboard.readText();
|
4022
|
-
};
|
4023
|
-
ClipBoardUtils.read = function (clipboard) {
|
4024
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4025
|
-
return clipboard.read();
|
4026
|
-
};
|
4027
|
-
ClipBoardUtils.writeText = function (data, clipboard) {
|
4028
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4029
|
-
return clipboard.writeText(data);
|
4030
|
-
};
|
4031
|
-
ClipBoardUtils.write = function (data, clipboard) {
|
4032
|
-
if (clipboard === void 0) { clipboard = navigator.clipboard; }
|
4033
|
-
return clipboard.write(data);
|
4034
|
-
};
|
4035
|
-
return ClipBoardUtils;
|
4036
|
-
}());
|
4037
|
-
|
4038
4088
|
var StorageUtils = /** @class */ (function () {
|
4039
4089
|
function StorageUtils() {
|
4040
4090
|
}
|