ywana-core8 0.0.230 → 0.0.234

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.
@@ -1036,6 +1036,7 @@ var TYPES = {
1036
1036
  var FORMATS = {
1037
1037
  NONE: '',
1038
1038
  DATE: 'date',
1039
+ TIME: 'time',
1039
1040
  EMAIL: 'email',
1040
1041
  HTML: 'HTML',
1041
1042
  URL: 'URL'
@@ -1622,10 +1623,23 @@ var StringCellViewer = function StringCellViewer(_ref7) {
1622
1623
  return o.value === value;
1623
1624
  }) : null;
1624
1625
  var text = option ? option.label : value;
1626
+ var locale = window.navigator.userLanguage || window.navigator.language;
1625
1627
 
1626
1628
  switch (format) {
1627
1629
  case FORMATS.DATE:
1628
- text = new Date(text).toLocaleString();
1630
+ text = new Date(text).toLocaleString(locale, {
1631
+ year: 'numeric',
1632
+ month: 'numeric',
1633
+ day: 'numeric'
1634
+ });
1635
+ break;
1636
+
1637
+ case FORMATS.TIME:
1638
+ text = new Date(text).toLocaleString(locale, {
1639
+ year: 'hour',
1640
+ month: 'minute',
1641
+ day: 'second'
1642
+ });
1629
1643
  break;
1630
1644
  }
1631
1645
 
@@ -3088,38 +3102,51 @@ var StringEditor = function StringEditor(_ref6) {
3088
3102
  return opts;
3089
3103
  }
3090
3104
 
3105
+ function renderFormat(format, options) {
3106
+ switch (format) {
3107
+ case FORMATS.HTML:
3108
+ return /*#__PURE__*/React.createElement(Editor, {
3109
+ id: id,
3110
+ value: value,
3111
+ onChange: change,
3112
+ content: content
3113
+ });
3114
+
3115
+ case FORMATS.DATE:
3116
+ return /*#__PURE__*/React.createElement(TextField, {
3117
+ outlined: outlined,
3118
+ id: id,
3119
+ type: "date",
3120
+ label: label,
3121
+ value: value,
3122
+ onChange: change,
3123
+ readOnly: !editable
3124
+ });
3125
+
3126
+ default:
3127
+ return options ? /*#__PURE__*/React.createElement(DropDown, {
3128
+ outlined: outlined,
3129
+ id: id,
3130
+ label: label,
3131
+ value: value,
3132
+ onChange: change,
3133
+ options: buildOptions(),
3134
+ readOnly: !editable,
3135
+ canFilter: predictive
3136
+ }) : /*#__PURE__*/React.createElement(TextField, {
3137
+ outlined: outlined,
3138
+ id: id,
3139
+ label: label,
3140
+ value: value,
3141
+ onChange: change,
3142
+ readOnly: !editable
3143
+ });
3144
+ }
3145
+ }
3146
+
3091
3147
  return /*#__PURE__*/React.createElement("div", {
3092
3148
  className: "field-editor string-editor"
3093
- }, format === FORMATS.HTML ? /*#__PURE__*/React.createElement(Editor, {
3094
- id: id,
3095
- value: value,
3096
- onChange: change,
3097
- content: content
3098
- }) : null, format === FORMATS.DATE ? /*#__PURE__*/React.createElement(TextField, {
3099
- outlined: outlined,
3100
- id: id,
3101
- type: "date",
3102
- label: label,
3103
- value: value,
3104
- onChange: change,
3105
- readOnly: !editable
3106
- }) : options ? /*#__PURE__*/React.createElement(DropDown, {
3107
- outlined: outlined,
3108
- id: id,
3109
- label: label,
3110
- value: value,
3111
- onChange: change,
3112
- options: buildOptions(),
3113
- readOnly: !editable,
3114
- canFilter: predictive
3115
- }) : /*#__PURE__*/React.createElement(TextField, {
3116
- outlined: outlined,
3117
- id: id,
3118
- label: label,
3119
- value: value,
3120
- onChange: change,
3121
- readOnly: !editable
3122
- }));
3149
+ }, renderFormat(format, options));
3123
3150
  };
3124
3151
  /**
3125
3152
  * Number Editor
@@ -4797,13 +4824,27 @@ var TableEditor = function TableEditor(props) {
4797
4824
  });
4798
4825
  }
4799
4826
 
4827
+ function renderGroupLabel(groupName) {
4828
+ var grouper = schema[groupBy];
4829
+
4830
+ if (grouper.options) {
4831
+ var options = CHECK['isFunction'](grouper.options) ? grouper.options() : grouper.options;
4832
+ var option = options.find(function (option) {
4833
+ return option.value === groupName;
4834
+ });
4835
+ return option.label;
4836
+ } else {
4837
+ return groupName;
4838
+ }
4839
+ }
4840
+
4800
4841
  function renderGroups() {
4801
4842
  var items = filter ? filter(all) : all;
4802
- var groups = items.reduce(function (groups, filter) {
4803
- var groupName = filter[groupBy];
4843
+ var groups = items.reduce(function (groups, item) {
4844
+ var groupName = item[groupBy];
4804
4845
  var group = groups[groupName];
4805
4846
  if (!group) groups[groupName] = [];
4806
- groups[groupName].push(filter);
4847
+ groups[groupName].push(item);
4807
4848
  return groups;
4808
4849
  }, {});
4809
4850
  return Object.keys(groups).map(function (groupName) {
@@ -4867,7 +4908,7 @@ var TableEditor = function TableEditor(props) {
4867
4908
  key: groupName
4868
4909
  }, /*#__PURE__*/React.createElement(Header, {
4869
4910
  title: groupName
4870
- }, /*#__PURE__*/React.createElement("span", {
4911
+ }, renderGroupLabel(groupName), /*#__PURE__*/React.createElement("span", {
4871
4912
  className: "size"
4872
4913
  }, groupSize)), /*#__PURE__*/React.createElement(DataTable, _extends({}, table, {
4873
4914
  onRowSelection: select,