ywana-core8 0.0.244 → 0.0.248

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 TEXTFORMATS = {
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;
243
+ }
244
+
245
+ var formatter = Intl.NumberFormat();
246
+
247
+ switch (format) {
248
+ case FORMATS.NUMERIC:
249
+ value = formatter.format(children);
250
+ break;
231
251
  }
232
252
 
233
- return children ? /*#__PURE__*/React__default["default"].createElement("span", null, children) : '';
253
+ return children ? /*#__PURE__*/React__default["default"].createElement("span", null, value) : '';
234
254
  };
235
255
 
236
256
  /**
@@ -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, {
@@ -1145,7 +1166,7 @@ var TYPES = {
1145
1166
  * FORMATS
1146
1167
  */
1147
1168
 
1148
- var FORMATS = {
1169
+ var FORMATS$1 = {
1149
1170
  NONE: '',
1150
1171
  DATE: 'date',
1151
1172
  TIME: 'time',
@@ -1738,7 +1759,7 @@ var StringCellViewer = function StringCellViewer(_ref7) {
1738
1759
  var locale = window.navigator.userLanguage || window.navigator.language;
1739
1760
 
1740
1761
  switch (format) {
1741
- case FORMATS.DATE:
1762
+ case FORMATS$1.DATE:
1742
1763
  text = new Date(text).toLocaleString(locale, {
1743
1764
  year: 'numeric',
1744
1765
  month: 'numeric',
@@ -1746,7 +1767,7 @@ var StringCellViewer = function StringCellViewer(_ref7) {
1746
1767
  });
1747
1768
  break;
1748
1769
 
1749
- case FORMATS.TIME:
1770
+ case FORMATS$1.TIME:
1750
1771
  text = new Date(text).toLocaleString(locale, {
1751
1772
  year: 'hour',
1752
1773
  month: 'minute',
@@ -3452,7 +3473,7 @@ var StringEditor = function StringEditor(_ref6) {
3452
3473
 
3453
3474
  function renderFormat(format, options) {
3454
3475
  switch (format) {
3455
- case FORMATS.HTML:
3476
+ case FORMATS$1.HTML:
3456
3477
  return /*#__PURE__*/React__default["default"].createElement(Editor, {
3457
3478
  id: id,
3458
3479
  value: value,
@@ -3460,7 +3481,7 @@ var StringEditor = function StringEditor(_ref6) {
3460
3481
  content: content
3461
3482
  });
3462
3483
 
3463
- case FORMATS.DATE:
3484
+ case FORMATS$1.DATE:
3464
3485
  return /*#__PURE__*/React__default["default"].createElement(TextField, {
3465
3486
  outlined: outlined,
3466
3487
  id: id,
@@ -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,
@@ -5793,7 +5814,7 @@ exports.DataTable = DataTable;
5793
5814
  exports.Dialog = Dialog;
5794
5815
  exports.DropDown = DropDown;
5795
5816
  exports.EditContentDialog = EditContentDialog;
5796
- exports.FORMATS = FORMATS;
5817
+ exports.FORMATS = FORMATS$1;
5797
5818
  exports.FieldEditor = FieldEditor;
5798
5819
  exports.Form = Form;
5799
5820
  exports.HTTPClient = HTTPClient;
@@ -5824,6 +5845,7 @@ exports.SiteContext = SiteContext;
5824
5845
  exports.SiteProvider = SiteProvider;
5825
5846
  exports.Stack = Stack;
5826
5847
  exports.Switch = Switch;
5848
+ exports.TEXTFORMATS = TEXTFORMATS;
5827
5849
  exports.TYPES = TYPES;
5828
5850
  exports.Tab = Tab;
5829
5851
  exports.TabbedContentEditor = TabbedContentEditor;