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.umd.js CHANGED
@@ -176,7 +176,8 @@
176
176
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
177
177
  action = _ref.action,
178
178
  _ref$eventPropagation = _ref.eventPropagation,
179
- eventPropagation = _ref$eventPropagation === void 0 ? false : _ref$eventPropagation;
179
+ eventPropagation = _ref$eventPropagation === void 0 ? false : _ref$eventPropagation,
180
+ className = _ref.className;
180
181
 
181
182
  function click(event) {
182
183
  if (!eventPropagation) {
@@ -189,7 +190,7 @@
189
190
 
190
191
  var style = disabled ? "disabled" : clickable ? "clickable" : "";
191
192
  return /*#__PURE__*/React__default["default"].createElement("i", {
192
- className: "icon " + size + " " + style + " material-icons",
193
+ className: "icon " + size + " " + style + " " + className + " material-icons",
193
194
  onClick: click
194
195
  }, icon);
195
196
  };
@@ -1442,6 +1443,8 @@
1442
1443
  readOnly = _props$readOnly3 === void 0 ? false : _props$readOnly3,
1443
1444
  _props$verbose = props.verbose,
1444
1445
  verbose = _props$verbose === void 0 ? true : _props$verbose,
1446
+ _props$editable = props.editable,
1447
+ editable = _props$editable === void 0 ? false : _props$editable,
1445
1448
  onBlur = props.onBlur;
1446
1449
 
1447
1450
  var _useState = React.useState(false),
@@ -1460,7 +1463,8 @@
1460
1463
 
1461
1464
  var _label = option ? option.label : "";
1462
1465
 
1463
- setLabel(_label);
1466
+ if (editable && _label === "") setLabel(value);
1467
+ if (!editable) setLabel(_label);
1464
1468
  }
1465
1469
  }, [value]);
1466
1470
 
@@ -1468,10 +1472,15 @@
1468
1472
  if (predictive) {
1469
1473
  setLabel(value);
1470
1474
  } else {
1475
+ console.log('change', id, value);
1471
1476
  if (onChange) onChange(id, value);
1472
1477
  }
1473
1478
  }
1474
1479
 
1480
+ function onFocus() {
1481
+ if (!editable) toggle();
1482
+ }
1483
+
1475
1484
  function toggle() {
1476
1485
  if (site && site.changeFocus) {
1477
1486
  site.changeFocus({
@@ -1522,14 +1531,22 @@
1522
1531
  }
1523
1532
  }
1524
1533
 
1534
+ var title = editable ? /*#__PURE__*/React__default["default"].createElement("div", {
1535
+ className: "row"
1536
+ }, props.label, /*#__PURE__*/React__default["default"].createElement(Icon, {
1537
+ className: "decorator",
1538
+ icon: "edit",
1539
+ size: "small"
1540
+ })) : props.label;
1525
1541
  return /*#__PURE__*/React__default["default"].createElement("div", {
1526
1542
  className: "dropdown"
1527
1543
  }, /*#__PURE__*/React__default["default"].createElement(TextField, _extends({}, props, {
1528
- onClick: toggle,
1544
+ label: title,
1545
+ onClick: onFocus,
1529
1546
  value: label,
1530
1547
  onChange: change,
1531
1548
  onBlur: blur,
1532
- readOnly: !predictive
1549
+ readOnly: !predictive && !editable
1533
1550
  })), !readOnly ? /*#__PURE__*/React__default["default"].createElement(Icon, {
1534
1551
  icon: "expand_more",
1535
1552
  clickable: true,
@@ -4653,6 +4670,8 @@
4653
4670
  predictive = _field$predictive === void 0 ? false : _field$predictive,
4654
4671
  _field$multivalue = field.multivalue,
4655
4672
  multivalue = _field$multivalue === void 0 ? false : _field$multivalue,
4673
+ _field$freeValue = field.freeValue,
4674
+ freeValue = _field$freeValue === void 0 ? false : _field$freeValue,
4656
4675
  Editor = field.Editor;
4657
4676
 
4658
4677
  function change(id, value) {
@@ -4735,7 +4754,8 @@
4735
4754
  onChange: change,
4736
4755
  options: buildOptions(),
4737
4756
  readOnly: !editable,
4738
- predictive: predictive
4757
+ predictive: predictive,
4758
+ editable: freeValue
4739
4759
  }) : multivalue ? /*#__PURE__*/React__default["default"].createElement(TokenField, {
4740
4760
  id: id,
4741
4761
  label: label,
@@ -5862,7 +5882,7 @@
5862
5882
  function search() {
5863
5883
  var items = filter ? all.filter(function (item) {
5864
5884
  var result = searchBy.some(function (fieldName) {
5865
- var value = item[fieldName];
5885
+ var value = item[fieldName] ? item[fieldName].toUpperCase() : "";
5866
5886
  return value ? value.indexOf(filter.toUpperCase()) >= 0 : false;
5867
5887
  });
5868
5888
  return result;