ywana-core8 0.0.243 → 0.0.247

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.umd.js CHANGED
@@ -208,13 +208,25 @@
208
208
 
209
209
  var SiteContext = React__default["default"].createContext({});
210
210
 
211
+ var FORMATS$1 = {
212
+ NONE: '',
213
+ NUMERIC: 'numeric',
214
+ DATE: 'date',
215
+ TIME: 'time',
216
+ EMAIL: 'email',
217
+ HTML: 'HTML',
218
+ URL: 'URL'
219
+ };
211
220
  /**
212
221
  * Text
213
222
  */
214
223
 
215
224
  var Text$1 = function Text(_ref) {
216
- var children = _ref.children;
225
+ var format = _ref.format,
226
+ children = _ref.children;
217
227
  var site = React.useContext(SiteContext);
228
+ console.log('xxx', format, site);
229
+ var value = children;
218
230
 
219
231
  if (site) {
220
232
  var lang = site.lang,
@@ -222,10 +234,18 @@
222
234
  dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
223
235
  var term = dictionary[children];
224
236
  var text = term ? term[lang] : children;
225
- return text ? /*#__PURE__*/React__default["default"].createElement("span", null, text) : '';
237
+ if (text) value = text;
226
238
  }
227
239
 
228
- return children ? /*#__PURE__*/React__default["default"].createElement("span", null, children) : '';
240
+ var formatter = Intl.NumberFormat();
241
+
242
+ switch (format) {
243
+ case FORMATS$1.NUMERIC:
244
+ value = formatter.format(children);
245
+ break;
246
+ }
247
+
248
+ return children ? /*#__PURE__*/React__default["default"].createElement("span", null, value) : '';
229
249
  };
230
250
 
231
251
  /**
@@ -720,7 +740,7 @@
720
740
  }
721
741
 
722
742
  function clear() {
723
- if (onChange) onChange("");
743
+ if (onChange) onChange(id, "");
724
744
  }
725
745
 
726
746
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -1034,8 +1054,8 @@
1034
1054
  options = _props$options === void 0 ? [] : _props$options,
1035
1055
  value = props.value,
1036
1056
  onChange = props.onChange,
1037
- _props$canFilter = props.canFilter,
1038
- canFilter = _props$canFilter === void 0 ? false : _props$canFilter,
1057
+ _props$predictive = props.predictive,
1058
+ predictive = _props$predictive === void 0 ? false : _props$predictive,
1039
1059
  _props$readOnly3 = props.readOnly,
1040
1060
  readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
1041
1061
 
@@ -1060,7 +1080,7 @@
1060
1080
  }, [value]);
1061
1081
 
1062
1082
  function change(id, value) {
1063
- if (canFilter) {
1083
+ if (predictive) {
1064
1084
  setLabel(value);
1065
1085
  } else {
1066
1086
  if (onChange) onChange(id, value);
@@ -1093,7 +1113,7 @@
1093
1113
  var canShow = open == true && Array.isArray(options);
1094
1114
 
1095
1115
  if (canShow) {
1096
- var filterActive = canFilter === true && label && label.length > 0;
1116
+ var filterActive = predictive === true && label && label.length > 0;
1097
1117
  var items = filterActive ? options.filter(function (option) {
1098
1118
  return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
1099
1119
  }) : options;
@@ -1111,6 +1131,7 @@
1111
1131
  }
1112
1132
  }
1113
1133
 
1134
+ console.log('dropdown', id, 'predictive', predictive);
1114
1135
  return /*#__PURE__*/React__default["default"].createElement("div", {
1115
1136
  className: "dropdown"
1116
1137
  }, /*#__PURE__*/React__default["default"].createElement(TextField, _extends({}, props, {
@@ -3475,7 +3496,7 @@
3475
3496
  onChange: change,
3476
3497
  options: buildOptions(),
3477
3498
  readOnly: !editable,
3478
- canFilter: predictive
3499
+ predictive: predictive
3479
3500
  }) : /*#__PURE__*/React__default["default"].createElement(TextField, {
3480
3501
  outlined: outlined,
3481
3502
  id: id,