lu-lowcode-package-form 0.9.66 → 0.9.68
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/dist/index.cjs.js +2 -2
- package/dist/index.es.js +303 -296
- package/package.json +1 -1
- package/src/App.jsx +4 -4
- package/src/components/field/date-picker/index.jsx +13 -8
package/package.json
CHANGED
package/src/App.jsx
CHANGED
@@ -99,7 +99,7 @@ function App() {
|
|
99
99
|
}
|
100
100
|
}
|
101
101
|
const setFormFields = () => {
|
102
|
-
formRef?.current?.formRef?.setFieldsValue({ "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)
|
@@ -324,10 +324,10 @@ function App() {
|
|
324
324
|
return fieldsValue?.switch ? true : false
|
325
325
|
}}
|
326
326
|
/>
|
327
|
-
<Field.DatePicker label="日期时间" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
|
327
|
+
<Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
|
328
328
|
<Field.DatePicker label="日期时间" prompt="" datetype="date" value='2022-10-22' __id="datetime2" />
|
329
|
-
<Field.DatePicker label="日期时间" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
|
330
|
-
<Field.DatePicker label="年" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
|
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" />
|
331
331
|
<Field.Input label="角色名称" __id="name" />
|
332
332
|
<Layout.FormRow layout={'1,1'}>
|
333
333
|
<Field.Input label="角色名称布局" __id="name1" />
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
2
2
|
import { DatePicker as OriginalDatePicker, Button } from 'antd';
|
3
3
|
import { BaseWrapper } from "../base.jsx"
|
4
4
|
import dayjs from 'dayjs';
|
@@ -9,24 +9,29 @@ import updateLocale from 'dayjs/plugin/updateLocale';
|
|
9
9
|
|
10
10
|
dayjs.extend(updateLocale);
|
11
11
|
dayjs.updateLocale('zh-cn', {
|
12
|
-
|
12
|
+
weekStart: 0,
|
13
13
|
});
|
14
14
|
|
15
|
-
const DatePicker = ({ datetype, value, onChange, ...props }) => {
|
15
|
+
const DatePicker = ({ datetype, value, defaultNow, onChange, ...props }) => {
|
16
16
|
datetype = datetype || "date"
|
17
17
|
const [picker, setPicker] = useState(props?.picker)
|
18
18
|
const [format, setFormat] = useState(props?.format)
|
19
|
-
const [nValue, setNValue] = useState(null)
|
20
19
|
const [showTime, setShowTime] = useState(false)
|
21
20
|
const [needConfirm, setNeedConfirm] = useState(false)
|
21
|
+
const isChanged = useRef(false)
|
22
22
|
useEffect(() => {
|
23
|
-
if (value) {
|
24
|
-
|
25
|
-
|
23
|
+
if (defaultNow && !value && !isChanged.current) {
|
24
|
+
onChange(dayjs())
|
25
|
+
return
|
26
|
+
}
|
27
|
+
if (value && typeof value === "string" && dayjs(value).isValid()) {
|
28
|
+
onChange(dayjs(value))
|
29
|
+
return
|
26
30
|
}
|
27
31
|
}, [value, format, picker])
|
28
32
|
|
29
33
|
const handleChange = (value, dateString) => {
|
34
|
+
isChanged.current = true
|
30
35
|
onChange(dateString)
|
31
36
|
}
|
32
37
|
|
@@ -65,7 +70,7 @@ const DatePicker = ({ datetype, value, onChange, ...props }) => {
|
|
65
70
|
}, [datetype])
|
66
71
|
return (
|
67
72
|
<BaseWrapper {...props}>
|
68
|
-
<OriginalDatePicker locale={zh} {...props} picker={picker} format={format} style={{ width: '100%' }} onChange={handleChange} value={
|
73
|
+
<OriginalDatePicker locale={zh} {...props} picker={picker} format={format} style={{ width: '100%' }} onChange={handleChange} value={typeof value == "object" ? value : undefined} showTime={showTime} needConfirm={needConfirm} />
|
69
74
|
</BaseWrapper>
|
70
75
|
);
|
71
76
|
}
|