@pisell/materials 1.10.25 → 1.10.27
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 +25 -25
- package/build/lowcode/view.js +32 -32
- package/es/components/pisellText/components/Editable/index.d.ts +2 -0
- package/es/components/pisellText/components/Editable/index.js +1 -0
- package/es/components/translation/index.d.ts +2 -0
- package/es/components/translation/index.js +24 -7
- package/es/components/walletCard/index.d.ts +10 -9
- package/es/components/walletCard/index.js +29 -8
- package/lib/components/pisellText/components/Editable/index.d.ts +2 -0
- package/lib/components/pisellText/components/Editable/index.js +1 -0
- package/lib/components/translation/index.d.ts +2 -0
- package/lib/components/translation/index.js +24 -7
- package/lib/components/walletCard/index.d.ts +10 -9
- package/lib/components/walletCard/index.js +29 -8
- package/package.json +1 -1
|
@@ -15,6 +15,8 @@ interface EditableConfig {
|
|
|
15
15
|
maxLength?: number;
|
|
16
16
|
/** 编辑图标 */
|
|
17
17
|
icon?: React.ReactNode;
|
|
18
|
+
/** 多语言输入框在翻译缺失时显示原文,保持原始保存值。 */
|
|
19
|
+
fallbackToOriginal?: boolean;
|
|
18
20
|
}
|
|
19
21
|
interface EditableProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
20
22
|
/** 文本内容,支持字符串或多语言对象 */
|
|
@@ -9,7 +9,16 @@ import { GlobalOutlined } from "@ant-design/icons";
|
|
|
9
9
|
import classNames from "classnames";
|
|
10
10
|
import "./index.less";
|
|
11
11
|
//#region src/components/translation/index.tsx
|
|
12
|
-
const _excluded = [
|
|
12
|
+
const _excluded = [
|
|
13
|
+
"value",
|
|
14
|
+
"onChange",
|
|
15
|
+
"fallbackToOriginal"
|
|
16
|
+
];
|
|
17
|
+
const getTranslationInputValue = (value, locale, fallbackToOriginal) => {
|
|
18
|
+
var _translations$locale;
|
|
19
|
+
const translations = value;
|
|
20
|
+
return (_translations$locale = translations === null || translations === void 0 ? void 0 : translations[locale]) !== null && _translations$locale !== void 0 ? _translations$locale : fallbackToOriginal ? (translations === null || translations === void 0 ? void 0 : translations.original) || (translations === null || translations === void 0 ? void 0 : translations.auto) || "" : "";
|
|
21
|
+
};
|
|
13
22
|
const defaultGlobal = {
|
|
14
23
|
shopLanguages: {
|
|
15
24
|
primary: "en",
|
|
@@ -56,7 +65,7 @@ const defaultGlobal = {
|
|
|
56
65
|
const defaultObj = {};
|
|
57
66
|
const Translation = (props) => {
|
|
58
67
|
var _context$appHelper, _store$getState;
|
|
59
|
-
const { value = defaultObj, onChange } = props, others = _objectWithoutProperties(props, _excluded);
|
|
68
|
+
const { value = defaultObj, onChange, fallbackToOriginal = false } = props, others = _objectWithoutProperties(props, _excluded);
|
|
60
69
|
const context = useEngineContext();
|
|
61
70
|
const [open, setOpen] = useState(false);
|
|
62
71
|
const [_value, set_value] = useState(value);
|
|
@@ -65,15 +74,19 @@ const Translation = (props) => {
|
|
|
65
74
|
useEffect(() => {
|
|
66
75
|
let _newValue = _objectSpread2({}, value);
|
|
67
76
|
if (isString(value)) _newValue = createTranslationText(value);
|
|
68
|
-
set_value(_objectSpread2(_objectSpread2({}, defaultValue), _newValue));
|
|
69
|
-
}, [value]);
|
|
77
|
+
set_value(fallbackToOriginal ? _newValue : _objectSpread2(_objectSpread2({}, defaultValue), _newValue));
|
|
78
|
+
}, [value, fallbackToOriginal]);
|
|
70
79
|
const currentLocale = useMemo(() => {
|
|
71
80
|
return shopLanguages.primary;
|
|
72
81
|
}, [shopLanguages.primary]);
|
|
73
82
|
const inputValue = useMemo(() => {
|
|
74
83
|
if (isString(value)) return value;
|
|
75
|
-
return value
|
|
76
|
-
}, [
|
|
84
|
+
return getTranslationInputValue(value, currentLocale, fallbackToOriginal);
|
|
85
|
+
}, [
|
|
86
|
+
value,
|
|
87
|
+
currentLocale,
|
|
88
|
+
fallbackToOriginal
|
|
89
|
+
]);
|
|
77
90
|
const languageList = useMemo(() => {
|
|
78
91
|
return shopLanguages.list;
|
|
79
92
|
}, [shopLanguages.list]);
|
|
@@ -83,6 +96,10 @@ const Translation = (props) => {
|
|
|
83
96
|
return obj;
|
|
84
97
|
}, []);
|
|
85
98
|
const allChange = (e) => {
|
|
99
|
+
if (fallbackToOriginal) {
|
|
100
|
+
onChange === null || onChange === void 0 || onChange(_objectSpread2(_objectSpread2({}, value), {}, { [currentLocale]: e || "" }));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
86
103
|
let newValue = _objectSpread2(_objectSpread2({}, defaultValue), value || {});
|
|
87
104
|
if (checkIfAllValuesAreEqual(newValue)) for (let key in newValue) newValue[key] = e || "";
|
|
88
105
|
else newValue[currentLocale] = e || "";
|
|
@@ -117,7 +134,7 @@ const Translation = (props) => {
|
|
|
117
134
|
labelCol: { span: 24 },
|
|
118
135
|
key: d.code
|
|
119
136
|
}, /* @__PURE__ */ React.createElement(Input, _objectSpread2(_objectSpread2({}, typeof others.maxLength === "number" ? { maxLength: others.maxLength } : {}), {}, {
|
|
120
|
-
value: _value
|
|
137
|
+
value: getTranslationInputValue(_value, d.code, fallbackToOriginal),
|
|
121
138
|
onChange: (e) => {
|
|
122
139
|
set_value(_objectSpread2(_objectSpread2({}, _value), {}, { [d.code]: e.target.value }));
|
|
123
140
|
}
|
|
@@ -2,20 +2,21 @@ import React from "react";
|
|
|
2
2
|
//#region src/components/walletCard/index.d.ts
|
|
3
3
|
interface WalletCardItem {
|
|
4
4
|
type: string;
|
|
5
|
-
custom_title?: string |
|
|
6
|
-
original: string;
|
|
7
|
-
en: string;
|
|
8
|
-
'zh-CN': string;
|
|
9
|
-
'zh-HK': string;
|
|
10
|
-
'ja': string;
|
|
11
|
-
'pt': string;
|
|
12
|
-
};
|
|
5
|
+
custom_title?: string | Record<string, string | null | undefined>;
|
|
13
6
|
display?: 0 | 1;
|
|
14
7
|
value?: number;
|
|
8
|
+
virtual_currency_info?: {
|
|
9
|
+
product_id: number | string;
|
|
10
|
+
total_balance?: number;
|
|
11
|
+
symbol?: Record<string, string | null | undefined> | [];
|
|
12
|
+
unit_label?: Record<string, string | null | undefined> | [];
|
|
13
|
+
amount_format?: string;
|
|
14
|
+
theme_color?: string;
|
|
15
|
+
};
|
|
15
16
|
}
|
|
16
17
|
interface WalletCardProps {
|
|
17
18
|
/** 钱包ID */
|
|
18
|
-
id?: string;
|
|
19
|
+
id?: number | string;
|
|
19
20
|
/** 二维码弹窗适配平台 */
|
|
20
21
|
platform?: 'pc' | 'h5' | 'ipad';
|
|
21
22
|
/** 卡片主题 */
|
|
@@ -7,6 +7,7 @@ import Amount from "../pisellText/components/Amount/index.js";
|
|
|
7
7
|
import Guest from "./Guest/index.js";
|
|
8
8
|
import Guide from "./Guide/index.js";
|
|
9
9
|
import React, { useMemo, useState } from "react";
|
|
10
|
+
import { formatAmountWithOptions } from "@pisell/utils";
|
|
10
11
|
import { Button, Card, QRCode } from "antd";
|
|
11
12
|
import classNames from "classnames";
|
|
12
13
|
import Barcode from "react-barcode";
|
|
@@ -152,30 +153,50 @@ const CardHeader = ({ showIcon = true, showWalletName = true, showShopName = tru
|
|
|
152
153
|
}))));
|
|
153
154
|
};
|
|
154
155
|
const CardItem = ({ item, symbol }) => {
|
|
155
|
-
var _context$appHelper2;
|
|
156
|
+
var _context$appHelper2, _item$virtual_currenc, _item$virtual_currenc2, _currencyInfo$theme_c, _ref;
|
|
156
157
|
const { type, custom_title, value } = item;
|
|
157
158
|
const context = useEngineContext();
|
|
158
159
|
const utils = context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils;
|
|
159
160
|
const translationOriginal = (utils === null || utils === void 0 ? void 0 : utils.translationOriginal) || (utils === null || utils === void 0 ? void 0 : utils.translation);
|
|
160
|
-
|
|
161
|
+
const translate = (text) => {
|
|
162
|
+
if (typeof text === "string") return text;
|
|
163
|
+
if (!text || Array.isArray(text)) return "";
|
|
164
|
+
const translated = translationOriginal === null || translationOriginal === void 0 ? void 0 : translationOriginal(text);
|
|
165
|
+
return typeof translated === "string" && translated ? translated : text.original || text.en || "";
|
|
166
|
+
};
|
|
167
|
+
const currencyInfo = item.virtual_currency_info;
|
|
168
|
+
const title = custom_title || (type === "virtual_currency" ? `Virtual currency #${(_item$virtual_currenc = (_item$virtual_currenc2 = item.virtual_currency_info) === null || _item$virtual_currenc2 === void 0 ? void 0 : _item$virtual_currenc2.product_id) !== null && _item$virtual_currenc !== void 0 ? _item$virtual_currenc : ""}` : "");
|
|
169
|
+
return /* @__PURE__ */ React.createElement("div", { className: "pisell-wallet-card-item" }, /* @__PURE__ */ React.createElement("div", { className: "pisell-wallet-card-item-label" }, translate(title)), /* @__PURE__ */ React.createElement("div", {
|
|
170
|
+
className: "pisell-wallet-card-item-value",
|
|
171
|
+
style: type === "virtual_currency" ? { color: (currencyInfo === null || currencyInfo === void 0 || (_currencyInfo$theme_c = currencyInfo.theme_color) === null || _currencyInfo$theme_c === void 0 ? void 0 : _currencyInfo$theme_c.trim()) || void 0 } : void 0
|
|
172
|
+
}, type === "rechargeable" ? /* @__PURE__ */ React.createElement(Amount, {
|
|
161
173
|
className: "pisell-card-amount-item-value",
|
|
162
174
|
platform: "h5",
|
|
163
175
|
symbol,
|
|
164
176
|
useThousandsSeparator: true,
|
|
165
177
|
showCurrencySymbol: true,
|
|
166
178
|
value
|
|
179
|
+
}) : type === "virtual_currency" ? formatAmountWithOptions((_ref = value !== null && value !== void 0 ? value : currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.total_balance) !== null && _ref !== void 0 ? _ref : 0, translate(currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.symbol), {
|
|
180
|
+
precision: 2,
|
|
181
|
+
hideDecimalForWholeNumbers: false,
|
|
182
|
+
useThousandsSeparator: true,
|
|
183
|
+
currencyCode: translate(currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.unit_label),
|
|
184
|
+
currencyFormat: (currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.amount_format) || ""
|
|
167
185
|
}) : value || "0"));
|
|
168
186
|
};
|
|
169
187
|
const CardContent = ({ items, symbol }) => {
|
|
170
|
-
const filteredItems = (items || []).filter((item) => item.display !== 0);
|
|
188
|
+
const filteredItems = (items || []).filter((item) => item.type === "virtual_currency" ? item.display === 1 : item.display !== 0).slice(0, 4);
|
|
171
189
|
return /* @__PURE__ */ React.createElement("div", {
|
|
172
190
|
className: "pisell-wallet-card-list",
|
|
173
191
|
style: { justifyContent: filteredItems.length > 1 ? "space-between" : "flex-start" }
|
|
174
|
-
}, filteredItems.map((item, index) =>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
}, filteredItems.map((item, index) => {
|
|
193
|
+
var _item$virtual_currenc3, _item$virtual_currenc4;
|
|
194
|
+
return /* @__PURE__ */ React.createElement(CardItem, {
|
|
195
|
+
key: item.type === "virtual_currency" ? `virtual_currency:${(_item$virtual_currenc3 = (_item$virtual_currenc4 = item.virtual_currency_info) === null || _item$virtual_currenc4 === void 0 ? void 0 : _item$virtual_currenc4.product_id) !== null && _item$virtual_currenc3 !== void 0 ? _item$virtual_currenc3 : index}` : item.type,
|
|
196
|
+
item,
|
|
197
|
+
symbol
|
|
198
|
+
});
|
|
199
|
+
}));
|
|
179
200
|
};
|
|
180
201
|
const CodeDisplay = ({ codeType, cardNo }) => {
|
|
181
202
|
if (!cardNo) return null;
|
|
@@ -15,6 +15,8 @@ interface EditableConfig {
|
|
|
15
15
|
maxLength?: number;
|
|
16
16
|
/** 编辑图标 */
|
|
17
17
|
icon?: React.ReactNode;
|
|
18
|
+
/** 多语言输入框在翻译缺失时显示原文,保持原始保存值。 */
|
|
19
|
+
fallbackToOriginal?: boolean;
|
|
18
20
|
}
|
|
19
21
|
interface EditableProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
20
22
|
/** 文本内容,支持字符串或多语言对象 */
|
|
@@ -12,7 +12,16 @@ let classnames = require("classnames");
|
|
|
12
12
|
classnames = require_runtime.__toESM(classnames);
|
|
13
13
|
require("./index.less");
|
|
14
14
|
//#region src/components/translation/index.tsx
|
|
15
|
-
const _excluded = [
|
|
15
|
+
const _excluded = [
|
|
16
|
+
"value",
|
|
17
|
+
"onChange",
|
|
18
|
+
"fallbackToOriginal"
|
|
19
|
+
];
|
|
20
|
+
const getTranslationInputValue = (value, locale, fallbackToOriginal) => {
|
|
21
|
+
var _translations$locale;
|
|
22
|
+
const translations = value;
|
|
23
|
+
return (_translations$locale = translations === null || translations === void 0 ? void 0 : translations[locale]) !== null && _translations$locale !== void 0 ? _translations$locale : fallbackToOriginal ? (translations === null || translations === void 0 ? void 0 : translations.original) || (translations === null || translations === void 0 ? void 0 : translations.auto) || "" : "";
|
|
24
|
+
};
|
|
16
25
|
const defaultGlobal = {
|
|
17
26
|
shopLanguages: {
|
|
18
27
|
primary: "en",
|
|
@@ -59,7 +68,7 @@ const defaultGlobal = {
|
|
|
59
68
|
const defaultObj = {};
|
|
60
69
|
const Translation = (props) => {
|
|
61
70
|
var _context$appHelper, _store$getState;
|
|
62
|
-
const { value = defaultObj, onChange } = props, others = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
71
|
+
const { value = defaultObj, onChange, fallbackToOriginal = false } = props, others = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
|
|
63
72
|
const context = require_useEngineContext.default();
|
|
64
73
|
const [open, setOpen] = (0, react.useState)(false);
|
|
65
74
|
const [_value, set_value] = (0, react.useState)(value);
|
|
@@ -68,15 +77,19 @@ const Translation = (props) => {
|
|
|
68
77
|
(0, react.useEffect)(() => {
|
|
69
78
|
let _newValue = require_objectSpread2._objectSpread2({}, value);
|
|
70
79
|
if ((0, _pisell_utils.isString)(value)) _newValue = require_utils.createTranslationText(value);
|
|
71
|
-
set_value(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultValue), _newValue));
|
|
72
|
-
}, [value]);
|
|
80
|
+
set_value(fallbackToOriginal ? _newValue : require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultValue), _newValue));
|
|
81
|
+
}, [value, fallbackToOriginal]);
|
|
73
82
|
const currentLocale = (0, react.useMemo)(() => {
|
|
74
83
|
return shopLanguages.primary;
|
|
75
84
|
}, [shopLanguages.primary]);
|
|
76
85
|
const inputValue = (0, react.useMemo)(() => {
|
|
77
86
|
if ((0, _pisell_utils.isString)(value)) return value;
|
|
78
|
-
return value
|
|
79
|
-
}, [
|
|
87
|
+
return getTranslationInputValue(value, currentLocale, fallbackToOriginal);
|
|
88
|
+
}, [
|
|
89
|
+
value,
|
|
90
|
+
currentLocale,
|
|
91
|
+
fallbackToOriginal
|
|
92
|
+
]);
|
|
80
93
|
const languageList = (0, react.useMemo)(() => {
|
|
81
94
|
return shopLanguages.list;
|
|
82
95
|
}, [shopLanguages.list]);
|
|
@@ -86,6 +99,10 @@ const Translation = (props) => {
|
|
|
86
99
|
return obj;
|
|
87
100
|
}, []);
|
|
88
101
|
const allChange = (e) => {
|
|
102
|
+
if (fallbackToOriginal) {
|
|
103
|
+
onChange === null || onChange === void 0 || onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, value), {}, { [currentLocale]: e || "" }));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
89
106
|
let newValue = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultValue), value || {});
|
|
90
107
|
if (require_utils.checkIfAllValuesAreEqual(newValue)) for (let key in newValue) newValue[key] = e || "";
|
|
91
108
|
else newValue[currentLocale] = e || "";
|
|
@@ -120,7 +137,7 @@ const Translation = (props) => {
|
|
|
120
137
|
labelCol: { span: 24 },
|
|
121
138
|
key: d.code
|
|
122
139
|
}, /* @__PURE__ */ react.default.createElement(antd.Input, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, typeof others.maxLength === "number" ? { maxLength: others.maxLength } : {}), {}, {
|
|
123
|
-
value: _value
|
|
140
|
+
value: getTranslationInputValue(_value, d.code, fallbackToOriginal),
|
|
124
141
|
onChange: (e) => {
|
|
125
142
|
set_value(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, _value), {}, { [d.code]: e.target.value }));
|
|
126
143
|
}
|
|
@@ -2,20 +2,21 @@ import React from "react";
|
|
|
2
2
|
//#region src/components/walletCard/index.d.ts
|
|
3
3
|
interface WalletCardItem {
|
|
4
4
|
type: string;
|
|
5
|
-
custom_title?: string |
|
|
6
|
-
original: string;
|
|
7
|
-
en: string;
|
|
8
|
-
'zh-CN': string;
|
|
9
|
-
'zh-HK': string;
|
|
10
|
-
'ja': string;
|
|
11
|
-
'pt': string;
|
|
12
|
-
};
|
|
5
|
+
custom_title?: string | Record<string, string | null | undefined>;
|
|
13
6
|
display?: 0 | 1;
|
|
14
7
|
value?: number;
|
|
8
|
+
virtual_currency_info?: {
|
|
9
|
+
product_id: number | string;
|
|
10
|
+
total_balance?: number;
|
|
11
|
+
symbol?: Record<string, string | null | undefined> | [];
|
|
12
|
+
unit_label?: Record<string, string | null | undefined> | [];
|
|
13
|
+
amount_format?: string;
|
|
14
|
+
theme_color?: string;
|
|
15
|
+
};
|
|
15
16
|
}
|
|
16
17
|
interface WalletCardProps {
|
|
17
18
|
/** 钱包ID */
|
|
18
|
-
id?: string;
|
|
19
|
+
id?: number | string;
|
|
19
20
|
/** 二维码弹窗适配平台 */
|
|
20
21
|
platform?: 'pc' | 'h5' | 'ipad';
|
|
21
22
|
/** 卡片主题 */
|
|
@@ -9,6 +9,7 @@ const require_index$4 = require("./Guest/index.js");
|
|
|
9
9
|
const require_index$5 = require("./Guide/index.js");
|
|
10
10
|
let react = require("react");
|
|
11
11
|
react = require_runtime.__toESM(react);
|
|
12
|
+
let _pisell_utils = require("@pisell/utils");
|
|
12
13
|
let antd = require("antd");
|
|
13
14
|
let classnames = require("classnames");
|
|
14
15
|
classnames = require_runtime.__toESM(classnames);
|
|
@@ -157,30 +158,50 @@ const CardHeader = ({ showIcon = true, showWalletName = true, showShopName = tru
|
|
|
157
158
|
}))));
|
|
158
159
|
};
|
|
159
160
|
const CardItem = ({ item, symbol }) => {
|
|
160
|
-
var _context$appHelper2;
|
|
161
|
+
var _context$appHelper2, _item$virtual_currenc, _item$virtual_currenc2, _currencyInfo$theme_c, _ref;
|
|
161
162
|
const { type, custom_title, value } = item;
|
|
162
163
|
const context = require_useEngineContext.default();
|
|
163
164
|
const utils = context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils;
|
|
164
165
|
const translationOriginal = (utils === null || utils === void 0 ? void 0 : utils.translationOriginal) || (utils === null || utils === void 0 ? void 0 : utils.translation);
|
|
165
|
-
|
|
166
|
+
const translate = (text) => {
|
|
167
|
+
if (typeof text === "string") return text;
|
|
168
|
+
if (!text || Array.isArray(text)) return "";
|
|
169
|
+
const translated = translationOriginal === null || translationOriginal === void 0 ? void 0 : translationOriginal(text);
|
|
170
|
+
return typeof translated === "string" && translated ? translated : text.original || text.en || "";
|
|
171
|
+
};
|
|
172
|
+
const currencyInfo = item.virtual_currency_info;
|
|
173
|
+
const title = custom_title || (type === "virtual_currency" ? `Virtual currency #${(_item$virtual_currenc = (_item$virtual_currenc2 = item.virtual_currency_info) === null || _item$virtual_currenc2 === void 0 ? void 0 : _item$virtual_currenc2.product_id) !== null && _item$virtual_currenc !== void 0 ? _item$virtual_currenc : ""}` : "");
|
|
174
|
+
return /* @__PURE__ */ react.default.createElement("div", { className: "pisell-wallet-card-item" }, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-wallet-card-item-label" }, translate(title)), /* @__PURE__ */ react.default.createElement("div", {
|
|
175
|
+
className: "pisell-wallet-card-item-value",
|
|
176
|
+
style: type === "virtual_currency" ? { color: (currencyInfo === null || currencyInfo === void 0 || (_currencyInfo$theme_c = currencyInfo.theme_color) === null || _currencyInfo$theme_c === void 0 ? void 0 : _currencyInfo$theme_c.trim()) || void 0 } : void 0
|
|
177
|
+
}, type === "rechargeable" ? /* @__PURE__ */ react.default.createElement(require_index$3.default, {
|
|
166
178
|
className: "pisell-card-amount-item-value",
|
|
167
179
|
platform: "h5",
|
|
168
180
|
symbol,
|
|
169
181
|
useThousandsSeparator: true,
|
|
170
182
|
showCurrencySymbol: true,
|
|
171
183
|
value
|
|
184
|
+
}) : type === "virtual_currency" ? (0, _pisell_utils.formatAmountWithOptions)((_ref = value !== null && value !== void 0 ? value : currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.total_balance) !== null && _ref !== void 0 ? _ref : 0, translate(currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.symbol), {
|
|
185
|
+
precision: 2,
|
|
186
|
+
hideDecimalForWholeNumbers: false,
|
|
187
|
+
useThousandsSeparator: true,
|
|
188
|
+
currencyCode: translate(currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.unit_label),
|
|
189
|
+
currencyFormat: (currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.amount_format) || ""
|
|
172
190
|
}) : value || "0"));
|
|
173
191
|
};
|
|
174
192
|
const CardContent = ({ items, symbol }) => {
|
|
175
|
-
const filteredItems = (items || []).filter((item) => item.display !== 0);
|
|
193
|
+
const filteredItems = (items || []).filter((item) => item.type === "virtual_currency" ? item.display === 1 : item.display !== 0).slice(0, 4);
|
|
176
194
|
return /* @__PURE__ */ react.default.createElement("div", {
|
|
177
195
|
className: "pisell-wallet-card-list",
|
|
178
196
|
style: { justifyContent: filteredItems.length > 1 ? "space-between" : "flex-start" }
|
|
179
|
-
}, filteredItems.map((item, index) =>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
197
|
+
}, filteredItems.map((item, index) => {
|
|
198
|
+
var _item$virtual_currenc3, _item$virtual_currenc4;
|
|
199
|
+
return /* @__PURE__ */ react.default.createElement(CardItem, {
|
|
200
|
+
key: item.type === "virtual_currency" ? `virtual_currency:${(_item$virtual_currenc3 = (_item$virtual_currenc4 = item.virtual_currency_info) === null || _item$virtual_currenc4 === void 0 ? void 0 : _item$virtual_currenc4.product_id) !== null && _item$virtual_currenc3 !== void 0 ? _item$virtual_currenc3 : index}` : item.type,
|
|
201
|
+
item,
|
|
202
|
+
symbol
|
|
203
|
+
});
|
|
204
|
+
}));
|
|
184
205
|
};
|
|
185
206
|
const CodeDisplay = ({ codeType, cardNo }) => {
|
|
186
207
|
if (!cardNo) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.27",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev:tailwind-css": "tailwindcss -c ./tailwind.materials.config.cjs --postcss ./postcss.materials-tailwind.cjs -i ./src/tailwind-input.css -o ./src/pisell-materials.tw.css --watch",
|
|
6
6
|
"build:tailwind-css:once": "tailwindcss -c ./tailwind.materials.config.cjs --postcss ./postcss.materials-tailwind.cjs -i ./src/tailwind-input.css -o ./src/pisell-materials.tw.css",
|