@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/dist/VueModel.esm.js
CHANGED
|
@@ -1190,6 +1190,7 @@ export class VueCommand extends VueStore {
|
|
|
1190
1190
|
Model.AddStore(SetOption.Target);
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
|
+
SetOption.FuncAction = true;
|
|
1193
1194
|
this.$AddCommand(DomName, 'v-text', SetOption);
|
|
1194
1195
|
return this;
|
|
1195
1196
|
}
|
|
@@ -1222,16 +1223,19 @@ export class VueCommand extends VueStore {
|
|
|
1222
1223
|
let Target = Model.ToJoin(SetOption.Target);
|
|
1223
1224
|
if (!/\b(in|of)\b/.test(Target))
|
|
1224
1225
|
SetOption.TargetHead ??= '(item, index) in ';
|
|
1226
|
+
SetOption.FuncAction = true;
|
|
1225
1227
|
this.$AddCommand(DomName, 'v-for', SetOption);
|
|
1226
1228
|
return this;
|
|
1227
1229
|
}
|
|
1228
1230
|
AddV_If(DomName, Option) {
|
|
1229
1231
|
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1232
|
+
SetOption.FuncAction = true;
|
|
1230
1233
|
this.$AddCommand(DomName, 'v-if', SetOption);
|
|
1231
1234
|
return this;
|
|
1232
1235
|
}
|
|
1233
1236
|
AddV_ElseIf(DomName, Option) {
|
|
1234
1237
|
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1238
|
+
SetOption.FuncAction = true;
|
|
1235
1239
|
this.$AddCommand(DomName, 'v-else-if', SetOption);
|
|
1236
1240
|
return this;
|
|
1237
1241
|
}
|
|
@@ -1243,22 +1247,18 @@ export class VueCommand extends VueStore {
|
|
|
1243
1247
|
}
|
|
1244
1248
|
AddV_Show(DomName, Option) {
|
|
1245
1249
|
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1250
|
+
SetOption.FuncAction = true;
|
|
1246
1251
|
this.$AddCommand(DomName, 'v-show', SetOption);
|
|
1247
1252
|
return this;
|
|
1248
1253
|
}
|
|
1249
1254
|
AddV_Bind(DomName, BindKey, Option, Args) {
|
|
1250
|
-
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1251
|
-
if (Args)
|
|
1252
|
-
SetOption.FuncArgs = Args;
|
|
1255
|
+
let SetOption = this.$ConvertCommandOption(DomName, Option, Args);
|
|
1253
1256
|
SetOption.CommandKey = BindKey;
|
|
1254
1257
|
this.$AddCommand(DomName, 'v-bind', SetOption);
|
|
1255
1258
|
return this;
|
|
1256
1259
|
}
|
|
1257
1260
|
AddV_On(DomName, EventName, Option, Args) {
|
|
1258
|
-
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1259
|
-
if (Args)
|
|
1260
|
-
SetOption.FuncArgs = Args;
|
|
1261
|
-
SetOption.FuncAction = false;
|
|
1261
|
+
let SetOption = this.$ConvertCommandOption(DomName, Option, Args);
|
|
1262
1262
|
SetOption.CommandKey = EventName;
|
|
1263
1263
|
this.$AddCommand(DomName, `v-on`, SetOption);
|
|
1264
1264
|
return this;
|
|
@@ -1291,9 +1291,7 @@ export class VueCommand extends VueStore {
|
|
|
1291
1291
|
return this;
|
|
1292
1292
|
}
|
|
1293
1293
|
AddV_Click(DomName, Option, Args) {
|
|
1294
|
-
let SetOption = this.$ConvertCommandOption(DomName, Option);
|
|
1295
|
-
if (Args)
|
|
1296
|
-
SetOption.FuncArgs = Args;
|
|
1294
|
+
let SetOption = this.$ConvertCommandOption(DomName, Option, Args);
|
|
1297
1295
|
this.AddV_On(DomName, 'click', SetOption);
|
|
1298
1296
|
return this;
|
|
1299
1297
|
}
|
|
@@ -1350,6 +1348,10 @@ export class VueCommand extends VueStore {
|
|
|
1350
1348
|
Model.$Error(`${Info.Command} command is not allowed, path: ${this.ToJoin(Info.DomPaths)}`);
|
|
1351
1349
|
continue;
|
|
1352
1350
|
}
|
|
1351
|
+
if (Info.StoreValue == '' || Info.StoreValue == null && ActionSet.AcceptNull != true)
|
|
1352
|
+
continue;
|
|
1353
|
+
if (Info.StoreValue == '.' && ActionSet.AcceptSelf != true)
|
|
1354
|
+
continue;
|
|
1353
1355
|
let NeedQuery = false;
|
|
1354
1356
|
let QueryOption = {
|
|
1355
1357
|
Mode: 'Multi',
|
|
@@ -1363,11 +1365,12 @@ export class VueCommand extends VueStore {
|
|
|
1363
1365
|
QueryOption.Mode = 'DeepMulti';
|
|
1364
1366
|
}
|
|
1365
1367
|
if (NeedQuery) {
|
|
1366
|
-
let QueryNodes =
|
|
1368
|
+
let QueryNodes = [RootNode];
|
|
1369
|
+
if (Info.DomPaths.length > 0)
|
|
1370
|
+
QueryNodes = Queryer.Query(Info.DomPaths, QueryOption);
|
|
1367
1371
|
Info.Nodes = QueryNodes;
|
|
1368
1372
|
}
|
|
1369
1373
|
let TargetDom = NeedQuery ? Info.Nodes : Info.DomPaths;
|
|
1370
|
-
let TargetPath = [];
|
|
1371
1374
|
let TargetValue;
|
|
1372
1375
|
if (typeof Info.StoreValue === 'function') {
|
|
1373
1376
|
TargetValue = {
|
|
@@ -1377,36 +1380,28 @@ export class VueCommand extends VueStore {
|
|
|
1377
1380
|
}
|
|
1378
1381
|
else {
|
|
1379
1382
|
if (typeof Info.StoreValue === 'string' || Array.isArray(Info.StoreValue)) {
|
|
1380
|
-
Info.StoreValue
|
|
1381
|
-
|
|
1382
|
-
TargetPath = [...Info.TreePaths];
|
|
1383
|
-
if (Option?.UseDomStore || Info.StoreValue == '.')
|
|
1384
|
-
TargetPath.push(Info.DomName);
|
|
1383
|
+
if (Info.StoreValue == '.')
|
|
1384
|
+
TargetValue = this.Paths(Info.TreePaths, Info.DomName);
|
|
1385
1385
|
else if (Info.StoreValue != null && Info.StoreValue != '')
|
|
1386
|
-
|
|
1387
|
-
TargetValue = TargetPath.length > 0 ? TargetPath : Info.StoreValue;
|
|
1386
|
+
TargetValue = Info.StoreValue;
|
|
1388
1387
|
}
|
|
1389
1388
|
else {
|
|
1390
|
-
|
|
1389
|
+
TargetValue = {
|
|
1391
1390
|
Target: Info.StoreValue?.TargetFunc,
|
|
1392
1391
|
FuncArgs: Info.StoreValue?.Args,
|
|
1393
1392
|
};
|
|
1394
|
-
TargetValue = NewStoreValue;
|
|
1395
1393
|
if (Info.StoreValue?.Args != null) {
|
|
1396
|
-
let
|
|
1397
|
-
if (Info.Args == null
|
|
1398
|
-
Info.Args =
|
|
1394
|
+
let TargetArgs = Info.StoreValue.Args;
|
|
1395
|
+
if (Info.Args == null)
|
|
1396
|
+
Info.Args = Model.ToJoin(TargetArgs, ', ');
|
|
1399
1397
|
else
|
|
1400
|
-
Info.Args = Model.ToJoin([Info.
|
|
1398
|
+
Info.Args = Model.ToJoin([Info.Args, TargetArgs], ', ');
|
|
1401
1399
|
}
|
|
1402
1400
|
}
|
|
1403
1401
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
TargetDom: TargetDom,
|
|
1408
|
-
TargetPath: TargetPath,
|
|
1409
|
-
TargetValue: TargetValue,
|
|
1402
|
+
ActionSet.Execute(Info, {
|
|
1403
|
+
TargetDom,
|
|
1404
|
+
TargetValue,
|
|
1410
1405
|
});
|
|
1411
1406
|
}
|
|
1412
1407
|
return this;
|
|
@@ -1494,71 +1489,118 @@ export class VueCommand extends VueStore {
|
|
|
1494
1489
|
}
|
|
1495
1490
|
$SetupCommandMap() {
|
|
1496
1491
|
this.$CommandMap = {
|
|
1497
|
-
'v-text':
|
|
1498
|
-
|
|
1492
|
+
'v-text': {
|
|
1493
|
+
Execute: (Info, Option) => {
|
|
1494
|
+
Model.AddV_Text(Option.TargetDom, Option.TargetValue);
|
|
1495
|
+
},
|
|
1496
|
+
AcceptSelf: true,
|
|
1499
1497
|
},
|
|
1500
|
-
'v-model':
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1498
|
+
'v-model': {
|
|
1499
|
+
Execute: (Info, Option) => {
|
|
1500
|
+
if (typeof (Option.TargetValue) == 'function') {
|
|
1501
|
+
Model.$Error(`v-model command value must be a string or string[], path: ${this.ToJoin(Info.DomPaths)}`);
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
Model.AddV_Model(Option.TargetDom, Option.TargetValue, {
|
|
1505
|
+
ModelValue: Info.CommandKey,
|
|
1506
|
+
});
|
|
1507
|
+
},
|
|
1508
|
+
AcceptSelf: true,
|
|
1508
1509
|
},
|
|
1509
|
-
'v-for':
|
|
1510
|
-
|
|
1510
|
+
'v-for': {
|
|
1511
|
+
Execute: (Info, Option) => {
|
|
1512
|
+
Model.AddV_For(Option.TargetDom, Option.TargetValue, Info.ForKey);
|
|
1513
|
+
},
|
|
1514
|
+
AcceptSelf: true,
|
|
1511
1515
|
},
|
|
1512
|
-
'v-
|
|
1513
|
-
|
|
1516
|
+
'v-show': {
|
|
1517
|
+
Execute: (Info, Option) => {
|
|
1518
|
+
Model.AddV_Show(Option.TargetDom, Option.TargetValue);
|
|
1519
|
+
},
|
|
1520
|
+
AcceptSelf: true,
|
|
1514
1521
|
},
|
|
1515
|
-
'v-
|
|
1516
|
-
|
|
1522
|
+
'v-if': {
|
|
1523
|
+
Execute: (Info, Option) => {
|
|
1524
|
+
Model.AddV_If(Option.TargetDom, Option.TargetValue);
|
|
1525
|
+
},
|
|
1526
|
+
AcceptSelf: true,
|
|
1517
1527
|
},
|
|
1518
|
-
'v-else':
|
|
1519
|
-
|
|
1528
|
+
'v-else-if': {
|
|
1529
|
+
Execute: (Info, Option) => {
|
|
1530
|
+
Model.AddV_ElseIf(Option.TargetDom, Option.TargetValue);
|
|
1531
|
+
},
|
|
1532
|
+
AcceptSelf: true,
|
|
1520
1533
|
},
|
|
1521
|
-
'v-
|
|
1522
|
-
|
|
1534
|
+
'v-else': {
|
|
1535
|
+
Execute: (Info, Option) => {
|
|
1536
|
+
Model.AddV_Else(Option.TargetDom);
|
|
1537
|
+
},
|
|
1538
|
+
AcceptNull: true,
|
|
1523
1539
|
},
|
|
1524
|
-
'v-bind':
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1540
|
+
'v-bind': {
|
|
1541
|
+
Execute: (Info, Option) => {
|
|
1542
|
+
Model.AddV_Bind(Option.TargetDom, Info.CommandKey, Option.TargetValue, Info.Args);
|
|
1543
|
+
},
|
|
1528
1544
|
},
|
|
1529
|
-
'v-on':
|
|
1530
|
-
|
|
1545
|
+
'v-on': {
|
|
1546
|
+
Execute: (Info, Option) => {
|
|
1547
|
+
Model.AddV_On(Option.TargetDom, Info.CommandKey, Option.TargetValue, Info.Args);
|
|
1548
|
+
},
|
|
1531
1549
|
},
|
|
1532
|
-
'v-slot':
|
|
1533
|
-
|
|
1550
|
+
'v-slot': {
|
|
1551
|
+
Execute: (Info, Option) => {
|
|
1552
|
+
Model.AddV_Slot(Option.TargetDom, Info.CommandKey, Option.TargetValue);
|
|
1553
|
+
},
|
|
1534
1554
|
},
|
|
1535
|
-
'v-on-mounted':
|
|
1536
|
-
|
|
1555
|
+
'v-on-mounted': {
|
|
1556
|
+
Execute: (Info, Option) => {
|
|
1557
|
+
Model.AddV_OnMounted(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
1558
|
+
},
|
|
1537
1559
|
},
|
|
1538
|
-
'v-on-unmounted':
|
|
1539
|
-
|
|
1560
|
+
'v-on-unmounted': {
|
|
1561
|
+
Execute: (Info, Option) => {
|
|
1562
|
+
Model.AddV_OnUnMounted(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
1563
|
+
},
|
|
1540
1564
|
},
|
|
1541
|
-
'v-on-ready':
|
|
1542
|
-
|
|
1565
|
+
'v-on-ready': {
|
|
1566
|
+
Execute: (Info, Option) => {
|
|
1567
|
+
Model.AddV_OnReady(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
1568
|
+
},
|
|
1543
1569
|
},
|
|
1544
|
-
'watch':
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1570
|
+
'watch': {
|
|
1571
|
+
Execute: (Info, Option) => {
|
|
1572
|
+
let WatchPaths = [Info.DomPaths];
|
|
1573
|
+
if (Info.CommandKey)
|
|
1574
|
+
WatchPaths.push(Info.CommandKey.split(':'));
|
|
1575
|
+
WatchPaths = Model.Paths(WatchPaths);
|
|
1576
|
+
if (typeof (Info.StoreValue) === 'function')
|
|
1577
|
+
Model.AddV_Watch(WatchPaths, Info.StoreValue);
|
|
1578
|
+
else {
|
|
1579
|
+
let Target = Info.StoreValue;
|
|
1580
|
+
Model.AddV_Watch(WatchPaths, Target?.CallBack, Target?.Option);
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1550
1583
|
},
|
|
1551
|
-
'func':
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1584
|
+
'func': {
|
|
1585
|
+
Execute: (Info, Option) => {
|
|
1586
|
+
if (typeof (Info.StoreValue) != 'function') {
|
|
1587
|
+
Model.$Error(`func command value must be a function, path: ${this.ToJoin(Info.DomPaths)}`);
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
Model.AddV_Function(Model.Paths(...Info.DomPaths, Info.CommandKey ?? 'func'), Info.StoreValue);
|
|
1591
|
+
},
|
|
1557
1592
|
},
|
|
1558
|
-
'using':
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1593
|
+
'using': {
|
|
1594
|
+
Execute: (Info, Option) => {
|
|
1595
|
+
if (typeof (Info.StoreValue) === 'function') {
|
|
1596
|
+
Info.StoreValue(Info.DomPaths, Info.Nodes);
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
},
|
|
1600
|
+
'store': {
|
|
1601
|
+
Execute: (Info, Option) => {
|
|
1602
|
+
Model.UpdateStore(Info.DomPaths, Info.StoreValue);
|
|
1603
|
+
},
|
|
1562
1604
|
}
|
|
1563
1605
|
};
|
|
1564
1606
|
}
|
|
@@ -1637,20 +1679,33 @@ export class VueCommand extends VueStore {
|
|
|
1637
1679
|
SetProperty[PropertyKey] = OriginalValue;
|
|
1638
1680
|
return SetProperty;
|
|
1639
1681
|
}
|
|
1640
|
-
$ConvertCommandOption(DomName, Option) {
|
|
1641
|
-
|
|
1682
|
+
$ConvertCommandOption(DomName, Option, Args) {
|
|
1683
|
+
let Result;
|
|
1684
|
+
if (Option == null || Option == '.') {
|
|
1642
1685
|
if (this.IsPathType(DomName))
|
|
1643
|
-
|
|
1686
|
+
Result = {
|
|
1687
|
+
Target: DomName
|
|
1688
|
+
};
|
|
1644
1689
|
else {
|
|
1645
1690
|
let Nodes = DomName;
|
|
1646
1691
|
let NodeNames = Nodes.map(Item => Item.DomName);
|
|
1647
|
-
|
|
1692
|
+
Result = {
|
|
1693
|
+
Target: NodeNames
|
|
1694
|
+
};
|
|
1648
1695
|
}
|
|
1649
1696
|
}
|
|
1650
|
-
if (typeof Option == 'string' || typeof Option == 'function' || Array.isArray(Option))
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1697
|
+
else if (typeof Option == 'string' || typeof Option == 'function' || Array.isArray(Option))
|
|
1698
|
+
Result = {
|
|
1699
|
+
Target: Option
|
|
1700
|
+
};
|
|
1701
|
+
else
|
|
1702
|
+
Result = Option;
|
|
1703
|
+
if (Args)
|
|
1704
|
+
Result.FuncArgs = Args;
|
|
1705
|
+
Result.FuncAction ??= false;
|
|
1706
|
+
if (Result.FuncArgs)
|
|
1707
|
+
Result.FuncAction = true;
|
|
1708
|
+
return Result;
|
|
1654
1709
|
}
|
|
1655
1710
|
$AddCommand(DomName, Command, Option) {
|
|
1656
1711
|
if (DomName == null)
|