lu-lowcode-package-form 0.10.37 → 0.10.39

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.10.37",
3
+ "version": "0.10.39",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -601,8 +601,8 @@ function App() {
601
601
  <Field.UploadImage label="上传图片" __id="UploadImage" ></Field.UploadImage>
602
602
 
603
603
  </FormContainerWrapper>
604
- <div class="fgroup">11111
605
- <div class="fbg-red-500 group-hover:fbg-blue-500">
604
+ <div className="fgroup">11111
605
+ <div className="fbg-red-500 group-hover:fbg-blue-500">
606
606
  Hover over me or my parent!
607
607
  </div>
608
608
  </div>
package/src/App.jsx CHANGED
@@ -103,7 +103,7 @@ function App() {
103
103
  }
104
104
  }
105
105
  const setFormFields = () => {
106
- formRef?.current?.setFieldsValue({ "userselect": "1213131","tianchong1":{"label":"选项1","value":"1"}, "remark11": { "label": "选项1", "value": "1", "name": "1111", "table": "[{\"price\":1,\"num\":2, \"remark11\":\"{ label: '选项3', value: '3' }\"},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, "table": [{ "product_num1": "123", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "remark11": { "label": "选项2", "value": "2" }, "product_price12": "" }, { "product_num1": "213", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "datetime2": "2024-08-22 11:09:07", "product_price13": 1, "product_price14": 2, "product_price12": "", "remark11": { "label": "选项3", "value": "3" } }], "product_total_price": "0.00", "DeptSelect": ["leaf11"], "PostSelect": ["parent 1-1", "leaf11"], "searchuser": [{ "id": 2, "name": "2222", "label": "2222", "value": 2 }, { "id": 4, "name": "4444", "label": "4444", "value": 4 }], "product_price": "213", "product_num": "21", "product_num_range": [1, 22], "product_sum": "4473", "switch": false, "datetime": "2024-08-25", "datetime2": "2024-08-25", "datetime3": "", "datetime4": "2024-08-22 11:09:04", "remark12": [{ "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" }] })
106
+ formRef?.current?.setFieldsValue({ "id": 1, "userselect": "1213131", "tianchong1": { "label": "选项1", "value": "1" }, "remark11": { "label": "选项1", "value": "1", "name": "1111", "table": "[{\"price\":1,\"num\":2, \"remark11\":\"{ label: '选项3', value: '3' }\"},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, "table": [{ "product_num1": "123", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "remark11": { "label": "选项2", "value": "2" }, "product_price12": "" }, { "product_num1": "213", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "datetime2": "2024-08-22 11:09:07", "product_price13": 1, "product_price14": 2, "product_price12": "", "remark11": { "label": "选项3", "value": "3" } }], "product_total_price": "0.00", "DeptSelect": ["leaf11"], "PostSelect": ["parent 1-1", "leaf11"], "searchuser": [{ "id": 2, "name": "2222", "label": "2222", "value": 2 }, { "id": 4, "name": "4444", "label": "4444", "value": 4 }], "product_price": "213", "product_num": "21", "product_num_range": [1, 22], "product_sum": "4473", "switch": false, "datetime": "2024-08-25", "datetime2": "2024-08-25", "datetime3": "", "datetime4": "2024-08-22 11:09:04", "remark12": [{ "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" }] })
107
107
  // formRef?.current?.setFieldsValue({"tianchong1":{"label":"选项1","value":"1"}, })
108
108
  }
109
109
  const handleCols = () => {
@@ -117,7 +117,7 @@ function App() {
117
117
  return (
118
118
  <div className='fflex fflex-col fitems-center fh-screen '>
119
119
  <div className='fflex fgap-2 fitems-center fjustify-center fw-full'>
120
- <Button type="primary" onClick={()=>{
120
+ <Button type="primary" onClick={() => {
121
121
  setTestCalcHidden(!testCalcHidden)
122
122
  }}>testCalcHidden</Button>
123
123
  <Button type="primary" onClick={validateFields}>validateFields</Button>
@@ -178,30 +178,30 @@ function App() {
178
178
 
179
179
 
180
180
  <FormContainerWrapper cols={cols} className="" ref={formRef} >
181
- <Layout.FormRow layout={'1'}>
182
- <Show.WithTable label="测试关联子表" __id="withtable1"
183
- filterRules={[
184
- {
185
- "value": {
186
- "parent": "",
187
- "field_key": "aa2",
188
- "group_key": "fieldsValue",
189
- "field_name": "当前表单.测试"
190
- },
191
- "valueType": "variable",
192
- "column": {
193
- "label": "库存表.所在仓库",
194
- "value": "node_ocm009lpxt2",
195
- "column_name": "node_ocm009lpxt2",
196
- "column_type": ""
197
- }
181
+ <Layout.FormRow layout={'1'}>
182
+ <Show.WithTable label="测试关联子表" __id="withtable1"
183
+ filterRules={[
184
+ {
185
+ "value": {
186
+ "parent": "",
187
+ "field_key": "aa2",
188
+ "group_key": "fieldsValue",
189
+ "field_name": "当前表单.测试"
190
+ },
191
+ "valueType": "variable",
192
+ "column": {
193
+ "label": "库存表.所在仓库",
194
+ "value": "node_ocm009lpxt2",
195
+ "column_name": "node_ocm009lpxt2",
196
+ "column_type": ""
198
197
  }
199
- ]} />
198
+ }
199
+ ]} />
200
200
  </Layout.FormRow>
201
- <Field.Number label="测试" __id="aa2" />
202
- <Field.Number label="测试" __id="aa3" />
203
- <Field.Number label="测试" __id="aa1" isRequired={true} calcHidden={true} />
204
- <Field.Number label="测试" __id="aa4" />
201
+ <Field.Number label="测试" __id="aa2" />
202
+ <Field.Number label="测试" __id="aa3" />
203
+ <Field.Number label="测试" __id="aa1" isRequired={true} calcHidden={true} />
204
+ <Field.Number label="测试" __id="aa4" />
205
205
  <Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} />
206
206
  <Layout.FormGroupTitle title={"基本信息"} />
207
207
  <Field.WithSingleSelect
@@ -257,70 +257,97 @@ function App() {
257
257
  }
258
258
  ]} label="测试关联单选" options={[{ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, { label: '选项2', value: '2' }]} __id="remark11" />
259
259
  <Layout.FormRow layout={'1'}>
260
- <Field.Number label="测试规则" isRequired={true} __id="ceshi_rule1" />
260
+ <Field.Number label="测试规则" isRequired={true} __id="ceshi_rule1" />
261
261
  </Layout.FormRow>
262
-
262
+
263
263
  <Layout.FormRow layout={'1'}>
264
264
  <Field.Table label="子表格" __id="table" >
265
-
266
- <Field.WithSingleSelect
267
- isRequired={true} ref={testRef}
268
- request={async (params) => {
269
- return { code: 0, data: { list: [{ label: '选项1', value: '1', tianchong2: { label: '选项2', value: '2'} ,tcinput1: "1111" , }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
270
- }}
271
- option_label="label"
272
- option_value="value"
273
- fillRules={[
274
- {
275
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b19",
276
- "type": 0,
277
- "source": "tianchong2",
278
- "target": "tianchong2",
279
- "subRules": [
280
- ]
281
- },
282
- {
283
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b11",
284
- "type": 0,
285
- "source": "tcinput1",
286
- "target": "tcinput1",
287
- "subRules": [
288
- ]
289
- },
290
265
 
291
- ]} label="测试填充1" __id="tianchong1" />
292
- <Field.WithSingleSelect
293
- isRequired={true} ref={testRef}
294
- request={async (params) => {
295
- console.log("WithSingleSelect params", params)
296
- if (!params?.value) return { code: 0, data: { list: [{ label: '选项1', value: '1', }] } }
297
- await new Promise(resolve => setTimeout(resolve, 200))
298
- return { code: 0, data: { list: [{ label: '选项1', value: '1', }, { label: '选项2', value: '2' ,tcinput1: "8989",tcinput2: "2222" }, { label: '选项3', value: '3' }] } }
299
- }}
300
- option_label="label"
301
- option_value="value"
302
- option_search="label"
303
- fillRules={[
304
- {
305
- "id": "636d3924-0298-4e9b-809a-16d4a10d7b29",
306
- "type": 0,
307
- "source": "tcinput1",
308
- "target": "tcinput1",
309
- "subRules": [
310
- ]
311
- },
312
- {
313
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b29",
314
- "type": 0,
315
- "source": "tcinput2",
316
- "target": "tcinput2",
317
- "subRules": [
266
+ <Field.WithSingleSelect
267
+ isRequired={true} ref={testRef}
268
+ request={async (params) => {
269
+ return { code: 0, data: { list: [{ label: '选项1', value: '1', tianchong2: { label: '选项2', value: '2' }, tcinput1: "1111", }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
270
+ }}
271
+ option_label="label"
272
+ option_value="value"
273
+ fillRules={[
274
+ {
275
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b19",
276
+ "type": 0,
277
+ "source": "tianchong2",
278
+ "target": "tianchong2",
279
+ "subRules": [
280
+ ]
281
+ },
282
+ {
283
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b11",
284
+ "type": 0,
285
+ "source": "tcinput1",
286
+ "target": "tcinput1",
287
+ "subRules": [
288
+ ]
289
+ },
290
+
291
+ ]} label="测试填充1" __id="tianchong1" />
292
+ <Field.WithSingleSelect
293
+ isRequired={true} ref={testRef}
294
+ request={async (params) => {
295
+ if (!params?.value) return { code: 0, data: { list: [{ label: '选项1', value: '1', }] } }
296
+ await new Promise(resolve => setTimeout(resolve, 200))
297
+ return { code: 0, data: { list: [{ label: '选项1', value: '1', }, { label: '选项2', value: '2', tcinput1: "8989", tcinput2: "2222" }, { label: '选项3', value: '3' }] } }
298
+ }}
299
+ option_label="label"
300
+ option_value="value"
301
+ option_search="label"
302
+ fillRules={[
303
+ {
304
+ "id": "636d3924-0298-4e9b-809a-16d4a10d7b29",
305
+ "type": 0,
306
+ "source": "tcinput1",
307
+ "target": "tcinput1",
308
+ "subRules": [
309
+ ]
310
+ },
311
+ {
312
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b29",
313
+ "type": 0,
314
+ "source": "tcinput2",
315
+ "target": "tcinput2",
316
+ "subRules": [
317
+ ]
318
+ },
319
+
320
+ ]} label="测试填充2" __id="tianchong2" />
321
+ <Field.Input label="测试被填充1" __id="tcinput1" />
322
+ <Field.Input label="测试被填充2" __id="tcinput2" />
323
+ <Field.Input label="测试被填充计算" __id="tcinput3"
324
+ withIds={["table.tcinput2"]}
325
+ withFill={{
326
+ "value": [
327
+ {
328
+ "insert": {
329
+ "span": true
330
+ },
331
+ "attributes": {
332
+ "id": "table.tcinput2",
333
+ "color": "blue",
334
+ "tagKey": "fieldsValue",
335
+ "content": "当前表单.测试被填充2"
336
+ }
337
+ },
338
+ {
339
+ "insert": "* 0.5"
340
+ },
341
+ {
342
+ "insert": "\n\n"
343
+ }
344
+ ],
345
+ "version": 1719296886283,
346
+ "withData": [
347
+
318
348
  ]
319
- },
320
-
321
- ]} label="测试填充2" __id="tianchong2" />
322
- <Field.Input label="测试被填充1" __id="tcinput1" />
323
- <Field.Input label="测试被填充2" __id="tcinput2" />
349
+ }}
350
+ />
324
351
 
325
352
  <Field.Number label="税率(%)" isRequired={true} calcHidden={true} __id="shuilv_table" withIds={[
326
353
  "shuilv"
@@ -349,7 +376,6 @@ function App() {
349
376
 
350
377
  <Field.WithSingleSelect ref={testRef}
351
378
  request={async (params) => {
352
- console.log("WithSingleSelect params", params)
353
379
  if (params?.ruleParams?.node_ocm009lpxt2 == 111)
354
380
  return { code: 0, data: { list: [{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
355
381
  else return { code: 0, data: { list: [{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' },] } }
@@ -582,11 +608,10 @@ function App() {
582
608
 
583
609
  ]
584
610
  }} />
585
-
586
- <Field.SingleSelect mode="single" option_value={"id"} label="测试单选" __id="select1" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.SingleSelect>
611
+
612
+ <Field.SingleSelect mode="single" option_value={"id"} label="测试单选" __id="select1" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.SingleSelect>
587
613
  <Field.MultipleSelect mode="multiple" label="测多选" __id="select2" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]}></Field.MultipleSelect>
588
- <Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测多选2" __id="select2222" request={async (params) => {
589
- console.log("MultipleSelect params", params)
614
+ <Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测多选2" __id="select2222" request={async (params) => {
590
615
  return { code: 0, data: { list: [{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }] } }
591
616
  }}></Field.MultipleSelect>
592
617
  <Field.TreeSelect label="分组名" __id="title11"></Field.TreeSelect>
@@ -599,9 +624,9 @@ function App() {
599
624
  }}
600
625
  />
601
626
 
602
- <div className=' fh-10 fw-full fbg-green-300' __id="div1111"
603
- _componentName="Field.div"
604
- withIds={["switch"]}
627
+ <div className=' fh-10 fw-full fbg-green-300' __id="div1111"
628
+ _componentName="Field.div"
629
+ withIds={["switch"]}
605
630
  withFunc={(fieldsValue) => {
606
631
  return fieldsValue?.switch ? true : false
607
632
  }}>1111</div>
@@ -648,8 +673,8 @@ function App() {
648
673
  <Field.UploadImage label="上传图片" __id="UploadImage" ></Field.UploadImage>
649
674
 
650
675
  </FormContainerWrapper>
651
- <div class="fgroup">11111
652
- <div class="fbg-red-500 group-hover:fbg-blue-500">
676
+ <div className="fgroup">11111
677
+ <div className="fbg-red-500 group-hover:fbg-blue-500">
653
678
  Hover over me or my parent!
654
679
  </div>
655
680
  </div>
@@ -35,9 +35,6 @@ export const BaseWrapper = ({
35
35
  }) => {
36
36
  const calcHiddenRef = useRef(false);
37
37
  useEffect(()=>{
38
- console.log("typeof initializeFormRender", typeof initializeFormRender)
39
- console.log("calcHidden", calcHidden)
40
- console.log("calcHiddenRef.current", calcHiddenRef.current)
41
38
  if (calcHiddenRef.current != calcHidden)
42
39
  {
43
40
  typeof initializeFormRender == "function" && initializeFormRender();
@@ -12,7 +12,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
12
12
  useEffect(() => {
13
13
  // console.log("SearchSelect useEffect props", props)
14
14
  if (value) {
15
- console.log(`SearchSelect ${fieldName} value`, value)
15
+ // console.log(`SearchSelect ${fieldName} value`, value)
16
16
  let item = null
17
17
  if (Array.isArray(nOptions) && nOptions.length > 0) {
18
18
  item = nOptions.find(item => item.value == value?.value || item.value == value)
@@ -36,7 +36,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
36
36
  // }, [fieldsValue])
37
37
 
38
38
  useEffect(() => {
39
- console.log("SearchSelect useEffect requestParams", requestParams)
39
+ // console.log("SearchSelect useEffect requestParams", requestParams)
40
40
  initData(requestParams)
41
41
  }, [requestParams])
42
42
  // useEffect(()=>{
@@ -32,7 +32,7 @@ const TableCol = ({ children, width, hidden, ...props }) => {
32
32
 
33
33
  const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow, form, fieldName, initializeFormRender, mode, ...props }) => {
34
34
  useEffect(() => {
35
- console.log("Table form reload", form)
35
+ // console.log("Table form reload", form)
36
36
  }, [form])
37
37
 
38
38
  const newidRefs = useRef(React.Children.map(children, () => nanoid()));
@@ -33,7 +33,6 @@ const UploadImage = ({ maxCount, value, multiple, onChange, ...props }) => {
33
33
  }, [value]);
34
34
  maxCount = maxCount || 99;
35
35
  multiple = multiple || true;
36
- console.log("maxCount",maxCount)
37
36
  const [fileList, setFileList] = React.useState([]);
38
37
  const [previewImage, setPreviewImage] = useState('');
39
38
  const [previewImageIndex, setPreviewImageIndex] = useState(0);
@@ -115,7 +114,7 @@ const UploadImage = ({ maxCount, value, multiple, onChange, ...props }) => {
115
114
  {file.status == "done" && <EyeOutlined onClick={() => { handlePreview(file, index) }} className="hover:ftext-gray-200" />}
116
115
  <DeleteOutlined onClick={() => { handleDelete(file, index) }} className="hover:ftext-gray-200" />
117
116
  </div>
118
- <img src={file.url || file.base64} alt="Example Image" class="fmax-w-full fmax-h-full fobject-contain " />
117
+ <img src={file.url || file.base64} alt="Example Image" className="fmax-w-full fmax-h-full fobject-contain " />
119
118
  </div>
120
119
  </>
121
120
  )
@@ -135,7 +134,7 @@ const UploadImage = ({ maxCount, value, multiple, onChange, ...props }) => {
135
134
 
136
135
  </div>
137
136
  {file.status == "uploading" && <div className=" fw-full fh-full fflex fitems-center fjustify-center fabsolute ftop-0 fleft-0 "><Spin></Spin></div>}
138
- <img src={file.url || file.thumbUrl} alt="Example Image" class="fmax-w-full fmax-h-full fobject-contain " />
137
+ <img src={file.url || file.thumbUrl} alt="Example Image" className="fmax-w-full fmax-h-full fobject-contain " />
139
138
  </div>
140
139
  </>
141
140
  )
@@ -1,11 +1,11 @@
1
1
  import React, { forwardRef, useEffect } from "react";
2
2
  import { Form, Row, Col, message } from "antd";
3
3
 
4
- import { debounce, isEqual } from 'lodash';
4
+ import { debounce, isEqual, throttle } from 'lodash';
5
5
  import { evalFormula } from '../../utils/formula'
6
6
  import { nanoid } from 'nanoid';
7
- import {eventEmitter} from '../../utils/events'
8
-
7
+ import { eventEmitter } from '../../utils/events'
8
+
9
9
 
10
10
  function batchElements(elements, groupSize) {
11
11
  const groupedElements = [];
@@ -14,7 +14,7 @@ function batchElements(elements, groupSize) {
14
14
  const fillWithReactElement = (size, array) => {
15
15
  const missingElementsCount = size - array.length;
16
16
  if (missingElementsCount > 0)
17
- array.push(...new Array(missingElementsCount).fill(React.createElement('div')));
17
+ array.push(...new Array(missingElementsCount).fill(React.createElement('div')));
18
18
  };
19
19
 
20
20
  for (const element of elements) {
@@ -57,18 +57,29 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
57
57
  formRef: form,
58
58
  setFieldsValue: (values) => {
59
59
  lockStatus.current = 1;
60
- form.setFieldsValue(values)
60
+ form.setFieldsValue({...values,__id: values?.id })
61
61
  },
62
62
  initializeFieldVisibility,
63
63
  }), []);
64
64
 
65
+ // 添加节流后的 initializeFormRender
66
+ const throttledInitializeFormRender = React.useCallback(
67
+ throttle(() => {
68
+ initializeDependencyMap();
69
+ setFormContent(renderChildren());
70
+ }, 300),
71
+ []
72
+ );
73
+
65
74
  useEffect(() => {
66
- initializeFormRender();
75
+ throttledInitializeFormRender();
76
+ return () => {
77
+ throttledInitializeFormRender.cancel();
78
+ };
67
79
  }, [children, cols]);
68
80
 
69
- const initializeFormRender = ()=>{
70
- initializeDependencyMap();
71
- setFormContent(renderChildren());
81
+ const initializeFormRender = () => {
82
+ throttledInitializeFormRender();
72
83
  }
73
84
 
74
85
  const lastFormValues = React.useRef(null);
@@ -126,7 +137,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
126
137
  ...field
127
138
  });
128
139
  });
129
- console.log(" dependencyMap.current", dependencyMap.current)
140
+ console.log("dependencyMap.current", dependencyMap.current)
130
141
  initializeFieldVisibility();
131
142
  };
132
143
 
@@ -224,7 +235,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
224
235
  setValue = current_value[withFillIndex]?.[source]
225
236
  }
226
237
  }
227
- changedFields[target] = { name: [target], value: setValue};
238
+ changedFields[target] = { name: Array.isArray(target) ? target : [target], value: setValue };
228
239
  }
229
240
  if (rule?.type == 1) {
230
241
  form.setFieldValue(target, undefined);
@@ -232,9 +243,9 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
232
243
  form.setFieldValue(target, setValue)
233
244
  // handleFieldsWith(target, form.getFieldsValue())
234
245
  // setTimeout(() => {
235
- // form.setFieldValue(target, setValue)
236
- // handleFieldsWith(target, form.getFieldsValue())
237
- // if (idGroups.length > 0) handleTableAddRow(idGroups)
246
+ // form.setFieldValue(target, setValue)
247
+ // handleFieldsWith(target, form.getFieldsValue())
248
+ // if (idGroups.length > 0) handleTableAddRow(idGroups)
238
249
  // }, 0);
239
250
 
240
251
 
@@ -247,7 +258,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
247
258
  changedKeys.forEach(key => {
248
259
  changedFieldsState.current[key] = changedFields[key];
249
260
  })
250
- // console.log("changedFieldsState",changedFieldsState.current)
261
+
251
262
  debounceHandleFieldsChange();
252
263
  }
253
264
  // console.log("idGroups", idGroups)
@@ -273,10 +284,6 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
273
284
  // 处理级联数据源
274
285
  // 处理级联填充
275
286
  const handleFieldsWithFill = async (fieldValues, child, parentIdentifier, componentName) => {
276
-
277
-
278
-
279
-
280
287
  const withFill = child?.component?.props.withFill;
281
288
  const withDataFetch = child?.component?.props.withDataFetch;
282
289
  let withFillIndex = 0
@@ -400,7 +407,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
400
407
  // console.log("field",field.value)
401
408
  // console.log("getLastFieldValue(field.name)",getLastFieldValue(field.name))
402
409
  if (!isEqual(field.value, getLastFieldValue(field.name))) {
403
- if (lockStatus_ !=1){
410
+ if (lockStatus_ != 1) {
404
411
  needRefresh = handleFieldsWith(field.name, fieldValues);
405
412
  }
406
413
  lastFormValues.current[field.name] = field.value;
@@ -471,7 +478,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
471
478
  const isLayoutComponent = componentName && componentName.startsWith('Layout.');
472
479
  const isTable = componentName && componentName == 'Field.Table';
473
480
  const hidden = props.calcHidden && mode != "desgin";
474
-
481
+
475
482
  const rules = []
476
483
  if (props.isRequired)
477
484
  rules.push({ required: true, message: `${props.label}必须填写` });
@@ -488,13 +495,12 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
488
495
  }
489
496
  let childComponent
490
497
  if (isTable || isLayoutComponent)
491
- childComponent = React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange,initializeFormRender,mode })
498
+ childComponent = React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange, initializeFormRender, mode })
492
499
  else if (componentName === "Field.WithSingleSelect" || componentName === "Field.WithMultipleSelect" || componentName === "Show.WithTable") {
493
500
  childComponent = <Form.Item
494
501
  hidden={hidden}
495
502
  style={{ margin: 0 }}
496
503
  shouldUpdate={(prevValues, curValues) => {
497
- console.log(`componentName:${componentName}; identifier:${identifier};`,props.filterRules)
498
504
  let result = false;
499
505
  if (Array.isArray(props.filterRules) &&
500
506
  props.filterRules.length > 0
@@ -507,19 +513,18 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
507
513
  prevFieldValue = prevValues?.[rule.value.field_key];
508
514
  curFieldValue = curValues?.[rule.value.field_key];
509
515
  if (prevFieldValue !== curFieldValue) {
510
- result = true;
516
+ result = true;
511
517
  break;
512
518
  }
513
519
  }
514
520
  }
515
-
516
- console.log(`componentName:${componentName}; identifier:${identifier}; result:`, result)
521
+
517
522
  return result;
518
523
  }}
519
524
  >
520
- {({getFieldsValue}) => {
525
+ {({ getFieldsValue }) => {
521
526
  const fieldsValue = getFieldsValue();
522
- let element = React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange, fieldsValue,initializeFormRender })
527
+ let element = React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange, fieldsValue, initializeFormRender })
523
528
  return componentName === "show.WithTable" ? <>{element}</> : <Form.Item
524
529
  style={{ marginBottom: 0 }}
525
530
  label=""
@@ -538,17 +543,17 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
538
543
  name={identifier}
539
544
  rules={rules}
540
545
  >
541
- {React.cloneElement(child, { form: form, fieldName: identifier, onCustomChange,initializeFormRender })}
546
+ {React.cloneElement(child, { form: form, fieldName: identifier, onCustomChange, initializeFormRender })}
542
547
  </Form.Item>
543
548
  }
544
549
  return (
545
550
  <Col
546
- key={identifier || `col-${index}`}
547
- span={props.calcHidden ? 0 : (isLayoutComponent ? 24 : 24 / cols)}
548
- style={{ marginBottom: 0 }}
549
- >
550
- {childComponent}
551
- </Col>
551
+ key={identifier || `col-${index}`}
552
+ span={props.calcHidden ? 0 : (isLayoutComponent ? 24 : 24 / cols)}
553
+ style={{ marginBottom: 0 }}
554
+ >
555
+ {childComponent}
556
+ </Col>
552
557
  );
553
558
  })}
554
559
  </Row>
@@ -560,6 +565,9 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
560
565
  // console.log("changedValues", changedValues)
561
566
  // console.log("allValues", allValues)
562
567
  }} onFieldsChange={handleFieldsChange}>
568
+ <Form.Item name="__id" hidden={true}>
569
+ <input type="hidden" />
570
+ </Form.Item>
563
571
  {formContent}
564
572
  </Form>
565
573
  );