@dooboostore/dom-render 1.0.100 → 1.0.103
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 +21 -6
- package/DomRender.js +54 -23
- package/DomRenderProxy.d.ts +7 -3
- package/DomRenderProxy.js +120 -49
- package/README.MD +469 -112
- package/components/ComponentBase.d.ts +12 -10
- package/components/ComponentBase.js +92 -46
- package/components/ComponentSet.d.ts +2 -2
- package/components/appender/Appender.d.ts +2 -2
- package/components/checkbox/CheckBox.d.ts +4 -4
- package/components/choose/Choose.d.ts +4 -4
- package/components/choose/Choose.js +0 -16
- package/components/details/Details.d.ts +5 -5
- package/components/forOf/ForOf.d.ts +2 -2
- package/components/if/If.d.ts +2 -2
- package/components/index.d.ts +26 -24
- package/components/index.js +2 -1
- package/components/input/Input.d.ts +2 -2
- package/components/input/Input.js +27 -24
- package/components/promise/PromiseSwitch.d.ts +6 -6
- package/components/promise/PromiseSwitch.js +15 -0
- package/components/radio/Radio.d.ts +4 -4
- package/components/router/Route.d.ts +32 -0
- package/components/router/Route.js +116 -0
- package/components/select/Select.d.ts +3 -3
- package/components/select/Select.js +2 -2
- package/components/this/This.d.ts +9 -2
- package/components/this/This.js +24 -2
- package/components/timer/Timer.d.ts +2 -2
- package/configs/Config.d.ts +6 -1
- package/decorators/DomRenderNoProxy.d.ts +2 -0
- package/decorators/DomRenderNoProxy.js +15 -0
- package/dist/bundle.js +2 -0
- package/events/EventManager.d.ts +16 -4
- package/events/EventManager.js +320 -140
- package/index.d.ts +48 -1
- package/index.js +40 -0
- package/lifecycle/OnDestroyRender.d.ts +1 -1
- package/lifecycle/OnProxyDomRender.d.ts +1 -0
- package/lifecycle/OnProxyDomRender.js +1 -1
- package/operators/DrForOf.js +2 -1
- package/operators/DrIf.js +3 -2
- package/operators/DrTargetElement.js +2 -1
- package/operators/DrTargetElementIsElement.d.ts +0 -5
- package/operators/DrTargetElementIsElement.js +2 -1
- package/operators/DrThis.js +40 -11
- package/operators/OperatorExecuter.js +3 -1
- package/package.json +5 -4
- package/rawsets/Attrs.d.ts +2 -0
- package/rawsets/RawSet.d.ts +2 -2
- package/rawsets/RawSet.js +48 -33
- package/routers/HashRouter.d.ts +5 -4
- package/routers/HashRouter.js +8 -5
- package/routers/PathRouter.d.ts +5 -4
- package/routers/PathRouter.js +6 -4
- package/routers/Router.d.ts +22 -8
- package/routers/Router.js +44 -24
|
@@ -8,27 +8,31 @@ import { OnInitRender } from '../lifecycle/OnInitRender';
|
|
|
8
8
|
import { OnDestroyRender, OnDestroyRenderParams } from '../lifecycle/OnDestroyRender';
|
|
9
9
|
import { OnDrThisUnBind } from '../lifecycle/dr-this/OnDrThisUnBind';
|
|
10
10
|
import { OnDrThisBind } from '../lifecycle/dr-this/OnDrThisBind';
|
|
11
|
-
import
|
|
11
|
+
import type { Render } from '../rawsets/Render';
|
|
12
12
|
export declare const ATTRIBUTE_METADATA_KEY: unique symbol;
|
|
13
13
|
export declare const QUERY_METADATA_KEY: unique symbol;
|
|
14
14
|
export declare const EVENT_METADATA_KEY: unique symbol;
|
|
15
15
|
export declare function attribute(options?: {
|
|
16
16
|
name?: string;
|
|
17
17
|
converter?: (value: string | null) => any;
|
|
18
|
-
}):
|
|
19
|
-
export declare function query(selector: string):
|
|
18
|
+
}): (target: object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => void;
|
|
19
|
+
export declare function query(selector: string): (target: object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => void;
|
|
20
20
|
export declare function event(options: {
|
|
21
21
|
query: string;
|
|
22
22
|
name: string;
|
|
23
23
|
}): MethodDecorator;
|
|
24
|
-
export
|
|
25
|
-
|
|
24
|
+
export type ComponentBaseConfig = {
|
|
25
|
+
onlyParentType?: ConstructorType<any>[] | ConstructorType<any>;
|
|
26
|
+
};
|
|
27
|
+
export declare class ComponentBase<T = any, C extends ComponentBaseConfig = ComponentBaseConfig> implements OnChangeAttrRender, OnCreateRenderData, OnCreatedThisChild, OnDrThisBind, OnDrThisUnBind, OnInitRender, OnDestroyRender {
|
|
28
|
+
private _config?;
|
|
26
29
|
private _rawSet?;
|
|
27
30
|
private _children;
|
|
28
31
|
private _render;
|
|
29
32
|
private _attribute?;
|
|
30
33
|
private _boundEventListeners;
|
|
31
|
-
get
|
|
34
|
+
get componentConfig(): C;
|
|
35
|
+
get render(): Render | undefined;
|
|
32
36
|
get rawSet(): RawSet | undefined;
|
|
33
37
|
private _queryElements;
|
|
34
38
|
private _cleanupEventListeners;
|
|
@@ -42,9 +46,7 @@ export declare abstract class ComponentBase<T> implements OnChangeAttrRender, On
|
|
|
42
46
|
getParentThis<P>(): P;
|
|
43
47
|
getChildren<C extends ConstructorType<any>>(type: C): InstanceType<C>[];
|
|
44
48
|
getChildren<C extends ConstructorType<any>[]>(types: C): InstanceType<C[number]>[];
|
|
45
|
-
constructor(
|
|
46
|
-
onlyParentType: ConstructorType<any>[] | ConstructorType<any>;
|
|
47
|
-
});
|
|
49
|
+
constructor(_config?: C);
|
|
48
50
|
private setRawSet;
|
|
49
51
|
setAttribute(attribute: T): void;
|
|
50
52
|
onCreatedThisChild(child: any, data: OnCreateRenderDataParams): void;
|
|
@@ -53,6 +55,6 @@ export declare abstract class ComponentBase<T> implements OnChangeAttrRender, On
|
|
|
53
55
|
onInitRender(param: any, rawSet: RawSet): void;
|
|
54
56
|
onDrThisBind(): void;
|
|
55
57
|
onDrThisUnBind(): void;
|
|
56
|
-
onDestroyRender(data
|
|
58
|
+
onDestroyRender(data?: OnDestroyRenderParams): void;
|
|
57
59
|
}
|
|
58
60
|
//# sourceMappingURL=ComponentBase.d.ts.map
|
|
@@ -8,64 +8,79 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import 'reflect-metadata';
|
|
11
|
+
import { ElementUtils } from '@dooboostore/core-web/element/ElementUtils';
|
|
11
12
|
import { RawSet } from '../rawsets/RawSet';
|
|
12
13
|
import { DomRenderNoProxy } from '../decorators/DomRenderNoProxy';
|
|
13
14
|
import { ConvertUtils } from '@dooboostore/core/convert/ConvertUtils';
|
|
14
|
-
import
|
|
15
|
+
import { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';
|
|
15
16
|
export const ATTRIBUTE_METADATA_KEY = Symbol('attribute');
|
|
16
17
|
export const QUERY_METADATA_KEY = Symbol('query');
|
|
17
18
|
export const EVENT_METADATA_KEY = Symbol('event');
|
|
18
19
|
export function attribute(options) {
|
|
19
|
-
return (target, propertyKey) => {
|
|
20
|
-
|
|
20
|
+
return (target, propertyKey, descriptor) => {
|
|
21
|
+
const attributes = ReflectUtils.getMetadata(ATTRIBUTE_METADATA_KEY, target.constructor) || [];
|
|
22
|
+
attributes.push({
|
|
23
|
+
propertyKey: propertyKey,
|
|
24
|
+
name: (options === null || options === void 0 ? void 0 : options.name) || propertyKey,
|
|
25
|
+
converter: options === null || options === void 0 ? void 0 : options.converter,
|
|
26
|
+
isMethod: !!descriptor
|
|
27
|
+
});
|
|
28
|
+
ReflectUtils.defineMetadata(ATTRIBUTE_METADATA_KEY, attributes, target.constructor);
|
|
21
29
|
};
|
|
22
30
|
}
|
|
23
31
|
export function query(selector) {
|
|
24
|
-
return (target, propertyKey) => {
|
|
25
|
-
|
|
32
|
+
return (target, propertyKey, descriptor) => {
|
|
33
|
+
const queries = ReflectUtils.getMetadata(QUERY_METADATA_KEY, target.constructor) || [];
|
|
34
|
+
queries.push({
|
|
35
|
+
selector: selector,
|
|
36
|
+
propertyKey: propertyKey,
|
|
37
|
+
isMethod: !!descriptor
|
|
38
|
+
});
|
|
39
|
+
ReflectUtils.defineMetadata(QUERY_METADATA_KEY, queries, target.constructor);
|
|
26
40
|
};
|
|
27
41
|
}
|
|
28
42
|
export function event(options) {
|
|
29
43
|
return (target, propertyKey, descriptor) => {
|
|
30
|
-
const events =
|
|
44
|
+
const events = ReflectUtils.getMetadata(EVENT_METADATA_KEY, target.constructor) || [];
|
|
31
45
|
events.push({
|
|
32
46
|
query: options.query,
|
|
33
47
|
eventName: options.name,
|
|
34
48
|
methodName: propertyKey
|
|
35
49
|
});
|
|
36
|
-
|
|
50
|
+
ReflectUtils.defineMetadata(EVENT_METADATA_KEY, events, target.constructor);
|
|
37
51
|
};
|
|
38
52
|
}
|
|
39
53
|
export class ComponentBase {
|
|
54
|
+
get componentConfig() {
|
|
55
|
+
return this._config;
|
|
56
|
+
}
|
|
40
57
|
get render() {
|
|
41
58
|
return this._render;
|
|
42
59
|
}
|
|
43
60
|
get rawSet() {
|
|
44
61
|
return this._rawSet;
|
|
45
62
|
}
|
|
46
|
-
_queryElements(selector) {
|
|
63
|
+
_queryElements(selector, rawSet) {
|
|
47
64
|
var _a, _b, _c, _d;
|
|
48
65
|
const e = this.getElement();
|
|
66
|
+
// console.log('queryElement-->', e);
|
|
49
67
|
if (e) {
|
|
50
|
-
return
|
|
68
|
+
return ElementUtils.querySelectorAll(e, selector);
|
|
51
69
|
}
|
|
52
70
|
else {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
currentNode = currentNode.nextSibling;
|
|
67
|
-
}
|
|
68
|
-
return elements;
|
|
71
|
+
let startNode = (_a = rawSet.point) === null || _a === void 0 ? void 0 : _a.start;
|
|
72
|
+
let endNode = (_b = rawSet.point) === null || _b === void 0 ? void 0 : _b.end;
|
|
73
|
+
// console.log('-----', startNode, endNode)
|
|
74
|
+
// console.log('-----', startNode?.isConnected, endNode?.isConnected)
|
|
75
|
+
if (((_c = rawSet.point) === null || _c === void 0 ? void 0 : _c.start) && startNode && !startNode.isConnected && startNode instanceof HTMLElement && startNode.hasAttribute('id')) {
|
|
76
|
+
rawSet.point.start = startNode = rawSet.dataSet.config.window.document.querySelector('#' + startNode.id);
|
|
77
|
+
}
|
|
78
|
+
if (((_d = rawSet.point) === null || _d === void 0 ? void 0 : _d.end) && endNode && !endNode.isConnected && endNode instanceof HTMLElement && endNode.hasAttribute('id')) {
|
|
79
|
+
rawSet.point.end = endNode = rawSet.dataSet.config.window.document.querySelector('#' + endNode.id);
|
|
80
|
+
}
|
|
81
|
+
if (startNode && endNode) {
|
|
82
|
+
// console.log('query!!', startNode, endNode);
|
|
83
|
+
return ElementUtils.querySelectorAll({ start: startNode, end: endNode }, selector);
|
|
69
84
|
}
|
|
70
85
|
}
|
|
71
86
|
return [];
|
|
@@ -136,8 +151,8 @@ export class ComponentBase {
|
|
|
136
151
|
const targets = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
|
|
137
152
|
return this._children.filter(child => targets.some(targetConstructor => child instanceof targetConstructor));
|
|
138
153
|
}
|
|
139
|
-
constructor(
|
|
140
|
-
this.
|
|
154
|
+
constructor(_config) {
|
|
155
|
+
this._config = _config;
|
|
141
156
|
this._children = [];
|
|
142
157
|
this._boundEventListeners = [];
|
|
143
158
|
}
|
|
@@ -160,10 +175,10 @@ export class ComponentBase {
|
|
|
160
175
|
if ((_a = data.render) === null || _a === void 0 ? void 0 : _a.rawSet) {
|
|
161
176
|
this.setRawSet(data.render.rawSet);
|
|
162
177
|
}
|
|
163
|
-
if ((_b = this.
|
|
164
|
-
const isOk = Array.isArray((_c = this.
|
|
178
|
+
if ((_b = this._config) === null || _b === void 0 ? void 0 : _b.onlyParentType) {
|
|
179
|
+
const isOk = Array.isArray((_c = this._config) === null || _c === void 0 ? void 0 : _c.onlyParentType) ? (_d = this._config) === null || _d === void 0 ? void 0 : _d.onlyParentType : [(_e = this._config) === null || _e === void 0 ? void 0 : _e.onlyParentType].some(it => { var _a; return ((_a = data.render) === null || _a === void 0 ? void 0 : _a.parentThis) instanceof it; });
|
|
165
180
|
if (!isOk) {
|
|
166
|
-
throw new Error('only my parentThis ' + ((_f = this.
|
|
181
|
+
throw new Error('only my parentThis ' + ((_f = this._config) === null || _f === void 0 ? void 0 : _f.onlyParentType));
|
|
167
182
|
}
|
|
168
183
|
}
|
|
169
184
|
}
|
|
@@ -171,17 +186,29 @@ export class ComponentBase {
|
|
|
171
186
|
if (other.rawSet) {
|
|
172
187
|
this.setRawSet(other.rawSet);
|
|
173
188
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (this.equalsAttributeName(name,
|
|
178
|
-
const finalValue =
|
|
179
|
-
|
|
189
|
+
const attributes = ReflectUtils.getMetadata(ATTRIBUTE_METADATA_KEY, this.constructor);
|
|
190
|
+
if (attributes && Array.isArray(attributes)) {
|
|
191
|
+
for (const attrInfo of attributes) {
|
|
192
|
+
if (this.equalsAttributeName(name, attrInfo.name)) {
|
|
193
|
+
const finalValue = attrInfo.converter ? attrInfo.converter(value) : value;
|
|
194
|
+
if (attrInfo.isMethod) {
|
|
195
|
+
const method = this[attrInfo.propertyKey];
|
|
196
|
+
if (typeof method === 'function') {
|
|
197
|
+
method.call(this, finalValue);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this[attrInfo.propertyKey] = finalValue;
|
|
202
|
+
}
|
|
180
203
|
}
|
|
181
204
|
}
|
|
182
205
|
}
|
|
183
206
|
}
|
|
184
207
|
onInitRender(param, rawSet) {
|
|
208
|
+
// console.log('onInitRender!!',param, rawSet);
|
|
209
|
+
// console.dir(rawSet, {depth: 33})
|
|
210
|
+
// console.table(rawSet);
|
|
211
|
+
// console.log('--------', rawSet.point)
|
|
185
212
|
if (rawSet) {
|
|
186
213
|
this.setRawSet(rawSet);
|
|
187
214
|
const e = this.getElement();
|
|
@@ -189,24 +216,43 @@ export class ComponentBase {
|
|
|
189
216
|
e.component = this;
|
|
190
217
|
}
|
|
191
218
|
// Handle @query decorators
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
219
|
+
const queries = ReflectUtils.getMetadata(QUERY_METADATA_KEY, this.constructor);
|
|
220
|
+
// console.log('queries', queries)
|
|
221
|
+
if (queries && Array.isArray(queries)) {
|
|
222
|
+
for (const queryInfo of queries) {
|
|
223
|
+
const { selector, propertyKey, isMethod } = queryInfo;
|
|
224
|
+
const elements = this._queryElements(selector, rawSet);
|
|
225
|
+
// console.log('-------element', elements);
|
|
226
|
+
if (isMethod) {
|
|
227
|
+
const method = this[propertyKey];
|
|
228
|
+
if (typeof method === 'function') {
|
|
229
|
+
const paramTypes = ReflectUtils.getParameterTypes(this, propertyKey);
|
|
230
|
+
if (paramTypes && paramTypes.length > 0 && paramTypes[0] === Array) {
|
|
231
|
+
method.call(this, elements);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
if (elements.length > 0) {
|
|
235
|
+
method.call(this, elements[0]);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
199
239
|
}
|
|
200
240
|
else {
|
|
201
|
-
|
|
241
|
+
const propertyType = ReflectUtils.getType(this, propertyKey);
|
|
242
|
+
if (propertyType === Array) {
|
|
243
|
+
this[propertyKey] = elements;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
this[propertyKey] = elements[0] || null;
|
|
247
|
+
}
|
|
202
248
|
}
|
|
203
249
|
}
|
|
204
250
|
}
|
|
205
251
|
// Handle @event decorators
|
|
206
|
-
const events =
|
|
252
|
+
const events = ReflectUtils.getMetadata(EVENT_METADATA_KEY, this.constructor);
|
|
207
253
|
if (events && Array.isArray(events)) {
|
|
208
254
|
for (const eventInfo of events) {
|
|
209
|
-
const elements = this._queryElements(eventInfo.query);
|
|
255
|
+
const elements = this._queryElements(eventInfo.query, rawSet);
|
|
210
256
|
elements.forEach(element => {
|
|
211
257
|
const listener = this[eventInfo.methodName].bind(this);
|
|
212
258
|
element.addEventListener(eventInfo.eventName, listener);
|
|
@@ -5,8 +5,8 @@ export type ComponentSetConfig = {
|
|
|
5
5
|
export declare class ComponentSet<T = any> {
|
|
6
6
|
obj: T;
|
|
7
7
|
private _config;
|
|
8
|
-
private _template
|
|
9
|
-
private _styles
|
|
8
|
+
private _template?;
|
|
9
|
+
private _styles?;
|
|
10
10
|
constructor(obj: T, source: {
|
|
11
11
|
template?: string;
|
|
12
12
|
styles?: (string[]) | string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
|
-
import {
|
|
2
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
3
3
|
import { RawSet } from '../../rawsets/RawSet';
|
|
4
4
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
5
5
|
import { OnInitRender } from '../../lifecycle/OnInitRender';
|
|
@@ -17,7 +17,7 @@ export declare namespace Appender {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
declare const _default: {
|
|
20
|
-
appender: (config?:
|
|
20
|
+
appender: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
21
21
|
};
|
|
22
22
|
export default _default;
|
|
23
23
|
//# sourceMappingURL=Appender.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
|
-
import {
|
|
2
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
3
3
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
4
4
|
import { OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';
|
|
5
5
|
export declare namespace CheckBox {
|
|
@@ -39,9 +39,9 @@ export declare namespace CheckBox {
|
|
|
39
39
|
export {};
|
|
40
40
|
}
|
|
41
41
|
declare const _default: {
|
|
42
|
-
checkBoxChecked: (config?:
|
|
43
|
-
checkBoxUnchecked: (config?:
|
|
44
|
-
checkBox: (config?:
|
|
42
|
+
checkBoxChecked: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
43
|
+
checkBoxUnchecked: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
44
|
+
checkBox: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
45
45
|
};
|
|
46
46
|
export default _default;
|
|
47
47
|
//# sourceMappingURL=CheckBox.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
|
-
import {
|
|
2
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
3
3
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
4
4
|
import { OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';
|
|
5
5
|
export declare namespace Choose {
|
|
@@ -31,9 +31,9 @@ export declare namespace Choose {
|
|
|
31
31
|
export {};
|
|
32
32
|
}
|
|
33
33
|
declare const _default: {
|
|
34
|
-
chooseWhen: (config?:
|
|
35
|
-
chooseOtherWise: (config?:
|
|
36
|
-
choose: (config?:
|
|
34
|
+
chooseWhen: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
35
|
+
chooseOtherWise: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
36
|
+
choose: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
37
37
|
};
|
|
38
38
|
export default _default;
|
|
39
39
|
//# sourceMappingURL=Choose.d.ts.map
|
|
@@ -12,30 +12,18 @@ export var Choose;
|
|
|
12
12
|
}
|
|
13
13
|
class ChildBase extends ChildOtherWiseBase {
|
|
14
14
|
}
|
|
15
|
-
// @Component({
|
|
16
|
-
// template: '<div dr-if="!@this@.hidden" dr-strip="true" >#innerHTML#</div>',
|
|
17
|
-
// selector: `${selector}.When`
|
|
18
|
-
// })
|
|
19
15
|
class When extends ChildBase {
|
|
20
16
|
constructor() {
|
|
21
17
|
super({ onlyParentType: (Choose) });
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
Choose_1.When = When;
|
|
25
|
-
// @Component({
|
|
26
|
-
// template: '<div dr-if="!@this@.hidden" dr-strip="true" >#innerHTML#</div>',
|
|
27
|
-
// selector: `${selector}.OtherWise`
|
|
28
|
-
// })
|
|
29
21
|
class OtherWise extends ChildBase {
|
|
30
22
|
constructor() {
|
|
31
23
|
super({ onlyParentType: (Choose) });
|
|
32
24
|
}
|
|
33
25
|
}
|
|
34
26
|
Choose_1.OtherWise = OtherWise;
|
|
35
|
-
// @Component({
|
|
36
|
-
// template: '#innerHTML#',
|
|
37
|
-
// selector: `${selector}`
|
|
38
|
-
// })
|
|
39
27
|
class Choose extends ComponentBase {
|
|
40
28
|
onCreatedThisChild(child, data) {
|
|
41
29
|
super.onCreatedThisChild(child, data);
|
|
@@ -43,10 +31,6 @@ export var Choose;
|
|
|
43
31
|
}
|
|
44
32
|
onChangeAttrRender(name, value, other) {
|
|
45
33
|
super.onChangeAttrRender(name, value, other);
|
|
46
|
-
// console.log('-----------changer Choose', name, value);
|
|
47
|
-
// this.getChildren(Pending).forEach(it => {
|
|
48
|
-
// console.log('------------asdasd', it, it.attribute?.defaultView)
|
|
49
|
-
// })
|
|
50
34
|
if (this.equalsAttributeName(name, 'data')) {
|
|
51
35
|
this.choose = undefined;
|
|
52
36
|
const children = this.getChildren([When, OtherWise]).sort((a, b) => (a instanceof OtherWise ? 1 : 0) - (b instanceof OtherWise ? 1 : 0));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
|
-
import {
|
|
2
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
3
3
|
import { RawSet } from '../../rawsets/RawSet';
|
|
4
4
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
5
5
|
import { OnInitRender } from '../../lifecycle/OnInitRender';
|
|
@@ -48,10 +48,10 @@ export declare namespace Details {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
declare const _default: {
|
|
51
|
-
detailsSummary: (config?:
|
|
52
|
-
detailsBody: (config?:
|
|
53
|
-
detailsForm: (config?:
|
|
54
|
-
details: (config?:
|
|
51
|
+
detailsSummary: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
52
|
+
detailsBody: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
53
|
+
detailsForm: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
54
|
+
details: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
55
55
|
};
|
|
56
56
|
export default _default;
|
|
57
57
|
//# sourceMappingURL=Details.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
|
-
import {
|
|
2
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
3
3
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
4
4
|
export declare namespace ForOf {
|
|
5
5
|
const selector = "System:ForOf";
|
|
@@ -12,7 +12,7 @@ export declare namespace ForOf {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
declare const _default: {
|
|
15
|
-
forOf: (config?:
|
|
15
|
+
forOf: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
16
16
|
};
|
|
17
17
|
export default _default;
|
|
18
18
|
//# sourceMappingURL=ForOf.d.ts.map
|
package/components/if/If.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
2
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
3
|
-
import {
|
|
3
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
4
4
|
import { OnInitRender } from '../../lifecycle/OnInitRender';
|
|
5
5
|
import { RawSet } from '../../rawsets/RawSet';
|
|
6
6
|
export declare namespace If {
|
|
@@ -15,7 +15,7 @@ export declare namespace If {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
declare const _default: {
|
|
18
|
-
if: (config?:
|
|
18
|
+
if: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
19
19
|
};
|
|
20
20
|
export default _default;
|
|
21
21
|
//# sourceMappingURL=If.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
export declare const drComponent: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
match: (config?: import("..").Config) => import("../configs/TargetElement").TargetElement;
|
|
3
|
+
regexp: (config?: import("..").Config) => import("../configs/TargetElement").TargetElement;
|
|
4
|
+
input: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
5
|
+
detailsSummary: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
6
|
+
detailsBody: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
7
|
+
detailsForm: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
8
|
+
details: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
9
|
+
choose: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
10
|
+
selectOption: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
11
|
+
select: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
12
|
+
radioChecked: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
13
|
+
radioUnChecked: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
14
|
+
radio: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
15
|
+
checkBoxChecked: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
16
|
+
checkBoxUnchecked: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
17
|
+
checkBox: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
18
|
+
chooseWhen: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
19
|
+
chooseOtherWise: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
20
|
+
promiseDefault: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
21
|
+
promisePending: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
22
|
+
promiseFulfilled: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
23
|
+
promiseRejected: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
24
|
+
promiseSwitch: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
25
|
+
appender: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
26
|
+
this: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
27
|
+
if: (config?: import("..").DomRenderRunConfig) => import("../configs/TargetElement").TargetElement;
|
|
26
28
|
};
|
|
27
29
|
//# sourceMappingURL=index.d.ts.map
|
package/components/index.js
CHANGED
|
@@ -9,5 +9,6 @@ import Select from './select/Select';
|
|
|
9
9
|
import Timer from './timer/Timer';
|
|
10
10
|
import Details from './details/Details';
|
|
11
11
|
import Input from './input/Input';
|
|
12
|
-
|
|
12
|
+
import Route from './router/Route';
|
|
13
|
+
export const drComponent = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, If), This), Appender), PromiseSwitch), Choose), CheckBox), Radio), Select), Timer), Details), Input), Route);
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentBase } from '../ComponentBase';
|
|
2
|
-
import {
|
|
2
|
+
import { DomRenderRunConfig } from '../../DomRender';
|
|
3
3
|
import { RawSet } from '../../rawsets/RawSet';
|
|
4
4
|
import { OtherData } from '../../lifecycle/OnChangeAttrRender';
|
|
5
5
|
import { OnCreateRender } from '../../lifecycle/OnCreateRender';
|
|
@@ -28,7 +28,7 @@ export declare namespace Input {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
declare const _default: {
|
|
31
|
-
input: (config?:
|
|
31
|
+
input: (config?: DomRenderRunConfig) => import("../../configs/TargetElement").TargetElement;
|
|
32
32
|
};
|
|
33
33
|
export default _default;
|
|
34
34
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -22,37 +22,40 @@ export var Input;
|
|
|
22
22
|
}
|
|
23
23
|
onInitRender(param, rawSet) {
|
|
24
24
|
super.onInitRender(param, rawSet);
|
|
25
|
+
// console.log('dr-input, rawSet', rawSet)
|
|
25
26
|
const inputElement = this.element;
|
|
26
27
|
const debounceTimeAttribute = this.getAttribute('debounceTime');
|
|
27
28
|
const debounceTimeValue = ValidUtils.isNotNullUndefined(debounceTimeAttribute) ? Number(debounceTimeAttribute) : 0;
|
|
28
29
|
const distinct = ValidUtils.isNotNullUndefined(this.getAttribute('distinct'));
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// console.log('change?????????????', it);
|
|
43
|
-
(_a = this.getAttribute('input')) === null || _a === void 0 ? void 0 : _a(it, inputElement);
|
|
44
|
-
});
|
|
45
|
-
if (inputElement && inputElement.form) {
|
|
46
|
-
this.resetSubscripton = EventUtils.htmlElementEventObservable(inputElement.form, 'reset').subscribe(it => {
|
|
30
|
+
if (inputElement) {
|
|
31
|
+
const makeDeboundceDistinctUtilChanged = () => {
|
|
32
|
+
// let result$ = EventUtils.htmlElementEventObservable(inputElement,'input');
|
|
33
|
+
let result$ = EventUtils.htmlElementEventObservable(inputElement, 'input').pipe(map(event => event.target.value.trim()));
|
|
34
|
+
if (ValidUtils.isNotNullUndefined(debounceTimeValue) && debounceTimeValue > 0) {
|
|
35
|
+
result$ = result$.pipe(debounceTime(debounceTimeValue));
|
|
36
|
+
}
|
|
37
|
+
if (ValidUtils.isNotNullUndefined(distinct) && distinct === true) {
|
|
38
|
+
result$ = result$.pipe(distinctUntilChanged());
|
|
39
|
+
}
|
|
40
|
+
return result$;
|
|
41
|
+
};
|
|
42
|
+
this.inputSubscription = makeDeboundceDistinctUtilChanged().subscribe(it => {
|
|
47
43
|
var _a;
|
|
48
|
-
// console.log('
|
|
49
|
-
(_a = this.
|
|
50
|
-
|
|
44
|
+
// console.log('change?????????????', it);
|
|
45
|
+
(_a = this.getAttribute('input')) === null || _a === void 0 ? void 0 : _a(it, inputElement);
|
|
46
|
+
});
|
|
47
|
+
if (inputElement.form) {
|
|
48
|
+
this.resetSubscripton = EventUtils.htmlElementEventObservable(inputElement.form, 'reset').subscribe(it => {
|
|
51
49
|
var _a;
|
|
52
|
-
// console.log('
|
|
53
|
-
(_a = this.
|
|
50
|
+
// console.log('rrrraaa?,', this.inputSubscription, it)
|
|
51
|
+
(_a = this.inputSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
52
|
+
this.inputSubscription = makeDeboundceDistinctUtilChanged().subscribe(it => {
|
|
53
|
+
var _a;
|
|
54
|
+
// console.log('rrrr?')
|
|
55
|
+
(_a = this.getAttribute('input')) === null || _a === void 0 ? void 0 : _a(it, inputElement);
|
|
56
|
+
});
|
|
54
57
|
});
|
|
55
|
-
}
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
onChangeAttrRender(name, value, other) {
|