lu-lowcode-package-form 0.9.70 → 0.9.71
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 +21 -15
- package/package.json +1 -1
- package/src/App.jsx +56 -11
- package/src/components/editor/quill.jsx +1 -1
- package/src/components/field/date-picker/index.jsx +6 -6
- package/src/components/field/select/select.jsx +1 -1
- package/src/components/field/upload/upload-image.jsx +1 -1
- package/src/components/form-container/index.jsx +23 -7
- package/src/utils/formula.js +2 -2
package/dist/index.es.js
CHANGED
@@ -40753,7 +40753,7 @@ const TreeSelect = (e1e) => {
|
|
40753
40753
|
customComponent: t1e,
|
40754
40754
|
...n1e
|
40755
40755
|
} = e1e;
|
40756
|
-
return
|
40756
|
+
return t1e ? /* @__PURE__ */ jsxRuntimeExports.jsx(BaseWrapper, {
|
40757
40757
|
...n1e,
|
40758
40758
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(t1e, {
|
40759
40759
|
...n1e
|
@@ -40855,9 +40855,8 @@ const WithSingleSelectForward = /* @__PURE__ */ forwardRef((e1e, t1e) => (React_
|
|
40855
40855
|
try {
|
40856
40856
|
result = eval(formula.join(""));
|
40857
40857
|
} catch (e1e) {
|
40858
|
-
console.error("formula error", e1e);
|
40859
40858
|
}
|
40860
|
-
return
|
40859
|
+
return result.toString();
|
40861
40860
|
}, LayoutFormRow = (e1e) => {
|
40862
40861
|
let {
|
40863
40862
|
children: t1e,
|
@@ -41008,17 +41007,18 @@ const FormContainer = /* @__PURE__ */ forwardRef((e1e, t1e) => {
|
|
41008
41007
|
console.log("error end", M1e);
|
41009
41008
|
}
|
41010
41009
|
if (!Array.isArray(D1e)) return;
|
41011
|
-
|
41010
|
+
let P1e = D1e.map((M1e) => {
|
41012
41011
|
let F1e = {};
|
41013
41012
|
if (O1e != null && O1e.subRules && Array.isArray(O1e == null ? void 0 : O1e.subRules) && (O1e == null ? void 0 : O1e.subRules.length) > 0) for (let B1e = 0; B1e < (O1e == null ? void 0 : O1e.subRules.length); B1e++) {
|
41014
41013
|
const {
|
41015
41014
|
source: L1e,
|
41016
41015
|
target: z1e
|
41017
41016
|
} = O1e == null ? void 0 : O1e.subRules[B1e];
|
41018
|
-
|
41017
|
+
P1e[z1e] = M1e == null ? void 0 : M1e[L1e];
|
41019
41018
|
}
|
41020
41019
|
return F1e;
|
41021
41020
|
});
|
41021
|
+
I1e = P1e;
|
41022
41022
|
} else {
|
41023
41023
|
let P1e = 0;
|
41024
41024
|
if (y1e && Array.isArray(y1e) && y1e.length > 1 && (y1e.filter((M1e) => typeof M1e == "string").join("."), P1e = y1e[y1e.length - 1], A1e = [...y1e, A1e], Array.isArray(S1e) && S1e.length > P1e)) {
|
@@ -41028,7 +41028,6 @@ const FormContainer = /* @__PURE__ */ forwardRef((e1e, t1e) => {
|
|
41028
41028
|
}
|
41029
41029
|
i1e.setFieldValue(A1e, I1e), f1e(A1e, i1e.getFieldsValue());
|
41030
41030
|
}
|
41031
|
-
console.log("current value", S1e);
|
41032
41031
|
}, p1e = (h1e, y1e, b1e) => {
|
41033
41032
|
var E1e, S1e;
|
41034
41033
|
let C1e = !1;
|
@@ -41042,9 +41041,17 @@ const FormContainer = /* @__PURE__ */ forwardRef((e1e, t1e) => {
|
|
41042
41041
|
var S1e, C1e;
|
41043
41042
|
const x1e = y1e == null || (S1e = y1e.component) === null || S1e === void 0 ? void 0 : S1e.props.withFill, O1e = y1e == null || (C1e = y1e.component) === null || C1e === void 0 ? void 0 : C1e.props.withDataFetch;
|
41044
41043
|
let R1e = 0, A1e = "", D1e = y1e.identifier;
|
41045
|
-
b1e && Array.isArray(b1e) && b1e.length > 1
|
41044
|
+
if (b1e && Array.isArray(b1e) && b1e.length > 1)
|
41045
|
+
A1e = b1e.filter((F1e) => typeof F1e == "string").join("."), R1e = b1e[b1e.length - 1], D1e.startsWith("".concat(A1e, ".")) && (D1e = [...b1e, D1e.replace("".concat(A1e, "."), "")]);
|
41046
|
+
else if (D1e.indexOf(".") >= 0) {
|
41047
|
+
D1e = D1e.split(".");
|
41048
|
+
let F1e = m1e("fieldsValue", D1e[0], h1e, []);
|
41049
|
+
if (Array.isArray(F1e) && F1e.length > 0) for (let B1e = 0; B1e < F1e.length; B1e++)
|
41050
|
+
await g1e(h1e, y1e, [D1e[0], B1e], E1e);
|
41051
|
+
return;
|
41052
|
+
}
|
41046
41053
|
let I1e = [];
|
41047
|
-
if (
|
41054
|
+
if (x1e != null && x1e.withData && (x1e == null ? void 0 : x1e.withData.length) > 0 && O1e && typeof O1e == "function")
|
41048
41055
|
for (let F1e = 0; F1e < (x1e == null ? void 0 : x1e.withData.length); F1e++) {
|
41049
41056
|
const B1e = x1e == null ? void 0 : x1e.withData[F1e];
|
41050
41057
|
let L1e = {};
|
@@ -41094,7 +41101,7 @@ const FormContainer = /* @__PURE__ */ forwardRef((e1e, t1e) => {
|
|
41094
41101
|
}, v1e = lodashExports.debounce((h1e, y1e) => {
|
41095
41102
|
const b1e = i1e.getFieldsValue();
|
41096
41103
|
let E1e = !1;
|
41097
|
-
|
41104
|
+
h1e.forEach((S1e) => {
|
41098
41105
|
S1e.name && S1e.name.length > 0 && (E1e = f1e(S1e.name, b1e));
|
41099
41106
|
}), E1e && s1e($1e());
|
41100
41107
|
}, 200), $1e = () => {
|
@@ -41308,7 +41315,7 @@ const UploadImageWrapper$1 = (e1e) => /* @__PURE__ */ jsxRuntimeExports.jsx(Base
|
|
41308
41315
|
onChange: r1e,
|
41309
41316
|
...o1e
|
41310
41317
|
} = e1e;
|
41311
|
-
|
41318
|
+
useEffect(() => {
|
41312
41319
|
if (n1e) {
|
41313
41320
|
if (console.log("value", n1e), typeof n1e == "string")
|
41314
41321
|
try {
|
@@ -41541,9 +41548,9 @@ const DatePicker = (e1e) => {
|
|
41541
41548
|
t1e = t1e || "date";
|
41542
41549
|
const [a1e, s1e] = useState(i1e == null ? void 0 : i1e.picker), [l1e, u1e] = useState(i1e == null ? void 0 : i1e.format), [c1e, f1e] = useState(!1), [d1e, p1e] = useState(!1), g1e = useRef(!1);
|
41543
41550
|
useEffect(() => {
|
41544
|
-
if (
|
41551
|
+
if (r1e && !n1e && !g1e.current) {
|
41545
41552
|
const v1e = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
41546
|
-
|
41553
|
+
typeof o1e == "function" && o1e(v1e);
|
41547
41554
|
return;
|
41548
41555
|
}
|
41549
41556
|
}, [n1e, o1e, l1e, a1e]);
|
@@ -41576,7 +41583,7 @@ const DatePicker = (e1e) => {
|
|
41576
41583
|
width: "100%"
|
41577
41584
|
},
|
41578
41585
|
onChange: m1e,
|
41579
|
-
value: dayjs(n1e).isValid() ? dayjs(n1e) : void 0,
|
41586
|
+
value: n1e && dayjs(n1e).isValid() ? dayjs(n1e) : void 0,
|
41580
41587
|
showTime: c1e,
|
41581
41588
|
needConfirm: d1e
|
41582
41589
|
})
|
@@ -49843,8 +49850,7 @@ const EditorQuill = (e1e) => {
|
|
49843
49850
|
}, [t1e]), useEffect(() => {
|
49844
49851
|
const s1e = r1e.current.getEditor();
|
49845
49852
|
s1e.on("text-change", (l1e, u1e, c1e) => {
|
49846
|
-
|
49847
|
-
console.log("text-change"), f1e.forEach((d1e) => {
|
49853
|
+
l1e.ops.forEach((d1e) => {
|
49848
49854
|
if (d1e.delete) {
|
49849
49855
|
const p1e = u1e.length() - d1e.delete, [g1e] = s1e.getLeaf(p1e);
|
49850
49856
|
g1e && g1e.domNode && g1e.domNode.tagName === "SPAN" && s1e.deleteText(p1e, g1e.domNode.innerText.length);
|
package/package.json
CHANGED
package/src/App.jsx
CHANGED
@@ -16,7 +16,7 @@ const searchSelectOptions = [
|
|
16
16
|
{ id: 9, name: "9999" },
|
17
17
|
]
|
18
18
|
const searchSelectRequest = async (params) => {
|
19
|
-
console.log("params", params)
|
19
|
+
// console.log("params", params)
|
20
20
|
return await new Promise((resolve) => {
|
21
21
|
setTimeout(() => {
|
22
22
|
if (params && params?.name) {
|
@@ -76,7 +76,7 @@ function App() {
|
|
76
76
|
const formRef = React.createRef();
|
77
77
|
const testRef = React.useRef()
|
78
78
|
useEffect(() => {
|
79
|
-
console.log("testRef //////", testRef.current)
|
79
|
+
// console.log("testRef //////", testRef.current)
|
80
80
|
}, [testRef.current])
|
81
81
|
const [cols, setCols] = React.useState(3);
|
82
82
|
|
@@ -138,9 +138,10 @@ function App() {
|
|
138
138
|
<FormContainerWrapper cols={cols} className="" ref={formRef} >
|
139
139
|
<Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} />
|
140
140
|
<Layout.FormGroupTitle title={"基本信息"} />
|
141
|
+
<Field.Number label="税率(%)" __id="shuilv" />
|
141
142
|
<Layout.FormRow layout={'1'}>
|
142
143
|
<Field.Table label="子表格" __id="table" >
|
143
|
-
<Field.DatePicker defaultNow={true}
|
144
|
+
<Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="date" __id="datetime2" />
|
144
145
|
<Field.WithSingleSelect ref={testRef} fillRules={[
|
145
146
|
{
|
146
147
|
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
@@ -173,8 +174,52 @@ function App() {
|
|
173
174
|
]} label="测试关联单选" options={[{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }]} __id="remark11" />
|
174
175
|
|
175
176
|
<Field.Switch label="开关" __id="switch_table"></Field.Switch>
|
176
|
-
<Field.Input defaultValue={3} isRequired={true} label="
|
177
|
-
<Field.Input isRequired={true} label="
|
177
|
+
<Field.Input defaultValue={3} isRequired={true} label="含税单价" __id="product_price11" />
|
178
|
+
<Field.Input isRequired={true} label="未税单价" __id="product_price12"
|
179
|
+
withIds={[
|
180
|
+
"table.product_price11",
|
181
|
+
"shuilv"
|
182
|
+
]}
|
183
|
+
withFill={{
|
184
|
+
"value": [
|
185
|
+
{
|
186
|
+
"insert": "("
|
187
|
+
},
|
188
|
+
{
|
189
|
+
"insert": {
|
190
|
+
"span": true
|
191
|
+
},
|
192
|
+
"attributes": {
|
193
|
+
"id": "table.product_price11",
|
194
|
+
"color": "blue",
|
195
|
+
"tagKey": "fieldsValue",
|
196
|
+
"content": "当前表单.产品列表.含税单价"
|
197
|
+
}
|
198
|
+
},
|
199
|
+
{
|
200
|
+
"insert": "/(1+"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"insert": {
|
204
|
+
"span": true
|
205
|
+
},
|
206
|
+
"attributes": {
|
207
|
+
"id": "shuilv",
|
208
|
+
"color": "blue",
|
209
|
+
"tagKey": "fieldsValue",
|
210
|
+
"content": "当前表单.税率(%)"
|
211
|
+
}
|
212
|
+
},
|
213
|
+
{
|
214
|
+
"insert": "/ 100)).toFixed(2)\n\n\n"
|
215
|
+
}
|
216
|
+
],
|
217
|
+
"version": 1723016911807,
|
218
|
+
"withData": [
|
219
|
+
|
220
|
+
]
|
221
|
+
}}
|
222
|
+
/>
|
178
223
|
<Field.Input isRequired={true} label="商品价格" __id="product_price13" />
|
179
224
|
<Field.Input isRequired={true} label="商品价格" __id="product_price14" />
|
180
225
|
<Field.Input isRequired={true} label="商品价格" __id="product_price1" />
|
@@ -325,10 +370,10 @@ function App() {
|
|
325
370
|
return fieldsValue?.switch ? true : false
|
326
371
|
}}
|
327
372
|
/>
|
328
|
-
<Field.DatePicker defaultNow={true} label="
|
329
|
-
<Field.DatePicker label="
|
330
|
-
<Field.DatePicker disabled={true} defaultNow={true} label="
|
331
|
-
<Field.DatePicker defaultNow={true} label="
|
373
|
+
<Field.DatePicker defaultNow={true} label="datetime" prompt="" datetype="month" value='2022-10-22' __id="datetime" />
|
374
|
+
<Field.DatePicker label="datetime2" prompt="" datetype="date" __id="datetime2" />
|
375
|
+
<Field.DatePicker isRequired={true} disabled={true} defaultNow={true} label="datetime3" prompt="" datetype="datetime" value={'2022-10-22'} __id="datetime3" />
|
376
|
+
<Field.DatePicker defaultNow={true} label="datetime4" prompt="" datetype="year" value={'2022-10-22'} __id="datetime4" />
|
332
377
|
<Field.Input label="角色名称" __id="name" />
|
333
378
|
<Layout.FormRow layout={'1,1'}>
|
334
379
|
<Field.Input label="角色名称布局" __id="name1" />
|
@@ -336,7 +381,7 @@ function App() {
|
|
336
381
|
</Layout.FormRow>
|
337
382
|
<Field.CheckboxTree label="角色权限" __id="permissions" addRoot={false} treeData={treeData} />
|
338
383
|
<Layout.FormGroupTitle title={"关联信息"} />
|
339
|
-
<Field.WithSingleSelect ref={testRef}
|
384
|
+
<Field.WithSingleSelect ref={testRef} disabled={true} fillRules={[
|
340
385
|
{
|
341
386
|
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
342
387
|
"type": 0,
|
@@ -368,7 +413,7 @@ function App() {
|
|
368
413
|
]
|
369
414
|
}
|
370
415
|
]} label="测试关联单选" options={[{ label: '选项1', value: '1', name: "1111", table: "[{\"price\":1,\"num\":2},{\"price\":2,\"num\":2}]" }, { label: '选项2', value: '2' }]} __id="remark11" />
|
371
|
-
<Field.WithMultipleSelect
|
416
|
+
<Field.WithMultipleSelect disabled={true} label="测试关联多选" options={[{ label: '选项1', value: '1' }, { label: '选项2', value: '2' }]} __id="remark12" />
|
372
417
|
<Layout.FormRow > <Field.TextArea label="备注" __id="remark" /></Layout.FormRow>
|
373
418
|
|
374
419
|
<Layout.FormRow layout={'1'}>
|
@@ -21,12 +21,12 @@ const DatePicker = ({ datetype, value, defaultNow, onChange, ...props }) => {
|
|
21
21
|
const [needConfirm, setNeedConfirm] = useState(false)
|
22
22
|
const isChanged = useRef(false)
|
23
23
|
useEffect(() => {
|
24
|
-
console.log(
|
25
|
-
console.log(
|
24
|
+
// console.log(`${props?.__id} defaultNow `, defaultNow)
|
25
|
+
// console.log(`${props?.__id} value `, value)
|
26
|
+
// console.log(`${props?.__id} value type `, typeof value)
|
26
27
|
if (defaultNow && !value && !isChanged.current) {
|
27
|
-
const now =dayjs().format("YYYY-MM-DD HH:mm:ss")
|
28
|
-
|
29
|
-
typeof onChange === "function" && onChange(now)
|
28
|
+
const now = dayjs().format("YYYY-MM-DD HH:mm:ss")
|
29
|
+
typeof onChange == "function" && onChange(now)
|
30
30
|
return
|
31
31
|
}
|
32
32
|
// if (value && typeof value === "string" && dayjs(value).isValid()) {
|
@@ -75,7 +75,7 @@ const DatePicker = ({ datetype, value, defaultNow, onChange, ...props }) => {
|
|
75
75
|
}, [datetype])
|
76
76
|
return (
|
77
77
|
<BaseWrapper {...props}>
|
78
|
-
<OriginalDatePicker locale={zh} {...props} picker={picker} format={format} style={{ width: '100%' }} onChange={handleChange} value={dayjs(value).isValid() ? dayjs(value) : undefined} showTime={showTime} needConfirm={needConfirm} />
|
78
|
+
<OriginalDatePicker locale={zh} {...props} picker={picker} format={format} style={{ width: '100%' }} onChange={handleChange} value={value && dayjs(value).isValid() ? dayjs(value) : undefined} showTime={showTime} needConfirm={needConfirm} />
|
79
79
|
</BaseWrapper>
|
80
80
|
);
|
81
81
|
}
|
@@ -124,7 +124,7 @@ const WithMultipleSelect = ({ readItemRender, readonly, onChange, value, ...prop
|
|
124
124
|
|
125
125
|
// 选择用户组件
|
126
126
|
const UserSelect = ({ customComponent: CustomComponent, ...props }) => {
|
127
|
-
console.log("UserSelect ////// props",props)
|
127
|
+
// console.log("UserSelect ////// props",props)
|
128
128
|
if (!CustomComponent) return <BaseWrapper {...props}><Input {...props} /></BaseWrapper>
|
129
129
|
else return <BaseWrapper {...props}><CustomComponent {...props} /></BaseWrapper>
|
130
130
|
}
|
@@ -5,7 +5,7 @@ import { DeleteOutlined, EyeOutlined, PlusOutlined } from "@ant-design/icons";
|
|
5
5
|
import React, { useEffect, useRef, useState, version } from "react";
|
6
6
|
|
7
7
|
const UploadImage = ({ maxCount, value, onChange, ...props }) => {
|
8
|
-
console.log("uploadimage props", props)
|
8
|
+
// console.log("uploadimage props", props)
|
9
9
|
useEffect(() => {
|
10
10
|
if (value) {
|
11
11
|
console.log("value", value)
|
@@ -122,6 +122,8 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
122
122
|
if (dependencyMap.current.has(identifier)) {
|
123
123
|
const dependent = dependencyMap.current.get(identifier)
|
124
124
|
const dependentChildren = dependent.children;
|
125
|
+
// console.log("identifier", identifier)
|
126
|
+
// console.log("dependentChildren", dependentChildren)
|
125
127
|
if (!init && dependent?.fillRules && Array.isArray(dependent?.fillRules) && dependent?.fillRules.length > 0) {
|
126
128
|
handleFillRules(identifier, parentIdentifier, fieldValues, dependent?.fillRules)
|
127
129
|
}
|
@@ -140,8 +142,6 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
140
142
|
|
141
143
|
// 处理填充规则
|
142
144
|
const handleFillRules = (current_identifier, parentIdentifier, fieldValues, fillRules) => {
|
143
|
-
|
144
|
-
|
145
145
|
// 获取当前变更的字段数据
|
146
146
|
let current_value = getParamValue("fieldsValue", current_identifier, fieldValues, null)
|
147
147
|
for (let index = 0; index < fillRules.length; index++) {
|
@@ -161,13 +161,13 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
161
161
|
|
162
162
|
if (!Array.isArray(source_value)) return
|
163
163
|
let target_value = source_value.map(item => {
|
164
|
-
let
|
164
|
+
let target_item_value = {}
|
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
168
|
target_value[subTarget] = item?.[subSource]
|
169
169
|
}
|
170
|
-
return
|
170
|
+
return target_item_value
|
171
171
|
})
|
172
172
|
setValue = target_value
|
173
173
|
}
|
@@ -187,7 +187,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
187
187
|
form.setFieldValue(target, setValue)
|
188
188
|
handleFieldsWith(target, form.getFieldsValue())
|
189
189
|
}
|
190
|
-
console.log("current value", current_value)
|
190
|
+
// console.log("current value", current_value)
|
191
191
|
}
|
192
192
|
// 处理级联显示隐藏 @return {boolean} 是否需要重新渲染表单的字段
|
193
193
|
const handleFieldsVisible = (fieldValues, child, parentIdentifier) => {
|
@@ -207,6 +207,10 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
207
207
|
// 处理级联数据源
|
208
208
|
// 处理级联填充
|
209
209
|
const handleFieldsWithFill = async (fieldValues, child, parentIdentifier, componentName) => {
|
210
|
+
// console.log("handleFieldsWithFill fieldValues", fieldValues)
|
211
|
+
// console.log("handleFieldsWithFill child", child)
|
212
|
+
// console.log("handleFieldsWithFill parentIdentifier", parentIdentifier)
|
213
|
+
// console.log("handleFieldsWithFill componentName", componentName)
|
210
214
|
const withFill = child?.component?.props.withFill;
|
211
215
|
const withDataFetch = child?.component?.props.withDataFetch;
|
212
216
|
let withFillIndex = 0
|
@@ -219,8 +223,19 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
219
223
|
childIdentifier = [...parentIdentifier, childIdentifier.replace(`${withFillGroup}.`, "")]
|
220
224
|
}
|
221
225
|
}
|
226
|
+
// 被依赖字段不是子表字段,依赖字段是子表字段的情况
|
227
|
+
else if (childIdentifier.indexOf(".") >= 0) {
|
228
|
+
childIdentifier = childIdentifier.split(".")
|
229
|
+
let table_values = getParamValue("fieldsValue", childIdentifier[0], fieldValues, [])
|
230
|
+
// console.log("table_values", table_values)
|
231
|
+
if (Array.isArray(table_values) && table_values.length > 0)
|
232
|
+
for (let index = 0; index < table_values.length; index++) {
|
233
|
+
await handleFieldsWithFill(fieldValues, child, [childIdentifier[0], index], componentName)
|
234
|
+
}
|
235
|
+
return
|
236
|
+
|
237
|
+
}
|
222
238
|
let withDatas = [];
|
223
|
-
console.log("componentName", componentName)
|
224
239
|
// 先处理依赖数据
|
225
240
|
if (withFill?.withData && withFill?.withData.length > 0 && withDataFetch && typeof withDataFetch === 'function') {
|
226
241
|
for (let index = 0; index < withFill?.withData.length; index++) {
|
@@ -278,6 +293,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
278
293
|
if (formula && formula.length > 0) {
|
279
294
|
const formulaResult = evalFormula(formula);
|
280
295
|
// console.log("formulaResult", formulaResult)
|
296
|
+
// console.log("setFieldValue setFieldValue", childIdentifier)
|
281
297
|
form.setFieldValue(childIdentifier, formulaResult)
|
282
298
|
handleFieldsWith(childIdentifier, form.getFieldsValue())
|
283
299
|
}
|
@@ -312,7 +328,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
312
328
|
const handleFieldsChange = debounce((changedFields, allFields) => {
|
313
329
|
const fieldValues = form.getFieldsValue();
|
314
330
|
let needRefresh = false;
|
315
|
-
console.log("changedFields", changedFields)
|
331
|
+
// console.log("changedFields", changedFields)
|
316
332
|
changedFields.forEach(field => {
|
317
333
|
if (field.name && field.name.length > 0) {
|
318
334
|
needRefresh = handleFieldsWith(field.name, fieldValues);
|
package/src/utils/formula.js
CHANGED
@@ -4,9 +4,9 @@ const evalFormula =(formula) => {
|
|
4
4
|
try {
|
5
5
|
result = eval(formula.join(""));
|
6
6
|
} catch (error) {
|
7
|
-
console.error("formula error", error);
|
7
|
+
// console.error("formula error", error);
|
8
8
|
}
|
9
|
-
console.log("formula result", result);
|
9
|
+
// console.log("formula result", result);
|
10
10
|
return result.toString();
|
11
11
|
};
|
12
12
|
|