@signalplus/params-about 1.0.5-alpha2 → 1.0.5-alpha3
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 +73 -58
- 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
3
|
* Generated: 2023-05-11
|
|
4
|
-
* Version: 1.0.5-
|
|
4
|
+
* Version: 1.0.5-alpha3
|
|
5
5
|
* License: MIT
|
|
6
6
|
* Author: 2631541504@qq.com
|
|
7
7
|
*/
|
|
@@ -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,48 +1623,14 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1618
1623
|
}));
|
|
1619
1624
|
},
|
|
1620
1625
|
validator: numRangeValidator,
|
|
1621
|
-
required: true
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
for (var i = 0; i < $val.length; i++) {
|
|
1630
|
-
var val = $val[i];
|
|
1631
|
-
var error = expiryValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
1632
|
-
|
|
1633
|
-
if (error) {
|
|
1634
|
-
// return { [i]: { expire: error } }
|
|
1635
|
-
return "Expiry field of the ".concat(i + 1, "th item: ").concat(error);
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
if ((isNullLike(val === null || val === void 0 ? void 0 : val.minAumPercentage) || isNullLike(val === null || val === void 0 ? void 0 : val.maxAumPercentage)) && (isNullLike(val === null || val === void 0 ? void 0 : val.minAbs) || isNullLike(val === null || val === void 0 ? void 0 : val.maxAbs))) {
|
|
1639
|
-
// return {
|
|
1640
|
-
// [i]: 'at least one parameter must be specified between AUM and ABS',
|
|
1641
|
-
// }
|
|
1642
|
-
return "The ".concat(i + 1, "th item: at least one parameter must be specified between AUM and ABS");
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAbs) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAbs)) && +val.minAbs >= +val.maxAbs) // return { [i]: { minAbs: 'Min ABS should smaller than Max ABS' } }
|
|
1646
|
-
return "The ".concat(i + 1, "th item: Min ABS should smaller than Max ABS");
|
|
1647
|
-
|
|
1648
|
-
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAumPercentage) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAumPercentage)) && +val.minAumPercentage >= +val.maxAumPercentage) {
|
|
1649
|
-
// return {
|
|
1650
|
-
// [i]: { minAumPercentage: 'Min AUM should smaller than Max AUM' },
|
|
1651
|
-
// }
|
|
1652
|
-
return "The ".concat(i + 1, "th item: Min AUM should smaller than Max AUM");
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
return '';
|
|
1657
|
-
}
|
|
1658
|
-
}), _defineProperty(_ParamTypeConfig, ParamType.Expiry, {
|
|
1659
|
-
name: '到期日',
|
|
1660
|
-
key: 'list',
|
|
1661
|
-
Comp: Expiries,
|
|
1662
|
-
validator: expiriesValidator
|
|
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
|
|
1663
1634
|
}), _defineProperty(_ParamTypeConfig, ParamType.Phone, {
|
|
1664
1635
|
name: '文本列表',
|
|
1665
1636
|
key: 'list',
|
|
@@ -1671,12 +1642,14 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1671
1642
|
});
|
|
1672
1643
|
if (index > -1) return "The ".concat(index + 1, "th item: should not be empty");
|
|
1673
1644
|
return '';
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1645
|
+
},
|
|
1646
|
+
sort: 7
|
|
1647
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.Expiry, {
|
|
1648
|
+
name: '到期日',
|
|
1649
|
+
key: 'list',
|
|
1650
|
+
Comp: Expiries,
|
|
1651
|
+
validator: expiriesValidator,
|
|
1652
|
+
sort: 8
|
|
1680
1653
|
}), _defineProperty(_ParamTypeConfig, ParamType.ExpiryValue, {
|
|
1681
1654
|
name: '到期日 Value',
|
|
1682
1655
|
key: 'expiryNumberList',
|
|
@@ -1702,7 +1675,45 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1702
1675
|
}
|
|
1703
1676
|
|
|
1704
1677
|
return '';
|
|
1705
|
-
}
|
|
1678
|
+
},
|
|
1679
|
+
sort: 9
|
|
1680
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.ExpiryLimit, {
|
|
1681
|
+
name: '到期日 Limit',
|
|
1682
|
+
key: 'expiryLimitList',
|
|
1683
|
+
Comp: ExpiriesLimit,
|
|
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 { [i]: { expire: error } }
|
|
1693
|
+
return "Expiry field of the ".concat(i + 1, "th item: ").concat(error);
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
if ((isNullLike(val === null || val === void 0 ? void 0 : val.minAumPercentage) || isNullLike(val === null || val === void 0 ? void 0 : val.maxAumPercentage)) && (isNullLike(val === null || val === void 0 ? void 0 : val.minAbs) || isNullLike(val === null || val === void 0 ? void 0 : val.maxAbs))) {
|
|
1697
|
+
// return {
|
|
1698
|
+
// [i]: 'at least one parameter must be specified between AUM and ABS',
|
|
1699
|
+
// }
|
|
1700
|
+
return "The ".concat(i + 1, "th item: at least one parameter must be specified between AUM and ABS");
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAbs) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAbs)) && +val.minAbs >= +val.maxAbs) // return { [i]: { minAbs: 'Min ABS should smaller than Max ABS' } }
|
|
1704
|
+
return "The ".concat(i + 1, "th item: Min ABS should smaller than Max ABS");
|
|
1705
|
+
|
|
1706
|
+
if ((!isNullLike(val === null || val === void 0 ? void 0 : val.minAumPercentage) || !isNullLike(val === null || val === void 0 ? void 0 : val.maxAumPercentage)) && +val.minAumPercentage >= +val.maxAumPercentage) {
|
|
1707
|
+
// return {
|
|
1708
|
+
// [i]: { minAumPercentage: 'Min AUM should smaller than Max AUM' },
|
|
1709
|
+
// }
|
|
1710
|
+
return "The ".concat(i + 1, "th item: Min AUM should smaller than Max AUM");
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
return '';
|
|
1715
|
+
},
|
|
1716
|
+
sort: 10
|
|
1706
1717
|
}), _defineProperty(_ParamTypeConfig, ParamType.InstrumentValue, {
|
|
1707
1718
|
name: 'Instrument Value',
|
|
1708
1719
|
key: 'instrumentNumberList',
|
|
@@ -1723,7 +1734,8 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1723
1734
|
}
|
|
1724
1735
|
|
|
1725
1736
|
return '';
|
|
1726
|
-
}
|
|
1737
|
+
},
|
|
1738
|
+
sort: 11
|
|
1727
1739
|
}), _ParamTypeConfig);
|
|
1728
1740
|
function paramValidator(val, values, enableEmpty) {
|
|
1729
1741
|
var _config$validator;
|
|
@@ -1742,6 +1754,8 @@ var ParamTypeOptions = Object.entries(ParamTypeConfig).map(function (_ref) {
|
|
|
1742
1754
|
value: Number(value),
|
|
1743
1755
|
label: config.name
|
|
1744
1756
|
});
|
|
1757
|
+
}).sort(function (a, b) {
|
|
1758
|
+
return a.sort - b.sort;
|
|
1745
1759
|
});
|
|
1746
1760
|
|
|
1747
1761
|
var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -1891,6 +1905,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1891
1905
|
|
|
1892
1906
|
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
1907
|
var config = ParamTypeConfig[valueType];
|
|
1908
|
+
console.log('ParamTypeOptions', ParamTypeOptions);
|
|
1894
1909
|
return [{
|
|
1895
1910
|
label: '所属分组',
|
|
1896
1911
|
name: 'parentId',
|