@signalplus/params-about 1.0.5-alpha2 → 1.0.5-alpha4
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/index.d.ts +3 -0
- package/lib/es/index.js +80 -63
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ declare class ParamRenderer extends PureComponent<ParamRendererProps> {
|
|
|
44
44
|
Comp: React.ComponentType<BaseInputProps>;
|
|
45
45
|
validator?(value: any, enableEmpty?: boolean | undefined): string;
|
|
46
46
|
required?: boolean | undefined;
|
|
47
|
+
sort: number;
|
|
47
48
|
};
|
|
48
49
|
get value(): any;
|
|
49
50
|
onChange: (val: any) => void;
|
|
@@ -310,6 +311,7 @@ declare const ParamTypeConfig: Record<ParamType, {
|
|
|
310
311
|
Comp: React.ComponentType<BaseInputProps>;
|
|
311
312
|
validator?(value: any, enableEmpty?: boolean): string;
|
|
312
313
|
required?: boolean;
|
|
314
|
+
sort: number;
|
|
313
315
|
}>;
|
|
314
316
|
declare function paramValidator(val: any, values: {
|
|
315
317
|
valueType: ParamType;
|
|
@@ -323,6 +325,7 @@ declare const ParamTypeOptions: {
|
|
|
323
325
|
Comp: React.ComponentType<BaseInputProps>;
|
|
324
326
|
validator?(value: any, enableEmpty?: boolean | undefined): string;
|
|
325
327
|
required?: boolean | undefined;
|
|
328
|
+
sort: number;
|
|
326
329
|
}[];
|
|
327
330
|
|
|
328
331
|
declare function formatNum(val: string): number | undefined;
|
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
|
-
* Generated: 2023-05-
|
|
4
|
-
* Version: 1.0.5-
|
|
3
|
+
* Generated: 2023-05-12
|
|
4
|
+
* Version: 1.0.5-alpha4
|
|
5
5
|
* License: MIT
|
|
6
6
|
* Author: 2631541504@qq.com
|
|
7
7
|
*/
|
|
@@ -260,7 +260,7 @@ function formatNum(val) {
|
|
|
260
260
|
return isNaN(num) ? undefined : num;
|
|
261
261
|
}
|
|
262
262
|
function isNullLike(val) {
|
|
263
|
-
return val === undefined || val === null;
|
|
263
|
+
return val === undefined || val === null || val === '';
|
|
264
264
|
}
|
|
265
265
|
function emptyValidator(val, enableEmpty) {
|
|
266
266
|
return !enableEmpty && (isNullLike(val) || val instanceof Array && !val.length || typeof val === 'string' && !val) ? 'Should not be empty' : '';
|
|
@@ -1459,7 +1459,7 @@ var InstrumentsValueList = /*#__PURE__*/function (_PureComponent) {
|
|
|
1459
1459
|
key: i
|
|
1460
1460
|
}, /*#__PURE__*/React.createElement(Instruments, {
|
|
1461
1461
|
style: {
|
|
1462
|
-
width:
|
|
1462
|
+
width: 240
|
|
1463
1463
|
},
|
|
1464
1464
|
multiple: false,
|
|
1465
1465
|
options: _this2.props.options,
|
|
@@ -1476,7 +1476,7 @@ var InstrumentsValueList = /*#__PURE__*/function (_PureComponent) {
|
|
|
1476
1476
|
}), /*#__PURE__*/React.createElement(Num, {
|
|
1477
1477
|
style: {
|
|
1478
1478
|
height: 30,
|
|
1479
|
-
width:
|
|
1479
|
+
width: 180
|
|
1480
1480
|
},
|
|
1481
1481
|
value: it.value,
|
|
1482
1482
|
onChange: function onChange(val) {
|
|
@@ -1580,13 +1580,15 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1580
1580
|
name: '参数组',
|
|
1581
1581
|
Comp: function Comp() {
|
|
1582
1582
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
1583
|
-
}
|
|
1583
|
+
},
|
|
1584
|
+
sort: 12
|
|
1584
1585
|
}), _defineProperty(_ParamTypeConfig, ParamType.Number, {
|
|
1585
1586
|
name: '普通数值',
|
|
1586
1587
|
key: 'number',
|
|
1587
1588
|
Comp: Num,
|
|
1588
1589
|
validator: emptyValidator,
|
|
1589
|
-
required: true
|
|
1590
|
+
required: true,
|
|
1591
|
+
sort: 1
|
|
1590
1592
|
}), _defineProperty(_ParamTypeConfig, ParamType.Percentage, {
|
|
1591
1593
|
name: '百分比数值',
|
|
1592
1594
|
key: 'number',
|
|
@@ -1596,19 +1598,22 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1596
1598
|
}));
|
|
1597
1599
|
},
|
|
1598
1600
|
validator: emptyValidator,
|
|
1599
|
-
required: true
|
|
1601
|
+
required: true,
|
|
1602
|
+
sort: 2
|
|
1600
1603
|
}), _defineProperty(_ParamTypeConfig, ParamType.Bool, {
|
|
1601
1604
|
name: 'TRUE/FALSE',
|
|
1602
1605
|
key: 'bool',
|
|
1603
1606
|
Comp: Bool,
|
|
1604
1607
|
validator: emptyValidator,
|
|
1605
|
-
required: true
|
|
1608
|
+
required: true,
|
|
1609
|
+
sort: 3
|
|
1606
1610
|
}), _defineProperty(_ParamTypeConfig, ParamType.NumberRange, {
|
|
1607
1611
|
name: '数值范围',
|
|
1608
1612
|
key: 'range',
|
|
1609
1613
|
Comp: NumRange,
|
|
1610
1614
|
validator: numRangeValidator,
|
|
1611
|
-
required: true
|
|
1615
|
+
required: true,
|
|
1616
|
+
sort: 4
|
|
1612
1617
|
}), _defineProperty(_ParamTypeConfig, ParamType.PercentageRange, {
|
|
1613
1618
|
name: '百分比范围',
|
|
1614
1619
|
key: 'range',
|
|
@@ -1618,7 +1623,61 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1618
1623
|
}));
|
|
1619
1624
|
},
|
|
1620
1625
|
validator: numRangeValidator,
|
|
1621
|
-
required: true
|
|
1626
|
+
required: true,
|
|
1627
|
+
sort: 5
|
|
1628
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.Text, {
|
|
1629
|
+
name: '文本',
|
|
1630
|
+
key: 'text',
|
|
1631
|
+
Comp: Text,
|
|
1632
|
+
validator: emptyValidator,
|
|
1633
|
+
sort: 6
|
|
1634
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.Phone, {
|
|
1635
|
+
name: '文本列表',
|
|
1636
|
+
key: 'list',
|
|
1637
|
+
Comp: TextArray,
|
|
1638
|
+
validator: function validator($val) {
|
|
1639
|
+
if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
|
|
1640
|
+
var index = $val.findIndex(function ($it) {
|
|
1641
|
+
return !$it.trim();
|
|
1642
|
+
});
|
|
1643
|
+
if (index > -1) return "The ".concat(index + 1, "th item: should not be empty");
|
|
1644
|
+
return '';
|
|
1645
|
+
},
|
|
1646
|
+
sort: 7
|
|
1647
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.Expiry, {
|
|
1648
|
+
name: '到期日',
|
|
1649
|
+
key: 'list',
|
|
1650
|
+
Comp: Expiries,
|
|
1651
|
+
validator: expiriesValidator,
|
|
1652
|
+
sort: 8
|
|
1653
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.ExpiryValue, {
|
|
1654
|
+
name: '到期日 Value',
|
|
1655
|
+
key: 'expiryNumberList',
|
|
1656
|
+
Comp: ExpiriesValueList,
|
|
1657
|
+
validator: function validator($val) {
|
|
1658
|
+
if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
|
|
1659
|
+
|
|
1660
|
+
for (var i = 0; i < $val.length; i++) {
|
|
1661
|
+
var val = $val[i];
|
|
1662
|
+
var error = expiryValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
1663
|
+
if (isNullLike(val.expiry) && isNullLike(val.value)) return '';
|
|
1664
|
+
|
|
1665
|
+
if (error) {
|
|
1666
|
+
return "Expiry field of the ".concat(i + 1, "th item: ").concat(error);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
if (isNullLike(val.expiry) && !isNullLike(val.value)) {
|
|
1670
|
+
return "The ".concat(i + 1, "th item: expiry shold not be empty");
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
if (!isNullLike(val.expiry) && isNullLike(val.value)) {
|
|
1674
|
+
return "The ".concat(i + 1, "th item: value shold not be empty");
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
return '';
|
|
1679
|
+
},
|
|
1680
|
+
sort: 9
|
|
1622
1681
|
}), _defineProperty(_ParamTypeConfig, ParamType.ExpiryLimit, {
|
|
1623
1682
|
name: '到期日 Limit',
|
|
1624
1683
|
key: 'expiryLimitList',
|
|
@@ -1654,55 +1713,8 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1654
1713
|
}
|
|
1655
1714
|
|
|
1656
1715
|
return '';
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
name: '到期日',
|
|
1660
|
-
key: 'list',
|
|
1661
|
-
Comp: Expiries,
|
|
1662
|
-
validator: expiriesValidator
|
|
1663
|
-
}), _defineProperty(_ParamTypeConfig, ParamType.Phone, {
|
|
1664
|
-
name: '文本列表',
|
|
1665
|
-
key: 'list',
|
|
1666
|
-
Comp: TextArray,
|
|
1667
|
-
validator: function validator($val) {
|
|
1668
|
-
if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
|
|
1669
|
-
var index = $val.findIndex(function ($it) {
|
|
1670
|
-
return !$it.trim();
|
|
1671
|
-
});
|
|
1672
|
-
if (index > -1) return "The ".concat(index + 1, "th item: should not be empty");
|
|
1673
|
-
return '';
|
|
1674
|
-
}
|
|
1675
|
-
}), _defineProperty(_ParamTypeConfig, ParamType.Text, {
|
|
1676
|
-
name: '文本',
|
|
1677
|
-
key: 'text',
|
|
1678
|
-
Comp: Text,
|
|
1679
|
-
validator: emptyValidator
|
|
1680
|
-
}), _defineProperty(_ParamTypeConfig, ParamType.ExpiryValue, {
|
|
1681
|
-
name: '到期日 Value',
|
|
1682
|
-
key: 'expiryNumberList',
|
|
1683
|
-
Comp: ExpiriesValueList,
|
|
1684
|
-
validator: function validator($val) {
|
|
1685
|
-
if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
|
|
1686
|
-
|
|
1687
|
-
for (var i = 0; i < $val.length; i++) {
|
|
1688
|
-
var val = $val[i];
|
|
1689
|
-
var error = expiryValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
1690
|
-
|
|
1691
|
-
if (error) {
|
|
1692
|
-
return "Expiry field of the ".concat(i + 1, "th item: ").concat(error);
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
if (!isNullLike(val.expiry) && isNullLike(val.value)) {
|
|
1696
|
-
return "The ".concat(i + 1, "th item: expiry shold not be empty");
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
if (isNullLike(val.expiry) && !isNullLike(val.value)) {
|
|
1700
|
-
return "The ".concat(i + 1, "th item: value shold not be empty");
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
|
|
1704
|
-
return '';
|
|
1705
|
-
}
|
|
1716
|
+
},
|
|
1717
|
+
sort: 10
|
|
1706
1718
|
}), _defineProperty(_ParamTypeConfig, ParamType.InstrumentValue, {
|
|
1707
1719
|
name: 'Instrument Value',
|
|
1708
1720
|
key: 'instrumentNumberList',
|
|
@@ -1712,18 +1724,20 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1712
1724
|
|
|
1713
1725
|
for (var i = 0; i < $val.length; i++) {
|
|
1714
1726
|
var val = $val[i];
|
|
1727
|
+
if (isNullLike(val.instrument) && isNullLike(val.value)) return '';
|
|
1715
1728
|
|
|
1716
|
-
if (
|
|
1729
|
+
if (isNullLike(val.instrument) && !isNullLike(val.value)) {
|
|
1717
1730
|
return "The ".concat(i + 1, "th item: instrument shold not be empty");
|
|
1718
1731
|
}
|
|
1719
1732
|
|
|
1720
|
-
if (isNullLike(val.instrument) &&
|
|
1733
|
+
if (!isNullLike(val.instrument) && isNullLike(val.value)) {
|
|
1721
1734
|
return "The ".concat(i + 1, "th item: value shold not be empty");
|
|
1722
1735
|
}
|
|
1723
1736
|
}
|
|
1724
1737
|
|
|
1725
1738
|
return '';
|
|
1726
|
-
}
|
|
1739
|
+
},
|
|
1740
|
+
sort: 11
|
|
1727
1741
|
}), _ParamTypeConfig);
|
|
1728
1742
|
function paramValidator(val, values, enableEmpty) {
|
|
1729
1743
|
var _config$validator;
|
|
@@ -1742,6 +1756,8 @@ var ParamTypeOptions = Object.entries(ParamTypeConfig).map(function (_ref) {
|
|
|
1742
1756
|
value: Number(value),
|
|
1743
1757
|
label: config.name
|
|
1744
1758
|
});
|
|
1759
|
+
}).sort(function (a, b) {
|
|
1760
|
+
return a.sort - b.sort;
|
|
1745
1761
|
});
|
|
1746
1762
|
|
|
1747
1763
|
var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -1891,6 +1907,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1891
1907
|
|
|
1892
1908
|
var valueType = (_this$ref$current$get = (_this$ref$current = this.ref.current) === null || _this$ref$current === void 0 ? void 0 : _this$ref$current.getFieldValue('valueType')) !== null && _this$ref$current$get !== void 0 ? _this$ref$current$get : (_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.valueType;
|
|
1893
1909
|
var config = ParamTypeConfig[valueType];
|
|
1910
|
+
console.log('ParamTypeOptions', ParamTypeOptions);
|
|
1894
1911
|
return [{
|
|
1895
1912
|
label: '所属分组',
|
|
1896
1913
|
name: 'parentId',
|