@yklyklpackages/message-card 0.6.2 → 0.6.3

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
@@ -4159,10 +4159,12 @@
4159
4159
  const { urls, startIndex = 0 } = config.params || {};
4160
4160
  if (!urls || !urls.length) return;
4161
4161
  };
4162
- const handleUpdateLocalData = async (config, { setValues }) => {
4162
+ const handleUpdateLocalData = async (config, { setValues, extra }) => {
4163
+ var _a, _b;
4163
4164
  if (!setValues) return;
4164
4165
  const { updateKey, value } = config.params;
4165
- const key = updateKey;
4166
+ const key = updateKey || (extra == null ? void 0 : extra.key);
4167
+ const targetValue = value !== void 0 && value !== "" ? value : (_b = (_a = extra == null ? void 0 : extra.payload) == null ? void 0 : _a.value) != null ? _b : value;
4166
4168
  const ok = await confirmIfNeeded(config.params);
4167
4169
  if (!ok) return;
4168
4170
  setValues((prev2) => {
@@ -4170,16 +4172,16 @@
4170
4172
  const isOldEmpty = oldValue === void 0 || oldValue === null || oldValue === "" || typeof oldValue === "object" && Object.keys(oldValue).length === 0;
4171
4173
  if (isOldEmpty) {
4172
4174
  return __spreadProps$p(__spreadValues$r({}, prev2 || {}), {
4173
- [key]: value
4175
+ [key]: targetValue
4174
4176
  });
4175
4177
  }
4176
- if (typeof oldValue === "object" && typeof value === "object" && !Array.isArray(oldValue) && !Array.isArray(value) && oldValue !== null && value !== null) {
4178
+ if (typeof oldValue === "object" && typeof targetValue === "object" && !Array.isArray(oldValue) && !Array.isArray(targetValue) && oldValue !== null && targetValue !== null) {
4177
4179
  return __spreadProps$p(__spreadValues$r({}, prev2 || {}), {
4178
- [key]: __spreadValues$r(__spreadValues$r({}, oldValue), value)
4180
+ [key]: __spreadValues$r(__spreadValues$r({}, oldValue), targetValue)
4179
4181
  });
4180
4182
  }
4181
4183
  return __spreadProps$p(__spreadValues$r({}, prev2 || {}), {
4182
- [key]: value
4184
+ [key]: targetValue
4183
4185
  });
4184
4186
  });
4185
4187
  };
@@ -4397,15 +4399,8 @@
4397
4399
  return a;
4398
4400
  };
4399
4401
  var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
4400
- const applySize = (props, scale = 1) => {
4401
- const style2 = { width: "100%" };
4402
- if (!props) return style2;
4403
- if (props.width != null) style2.width = runStyle(props.width, scale);
4404
- if (props.height != null) style2.height = runStyle(props.height, scale);
4405
- return style2;
4406
- };
4407
4402
  const baseContainerStyle = (props, scale = 1) => {
4408
- const style2 = __spreadValues$q(__spreadValues$q({}, applySize(props, scale)), (props == null ? void 0 : props.style) || {});
4403
+ const style2 = __spreadValues$q({}, (props == null ? void 0 : props.style) || {});
4409
4404
  return style2;
4410
4405
  };
4411
4406
  const childGapStyle = (index2, count, gap, horizontal, scale = 1) => {
@@ -4571,10 +4566,10 @@
4571
4566
  return style2;
4572
4567
  };
4573
4568
  const borderRadiusToStyle = (borderRadius, theme, scale = 1) => {
4574
- const borderRadiusMap = theme.borderRadius;
4569
+ const borderRadiusMap = (theme == null ? void 0 : theme.borderRadius) || {};
4575
4570
  const style2 = {};
4576
4571
  if (borderRadius) {
4577
- style2.borderRadius = borderRadiusMap[borderRadius] ? runStyle(borderRadiusMap[borderRadius], scale) : runStyle(borderRadius);
4572
+ style2.borderRadius = borderRadiusMap[borderRadius] ? runStyle(borderRadiusMap[borderRadius], scale) : runStyle(borderRadius, scale);
4578
4573
  }
4579
4574
  return style2;
4580
4575
  };
@@ -4887,14 +4882,16 @@
4887
4882
  });
4888
4883
  const itemContainerStyle = (child, idx) => {
4889
4884
  return __spreadProps$m(__spreadValues$o({}, buildItemContainerStyle(idx, count, props, true, scale)), {
4890
- flexShrink: itemFlexShrink(),
4885
+ flexShrink: itemFlexShrink(child),
4891
4886
  width: void 0
4892
4887
  });
4893
4888
  };
4894
4889
  const items = React.Children.toArray(children);
4895
4890
  const count = items.length;
4896
4891
  const itemFlexShrink = (child) => {
4897
- return 0;
4892
+ var _a, _b;
4893
+ if (((_b = (_a = child == null ? void 0 : child.props) == null ? void 0 : _a.node) == null ? void 0 : _b.props.flexShrink) == 0) return 0;
4894
+ return 1;
4898
4895
  };
