@rugal.tu/vuemodel3 1.5.1 → 1.5.3
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/dist/VueModel.esm.js +144 -89
- package/dist/VueModel.umd.js +144 -89
- package/package.json +1 -1
- package/src/VueModel.d.ts +33 -26
- package/src/VueModel.ts +185 -124
- package/src/esm/VueModel.js +144 -89
- package/src/esm/VueModel.js.map +1 -1
- package/src/umd/VueModel.js +144 -89
- package/src/umd/VueModel.js.map +1 -1
package/src/VueModel.ts
CHANGED
|
@@ -1491,47 +1491,54 @@ type CommandOption = {
|
|
|
1491
1491
|
FuncAction?: boolean;
|
|
1492
1492
|
FuncArgs?: PathType,
|
|
1493
1493
|
};
|
|
1494
|
-
|
|
1494
|
+
type TreeWatchOption = {
|
|
1495
|
+
CallBack: WatchCallback,
|
|
1496
|
+
Option?: WatchOptions,
|
|
1497
|
+
}
|
|
1495
1498
|
type TreeSetType = {
|
|
1496
|
-
'
|
|
1497
|
-
'
|
|
1498
|
-
|
|
1499
|
-
[FuncCmd: `func:${string}`]: Function,
|
|
1500
|
-
[DomName: `:${string}`]: '' | UsingFunctionType | TreeSetType,
|
|
1499
|
+
'using'?: UsingFunctionType,
|
|
1500
|
+
'store'?: any,
|
|
1501
|
+
[DomName: `:${string}`]: UsingFunctionType | TreeSetType,
|
|
1501
1502
|
|
|
1502
|
-
'
|
|
1503
|
-
[
|
|
1503
|
+
'watch'?: WatchCallback | TreeWatchOption,
|
|
1504
|
+
[WatchTargetCmd: `watch:${string}`]: WatchCallback | TreeWatchOption,
|
|
1504
1505
|
|
|
1505
|
-
'
|
|
1506
|
-
[
|
|
1507
|
-
[VSlotKeyCmd: `v-slot:${string}`]: '' | PathType | Function | TreeSetFuncOption,
|
|
1508
|
-
[VSlotKeyArgsCmd: `v-slot:${string}(${string})`]: Function | TreeSetFuncOption,
|
|
1506
|
+
'func'?: Function,
|
|
1507
|
+
[FuncNameCmd: `func:${string}`]: Function,
|
|
1509
1508
|
|
|
1510
|
-
'v-text'?: '' | PathType | Function | TreeSetFuncOption,
|
|
1509
|
+
'v-text'?: '.' | PathType | Function | TreeSetFuncOption,
|
|
1511
1510
|
[VForTextCmd: `v-text(${string})`]: Function | TreeSetFuncOption,
|
|
1512
1511
|
|
|
1513
|
-
'v-
|
|
1512
|
+
'v-model'?: '.' | PathType,
|
|
1513
|
+
[VModelArgsCmd: `v-model:${string}`]: '.' | PathType,
|
|
1514
|
+
|
|
1515
|
+
'v-for'?: '.' | PathType | Function | TreeSetFuncOption,
|
|
1514
1516
|
[VForKeyCmd: `v-for<${string}>`]: PathType | Function | TreeSetFuncOption,
|
|
1515
1517
|
[VForKeyArgsCmd: `v-for<${string}>(${string})`]: Function | TreeSetFuncOption,
|
|
1516
1518
|
[VForArgsCmd: `v-for(${string})`]: Function | TreeSetFuncOption,
|
|
1517
1519
|
[VForArgsKeyCmd: `v-for(${string})<${string}>`]: Function | TreeSetFuncOption,
|
|
1518
1520
|
|
|
1519
|
-
'v-show'?: '' | PathType | Function | TreeSetFuncOption,
|
|
1521
|
+
'v-show'?: '.' | PathType | Function | TreeSetFuncOption,
|
|
1520
1522
|
[VShowArgsCmd: `v-show(${string})`]: Function | TreeSetFuncOption,
|
|
1521
1523
|
|
|
1522
|
-
'v-if'?: '' | PathType | Function | TreeSetFuncOption,
|
|
1523
|
-
'v-else-if'?: '' | PathType | Function | TreeSetFuncOption,
|
|
1524
|
-
'v-else'?:
|
|
1524
|
+
'v-if'?: '.' | PathType | Function | TreeSetFuncOption,
|
|
1525
|
+
'v-else-if'?: '.' | PathType | Function | TreeSetFuncOption,
|
|
1526
|
+
'v-else'?: null,
|
|
1525
1527
|
[VIfArgsCmd: `v-if(${string})`]: Function | TreeSetFuncOption,
|
|
1526
1528
|
[VElseIfArgsCmd: `v-else-if(${string})`]: Function | TreeSetFuncOption,
|
|
1527
1529
|
|
|
1528
|
-
'v-
|
|
1529
|
-
[
|
|
1530
|
+
'v-slot'?: PathType | Function | TreeSetFuncOption,
|
|
1531
|
+
[VSlotArgsCmd: `v-slot(${string})`]: Function | TreeSetFuncOption,
|
|
1532
|
+
[VSlotKeyCmd: `v-slot:${string}`]: PathType | Function | TreeSetFuncOption,
|
|
1533
|
+
[VSlotKeyArgsCmd: `v-slot:${string}(${string})`]: Function | TreeSetFuncOption,
|
|
1534
|
+
|
|
1535
|
+
'v-bind'?: PathType | Function | TreeSetFuncOption,
|
|
1536
|
+
[VBindCmd: `v-bind:${string}`]: PathType | Function | TreeSetFuncOption,
|
|
1530
1537
|
[VBindArgsCmd: `v-bind:${string}(${string})`]: Function | TreeSetFuncOption,
|
|
1531
1538
|
|
|
1532
|
-
'v-on:change'?:
|
|
1533
|
-
'v-on:click'?:
|
|
1534
|
-
[VOnCmd: `v-on:${string}`]:
|
|
1539
|
+
'v-on:change'?: PathType | Function | TreeSetFuncOption,
|
|
1540
|
+
'v-on:click'?: PathType | Function | TreeSetFuncOption,
|
|
1541
|
+
[VOnCmd: `v-on:${string}`]: PathType | Function | TreeSetFuncOption,
|
|
1535
1542
|
[VOnArgsCmd: `v-on:${string}(${string})`]: Function | TreeSetFuncOption,
|
|
1536
1543
|
|
|
1537
1544
|
'v-on-mounted'?: PathType | Function | TreeSetFuncOption,
|
|
@@ -1563,7 +1570,6 @@ type TreeSetInfo = {
|
|
|
1563
1570
|
type TreeSetInfoOption = {
|
|
1564
1571
|
TargetDom: PathType | QueryNode[],
|
|
1565
1572
|
TargetValue: PathType | Function | CommandOption,
|
|
1566
|
-
TargetPath: PathType,
|
|
1567
1573
|
};
|
|
1568
1574
|
type AddV_ModelOption = {
|
|
1569
1575
|
ModelValue?: string,
|
|
@@ -1577,14 +1583,16 @@ type AddV_FilePickerOption = string | {
|
|
|
1577
1583
|
};
|
|
1578
1584
|
type AddV_TreeOption = {
|
|
1579
1585
|
UseDeepQuery?: boolean,
|
|
1580
|
-
UseTreePath?: boolean,
|
|
1581
|
-
UseDomStore?: boolean,
|
|
1582
1586
|
};
|
|
1583
1587
|
//#endregion
|
|
1584
1588
|
|
|
1585
1589
|
export class VueCommand extends VueStore {
|
|
1586
1590
|
protected $IsInited: boolean = false;
|
|
1587
|
-
protected $CommandMap: Record<string,
|
|
1591
|
+
protected $CommandMap: Record<string, {
|
|
1592
|
+
Execute: (Info: TreeSetInfo, Option: TreeSetInfoOption) => void,
|
|
1593
|
+
AcceptNull?: boolean,
|
|
1594
|
+
AcceptSelf?: boolean,
|
|
1595
|
+
}>;
|
|
1588
1596
|
$QueryDomName: string = null;
|
|
1589
1597
|
|
|
1590
1598
|
constructor() {
|
|
@@ -1609,7 +1617,7 @@ export class VueCommand extends VueStore {
|
|
|
1609
1617
|
Model.AddStore(SetOption.Target);
|
|
1610
1618
|
}
|
|
1611
1619
|
}
|
|
1612
|
-
|
|
1620
|
+
SetOption.FuncAction = true;
|
|
1613
1621
|
this.$AddCommand(DomName, 'v-text', SetOption);
|
|
1614
1622
|
return this;
|
|
1615
1623
|
}
|
|
@@ -1617,7 +1625,6 @@ export class VueCommand extends VueStore {
|
|
|
1617
1625
|
let SetOption = this.$ConvertCommandOption(StorePath);
|
|
1618
1626
|
Option ??= {};
|
|
1619
1627
|
Option.DefaultValue ??= null;
|
|
1620
|
-
|
|
1621
1628
|
SetOption.CommandKey = Option.ModelValue;
|
|
1622
1629
|
this.AddStore(StorePath, Option.DefaultValue);
|
|
1623
1630
|
this.$AddCommand(DomName, 'v-model', SetOption);
|
|
@@ -1647,16 +1654,20 @@ export class VueCommand extends VueStore {
|
|
|
1647
1654
|
let Target = Model.ToJoin(SetOption.Target);
|
|
1648
1655
|
if (!/\b(in|of)\b/.test(Target))
|
|
1649
1656
|
SetOption.TargetHead ??= '(item, index) in ';
|
|
1657
|
+
|
|
1658
|
+
SetOption.FuncAction = true;
|
|
1650
1659
|
this.$AddCommand(DomName, 'v-for', SetOption);
|
|
1651
1660
|
return this;
|
|
1652
1661
|
}
|
|
1653
1662
|
public AddV_If(DomName: PathType | QueryNode[], Option: AddCommandOption) {
|
|
1654
1663
|
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1664
|
+
SetOption.FuncAction = true;
|
|
1655
1665
|
this.$AddCommand(DomName, 'v-if', SetOption);
|
|
1656
1666
|
return this;
|
|
1657
1667
|
}
|
|
1658
1668
|
public AddV_ElseIf(DomName: PathType | QueryNode[], Option: AddCommandOption) {
|
|
1659
1669
|
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1670
|
+
SetOption.FuncAction = true;
|
|
1660
1671
|
this.$AddCommand(DomName, 'v-else-if', SetOption);
|
|
1661
1672
|
return this;
|
|
1662
1673
|
}
|
|
@@ -1669,22 +1680,18 @@ export class VueCommand extends VueStore {
|
|
|
1669
1680
|
|
|
1670
1681
|
public AddV_Show(DomName: PathType | QueryNode[], Option: AddCommandOption) {
|
|
1671
1682
|
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1683
|
+
SetOption.FuncAction = true;
|
|
1672
1684
|
this.$AddCommand(DomName, 'v-show', SetOption);
|
|
1673
1685
|
return this;
|
|
1674
1686
|
}
|
|
1675
1687
|
public AddV_Bind(DomName: PathType | QueryNode[], BindKey: string, Option: AddCommandOption, Args?: string) {
|
|
1676
|
-
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1677
|
-
if (Args)
|
|
1678
|
-
SetOption.FuncArgs = Args;
|
|
1688
|
+
let SetOption = this.$ConvertCommandOption(DomName, Option, Args);
|
|
1679
1689
|
SetOption.CommandKey = BindKey;
|
|
1680
1690
|
this.$AddCommand(DomName, 'v-bind', SetOption);
|
|
1681
1691
|
return this;
|
|
1682
1692
|
}
|
|
1683
1693
|
public AddV_On(DomName: PathType | QueryNode[], EventName: string, Option: AddCommandOption, Args?: string) {
|
|
1684
|
-
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1685
|
-
if (Args)
|
|
1686
|
-
SetOption.FuncArgs = Args;
|
|
1687
|
-
SetOption.FuncAction = false;
|
|
1694
|
+
let SetOption = this.$ConvertCommandOption(DomName, Option, Args);
|
|
1688
1695
|
SetOption.CommandKey = EventName;
|
|
1689
1696
|
this.$AddCommand(DomName, `v-on`, SetOption);
|
|
1690
1697
|
return this;
|
|
@@ -1721,15 +1728,11 @@ export class VueCommand extends VueStore {
|
|
|
1721
1728
|
return this;
|
|
1722
1729
|
}
|
|
1723
1730
|
public AddV_Click(DomName: PathType | QueryNode[], Option: AddCommandOption, Args?: string) {
|
|
1724
|
-
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1725
|
-
if (Args)
|
|
1726
|
-
SetOption.FuncArgs = Args;
|
|
1727
|
-
|
|
1731
|
+
let SetOption = this.$ConvertCommandOption(DomName, Option, Args);
|
|
1728
1732
|
this.AddV_On(DomName, 'click', SetOption);
|
|
1729
1733
|
return this;
|
|
1730
1734
|
}
|
|
1731
1735
|
public AddV_FilePicker(DomName: PathType | QueryNode[], Option: AddV_FilePickerOption) {
|
|
1732
|
-
|
|
1733
1736
|
let FileStorePath: string = null;
|
|
1734
1737
|
let Accept: string = null;
|
|
1735
1738
|
let ConvertType: FileConvertType | FileConvertType[] = 'none';
|
|
@@ -1775,7 +1778,6 @@ export class VueCommand extends VueStore {
|
|
|
1775
1778
|
}
|
|
1776
1779
|
|
|
1777
1780
|
public AddV_Tree(TreeRoot: PathType | QueryNode, TreeSet: TreeSetType, Option?: AddV_TreeOption): this {
|
|
1778
|
-
|
|
1779
1781
|
let AllSetInfo: TreeSetInfo[] = [];
|
|
1780
1782
|
let RootNode: QueryNode;
|
|
1781
1783
|
let UsingRootNode = TreeRoot instanceof QueryNode;
|
|
@@ -1790,6 +1792,12 @@ export class VueCommand extends VueStore {
|
|
|
1790
1792
|
continue;
|
|
1791
1793
|
}
|
|
1792
1794
|
|
|
1795
|
+
if (Info.StoreValue == '' || Info.StoreValue == null && ActionSet.AcceptNull != true)
|
|
1796
|
+
continue;
|
|
1797
|
+
|
|
1798
|
+
if (Info.StoreValue == '.' && ActionSet.AcceptSelf != true)
|
|
1799
|
+
continue;
|
|
1800
|
+
|
|
1793
1801
|
let NeedQuery = false;
|
|
1794
1802
|
let QueryOption: QueryOption = {
|
|
1795
1803
|
Mode: 'Multi',
|
|
@@ -1803,12 +1811,14 @@ export class VueCommand extends VueStore {
|
|
|
1803
1811
|
QueryOption.Mode = 'DeepMulti';
|
|
1804
1812
|
}
|
|
1805
1813
|
if (NeedQuery) {
|
|
1806
|
-
let QueryNodes =
|
|
1814
|
+
let QueryNodes = [RootNode];
|
|
1815
|
+
if (Info.DomPaths.length > 0)
|
|
1816
|
+
QueryNodes = Queryer.Query(Info.DomPaths, QueryOption);
|
|
1817
|
+
|
|
1807
1818
|
Info.Nodes = QueryNodes;
|
|
1808
1819
|
}
|
|
1809
1820
|
|
|
1810
1821
|
let TargetDom: PathType | QueryNode[] = NeedQuery ? Info.Nodes : Info.DomPaths;
|
|
1811
|
-
let TargetPath: PathType = [];
|
|
1812
1822
|
let TargetValue: PathType | Function | CommandOption;
|
|
1813
1823
|
|
|
1814
1824
|
if (typeof Info.StoreValue === 'function') {
|
|
@@ -1819,39 +1829,29 @@ export class VueCommand extends VueStore {
|
|
|
1819
1829
|
}
|
|
1820
1830
|
else {
|
|
1821
1831
|
if (typeof Info.StoreValue === 'string' || Array.isArray(Info.StoreValue)) {
|
|
1822
|
-
Info.StoreValue
|
|
1823
|
-
|
|
1824
|
-
TargetPath = [...Info.TreePaths];
|
|
1825
|
-
if (Option?.UseDomStore || Info.StoreValue == '.')
|
|
1826
|
-
TargetPath.push(Info.DomName);
|
|
1832
|
+
if (Info.StoreValue == '.')
|
|
1833
|
+
TargetValue = this.Paths(Info.TreePaths, Info.DomName);
|
|
1827
1834
|
else if (Info.StoreValue != null && Info.StoreValue != '')
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
TargetValue = TargetPath.length > 0 ? TargetPath : Info.StoreValue;
|
|
1835
|
+
TargetValue = Info.StoreValue;
|
|
1831
1836
|
}
|
|
1832
1837
|
else {
|
|
1833
|
-
|
|
1838
|
+
TargetValue = {
|
|
1834
1839
|
Target: Info.StoreValue?.TargetFunc,
|
|
1835
1840
|
FuncArgs: Info.StoreValue?.Args,
|
|
1836
|
-
};
|
|
1837
|
-
TargetValue = NewStoreValue;
|
|
1841
|
+
} as CommandOption;
|
|
1838
1842
|
if (Info.StoreValue?.Args != null) {
|
|
1839
|
-
let
|
|
1840
|
-
if (Info.Args == null
|
|
1841
|
-
Info.Args =
|
|
1843
|
+
let TargetArgs = Info.StoreValue.Args;
|
|
1844
|
+
if (Info.Args == null)
|
|
1845
|
+
Info.Args = Model.ToJoin(TargetArgs, ', ');
|
|
1842
1846
|
else
|
|
1843
|
-
Info.Args = Model.ToJoin([Info.
|
|
1847
|
+
Info.Args = Model.ToJoin([Info.Args, TargetArgs], ', ');
|
|
1844
1848
|
}
|
|
1845
1849
|
}
|
|
1846
1850
|
}
|
|
1847
1851
|
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
ActionSet(Info, {
|
|
1852
|
-
TargetDom: TargetDom,
|
|
1853
|
-
TargetPath: TargetPath,
|
|
1854
|
-
TargetValue: TargetValue,
|
|
1852
|
+
ActionSet.Execute(Info, {
|
|
1853
|
+
TargetDom,
|
|
1854
|
+
TargetValue,
|
|
1855
1855
|
});
|
|
1856
1856
|
}
|
|
1857
1857
|
return this;
|
|
@@ -1946,71 +1946,118 @@ export class VueCommand extends VueStore {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
private $SetupCommandMap() {
|
|
1948
1948
|
this.$CommandMap = {
|
|
1949
|
-
'v-text':
|
|
1950
|
-
|
|
1949
|
+
'v-text': {
|
|
1950
|
+
Execute: (Info, Option) => {
|
|
1951
|
+
Model.AddV_Text(Option.TargetDom, Option.TargetValue);
|
|
1952
|
+
},
|
|
1953
|
+
AcceptSelf: true,
|
|
1951
1954
|
},
|
|
1952
|
-
'v-model':
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1955
|
+
'v-model': {
|
|
1956
|
+
Execute: (Info, Option) => {
|
|
1957
|
+
if (typeof (Option.TargetValue) == 'function') {
|
|
1958
|
+
Model.$Error(`v-model command value must be a string or string[], path: ${this.ToJoin(Info.DomPaths)}`);
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
Model.AddV_Model(Option.TargetDom, Option.TargetValue as PathType, {
|
|
1962
|
+
ModelValue: Info.CommandKey,
|
|
1963
|
+
});
|
|
1964
|
+
},
|
|
1965
|
+
AcceptSelf: true,
|
|
1960
1966
|
},
|
|
1961
|
-
'v-for':
|
|
1962
|
-
|
|
1967
|
+
'v-for': {
|
|
1968
|
+
Execute: (Info, Option) => {
|
|
1969
|
+
Model.AddV_For(Option.TargetDom, Option.TargetValue, Info.ForKey);
|
|
1970
|
+
},
|
|
1971
|
+
AcceptSelf: true,
|
|
1963
1972
|
},
|
|
1964
|
-
'v-
|
|
1965
|
-
|
|
1973
|
+
'v-show': {
|
|
1974
|
+
Execute: (Info, Option) => {
|
|
1975
|
+
Model.AddV_Show(Option.TargetDom, Option.TargetValue);
|
|
1976
|
+
},
|
|
1977
|
+
AcceptSelf: true,
|
|
1966
1978
|
},
|
|
1967
|
-
'v-
|
|
1968
|
-
|
|
1979
|
+
'v-if': {
|
|
1980
|
+
Execute: (Info, Option) => {
|
|
1981
|
+
Model.AddV_If(Option.TargetDom, Option.TargetValue);
|
|
1982
|
+
},
|
|
1983
|
+
AcceptSelf: true,
|
|
1969
1984
|
},
|
|
1970
|
-
'v-else':
|
|
1971
|
-
|
|
1985
|
+
'v-else-if': {
|
|
1986
|
+
Execute: (Info, Option) => {
|
|
1987
|
+
Model.AddV_ElseIf(Option.TargetDom, Option.TargetValue);
|
|
1988
|
+
},
|
|
1989
|
+
AcceptSelf: true,
|
|
1972
1990
|
},
|
|
1973
|
-
'v-
|
|
1974
|
-
|
|
1991
|
+
'v-else': {
|
|
1992
|
+
Execute: (Info, Option) => {
|
|
1993
|
+
Model.AddV_Else(Option.TargetDom);
|
|
1994
|
+
},
|
|
1995
|
+
AcceptNull: true,
|
|
1975
1996
|
},
|
|
1976
|
-
'v-bind':
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1997
|
+
'v-bind': {
|
|
1998
|
+
Execute: (Info, Option) => {
|
|
1999
|
+
Model.AddV_Bind(Option.TargetDom, Info.CommandKey, Option.TargetValue, Info.Args);
|
|
2000
|
+
},
|
|
1980
2001
|
},
|
|
1981
|
-
'v-on':
|
|
1982
|
-
|
|
2002
|
+
'v-on': {
|
|
2003
|
+
Execute: (Info, Option) => {
|
|
2004
|
+
Model.AddV_On(Option.TargetDom, Info.CommandKey, Option.TargetValue, Info.Args);
|
|
2005
|
+
},
|
|
1983
2006
|
},
|
|
1984
|
-
'v-slot':
|
|
1985
|
-
|
|
2007
|
+
'v-slot': {
|
|
2008
|
+
Execute: (Info, Option) => {
|
|
2009
|
+
Model.AddV_Slot(Option.TargetDom, Info.CommandKey, Option.TargetValue);
|
|
2010
|
+
},
|
|
1986
2011
|
},
|
|
1987
|
-
'v-on-mounted':
|
|
1988
|
-
|
|
2012
|
+
'v-on-mounted': {
|
|
2013
|
+
Execute: (Info, Option) => {
|
|
2014
|
+
Model.AddV_OnMounted(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
2015
|
+
},
|
|
1989
2016
|
},
|
|
1990
|
-
'v-on-unmounted':
|
|
1991
|
-
|
|
2017
|
+
'v-on-unmounted': {
|
|
2018
|
+
Execute: (Info, Option) => {
|
|
2019
|
+
Model.AddV_OnUnMounted(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
2020
|
+
},
|
|
1992
2021
|
},
|
|
1993
|
-
'v-on-ready':
|
|
1994
|
-
|
|
2022
|
+
'v-on-ready': {
|
|
2023
|
+
Execute: (Info, Option) => {
|
|
2024
|
+
Model.AddV_OnReady(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
2025
|
+
},
|
|
1995
2026
|
},
|
|
1996
|
-
'watch':
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2027
|
+
'watch': {
|
|
2028
|
+
Execute: (Info, Option) => {
|
|
2029
|
+
let WatchPaths = [Info.DomPaths];
|
|
2030
|
+
if (Info.CommandKey)
|
|
2031
|
+
WatchPaths.push(Info.CommandKey.split(':'));
|
|
2032
|
+
WatchPaths = Model.Paths(WatchPaths);
|
|
2033
|
+
if (typeof (Info.StoreValue) === 'function')
|
|
2034
|
+
Model.AddV_Watch(WatchPaths, Info.StoreValue as WatchCallback);
|
|
2035
|
+
else {
|
|
2036
|
+
let Target = Info.StoreValue as any;
|
|
2037
|
+
Model.AddV_Watch(WatchPaths, Target?.CallBack, Target?.Option);
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2002
2040
|
},
|
|
2003
|
-
'func':
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2041
|
+
'func': {
|
|
2042
|
+
Execute: (Info, Option) => {
|
|
2043
|
+
if (typeof (Info.StoreValue) != 'function') {
|
|
2044
|
+
Model.$Error(`func command value must be a function, path: ${this.ToJoin(Info.DomPaths)}`);
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
Model.AddV_Function(Model.Paths(...Info.DomPaths, Info.CommandKey ?? 'func'), Info.StoreValue);
|
|
2048
|
+
},
|
|
2009
2049
|
},
|
|
2010
|
-
'using':
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2050
|
+
'using': {
|
|
2051
|
+
Execute: (Info, Option) => {
|
|
2052
|
+
if (typeof (Info.StoreValue) === 'function') {
|
|
2053
|
+
Info.StoreValue(Info.DomPaths, Info.Nodes);
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
},
|
|
2057
|
+
'store': {
|
|
2058
|
+
Execute: (Info, Option) => {
|
|
2059
|
+
Model.UpdateStore(Info.DomPaths, Info.StoreValue);
|
|
2060
|
+
},
|
|
2014
2061
|
}
|
|
2015
2062
|
}
|
|
2016
2063
|
}
|
|
@@ -2102,22 +2149,36 @@ export class VueCommand extends VueStore {
|
|
|
2102
2149
|
//#endregion
|
|
2103
2150
|
|
|
2104
2151
|
//#region Protected Process
|
|
2105
|
-
protected $ConvertCommandOption(DomName: PathType | QueryNode[], Option?: AddCommandOption): CommandOption {
|
|
2106
|
-
|
|
2152
|
+
protected $ConvertCommandOption(DomName: PathType | QueryNode[], Option?: AddCommandOption, Args?: string): CommandOption {
|
|
2153
|
+
let Result: CommandOption;
|
|
2154
|
+
if (Option == null || Option == '.') {
|
|
2107
2155
|
if (this.IsPathType(DomName))
|
|
2108
|
-
|
|
2156
|
+
Result = {
|
|
2157
|
+
Target: DomName as PathType
|
|
2158
|
+
};
|
|
2109
2159
|
else {
|
|
2110
2160
|
let Nodes = DomName as QueryNode[];
|
|
2111
2161
|
let NodeNames = Nodes.map(Item => Item.DomName);
|
|
2112
|
-
|
|
2162
|
+
Result = {
|
|
2163
|
+
Target: NodeNames
|
|
2164
|
+
};
|
|
2113
2165
|
}
|
|
2114
2166
|
}
|
|
2167
|
+
else if (typeof Option == 'string' || typeof Option == 'function' || Array.isArray(Option))
|
|
2168
|
+
Result = {
|
|
2169
|
+
Target: Option
|
|
2170
|
+
};
|
|
2171
|
+
else
|
|
2172
|
+
Result = Option;
|
|
2115
2173
|
|
|
2116
|
-
if (
|
|
2117
|
-
|
|
2174
|
+
if (Args)
|
|
2175
|
+
Result.FuncArgs = Args;
|
|
2176
|
+
|
|
2177
|
+
Result.FuncAction ??= false;
|
|
2178
|
+
if (Result.FuncArgs)
|
|
2179
|
+
Result.FuncAction = true;
|
|
2118
2180
|
|
|
2119
|
-
|
|
2120
|
-
return Option;
|
|
2181
|
+
return Result;
|
|
2121
2182
|
}
|
|
2122
2183
|
protected $AddCommand(DomName: PathType | QueryNode[], Command: string, Option: CommandOption) {
|
|
2123
2184
|
if (DomName == null)
|