lu-lowcode-package-form 0.9.71 → 0.9.72

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/src/App.jsx CHANGED
@@ -139,6 +139,39 @@ function App() {
139
139
  <Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} />
140
140
  <Layout.FormGroupTitle title={"基本信息"} />
141
141
  <Field.Number label="税率(%)" __id="shuilv" />
142
+
143
+ <Field.WithSingleSelect ref={testRef} fillRules={[
144
+ {
145
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
146
+ "type": 0,
147
+ "source": "name",
148
+ "target": "name",
149
+ "subRules": [
150
+
151
+ ]
152
+ },
153
+ {
154
+ "id": "93401e38-60a4-4acf-84a6-8958785a4a30",
155
+ "type": 1,
156
+ "source": "table",
157
+ "target": "table",
158
+ "subRules": [
159
+ {
160
+ "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
161
+ "type": 0,
162
+ "source": "price",
163
+ "target": "product_price1"
164
+ },
165
+
166
+ {
167
+ "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
168
+ "type": 0,
169
+ "source": "num",
170
+ "target": "product_num1"
171
+ },
172
+ ]
173
+ }
174
+ ]} 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" />
142
175
  <Layout.FormRow layout={'1'}>
143
176
  <Field.Table label="子表格" __id="table" >
144
177
  <Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="date" __id="datetime2" />
@@ -171,7 +204,7 @@ function App() {
171
204
  ]
172
205
  },
173
206
 
174
- ]} label="测试关联单选" options={[{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }]} __id="remark11" />
207
+ ]} label="测试关联单选" options={[{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }, { label: '选项2', value: '2' }]} __id="remark11" />
175
208
 
176
209
  <Field.Switch label="开关" __id="switch_table"></Field.Switch>
177
210
  <Field.Input defaultValue={3} isRequired={true} label="含税单价" __id="product_price11" />
@@ -220,8 +253,8 @@ function App() {
220
253
  ]
221
254
  }}
222
255
  />
223
- <Field.Input isRequired={true} label="商品价格" __id="product_price13" />
224
- <Field.Input isRequired={true} label="商品价格" __id="product_price14" />
256
+ <Field.Input isRequired={true} defaultValue={1} label="商品价格" __id="product_price13" />
257
+ <Field.Input isRequired={true} defaultValue={2} label="商品价格" __id="product_price14" />
225
258
  <Field.Input isRequired={true} label="商品价格" __id="product_price1" />
226
259
  <Field.Input isRequired={true} label="商品个数" __id="product_num1" />
227
260
  <Field.Input label="商品总价" __id="product_sum1"
@@ -381,38 +414,6 @@ function App() {
381
414
  </Layout.FormRow>
382
415
  <Field.CheckboxTree label="角色权限" __id="permissions" addRoot={false} treeData={treeData} />
383
416
  <Layout.FormGroupTitle title={"关联信息"} />
384
- <Field.WithSingleSelect ref={testRef} disabled={true} fillRules={[
385
- {
386
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
387
- "type": 0,
388
- "source": "name",
389
- "target": "name",
390
- "subRules": [
391
-
392
- ]
393
- },
394
- {
395
- "id": "93401e38-60a4-4acf-84a6-8958785a4a30",
396
- "type": 1,
397
- "source": "table",
398
- "target": "table",
399
- "subRules": [
400
- {
401
- "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
402
- "type": 0,
403
- "source": "price",
404
- "target": "product_price1"
405
- },
406
-
407
- {
408
- "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
409
- "type": 0,
410
- "source": "num",
411
- "target": "product_num1"
412
- },
413
- ]
414
- }
415
- ]} label="测试关联单选" options={[{ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]" }, { label: '选项2', value: '2' }]} __id="remark11" />
416
417
  <Field.WithMultipleSelect disabled={true} label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
417
418
  <Layout.FormRow > <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
418
419
 
@@ -31,7 +31,10 @@ export const BaseWrapper = ({
31
31
  ...otherProps
32
32
  }) => {
33
33
  useEffect(()=>{
34
- if (defaultValue && typeof onChange === "function") onChange(defaultValue)
34
+ if (defaultValue && typeof onChange === "function") {
35
+ console.log("defaultValue changed", defaultValue)
36
+ onChange(defaultValue)
37
+ }
35
38
  },[defaultValue])
36
39
  if (!addWrapper) return children;
37
40
  // 不接管只读属性的组件
@@ -165,7 +165,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
165
165
  if (rule?.subRules && Array.isArray(rule?.subRules) && rule?.subRules.length > 0)
166
166
  for (let index = 0; index < rule?.subRules.length; index++) {
167
167
  const { source: subSource, target: subTarget } = rule?.subRules[index];
168
- target_value[subTarget] = item?.[subSource]
168
+ target_item_value[subTarget] = item?.[subSource]
169
169
  }
170
170
  return target_item_value
171
171
  })
@@ -274,7 +274,6 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
274
274
  const { insert, attributes } = item
275
275
  if (typeof insert !== "string") {
276
276
  if (insert?.span && attributes && attributes.tagKey && attributes.id) {
277
-
278
277
  result = getParamValue(attributes.tagKey, attributes.id, fieldValues, withDatas)
279
278
  if (Array.isArray(result)) {
280
279
  if (Array.isArray(childIdentifier) && result.length > withFillIndex) {