4899
4896
  const handleClick = (e) => {
4900
4897
  if (props.actions) {
@@ -5212,8 +5209,8 @@
5212
5209
  "div",
5213
5210
  {
5214
5211
  style: __spreadProps$h(__spreadValues$j({}, buildItemContainerStyle(idx, count, props, true, scale)), {
5215
- flex: idx === 1 ? 1 : 0,
5216
- width: idx === 1 ? runStyle(props.leftWidth, scale) : "auto",
5212
+ flex: idx === 1 ? 1 : "none",
5213
+ width: idx === 0 ? runStyle(props == null ? void 0 : props.leftWidth) : "auto",
5217
5214
  flexDirection: "row"
5218
5215
  }),
5219
5216
  children: child
@@ -29601,11 +29598,17 @@
29601
29598
  };
29602
29599
  var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
29603
29600
  const InputRender = (props) => {
29604
- var _a;
29605
29601
  const { scale } = useResponsive();
29606
29602
  const { executeActions } = useAction$1();
29607
29603
  const { ref: ref2, onClick, onMouseEnter, onMouseLeave } = useForEditor(props);
29608
29604
  const style2 = baseContainerStyle(props, scale);
29605
+ const handleChange = (e) => {
29606
+ if (props.actions) {
29607
+ void executeActions(props.actions, {
29608
+ payload: { value: e.target.value }
29609
+ });
29610
+ }
29611
+ };
29609
29612
  const handleContainerClick = (e) => {
29610
29613
  if (props == null ? void 0 : props.actions) {
29611
29614
  void executeActions(props.actions);
@@ -29622,13 +29625,10 @@
29622
29625
  children: /* @__PURE__ */ jsxRuntime.jsx(
29623
29626
  Input,
29624
29627
  {
29625
- value: (_a = props.value) != null ? _a : "",
29626
29628
  placeholder: props.placeholder,
29627
- onChange: (e) => {
29628
- var _a2;
29629
- return (_a2 = props.onChange) == null ? void 0 : _a2.call(props, e.target.value);
29630
- },
29631
- style: { width: "100%" }
29629
+ onChange: handleChange,
29630
+ style: { width: "100%" },
29631
+ variant: "borderless"
29632
29632
  }
29633
29633
  )
29634
29634
  })
@@ -29719,11 +29719,16 @@
29719
29719
  const style2 = baseContainerStyle(props, scale);
29720
29720
  const valueStr = props.value != null ? String(props.value) : void 0;
29721
29721
  const handleContainerClick = (e) => {
29722
- if (props == null ? void 0 : props.actions) {
29723
- void executeActions(props.actions);
29724
- }
29725
29722
  onClick(e);
29726
29723
  };
29724
+ const handleChange = (e) => {
29725
+ var _a;
29726
+ const val = e.target.value;
29727
+ (_a = props.onChange) == null ? void 0 : _a.call(props, e);
29728
+ if (props.actions) {
29729
+ void executeActions(props.actions, { payload: { value: val } });
29730
+ }
29731
+ };
29727
29732
  return /* @__PURE__ */ jsxRuntime.jsx(
29728
29733
  "div",
29729
29734
  __spreadProps$7(__spreadValues$9({
@@ -29731,10 +29736,30 @@
29731
29736
  onClick: handleContainerClick,
29732
29737
  ref: ref2
29733
29738
  }, { onMouseEnter, onMouseLeave }), {
29734
- children: /* @__PURE__ */ jsxRuntime.jsx(Group$1, { onChange: props.onChange, value: valueStr, children: (props.options || []).map((opt) => {
29735
- const ov = String(opt.value);
29736
- return /* @__PURE__ */ jsxRuntime.jsx(Radio, { value: ov, style: props.itemStyle, children: opt.label }, ov);
29737
- }) })
29739
+ children: /* @__PURE__ */ jsxRuntime.jsx(
29740
+ ConfigProvider,
29741
+ {
29742
+ theme: {
29743
+ token: {
29744
+ colorPrimary: "#1bb193"
29745
+ }
29746
+ },
29747
+ children: /* @__PURE__ */ jsxRuntime.jsx(
29748
+ Group$1,
29749
+ {
29750
+ onChange: handleChange,
29751
+ value: valueStr,
29752
+ defaultValue: props.defaultValue,
29753
+ optionType: "button",
29754
+ buttonStyle: "solid",
29755
+ children: (props.options || []).map((opt) => {
29756
+ const ov = String(opt.value);
29757
+ return /* @__PURE__ */ jsxRuntime.jsx(Radio, { value: ov, style: props.itemStyle, children: opt.label }, ov);
29758
+ })
29759
+ }
29760
+ )
29761
+ }
29762
+ )
29738
29763
  })
29739
29764
  );
29740
29765
  };
@@ -34041,7 +34066,6 @@
34041
34066
  }),
34042
34067
  theme,
34043
34068
  onAction: (payload) => {
34044
- console.info("onAction", payload);
34045
34069
  },
34046
34070
  externalActions: props.externalActions
34047
34071
  }, props)