@dooboostore/dom-render 1.0.98
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 +24 -0
- package/DomRender.js +115 -0
- package/DomRenderProxy.d.ts +38 -0
- package/DomRenderProxy.js +586 -0
- package/README.MD +938 -0
- package/components/ComponentBase.d.ts +41 -0
- package/components/ComponentBase.js +210 -0
- package/components/ComponentSet.d.ts +22 -0
- package/components/ComponentSet.js +23 -0
- package/components/appender/Appender.d.ts +23 -0
- package/components/appender/Appender.js +59 -0
- package/components/checkbox/CheckBox.d.ts +47 -0
- package/components/checkbox/CheckBox.js +118 -0
- package/components/choose/Choose.d.ts +39 -0
- package/components/choose/Choose.js +110 -0
- package/components/details/Details.d.ts +57 -0
- package/components/details/Details.js +199 -0
- package/components/dialog/Dialog.d.ts +1 -0
- package/components/dialog/Dialog.js +85 -0
- package/components/dialog/example/ImageEditorDialog.d.ts +1 -0
- package/components/dialog/example/ImageEditorDialog.js +116 -0
- package/components/forOf/ForOf.d.ts +18 -0
- package/components/forOf/ForOf.js +32 -0
- package/components/if/If.d.ts +21 -0
- package/components/if/If.js +40 -0
- package/components/index.d.ts +27 -0
- package/components/index.js +13 -0
- package/components/input/Input.d.ts +34 -0
- package/components/input/Input.js +86 -0
- package/components/promise/PromiseSwitch.d.ts +55 -0
- package/components/promise/PromiseSwitch.js +181 -0
- package/components/radio/Radio.d.ts +45 -0
- package/components/radio/Radio.js +123 -0
- package/components/select/Select.d.ts +23 -0
- package/components/select/Select.js +52 -0
- package/components/this/This.d.ts +24 -0
- package/components/this/This.js +62 -0
- package/components/timer/Timer.d.ts +26 -0
- package/components/timer/Timer.js +102 -0
- package/configs/Config.d.ts +34 -0
- package/configs/Config.js +2 -0
- package/configs/TargetAttr.d.ts +7 -0
- package/configs/TargetAttr.js +2 -0
- package/configs/TargetElement.d.ts +16 -0
- package/configs/TargetElement.js +2 -0
- package/css/parse/index.d.ts +49 -0
- package/css/parse/index.js +498 -0
- package/css/stringify/compiler.d.ts +34 -0
- package/css/stringify/compiler.js +36 -0
- package/css/stringify/compress.d.ts +104 -0
- package/css/stringify/compress.js +147 -0
- package/css/stringify/identity.d.ts +109 -0
- package/css/stringify/identity.js +183 -0
- package/css/stringify/index.d.ts +24 -0
- package/css/stringify/index.js +27 -0
- package/css/stringify/types.d.ts +15 -0
- package/css/stringify/types.js +2 -0
- package/css/types.d.ts +10 -0
- package/css/types.js +2 -0
- package/decorators/DomRenderNoProxy.d.ts +4 -0
- package/decorators/DomRenderNoProxy.js +15 -0
- package/events/EventManager.d.ts +68 -0
- package/events/EventManager.js +477 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/iterators/Range.d.ts +24 -0
- package/iterators/Range.js +70 -0
- package/lifecycle/OnBeforeReturnGet.d.ts +4 -0
- package/lifecycle/OnBeforeReturnGet.js +2 -0
- package/lifecycle/OnBeforeReturnSet.d.ts +5 -0
- package/lifecycle/OnBeforeReturnSet.js +4 -0
- package/lifecycle/OnChangeAttrRender.d.ts +9 -0
- package/lifecycle/OnChangeAttrRender.js +4 -0
- package/lifecycle/OnChildRenderedByProperty.d.ts +5 -0
- package/lifecycle/OnChildRenderedByProperty.js +4 -0
- package/lifecycle/OnCreateRender.d.ts +5 -0
- package/lifecycle/OnCreateRender.js +4 -0
- package/lifecycle/OnCreateRenderData.d.ts +10 -0
- package/lifecycle/OnCreateRenderData.js +4 -0
- package/lifecycle/OnCreateRendered.d.ts +8 -0
- package/lifecycle/OnCreateRendered.js +4 -0
- package/lifecycle/OnCreatedThisChild.d.ts +6 -0
- package/lifecycle/OnCreatedThisChild.js +4 -0
- package/lifecycle/OnDestroyRender.d.ts +9 -0
- package/lifecycle/OnDestroyRender.js +4 -0
- package/lifecycle/OnInitRender.d.ts +6 -0
- package/lifecycle/OnInitRender.js +4 -0
- package/lifecycle/OnProxyDomRender.d.ts +5 -0
- package/lifecycle/OnProxyDomRender.js +2 -0
- package/lifecycle/dr-this/OnDrThisBind.d.ts +5 -0
- package/lifecycle/dr-this/OnDrThisBind.js +4 -0
- package/lifecycle/dr-this/OnDrThisUnBind.d.ts +5 -0
- package/lifecycle/dr-this/OnDrThisUnBind.js +4 -0
- package/managers/RenderManager.d.ts +2 -0
- package/managers/RenderManager.js +12 -0
- package/messenger/DefaultMessenger.d.ts +4 -0
- package/messenger/DefaultMessenger.js +4 -0
- package/messenger/Messenger.d.ts +79 -0
- package/messenger/Messenger.js +185 -0
- package/operators/Appender.d.ts +15 -0
- package/operators/Appender.js +90 -0
- package/operators/Dr.d.ts +9 -0
- package/operators/Dr.js +53 -0
- package/operators/DrAppender.d.ts +9 -0
- package/operators/DrAppender.js +69 -0
- package/operators/DrFor.d.ts +9 -0
- package/operators/DrFor.js +58 -0
- package/operators/DrForOf.d.ts +9 -0
- package/operators/DrForOf.js +120 -0
- package/operators/DrForm.d.ts +9 -0
- package/operators/DrForm.js +79 -0
- package/operators/DrIf.d.ts +9 -0
- package/operators/DrIf.js +70 -0
- package/operators/DrInnerHTML.d.ts +9 -0
- package/operators/DrInnerHTML.js +48 -0
- package/operators/DrInnerText.d.ts +9 -0
- package/operators/DrInnerText.js +46 -0
- package/operators/DrPre.d.ts +8 -0
- package/operators/DrPre.js +22 -0
- package/operators/DrRepeat.d.ts +9 -0
- package/operators/DrRepeat.js +70 -0
- package/operators/DrStripElement.d.ts +9 -0
- package/operators/DrStripElement.js +50 -0
- package/operators/DrTargetAttr.d.ts +8 -0
- package/operators/DrTargetAttr.js +45 -0
- package/operators/DrTargetElement.d.ts +13 -0
- package/operators/DrTargetElement.js +91 -0
- package/operators/DrTargetElementIsElement.d.ts +13 -0
- package/operators/DrTargetElementIsElement.js +79 -0
- package/operators/DrThis.d.ts +7 -0
- package/operators/DrThis.js +72 -0
- package/operators/DrThisProperty.d.ts +11 -0
- package/operators/DrThisProperty.js +93 -0
- package/operators/OperatorExecuter.d.ts +50 -0
- package/operators/OperatorExecuter.js +50 -0
- package/operators/OperatorExecuterAttrRequire.d.ts +9 -0
- package/operators/OperatorExecuterAttrRequire.js +25 -0
- package/package.json +70 -0
- package/rawsets/AttrInitCallBack.d.ts +6 -0
- package/rawsets/AttrInitCallBack.js +2 -0
- package/rawsets/Attrs.d.ts +27 -0
- package/rawsets/Attrs.js +2 -0
- package/rawsets/CreatorMetaData.d.ts +20 -0
- package/rawsets/CreatorMetaData.js +2 -0
- package/rawsets/DestroyOptionType.d.ts +5 -0
- package/rawsets/DestroyOptionType.js +6 -0
- package/rawsets/ElementInitCallBack.d.ts +9 -0
- package/rawsets/ElementInitCallBack.js +2 -0
- package/rawsets/RawSet.d.ts +180 -0
- package/rawsets/RawSet.js +1450 -0
- package/rawsets/RawSetOperatorType.d.ts +4 -0
- package/rawsets/RawSetOperatorType.js +5 -0
- package/rawsets/RawSetType.d.ts +8 -0
- package/rawsets/RawSetType.js +9 -0
- package/rawsets/Render.d.ts +27 -0
- package/rawsets/Render.js +2 -0
- package/routers/HashRouter.d.ts +24 -0
- package/routers/HashRouter.js +86 -0
- package/routers/PathRouter.d.ts +23 -0
- package/routers/PathRouter.js +73 -0
- package/routers/Router.d.ts +68 -0
- package/routers/Router.js +132 -0
- package/types/Types.d.ts +12 -0
- package/types/Types.js +26 -0
- package/validators/AllCheckedValidatorArray.d.ts +7 -0
- package/validators/AllCheckedValidatorArray.js +11 -0
- package/validators/AllUnCheckedValidatorArray.d.ts +7 -0
- package/validators/AllUnCheckedValidatorArray.js +11 -0
- package/validators/CheckedValidator.d.ts +6 -0
- package/validators/CheckedValidator.js +11 -0
- package/validators/CountEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +12 -0
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountLessThanUnCheckedValidatorArray.js +12 -0
- package/validators/CountUnCheckedValidatorArray.d.ts +8 -0
- package/validators/CountUnCheckedValidatorArray.js +12 -0
- package/validators/EmptyValidator.d.ts +6 -0
- package/validators/EmptyValidator.js +12 -0
- package/validators/ExcludeCheckedValidatorArray.d.ts +9 -0
- package/validators/ExcludeCheckedValidatorArray.js +17 -0
- package/validators/FormValidator.d.ts +8 -0
- package/validators/FormValidator.js +16 -0
- package/validators/IncludeCheckedValidatorArray.d.ts +9 -0
- package/validators/IncludeCheckedValidatorArray.js +17 -0
- package/validators/MultipleValidator.d.ts +9 -0
- package/validators/MultipleValidator.js +25 -0
- package/validators/NonPassValidator.d.ts +6 -0
- package/validators/NonPassValidator.js +10 -0
- package/validators/NotEmptyValidator.d.ts +6 -0
- package/validators/NotEmptyValidator.js +13 -0
- package/validators/NotRegExpTestValidator.d.ts +7 -0
- package/validators/NotRegExpTestValidator.js +20 -0
- package/validators/PassValidator.d.ts +6 -0
- package/validators/PassValidator.js +10 -0
- package/validators/RegExpTestValidator.d.ts +7 -0
- package/validators/RegExpTestValidator.js +21 -0
- package/validators/RequiredValidator.d.ts +6 -0
- package/validators/RequiredValidator.js +12 -0
- package/validators/UnCheckedValidator.d.ts +6 -0
- package/validators/UnCheckedValidator.js +11 -0
- package/validators/ValidMultipleValidator.d.ts +10 -0
- package/validators/ValidMultipleValidator.js +12 -0
- package/validators/ValidValidator.d.ts +7 -0
- package/validators/ValidValidator.js +11 -0
- package/validators/ValidValidatorArray.d.ts +8 -0
- package/validators/ValidValidatorArray.js +11 -0
- package/validators/Validator.d.ts +58 -0
- package/validators/Validator.js +203 -0
- package/validators/ValidatorArray.d.ts +18 -0
- package/validators/ValidatorArray.js +77 -0
- package/validators/ValueEqualsValidator.d.ts +7 -0
- package/validators/ValueEqualsValidator.js +11 -0
- package/validators/ValueNotEqualsValidator.d.ts +7 -0
- package/validators/ValueNotEqualsValidator.js +11 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
11
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
12
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
13
|
+
import { ExecuteState } from './OperatorExecuter';
|
|
14
|
+
export class DrStripElement extends OperatorExecuterAttrRequire {
|
|
15
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
16
|
+
source.operatorAround = undefined;
|
|
17
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);
|
|
18
|
+
}
|
|
19
|
+
executeAttrRequire(attr) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
// const itRandom = RawSet.drItOtherEncoding(this.elementSource.element, 'DrStripElement');
|
|
23
|
+
// const vars = RawSet.drVarEncoding(this.elementSource.element, this.elementSource.attrs.drVarOption ?? '');
|
|
24
|
+
const newTemp = this.source.config.window.document.createElement('temp');
|
|
25
|
+
// Object.entries(this.__render.drAttr).filter(([k,v]) => k !== 'drIf' && v).forEach(([k, v]) => n.setAttribute(this.__render.drAttrsOriginName[k], v)); <-- 이부분은 다른 attr에도 적용을 할지말지 생각해야됨 엘리먼트 존재유무에 따라서 적용을 할지말지 결정해야됨
|
|
26
|
+
ScriptUtils.eval(`
|
|
27
|
+
${this.render.bindScript}
|
|
28
|
+
${(_a = this.elementSource.attrs.drBeforeOption) !== null && _a !== void 0 ? _a : ''}
|
|
29
|
+
const n = $element.cloneNode(true);
|
|
30
|
+
if(${attr}) {
|
|
31
|
+
Array.from(n.childNodes).forEach(it => this.__render.fag.append(it));
|
|
32
|
+
} else {
|
|
33
|
+
this.__render.fag.append(n);
|
|
34
|
+
}
|
|
35
|
+
${(_b = this.elementSource.attrs.drAfterOption) !== null && _b !== void 0 ? _b : ''};
|
|
36
|
+
return true;
|
|
37
|
+
`, Object.assign(this.source.obj, {
|
|
38
|
+
__render: Object.freeze(Object.assign({ fag: newTemp, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, drStripOption: this.elementSource.attrs.drStripOption }, this.render))
|
|
39
|
+
}));
|
|
40
|
+
const tempalte = this.source.config.window.document.createElement('template');
|
|
41
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
|
42
|
+
this.returnContainer.fag.append(tempalte.content);
|
|
43
|
+
const rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
|
44
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
|
45
|
+
this.returnContainer.raws.push(...rr);
|
|
46
|
+
return ExecuteState.EXECUTE;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=DrStripElement.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
2
|
+
import { AfterCallBack, ElementSource, ExecuteState, OperatorExecuter, ReturnContainer, Source } from './OperatorExecuter';
|
|
3
|
+
import { Render } from '../rawsets/Render';
|
|
4
|
+
export declare class DrTargetAttr extends OperatorExecuter<void> {
|
|
5
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
|
6
|
+
execute(): Promise<ExecuteState>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=DrTargetAttr.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
11
|
+
import { ExecuteState, OperatorExecuter } from './OperatorExecuter';
|
|
12
|
+
export class DrTargetAttr extends OperatorExecuter {
|
|
13
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
14
|
+
source.operatorAround = undefined;
|
|
15
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);
|
|
16
|
+
}
|
|
17
|
+
execute() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
var _a, _b, _c, _d;
|
|
20
|
+
const attributeNames = this.elementSource.element.getAttributeNames();
|
|
21
|
+
const targetAttr = (_b = (_a = this.source.config) === null || _a === void 0 ? void 0 : _a.targetAttrs) === null || _b === void 0 ? void 0 : _b.find(it => attributeNames.includes(it.name));
|
|
22
|
+
if (targetAttr) {
|
|
23
|
+
const attrName = targetAttr.name;
|
|
24
|
+
const attrValue = this.rawSet.getAttributeAndDelete(this.elementSource.element, attrName);
|
|
25
|
+
if (attrValue && attrName && (!this.elementSource.attrs.drForOf && !this.elementSource.attrs.drFor && !this.elementSource.attrs.drRepeat)) {
|
|
26
|
+
const documentFragment = targetAttr.callBack(this.elementSource.element, attrValue, this.source.obj, this.rawSet);
|
|
27
|
+
if (documentFragment) {
|
|
28
|
+
const rr = RawSet.checkPointCreates(documentFragment, this.source.obj, this.source.config);
|
|
29
|
+
(_c = this.elementSource.element.parentNode) === null || _c === void 0 ? void 0 : _c.replaceChild(documentFragment, this.elementSource.element);
|
|
30
|
+
this.returnContainer.raws.push(...rr);
|
|
31
|
+
this.afterCallBack.onAttrInitCallBacks.push({
|
|
32
|
+
attrName,
|
|
33
|
+
attrValue,
|
|
34
|
+
obj: this.source.obj
|
|
35
|
+
});
|
|
36
|
+
(_d = targetAttr === null || targetAttr === void 0 ? void 0 : targetAttr.complete) === null || _d === void 0 ? void 0 : _d.call(targetAttr, this.elementSource.element, attrValue, this.source.obj, this.rawSet);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return ExecuteState.EXECUTE;
|
|
40
|
+
}
|
|
41
|
+
return ExecuteState.NO_EXECUTE;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=DrTargetAttr.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
2
|
+
import { AfterCallBack, ElementSource, ExecuteState, OperatorExecuter, ReturnContainer, Source } from './OperatorExecuter';
|
|
3
|
+
import { Render } from '../rawsets/Render';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
HTMLMetaElement: typeof HTMLMetaElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class DrTargetElement extends OperatorExecuter<void> {
|
|
10
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
|
11
|
+
execute(): Promise<ExecuteState>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DrTargetElement.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
11
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
12
|
+
import { ExecuteState, OperatorExecuter } from './OperatorExecuter';
|
|
13
|
+
// 여기서 사용자가 등록한 TargetElement가 들어간다.
|
|
14
|
+
export class DrTargetElement extends OperatorExecuter {
|
|
15
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
16
|
+
source.operatorAround = undefined;
|
|
17
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);
|
|
18
|
+
}
|
|
19
|
+
execute() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
const targetElement = (_b = (_a = this.source.config) === null || _a === void 0 ? void 0 : _a.targetElements) === null || _b === void 0 ? void 0 : _b.find(it => it.name.toLowerCase() === this.elementSource.element.tagName.toLowerCase());
|
|
23
|
+
if (targetElement) {
|
|
24
|
+
if (this.rawSet.point.start instanceof this.source.config.window.HTMLMetaElement && this.rawSet.point.end instanceof this.source.config.window.HTMLMetaElement) {
|
|
25
|
+
this.rawSet.point.start.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);
|
|
26
|
+
this.rawSet.point.end.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);
|
|
27
|
+
}
|
|
28
|
+
const documentFragment = yield targetElement.callBack(this.elementSource.element, this.source.obj, this.rawSet, this.elementSource.attrs, this.source.config);
|
|
29
|
+
if (documentFragment) {
|
|
30
|
+
const detectAction = this.elementSource.element.getAttribute(RawSet.DR_DETECT_NAME);
|
|
31
|
+
// const dictionaryKey = this.elementSource.element.getAttribute(RawSet.DR_DICTIONARY_OPTIONKEYNAME);
|
|
32
|
+
// console.log('dictionaryKey', dictionaryKey);
|
|
33
|
+
// const render = (documentFragment as any).render;
|
|
34
|
+
this.rawSet.dataSet.fragment = documentFragment;
|
|
35
|
+
// if (documentFragment) {
|
|
36
|
+
// const tempDiv = this.source.config.window.document.createElement('div');
|
|
37
|
+
// tempDiv.appendChild(documentFragment.cloneNode(true));
|
|
38
|
+
// console.log('DocumentFragment innerHTML:', tempDiv.innerHTML);
|
|
39
|
+
// }
|
|
40
|
+
// this.rawSet.dataSet??={};
|
|
41
|
+
// this.rawSet.dataSet.data = render.component;
|
|
42
|
+
if (detectAction && this.rawSet.dataSet.render) {
|
|
43
|
+
// TODO: 없어져야될듯?
|
|
44
|
+
this.rawSet.detect = {
|
|
45
|
+
action: () => {
|
|
46
|
+
const script = `var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; ${detectAction} `;
|
|
47
|
+
ScriptUtils.eval(script, Object.assign(this.source.obj, {
|
|
48
|
+
__render: this.rawSet.dataSet.render
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// fag.append(documentFragment)
|
|
54
|
+
// console.log('----------1', ElementUtils.toInnerHTML(documentFragment, {document: this.source.config.window.document}));
|
|
55
|
+
// await Promises.sleep(1000)
|
|
56
|
+
let targetFragment = documentFragment;
|
|
57
|
+
if (targetElement.noStrip) {
|
|
58
|
+
// documentFragment.firstElementChild.classList.add(`${this.rawSet.uuid}___DrTargetElement`)
|
|
59
|
+
const fragment = this.source.config.window.document.createDocumentFragment();
|
|
60
|
+
Array.from(((_c = documentFragment.firstElementChild) === null || _c === void 0 ? void 0 : _c.childNodes) || []).forEach(child => {
|
|
61
|
+
// fragment.appendChild(child.cloneNode(true));
|
|
62
|
+
fragment.appendChild(child);
|
|
63
|
+
});
|
|
64
|
+
// fragment.append(documentFragment.firstElementChild);
|
|
65
|
+
targetFragment = fragment;
|
|
66
|
+
}
|
|
67
|
+
// console.log('----------2', ElementUtils.toInnerHTML(targetFragment, {document: this.source.config.window.document}));
|
|
68
|
+
const rr = RawSet.checkPointCreates(targetFragment, this.source.obj, this.source.config);
|
|
69
|
+
if (targetElement.noStrip) {
|
|
70
|
+
Array.from(targetFragment.childNodes || []).forEach(child => {
|
|
71
|
+
documentFragment.firstElementChild.appendChild(child);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(documentFragment, this.elementSource.element);
|
|
75
|
+
this.returnContainer.raws.push(...rr);
|
|
76
|
+
this.afterCallBack.onElementInitCallBacks.push({
|
|
77
|
+
name: targetElement.name.toLowerCase(),
|
|
78
|
+
obj: this.source.obj,
|
|
79
|
+
targetElement,
|
|
80
|
+
creatorMetaData: targetElement.__creatorMetaData
|
|
81
|
+
});
|
|
82
|
+
// console.log('sssssssssssssss', this.source.obj);
|
|
83
|
+
(_e = targetElement === null || targetElement === void 0 ? void 0 : targetElement.complete) === null || _e === void 0 ? void 0 : _e.call(targetElement, this.elementSource.element, this.source.obj, this.rawSet);
|
|
84
|
+
}
|
|
85
|
+
return ExecuteState.EXECUTE;
|
|
86
|
+
}
|
|
87
|
+
return ExecuteState.NO_EXECUTE;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=DrTargetElement.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
2
|
+
import { AfterCallBack, ElementSource, ExecuteState, OperatorExecuter, ReturnContainer, Source } from './OperatorExecuter';
|
|
3
|
+
import { Render } from '../rawsets/Render';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
HTMLMetaElement: typeof HTMLMetaElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare class DrTargetElementIsElement extends OperatorExecuter<string | null> {
|
|
10
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
|
11
|
+
execute(attr: string | null): Promise<ExecuteState>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DrTargetElementIsElement.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
11
|
+
import { ExecuteState, OperatorExecuter } from './OperatorExecuter';
|
|
12
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
13
|
+
// 여기서 사용자가 등록한 TargetElement가 들어간다.
|
|
14
|
+
export class DrTargetElementIsElement extends OperatorExecuter {
|
|
15
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
16
|
+
source.operatorAround = undefined;
|
|
17
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);
|
|
18
|
+
}
|
|
19
|
+
execute(attr) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
if (!attr) {
|
|
23
|
+
return ExecuteState.NO_EXECUTE;
|
|
24
|
+
}
|
|
25
|
+
const targetElement = (_b = (_a = this.source.config) === null || _a === void 0 ? void 0 : _a.targetElements) === null || _b === void 0 ? void 0 : _b.find(it => it.name.toLowerCase() === attr.toLowerCase());
|
|
26
|
+
// console.log('--------------tar', targetElement)
|
|
27
|
+
if (targetElement) {
|
|
28
|
+
if (this.rawSet.point.start instanceof this.source.config.window.HTMLMetaElement && this.rawSet.point.end instanceof this.source.config.window.HTMLMetaElement) {
|
|
29
|
+
this.rawSet.point.start.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);
|
|
30
|
+
this.rawSet.point.end.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);
|
|
31
|
+
}
|
|
32
|
+
const documentFragment = yield targetElement.callBack(this.elementSource.element, this.source.obj, this.rawSet, this.elementSource.attrs, this.source.config);
|
|
33
|
+
if (documentFragment) {
|
|
34
|
+
const detectAction = this.elementSource.element.getAttribute(RawSet.DR_DETECT_NAME);
|
|
35
|
+
this.rawSet.dataSet.fragment = documentFragment;
|
|
36
|
+
if (detectAction && this.rawSet.dataSet.render) {
|
|
37
|
+
// TODO: 없어져야될듯?
|
|
38
|
+
this.rawSet.detect = {
|
|
39
|
+
action: () => {
|
|
40
|
+
const script = `var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; ${detectAction} `;
|
|
41
|
+
ScriptUtils.eval(script, Object.assign(this.source.obj, {
|
|
42
|
+
__render: this.rawSet.dataSet.render
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// dr-replace-target-element-is 는 무조건 NoStrip로 처리
|
|
48
|
+
const noStrip = targetElement.noStrip;
|
|
49
|
+
let targetFragment = documentFragment;
|
|
50
|
+
if (noStrip) {
|
|
51
|
+
const fragment = this.source.config.window.document.createDocumentFragment();
|
|
52
|
+
Array.from(((_c = documentFragment.firstElementChild) === null || _c === void 0 ? void 0 : _c.childNodes) || []).forEach(child => {
|
|
53
|
+
fragment.appendChild(child);
|
|
54
|
+
});
|
|
55
|
+
targetFragment = fragment;
|
|
56
|
+
}
|
|
57
|
+
const rr = RawSet.checkPointCreates(targetFragment, this.source.obj, this.source.config);
|
|
58
|
+
if (noStrip) {
|
|
59
|
+
Array.from(targetFragment.childNodes || []).forEach(child => {
|
|
60
|
+
documentFragment.firstElementChild.appendChild(child);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
(_d = this.elementSource.element.parentNode) === null || _d === void 0 ? void 0 : _d.replaceChild(documentFragment, this.elementSource.element);
|
|
64
|
+
this.returnContainer.raws.push(...rr);
|
|
65
|
+
this.afterCallBack.onElementInitCallBacks.push({
|
|
66
|
+
name: targetElement.name.toLowerCase(),
|
|
67
|
+
obj: this.source.obj,
|
|
68
|
+
targetElement,
|
|
69
|
+
creatorMetaData: targetElement.__creatorMetaData
|
|
70
|
+
});
|
|
71
|
+
(_e = targetElement === null || targetElement === void 0 ? void 0 : targetElement.complete) === null || _e === void 0 ? void 0 : _e.call(targetElement, this.elementSource.element, this.source.obj, this.rawSet);
|
|
72
|
+
}
|
|
73
|
+
return ExecuteState.EXECUTE;
|
|
74
|
+
}
|
|
75
|
+
return ExecuteState.NO_EXECUTE;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=DrTargetElementIsElement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
2
|
+
import { ExecuteState } from './OperatorExecuter';
|
|
3
|
+
export declare class DrThis extends OperatorExecuterAttrRequire<string> {
|
|
4
|
+
executeAttrRequire(attr: any): Promise<ExecuteState>;
|
|
5
|
+
setThisPath(thisPath: string): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=DrThis.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
11
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
12
|
+
import { ComponentSet } from '../components/ComponentSet';
|
|
13
|
+
import { ExecuteState } from './OperatorExecuter';
|
|
14
|
+
import { isOnDrThisUnBind } from '../lifecycle/dr-this/OnDrThisUnBind';
|
|
15
|
+
import { isOnDrThisBind } from '../lifecycle/dr-this/OnDrThisBind';
|
|
16
|
+
export class DrThis extends OperatorExecuterAttrRequire {
|
|
17
|
+
executeAttrRequire(attr) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
20
|
+
// console.log('drThis!!!!!!!!!!!!!',this.elementSource.attrs.drThis);
|
|
21
|
+
if (attr && this.elementSource.attrs.drThis) {
|
|
22
|
+
let thisPath = this.elementSource.attrs.drThis;
|
|
23
|
+
if (attr instanceof ComponentSet) {
|
|
24
|
+
// console.log('drThis!!!!!!!!!!->', attr)
|
|
25
|
+
// if (this.rawSet.data) {
|
|
26
|
+
// const destroyOptions = this.elementSource.attrs.drDestroyOption?.split(',') ?? [];
|
|
27
|
+
// debugger;
|
|
28
|
+
// RawSet.destroy((this.rawSet.data as ComponentSet).obj, [], this.source.config, destroyOptions);
|
|
29
|
+
// }
|
|
30
|
+
if (((_b = (_a = attr.config) === null || _a === void 0 ? void 0 : _a.beforeComponentSet) === null || _b === void 0 ? void 0 : _b.obj) !== attr.obj) {
|
|
31
|
+
if (isOnDrThisUnBind((_c = attr.config.beforeComponentSet) === null || _c === void 0 ? void 0 : _c.obj)) {
|
|
32
|
+
(_f = (_e = (_d = attr.config.beforeComponentSet) === null || _d === void 0 ? void 0 : _d.obj) === null || _e === void 0 ? void 0 : _e.onDrThisUnBind) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// this.rawSet.dataSet ??= {};
|
|
36
|
+
// this.rawSet.dataSet.data = attr;
|
|
37
|
+
if (((_h = (_g = attr.config) === null || _g === void 0 ? void 0 : _g.beforeComponentSet) === null || _h === void 0 ? void 0 : _h.obj) !== attr.obj) {
|
|
38
|
+
if (isOnDrThisBind(attr.obj)) {
|
|
39
|
+
(_k = (_j = attr.obj) === null || _j === void 0 ? void 0 : _j.onDrThisBind) === null || _k === void 0 ? void 0 : _k.call(_j);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// 중요: componentSet 의 objPath를 보고 판단하는 중요한부분
|
|
43
|
+
thisPath = `${this.elementSource.attrs.drThis}${attr.config.objPath ? ('.' + attr.config.objPath) : ''}`;
|
|
44
|
+
this.setThisPath(thisPath);
|
|
45
|
+
const componentBody = yield RawSet.drThisCreate(this.rawSet, this.elementSource.element, thisPath, (_l = this.elementSource.attrs.drVarOption) !== null && _l !== void 0 ? _l : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config, attr);
|
|
46
|
+
this.returnContainer.fag.append(componentBody);
|
|
47
|
+
this.afterCallBack.onThisComponentSetCallBacks.push(attr);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.setThisPath(thisPath);
|
|
51
|
+
this.returnContainer.fag.append(yield RawSet.drThisCreate(this.rawSet, this.elementSource.element, this.elementSource.attrs.drThis, (_m = this.elementSource.attrs.drVarOption) !== null && _m !== void 0 ? _m : '', this.elementSource.attrs.drStripOption, this.source.obj, this.source.config));
|
|
52
|
+
}
|
|
53
|
+
// console.log('!!!!!!!!!zzz', Array.from(this.returnContainer.fag.childNodes), this.elementSource.element);
|
|
54
|
+
const rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
|
55
|
+
(_o = this.elementSource.element.parentNode) === null || _o === void 0 ? void 0 : _o.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
|
56
|
+
this.returnContainer.raws.push(...rr);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.elementSource.element.remove();
|
|
60
|
+
}
|
|
61
|
+
return ExecuteState.EXECUTE;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
setThisPath(thisPath) {
|
|
65
|
+
// if (this.rawSet.point.start instanceof HTMLMetaElement && this.rawSet.point.end instanceof HTMLMetaElement) {
|
|
66
|
+
if (this.rawSet.point.start instanceof this.source.config.window.HTMLMetaElement && this.rawSet.point.end instanceof this.source.config.window.HTMLMetaElement) {
|
|
67
|
+
this.rawSet.point.start.setAttribute('this-path', thisPath);
|
|
68
|
+
this.rawSet.point.end.setAttribute('this-path', thisPath);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=DrThis.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
2
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
3
|
+
import { Render } from '../rawsets/Render';
|
|
4
|
+
import { AfterCallBack, ElementSource, ExecuteState, ReturnContainer, Source } from './OperatorExecuter';
|
|
5
|
+
import { Config } from '../configs/Config';
|
|
6
|
+
export declare class DrThisProperty extends OperatorExecuterAttrRequire<string> {
|
|
7
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack);
|
|
8
|
+
executeAttrRequire(attr: string): Promise<ExecuteState>;
|
|
9
|
+
static append(obj: any, fullPath: string, key: string, rawSet: RawSet, config: Config): RawSet[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=DrThisProperty.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { OperatorExecuterAttrRequire } from './OperatorExecuterAttrRequire';
|
|
11
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
12
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
13
|
+
import { ExecuteState } from './OperatorExecuter';
|
|
14
|
+
export class DrThisProperty extends OperatorExecuterAttrRequire {
|
|
15
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
|
|
16
|
+
source.operatorAround = undefined;
|
|
17
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);
|
|
18
|
+
}
|
|
19
|
+
executeAttrRequire(attr) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b, _c, _d, _e;
|
|
22
|
+
const itRandom = RawSet.drItOtherEncoding(this.elementSource.element, 'DrThisProperty');
|
|
23
|
+
const vars = RawSet.drVarEncoding(this.elementSource.element, (_a = this.elementSource.attrs.drVarOption) !== null && _a !== void 0 ? _a : '');
|
|
24
|
+
const newTemp = this.source.config.window.document.createElement('temp');
|
|
25
|
+
const dictioanry = ScriptUtils.evalReturn(attr, this.source.obj);
|
|
26
|
+
const dictionaryKey = (_b = this.elementSource.attrs.drKeyOption) !== null && _b !== void 0 ? _b : '';
|
|
27
|
+
// console.log('--->', attr, dictionaryKey)
|
|
28
|
+
// if (!(dictioanry instanceof Dictionary)) {
|
|
29
|
+
// return ExecuteState.STOP;
|
|
30
|
+
// }
|
|
31
|
+
// await new Promise(resolve => setTimeout(resolve, 1000));
|
|
32
|
+
// console.log('!!!!!!!!!!!!!!', this.rawSet);
|
|
33
|
+
ScriptUtils.eval(`
|
|
34
|
+
${this.render.bindScript}
|
|
35
|
+
${(_c = this.elementSource.attrs.drBeforeOption) !== null && _c !== void 0 ? _c : ''}
|
|
36
|
+
var i = 0;
|
|
37
|
+
const dictionary = ${attr};
|
|
38
|
+
const dictionaryKey = '${dictionaryKey}';
|
|
39
|
+
const dictionaryStr = \`${attr}\`.trim();
|
|
40
|
+
// console.log('----@#!@#@!#', this.__render.oldChild);
|
|
41
|
+
if (dictionary) {
|
|
42
|
+
for(const it in dictionary) {
|
|
43
|
+
var destIt = dictionaryStr + '["' + it + '"]';
|
|
44
|
+
const n = this.__render.element.cloneNode(true);
|
|
45
|
+
n.setAttribute('dr-this', destIt);
|
|
46
|
+
n.setAttribute('${RawSet.DR_KEY_OPTIONNAME}', it);
|
|
47
|
+
// n.setAttribute('dr-dictionary-key', it);
|
|
48
|
+
this.__render.fag.append(n);
|
|
49
|
+
i++;
|
|
50
|
+
}
|
|
51
|
+
this.__render.rawset.point.start.setAttribute('${RawSet.DR_HAS_KEYS_OPTIONNAME}',Object.keys(dictionary).join(','));
|
|
52
|
+
}
|
|
53
|
+
${(_d = this.elementSource.attrs.drAfterOption) !== null && _d !== void 0 ? _d : ''}
|
|
54
|
+
`, Object.assign(this.source.obj, {
|
|
55
|
+
__render: Object.freeze(Object.assign({ drStripOption: this.elementSource.attrs.drStripOption, drAttr: this.elementSource.attrs, drAttrsOriginName: RawSet.drAttrsOriginName, fag: newTemp }, this.render))
|
|
56
|
+
}));
|
|
57
|
+
RawSet.drVarDecoding(newTemp, vars);
|
|
58
|
+
RawSet.drItOtherDecoding(newTemp, itRandom);
|
|
59
|
+
const tempalte = this.source.config.window.document.createElement('template');
|
|
60
|
+
tempalte.innerHTML = newTemp.innerHTML;
|
|
61
|
+
this.returnContainer.fag.append(tempalte.content);
|
|
62
|
+
const rr = RawSet.checkPointCreates(this.returnContainer.fag, this.source.obj, this.source.config);
|
|
63
|
+
(_e = this.elementSource.element.parentNode) === null || _e === void 0 ? void 0 : _e.replaceChild(this.returnContainer.fag, this.elementSource.element);
|
|
64
|
+
// const rrr = rr.flatMap(it => it.render(obj, config));// .flat();
|
|
65
|
+
this.returnContainer.raws.push(...rr);
|
|
66
|
+
return ExecuteState.EXECUTE;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
static append(obj, fullPath, key, rawSet, config) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
const genNode = config.window.document.importNode(rawSet.dataSet.fragment, true);
|
|
72
|
+
// console.log('---> append', rawSet, genNode);
|
|
73
|
+
const rawSets = [];
|
|
74
|
+
for (const cNode of Array.from(genNode.childNodes.values())) {
|
|
75
|
+
const element = cNode.cloneNode(true);
|
|
76
|
+
element.removeAttribute(RawSet.DR_THIS_PROPERTY_NAME);
|
|
77
|
+
element.setAttribute(RawSet.DR_THIS_NAME, `this.${fullPath}`);
|
|
78
|
+
element.setAttribute(RawSet.DR_KEY_OPTIONNAME, key);
|
|
79
|
+
// rawSet.point.end.after(element);
|
|
80
|
+
const fg = config.window.document.createDocumentFragment();
|
|
81
|
+
fg.append(element);
|
|
82
|
+
rawSets.push(...RawSet.checkPointCreates(fg, obj, config));
|
|
83
|
+
rawSet.point.end.before(fg);
|
|
84
|
+
const start = rawSet.point.start;
|
|
85
|
+
const keys = (_b = (_a = start.getAttribute(RawSet.DR_HAS_KEYS_OPTIONNAME)) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : [];
|
|
86
|
+
keys.push(key);
|
|
87
|
+
start.setAttribute(RawSet.DR_HAS_KEYS_OPTIONNAME, keys.join(','));
|
|
88
|
+
rawSets.forEach((it) => __awaiter(this, void 0, void 0, function* () { return yield it.render(obj, config); }));
|
|
89
|
+
}
|
|
90
|
+
return rawSets;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=DrThisProperty.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AttrInitCallBack } from '../rawsets/AttrInitCallBack';
|
|
2
|
+
import { ElementInitCallBack } from '../rawsets/ElementInitCallBack';
|
|
3
|
+
import { ComponentSet } from '../components/ComponentSet';
|
|
4
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
5
|
+
import { Render } from '../rawsets/Render';
|
|
6
|
+
import { Attrs } from '../rawsets/Attrs';
|
|
7
|
+
import { Config } from '../configs/Config';
|
|
8
|
+
export interface OperatorAround {
|
|
9
|
+
beforeAttr?: (value: string | null | undefined, opratorExecutor: OperatorExecuter) => string | null | undefined;
|
|
10
|
+
before?: (data: any, opratorExecutor: OperatorExecuter) => any;
|
|
11
|
+
after?: (data: any, opratorExecutor: OperatorExecuter) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare enum ExecuteState {
|
|
14
|
+
EXECUTE = 0,
|
|
15
|
+
NO_EXECUTE = 1,
|
|
16
|
+
STOP = 2
|
|
17
|
+
}
|
|
18
|
+
export type AfterCallBack = {
|
|
19
|
+
onAttrInitCallBacks: AttrInitCallBack[];
|
|
20
|
+
onElementInitCallBacks: ElementInitCallBack[];
|
|
21
|
+
onThisComponentSetCallBacks: ComponentSet[];
|
|
22
|
+
};
|
|
23
|
+
export type ReturnContainer = {
|
|
24
|
+
raws: RawSet[];
|
|
25
|
+
fag: DocumentFragment;
|
|
26
|
+
};
|
|
27
|
+
export type ElementSource = {
|
|
28
|
+
element: Element;
|
|
29
|
+
attrs: Attrs;
|
|
30
|
+
attr?: string | null;
|
|
31
|
+
attrName?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type Source = {
|
|
34
|
+
config: Config;
|
|
35
|
+
operatorAround?: OperatorAround;
|
|
36
|
+
obj: any;
|
|
37
|
+
};
|
|
38
|
+
export declare abstract class OperatorExecuter<T = any> {
|
|
39
|
+
rawSet: RawSet;
|
|
40
|
+
render: Render;
|
|
41
|
+
returnContainer: ReturnContainer;
|
|
42
|
+
elementSource: ElementSource;
|
|
43
|
+
source: Source;
|
|
44
|
+
afterCallBack: AfterCallBack;
|
|
45
|
+
startingExecute: boolean;
|
|
46
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack, startingExecute?: boolean);
|
|
47
|
+
start(): Promise<ExecuteState>;
|
|
48
|
+
abstract execute(value: T): Promise<ExecuteState>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=OperatorExecuter.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';
|
|
11
|
+
export var ExecuteState;
|
|
12
|
+
(function (ExecuteState) {
|
|
13
|
+
ExecuteState[ExecuteState["EXECUTE"] = 0] = "EXECUTE";
|
|
14
|
+
ExecuteState[ExecuteState["NO_EXECUTE"] = 1] = "NO_EXECUTE";
|
|
15
|
+
ExecuteState[ExecuteState["STOP"] = 2] = "STOP";
|
|
16
|
+
})(ExecuteState || (ExecuteState = {}));
|
|
17
|
+
export class OperatorExecuter {
|
|
18
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute = true) {
|
|
19
|
+
this.rawSet = rawSet;
|
|
20
|
+
this.render = render;
|
|
21
|
+
this.returnContainer = returnContainer;
|
|
22
|
+
this.elementSource = elementSource;
|
|
23
|
+
this.source = source;
|
|
24
|
+
this.afterCallBack = afterCallBack;
|
|
25
|
+
this.startingExecute = startingExecute;
|
|
26
|
+
}
|
|
27
|
+
;
|
|
28
|
+
start() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f;
|
|
31
|
+
let attrValue = this.elementSource.attr;
|
|
32
|
+
// console.log('OperatorExecuter ', attrValue, this);
|
|
33
|
+
if ((_a = this.source.operatorAround) === null || _a === void 0 ? void 0 : _a.beforeAttr) {
|
|
34
|
+
attrValue = (_b = this.source.operatorAround.beforeAttr(attrValue, this)) !== null && _b !== void 0 ? _b : '';
|
|
35
|
+
}
|
|
36
|
+
let r = attrValue;
|
|
37
|
+
if (r && this.startingExecute) {
|
|
38
|
+
r = ScriptUtils.eval(` ${this.render.bindScript}; return ${attrValue}`, Object.assign(this.source.obj, { __render: this.render }));
|
|
39
|
+
}
|
|
40
|
+
if ((_c = this.source.operatorAround) === null || _c === void 0 ? void 0 : _c.before) {
|
|
41
|
+
r = (_d = this.source.operatorAround) === null || _d === void 0 ? void 0 : _d.before(r, this);
|
|
42
|
+
}
|
|
43
|
+
const state = yield this.execute(r);
|
|
44
|
+
(_f = (_e = this.source.operatorAround) === null || _e === void 0 ? void 0 : _e.after) === null || _f === void 0 ? void 0 : _f.call(_e, r, this);
|
|
45
|
+
return state;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=OperatorExecuter.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
2
|
+
import { Render } from '../rawsets/Render';
|
|
3
|
+
import { AfterCallBack, ElementSource, ExecuteState, OperatorExecuter, ReturnContainer, Source } from './OperatorExecuter';
|
|
4
|
+
export declare abstract class OperatorExecuterAttrRequire<T> extends OperatorExecuter<T> {
|
|
5
|
+
constructor(rawSet: RawSet, render: Render, returnContainer: ReturnContainer, elementSource: ElementSource, source: Source, afterCallBack: AfterCallBack, startingExecute?: boolean);
|
|
6
|
+
execute(data: T): Promise<ExecuteState>;
|
|
7
|
+
protected abstract executeAttrRequire(attr: T): Promise<ExecuteState>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=OperatorExecuterAttrRequire.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { ExecuteState, OperatorExecuter } from './OperatorExecuter';
|
|
11
|
+
export class OperatorExecuterAttrRequire extends OperatorExecuter {
|
|
12
|
+
constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute = true) {
|
|
13
|
+
super(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute);
|
|
14
|
+
}
|
|
15
|
+
;
|
|
16
|
+
execute(data) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (!this.elementSource.attr) {
|
|
19
|
+
return ExecuteState.NO_EXECUTE;
|
|
20
|
+
}
|
|
21
|
+
return yield this.executeAttrRequire(data);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=OperatorExecuterAttrRequire.js.map
|