@rugal.tu/vuemodel3 1.5.8 → 1.5.9
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/package.json +1 -1
- package/src/VueModel.d.ts +8 -6
- package/src/VueModel.ts +36 -15
- package/dist/VueModel.esm.js +0 -1963
- package/dist/VueModel.esm.min.js +0 -2
- package/dist/VueModel.esm.min.js.map +0 -7
- package/dist/VueModel.umd.js +0 -1984
- package/dist/VueModel.umd.min.js +0 -2
- package/dist/VueModel.umd.min.js.map +0 -7
- package/src/esm/VueModel.js +0 -1963
- package/src/esm/VueModel.js.map +0 -1
- package/src/umd/VueModel.js +0 -1984
- package/src/umd/VueModel.js.map +0 -1
package/package.json
CHANGED
package/src/VueModel.d.ts
CHANGED
|
@@ -297,14 +297,13 @@ type CommandOption = {
|
|
|
297
297
|
FuncAction?: boolean;
|
|
298
298
|
FuncArgs?: PathType;
|
|
299
299
|
};
|
|
300
|
-
type
|
|
301
|
-
CallBack: WatchCallback;
|
|
302
|
-
Option?: WatchOptions;
|
|
303
|
-
};
|
|
300
|
+
type AddCommandOption = PathType | Function | CommandOption;
|
|
304
301
|
export type TreeSetType = {
|
|
305
302
|
'using'?: UsingFunctionType;
|
|
306
303
|
'store'?: any;
|
|
307
304
|
[DomName: `:${string}`]: UsingFunctionType | TreeSetType;
|
|
305
|
+
[TagName: `@${string}`]: UsingFunctionType | TreeSetType;
|
|
306
|
+
[TagName: `tag:${string}`]: UsingFunctionType | TreeSetType;
|
|
308
307
|
'watch'?: WatchCallback | TreeWatchOption;
|
|
309
308
|
[WatchTargetCmd: `watch:${string}`]: WatchCallback | TreeWatchOption;
|
|
310
309
|
'func'?: Function;
|
|
@@ -347,7 +346,6 @@ type TreeSetFuncOption = {
|
|
|
347
346
|
TargetFunc: PathType | Function;
|
|
348
347
|
Args?: PathType;
|
|
349
348
|
};
|
|
350
|
-
type AddCommandOption = PathType | Function | CommandOption;
|
|
351
349
|
type TreeSetInfo = {
|
|
352
350
|
Nodes?: QueryNode[];
|
|
353
351
|
TreePaths: string[];
|
|
@@ -363,6 +361,10 @@ type TreeSetInfoOption = {
|
|
|
363
361
|
TargetDom: PathType | QueryNode[];
|
|
364
362
|
TargetValue: PathType | Function | CommandOption;
|
|
365
363
|
};
|
|
364
|
+
type TreeWatchOption = {
|
|
365
|
+
CallBack: WatchCallback;
|
|
366
|
+
Option?: WatchOptions;
|
|
367
|
+
};
|
|
366
368
|
type AddV_ModelOption = {
|
|
367
369
|
ModelValue?: string;
|
|
368
370
|
DefaultValue?: any;
|
|
@@ -414,7 +416,7 @@ export declare class VueCommand extends VueStore {
|
|
|
414
416
|
protected $AddCommand(DomName: PathType | QueryNode[], Command: string, Option: CommandOption): void;
|
|
415
417
|
protected $SetAttribute(Dom: HTMLElement, AttrName: string, AttrValue: string): void;
|
|
416
418
|
protected $RandomFuncName(BaseFuncName: string): string;
|
|
417
|
-
protected $GenerateEventFunction(
|
|
419
|
+
protected $GenerateEventFunction(domName: PathType, eventFunc: Function, command: string): string;
|
|
418
420
|
}
|
|
419
421
|
export declare class VueModel extends VueCommand {
|
|
420
422
|
$NativeWarn: (...Message: any[]) => void;
|
package/src/VueModel.ts
CHANGED
|
@@ -257,6 +257,7 @@ export class QueryNode extends FuncBase {
|
|
|
257
257
|
DomName: string = null;
|
|
258
258
|
Parent: QueryNode = null;
|
|
259
259
|
Children: QueryNode[] = [];
|
|
260
|
+
//DomChildren:
|
|
260
261
|
ElementDeep: number = 0;
|
|
261
262
|
NodeDeep: number = 0;
|
|
262
263
|
constructor(Dom: HTMLElement) {
|
|
@@ -266,9 +267,11 @@ export class QueryNode extends FuncBase {
|
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
public Query(DomName: PathType, Option?: QueryOption): QueryNode[] {
|
|
270
|
+
Option ??= { Mode: 'Multi' };
|
|
269
271
|
return this.$RCS_QueryChildrens(this, DomName, Option);
|
|
270
272
|
}
|
|
271
273
|
public QueryCss(Selector: string, Option?: QueryOption): QueryNode[] {
|
|
274
|
+
Option ??= { Mode: 'Multi' };
|
|
272
275
|
return this.$RCS_QueryCssChildrens(this, Selector, Option);
|
|
273
276
|
}
|
|
274
277
|
public Selector(Selector: string) {
|
|
@@ -289,7 +292,22 @@ export class QueryNode extends FuncBase {
|
|
|
289
292
|
for (let NodeItem of TargetNode.Children) {
|
|
290
293
|
if (Array.isArray(DomName)) {
|
|
291
294
|
let Names: PathType = [...DomName];
|
|
292
|
-
let FirstName = Names.shift();
|
|
295
|
+
let FirstName = Names.shift() as string;
|
|
296
|
+
|
|
297
|
+
const pathRegex = FirstName.match(/^(?<key>[^:]+):(?<name>.+)$/);
|
|
298
|
+
if (pathRegex) {
|
|
299
|
+
const key = pathRegex.groups.key;
|
|
300
|
+
const name = pathRegex.groups.name;
|
|
301
|
+
switch (key) {
|
|
302
|
+
case 'tag':
|
|
303
|
+
//TargetNode.Dom.
|
|
304
|
+
//Todo:
|
|
305
|
+
break;
|
|
306
|
+
default:
|
|
307
|
+
FirstName = name;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
293
311
|
if (NodeItem.DomName == FirstName) {
|
|
294
312
|
if (Names.length == 1)
|
|
295
313
|
Names = Names[0];
|
|
@@ -1546,14 +1564,13 @@ type CommandOption = {
|
|
|
1546
1564
|
FuncAction?: boolean;
|
|
1547
1565
|
FuncArgs?: PathType,
|
|
1548
1566
|
};
|
|
1549
|
-
type
|
|
1550
|
-
CallBack: WatchCallback,
|
|
1551
|
-
Option?: WatchOptions,
|
|
1552
|
-
}
|
|
1567
|
+
type AddCommandOption = PathType | Function | CommandOption;
|
|
1553
1568
|
export type TreeSetType = {
|
|
1554
1569
|
'using'?: UsingFunctionType,
|
|
1555
1570
|
'store'?: any,
|
|
1556
1571
|
[DomName: `:${string}`]: UsingFunctionType | TreeSetType,
|
|
1572
|
+
[TagName: `@${string}`]: UsingFunctionType | TreeSetType,
|
|
1573
|
+
[TagName: `tag:${string}`]: UsingFunctionType | TreeSetType,
|
|
1557
1574
|
|
|
1558
1575
|
'watch'?: WatchCallback | TreeWatchOption,
|
|
1559
1576
|
[WatchTargetCmd: `watch:${string}`]: WatchCallback | TreeWatchOption,
|
|
@@ -1609,8 +1626,6 @@ type TreeSetFuncOption = {
|
|
|
1609
1626
|
TargetFunc: PathType | Function,
|
|
1610
1627
|
Args?: PathType,
|
|
1611
1628
|
};
|
|
1612
|
-
type AddCommandOption = PathType | Function | CommandOption;
|
|
1613
|
-
|
|
1614
1629
|
type TreeSetInfo = {
|
|
1615
1630
|
Nodes?: QueryNode[],
|
|
1616
1631
|
TreePaths: string[],
|
|
@@ -1626,6 +1641,10 @@ type TreeSetInfoOption = {
|
|
|
1626
1641
|
TargetDom: PathType | QueryNode[],
|
|
1627
1642
|
TargetValue: PathType | Function | CommandOption,
|
|
1628
1643
|
};
|
|
1644
|
+
type TreeWatchOption = {
|
|
1645
|
+
CallBack: WatchCallback,
|
|
1646
|
+
Option?: WatchOptions,
|
|
1647
|
+
};
|
|
1629
1648
|
type AddV_ModelOption = {
|
|
1630
1649
|
ModelValue?: string,
|
|
1631
1650
|
DefaultValue?: any,
|
|
@@ -2191,14 +2210,14 @@ export class VueCommand extends VueStore {
|
|
|
2191
2210
|
if (Option.get)
|
|
2192
2211
|
return Option.get();
|
|
2193
2212
|
|
|
2194
|
-
return this.$get(PropertyKey);
|
|
2213
|
+
return (this as any).$get(PropertyKey);
|
|
2195
2214
|
},
|
|
2196
2215
|
set(Value) {
|
|
2197
2216
|
if (Option.set) {
|
|
2198
2217
|
Option.set(Value);
|
|
2199
2218
|
return;
|
|
2200
2219
|
}
|
|
2201
|
-
this.$set(PropertyKey, Value);
|
|
2220
|
+
(this as any).$set(PropertyKey, Value);
|
|
2202
2221
|
}
|
|
2203
2222
|
};
|
|
2204
2223
|
|
|
@@ -2328,12 +2347,14 @@ export class VueCommand extends VueStore {
|
|
|
2328
2347
|
protected $RandomFuncName(BaseFuncName: string) {
|
|
2329
2348
|
return `${BaseFuncName}${this.GenerateIdReplace('')}`.replace(/[-:.]/g, '_');
|
|
2330
2349
|
}
|
|
2331
|
-
protected $GenerateEventFunction(
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2350
|
+
protected $GenerateEventFunction(domName: PathType, eventFunc: Function, command: string) {
|
|
2351
|
+
const funcName = this.$RandomFuncName(`${command}_`);
|
|
2352
|
+
domName = this.Paths(domName);
|
|
2353
|
+
const fullFuncPath = ['event', ...domName, funcName]
|
|
2354
|
+
.filter(item => item != null && item != '');
|
|
2355
|
+
|
|
2356
|
+
this.AddV_Function(fullFuncPath, eventFunc);
|
|
2357
|
+
return this.ToJoin(fullFuncPath);
|
|
2337
2358
|
}
|
|
2338
2359
|
//#endregion
|
|
2339
2360
|
|