pb-sxp-ui 1.5.0 → 1.5.1

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.js CHANGED
@@ -9183,7 +9183,7 @@ var CommodityGroup$1 = memo(CommodityGroup);
9183
9183
  * @Author: binruan@chatlabs.com
9184
9184
  * @Date: 2024-03-20 14:56:16
9185
9185
  * @LastEditors: binruan@chatlabs.com
9186
- * @LastEditTime: 2024-09-12 15:50:11
9186
+ * @LastEditTime: 2024-09-13 15:06:44
9187
9187
  * @FilePath: \pb-sxp-ui\src\core\utils\materials.ts
9188
9188
  *
9189
9189
  */
@@ -9216,7 +9216,7 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
9216
9216
  let text = '';
9217
9217
  let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
9218
9218
  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 : '' : '$';
9219
- const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice || (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) !== 'none';
9219
+ const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
9220
9220
  let decPic = price.toString();
9221
9221
  if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
9222
9222
  decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
@@ -9230,7 +9230,7 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
9230
9230
  let startIndex = 0;
9231
9231
  let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
9232
9232
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
9233
- text = text === null || text === void 0 ? void 0 : text.replace(/,/g, function (match, index) {
9233
+ text = text === null || text === void 0 ? void 0 : text.replace(/\,/g, function (match, index) {
9234
9234
  if (index >= startIndex && index < endIndex) {
9235
9235
  return '.';
9236
9236
  }
@@ -9246,8 +9246,16 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
9246
9246
  else {
9247
9247
  text = `${(priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? price === null || price === void 0 ? void 0 : price.toFixed(2) : price}`;
9248
9248
  }
9249
- if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0 && decInd + 1 < (text === null || text === void 0 ? void 0 : text.length)) {
9250
- text = text.slice(0, decInd + 1) + ',' + text.slice(decInd + 2);
9249
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0) {
9250
+ // text = text.slice(0, decInd) + ',' + text.slice(decInd + 1);
9251
+ text = text = text === null || text === void 0 ? void 0 : text.replace(/\./g, function (match, index) {
9252
+ if (index >= decInd && index < (text === null || text === void 0 ? void 0 : text.length)) {
9253
+ return ',';
9254
+ }
9255
+ else {
9256
+ return match;
9257
+ }
9258
+ });
9251
9259
  }
9252
9260
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
9253
9261
  text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;