ywana-core8 0.0.624 → 0.0.627

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
@@ -182,7 +182,8 @@ var Icon = function Icon(_ref) {
182
182
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
183
183
  action = _ref.action,
184
184
  _ref$eventPropagation = _ref.eventPropagation,
185
- eventPropagation = _ref$eventPropagation === void 0 ? false : _ref$eventPropagation;
185
+ eventPropagation = _ref$eventPropagation === void 0 ? false : _ref$eventPropagation,
186
+ className = _ref.className;
186
187
 
187
188
  function click(event) {
188
189
  if (!eventPropagation) {
@@ -195,7 +196,7 @@ var Icon = function Icon(_ref) {
195
196
 
196
197
  var style = disabled ? "disabled" : clickable ? "clickable" : "";
197
198
  return /*#__PURE__*/React__default["default"].createElement("i", {
198
- className: "icon " + size + " " + style + " material-icons",
199
+ className: "icon " + size + " " + style + " " + className + " material-icons",
199
200
  onClick: click
200
201
  }, icon);
201
202
  };
@@ -1448,6 +1449,8 @@ var DropDown = function DropDown(props) {
1448
1449
  readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
1449
1450
  _props$verbose = props.verbose,
1450
1451
  verbose = _props$verbose === void 0 ? true : _props$verbose,
1452
+ _props$editable = props.editable,
1453
+ editable = _props$editable === void 0 ? false : _props$editable,
1451
1454
  onBlur = props.onBlur;
1452
1455
 
1453
1456
  var _useState = React.useState(false),
@@ -1466,7 +1469,8 @@ var DropDown = function DropDown(props) {
1466
1469
 
1467
1470
  var _label = option ? option.label : "";
1468
1471
 
1469
- setLabel(_label);
1472
+ if (editable && _label === "") setLabel(value);
1473
+ if (!editable) setLabel(_label);
1470
1474
  }
1471
1475
  }, [value]);
1472
1476
 
@@ -1474,10 +1478,15 @@ var DropDown = function DropDown(props) {
1474
1478
  if (predictive) {
1475
1479
  setLabel(value);
1476
1480
  } else {
1481
+ console.log('change', id, value);
1477
1482
  if (onChange) onChange(id, value);
1478
1483
  }
1479
1484
  }
1480
1485
 
1486
+ function onFocus() {
1487
+ if (!editable) toggle();
1488
+ }
1489
+
1481
1490
  function toggle() {
1482
1491
  if (site && site.changeFocus) {
1483
1492
  site.changeFocus({
@@ -1528,14 +1537,22 @@ var DropDown = function DropDown(props) {
1528
1537
  }
1529
1538
  }
1530
1539
 
1540
+ var title = editable ? /*#__PURE__*/React__default["default"].createElement("div", {
1541
+ className: "row"
1542
+ }, props.label, /*#__PURE__*/React__default["default"].createElement(Icon, {
1543
+ className: "decorator",
1544
+ icon: "edit",
1545
+ size: "small"
1546
+ })) : props.label;
1531
1547
  return /*#__PURE__*/React__default["default"].createElement("div", {
1532
1548
  className: "dropdown"
1533
1549
  }, /*#__PURE__*/React__default["default"].createElement(TextField, _extends({}, props, {
1534
- onClick: toggle,
1550
+ label: title,
1551
+ onClick: onFocus,
1535
1552
  value: label,
1536
1553
  onChange: change,
1537
1554
  onBlur: blur,
1538
- readOnly: !predictive
1555
+ readOnly: !predictive && !editable
1539
1556
  })), !readOnly ? /*#__PURE__*/React__default["default"].createElement(Icon, {
1540
1557
  icon: "expand_more",
1541
1558
  clickable: true,
@@ -4659,6 +4676,8 @@ var StringEditor = function StringEditor(_ref7) {
4659
4676
  predictive = _field$predictive === void 0 ? false : _field$predictive,
4660
4677
  _field$multivalue = field.multivalue,
4661
4678
  multivalue = _field$multivalue === void 0 ? false : _field$multivalue,
4679
+ _field$freeValue = field.freeValue,
4680
+ freeValue = _field$freeValue === void 0 ? false : _field$freeValue,
4662
4681
  Editor = field.Editor;
4663
4682
 
4664
4683
  function change(id, value) {
@@ -4741,7 +4760,8 @@ var StringEditor = function StringEditor(_ref7) {
4741
4760
  onChange: change,
4742
4761
  options: buildOptions(),
4743
4762
  readOnly: !editable,
4744
- predictive: predictive
4763
+ predictive: predictive,
4764
+ editable: freeValue
4745
4765
  }) : multivalue ? /*#__PURE__*/React__default["default"].createElement(TokenField, {
4746
4766
  id: id,
4747
4767
  label: label,
@@ -5868,7 +5888,7 @@ var CollectionList = function CollectionList(props) {
5868
5888
  function search() {
5869
5889
  var items = filter ? all.filter(function (item) {
5870
5890
  var result = searchBy.some(function (fieldName) {
5871
- var value = item[fieldName];
5891
+ var value = item[fieldName] ? item[fieldName].toUpperCase() : "";
5872
5892
  return value ? value.indexOf(filter.toUpperCase()) >= 0 : false;
5873
5893
  });
5874
5894
  return result;