lu-lowcode-package-form 0.9.68 → 0.9.69

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
@@ -99,7 +99,7 @@ function App() {
99
99
  }
100
100
  }
101
101
  const setFormFields = () => {
102
- formRef?.current?.formRef?.setFieldsValue({datetime:"2024-08-08", "remark11": { "label": "选项2", "value": "2" }, "remark12": [{ "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" }], "userselect": "1213131", "DeptSelect": ["leaf11"], "searchuser": [{ "id": 2, "name": "2222", "label": "2222", "value": 2 }, { "id": 4, "name": "4444", "label": "4444", "value": 4 }], "PostSelect": '["parent 1-1","leaf11"]', "table": [{ "product_price1": "12", "product_num1": "123", "product_sum1": "1476", "node_oclxmzswzti": "", "select2": "" }, { "product_price1": "123", "product_num1": "213", "product_sum1": "26199", "node_oclxmzswzti": "", "select2": "" }], "product_total_price": "0.00", "product_price": "213", "product_num": "21", "product_num_range": [1, 22], "product_sum": "4473", "switch": false })
102
+ formRef?.current?.formRef?.setFieldsValue({ datetime: "2024-08-08", "remark11": { "label": "选项2", "value": "2" }, "remark12": [{ "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" }], "userselect": "1213131", "DeptSelect": ["leaf11"], "searchuser": [{ "id": 2, "name": "2222", "label": "2222", "value": 2 }, { "id": 4, "name": "4444", "label": "4444", "value": 4 }], "PostSelect": '["parent 1-1","leaf11"]', "table": [{ "product_price1": "12", "product_num1": "123", "product_sum1": "1476", "node_oclxmzswzti": "", "select2": "" }, { "product_price1": "123", "product_num1": "213", "product_sum1": "26199", "node_oclxmzswzti": "", "select2": "" }], "product_total_price": "0.00", "product_price": "213", "product_num": "21", "product_num_range": [1, 22], "product_sum": "4473", "switch": false })
103
103
  }
104
104
  const handleCols = () => {
105
105
  setCols(cols - 1)
@@ -136,40 +136,41 @@ function App() {
136
136
 
137
137
 
138
138
  <FormContainerWrapper cols={cols} className="" ref={formRef} >
139
- <Field.UserSelect label="选择用户" __id="userselect" defaultValue={ [{id:1,username: "十天"}]} />
139
+ <Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} />
140
140
  <Layout.FormGroupTitle title={"基本信息"} />
141
141
  <Layout.FormRow layout={'1'}>
142
142
  <Field.Table label="子表格" __id="table" >
143
- <Field.WithSingleSelect ref={testRef} fillRules={[
144
- {
145
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
146
- "type": 0,
147
- "source": "product_price11",
148
- "target": "product_price11",
149
- "subRules": [
143
+ <Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="date" __id="datetime2" />
144
+ <Field.WithSingleSelect ref={testRef} fillRules={[
145
+ {
146
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
147
+ "type": 0,
148
+ "source": "product_price11",
149
+ "target": "product_price11",
150
+ "subRules": [
150
151
 
151
- ]
152
- },
153
- {
154
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
155
- "type": 0,
156
- "source": "product_price12",
157
- "target": "product_price12",
158
- "subRules": [
152
+ ]
153
+ },
154
+ {
155
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
156
+ "type": 0,
157
+ "source": "product_price12",
158
+ "target": "product_price12",
159
+ "subRules": [
159
160
 
160
- ]
161
- },
162
- {
163
- "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
164
- "type": 0,
165
- "source": "product_price1",
166
- "target": "product_price1",
167
- "subRules": [
161
+ ]
162
+ },
163
+ {
164
+ "id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
165
+ "type": 0,
166
+ "source": "product_price1",
167
+ "target": "product_price1",
168
+ "subRules": [
168
169
 
169
- ]
170
- },
171
-
172
- ]} label="测试关联单选" options={[{ label: '选项1', value: '1', product_price11:"1111", product_price12:"2222",product_price1:111}, { label: '选项2', value: '2' }]} __id="remark11" />
170
+ ]
171
+ },
172
+
173
+ ]} label="测试关联单选" options={[{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }]} __id="remark11" />
173
174
 
174
175
  <Field.Switch label="开关" __id="switch_table"></Field.Switch>
175
176
  <Field.Input defaultValue={3} isRequired={true} label="商品价格" __id="product_price11" />
@@ -326,8 +327,8 @@ function App() {
326
327
  />
327
328
  <Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
328
329
  <Field.DatePicker label="日期时间" prompt="" datetype="date" value='2022-10-22' __id="datetime2" />
329
- <Field.DatePicker disabled={true} defaultNow={true} label="日期时间" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
330
- <Field.DatePicker defaultNow={true} label="年" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
330
+ <Field.DatePicker disabled={true} defaultNow={true} label="日期时间" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
331
+ <Field.DatePicker defaultNow={true} label="年" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
331
332
  <Field.Input label="角色名称" __id="name" />
332
333
  <Layout.FormRow layout={'1,1'}>
333
334
  <Field.Input label="角色名称布局" __id="name1" />
@@ -357,7 +358,7 @@ function App() {
357
358
  "source": "price",
358
359
  "target": "product_price1"
359
360
  },
360
-
361
+
361
362
  {
362
363
  "id": "c4a65ae5-58ff-4d7f-8738-a04de1acab61",
363
364
  "type": 0,
@@ -366,7 +367,7 @@ function App() {
366
367
  },
367
368
  ]
368
369
  }
369
- ]} label="测试关联单选" options={[{ label: '选项1', value: '1', name:"1111",table:"[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]"}, { label: '选项2', value: '2' }]} __id="remark11" />
370
+ ]} label="测试关联单选" options={[{ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]" }, { label: '选项2', value: '2' }]} __id="remark11" />
370
371
  <Field.WithMultipleSelect label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
371
372
  <Layout.FormRow > <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
372
373
 
@@ -407,9 +408,9 @@ function App() {
407
408
  <Button type="primary" onClick={validateFields}>validateFields</Button>
408
409
  <Button type="primary" onClick={getFormFields}>GetValues</Button>
409
410
  <Button type="primary" onClick={setFormFields}>SetValues</Button>
410
- <Button type="primary" onClick={()=>{
411
- console.log("testRef.current",testRef.current)
412
- testRef.current?.handleChange({ label: '选项1', value: '1', name:"1111",table:"[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]"})
411
+ <Button type="primary" onClick={() => {
412
+ console.log("testRef.current", testRef.current)
413
+ testRef.current?.handleChange({ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]" })
413
414
  }}>testwithref</Button>
414
415
  <Button type="primary" onClick={handleCols}>UpdateCol</Button>
415
416
  </div>
@@ -21,14 +21,14 @@ const DatePicker = ({ datetype, value, defaultNow, onChange, ...props }) => {
21
21
  const isChanged = useRef(false)
22
22
  useEffect(() => {
23
23
  if (defaultNow && !value && !isChanged.current) {
24
- onChange(dayjs())
24
+ typeof onChange === "function" && onChange(dayjs())
25
25
  return
26
26
  }
27
27
  if (value && typeof value === "string" && dayjs(value).isValid()) {
28
- onChange(dayjs(value))
28
+ typeof onChange === "function" && onChange(dayjs(value))
29
29
  return
30
30
  }
31
- }, [value, format, picker])
31
+ }, [value,onChange, format, picker])
32
32
 
33
33
  const handleChange = (value, dateString) => {
34
34
  isChanged.current = true