lu-lowcode-package-form 0.10.64 → 0.10.66
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 +363 -440
- package/dist/index.es.js +43969 -57145
- package/package.json +1 -1
- package/src/App.jsx +19 -19
- package/src/components/field/select/search-select.jsx +3 -1
- package/src/components/field/table/index.jsx +11 -8
package/package.json
CHANGED
package/src/App.jsx
CHANGED
@@ -105,7 +105,7 @@ function App() {
|
|
105
105
|
}
|
106
106
|
}
|
107
107
|
const setFormFields = () => {
|
108
|
-
formRef?.current?.setFieldsValue({
|
108
|
+
formRef?.current?.setFieldsValue({"__id":1,"userselect":"1213131","remark11":{"label":"选项1","value":"1","name":"1111","table":"[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]"},"table2":[{}],"table":[{"product_num1":"123","product_sum1":"","node_oclxmzswzti":"","select2":"","switch_table":false,"remark11":{"label":"选项2","value":"2"},"product_price12":"","tianchong1":{"label":"选项1","value":"1","tianchong2":{"label":"选项2","value":"2"},"tcinput1":"1111"},"tianchong2":{"label":"选项2","value":"2","tcinput1":"8989","tcinput2":"2222"},"tcinput1":"8989","tcinput2":"2222","tcinput3":"1111"},{"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_price11":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"}]})
|
109
109
|
// formRef?.current?.setFieldsValue({"tianchong1":{"label":"选项1","value":"1"}, })
|
110
110
|
}
|
111
111
|
const handleCols = () => {
|
@@ -210,9 +210,9 @@ function App() {
|
|
210
210
|
}
|
211
211
|
]} />
|
212
212
|
</Layout.FormRow>
|
213
|
-
<Field.Number label="测试" __id="aa2"
|
213
|
+
<Field.Number label="测试" __id="aa2" isRequired={true} />
|
214
214
|
<Field.Number label="测试" __id="aa3" readonly={readonly} />
|
215
|
-
<Field.Number label="测试" __id="aa1"
|
215
|
+
<Field.Number label="测试" __id="aa1" calcHidden={true} readonly={readonly} />
|
216
216
|
<Field.Number label="测试" __id="aa4" readonly={readonly} />
|
217
217
|
<Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} readonly={readonly} />
|
218
218
|
<Layout.FormGroupTitle title={"基本信息"} />
|
@@ -222,7 +222,7 @@ function App() {
|
|
222
222
|
// console.log("rightIconRender fieldName", fieldName)
|
223
223
|
return <><PrinterOutlined /></>
|
224
224
|
}}
|
225
|
-
|
225
|
+
ref={testRef} fillRules={[
|
226
226
|
{
|
227
227
|
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
228
228
|
"type": 0,
|
@@ -236,7 +236,7 @@ function App() {
|
|
236
236
|
|
237
237
|
<Field.Number label="税率(%)" __id="shuilv" calcHidden={true} />
|
238
238
|
|
239
|
-
<Field.WithSingleSelect
|
239
|
+
<Field.WithSingleSelect ref={testRef} fillRules={[
|
240
240
|
{
|
241
241
|
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
242
242
|
"type": 0,
|
@@ -269,7 +269,7 @@ function App() {
|
|
269
269
|
}
|
270
270
|
]} 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" />
|
271
271
|
<Layout.FormRow layout={'1'}>
|
272
|
-
<Field.Number label="测试规则"
|
272
|
+
<Field.Number label="测试规则" __id="ceshi_rule1" />
|
273
273
|
</Layout.FormRow>
|
274
274
|
<Layout.FormRow layout={'1'}>
|
275
275
|
<Field.Table label="子表格" __id="table2" isAllowCopy={true} >
|
@@ -278,7 +278,7 @@ function App() {
|
|
278
278
|
</Layout.FormRow>
|
279
279
|
|
280
280
|
<Field.WithSingleSelect
|
281
|
-
|
281
|
+
ref={testRef}
|
282
282
|
request={async (params) => {
|
283
283
|
console.log("request params", params);
|
284
284
|
const { page = 1 ,pageSize = 10} = params; // 获取当前页码,默认为1
|
@@ -330,10 +330,10 @@ function App() {
|
|
330
330
|
label="测试请求" __id="ceshirequest" />
|
331
331
|
|
332
332
|
<Layout.FormRow layout={'1'}>
|
333
|
-
<Field.Table label="子表格" __id="table" isAllowAdd={
|
333
|
+
<Field.Table label="子表格" __id="table" isAllowAdd={true} isAllowCopy={false} >
|
334
334
|
|
335
335
|
<Field.WithSingleSelect
|
336
|
-
|
336
|
+
ref={testRef}
|
337
337
|
request={async (params) => {
|
338
338
|
console.log("request params", params)
|
339
339
|
return { code: 0, data: { list: [{ label: '选项1', value: '1', tianchong2: { label: '选项2', value: '2' }, tcinput1: "1111", }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }] } }
|
@@ -360,7 +360,7 @@ function App() {
|
|
360
360
|
|
361
361
|
]} label="测试填充1" __id="tianchong1" />
|
362
362
|
<Field.WithSingleSelect
|
363
|
-
|
363
|
+
ref={testRef}
|
364
364
|
request={async (params) => {
|
365
365
|
if (!params?.value) return { code: 0, data: { list: [{ label: '选项1', value: '1', }] } }
|
366
366
|
await new Promise(resolve => setTimeout(resolve, 200))
|
@@ -419,7 +419,7 @@ function App() {
|
|
419
419
|
}}
|
420
420
|
/>
|
421
421
|
|
422
|
-
<Field.Number label="税率(%)"
|
422
|
+
<Field.Number label="税率(%)" calcHidden={true} __id="shuilv_table" withIds={[
|
423
423
|
"shuilv"
|
424
424
|
]}
|
425
425
|
withFill={{
|
@@ -493,8 +493,8 @@ function App() {
|
|
493
493
|
]} label="测试关联单选" __id="remark11" />
|
494
494
|
|
495
495
|
<Field.Switch label="开关" __id="switch_table"></Field.Switch>
|
496
|
-
<Field.Input defaultValue={3}
|
497
|
-
<Field.Input
|
496
|
+
<Field.Input defaultValue={3} label="含税单价" __id="product_price11" />
|
497
|
+
<Field.Input label="未税单价" __id="product_price12"
|
498
498
|
withIds={[
|
499
499
|
"table.product_price11",
|
500
500
|
"shuilv"
|
@@ -539,10 +539,10 @@ function App() {
|
|
539
539
|
]
|
540
540
|
}}
|
541
541
|
/>
|
542
|
-
<Field.Input
|
543
|
-
<Field.Input
|
544
|
-
<Field.Input
|
545
|
-
<Field.Input
|
542
|
+
<Field.Input defaultValue={1} label="商品价格" __id="product_price13" />
|
543
|
+
<Field.Input defaultValue={2} label="商品价格" __id="product_price14" />
|
544
|
+
<Field.Input label="商品价格" __id="product_price1" />
|
545
|
+
<Field.Input label="商品个数" __id="product_num1" />
|
546
546
|
<Field.Input disabled={true} label="商品总价" __id="product_sum1"
|
547
547
|
withIds={["table.product_price1", "table.product_num1"]}
|
548
548
|
withFill={{
|
@@ -637,7 +637,7 @@ function App() {
|
|
637
637
|
],
|
638
638
|
},]}></Field.PostSelect>
|
639
639
|
<Field.SearchSelect mode='multiple' label="搜组件" __id="searchuser" request={searchSelectRequest} option_search={"name"} option_label="name" option_value="id"></Field.SearchSelect>
|
640
|
-
<Field.Input
|
640
|
+
<Field.Input label="商品价格" __id="product_price" defaultValue={"12"} disabled={true} />
|
641
641
|
<Field.Input label="商品数量" __id="product_num" rules={"^(1[3-9]\\d{9})$"} />
|
642
642
|
<Field.NumberRange label="数量范围" __id="product_num_range" />
|
643
643
|
<Field.Input rules={["^(1[3-9]\\d{9})$", "^\\d+$"]} label="商品总价" __id="product_sum"
|
@@ -702,7 +702,7 @@ function App() {
|
|
702
702
|
}}>1111</div>
|
703
703
|
<Field.DatePicker defaultNow={true} label="datetime" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
|
704
704
|
<Field.DatePicker label="datetime2" prompt="" datetype="date" __id="datetime2" />
|
705
|
-
<Field.DatePicker
|
705
|
+
<Field.DatePicker disabled={true} defaultNow={true} label="datetime3" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
|
706
706
|
<Field.DatePicker defaultNow={true} label="datetime4" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
|
707
707
|
<Field.Input label="角色名称" __id="name" />
|
708
708
|
<Layout.FormRow layout={'1,1'}>
|
@@ -37,11 +37,13 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
|
|
37
37
|
// initData(requestParams)
|
38
38
|
// }, [requestParams, fieldsValue])
|
39
39
|
|
40
|
+
// 好像是这里会造成数据重置 ? undo
|
40
41
|
useEffect(() => {
|
41
42
|
console.log("SearchSelect useEffect shouldUpdateKey", shouldUpdateKey)
|
42
43
|
console.log("SearchSelect useEffect requestParams", requestParams)
|
43
44
|
initData(requestParams)
|
44
|
-
}, [shouldUpdateKey, requestParams])
|
45
|
+
// }, [shouldUpdateKey, requestParams])
|
46
|
+
}, [ requestParams])
|
45
47
|
|
46
48
|
// useEffect(() => {
|
47
49
|
// console.log("SearchSelect useEffect requestParams", requestParams)
|
@@ -2,16 +2,19 @@ import React, { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { Button, Form, Input,Popconfirm } from "antd";
|
3
3
|
import { CopyOutlined, DeleteOutlined } from "@ant-design/icons";
|
4
4
|
import { BaseWrapper } from "../base.jsx"
|
5
|
-
import { type } from "@testing-library/user-event/dist/type/index.js";
|
6
5
|
import { nanoid } from "nanoid";
|
7
6
|
import { eventEmitter } from '../../../utils/events'
|
8
7
|
|
9
8
|
const TableAction = ({ label, subTableIndex, children, subTableHead = false, ...props }) => {
|
10
9
|
//fsticky fright-0
|
11
|
-
return <div className="
|
10
|
+
return <div className="fsticky fright-0 fbg-white fborder-b " style={{
|
11
|
+
boxShadow: '-6px 0 6px -6px rgba(50,50,50,0.15)',
|
12
|
+
flex: '0 0 50px',
|
13
|
+
width: '50px'
|
14
|
+
}}>
|
12
15
|
<div className="frelative fw-full fh-full fflex fflex-col foverflow-hidden">
|
13
16
|
{label && subTableHead && <div className='fh-12 ffont-semibold fbg-[#fafafa] ftext-sm fflex fflex-nowrap ftext-nowrap fjustify-between fitems-center fpx-2 fborder-b'>{label}</div>}
|
14
|
-
<div className="fw-full fflex-1 fflex fitems-center fjustify-center fp-2 fbox-border fgap-2
|
17
|
+
<div className="fw-full fflex-1 fflex fitems-center fjustify-center fp-2 fbox-border fgap-2">
|
15
18
|
{children}
|
16
19
|
</div>
|
17
20
|
</div>
|
@@ -25,7 +28,7 @@ const TableCol = ({ children, width, hidden, ...props }) => {
|
|
25
28
|
setSWidth(width);
|
26
29
|
}, [width]);
|
27
30
|
if (hidden) return children;
|
28
|
-
return <div className="fflex-1 fpx-1" style={{ minWidth: `${sWidth}px` }} {...props}>
|
31
|
+
return <div className="fflex-1 fpx-1 fborder-b" style={{ minWidth: `${sWidth}px` }} {...props}>
|
29
32
|
{children}
|
30
33
|
</div>
|
31
34
|
}
|
@@ -65,7 +68,7 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
|
|
65
68
|
{(fields, { add, remove }) => {
|
66
69
|
if (fields.length === 0 && !init) handleAdd();
|
67
70
|
return <div className="fw-full ">
|
68
|
-
<div className="fw-full frelative fmin-h-20 foverflow-x-auto">
|
71
|
+
<div className="fw-full frelative fmin-h-20 foverflow-x-auto" style={{ position: 'relative' }}>
|
69
72
|
{fields.length === 0 && <div key={`tableHead`} className="fborder-b fflex flex-nowrap fmin-w-full ">
|
70
73
|
{React.Children.map(children, (child, childIndex) => {
|
71
74
|
const hidden = child?.props?.calcHidden;
|
@@ -76,13 +79,13 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
|
|
76
79
|
subTableHead: true,
|
77
80
|
subTableContent: false,
|
78
81
|
})}
|
79
|
-
</TableCol>
|
82
|
+
</TableCol>
|
80
83
|
})}
|
81
84
|
{disabled != true && readonly != true && <TableAction subTableHead={true} key={`row_${0}_action`} subTable={true} subTableIndex={0} label={"操作"}>
|
82
85
|
</TableAction>}
|
83
|
-
</div>}
|
86
|
+
</div>}
|
84
87
|
{fields.map((field, index) => (
|
85
|
-
<div key={`${tableId}.${field.key}`} className="
|
88
|
+
<div key={`${tableId}.${field.key}`} className=" fflex flex-nowrap fmin-w-full ">
|
86
89
|
|
87
90
|
{React.Children.map(children, (child, childIndex) => {
|
88
91
|
let { props } = child;
|