lu-lowcode-package-form 0.9.16 → 0.9.18
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 +157 -145
- package/dist/index.es.js +8828 -7696
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/App.jsx +14 -11
- package/src/components/field/base.jsx +17 -4
- package/src/components/field/checkbox/index.jsx +2 -16
- package/src/components/field/input/index.jsx +11 -1
- package/src/components/field/table/index.jsx +1 -1
- package/src/components/field/upload/upload-file.jsx +1 -2
- package/src/components/field/upload/upload-image.jsx +1 -4
- package/src/components/form-container/index.jsx +41 -14
- package/src/components/index.jsx +9 -1
- package/src/utils/formula.js +2 -1
package/dist/style.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.fabsolute{position:absolute}.frelative{position:relative}.fleft-0{left:0}.ftop-0{top:0}.fz-10{z-index:10}.fmt-2{margin-top:.5rem}.fflex{display:flex}.finline-flex{display:inline-flex}.fhidden{display:none}.fh-11{height:2.75rem}.fh-12{height:3rem}.fh-24{height:6rem}.fh-8{height:2rem}.fh-full{height:100%}.fmax-h-full{max-height:100%}.fmin-h-20{min-height:5rem}.fmin-h-5{min-height:1.25rem}.fw-16{width:4rem}.fw-24{width:6rem}.fw-\[960px\]{width:960px}.fw-full{width:100%}.fmin-w-36{min-width:9rem}.fmin-w-full{min-width:100%}.fmax-w-full{max-width:100%}.fflex-1{flex:1 1 0%}.fcursor-pointer{cursor:pointer}.fflex-col{flex-direction:column}.fflex-wrap{flex-wrap:wrap}.fitems-center{align-items:center}.fitems-stretch{align-items:stretch}.fjustify-center{justify-content:center}.fjustify-between{justify-content:space-between}.fgap-1{gap:.25rem}.fgap-2{gap:.5rem}.fgap-3{gap:.75rem}.foverflow-hidden{overflow:hidden}.foverflow-x-auto{overflow-x:auto}.frounded{border-radius:.25rem}.fborder{border-width:1px}.fborder-b{border-bottom-width:1px}.fborder-l-4{border-left-width:4px}.fborder-dashed{border-style:dashed}.fborder-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.fborder-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.fborder-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.fbg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.fbg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.fbg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.fbg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.fbg-transparent{background-color:transparent}.fbg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fbg-opacity-50{--tw-bg-opacity: .5}.fobject-contain{object-fit:contain}.fp-2{padding:.5rem}.fp-4{padding:1rem}.fp-6{padding:1.5rem}.fpx-2{padding-left:.5rem;padding-right:.5rem}.fpb-10{padding-bottom:2.5rem}.fpl-2{padding-left:.5rem}.ftext-lg{font-size:1.125rem;line-height:1.75rem}.ftext-sm{font-size:.875rem;line-height:1.25rem}.ftext-xs{font-size:.75rem;line-height:1rem}.ffont-medium{font-weight:500}.ffont-semibold{font-weight:600}.ftext-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.ftext-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:fborder-\[\#3e92f8\]:hover{--tw-border-opacity: 1;border-color:rgb(62 146 248 / var(--tw-border-opacity))}.hover\:ftext-\[\#3e92f8\]:hover{--tw-text-opacity: 1;color:rgb(62 146 248 / var(--tw-text-opacity))}.hover\:ftext-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.fgroup:hover .group-hover\:fflex{display:flex}.fgroup:hover .group-hover\:fbg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}/*!
|
|
1
|
+
*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.fabsolute{position:absolute}.frelative{position:relative}.fleft-0{left:0}.ftop-0{top:0}.fz-10{z-index:10}.fmt-2{margin-top:.5rem}.fflex{display:flex}.finline-flex{display:inline-flex}.fhidden{display:none}.fh-11{height:2.75rem}.fh-12{height:3rem}.fh-24{height:6rem}.fh-8{height:2rem}.fh-full{height:100%}.fmax-h-full{max-height:100%}.fmin-h-20{min-height:5rem}.fmin-h-5{min-height:1.25rem}.fw-16{width:4rem}.fw-24{width:6rem}.fw-\[960px\]{width:960px}.fw-full{width:100%}.fmin-w-36{min-width:9rem}.fmin-w-full{min-width:100%}.fmax-w-full{max-width:100%}.fflex-1{flex:1 1 0%}.fcursor-pointer{cursor:pointer}.fflex-col{flex-direction:column}.fflex-wrap{flex-wrap:wrap}.fitems-center{align-items:center}.fitems-stretch{align-items:stretch}.fjustify-center{justify-content:center}.fjustify-between{justify-content:space-between}.fgap-1{gap:.25rem}.fgap-2{gap:.5rem}.fgap-3{gap:.75rem}.foverflow-hidden{overflow:hidden}.foverflow-x-auto{overflow-x:auto}.frounded{border-radius:.25rem}.fborder{border-width:1px}.fborder-b{border-bottom-width:1px}.fborder-l-4{border-left-width:4px}.fborder-dashed{border-style:dashed}.fborder-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.fborder-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.fborder-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.fbg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.fbg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.fbg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.fbg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.fbg-transparent{background-color:transparent}.fbg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fbg-opacity-50{--tw-bg-opacity: .5}.fobject-contain{object-fit:contain}.fp-2{padding:.5rem}.fp-4{padding:1rem}.fp-6{padding:1.5rem}.fpx-2{padding-left:.5rem;padding-right:.5rem}.fpb-10{padding-bottom:2.5rem}.fpl-2{padding-left:.5rem}.ftext-lg{font-size:1.125rem;line-height:1.75rem}.ftext-sm{font-size:.875rem;line-height:1.25rem}.ftext-xs{font-size:.75rem;line-height:1rem}.ffont-medium{font-weight:500}.ffont-semibold{font-weight:600}.ftext-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.ftext-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.ftext-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:fborder-\[\#3e92f8\]:hover{--tw-border-opacity: 1;border-color:rgb(62 146 248 / var(--tw-border-opacity))}.hover\:ftext-\[\#3e92f8\]:hover{--tw-text-opacity: 1;color:rgb(62 146 248 / var(--tw-text-opacity))}.hover\:ftext-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.fgroup:hover .group-hover\:fflex{display:flex}.fgroup:hover .group-hover\:fbg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}/*!
|
|
2
2
|
* Quill Editor v1.3.7
|
|
3
3
|
* https://quilljs.com/
|
|
4
4
|
* Copyright (c) 2014, Jason Chen
|
package/package.json
CHANGED
package/src/App.jsx
CHANGED
|
@@ -82,7 +82,7 @@ function App() {
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
<FormContainerWrapper cols={cols} className="" ref={formRef} >
|
|
85
|
-
<Layout.FormRow
|
|
85
|
+
<Layout.FormRow layout={'1'}>
|
|
86
86
|
<Field.Table label="子表格" __id="table" >
|
|
87
87
|
<Field.Input label="商品价格" __id="product_price1" />
|
|
88
88
|
<Field.Input label="商品数量" __id="product_num1" />
|
|
@@ -145,6 +145,9 @@ function App() {
|
|
|
145
145
|
"content": "当前表单.标签.小计"
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
|
+
{
|
|
149
|
+
"insert": ".reduce((acc, curr) => parseFloat(acc||0) + parseFloat(curr||0), 0).toFixed(2)"
|
|
150
|
+
},
|
|
148
151
|
{
|
|
149
152
|
"insert": "\n"
|
|
150
153
|
}
|
|
@@ -155,7 +158,7 @@ function App() {
|
|
|
155
158
|
]
|
|
156
159
|
}}
|
|
157
160
|
/>
|
|
158
|
-
<Field.SearchSelect
|
|
161
|
+
<Field.SearchSelect label="搜组件" option_search="username" option_label="username" setValue={() => { }} option_value="id"></Field.SearchSelect>
|
|
159
162
|
<Field.Input label="商品价格" __id="product_price" />
|
|
160
163
|
<Field.Input label="商品数量" __id="product_num" />
|
|
161
164
|
<Field.Input label="商品总价" __id="product_sum"
|
|
@@ -211,25 +214,25 @@ function App() {
|
|
|
211
214
|
<Field.DatePicker label="日期时间" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
|
|
212
215
|
<Field.DatePicker label="年" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
|
|
213
216
|
<Field.Input label="角色名称" __id="name" />
|
|
214
|
-
<Layout.FormRow
|
|
217
|
+
<Layout.FormRow layout={'1,1,1'}>
|
|
215
218
|
<Field.Input label="角色名称布局" __id="name1" />
|
|
216
219
|
<Field.Input label="角色名称布局2" __id="name2" />
|
|
217
220
|
<Field.Input label="角色名称布局3" __id="name3" />
|
|
218
221
|
</Layout.FormRow>
|
|
219
222
|
<Field.CheckboxTree label="角色权限" __id="permissions" addRoot={false} treeData={treeData} />
|
|
220
|
-
<Layout.FormGroupTitle
|
|
223
|
+
<Layout.FormGroupTitle title={"关联信息"} />
|
|
221
224
|
<Field.WithSingleSelect label="测试关联单选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark11" />
|
|
222
225
|
<Field.WithMultipleSelect label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
|
|
223
|
-
<Layout.FormRow
|
|
226
|
+
<Layout.FormRow > <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
|
|
224
227
|
|
|
225
|
-
<Layout.FormRow
|
|
226
|
-
<Field.RadioGroup
|
|
228
|
+
<Layout.FormRow layout={'1'}>
|
|
229
|
+
<Field.RadioGroup options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="单选框" __id="radio" ></Field.RadioGroup>
|
|
227
230
|
</Layout.FormRow>
|
|
228
|
-
<Layout.FormRow
|
|
229
|
-
<Field.CheckboxGroup
|
|
231
|
+
<Layout.FormRow layout={'1'}>
|
|
232
|
+
<Field.CheckboxGroup options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} label="多选框" __id="CheckboxGroup" ></Field.CheckboxGroup>
|
|
230
233
|
</Layout.FormRow>
|
|
231
|
-
<Field.UploadFile
|
|
232
|
-
<Field.UploadImage
|
|
234
|
+
<Field.UploadFile label="上传文件" __id="UploadFile" ></Field.UploadFile>
|
|
235
|
+
<Field.UploadImage label="上传图片" __id="UploadImage" ></Field.UploadImage>
|
|
233
236
|
|
|
234
237
|
</FormContainerWrapper>
|
|
235
238
|
<div class="fgroup">11111
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
const FieldLable = ({value,onChange})=>{
|
|
4
|
+
const [text, setText] = useState("");
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
setText(value);
|
|
7
|
+
console.log("value changed", value)
|
|
8
|
+
}, [value]);
|
|
9
|
+
return <>{text}</>
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
export const BaseWrapper = function BaseWrapper({
|
|
2
13
|
label,
|
|
3
14
|
children,
|
|
@@ -10,9 +21,10 @@ export const BaseWrapper = function BaseWrapper({
|
|
|
10
21
|
if (!addWrapper) return children;
|
|
11
22
|
const formWarpper = (
|
|
12
23
|
<div className="frelative">
|
|
13
|
-
{label && <div className='fh-8 ftext-sm fflex fjustify-between fitems-center'>{label}</div>}
|
|
14
|
-
<div className="fw-full fflex fitems-stretch">
|
|
15
|
-
|
|
24
|
+
{label && <div className='fh-8 ftext-gray-500 ftext-sm fflex fjustify-between fitems-center'>{label}</div>}
|
|
25
|
+
<div className="fw-full fflex fitems-stretch ftext-gray-900">
|
|
26
|
+
{/* <FieldLable value={otherProps?.value} /> */}
|
|
27
|
+
{children}
|
|
16
28
|
</div>
|
|
17
29
|
{!subTable && <div className="ftext-xs ftext-gray-500 fmin-h-5 fflex fitems-center">{prompt}</div>}
|
|
18
30
|
</div>
|
|
@@ -22,7 +34,8 @@ export const BaseWrapper = function BaseWrapper({
|
|
|
22
34
|
<div className="frelative fw-full">
|
|
23
35
|
{label && subTableIndex === 0 && <div className='fh-12 ffont-semibold fbg-gray-100 ftext-sm fflex fjustify-between fitems-center fpx-2 fborder-b'>{label}</div>}
|
|
24
36
|
<div className="fw-full fflex fitems-stretch fp-2 ">
|
|
25
|
-
|
|
37
|
+
{/* <FieldLable value={otherProps?.value} /> */}
|
|
38
|
+
{children}
|
|
26
39
|
</div>
|
|
27
40
|
</div>
|
|
28
41
|
)
|
|
@@ -11,24 +11,10 @@ export const Checkbox = (props) => {
|
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const CheckboxGroup = (
|
|
15
|
-
const [nValue, setNValue] = useState([])
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (typeof value === "string") {
|
|
19
|
-
try {
|
|
20
|
-
value = JSON.parse(value)
|
|
21
|
-
onChange(value)
|
|
22
|
-
} catch (error) {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
setNValue(value)
|
|
28
|
-
}, [value])
|
|
14
|
+
export const CheckboxGroup = (props) => {
|
|
29
15
|
return (
|
|
30
16
|
<BaseWrapper {...props}>
|
|
31
|
-
<OriginalCheckbox.Group {...props}
|
|
17
|
+
<OriginalCheckbox.Group {...props} />
|
|
32
18
|
</BaseWrapper>
|
|
33
19
|
);
|
|
34
20
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Input as OriginalInput } from 'antd';
|
|
2
|
+
import { InputNumber } from 'antd';
|
|
2
3
|
import { BaseWrapper } from "../base.jsx"
|
|
3
4
|
import React from 'react';
|
|
4
5
|
const {
|
|
@@ -7,6 +8,8 @@ const {
|
|
|
7
8
|
Search: OriginalSearch,
|
|
8
9
|
} = OriginalInput;
|
|
9
10
|
|
|
11
|
+
|
|
12
|
+
|
|
10
13
|
const Input = (props) =>{
|
|
11
14
|
return (
|
|
12
15
|
<BaseWrapper {...props}>
|
|
@@ -48,4 +51,11 @@ const Search = (props) =>{
|
|
|
48
51
|
);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
const Number = (props) =>{
|
|
55
|
+
return (
|
|
56
|
+
<BaseWrapper {...props}>
|
|
57
|
+
<InputNumber {...props} style={{width: '100%'}} />
|
|
58
|
+
</BaseWrapper>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export {Input,TextArea,Password,Search,CodeMachine,Number};
|
|
@@ -242,7 +242,7 @@ const Table = ({ children, value, onChange, ...props }) => {
|
|
|
242
242
|
{React.Children.map(children, (child, childIndex) => {
|
|
243
243
|
const col_id = child?.props?.__id || childIndex;
|
|
244
244
|
if (row?.[col_id] === undefined) row[col_id] = "";
|
|
245
|
-
return <TableCol width={
|
|
245
|
+
return <TableCol width={100} key={`row_${rowIndex}_col_${childIndex}`}>
|
|
246
246
|
{React.cloneElement(child, {
|
|
247
247
|
key: `row_${rowIndex}_child_${childIndex}`,
|
|
248
248
|
subTable: true,
|
|
@@ -49,8 +49,7 @@ const UploadFile = ({ value, maxCount, onChange, ...props }) => {
|
|
|
49
49
|
maxCount={maxCount}
|
|
50
50
|
onChange={handleChange}
|
|
51
51
|
fileList={fileList}>
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
{ !props?.disabled && <div className=" fmin-w-36 fgap-1 frounded fborder-gray-300 fborder hover:fborder-[#3e92f8] hover:ftext-[#3e92f8] fcursor-pointer fh-8 fflex fitems-center fbg-white fjustify-center "><UploadOutlined />点击上传文件</div>}
|
|
54
53
|
</OriginalUpload>
|
|
55
54
|
</BaseWrapper>
|
|
56
55
|
);
|
|
@@ -72,7 +72,6 @@ const UploadImage = ({ maxCount, value, onChange, ...props }) => {
|
|
|
72
72
|
|
|
73
73
|
let handleFileList = []
|
|
74
74
|
|
|
75
|
-
console.log("fileMap.current", JSON.parse(JSON.stringify(fileMap.current)))
|
|
76
75
|
for (let i = 0; i < newFileList.length; i++) {
|
|
77
76
|
var file = newFileList[i];
|
|
78
77
|
file.version = new Date().getTime()
|
|
@@ -88,8 +87,6 @@ const UploadImage = ({ maxCount, value, onChange, ...props }) => {
|
|
|
88
87
|
handleFileList.push(file)
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
console.log("newFileList", JSON.parse(JSON.stringify(newFileList)))
|
|
92
|
-
console.log("handleFileList", JSON.parse(JSON.stringify(handleFileList)))
|
|
93
90
|
fileMap.current = handleFileList
|
|
94
91
|
setFileList(handleFileList);
|
|
95
92
|
onChange(handleFileList.map((file) => {
|
|
@@ -152,7 +149,7 @@ const UploadImage = ({ maxCount, value, onChange, ...props }) => {
|
|
|
152
149
|
onPreview={handlePreview}
|
|
153
150
|
onChange={handleChange}
|
|
154
151
|
>
|
|
155
|
-
{fileList.length >= maxCount ? null : uploadButton}
|
|
152
|
+
{fileList.length >= maxCount || props?.disabled ? null : uploadButton}
|
|
156
153
|
</OriginalUpload>
|
|
157
154
|
</div>
|
|
158
155
|
|
|
@@ -16,8 +16,8 @@ function batchElements(elements, groupSize) {
|
|
|
16
16
|
|
|
17
17
|
for (const element of elements) {
|
|
18
18
|
const { _componentName } = element?.props || {};
|
|
19
|
-
|
|
20
|
-
if (
|
|
19
|
+
const componentName = element.type?.displayName || _componentName;
|
|
20
|
+
if (componentName && componentName.startsWith('Layout.')) {
|
|
21
21
|
if (tempArray.length > 0) {
|
|
22
22
|
fillWithReactElement(groupSize, tempArray);
|
|
23
23
|
groupedElements.push(tempArray);
|
|
@@ -58,16 +58,32 @@ const FormContainer = forwardRef(({ cols = 1, children }, ref) => {
|
|
|
58
58
|
}, [children, cols]);
|
|
59
59
|
|
|
60
60
|
const initializeDependencyMap = () => {
|
|
61
|
-
|
|
61
|
+
const fields = [];
|
|
62
|
+
function traverse(currentNode) {
|
|
63
|
+
var componentName = currentNode.type?.displayName || currentNode.props?._componentName;
|
|
64
|
+
const { props } = currentNode;
|
|
65
|
+
if (componentName && componentName.startsWith('Field.')) {
|
|
66
|
+
fields.push(currentNode);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (props?.children){
|
|
70
|
+
let children = React.Children.toArray(props?.children)
|
|
71
|
+
children.forEach(child => traverse(child));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
62
74
|
dependencyMap.current = new Map();
|
|
63
75
|
const childrenArray = React.Children.toArray(children);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
for (let index = 0; index < childrenArray.length; index++) {
|
|
77
|
+
const element = childrenArray[index];
|
|
78
|
+
traverse(element)
|
|
79
|
+
}
|
|
80
|
+
fields.forEach(child => {
|
|
81
|
+
const { componentId, __id, ...props } = child?.props;
|
|
68
82
|
const identifier = componentId || __id;
|
|
69
83
|
dependencyMap.current.set(identifier, {
|
|
70
|
-
children: childrenArray.filter(item => item.props.withId === identifier || item.props.withIds?.
|
|
84
|
+
children: childrenArray.filter(item => item.props.withId === identifier || item.props.withIds?.some(item=>{
|
|
85
|
+
return identifier == item || item.startsWith(identifier + '.')
|
|
86
|
+
})),
|
|
71
87
|
show: true,
|
|
72
88
|
});
|
|
73
89
|
});
|
|
@@ -77,12 +93,10 @@ const FormContainer = forwardRef(({ cols = 1, children }, ref) => {
|
|
|
77
93
|
|
|
78
94
|
// 初始化字段的级联关系
|
|
79
95
|
const initializeFieldVisibility = (reloadFields = false) => {
|
|
80
|
-
console.log("initializeFieldVisibility**********")
|
|
81
96
|
const fieldValues = form.getFieldsValue();
|
|
82
97
|
for (let key of dependencyMap.current.keys()) {
|
|
83
98
|
handleFieldsWith(key, fieldValues);
|
|
84
99
|
}
|
|
85
|
-
|
|
86
100
|
if (reloadFields) setFormContent(renderChildren());
|
|
87
101
|
};
|
|
88
102
|
|
|
@@ -161,14 +175,15 @@ const FormContainer = forwardRef(({ cols = 1, children }, ref) => {
|
|
|
161
175
|
if (typeof insert !== "string") {
|
|
162
176
|
if (insert?.span && attributes && attributes.tagKey && attributes.id) {
|
|
163
177
|
result = getParamValue(attributes.tagKey, attributes.id, fieldValues, withDatas)
|
|
164
|
-
if (result) result =
|
|
178
|
+
if (Array.isArray(result)) result = JSON.stringify(result)
|
|
179
|
+
else if (result) result = `"${result}"`
|
|
165
180
|
}
|
|
166
181
|
}
|
|
167
182
|
else result = insert
|
|
168
183
|
return result
|
|
169
184
|
})
|
|
170
185
|
}
|
|
171
|
-
|
|
186
|
+
console.log("formula",formula)
|
|
172
187
|
if (formula && formula.length > 0) {
|
|
173
188
|
const childIdentifier = child.props.componentId || child.props.__id;
|
|
174
189
|
form.setFieldValue(childIdentifier, evalFormula(formula))
|
|
@@ -178,7 +193,18 @@ const FormContainer = forwardRef(({ cols = 1, children }, ref) => {
|
|
|
178
193
|
const getParamValue = (tagKey, id, fieldValues, withDatas) => {
|
|
179
194
|
let result = "";
|
|
180
195
|
// 从当前表单字段取值
|
|
181
|
-
if (tagKey == "fieldsValue")
|
|
196
|
+
if (tagKey == "fieldsValue") {
|
|
197
|
+
if (id.indexOf(".") >= 0) {
|
|
198
|
+
const [parentKey, childKey] = id.split(".");
|
|
199
|
+
const parentValue = fieldValues?.[parentKey] || [];
|
|
200
|
+
if (Array.isArray(parentValue))
|
|
201
|
+
result = parentValue.map(item => {
|
|
202
|
+
return item?.[childKey] || ""
|
|
203
|
+
})
|
|
204
|
+
else result = parentValue?.[childKey] || ""
|
|
205
|
+
}
|
|
206
|
+
else result = fieldValues?.[id] || ""
|
|
207
|
+
}
|
|
182
208
|
// 从依赖数据取值
|
|
183
209
|
else {
|
|
184
210
|
let withData = withDatas.find(item => item.id === tagKey)
|
|
@@ -218,8 +244,9 @@ const FormContainer = forwardRef(({ cols = 1, children }, ref) => {
|
|
|
218
244
|
<Row key={`row-${index}`} gutter={[24, 24]}>
|
|
219
245
|
{group.map((child, index) => {
|
|
220
246
|
const { componentId, __id, _componentName, ...props } = child.props;
|
|
247
|
+
const componentName = child.type?.displayName || _componentName;
|
|
221
248
|
const identifier = componentId || __id;
|
|
222
|
-
const isLayoutComponent =
|
|
249
|
+
const isLayoutComponent = componentName && componentName.startsWith('Layout.');
|
|
223
250
|
|
|
224
251
|
return (
|
|
225
252
|
<Col key={identifier || `col-${index}`} span={isLayoutComponent ? 24 : 24 / group.length} style={{ marginBottom: 0 }}>
|
package/src/components/index.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Input, TextArea, Password, Search ,CodeMachine} from './field/input/index.jsx'
|
|
1
|
+
import { Input, TextArea, Password, Search ,CodeMachine, Number} from './field/input/index.jsx'
|
|
2
2
|
import '../App.css';
|
|
3
3
|
import { TreeSelect, Select, WithSingleSelect,WithMultipleSelect, SingleSelect, MultipleSelect, SearchSelect } from './field/select/index.jsx'
|
|
4
4
|
import Custom from './field/custom/index.jsx'
|
|
@@ -14,6 +14,7 @@ const Field = {
|
|
|
14
14
|
TextArea,
|
|
15
15
|
Password,
|
|
16
16
|
Search,
|
|
17
|
+
Number,
|
|
17
18
|
TreeSelect,
|
|
18
19
|
Select,
|
|
19
20
|
SearchSelect,
|
|
@@ -33,11 +34,18 @@ const Field = {
|
|
|
33
34
|
Table,
|
|
34
35
|
Custom,
|
|
35
36
|
}
|
|
37
|
+
Object.keys(Field).forEach(key => {
|
|
38
|
+
Field[key].displayName = `Field.${key}`;
|
|
39
|
+
});
|
|
40
|
+
|
|
36
41
|
const Layout = {
|
|
37
42
|
FormRow: LayoutFormRow,
|
|
38
43
|
FormGroupTitle: LayoutFormGroupTitle,
|
|
39
44
|
TableCol
|
|
40
45
|
}
|
|
46
|
+
Object.keys(Layout).forEach(key => {
|
|
47
|
+
Layout[key].displayName = `Layout.${key}`;
|
|
48
|
+
});
|
|
41
49
|
export { FormContainer, Field ,FormContainerWrapper,Layout }
|
|
42
50
|
import { default as OptionSetter} from './setter/optionsetter'
|
|
43
51
|
const Setter = {
|
package/src/utils/formula.js
CHANGED