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.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-12 15:50:11
9208
+ * @LastEditTime: 2024-09-13 15:06:44
9209
9209
  * @FilePath: \pb-sxp-ui\src\core\utils\materials.ts
9210
9210
  *
9211
9211
  */
@@ -9238,7 +9238,7 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
9238
9238
  let text = '';
9239
9239
  let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
9240
9240
  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 || (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) !== 'none';
9241
+ const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
9242
9242
  let decPic = price.toString();
9243
9243
  if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
9244
9244
  decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
@@ -9252,7 +9252,7 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
9252
9252
  let startIndex = 0;
9253
9253
  let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
9254
9254
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
9255
- text = text === null || text === void 0 ? void 0 : text.replace(/,/g, function (match, index) {
9255
+ text = text === null || text === void 0 ? void 0 : text.replace(/\,/g, function (match, index) {
9256
9256
  if (index >= startIndex && index < endIndex) {
9257
9257
  return '.';
9258
9258
  }
@@ -9268,8 +9268,16 @@ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
9268
9268
  else {
9269
9269
  text = `${(priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? price === null || price === void 0 ? void 0 : price.toFixed(2) : price}`;
9270
9270
  }
9271
- if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0 && decInd + 1 < (text === null || text === void 0 ? void 0 : text.length)) {
9272
- text = text.slice(0, decInd + 1) + ',' + text.slice(decInd + 2);
9271
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0) {
9272
+ // text = text.slice(0, decInd) + ',' + text.slice(decInd + 1);
9273
+ text = text = text === null || text === void 0 ? void 0 : text.replace(/\./g, function (match, index) {
9274
+ if (index >= decInd && index < (text === null || text === void 0 ? void 0 : text.length)) {
9275
+ return ',';
9276
+ }
9277
+ else {
9278
+ return match;
9279
+ }
9280
+ });
9273
9281
  }
9274
9282
  if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
9275
9283
  text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;