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.cjs CHANGED
@@ -213,13 +213,25 @@ var Button$1 = function Button(_ref) {
213
213
 
214
214
  var SiteContext = React__default["default"].createContext({});
215
215
 
216
+ var FORMATS$1 = {
217
+ NONE: '',
218
+ NUMERIC: 'numeric',
219
+ DATE: 'date',
220
+ TIME: 'time',
221
+ EMAIL: 'email',
222
+ HTML: 'HTML',
223
+ URL: 'URL'
224
+ };
216
225
  /**
217
226
  * Text
218
227
  */
219
228
 
220
229
  var Text$1 = function Text(_ref) {
221
- var children = _ref.children;
230
+ var format = _ref.format,
231
+ children = _ref.children;
222
232
  var site = React.useContext(SiteContext);
233
+ console.log('xxx', format, site);
234
+ var value = children;
223
235
 
224
236
  if (site) {
225
237
  var lang = site.lang,
@@ -227,10 +239,18 @@ var Text$1 = function Text(_ref) {
227
239
  dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
228
240
  var term = dictionary[children];
229
241
  var text = term ? term[lang] : children;
230
- return text ? /*#__PURE__*/React__default["default"].createElement("span", null, text) : '';
242
+ if (text) value = text;
231
243
  }
232
244
 
233
- return children ? /*#__PURE__*/React__default["default"].createElement("span", null, children) : '';
245
+ var formatter = Intl.NumberFormat();
246
+
247
+ switch (format) {
248
+ case FORMATS$1.NUMERIC:
249
+ value = formatter.format(children);
250
+ break;
251
+ }
252
+
253
+ return children ? /*#__PURE__*/React__default["default"].createElement("span", null, value) : '';
234
254
  };
235
255
 
236
256
  /**
@@ -725,7 +745,7 @@ var Property = function Property(props) {
725
745
  }
726
746
 
727
747
  function clear() {
728
- if (onChange) onChange("");
748
+ if (onChange) onChange(id, "");
729
749
  }
730
750
 
731
751
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -1039,8 +1059,8 @@ var DropDown = function DropDown(props) {
1039
1059
  options = _props$options === void 0 ? [] : _props$options,
1040
1060
  value = props.value,
1041
1061
  onChange = props.onChange,
1042
- _props$canFilter = props.canFilter,
1043
- canFilter = _props$canFilter === void 0 ? false : _props$canFilter,
1062
+ _props$predictive = props.predictive,
1063
+ predictive = _props$predictive === void 0 ? false : _props$predictive,
1044
1064
  _props$readOnly3 = props.readOnly,
1045
1065
  readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
1046
1066
 
@@ -1065,7 +1085,7 @@ var DropDown = function DropDown(props) {
1065
1085
  }, [value]);
1066
1086
 
1067
1087
  function change(id, value) {
1068
- if (canFilter) {
1088
+ if (predictive) {
1069
1089
  setLabel(value);
1070
1090
  } else {
1071
1091
  if (onChange) onChange(id, value);
@@ -1098,7 +1118,7 @@ var DropDown = function DropDown(props) {
1098
1118
  var canShow = open == true && Array.isArray(options);
1099
1119
 
1100
1120
  if (canShow) {
1101
- var filterActive = canFilter === true && label && label.length > 0;
1121
+ var filterActive = predictive === true && label && label.length > 0;
1102
1122
  var items = filterActive ? options.filter(function (option) {
1103
1123
  return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
1104
1124
  }) : options;
@@ -1116,6 +1136,7 @@ var DropDown = function DropDown(props) {
1116
1136
  }
1117
1137
  }
1118
1138
 
1139
+ console.log('dropdown', id, 'predictive', predictive);
1119
1140
  return /*#__PURE__*/React__default["default"].createElement("div", {
1120
1141
  className: "dropdown"
1121
1142
  }, /*#__PURE__*/React__default["default"].createElement(TextField, _extends({}, props, {
@@ -3480,7 +3501,7 @@ var StringEditor = function StringEditor(_ref6) {
3480
3501
  onChange: change,
3481
3502
  options: buildOptions(),
3482
3503
  readOnly: !editable,
3483
- canFilter: predictive
3504
+ predictive: predictive
3484
3505
  }) : /*#__PURE__*/React__default["default"].createElement(TextField, {
3485
3506
  outlined: outlined,
3486
3507
  id: id,