lu-lowcode-package-form 0.11.6 → 0.11.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.11.6",
3
+ "version": "0.11.7",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
package/src/App.jsx CHANGED
@@ -244,6 +244,32 @@ function App() {
244
244
  "content": "当前表单.开关"
245
245
  }
246
246
  },
247
+ {
248
+ "insert": " == 1\n"
249
+ }
250
+ ],
251
+ "version": 1734400834533,
252
+ "withData": [
253
+
254
+ ]
255
+ }}
256
+ />
257
+ <Field.Input label="测试 withVisible2" __id="withVisible2"
258
+ isRequired={true}
259
+ withIds={["routeType"]}
260
+ withVisible={{
261
+ "value": [
262
+ {
263
+ "insert": {
264
+ "span": true
265
+ },
266
+ "attributes": {
267
+ "id": "routeType",
268
+ "color": "blue",
269
+ "tagKey": "fieldsValue",
270
+ "content": "当前表单.开关2"
271
+ }
272
+ },
247
273
  {
248
274
  "insert": " == 2\n"
249
275
  }
@@ -254,7 +280,32 @@ function App() {
254
280
  ]
255
281
  }}
256
282
  />
283
+ <Field.Input label="测试 withVisible21" __id="withVisible21"
284
+ isRequired={true}
285
+ withIds={["routeType"]}
286
+ withVisible={{
287
+ "value": [
288
+ {
289
+ "insert": {
290
+ "span": true
291
+ },
292
+ "attributes": {
293
+ "id": "routeType",
294
+ "color": "blue",
295
+ "tagKey": "fieldsValue",
296
+ "content": "当前表单.开关2"
297
+ }
298
+ },
299
+ {
300
+ "insert": " == 2\n"
301
+ }
302
+ ],
303
+ "version": 1734400834533,
304
+ "withData": [
257
305
 
306
+ ]
307
+ }}
308
+ />
258
309
  <Field.Select label="绑定表单"
259
310
  option_label={"formTitle"}
260
311
  __id="menuFormTemplateId"
@@ -267,6 +318,9 @@ function App() {
267
318
  }} />
268
319
 
269
320
 
321
+ <Field.Input label="隐藏字段" __id="hidden1"
322
+ calcHidden={true}
323
+ />
270
324
 
271
325
  <Field.Input label="菜单URL" __id="route"
272
326
  withIds={["routeType"]}
@@ -39,7 +39,7 @@ export const BaseWrapper = ({
39
39
  {
40
40
  console.log(label+" calcHiddenRef.current", calcHiddenRef.current)
41
41
  console.log(label+" calcHiddenRef.current", calcHidden)
42
- typeof initializeFormRender == "function" && initializeFormRender();
42
+ // typeof initializeFormRender == "function" && initializeFormRender();
43
43
  calcHiddenRef.current = calcHidden;
44
44
  }
45
45
  },[calcHidden])
@@ -81,6 +81,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
81
81
  // 添加节流后的 initializeFormRender
82
82
  const throttledInitializeFormRender = React.useCallback(
83
83
  throttle(() => {
84
+ console.log("throttledInitializeFormRender")
84
85
  initializeDependencyMap();
85
86
  setFormContent(renderChildren());
86
87
  }, 300),
@@ -160,18 +161,18 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
160
161
  };
161
162
 
162
163
  // 初始化字段的级联关系
163
- const initializeFieldVisibility = async (reloadFields = false) => {
164
- console.log("initializeFieldVisibility")
164
+ const initializeFieldVisibility = debounce(async (reloadFields = false) => {
165
+ console.log("initializeFieldVisibility *************************************")
165
166
  const fieldValues = form.getFieldsValue();
166
167
  for (let key of dependencyMap.current.keys()) {
167
- handleFieldsWith(key, fieldValues, true);
168
+ await handleFieldsWith(key, fieldValues, true);
168
169
  }
169
170
  if (reloadFields) setFormContent(renderChildren());
170
- };
171
+ }, 100);
171
172
 
172
173
  // 计算字段级联关系
173
174
  const handleFieldsWith = async (identifier, fieldValues, init = false) => {
174
- console.log("handleFieldsWith identifier", identifier)
175
+ // console.log("handleFieldsWith identifier", identifier)
175
176
  let needRefresh = false;
176
177
  let parentIdentifier = [];
177
178
  if (Array.isArray(identifier)) {