lu-lowcode-package-form 0.11.19 → 0.11.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.11.19",
3
+ "version": "0.11.21",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
package/src/App.jsx CHANGED
@@ -197,6 +197,30 @@ function App() {
197
197
  option_label="label"
198
198
  option_value="value"
199
199
  option_search="label" label="测试填充2" __id="fill_tianchong1_test" />
200
+
201
+ <Field.WithSingleSelect label="测试关联填充啥地方都是粉丝的" __id="fill_tianchong1_test2"
202
+ withIds={["fill_tianchong1_test"]}
203
+ withFill={{
204
+ "value": [
205
+ {
206
+ "insert": {
207
+ "span": true
208
+ },
209
+ "attributes": {
210
+ "id": "fill_tianchong1_test",
211
+ "color": "blue",
212
+ "tagKey": "fieldsValue",
213
+ "content": "当前表单.测试被填充2"
214
+ }
215
+ },
216
+
217
+ ],
218
+ "version": 1719296886283,
219
+ "withData": [
220
+
221
+ ]
222
+ }}
223
+ />
200
224
  <Field.RadioGroup
201
225
  buttonStyle="solid"
202
226
  label="菜单类型"
@@ -487,7 +487,12 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
487
487
  filter_value = filter_value[withFillIndex]
488
488
  }
489
489
  }
490
- if (componentName == "Field.WithSingleSelect" && filter_value && filter_value?.value) filter_value = filter_value.value
490
+ if (componentName == "Field.WithSingleSelect" && filter_value) {
491
+ if (typeof filter_value === "string") {
492
+ filter_value = JSON.parse(filter_value)
493
+ }
494
+ filter_value = filter_value?.value
495
+ }
491
496
  params.filter[condition_column.column_name] = filter_value
492
497
  }
493
498
 
@@ -561,6 +566,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
561
566
  result = withData.data[0]?.[id] ?? ""
562
567
  }
563
568
  }
569
+
564
570
  return result
565
571
  }
566
572
 
@@ -9,6 +9,7 @@ const evalFormula =(formula) => {
9
9
  const func = new Function(funcCode);
10
10
  result = func()
11
11
  // result = eval(formula.join(""));
12
+ if (!(typeof result === "object" && result !== null))
12
13
  result = result.toString();
13
14
  } catch (error) {
14
15
  console.error(`formula (${funcCode}) error`, error);
@@ -17,4 +18,12 @@ const evalFormula =(formula) => {
17
18
  return result
18
19
  };
19
20
 
21
+
22
+ // let demo = ["JSON.parse(`","{\"label\":\"1111\",\"value\":1}","`)\n\n"]
23
+
24
+ // let demo_result = evalFormula(demo)
25
+
26
+ // demo_result = JSON.stringify({value:demo_result?.value,label:demo_result?.label})
27
+
28
+ // console.log("demo_result",demo_result)
20
29
  export {evalFormula};