@pisell/materials 1.0.424 → 1.0.426
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.js +2 -2
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +6 -2
- package/es/components/pisellAdjustPrice/index.js +11 -2
- package/es/components/virtual-keyboard/Amount/index.d.ts +1 -0
- package/es/components/virtual-keyboard/Amount/index.js +5 -1
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.js +6 -2
- package/lib/components/pisellAdjustPrice/index.js +12 -1
- package/lib/components/virtual-keyboard/Amount/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/Amount/index.js +5 -1
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ var PisellAdjustPriceInputNumber = function PisellAdjustPriceInputNumber(props)
|
|
|
25
25
|
setOpen = _useState2[1];
|
|
26
26
|
var handleChange = function handleChange(val) {
|
|
27
27
|
setOpen(false);
|
|
28
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
28
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(val.toFixed(2)));
|
|
29
29
|
};
|
|
30
30
|
var content = useMemo(function () {
|
|
31
31
|
return /*#__PURE__*/React.createElement(PisellAdjustPricePanel, {
|
|
@@ -46,7 +46,11 @@ var PisellAdjustPriceInputNumber = function PisellAdjustPriceInputNumber(props)
|
|
|
46
46
|
onOpenChange: function onOpenChange(val) {
|
|
47
47
|
return setOpen(val);
|
|
48
48
|
},
|
|
49
|
-
destroyTooltipOnHide: true
|
|
49
|
+
destroyTooltipOnHide: true,
|
|
50
|
+
arrow: false,
|
|
51
|
+
align: {
|
|
52
|
+
offset: [0, 20]
|
|
53
|
+
}
|
|
50
54
|
}, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(InputNumber, _extends({}, others, {
|
|
51
55
|
disabled: disabled,
|
|
52
56
|
prefix: prefix,
|
|
@@ -83,6 +83,13 @@ var PisellAdjustPrice = function PisellAdjustPrice(props) {
|
|
|
83
83
|
setUpdateMode(val);
|
|
84
84
|
setNewValue(val === 'priceOverride' ? value || 0 : '');
|
|
85
85
|
};
|
|
86
|
+
var inputFormat = function inputFormat(v) {
|
|
87
|
+
if (discountMode === 'amount') {
|
|
88
|
+
return null;
|
|
89
|
+
} else {
|
|
90
|
+
return "".concat(v, "%");
|
|
91
|
+
}
|
|
92
|
+
};
|
|
86
93
|
return /*#__PURE__*/React.createElement("div", {
|
|
87
94
|
className: "pisell-lowcode-adjust-price-wrap"
|
|
88
95
|
}, /*#__PURE__*/React.createElement(Segmented, {
|
|
@@ -100,7 +107,7 @@ var PisellAdjustPrice = function PisellAdjustPrice(props) {
|
|
|
100
107
|
}), updateMode === 'discount' && /*#__PURE__*/React.createElement(Segmented, {
|
|
101
108
|
size: "large",
|
|
102
109
|
options: [{
|
|
103
|
-
label: "".concat(getText('pisell-adjust-price-discount-amount'), "(").concat((config === null || config === void 0 ? void 0 : config.symbol) ||
|
|
110
|
+
label: "".concat(getText('pisell-adjust-price-discount-amount'), "(").concat((config === null || config === void 0 ? void 0 : config.symbol) || '$', ")"),
|
|
104
111
|
value: 'amount'
|
|
105
112
|
}, {
|
|
106
113
|
label: "".concat(getText('pisell-adjust-price-discount-percentage'), "(%)"),
|
|
@@ -108,12 +115,14 @@ var PisellAdjustPrice = function PisellAdjustPrice(props) {
|
|
|
108
115
|
}],
|
|
109
116
|
value: discountMode,
|
|
110
117
|
onChange: function onChange(val) {
|
|
111
|
-
|
|
118
|
+
setNewValue('');
|
|
119
|
+
setDiscountMode(val);
|
|
112
120
|
},
|
|
113
121
|
block: true
|
|
114
122
|
}), /*#__PURE__*/React.createElement("div", {
|
|
115
123
|
className: "pisell-lowcode-adjust-price-amount-wrap"
|
|
116
124
|
}, /*#__PURE__*/React.createElement(Amount, _extends({}, others, {
|
|
125
|
+
inputFormat: inputFormat,
|
|
117
126
|
defaultValue: updateMode === 'priceOverride' ? defaultValue : '',
|
|
118
127
|
key: updateMode,
|
|
119
128
|
value: newValue,
|
|
@@ -16,6 +16,7 @@ export interface AmountProps {
|
|
|
16
16
|
onChange?: (val: string | number) => void;
|
|
17
17
|
onEnter?: (val: string | number) => void;
|
|
18
18
|
defaultSelect?: boolean;
|
|
19
|
+
inputFormat?: (_v: string) => React.ReactNode | null;
|
|
19
20
|
}
|
|
20
21
|
declare const Amount: (props: AmountProps) => React.JSX.Element;
|
|
21
22
|
export default Amount;
|
|
@@ -18,7 +18,8 @@ var Amount = function Amount(props) {
|
|
|
18
18
|
placeholder = props.placeholder,
|
|
19
19
|
onEnter = props.onEnter,
|
|
20
20
|
presets = props.presets,
|
|
21
|
-
defaultSelect = props.defaultSelect
|
|
21
|
+
defaultSelect = props.defaultSelect,
|
|
22
|
+
inputFormat = props.inputFormat;
|
|
22
23
|
var _useControllableValue = useControllableValue(props, {
|
|
23
24
|
defaultValue: defaultValue || ""
|
|
24
25
|
}),
|
|
@@ -30,6 +31,9 @@ var Amount = function Amount(props) {
|
|
|
30
31
|
}, []);
|
|
31
32
|
var format = function format(_v) {
|
|
32
33
|
var v = "".concat(_v);
|
|
34
|
+
if (inputFormat !== null && inputFormat !== void 0 && inputFormat(v)) {
|
|
35
|
+
return inputFormat === null || inputFormat === void 0 ? void 0 : inputFormat(v);
|
|
36
|
+
}
|
|
33
37
|
// 取value小数位数
|
|
34
38
|
var precision = v.includes('.') ? v.split('.')[1].length : 0;
|
|
35
39
|
var endWith = v.endsWith('.');
|
|
@@ -40,7 +40,7 @@ var PisellAdjustPriceInputNumber = (props) => {
|
|
|
40
40
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
41
41
|
const handleChange = (val) => {
|
|
42
42
|
setOpen(false);
|
|
43
|
-
onChange == null ? void 0 : onChange(val);
|
|
43
|
+
onChange == null ? void 0 : onChange(Number(val.toFixed(2)));
|
|
44
44
|
};
|
|
45
45
|
const content = (0, import_react.useMemo)(() => {
|
|
46
46
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -62,7 +62,11 @@ var PisellAdjustPriceInputNumber = (props) => {
|
|
|
62
62
|
trigger: ["click"],
|
|
63
63
|
overlayInnerStyle: { padding: 0 },
|
|
64
64
|
onOpenChange: (val) => setOpen(val),
|
|
65
|
-
destroyTooltipOnHide: true
|
|
65
|
+
destroyTooltipOnHide: true,
|
|
66
|
+
arrow: false,
|
|
67
|
+
align: {
|
|
68
|
+
offset: [0, 20]
|
|
69
|
+
}
|
|
66
70
|
},
|
|
67
71
|
/* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(
|
|
68
72
|
import_antd.InputNumber,
|
|
@@ -82,6 +82,13 @@ var PisellAdjustPrice = (props) => {
|
|
|
82
82
|
setUpdateMode(val);
|
|
83
83
|
setNewValue(val === "priceOverride" ? value || 0 : "");
|
|
84
84
|
};
|
|
85
|
+
const inputFormat = (v) => {
|
|
86
|
+
if (discountMode === "amount") {
|
|
87
|
+
return null;
|
|
88
|
+
} else {
|
|
89
|
+
return `${v}%`;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
85
92
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-adjust-price-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
86
93
|
import_antd.Segmented,
|
|
87
94
|
{
|
|
@@ -112,13 +119,17 @@ var PisellAdjustPrice = (props) => {
|
|
|
112
119
|
}
|
|
113
120
|
],
|
|
114
121
|
value: discountMode,
|
|
115
|
-
onChange: (val) =>
|
|
122
|
+
onChange: (val) => {
|
|
123
|
+
setNewValue("");
|
|
124
|
+
setDiscountMode(val);
|
|
125
|
+
},
|
|
116
126
|
block: true
|
|
117
127
|
}
|
|
118
128
|
), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-adjust-price-amount-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
119
129
|
import_Amount.default,
|
|
120
130
|
{
|
|
121
131
|
...others,
|
|
132
|
+
inputFormat,
|
|
122
133
|
defaultValue: updateMode === "priceOverride" ? defaultValue : "",
|
|
123
134
|
key: updateMode,
|
|
124
135
|
value: newValue,
|
|
@@ -16,6 +16,7 @@ export interface AmountProps {
|
|
|
16
16
|
onChange?: (val: string | number) => void;
|
|
17
17
|
onEnter?: (val: string | number) => void;
|
|
18
18
|
defaultSelect?: boolean;
|
|
19
|
+
inputFormat?: (_v: string) => React.ReactNode | null;
|
|
19
20
|
}
|
|
20
21
|
declare const Amount: (props: AmountProps) => React.JSX.Element;
|
|
21
22
|
export default Amount;
|
|
@@ -47,7 +47,8 @@ var Amount = (props) => {
|
|
|
47
47
|
placeholder,
|
|
48
48
|
onEnter,
|
|
49
49
|
presets,
|
|
50
|
-
defaultSelect
|
|
50
|
+
defaultSelect,
|
|
51
|
+
inputFormat
|
|
51
52
|
} = props;
|
|
52
53
|
const [value, setValue] = (0, import_ahooks.useControllableValue)(props, {
|
|
53
54
|
defaultValue: defaultValue || ""
|
|
@@ -57,6 +58,9 @@ var Amount = (props) => {
|
|
|
57
58
|
}, []);
|
|
58
59
|
const format = (_v) => {
|
|
59
60
|
const v = `${_v}`;
|
|
61
|
+
if (inputFormat == null ? void 0 : inputFormat(v)) {
|
|
62
|
+
return inputFormat == null ? void 0 : inputFormat(v);
|
|
63
|
+
}
|
|
60
64
|
const precision = v.includes(".") ? v.split(".")[1].length : 0;
|
|
61
65
|
const endWith = v.endsWith(".");
|
|
62
66
|
const value2 = endWith ? v.slice(0, -1) : v;
|