@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.mjs CHANGED
@@ -4142,10 +4142,12 @@ const handleImagePreview = async (config) => {
4142
4142
  const { urls, startIndex = 0 } = config.params || {};
4143
4143
  if (!urls || !urls.length) return;
4144
4144
  };
4145
- const handleUpdateLocalData = async (config, { setValues }) => {
4145
+ const handleUpdateLocalData = async (config, { setValues, extra }) => {
4146
+ var _a, _b;
4146
4147
  if (!setValues) return;
4147
4148
  const { updateKey, value } = config.params;
4148
- const key = updateKey;
4149
+ const key = updateKey || (extra == null ? void 0 : extra.key);
4150
+ const targetValue = value !== void 0 && value !== "" ? value : (_b = (_a = extra == null ? void 0 : extra.payload) == null ? void 0 : _a.value) != null ? _b : value;
4149
4151
  const ok = await confirmIfNeeded(config.params);
4150
4152
  if (!ok) return;
4151
4153
  setValues((prev2) => {
@@ -4153,16 +4155,16 @@ const handleUpdateLocalData = async (config, { setValues }) => {
4153
4155
  const isOldEmpty = oldValue === void 0 || oldValue === null || oldValue === "" || typeof oldValue === "object" && Object.keys(oldValue).length === 0;
4154
4156
  if (isOldEmpty) {
4155
4157
  return __spreadProps$p(__spreadValues$r({}, prev2 || {}), {
4156
- [key]: value
4158
+ [key]: targetValue
4157
4159
  });
4158
4160
  }
4159
- if (typeof oldValue === "object" && typeof value === "object" && !Array.isArray(oldValue) && !Array.isArray(value) && oldValue !== null && value !== null) {
4161
+ if (typeof oldValue === "object" && typeof targetValue === "object" && !Array.isArray(oldValue) && !Array.isArray(targetValue) && oldValue !== null && targetValue !== null) {
4160
4162
  return __spreadProps$p(__spreadValues$r({}, prev2 || {}), {
4161
- [key]: __spreadValues$r(__spreadValues$r({}, oldValue), value)
4163
+ [key]: __spreadValues$r(__spreadValues$r({}, oldValue), targetValue)
4162
4164
  });
4163
4165
  }
4164
4166
  return __spreadProps$p(__spreadValues$r({}, prev2 || {}), {
4165
- [key]: value
4167
+ [key]: targetValue
4166
4168
  });
4167
4169
  });
4168
4170
  };
@@ -4380,15 +4382,8 @@ var __spreadValues$q = (a, b) => {
4380
4382
  return a;
4381
4383
  };
4382
4384
  var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
4383
- const applySize = (props, scale = 1) => {
4384
- const style2 = { width: "100%" };
4385
- if (!props) return style2;
4386
- if (props.width != null) style2.width = runStyle(props.width, scale);
4387
- if (props.height != null) style2.height = runStyle(props.height, scale);
4388
- return style2;
4389
- };
4390
4385
  const baseContainerStyle = (props, scale = 1) => {
4391
- const style2 = __spreadValues$q(__spreadValues$q({}, applySize(props, scale)), (props == null ? void 0 : props.style) || {});
4386
+ const style2 = __spreadValues$q({}, (props == null ? void 0 : props.style) || {});
4392
4387
  return style2;
4393
4388
  };
4394
4389
  const childGapStyle = (index2, count, gap, horizontal, scale = 1) => {
@@ -4554,10 +4549,10 @@ const backgroundToStyle = (background, theme) => {
4554
4549
  return style2;
4555
4550
  };
4556
4551
  const borderRadiusToStyle = (borderRadius, theme, scale = 1) => {
4557
- const borderRadiusMap = theme.borderRadius;
4552
+ const borderRadiusMap = (theme == null ? void 0 : theme.borderRadius) || {};
4558
4553
  const style2 = {};
4559
4554
  if (borderRadius) {
4560
- style2.borderRadius = borderRadiusMap[borderRadius] ? runStyle(borderRadiusMap[borderRadius], scale) : runStyle(borderRadius);
4555
+ style2.borderRadius = borderRadiusMap[borderRadius] ? runStyle(borderRadiusMap[borderRadius], scale) : runStyle(borderRadius, scale);
4561
4556
  }
4562
4557
  return style2;
4563
4558
  };
@@ -4870,14 +4865,16 @@ const MultipleColumnLayout = ({
4870
4865
  });
4871
4866
  const itemContainerStyle = (child, idx) => {
4872
4867
  return __spreadProps$m(__spreadValues$o({}, buildItemContainerStyle(idx, count, props, true, scale)), {
4873
- flexShrink: itemFlexShrink(),
4868
+ flexShrink: itemFlexShrink(child),
4874
4869
  width: void 0
4875
4870
  });
4876
4871
  };
4877
4872
  const items = React__default.Children.toArray(children);
4878
4873
  const count = items.length;
4879
4874
  const itemFlexShrink = (child) => {
4880
- return 0;
4875
+ var _a, _b;
4876
+ if (((_b = (_a = child == null ? void 0 : child.props) == null ? void 0 : _a.node) == null ? void 0 : _b.props.flexShrink) == 0) return 0;
4877
+ return 1;
4881
4878
  };
4882
4879
  const handleClick = (e) => {
4883
4880
  if (props.actions) {
@@ -5195,8 +5192,8 @@ const TwoColumnLayout = ({
5195
5192
  "div",
5196
5193
  {
5197
5194
  style: __spreadProps$h(__spreadValues$j({}, buildItemContainerStyle(idx, count, props, true, scale)), {
5198
- flex: idx === 1 ? 1 : 0,
5199
- width: idx === 1 ? runStyle(props.leftWidth, scale) : "auto",
5195
+ flex: idx === 1 ? 1 : "none",
5196
+ width: idx === 0 ? runStyle(props == null ? void 0 : props.leftWidth) : "auto",
5200
5197
  flexDirection: "row"
5201
5198
  }),
5202
5199
  children: child
@@ -29584,11 +29581,17 @@ var __spreadValues$b = (a, b) => {
29584
29581
  };
29585
29582
  var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
29586
29583
  const InputRender = (props) => {
29587
- var _a;
29588
29584
  const { scale } = useResponsive();
29589
29585
  const { executeActions } = useAction$1();
29590
29586
  const { ref: ref2, onClick, onMouseEnter, onMouseLeave } = useForEditor(props);
29591
29587
  const style2 = baseContainerStyle(props, scale);
29588
+ const handleChange = (e) => {
29589
+ if (props.actions) {
29590
+ void executeActions(props.actions, {
29591
+ payload: { value: e.target.value }
29592
+ });
29593
+ }
29594
+ };
29592
29595
  const handleContainerClick = (e) => {
29593
29596
  if (props == null ? void 0 : props.actions) {
29594
29597
  void executeActions(props.actions);
@@ -29605,13 +29608,10 @@ const InputRender = (props) => {
29605
29608
  children: /* @__PURE__ */ jsx(
29606
29609
  Input2,
29607
29610
  {
29608
- value: (_a = props.value) != null ? _a : "",
29609
29611
  placeholder: props.placeholder,
29610
- onChange: (e) => {
29611
- var _a2;
29612
- return (_a2 = props.onChange) == null ? void 0 : _a2.call(props, e.target.value);
29613
- },
29614
- style: { width: "100%" }
29612
+ onChange: handleChange,
29613
+ style: { width: "100%" },
29614
+ variant: "borderless"
29615
29615
  }
29616
29616
  )
29617
29617
  })
@@ -29702,11 +29702,16 @@ const RadioRender = (props) => {
29702
29702
  const style2 = baseContainerStyle(props, scale);
29703
29703
  const valueStr = props.value != null ? String(props.value) : void 0;
29704
29704
  const handleContainerClick = (e) => {
29705
- if (props == null ? void 0 : props.actions) {
29706
- void executeActions(props.actions);
29707
- }
29708
29705
  onClick(e);
29709
29706
  };
29707
+ const handleChange = (e) => {
29708
+ var _a;
29709
+ const val = e.target.value;
29710
+ (_a = props.onChange) == null ? void 0 : _a.call(props, e);
29711
+ if (props.actions) {
29712
+ void executeActions(props.actions, { payload: { value: val } });
29713
+ }
29714
+ };
29710
29715
  return /* @__PURE__ */ jsx(
29711
29716
  "div",
29712
29717
  __spreadProps$7(__spreadValues$9({
@@ -29714,10 +29719,30 @@ const RadioRender = (props) => {
29714
29719
  onClick: handleContainerClick,
29715
29720
  ref: ref2
29716
29721
  }, { onMouseEnter, onMouseLeave }), {
29717
- children: /* @__PURE__ */ jsx(Group$1, { onChange: props.onChange, value: valueStr, children: (props.options || []).map((opt) => {
29718
- const ov = String(opt.value);
29719
- return /* @__PURE__ */ jsx(Radio, { value: ov, style: props.itemStyle, children: opt.label }, ov);
29720
- }) })
29722
+ children: /* @__PURE__ */ jsx(
29723
+ ConfigProvider,
29724
+ {
29725
+ theme: {
29726
+ token: {
29727
+ colorPrimary: "#1bb193"
29728
+ }
29729
+ },
29730
+ children: /* @__PURE__ */ jsx(
29731
+ Group$1,
29732
+ {
29733
+ onChange: handleChange,
29734
+ value: valueStr,
29735
+ defaultValue: props.defaultValue,
29736
+ optionType: "button",
29737
+ buttonStyle: "solid",
29738
+ children: (props.options || []).map((opt) => {
29739
+ const ov = String(opt.value);
29740
+ return /* @__PURE__ */ jsx(Radio, { value: ov, style: props.itemStyle, children: opt.label }, ov);
29741
+ })
29742
+ }
29743
+ )
29744
+ }
29745
+ )
29721
29746
  })
29722
29747
  );
29723
29748
  };
@@ -34024,7 +34049,6 @@ const MessageCard = (props) => {
34024
34049
  }),
34025
34050
  theme,
34026
34051
  onAction: (payload) => {
34027
- console.info("onAction", payload);
34028
34052
  },
34029
34053
  externalActions: props.externalActions
34030
34054
  }, props)