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.
@@ -205,13 +205,25 @@ var Button$1 = function Button(_ref) {
205
205
 
206
206
  var SiteContext = React.createContext({});
207
207
 
208
+ var TEXTFORMATS = {
209
+ NONE: '',
210
+ NUMERIC: 'numeric',
211
+ DATE: 'date',
212
+ TIME: 'time',
213
+ EMAIL: 'email',
214
+ HTML: 'HTML',
215
+ URL: 'URL'
216
+ };
208
217
  /**
209
218
  * Text
210
219
  */
211
220
 
212
221
  var Text$1 = function Text(_ref) {
213
- var children = _ref.children;
222
+ var format = _ref.format,
223
+ children = _ref.children;
214
224
  var site = useContext(SiteContext);
225
+ console.log('xxx', format, site);
226
+ var value = children;
215
227
 
216
228
  if (site) {
217
229
  var lang = site.lang,
@@ -219,10 +231,18 @@ var Text$1 = function Text(_ref) {
219
231
  dictionary = _site$dictionary === void 0 ? {} : _site$dictionary;
220
232
  var term = dictionary[children];
221
233
  var text = term ? term[lang] : children;
222
- return text ? /*#__PURE__*/React.createElement("span", null, text) : '';
234
+ if (text) value = text;
235
+ }
236
+
237
+ var formatter = Intl.NumberFormat();
238
+
239
+ switch (format) {
240
+ case FORMATS.NUMERIC:
241
+ value = formatter.format(children);
242
+ break;
223
243
  }
224
244
 
225
- return children ? /*#__PURE__*/React.createElement("span", null, children) : '';
245
+ return children ? /*#__PURE__*/React.createElement("span", null, value) : '';
226
246
  };
227
247
 
228
248
  /**
@@ -1031,8 +1051,8 @@ var DropDown = function DropDown(props) {
1031
1051
  options = _props$options === void 0 ? [] : _props$options,
1032
1052
  value = props.value,
1033
1053
  onChange = props.onChange,
1034
- _props$canFilter = props.canFilter,
1035
- canFilter = _props$canFilter === void 0 ? false : _props$canFilter,
1054
+ _props$predictive = props.predictive,
1055
+ predictive = _props$predictive === void 0 ? false : _props$predictive,
1036
1056
  _props$readOnly3 = props.readOnly,
1037
1057
  readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3;
1038
1058
 
@@ -1057,7 +1077,7 @@ var DropDown = function DropDown(props) {
1057
1077
  }, [value]);
1058
1078
 
1059
1079
  function change(id, value) {
1060
- if (canFilter) {
1080
+ if (predictive) {
1061
1081
  setLabel(value);
1062
1082
  } else {
1063
1083
  if (onChange) onChange(id, value);
@@ -1090,7 +1110,7 @@ var DropDown = function DropDown(props) {
1090
1110
  var canShow = open == true && Array.isArray(options);
1091
1111
 
1092
1112
  if (canShow) {
1093
- var filterActive = canFilter === true && label && label.length > 0;
1113
+ var filterActive = predictive === true && label && label.length > 0;
1094
1114
  var items = filterActive ? options.filter(function (option) {
1095
1115
  return option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0;
1096
1116
  }) : options;
@@ -1108,6 +1128,7 @@ var DropDown = function DropDown(props) {
1108
1128
  }
1109
1129
  }
1110
1130
 
1131
+ console.log('dropdown', id, 'predictive', predictive);
1111
1132
  return /*#__PURE__*/React.createElement("div", {
1112
1133
  className: "dropdown"
1113
1134
  }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
@@ -1137,7 +1158,7 @@ var TYPES = {
1137
1158
  * FORMATS
1138
1159
  */
1139
1160
 
1140
- var FORMATS = {
1161
+ var FORMATS$1 = {
1141
1162
  NONE: '',
1142
1163
  DATE: 'date',
1143
1164
  TIME: 'time',
@@ -1730,7 +1751,7 @@ var StringCellViewer = function StringCellViewer(_ref7) {
1730
1751
  var locale = window.navigator.userLanguage || window.navigator.language;
1731
1752
 
1732
1753
  switch (format) {
1733
- case FORMATS.DATE:
1754
+ case FORMATS$1.DATE:
1734
1755
  text = new Date(text).toLocaleString(locale, {
1735
1756
  year: 'numeric',
1736
1757
  month: 'numeric',
@@ -1738,7 +1759,7 @@ var StringCellViewer = function StringCellViewer(_ref7) {
1738
1759
  });
1739
1760
  break;
1740
1761
 
1741
- case FORMATS.TIME:
1762
+ case FORMATS$1.TIME:
1742
1763
  text = new Date(text).toLocaleString(locale, {
1743
1764
  year: 'hour',
1744
1765
  month: 'minute',
@@ -3444,7 +3465,7 @@ var StringEditor = function StringEditor(_ref6) {
3444
3465
 
3445
3466
  function renderFormat(format, options) {
3446
3467
  switch (format) {
3447
- case FORMATS.HTML:
3468
+ case FORMATS$1.HTML:
3448
3469
  return /*#__PURE__*/React.createElement(Editor, {
3449
3470
  id: id,
3450
3471
  value: value,
@@ -3452,7 +3473,7 @@ var StringEditor = function StringEditor(_ref6) {
3452
3473
  content: content
3453
3474
  });
3454
3475
 
3455
- case FORMATS.DATE:
3476
+ case FORMATS$1.DATE:
3456
3477
  return /*#__PURE__*/React.createElement(TextField, {
3457
3478
  outlined: outlined,
3458
3479
  id: id,
@@ -3472,7 +3493,7 @@ var StringEditor = function StringEditor(_ref6) {
3472
3493
  onChange: change,
3473
3494
  options: buildOptions(),
3474
3495
  readOnly: !editable,
3475
- canFilter: predictive
3496
+ predictive: predictive
3476
3497
  }) : /*#__PURE__*/React.createElement(TextField, {
3477
3498
  outlined: outlined,
3478
3499
  id: id,
@@ -5768,5 +5789,5 @@ var isFunction = function isFunction(value) {
5768
5789
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
5769
5790
  };
5770
5791
 
5771
- export { Avatar, Button$1 as Button, CheckBox, Chip, Chips, CircularProgress, CollectionContext, CollectionEditor$1 as CollectionEditor, CollectionPage, Content, ContentEditor, ContentForm, CreateContentDialog$1 as CreateContentDialog, DataTable, Dialog, DropDown, EditContentDialog, FORMATS, FieldEditor, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TYPES, Tab, TabbedContentEditor, TablePage, Tabs, Text$1 as Text, TextArea, TextField, Thumbnail, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadButton, UploadDialog, UploadFile, Uploader, Viewer, WaitScreen, isFunction };
5792
+ export { Avatar, Button$1 as Button, CheckBox, Chip, Chips, CircularProgress, CollectionContext, CollectionEditor$1 as CollectionEditor, CollectionPage, Content, ContentEditor, ContentForm, CreateContentDialog$1 as CreateContentDialog, DataTable, Dialog, DropDown, EditContentDialog, FORMATS$1 as FORMATS, FieldEditor, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TEXTFORMATS, TYPES, Tab, TabbedContentEditor, TablePage, Tabs, Text$1 as Text, TextArea, TextField, Thumbnail, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadButton, UploadDialog, UploadFile, Uploader, Viewer, WaitScreen, isFunction };
5772
5793
  //# sourceMappingURL=index.modern.js.map