@majoo-ui/react 1.60.16-rc.4 → 1.60.16-rc.5

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/index.esm.js CHANGED
@@ -24367,12 +24367,15 @@ DecimalColumn.displayName = 'DecimalColumn';
24367
24367
  // import PropTypes from 'prop-types';
24368
24368
 
24369
24369
  const currency$1 = ({
24370
- value,
24370
+ value: val,
24371
24371
  type: _type = 'Rp',
24372
24372
  thousandSeparator: _thousandSeparator = '.',
24373
24373
  decimal: _decimal = false,
24374
- convertMinus: _convertMinus = false
24374
+ convertMinus: _convertMinus = false,
24375
+ forSummary: _forSummary = false
24375
24376
  }) => {
24377
+ let value = val;
24378
+ if (!value) value = 0;
24376
24379
  // const formattedNumber = Math.round(num).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
24377
24380
  // return (type === 'rp') ? `Rp ${formattedNumber}` : ((type == 'nonPrefix') ? formattedNumber : `${type} ${formattedNumber}`);
24378
24381
 
@@ -24387,9 +24390,14 @@ const currency$1 = ({
24387
24390
  }
24388
24391
  if (_convertMinus && parseFloat(value) < 0) {
24389
24392
  const numberWithoutMinus = formattedNumber.toString().replace('-', '');
24393
+ if (_forSummary) return _type.length > 0 ? `(${_type} ${numberWithoutMinus})` : `(${numberWithoutMinus})`;
24390
24394
  return _type.length > 0 ? `( ${_type} ${numberWithoutMinus} )` : `( ${numberWithoutMinus} )`;
24391
24395
  }
24392
- return _type.length > 0 ? `${_type} ${formattedNumber},00` : formattedNumber;
24396
+ const returnValue = _type.length > 0 ? `${_type} ${formattedNumber}` : formattedNumber;
24397
+ if (value === 0) {
24398
+ return returnValue.replace(',00', '');
24399
+ }
24400
+ return returnValue;
24393
24401
 
24394
24402
  // if (thousandSeparator === '.') {
24395
24403
  // return (type === 'rp') ? `Rp ${decimalSplit.join(',')}` : ((type == 'nonPrefix') ? newNum : `${type} ${decimalSplit.join(',')}`);
@@ -24398,8 +24406,10 @@ const currency$1 = ({
24398
24406
  // return (type === 'rp') ? `Rp ${decimalSplit.join('.')}` : ((type == 'nonPrefix') ? newNum : `${type} ${decimalSplit.join('.')}`);
24399
24407
  };
24400
24408
 
24401
- const addThousandSeparator = value => currency$1({
24402
- value
24409
+ const addThousandSeparator = (value, decimal, convertMinus) => currency$1({
24410
+ value,
24411
+ decimal: decimal === undefined ? value !== 0 : decimal,
24412
+ convertMinus: convertMinus === undefined ? true : convertMinus
24403
24413
  });
24404
24414
  const PriceColumn = props => {
24405
24415
  let param = 0;
package/index.umd.js CHANGED
@@ -24852,12 +24852,15 @@
24852
24852
  // import PropTypes from 'prop-types';
24853
24853
 
24854
24854
  const currency$1 = ({
24855
- value,
24855
+ value: val,
24856
24856
  type: _type = 'Rp',
24857
24857
  thousandSeparator: _thousandSeparator = '.',
24858
24858
  decimal: _decimal = false,
24859
- convertMinus: _convertMinus = false
24859
+ convertMinus: _convertMinus = false,
24860
+ forSummary: _forSummary = false
24860
24861
  }) => {
24862
+ let value = val;
24863
+ if (!value) value = 0;
24861
24864
  // const formattedNumber = Math.round(num).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
24862
24865
  // return (type === 'rp') ? `Rp ${formattedNumber}` : ((type == 'nonPrefix') ? formattedNumber : `${type} ${formattedNumber}`);
24863
24866
 
@@ -24872,9 +24875,14 @@
24872
24875
  }
24873
24876
  if (_convertMinus && parseFloat(value) < 0) {
24874
24877
  const numberWithoutMinus = formattedNumber.toString().replace('-', '');
24878
+ if (_forSummary) return _type.length > 0 ? `(${_type} ${numberWithoutMinus})` : `(${numberWithoutMinus})`;
24875
24879
  return _type.length > 0 ? `( ${_type} ${numberWithoutMinus} )` : `( ${numberWithoutMinus} )`;
24876
24880
  }
24877
- return _type.length > 0 ? `${_type} ${formattedNumber},00` : formattedNumber;
24881
+ const returnValue = _type.length > 0 ? `${_type} ${formattedNumber}` : formattedNumber;
24882
+ if (value === 0) {
24883
+ return returnValue.replace(',00', '');
24884
+ }
24885
+ return returnValue;
24878
24886
 
24879
24887
  // if (thousandSeparator === '.') {
24880
24888
  // return (type === 'rp') ? `Rp ${decimalSplit.join(',')}` : ((type == 'nonPrefix') ? newNum : `${type} ${decimalSplit.join(',')}`);
@@ -24883,8 +24891,10 @@
24883
24891
  // return (type === 'rp') ? `Rp ${decimalSplit.join('.')}` : ((type == 'nonPrefix') ? newNum : `${type} ${decimalSplit.join('.')}`);
24884
24892
  };
24885
24893
 
24886
- const addThousandSeparator = value => currency$1({
24887
- value
24894
+ const addThousandSeparator = (value, decimal, convertMinus) => currency$1({
24895
+ value,
24896
+ decimal: decimal === undefined ? value !== 0 : decimal,
24897
+ convertMinus: convertMinus === undefined ? true : convertMinus
24888
24898
  });
24889
24899
  const PriceColumn = props => {
24890
24900
  let param = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majoo-ui/react",
3
- "version": "1.60.16-rc.4",
3
+ "version": "1.60.16-rc.5",
4
4
  "dependencies": {
5
5
  "@majoo-ui/core": "^1.31.3",
6
6
  "@majoo-ui/helpers": "^1.30.5",