ztxkui 3.9.6 → 3.9.7

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.
@@ -109,9 +109,7 @@ function BasicDemo() {
109
109
  React.createElement(InputNumber, { value: value, onChange: function (value) {
110
110
  console.log(value, 1);
111
111
  setValue(value);
112
- },
113
- // precision={3}
114
- formatterType: "currency", style: { width: '300px' } }),
112
+ }, precision: 3, formatterType: "currency", style: { width: '300px' } }),
115
113
  React.createElement(InputNumber, { value: value1, onChange: function (value) {
116
114
  console.log(value, 1);
117
115
  setValue1(value);
@@ -150,7 +150,7 @@ var EditableTable = function () {
150
150
  placeholder: '输入',
151
151
  min: 0,
152
152
  precision: 2,
153
- // formatterType: 'currency',
153
+ formatterType: 'currency',
154
154
  },
155
155
  required: true,
156
156
  showCopy: true,
@@ -398,7 +398,7 @@ function EnhanceSelect(_a) {
398
398
  getRemoteDataHandle(value, '');
399
399
  // }
400
400
  };
401
- var onSearchHandle = debounce(searchHandle, 400);
401
+ var onSearchHandle = debounce(searchHandle, 500);
402
402
  var onSearchHandleInner = function (value) {
403
403
  var _a;
404
404
  // console.log(value);
@@ -92,16 +92,19 @@ function formatCurrency(n) {
92
92
  return n;
93
93
  }
94
94
  }
95
+ function getValue(value, isFocusRef, precision) {
96
+ if (value && !isNaN(Number(value)) && !isFocusRef.current && precision) {
97
+ return exactRound(value, precision);
98
+ }
99
+ return value;
100
+ }
95
101
  export function getFormatter(formatterType, currencySymbol, isFocusRef, precision) {
96
102
  if (currencySymbol === void 0) { currencySymbol = '$'; }
97
103
  if (formatterType === 'currency') {
98
104
  // let formatterFn: IFormatterFuc = (value) =>
99
105
  // `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
100
106
  var formatterFn = function (v) {
101
- var value = v;
102
- if (value && !isFocusRef.current && precision) {
103
- value = exactRound(value, precision);
104
- }
107
+ var value = getValue(v, isFocusRef, precision);
105
108
  return formatCurrency(value);
106
109
  };
107
110
  var parserFn = function (value) { return value.replace(/(,*)/g, ''); };
@@ -113,10 +116,7 @@ export function getFormatter(formatterType, currencySymbol, isFocusRef, precisio
113
116
  }
114
117
  if (formatterType === 'percent') {
115
118
  var formatterFn = function (v) {
116
- var value = v;
117
- if (value && !isFocusRef.current && precision) {
118
- value = exactRound(value, precision);
119
- }
119
+ var value = getValue(v, isFocusRef, precision);
120
120
  return value + "%";
121
121
  };
122
122
  var parserFn = function (value) {
@@ -130,10 +130,7 @@ export function getFormatter(formatterType, currencySymbol, isFocusRef, precisio
130
130
  }
131
131
  if (formatterType === 'thousands') {
132
132
  var formatterFn = function (v) {
133
- var value = v;
134
- if (value && !isFocusRef.current && precision) {
135
- value = exactRound(value, precision);
136
- }
133
+ var value = getValue(v, isFocusRef, precision);
137
134
  return value + "\u2030";
138
135
  };
139
136
  var parserFn = function (value) {
@@ -147,10 +144,7 @@ export function getFormatter(formatterType, currencySymbol, isFocusRef, precisio
147
144
  }
148
145
  return {
149
146
  formatter: function (value) {
150
- if (value && !isFocusRef.current && precision) {
151
- return exactRound(value, precision);
152
- }
153
- return value;
147
+ return getValue(value, isFocusRef, precision);
154
148
  },
155
149
  parser: function (value) { return value; },
156
150
  precision: precision,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.9.6",
3
+ "version": "3.9.7",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",