lu-lowcode-package-form 0.10.45 → 0.10.47

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.10.45",
3
+ "version": "0.10.47",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
package/src/App.jsx CHANGED
@@ -79,6 +79,8 @@ function App() {
79
79
  const formRef = React.createRef();
80
80
  const testRef = React.useRef()
81
81
  const [testCalcHidden, setTestCalcHidden] = useState(false);
82
+ const [readonly, setReadonly] = useState(true);
83
+
82
84
  useEffect(() => {
83
85
  // console.log("testRef //////", testRef.current)
84
86
  }, [testRef.current])
@@ -107,11 +109,15 @@ function App() {
107
109
  // formRef?.current?.setFieldsValue({"tianchong1":{"label":"选项1","value":"1"}, })
108
110
  }
109
111
  const handleCols = () => {
110
- setCols(cols - 1)
112
+
113
+ setCols(cols == 1 ? 3 : cols - 1)
111
114
  }
112
115
 
113
116
  const [items, setItems] = useState(['Item 1', 'Item 2', 'Item 3', 'Item 4']);
114
117
 
118
+ const handleUpdateReadonly = () => {
119
+ setReadonly(!readonly)
120
+ }
115
121
 
116
122
  const [sortItems, setSortItems] = useState([{ id: 1, content: "sdfsfd" }, { id: 2, content: "sdfsfd2" }, { id: 3, content: "sdfsfd3" }]);
117
123
  return (
@@ -127,7 +133,9 @@ function App() {
127
133
  console.log("testRef.current", testRef.current)
128
134
  testRef.current?.handleChange({ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]" })
129
135
  }}>testwithref</Button>
130
- <Button type="primary" onClick={handleCols}>UpdateCol</Button></div>
136
+ <Button type="primary" onClick={handleCols}>UpdateCol</Button>
137
+ <Button type="primary" onClick={handleUpdateReadonly}>UpdateReadonly</Button>
138
+ </div>
131
139
 
132
140
  <div className=" fflex fflex-col fitems-center fflex-1 foverflow-y-auto">
133
141
  <DraggableBtn />
@@ -178,7 +186,11 @@ function App() {
178
186
 
179
187
 
180
188
  <FormContainerWrapper cols={cols} className="" ref={formRef} >
189
+ <Field.MultipleSelect mode="multiple" option_label={"label"} option_value={"value"} label="测试过滤条件" __id="selecta1" request={async (params) => {
190
+ return { code: 0, data: { list: [{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }] } }
191
+ }}></Field.MultipleSelect>
181
192
  <Layout.FormRow layout={'1'}>
193
+
182
194
  <Show.WithTable label="测试关联子表" __id="withtable1"
183
195
  filterRules={[
184
196
  {
@@ -198,11 +210,11 @@ function App() {
198
210
  }
199
211
  ]} />
200
212
  </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" />
205
- <Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} />
213
+ <Field.Number label="测试" __id="aa2" readonly={readonly} />
214
+ <Field.Number label="测试" __id="aa3" readonly={readonly} />
215
+ <Field.Number label="测试" __id="aa1" isRequired={true} calcHidden={true} readonly={readonly} />
216
+ <Field.Number label="测试" __id="aa4" readonly={readonly} />
217
+ <Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} readonly={readonly} />
206
218
  <Layout.FormGroupTitle title={"基本信息"} />
207
219
  <Field.WithSingleSelect
208
220
  rightIconRender={({ form, fieldName }) => {
@@ -68,8 +68,9 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
68
68
  initializeDependencyMap();
69
69
  setFormContent(renderChildren());
70
70
  }, 300),
71
- []
71
+ [children, cols]
72
72
  );
73
+
73
74
 
74
75
  useEffect(() => {
75
76
  throttledInitializeFormRender();
@@ -491,6 +492,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
491
492
  }),
492
493
  cols
493
494
  );
495
+
494
496
 
495
497
  return groupedChildren.map((group, index) => (
496
498
  <Row key={`row-${index}`} gutter={[24, 24]}>
@@ -543,7 +545,11 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
543
545
  }
544
546
  }
545
547
  }
546
-
548
+ console.log(" ")
549
+ console.log("prevValues",prevValues)
550
+ console.log("curValues",curValues)
551
+ console.log("result",result)
552
+ console.log(" ")
547
553
  return result;
548
554
  }}
549
555
  >