@fonixtree/magic-design 2.0.198 → 2.0.200

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.
@@ -93,6 +93,11 @@ function (_super) {
93
93
  var _this = _super !== null && _super.apply(this, arguments) || this;
94
94
 
95
95
  _this.state = {};
96
+
97
+ _this.formatDistance = function (val) {
98
+ return (Number(val) / 1000).toFixed(2).replace(/(\.0+|0+)$/, '');
99
+ };
100
+
96
101
  return _this;
97
102
  }
98
103
 
@@ -172,7 +177,7 @@ function (_super) {
172
177
  }), distance.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
173
178
  className: "distance",
174
179
  data: __assign(__assign({}, distance), {
175
- text: (data.distance || 0) + " " + (0, _locale.i18n)('KM')
180
+ text: this.formatDistance(data.distance) + " " + (0, _locale.i18n)('KM')
176
181
  }),
177
182
  readonly: true
178
183
  })))) : /*#__PURE__*/_react["default"].createElement("div", _extends({
@@ -244,7 +249,7 @@ function (_super) {
244
249
  }), distance.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
245
250
  className: "distance",
246
251
  data: __assign(__assign({}, distance), {
247
- text: (data.distance || 0) + " " + (0, _locale.i18n)('KM')
252
+ text: this.formatDistance(data.distance) + " " + (0, _locale.i18n)('KM')
248
253
  }),
249
254
  readonly: true
250
255
  })))));
@@ -93,6 +93,11 @@ function (_super) {
93
93
  var _this = _super !== null && _super.apply(this, arguments) || this;
94
94
 
95
95
  _this.state = {};
96
+
97
+ _this.formatDistance = function (val) {
98
+ return (Number(val) / 1000).toFixed(2).replace(/(\.0+|0+)$/, '');
99
+ };
100
+
96
101
  return _this;
97
102
  }
98
103
 
@@ -172,7 +177,7 @@ function (_super) {
172
177
  }), distance.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
173
178
  className: "distance",
174
179
  data: __assign(__assign({}, distance), {
175
- text: (data.distance || 0) + " " + (0, _locale.i18n)('KM')
180
+ text: this.formatDistance(data.distance) + " " + (0, _locale.i18n)('KM')
176
181
  }),
177
182
  readonly: true
178
183
  })))) : /*#__PURE__*/_react["default"].createElement("div", _extends({
@@ -244,7 +249,7 @@ function (_super) {
244
249
  }), distance.open && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
245
250
  className: "distance",
246
251
  data: __assign(__assign({}, distance), {
247
- text: (data.distance || 0) + " " + (0, _locale.i18n)('KM')
252
+ text: this.formatDistance(data.distance) + " " + (0, _locale.i18n)('KM')
248
253
  }),
249
254
  readonly: true
250
255
  })))));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "2.0.198",
4
+ "version": "2.0.200",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",