@rugal.tu/vuemodel3 1.5.2 → 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 +141 -88
- package/dist/VueModel.umd.js +141 -88
- package/package.json +1 -1
- package/src/VueModel.d.ts +33 -26
- package/src/VueModel.ts +181 -123
- package/src/esm/VueModel.js +141 -88
- package/src/esm/VueModel.js.map +1 -1
- package/src/umd/VueModel.js +141 -88
- 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',
|
|
@@ -1369,7 +1371,6 @@ export class VueCommand extends VueStore {
|
|
|
1369
1371
|
Info.Nodes = QueryNodes;
|
|
1370
1372
|
}
|
|
1371
1373
|
let TargetDom = NeedQuery ? Info.Nodes : Info.DomPaths;
|
|
1372
|
-
let TargetPath = [];
|
|
1373
1374
|
let TargetValue;
|
|
1374
1375
|
if (typeof Info.StoreValue === 'function') {
|
|
1375
1376
|
TargetValue = {
|
|
@@ -1379,36 +1380,28 @@ export class VueCommand extends VueStore {
|
|
|
1379
1380
|
}
|
|
1380
1381
|
else {
|
|
1381
1382
|
if (typeof Info.StoreValue === 'string' || Array.isArray(Info.StoreValue)) {
|
|
1382
|
-
Info.StoreValue
|
|
1383
|
-
|
|
1384
|
-
TargetPath = [...Info.TreePaths];
|
|
1385
|
-
if (Option?.UseDomStore || Info.StoreValue == '.')
|
|
1386
|
-
TargetPath.push(Info.DomName);
|
|
1383
|
+
if (Info.StoreValue == '.')
|
|
1384
|
+
TargetValue = this.Paths(Info.TreePaths, Info.DomName);
|
|
1387
1385
|
else if (Info.StoreValue != null && Info.StoreValue != '')
|
|
1388
|
-
|
|
1389
|
-
TargetValue = TargetPath.length > 0 ? TargetPath : Info.StoreValue;
|
|
1386
|
+
TargetValue = Info.StoreValue;
|
|
1390
1387
|
}
|
|
1391
1388
|
else {
|
|
1392
|
-
|
|
1389
|
+
TargetValue = {
|
|
1393
1390
|
Target: Info.StoreValue?.TargetFunc,
|
|
1394
1391
|
FuncArgs: Info.StoreValue?.Args,
|
|
1395
1392
|
};
|
|
1396
|
-
TargetValue = NewStoreValue;
|
|
1397
1393
|
if (Info.StoreValue?.Args != null) {
|
|
1398
|
-
let
|
|
1399
|
-
if (Info.Args == null
|
|
1400
|
-
Info.Args =
|
|
1394
|
+
let TargetArgs = Info.StoreValue.Args;
|
|
1395
|
+
if (Info.Args == null)
|
|
1396
|
+
Info.Args = Model.ToJoin(TargetArgs, ', ');
|
|
1401
1397
|
else
|
|
1402
|
-
Info.Args = Model.ToJoin([Info.
|
|
1398
|
+
Info.Args = Model.ToJoin([Info.Args, TargetArgs], ', ');
|
|
1403
1399
|
}
|
|
1404
1400
|
}
|
|
1405
1401
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
TargetDom: TargetDom,
|
|
1410
|
-
TargetPath: TargetPath,
|
|
1411
|
-
TargetValue: TargetValue,
|
|
1402
|
+
ActionSet.Execute(Info, {
|
|
1403
|
+
TargetDom,
|
|
1404
|
+
TargetValue,
|
|
1412
1405
|
});
|
|
1413
1406
|
}
|
|
1414
1407
|
return this;
|
|
@@ -1496,71 +1489,118 @@ export class VueCommand extends VueStore {
|
|
|
1496
1489
|
}
|
|
1497
1490
|
$SetupCommandMap() {
|
|
1498
1491
|
this.$CommandMap = {
|
|
1499
|
-
'v-text':
|
|
1500
|
-
|
|
1492
|
+
'v-text': {
|
|
1493
|
+
Execute: (Info, Option) => {
|
|
1494
|
+
Model.AddV_Text(Option.TargetDom, Option.TargetValue);
|
|
1495
|
+
},
|
|
1496
|
+
AcceptSelf: true,
|
|
1501
1497
|
},
|
|
1502
|
-
'v-model':
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
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,
|
|
1510
1509
|
},
|
|
1511
|
-
'v-for':
|
|
1512
|
-
|
|
1510
|
+
'v-for': {
|
|
1511
|
+
Execute: (Info, Option) => {
|
|
1512
|
+
Model.AddV_For(Option.TargetDom, Option.TargetValue, Info.ForKey);
|
|
1513
|
+
},
|
|
1514
|
+
AcceptSelf: true,
|
|
1513
1515
|
},
|
|
1514
|
-
'v-
|
|
1515
|
-
|
|
1516
|
+
'v-show': {
|
|
1517
|
+
Execute: (Info, Option) => {
|
|
1518
|
+
Model.AddV_Show(Option.TargetDom, Option.TargetValue);
|
|
1519
|
+
},
|
|
1520
|
+
AcceptSelf: true,
|
|
1516
1521
|
},
|
|
1517
|
-
'v-
|
|
1518
|
-
|
|
1522
|
+
'v-if': {
|
|
1523
|
+
Execute: (Info, Option) => {
|
|
1524
|
+
Model.AddV_If(Option.TargetDom, Option.TargetValue);
|
|
1525
|
+
},
|
|
1526
|
+
AcceptSelf: true,
|
|
1519
1527
|
},
|
|
1520
|
-
'v-else':
|
|
1521
|
-
|
|
1528
|
+
'v-else-if': {
|
|
1529
|
+
Execute: (Info, Option) => {
|
|
1530
|
+
Model.AddV_ElseIf(Option.TargetDom, Option.TargetValue);
|
|
1531
|
+
},
|
|
1532
|
+
AcceptSelf: true,
|
|
1522
1533
|
},
|
|
1523
|
-
'v-
|
|
1524
|
-
|
|
1534
|
+
'v-else': {
|
|
1535
|
+
Execute: (Info, Option) => {
|
|
1536
|
+
Model.AddV_Else(Option.TargetDom);
|
|
1537
|
+
},
|
|
1538
|
+
AcceptNull: true,
|
|
1525
1539
|
},
|
|
1526
|
-
'v-bind':
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1540
|
+
'v-bind': {
|
|
1541
|
+
Execute: (Info, Option) => {
|
|
1542
|
+
Model.AddV_Bind(Option.TargetDom, Info.CommandKey, Option.TargetValue, Info.Args);
|
|
1543
|
+
},
|
|
1530
1544
|
},
|
|
1531
|
-
'v-on':
|
|
1532
|
-
|
|
1545
|
+
'v-on': {
|
|
1546
|
+
Execute: (Info, Option) => {
|
|
1547
|
+
Model.AddV_On(Option.TargetDom, Info.CommandKey, Option.TargetValue, Info.Args);
|
|
1548
|
+
},
|
|
1533
1549
|
},
|
|
1534
|
-
'v-slot':
|
|
1535
|
-
|
|
1550
|
+
'v-slot': {
|
|
1551
|
+
Execute: (Info, Option) => {
|
|
1552
|
+
Model.AddV_Slot(Option.TargetDom, Info.CommandKey, Option.TargetValue);
|
|
1553
|
+
},
|
|
1536
1554
|
},
|
|
1537
|
-
'v-on-mounted':
|
|
1538
|
-
|
|
1555
|
+
'v-on-mounted': {
|
|
1556
|
+
Execute: (Info, Option) => {
|
|
1557
|
+
Model.AddV_OnMounted(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
1558
|
+
},
|
|
1539
1559
|
},
|
|
1540
|
-
'v-on-unmounted':
|
|
1541
|
-
|
|
1560
|
+
'v-on-unmounted': {
|
|
1561
|
+
Execute: (Info, Option) => {
|
|
1562
|
+
Model.AddV_OnUnMounted(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
1563
|
+
},
|
|
1542
1564
|
},
|
|
1543
|
-
'v-on-ready':
|
|
1544
|
-
|
|
1565
|
+
'v-on-ready': {
|
|
1566
|
+
Execute: (Info, Option) => {
|
|
1567
|
+
Model.AddV_OnReady(Option.TargetDom, Option.TargetValue, Info.Args);
|
|
1568
|
+
},
|
|
1545
1569
|
},
|
|
1546
|
-
'watch':
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
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
|
+
},
|
|
1552
1583
|
},
|
|
1553
|
-
'func':
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
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
|
+
},
|
|
1559
1592
|
},
|
|
1560
|
-
'using':
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
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
|
+
},
|
|
1564
1604
|
}
|
|
1565
1605
|
};
|
|
1566
1606
|
}
|
|
@@ -1639,20 +1679,33 @@ export class VueCommand extends VueStore {
|
|
|
1639
1679
|
SetProperty[PropertyKey] = OriginalValue;
|
|
1640
1680
|
return SetProperty;
|
|
1641
1681
|
}
|
|
1642
|
-
$ConvertCommandOption(DomName, Option) {
|
|
1643
|
-
|
|
1682
|
+
$ConvertCommandOption(DomName, Option, Args) {
|
|
1683
|
+
let Result;
|
|
1684
|
+
if (Option == null || Option == '.') {
|
|
1644
1685
|
if (this.IsPathType(DomName))
|
|
1645
|
-
|
|
1686
|
+
Result = {
|
|
1687
|
+
Target: DomName
|
|
1688
|
+
};
|
|
1646
1689
|
else {
|
|
1647
1690
|
let Nodes = DomName;
|
|
1648
1691
|
let NodeNames = Nodes.map(Item => Item.DomName);
|
|
1649
|
-
|
|
1692
|
+
Result = {
|
|
1693
|
+
Target: NodeNames
|
|
1694
|
+
};
|
|
1650
1695
|
}
|
|
1651
1696
|
}
|
|
1652
|
-
if (typeof Option == 'string' || typeof Option == 'function' || Array.isArray(Option))
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
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;
|
|
1656
1709
|
}
|
|
1657
1710
|
$AddCommand(DomName, Command, Option) {
|
|
1658
1711
|
if (DomName == null)
|