@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,41 @@
|
|
|
1
|
+
import { OnChangeAttrRender, OtherData } from '../lifecycle/OnChangeAttrRender';
|
|
2
|
+
import { OnCreateRenderData, OnCreateRenderDataParams } from '../lifecycle/OnCreateRenderData';
|
|
3
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
4
|
+
import { ConstructorType } from '@dooboostore/core/types';
|
|
5
|
+
import { OnCreatedThisChild } from '../lifecycle/OnCreatedThisChild';
|
|
6
|
+
import { OnInitRender } from '../lifecycle/OnInitRender';
|
|
7
|
+
import { OnDestroyRender, OnDestroyRenderParams } from '../lifecycle/OnDestroyRender';
|
|
8
|
+
import { OnDrThisUnBind } from '../lifecycle/dr-this/OnDrThisUnBind';
|
|
9
|
+
import { OnDrThisBind } from '../lifecycle/dr-this/OnDrThisBind';
|
|
10
|
+
import * as Render from '../rawsets/Render';
|
|
11
|
+
export declare abstract class ComponentBase<T> implements OnChangeAttrRender, OnCreateRenderData, OnCreatedThisChild, OnDrThisBind, OnDrThisUnBind, OnInitRender, OnDestroyRender {
|
|
12
|
+
private config?;
|
|
13
|
+
private _rawSet?;
|
|
14
|
+
private _children;
|
|
15
|
+
private _render;
|
|
16
|
+
private _attribute?;
|
|
17
|
+
get render(): Render.Render | undefined;
|
|
18
|
+
get rawSet(): RawSet | undefined;
|
|
19
|
+
getAttribute<K extends keyof T>(name: K, attribute?: T): T[K] | null;
|
|
20
|
+
hasAttribute(name: keyof T): boolean;
|
|
21
|
+
equalsAttributeName(n: string, name: keyof T): boolean;
|
|
22
|
+
get uuid(): string | undefined;
|
|
23
|
+
get children(): any[];
|
|
24
|
+
getElement<T extends Element>(): T | undefined;
|
|
25
|
+
getFirstChild<T>(type: ConstructorType<T>): T | undefined;
|
|
26
|
+
getParentThis<P>(): P;
|
|
27
|
+
getChildren<C extends ConstructorType<any>>(type: C): InstanceType<C>[];
|
|
28
|
+
getChildren<C extends ConstructorType<any>[]>(types: C): InstanceType<C[number]>[];
|
|
29
|
+
constructor(config?: {
|
|
30
|
+
onlyParentType: ConstructorType<any>[] | ConstructorType<any>;
|
|
31
|
+
});
|
|
32
|
+
setAttribute(attribute: T): void;
|
|
33
|
+
onCreatedThisChild(child: any, data: OnCreateRenderDataParams): void;
|
|
34
|
+
onCreateRenderData(data: OnCreateRenderDataParams): void;
|
|
35
|
+
onChangeAttrRender(name: string, value: any, other: OtherData): void;
|
|
36
|
+
onInitRender(param: any, rawSet: RawSet): void;
|
|
37
|
+
onDrThisBind(): void;
|
|
38
|
+
onDrThisUnBind(): void;
|
|
39
|
+
onDestroyRender(data: OnDestroyRenderParams): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=ComponentBase.d.ts.map
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { RawSet } from '../rawsets/RawSet';
|
|
11
|
+
import { DomRenderNoProxy } from '../decorators/DomRenderNoProxy';
|
|
12
|
+
import { ConvertUtils } from '@dooboostore/core/convert/ConvertUtils';
|
|
13
|
+
import * as Render from '../rawsets/Render';
|
|
14
|
+
export class ComponentBase {
|
|
15
|
+
// private attributeData?: FieldUnionType<T, null>;
|
|
16
|
+
get render() {
|
|
17
|
+
return this._render;
|
|
18
|
+
}
|
|
19
|
+
get rawSet() {
|
|
20
|
+
return this._rawSet;
|
|
21
|
+
}
|
|
22
|
+
getAttribute(name, attribute = this._attribute) {
|
|
23
|
+
const target = attribute;
|
|
24
|
+
if (!target) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const nameString = String(name);
|
|
28
|
+
let p = nameString;
|
|
29
|
+
if (p in target) {
|
|
30
|
+
return target[p];
|
|
31
|
+
}
|
|
32
|
+
p = ConvertUtils.snakeToCamelCase(nameString);
|
|
33
|
+
if (p in target) {
|
|
34
|
+
return target[p];
|
|
35
|
+
}
|
|
36
|
+
p = ConvertUtils.camelToSnakeCase(nameString);
|
|
37
|
+
if (p in target) {
|
|
38
|
+
return target[p];
|
|
39
|
+
}
|
|
40
|
+
p = nameString.toUpperCase();
|
|
41
|
+
if (p in target) {
|
|
42
|
+
return target[p];
|
|
43
|
+
}
|
|
44
|
+
p = nameString.toLowerCase();
|
|
45
|
+
if (p in target) {
|
|
46
|
+
return target[p];
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
// get attribute(): T | undefined {
|
|
51
|
+
// const handler = {
|
|
52
|
+
// get(target: any, prop: string) {
|
|
53
|
+
// let p = prop;
|
|
54
|
+
// if (p in target) {
|
|
55
|
+
// return target[p];
|
|
56
|
+
// }
|
|
57
|
+
// p = ConvertUtils.snakeToCamelCase(prop);
|
|
58
|
+
// if (p in target) {
|
|
59
|
+
// return target[p];
|
|
60
|
+
// }
|
|
61
|
+
// p = ConvertUtils.camelToSnakeCase(prop);
|
|
62
|
+
// if (p in target) {
|
|
63
|
+
// return target[p];
|
|
64
|
+
// }
|
|
65
|
+
// p = prop.toUpperCase()
|
|
66
|
+
// if (p in target) {
|
|
67
|
+
// return target[p];
|
|
68
|
+
// }
|
|
69
|
+
// p = prop.toLowerCase()
|
|
70
|
+
// if (p in target) {
|
|
71
|
+
// return target[p];
|
|
72
|
+
// }
|
|
73
|
+
// return null;
|
|
74
|
+
// }
|
|
75
|
+
// };
|
|
76
|
+
// const obj = new Proxy(this._attribute, handler);
|
|
77
|
+
// return obj;
|
|
78
|
+
// }
|
|
79
|
+
hasAttribute(name) {
|
|
80
|
+
return this.getAttribute(name) !== null;
|
|
81
|
+
}
|
|
82
|
+
equalsAttributeName(n, name) {
|
|
83
|
+
return n === name ||
|
|
84
|
+
ConvertUtils.snakeToCamelCase(n) === name ||
|
|
85
|
+
ConvertUtils.camelToSnakeCase(n) === name ||
|
|
86
|
+
n.toUpperCase() === name.toUpperCase() ||
|
|
87
|
+
n.toLowerCase() === name.toLowerCase();
|
|
88
|
+
}
|
|
89
|
+
// attribute(name: keyof T, {attribute = this._attribute}: {equals?: (data: T[keyof T]) => void, notEquals?: () => void,attribute?: T} = {}) {
|
|
90
|
+
// const data = this.getAttribute(name, attribute)
|
|
91
|
+
// return n === name ||
|
|
92
|
+
// ConvertUtils.snakeToCamelCase(n) === name ||
|
|
93
|
+
// ConvertUtils.camelToSnakeCase(n) === name ||
|
|
94
|
+
// n.toUpperCase() === (name as string).toUpperCase() ||
|
|
95
|
+
// n.toLowerCase() === (name as string).toLowerCase()
|
|
96
|
+
// ;
|
|
97
|
+
// }
|
|
98
|
+
get uuid() {
|
|
99
|
+
var _a;
|
|
100
|
+
return (_a = this._rawSet) === null || _a === void 0 ? void 0 : _a.uuid;
|
|
101
|
+
}
|
|
102
|
+
get children() {
|
|
103
|
+
return this._children;
|
|
104
|
+
}
|
|
105
|
+
getElement() {
|
|
106
|
+
var _a, _b, _c, _d, _e;
|
|
107
|
+
return (_e = (_d = ((_a = this.render) !== null && _a !== void 0 ? _a : (_c = (_b = this.rawSet) === null || _b === void 0 ? void 0 : _b.dataSet) === null || _c === void 0 ? void 0 : _c.render)) === null || _d === void 0 ? void 0 : _d.getElement) === null || _e === void 0 ? void 0 : _e.call(_d);
|
|
108
|
+
}
|
|
109
|
+
getFirstChild(type) {
|
|
110
|
+
return this._children.find(it => it instanceof type);
|
|
111
|
+
}
|
|
112
|
+
getParentThis() {
|
|
113
|
+
var _a;
|
|
114
|
+
return (_a = this.render) === null || _a === void 0 ? void 0 : _a.parentThis;
|
|
115
|
+
}
|
|
116
|
+
// 구현 시그니처 (오버로드 시그니처보다 더 일반적이어야 함)
|
|
117
|
+
getChildren(typeOrTypes) {
|
|
118
|
+
const targets = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
|
|
119
|
+
// filter의 결과는 항상 배열이므로 `?? []`는 필요 없습니다.
|
|
120
|
+
// filter가 아무것도 찾지 못하면 빈 배열을 반환합니다.
|
|
121
|
+
return this._children.filter(child => targets.some(targetConstructor => child instanceof targetConstructor));
|
|
122
|
+
}
|
|
123
|
+
// getChildren<T extends ConstructorType<any>[] | ConstructorType<any>>(
|
|
124
|
+
// type: T
|
|
125
|
+
// ): T extends (infer U)[] ? InstanceType<U>[] : T extends ConstructorType<infer V> ? V[] : never {
|
|
126
|
+
// const target = Array.isArray(type) ? type : [type];
|
|
127
|
+
// return this._children.filter(it => target.some(t => it instanceof t)) ?? [];
|
|
128
|
+
// }
|
|
129
|
+
// getChildren<T>(type: ConstructorType<T> | ConstructorType<T>[]): T[] {
|
|
130
|
+
// const target = Array.isArray(type) ? type : [type];
|
|
131
|
+
// return this._children.filter(it => target.some(t => it instanceof t)) ?? [];
|
|
132
|
+
// }
|
|
133
|
+
/*
|
|
134
|
+
getChildren<T>(type: ConstructorType<T>): T[] {
|
|
135
|
+
return this._children.filter(it => it instanceof type) ?? [];
|
|
136
|
+
}
|
|
137
|
+
*/
|
|
138
|
+
constructor(config) {
|
|
139
|
+
this.config = config;
|
|
140
|
+
this._children = [];
|
|
141
|
+
}
|
|
142
|
+
setAttribute(attribute) {
|
|
143
|
+
this._attribute = attribute;
|
|
144
|
+
// this.attributeData = this._attribute;
|
|
145
|
+
}
|
|
146
|
+
onCreatedThisChild(child, data) {
|
|
147
|
+
this._children.push(child);
|
|
148
|
+
// this._rawSet = data.render?.rawSet;
|
|
149
|
+
// this._attribute = data.render?.attribute as T;
|
|
150
|
+
}
|
|
151
|
+
onCreateRenderData(data) {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
153
|
+
this._rawSet = (_a = data.render) === null || _a === void 0 ? void 0 : _a.rawSet;
|
|
154
|
+
this.setAttribute((_b = data.render) === null || _b === void 0 ? void 0 : _b.attribute);
|
|
155
|
+
this._render = data.render;
|
|
156
|
+
if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.onlyParentType) {
|
|
157
|
+
const isOk = Array.isArray((_d = this.config) === null || _d === void 0 ? void 0 : _d.onlyParentType) ? (_e = this.config) === null || _e === void 0 ? void 0 : _e.onlyParentType : [(_f = this.config) === null || _f === void 0 ? void 0 : _f.onlyParentType].some(it => { var _a; return ((_a = data.render) === null || _a === void 0 ? void 0 : _a.parentThis) instanceof it; });
|
|
158
|
+
if (!isOk) {
|
|
159
|
+
throw new Error('only my parentThis ' + ((_g = this.config) === null || _g === void 0 ? void 0 : _g.onlyParentType));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
onChangeAttrRender(name, value, other) {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
if (other.rawSet) {
|
|
166
|
+
this._rawSet = other.rawSet;
|
|
167
|
+
if (this._rawSet) {
|
|
168
|
+
this.setAttribute((_b = (_a = this._rawSet.dataSet) === null || _a === void 0 ? void 0 : _a.render) === null || _b === void 0 ? void 0 : _b.attribute);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// this.changeAttribute?.(this._attribute);
|
|
172
|
+
}
|
|
173
|
+
onInitRender(param, rawSet) {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
if (rawSet) {
|
|
176
|
+
this._rawSet = rawSet;
|
|
177
|
+
if (this._rawSet) {
|
|
178
|
+
this.setAttribute((_b = (_a = rawSet.dataSet) === null || _a === void 0 ? void 0 : _a.render) === null || _b === void 0 ? void 0 : _b.attribute);
|
|
179
|
+
}
|
|
180
|
+
const e = this.getElement();
|
|
181
|
+
if (e) {
|
|
182
|
+
e.component = this;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
onDrThisBind() {
|
|
187
|
+
}
|
|
188
|
+
onDrThisUnBind() {
|
|
189
|
+
}
|
|
190
|
+
onDestroyRender(data) {
|
|
191
|
+
// console.log('ComponentBase---onDestroyRender----')
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
__decorate([
|
|
195
|
+
DomRenderNoProxy,
|
|
196
|
+
__metadata("design:type", RawSet)
|
|
197
|
+
], ComponentBase.prototype, "_rawSet", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
DomRenderNoProxy,
|
|
200
|
+
__metadata("design:type", Array)
|
|
201
|
+
], ComponentBase.prototype, "_children", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
DomRenderNoProxy,
|
|
204
|
+
__metadata("design:type", Object)
|
|
205
|
+
], ComponentBase.prototype, "_render", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
DomRenderNoProxy,
|
|
208
|
+
__metadata("design:type", Object)
|
|
209
|
+
], ComponentBase.prototype, "_attribute", void 0);
|
|
210
|
+
//# sourceMappingURL=ComponentBase.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ComponentSetConfig = {
|
|
2
|
+
objPath?: string | null;
|
|
3
|
+
beforeComponentSet?: ComponentSet;
|
|
4
|
+
};
|
|
5
|
+
export declare class ComponentSet<T = any> {
|
|
6
|
+
obj: T;
|
|
7
|
+
private _config;
|
|
8
|
+
private _template;
|
|
9
|
+
private _styles;
|
|
10
|
+
constructor(obj: T, source: {
|
|
11
|
+
template?: string;
|
|
12
|
+
styles?: (string[]) | string;
|
|
13
|
+
}, config?: ComponentSetConfig);
|
|
14
|
+
get template(): string;
|
|
15
|
+
get styles(): string | string[];
|
|
16
|
+
get config(): ComponentSetConfig;
|
|
17
|
+
setTemplateStyle(set: {
|
|
18
|
+
template?: string;
|
|
19
|
+
styles?: string | (string[]);
|
|
20
|
+
}): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ComponentSet.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DomRenderFinalProxy } from '../types/Types';
|
|
2
|
+
export class ComponentSet {
|
|
3
|
+
constructor(obj, source, config) {
|
|
4
|
+
this.obj = obj;
|
|
5
|
+
this._template = source.template;
|
|
6
|
+
this._styles = source.styles;
|
|
7
|
+
this._config = DomRenderFinalProxy.final(Object.assign({ objPath: 'obj' }, config));
|
|
8
|
+
}
|
|
9
|
+
get template() {
|
|
10
|
+
return this._template;
|
|
11
|
+
}
|
|
12
|
+
get styles() {
|
|
13
|
+
return this._styles;
|
|
14
|
+
}
|
|
15
|
+
get config() {
|
|
16
|
+
return this._config;
|
|
17
|
+
}
|
|
18
|
+
setTemplateStyle(set) {
|
|
19
|
+
this._template = set.template;
|
|
20
|
+
this._styles = set.styles;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ComponentSet.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentBase } from '../ComponentBase';
|
|
2
|
+
import { RunConfig } from '../../DomRender';
|
|
3
|
+
import { RawSet } from '../../rawsets/RawSet';
|
|
4
|
+
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
5
|
+
import { OnInitRender } from '../../lifecycle/OnInitRender';
|
|
6
|
+
import { Appender as DomRenderAppender } from '../../operators/Appender';
|
|
7
|
+
export declare namespace Appender {
|
|
8
|
+
const selector = "dr-appender";
|
|
9
|
+
type Attribute<D> = {
|
|
10
|
+
value: DomRenderAppender<D>;
|
|
11
|
+
onCreate?: (appender: DomRenderAppender) => void;
|
|
12
|
+
};
|
|
13
|
+
class Appender<D> extends ComponentBase<Attribute<D>> implements OnInitRender {
|
|
14
|
+
private value?;
|
|
15
|
+
onInitRender(param: any, rawSet: RawSet): void;
|
|
16
|
+
onChangeAttrRender(name: string, value: any, other: OtherData): void;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const _default: {
|
|
20
|
+
appender: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
23
|
+
//# sourceMappingURL=Appender.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ComponentBase } from '../ComponentBase';
|
|
2
|
+
import { DomRender } from '../../DomRender';
|
|
3
|
+
import { RawSet } from '../../rawsets/RawSet';
|
|
4
|
+
export var Appender;
|
|
5
|
+
(function (Appender_1) {
|
|
6
|
+
Appender_1.selector = 'dr-appender';
|
|
7
|
+
// @Component({
|
|
8
|
+
// template: '<div dr-appender="@this@.appender" dr-option-strip="true">#innerHTML#</div>',
|
|
9
|
+
// selector: `${selector}`
|
|
10
|
+
// })
|
|
11
|
+
class Appender extends ComponentBase {
|
|
12
|
+
// onCreateRender(...param: any) {
|
|
13
|
+
// console.log('--onCreateRender')
|
|
14
|
+
// }
|
|
15
|
+
// test() {
|
|
16
|
+
// console.log('t', this.getAttribute('appender'))
|
|
17
|
+
// }
|
|
18
|
+
onInitRender(param, rawSet) {
|
|
19
|
+
// console.log('--onInitRender onInitRender')
|
|
20
|
+
super.onInitRender(param, rawSet);
|
|
21
|
+
}
|
|
22
|
+
// push(...data:D[]) {
|
|
23
|
+
// console.log('push/////', data);
|
|
24
|
+
// this.appender.push(...data);
|
|
25
|
+
// }
|
|
26
|
+
//
|
|
27
|
+
// set(key: string, v: D): void {
|
|
28
|
+
// this.appender.set(key, v)
|
|
29
|
+
// }
|
|
30
|
+
//
|
|
31
|
+
// delete(key: string): void {
|
|
32
|
+
// this.appender.delete(key);
|
|
33
|
+
// }
|
|
34
|
+
//
|
|
35
|
+
// clear(): void {
|
|
36
|
+
// this.appender.clear();
|
|
37
|
+
// }
|
|
38
|
+
onChangeAttrRender(name, value, other) {
|
|
39
|
+
super.onChangeAttrRender(name, value, other);
|
|
40
|
+
if (this.equalsAttributeName(name, 'value')) {
|
|
41
|
+
this.value = value;
|
|
42
|
+
}
|
|
43
|
+
// console.log('------>appender', name, value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
Appender_1.Appender = Appender;
|
|
47
|
+
})(Appender || (Appender = {}));
|
|
48
|
+
export default {
|
|
49
|
+
appender: (config) => {
|
|
50
|
+
return RawSet.createComponentTargetElement({
|
|
51
|
+
name: Appender.selector,
|
|
52
|
+
template: '<div dr-appender="@this@.value" dr-option-strip="true">#innerHTML#</div>',
|
|
53
|
+
objFactory: (e, o, r2, counstructorParam) => {
|
|
54
|
+
return DomRender.run({ rootObject: new Appender.Appender(...counstructorParam), config: config });
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=Appender.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComponentBase } from '../ComponentBase';
|
|
2
|
+
import { RunConfig } from '../../DomRender';
|
|
3
|
+
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
4
|
+
import { OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';
|
|
5
|
+
export declare namespace CheckBox {
|
|
6
|
+
export const selector = "dr-checkbox";
|
|
7
|
+
export type Attribute = {
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
10
|
+
export type ChangeOption = {
|
|
11
|
+
type: 'initialize' | 'event' | 'attributeChange';
|
|
12
|
+
};
|
|
13
|
+
export type WrapAttribute = {
|
|
14
|
+
class?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
change?: (checked: boolean, option: ChangeOption) => void;
|
|
18
|
+
};
|
|
19
|
+
class CheckBoxBase extends ComponentBase<Attribute> {
|
|
20
|
+
hidden: boolean;
|
|
21
|
+
}
|
|
22
|
+
export class Checked extends CheckBoxBase {
|
|
23
|
+
name: string;
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
export class UnChecked extends CheckBoxBase {
|
|
27
|
+
name: string;
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export class CheckBox extends ComponentBase<WrapAttribute> {
|
|
31
|
+
private checked;
|
|
32
|
+
private inputElement?;
|
|
33
|
+
change(option: ChangeOption, checked?: boolean): void;
|
|
34
|
+
private setChildrenHidden;
|
|
35
|
+
onCreatedThisChild(child: CheckBoxBase, childData: OnCreateRenderDataParams): void;
|
|
36
|
+
onInitInputElement(element: HTMLInputElement): void;
|
|
37
|
+
onChangeAttrRender(name: string, val: any, other: OtherData): void;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
}
|
|
41
|
+
declare const _default: {
|
|
42
|
+
checkBoxChecked: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
43
|
+
checkBoxUnchecked: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
44
|
+
checkBox: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
45
|
+
};
|
|
46
|
+
export default _default;
|
|
47
|
+
//# sourceMappingURL=CheckBox.d.ts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { ComponentBase } from '../ComponentBase';
|
|
2
|
+
import { DomRender } from '../../DomRender';
|
|
3
|
+
import { RawSet } from '../../rawsets/RawSet';
|
|
4
|
+
export var CheckBox;
|
|
5
|
+
(function (CheckBox_1) {
|
|
6
|
+
CheckBox_1.selector = 'dr-checkbox';
|
|
7
|
+
class CheckBoxBase extends ComponentBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.hidden = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// @Component({
|
|
14
|
+
// template: '<div dr-if="!@this@.hidden" dr-strip="true">#innerHTML#</div>',
|
|
15
|
+
// styles: '',
|
|
16
|
+
// selector: `${selector}.Checked`
|
|
17
|
+
// })
|
|
18
|
+
class Checked extends CheckBoxBase {
|
|
19
|
+
constructor() {
|
|
20
|
+
super({ onlyParentType: CheckBox });
|
|
21
|
+
this.name = 'checked';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
CheckBox_1.Checked = Checked;
|
|
25
|
+
// @Component({
|
|
26
|
+
// template: '<div dr-if="!@this@.hidden" dr-strip="true">#innerHTML#</div>',
|
|
27
|
+
// styles: '',
|
|
28
|
+
// selector: `${selector}.UnChecked`
|
|
29
|
+
// })
|
|
30
|
+
class UnChecked extends CheckBoxBase {
|
|
31
|
+
constructor() {
|
|
32
|
+
super({ onlyParentType: CheckBox });
|
|
33
|
+
this.name = 'unChecked';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
CheckBox_1.UnChecked = UnChecked;
|
|
37
|
+
// @Component({
|
|
38
|
+
// template: template,
|
|
39
|
+
// styles: style,
|
|
40
|
+
// selector: `${selector}`
|
|
41
|
+
// })
|
|
42
|
+
class CheckBox extends ComponentBase {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
this.checked = false;
|
|
46
|
+
}
|
|
47
|
+
change(option, checked = this.checked) {
|
|
48
|
+
var _a;
|
|
49
|
+
this.checked = checked;
|
|
50
|
+
this.setChildrenHidden(checked);
|
|
51
|
+
(_a = this.getAttribute('change')) === null || _a === void 0 ? void 0 : _a(checked, option);
|
|
52
|
+
}
|
|
53
|
+
setChildrenHidden(checked) {
|
|
54
|
+
this.getChildren(Checked).forEach(it => {
|
|
55
|
+
it.hidden = !checked;
|
|
56
|
+
});
|
|
57
|
+
this.getChildren(UnChecked).forEach(it => {
|
|
58
|
+
it.hidden = checked;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
onCreatedThisChild(child, childData) {
|
|
62
|
+
super.onCreatedThisChild(child, childData);
|
|
63
|
+
this.setChildrenHidden(this.checked);
|
|
64
|
+
}
|
|
65
|
+
onInitInputElement(element) {
|
|
66
|
+
// console.log('---cr', element)
|
|
67
|
+
this.inputElement = element;
|
|
68
|
+
this.inputElement.checked = !!this.getAttribute('checked');
|
|
69
|
+
this.change({ type: 'initialize' }, !!this.getAttribute('checked'));
|
|
70
|
+
}
|
|
71
|
+
onChangeAttrRender(name, val, other) {
|
|
72
|
+
super.onChangeAttrRender(name, val, other);
|
|
73
|
+
// console.log('Checkbox ChangeAttr------', name, val, this.inputElement)
|
|
74
|
+
if (this.inputElement && this.getAttribute('checked') !== this.checked) {
|
|
75
|
+
this.inputElement.checked = !!this.getAttribute('checked');
|
|
76
|
+
this.change({ type: 'attributeChange' }, !!this.getAttribute('checked'));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
CheckBox_1.CheckBox = CheckBox;
|
|
81
|
+
})(CheckBox || (CheckBox = {}));
|
|
82
|
+
export default {
|
|
83
|
+
checkBoxChecked: (config) => {
|
|
84
|
+
return RawSet.createComponentTargetElement({
|
|
85
|
+
name: `${CheckBox.selector}-checked`,
|
|
86
|
+
template: '<div dr-if="!@this@.hidden" dr-option-strip="true">#innerHTML#</div>',
|
|
87
|
+
objFactory: (e, o, r2, counstructorParam) => {
|
|
88
|
+
return DomRender.run({ rootObject: new CheckBox.Checked(), config: config });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
checkBoxUnchecked: (config) => {
|
|
93
|
+
return RawSet.createComponentTargetElement({
|
|
94
|
+
name: `${CheckBox.selector}-unchecked`,
|
|
95
|
+
template: '<div dr-if="!@this@.hidden" dr-option-strip="true" >#innerHTML#</div>',
|
|
96
|
+
objFactory: (e, o, r2, counstructorParam) => {
|
|
97
|
+
return DomRender.run({ rootObject: new CheckBox.UnChecked(), config: config });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
checkBox: (config) => {
|
|
102
|
+
return RawSet.createComponentTargetElement({
|
|
103
|
+
name: `${CheckBox.selector}`,
|
|
104
|
+
template: '<label class="${@this@.getAttribute(\'class\')}$">\n' +
|
|
105
|
+
' <input\n' +
|
|
106
|
+
' name="${@this@.getAttribute(\'name\')}$"\n' +
|
|
107
|
+
' dr-on-init="@this@.onInitInputElement($element)"\n' +
|
|
108
|
+
' dr-event-change="@this@.change({type: \'event\'},$element.checked);"\n' +
|
|
109
|
+
' type="checkbox" hidden="hidden"/>\n' +
|
|
110
|
+
' #innerHTML#\n' +
|
|
111
|
+
'</label>',
|
|
112
|
+
objFactory: (e, o, r2, counstructorParam) => {
|
|
113
|
+
return DomRender.run({ rootObject: new CheckBox.CheckBox(...counstructorParam), config: config });
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=CheckBox.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComponentBase } from '../ComponentBase';
|
|
2
|
+
import { RunConfig } from '../../DomRender';
|
|
3
|
+
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
4
|
+
import { OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';
|
|
5
|
+
export declare namespace Choose {
|
|
6
|
+
export const selector = "dr-choose";
|
|
7
|
+
export type Attribute<D> = {
|
|
8
|
+
data: D;
|
|
9
|
+
};
|
|
10
|
+
export type WhenAttribute<D> = {
|
|
11
|
+
test: (data?: D | null) => boolean;
|
|
12
|
+
};
|
|
13
|
+
class ChildOtherWiseBase<A> extends ComponentBase<A> {
|
|
14
|
+
hidden: boolean;
|
|
15
|
+
}
|
|
16
|
+
class ChildBase<D> extends ChildOtherWiseBase<WhenAttribute<D>> {
|
|
17
|
+
data?: D;
|
|
18
|
+
}
|
|
19
|
+
export class When<D> extends ChildBase<D> {
|
|
20
|
+
constructor();
|
|
21
|
+
}
|
|
22
|
+
export class OtherWise<D> extends ChildBase<D> {
|
|
23
|
+
constructor();
|
|
24
|
+
}
|
|
25
|
+
export class Choose<D> extends ComponentBase<Attribute<D>> {
|
|
26
|
+
private choose?;
|
|
27
|
+
onCreatedThisChild(child: any, data: OnCreateRenderDataParams): void;
|
|
28
|
+
onChangeAttrRender(name: string, value: any, other: OtherData): void;
|
|
29
|
+
private setChange;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
}
|
|
33
|
+
declare const _default: {
|
|
34
|
+
chooseWhen: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
35
|
+
chooseOtherWise: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
36
|
+
choose: (config?: RunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
|
39
|
+
//# sourceMappingURL=Choose.d.ts.map
|