pb-sxp-ui 1.5.0 → 1.5.2
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/index.cjs +20 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +20 -8
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/WaterFall/List.js +2 -1
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +2 -1
- package/es/core/utils/materials.d.ts +3 -2
- package/es/core/utils/materials.js +14 -5
- package/lib/core/components/SxpPageRender/WaterFall/List.js +2 -1
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +2 -1
- package/lib/core/utils/materials.d.ts +3 -2
- package/lib/core/utils/materials.js +14 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -9205,7 +9205,7 @@ var CommodityGroup$1 = React.memo(CommodityGroup);
|
|
9205
9205
|
* @Author: binruan@chatlabs.com
|
9206
9206
|
* @Date: 2024-03-20 14:56:16
|
9207
9207
|
* @LastEditors: binruan@chatlabs.com
|
9208
|
-
* @LastEditTime: 2024-09-
|
9208
|
+
* @LastEditTime: 2024-09-14 10:07:47
|
9209
9209
|
* @FilePath: \pb-sxp-ui\src\core\utils\materials.ts
|
9210
9210
|
*
|
9211
9211
|
*/
|
@@ -9232,13 +9232,15 @@ const getMediaValueByMode = (obj) => {
|
|
9232
9232
|
return file && file.length > 0 ? (_a = file[0]) === null || _a === void 0 ? void 0 : _a.url : null;
|
9233
9233
|
}
|
9234
9234
|
};
|
9235
|
-
const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
|
9235
|
+
const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef }) => {
|
9236
9236
|
var _a, _b, _c, _d, _e;
|
9237
|
+
if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
|
9238
|
+
return null;
|
9237
9239
|
let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
|
9238
9240
|
let text = '';
|
9239
9241
|
let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
|
9240
9242
|
let currency = (product === null || product === void 0 ? void 0 : product.currency) ? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : '' : '$';
|
9241
|
-
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice
|
9243
|
+
const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
|
9242
9244
|
let decPic = price.toString();
|
9243
9245
|
if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
|
9244
9246
|
decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
|
@@ -9252,7 +9254,7 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
|
|
9252
9254
|
let startIndex = 0;
|
9253
9255
|
let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
|
9254
9256
|
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
|
9255
|
-
text = text === null || text === void 0 ? void 0 : text.replace(
|
9257
|
+
text = text === null || text === void 0 ? void 0 : text.replace(/\,/g, function (match, index) {
|
9256
9258
|
if (index >= startIndex && index < endIndex) {
|
9257
9259
|
return '.';
|
9258
9260
|
}
|
@@ -9268,8 +9270,16 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
|
|
9268
9270
|
else {
|
9269
9271
|
text = `${(priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? price === null || price === void 0 ? void 0 : price.toFixed(2) : price}`;
|
9270
9272
|
}
|
9271
|
-
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0
|
9272
|
-
text = text.slice(0, decInd
|
9273
|
+
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0) {
|
9274
|
+
// text = text.slice(0, decInd) + ',' + text.slice(decInd + 1);
|
9275
|
+
text = text = text === null || text === void 0 ? void 0 : text.replace(/\./g, function (match, index) {
|
9276
|
+
if (index >= decInd && index < (text === null || text === void 0 ? void 0 : text.length)) {
|
9277
|
+
return ',';
|
9278
|
+
}
|
9279
|
+
else {
|
9280
|
+
return match;
|
9281
|
+
}
|
9282
|
+
});
|
9273
9283
|
}
|
9274
9284
|
if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
|
9275
9285
|
text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
|
@@ -13802,7 +13812,8 @@ const WaterfallFlowItem$1 = (props) => {
|
|
13802
13812
|
const priceText = getPriceText({
|
13803
13813
|
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
13804
13814
|
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
13805
|
-
globalConfig
|
13815
|
+
globalConfig,
|
13816
|
+
isHiddenDef: true
|
13806
13817
|
});
|
13807
13818
|
React.useEffect(() => {
|
13808
13819
|
if (imgDom.current === null || src === '') {
|
@@ -14118,7 +14129,8 @@ const WaterfallFlowItem = (props) => {
|
|
14118
14129
|
const priceText = getPriceText({
|
14119
14130
|
product: rec === null || rec === void 0 ? void 0 : rec.product,
|
14120
14131
|
enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
|
14121
|
-
globalConfig
|
14132
|
+
globalConfig,
|
14133
|
+
isHiddenDef: true
|
14122
14134
|
});
|
14123
14135
|
// useEffect(() => {
|
14124
14136
|
// if (imgDom.current === null || src === '') {
|