ywana-core8 0.0.554 → 0.0.557

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
@@ -755,7 +755,8 @@ var Property = function Property(props) {
755
755
  value = props.value,
756
756
  _props$editable = props.editable,
757
757
  editable = _props$editable === void 0 ? false : _props$editable,
758
- onChange = props.onChange;
758
+ onChange = props.onChange,
759
+ options = props.options;
759
760
 
760
761
  function change(event) {
761
762
  if (onChange) {
@@ -768,19 +769,26 @@ var Property = function Property(props) {
768
769
  if (onChange) onChange(id, "");
769
770
  }
770
771
 
772
+ var value2 = value || initial;
773
+
774
+ if (options && Array.isArray(options)) {
775
+ var opt = options.find(function (option) {
776
+ return option.value == value2;
777
+ });
778
+ if (opt) value2 = opt.label;
779
+ }
780
+
771
781
  return /*#__PURE__*/React__default["default"].createElement("div", {
772
782
  className: "property property-" + id + " " + className
773
783
  }, /*#__PURE__*/React__default["default"].createElement("div", {
774
784
  className: "property-name"
775
- }, name || label), initial ? /*#__PURE__*/React__default["default"].createElement("div", {
776
- className: "property-value"
777
- }, initial) : null, /*#__PURE__*/React__default["default"].createElement("div", {
785
+ }, name || label), /*#__PURE__*/React__default["default"].createElement("div", {
778
786
  className: "property-value"
779
787
  }, editable ? /*#__PURE__*/React__default["default"].createElement("input", {
780
788
  type: "text",
781
- value: value,
789
+ value: value2,
782
790
  onChange: change
783
- }) : value, editable && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
791
+ }) : value2, editable && value2.length > 0 ? /*#__PURE__*/React__default["default"].createElement(Icon, {
784
792
  icon: "close",
785
793
  size: "small",
786
794
  clickable: true,
@@ -5999,7 +6007,8 @@ var FieldViewer = function FieldViewer(props) {
5999
6007
  case TYPES.STRING:
6000
6008
  return /*#__PURE__*/React__default["default"].createElement(Property, {
6001
6009
  label: label,
6002
- value: value
6010
+ value: value,
6011
+ options: field.options
6003
6012
  });
6004
6013
 
6005
6014
  case TYPES.ENTITY: