@kne/form-creator 0.1.24 → 0.1.25

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.js CHANGED
@@ -23,7 +23,7 @@ var SelectList__default = /*#__PURE__*/_interopDefaultLegacy(SelectList);
23
23
  var FormInfo__default = /*#__PURE__*/_interopDefaultLegacy(FormInfo);
24
24
  var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
25
25
 
26
- var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","locale-text":"kne-form-creator_hMXkE","is-compact":"kne-form-creator_jBFpL","locale-text-item":"kne-form-creator_NqCQD","locale-text-prefix":"kne-form-creator_BQl2X","options-locale-text":"kne-form-creator_7-99l","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz"};
26
+ var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-summary-type":"kne-form-creator_0iyhP","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","visible-when-editor":"kne-form-creator_ttGnB","visible-when-hint":"kne-form-creator_hPtdv","visible-when-list":"kne-form-creator_aoAt6","visible-when-row":"kne-form-creator_phRgr","visible-when-row-main":"kne-form-creator_l-J7d","visible-when-field":"kne-form-creator_YRh5W","visible-when-operator":"kne-form-creator_DIqFq","visible-when-value":"kne-form-creator_CHcia","visible-when-regex":"kne-form-creator_lKpVo","visible-when-flags":"kne-form-creator_Ps-cu","visible-when-regex-tester":"kne-form-creator_Wf4eG","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","icon-square-btn-sm":"kne-form-creator_GAh-t","locale-text":"kne-form-creator_hMXkE","is-compact":"kne-form-creator_jBFpL","locale-text-item":"kne-form-creator_NqCQD","locale-text-prefix":"kne-form-creator_BQl2X","options-locale-text":"kne-form-creator_7-99l","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz"};
27
27
 
28
28
  const locale$1 = {
29
29
  addField: '添加填写项',
@@ -160,6 +160,8 @@ const locale$1 = {
160
160
  fieldBlock: '占满整行',
161
161
  fieldHidden: '隐藏该项',
162
162
  fieldHiddenTag: '已隐藏',
163
+ fieldLockedTag: '固定',
164
+ fieldLockedTips: '固定填写项,不可编辑、删除或移动',
163
165
  fieldBlockTag: '整行',
164
166
  fieldNameDuplicate: '该名称已被使用,请换一个',
165
167
  untitledField: '未命名填写项',
@@ -271,9 +273,51 @@ const locale$1 = {
271
273
  ruleErrorLenEqual: '%s长度必须等于{end}',
272
274
  ruleErrorLenMin: '%s长度必须大于{start}',
273
275
  ruleErrorLenMax: '%s长度必须小于{end}',
274
- localeTextFallback: '留空时使用{language}'
275
- };
276
- var defaultLocale = locale$1;
276
+ localeTextFallback: '留空时使用{language}',
277
+ visibleWhenTitle: '条件显示',
278
+ visibleWhenEnable: '满足条件时才显示',
279
+ visibleWhenEnableTips: '不满足条件时隐藏该填写项,并清空其已填写的值',
280
+ visibleWhenLogic: '满足方式',
281
+ conditionLogic_and: '全部满足',
282
+ conditionLogic_or: '满足任一',
283
+ visibleWhenAddCondition: '添加条件',
284
+ visibleWhenField: '触发填写项',
285
+ visibleWhenOperator: '判断',
286
+ visibleWhenValue: '值',
287
+ visibleWhenNoTrigger: '暂无可作为条件的填写项(列表类模块中的填写项不支持)',
288
+ visibleWhenListUnsupported: '列表类模块中的填写项不支持条件显示',
289
+ visibleWhenRegexInvalid: '正则表达式无效',
290
+ visibleWhenRegexFlags: '修饰符',
291
+ visibleWhenRegexFlag_i: 'i 忽略大小写',
292
+ visibleWhenRegexFlag_m: 'm 多行',
293
+ visibleWhenRegexFlag_s: 's 点号匹配换行',
294
+ visibleWhenRegexFlag_u: 'u Unicode',
295
+ visibleWhenRegexTester: '测试文本',
296
+ visibleWhenRegexMatched: '匹配',
297
+ visibleWhenRegexNotMatched: '不匹配',
298
+ visibleWhenConditionRequired: '请完善条件:选择触发填写项并填写值',
299
+ visibleWhenCycle: '条件形成循环依赖:{path}',
300
+ fieldConditionTag: '条件显示',
301
+ fieldConditionInvalidTag: '条件失效',
302
+ fieldConditionInvalidTips: '条件引用的填写项已不存在或不可用,该条件被忽略',
303
+ conditionOperator_eq: '等于',
304
+ conditionOperator_neq: '不等于',
305
+ conditionOperator_in: '属于其一',
306
+ conditionOperator_includesAny: '包含任一',
307
+ conditionOperator_empty: '为空',
308
+ conditionOperator_notEmpty: '不为空',
309
+ conditionOperator_gt: '大于',
310
+ conditionOperator_gte: '大于等于',
311
+ conditionOperator_lt: '小于',
312
+ conditionOperator_lte: '小于等于',
313
+ conditionOperator_regex: '匹配正则',
314
+ conditionJoinAnd: ' 且 ',
315
+ conditionJoinOr: ' 或 ',
316
+ conditionValueTrue: '是',
317
+ conditionValueFalse: '否',
318
+ conditionDescription: '满足条件时显示:{condition}'
319
+ };
320
+ var zhCN = locale$1;
277
321
 
278
322
  const locale = {
279
323
  addField: 'Add Field',
@@ -410,6 +454,8 @@ const locale = {
410
454
  fieldBlock: 'Full Width',
411
455
  fieldHidden: 'Hidden',
412
456
  fieldHiddenTag: 'Hidden',
457
+ fieldLockedTag: 'Locked',
458
+ fieldLockedTips: 'Locked field: cannot be edited, deleted or moved',
413
459
  fieldBlockTag: 'Full Width',
414
460
  fieldNameDuplicate: 'This name is already in use, please choose another',
415
461
  untitledField: 'Untitled Field',
@@ -521,14 +567,56 @@ const locale = {
521
567
  ruleErrorLenEqual: '%s must be exactly {end} characters',
522
568
  ruleErrorLenMin: '%s must be at least {start} characters',
523
569
  ruleErrorLenMax: '%s must be at most {end} characters',
524
- localeTextFallback: 'Falls back to {language} when empty'
570
+ localeTextFallback: 'Falls back to {language} when empty',
571
+ visibleWhenTitle: 'Conditional display',
572
+ visibleWhenEnable: 'Show only when conditions are met',
573
+ visibleWhenEnableTips: 'The field is hidden and its value cleared when conditions are not met',
574
+ visibleWhenLogic: 'Match',
575
+ conditionLogic_and: 'All conditions',
576
+ conditionLogic_or: 'Any condition',
577
+ visibleWhenAddCondition: 'Add condition',
578
+ visibleWhenField: 'Trigger field',
579
+ visibleWhenOperator: 'Operator',
580
+ visibleWhenValue: 'Value',
581
+ visibleWhenNoTrigger: 'No field can be used as a condition (fields inside list blocks are not supported)',
582
+ visibleWhenListUnsupported: 'Fields inside list blocks do not support conditional display',
583
+ visibleWhenRegexInvalid: 'Invalid regular expression',
584
+ visibleWhenRegexFlags: 'Flags',
585
+ visibleWhenRegexFlag_i: 'i ignore case',
586
+ visibleWhenRegexFlag_m: 'm multiline',
587
+ visibleWhenRegexFlag_s: 's dot matches newline',
588
+ visibleWhenRegexFlag_u: 'u Unicode',
589
+ visibleWhenRegexTester: 'Test text',
590
+ visibleWhenRegexMatched: 'Matched',
591
+ visibleWhenRegexNotMatched: 'Not matched',
592
+ visibleWhenConditionRequired: 'Complete each condition: choose a trigger field and fill in the value',
593
+ visibleWhenCycle: 'Conditions form a circular dependency: {path}',
594
+ fieldConditionTag: 'Conditional',
595
+ fieldConditionInvalidTag: 'Condition invalid',
596
+ fieldConditionInvalidTips: 'A referenced field no longer exists or is unavailable; that condition is ignored',
597
+ conditionOperator_eq: 'equals',
598
+ conditionOperator_neq: 'does not equal',
599
+ conditionOperator_in: 'is one of',
600
+ conditionOperator_includesAny: 'includes any of',
601
+ conditionOperator_empty: 'is empty',
602
+ conditionOperator_notEmpty: 'is not empty',
603
+ conditionOperator_gt: '>',
604
+ conditionOperator_gte: '>=',
605
+ conditionOperator_lt: '<',
606
+ conditionOperator_lte: '<=',
607
+ conditionOperator_regex: 'matches',
608
+ conditionJoinAnd: ' and ',
609
+ conditionJoinOr: ' or ',
610
+ conditionValueTrue: 'Yes',
611
+ conditionValueFalse: 'No',
612
+ conditionDescription: 'Shown when: {condition}'
525
613
  };
526
614
  var enUS = locale;
527
615
 
528
616
  const withLocale = reactIntl.createWithIntlProvider({
529
617
  defaultLocale: 'zh-CN',
530
618
  messages: {
531
- 'zh-CN': defaultLocale,
619
+ 'zh-CN': zhCN,
532
620
  'en-US': enUS
533
621
  },
534
622
  namespace: 'form-creator'
@@ -1000,7 +1088,23 @@ const normalizeSchema = (schema = {}) => {
1000
1088
  blocks: []
1001
1089
  };
1002
1090
  };
1003
- const moveItem = (list, id, direction) => {
1091
+ const isFieldLocked = field => !!field?.locked;
1092
+ const blockHasLockedField = block => {
1093
+ if (!block) {
1094
+ return false;
1095
+ }
1096
+ if ((block.list || []).some(isFieldLocked)) {
1097
+ return true;
1098
+ }
1099
+ const groups = [...(block.items || []), ...(block.options || [])];
1100
+ if (groups.some(group => (group.list || []).some(isFieldLocked) || (group.blocks || []).some(blockHasLockedField))) {
1101
+ return true;
1102
+ }
1103
+ return [...(block.blocks || []), ...(block.itemBlocks || [])].some(blockHasLockedField);
1104
+ };
1105
+
1106
+ // 锁定项(locked 字段 / 含锁定字段的模块)位置固定:自身不能移动,其他项也不能与其交换位置
1107
+ const moveItem = (list, id, direction, isFixed = isFieldLocked) => {
1004
1108
  const index = list.findIndex(item => item.id === id);
1005
1109
  if (index < 0) {
1006
1110
  return list;
@@ -1009,6 +1113,9 @@ const moveItem = (list, id, direction) => {
1009
1113
  if (targetIndex < 0 || targetIndex >= list.length) {
1010
1114
  return list;
1011
1115
  }
1116
+ if (isFixed(list[index]) || isFixed(list[targetIndex])) {
1117
+ return list;
1118
+ }
1012
1119
  const next = [...list];
1013
1120
  const [item] = next.splice(index, 1);
1014
1121
  next.splice(targetIndex, 0, item);
@@ -1320,7 +1427,7 @@ const removeBlockInTree = (blocks, blockId) => {
1320
1427
  };
1321
1428
  const moveBlockInTree = (blocks, blockId, direction) => {
1322
1429
  if ((blocks || []).some(block => block?.id === blockId)) {
1323
- return moveItem(blocks, blockId, direction);
1430
+ return moveItem(blocks, blockId, direction, blockHasLockedField);
1324
1431
  }
1325
1432
  let changed = false;
1326
1433
  const next = (blocks || []).map(block => {
@@ -1735,6 +1842,440 @@ const buildRuleString = ({
1735
1842
  return parts.join(' ') || undefined;
1736
1843
  };
1737
1844
 
1845
+ const CONDITION_OPERATORS = ['eq', 'neq', 'in', 'includesAny', 'empty', 'notEmpty', 'gt', 'gte', 'lt', 'lte', 'regex'];
1846
+ const NO_VALUE_OPERATORS = ['empty', 'notEmpty'];
1847
+ const ALLOWED_REGEX_FLAGS = ['i', 'm', 's', 'u'];
1848
+
1849
+ // 列表类模块内的字段会重复出现,单个 name 定位不到具体条目,不参与条件
1850
+ const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField'];
1851
+ const getByPath$2 = (data, path) => {
1852
+ if (data == null || path == null || path === '') {
1853
+ return undefined;
1854
+ }
1855
+ return String(path).split('.').reduce((current, key) => current == null ? undefined : current[key], data);
1856
+ };
1857
+ const isEmptyValue$1 = value => value === undefined || value === null || value === '' || Array.isArray(value) && value.length === 0;
1858
+
1859
+ // SuperSelect 等字段的值是 { label, value } 对象,比较时统一取 value
1860
+ const toComparable = item => {
1861
+ if (item && typeof item === 'object' && !Array.isArray(item)) {
1862
+ return item.value ?? item.id ?? item.key ?? item;
1863
+ }
1864
+ return item;
1865
+ };
1866
+ const toArray = value => Array.isArray(value) ? value : isEmptyValue$1(value) ? [] : [value];
1867
+ const sameValue = (a, b) => String(toComparable(a)) === String(toComparable(b));
1868
+ const sanitizeRegexFlags = flags => Array.from(new Set(String(flags || '').split(''))).filter(flag => ALLOWED_REGEX_FLAGS.includes(flag)).join('');
1869
+ const regexCache = new Map();
1870
+
1871
+ /** 编译失败返回 null;以「源码 + flags」缓存 */
1872
+ const compileConditionRegex = (source, flags) => {
1873
+ if (source == null || String(source) === '') {
1874
+ return null;
1875
+ }
1876
+ const safeFlags = sanitizeRegexFlags(flags);
1877
+ const key = `${safeFlags}/${source}`;
1878
+ if (regexCache.has(key)) {
1879
+ return regexCache.get(key);
1880
+ }
1881
+ let regex = null;
1882
+ try {
1883
+ regex = new RegExp(String(source), safeFlags);
1884
+ } catch (error) {
1885
+ regex = null;
1886
+ }
1887
+ regexCache.set(key, regex);
1888
+ return regex;
1889
+ };
1890
+ const toNumber = value => {
1891
+ if (isEmptyValue$1(value) || typeof value === 'boolean') {
1892
+ return NaN;
1893
+ }
1894
+ return Number(value);
1895
+ };
1896
+
1897
+ /**
1898
+ * 返回 true / false;条件本身无效(未知运算符、正则无法编译)时返回 null,由调用方忽略
1899
+ */
1900
+ const evaluateCondition = (condition, formData) => {
1901
+ if (!condition?.field || !CONDITION_OPERATORS.includes(condition.operator)) {
1902
+ return null;
1903
+ }
1904
+ const actual = getByPath$2(formData, condition.field);
1905
+ const expected = condition.value;
1906
+ switch (condition.operator) {
1907
+ case 'empty':
1908
+ return isEmptyValue$1(actual);
1909
+ case 'notEmpty':
1910
+ return !isEmptyValue$1(actual);
1911
+ case 'eq':
1912
+ return !isEmptyValue$1(actual) && !Array.isArray(actual) && sameValue(actual, expected);
1913
+ case 'neq':
1914
+ return isEmptyValue$1(actual) || Array.isArray(actual) || !sameValue(actual, expected);
1915
+ case 'in':
1916
+ return !isEmptyValue$1(actual) && toArray(expected).some(item => sameValue(actual, item));
1917
+ case 'includesAny':
1918
+ {
1919
+ const expectedList = toArray(expected);
1920
+ return toArray(actual).some(item => expectedList.some(target => sameValue(item, target)));
1921
+ }
1922
+ case 'gt':
1923
+ case 'gte':
1924
+ case 'lt':
1925
+ case 'lte':
1926
+ {
1927
+ const a = toNumber(actual);
1928
+ const b = toNumber(expected);
1929
+ if (!Number.isFinite(a) || !Number.isFinite(b)) {
1930
+ return false;
1931
+ }
1932
+ return {
1933
+ gt: a > b,
1934
+ gte: a >= b,
1935
+ lt: a < b,
1936
+ lte: a <= b
1937
+ }[condition.operator];
1938
+ }
1939
+ case 'regex':
1940
+ {
1941
+ const regex = compileConditionRegex(expected, condition.flags);
1942
+ if (!regex) {
1943
+ return null;
1944
+ }
1945
+ if (isEmptyValue$1(actual)) {
1946
+ return false;
1947
+ }
1948
+ return toArray(actual).some(item => regex.test(String(toComparable(item))));
1949
+ }
1950
+ default:
1951
+ return null;
1952
+ }
1953
+ };
1954
+ const hasVisibleWhen = field => Array.isArray(field?.visibleWhen?.conditions) && field.visibleWhen.conditions.length > 0;
1955
+
1956
+ /**
1957
+ * knownNames:可作为触发字段的完整路径集合;传入时引用未知字段的条件视为失效
1958
+ * 全部条件失效时返回 true(照常显示)
1959
+ */
1960
+ const evaluateVisibleWhen = (visibleWhen, formData, knownNames) => {
1961
+ const conditions = visibleWhen?.conditions;
1962
+ if (!Array.isArray(conditions) || !conditions.length) {
1963
+ return true;
1964
+ }
1965
+ const results = conditions.map(condition => {
1966
+ if (knownNames && !knownNames.has(condition?.field)) {
1967
+ return null;
1968
+ }
1969
+ return evaluateCondition(condition, formData || {});
1970
+ }).filter(result => result !== null);
1971
+ if (!results.length) {
1972
+ return true;
1973
+ }
1974
+ return visibleWhen.logic === 'or' ? results.some(Boolean) : results.every(Boolean);
1975
+ };
1976
+ const joinPath = (prefix, name) => prefix ? `${prefix}.${name}` : name;
1977
+
1978
+ /**
1979
+ * 收集 schema 中所有字段:{ id, path, field, inList }
1980
+ * path 为提交数据中的完整路径(object 模块带前缀);inList 表示位于列表类模块内
1981
+ */
1982
+ const collectConditionFields = schema => {
1983
+ const result = [];
1984
+ const pushFields = (list, prefix, inList) => {
1985
+ (list || []).forEach(field => {
1986
+ if (field?.name) {
1987
+ result.push({
1988
+ id: field.id,
1989
+ path: joinPath(prefix, field.name),
1990
+ field,
1991
+ inList
1992
+ });
1993
+ }
1994
+ });
1995
+ };
1996
+ // 与 renderSchema 一致:仅 object 模块自身字段带 block.name 前缀,子模块不累加
1997
+ const walk = (blocks, inList) => {
1998
+ (blocks || []).forEach(block => {
1999
+ if (!block) {
2000
+ return;
2001
+ }
2002
+ const blockInList = inList || LIST_BLOCK_KINDS.includes(block.kind);
2003
+ pushFields(block.list, block.kind === 'object' ? block.name || '' : '', blockInList);
2004
+ (block.items || []).forEach(step => {
2005
+ pushFields(step.list, '', blockInList);
2006
+ walk(step.blocks, blockInList);
2007
+ });
2008
+ (block.options || []).forEach(option => {
2009
+ pushFields(option.list, '', blockInList);
2010
+ walk(option.blocks, blockInList);
2011
+ });
2012
+ walk(block.blocks, blockInList);
2013
+ walk(block.itemBlocks, true);
2014
+ });
2015
+ };
2016
+ walk(schema?.blocks, false);
2017
+ return result;
2018
+ };
2019
+
2020
+ /** 字段所在模块的路径前缀与是否位于列表类模块内;找不到返回 null */
2021
+ const getBlockConditionScope = (schema, blockId) => {
2022
+ let found = null;
2023
+ const walk = (blocks, inList) => {
2024
+ (blocks || []).forEach(block => {
2025
+ if (!block || found) {
2026
+ return;
2027
+ }
2028
+ const blockInList = inList || LIST_BLOCK_KINDS.includes(block.kind);
2029
+ if (block.id === blockId) {
2030
+ found = {
2031
+ prefix: block.kind === 'object' ? block.name || '' : '',
2032
+ inList: blockInList
2033
+ };
2034
+ return;
2035
+ }
2036
+ (block.items || []).forEach(step => walk(step.blocks, blockInList));
2037
+ (block.options || []).forEach(option => walk(option.blocks, blockInList));
2038
+ walk(block.blocks, blockInList);
2039
+ walk(block.itemBlocks, true);
2040
+ });
2041
+ };
2042
+ walk(schema?.blocks, false);
2043
+ return found;
2044
+ };
2045
+ const getFieldConditionPath = (scope, name) => name ? joinPath(scope?.prefix || '', name) : '';
2046
+
2047
+ /** 可作为触发字段的路径集合(排除列表类模块内字段) */
2048
+ const collectTriggerNames = schema => new Set(collectConditionFields(schema).filter(item => !item.inList).map(item => item.path));
2049
+
2050
+ /** 某字段的条件里引用了不存在 / 不可用的触发字段 */
2051
+ const hasInvalidCondition = (field, triggerNames) => hasVisibleWhen(field) && field.visibleWhen.conditions.some(condition => !triggerNames.has(condition?.field) || condition.operator === 'regex' && !compileConditionRegex(condition.value, condition.flags));
2052
+ const buildDependencyGraph = schema => {
2053
+ const graph = new Map();
2054
+ collectConditionFields(schema).forEach(({
2055
+ path,
2056
+ field
2057
+ }) => {
2058
+ if (hasVisibleWhen(field)) {
2059
+ graph.set(path, field.visibleWhen.conditions.map(condition => condition?.field).filter(Boolean));
2060
+ }
2061
+ });
2062
+ return graph;
2063
+ };
2064
+
2065
+ /** 返回循环链路(路径数组,首尾相同);无循环返回 null */
2066
+ const findConditionCycle = schema => {
2067
+ const graph = buildDependencyGraph(schema);
2068
+ const state = new Map();
2069
+ const stack = [];
2070
+ const visit = node => {
2071
+ if (state.get(node) === 'done') {
2072
+ return null;
2073
+ }
2074
+ if (state.get(node) === 'visiting') {
2075
+ return [...stack.slice(stack.indexOf(node)), node];
2076
+ }
2077
+ state.set(node, 'visiting');
2078
+ stack.push(node);
2079
+ for (const next of graph.get(node) || []) {
2080
+ const cycle = visit(next);
2081
+ if (cycle) {
2082
+ return cycle;
2083
+ }
2084
+ }
2085
+ stack.pop();
2086
+ state.set(node, 'done');
2087
+ return null;
2088
+ };
2089
+ for (const node of graph.keys()) {
2090
+ const cycle = visit(node);
2091
+ if (cycle) {
2092
+ return cycle;
2093
+ }
2094
+ }
2095
+ return null;
2096
+ };
2097
+
2098
+ /** 选中 candidate 作为 fieldPath 的触发字段是否会形成循环 */
2099
+ const wouldCreateCycle = (schema, fieldPath, candidatePath) => {
2100
+ if (fieldPath === candidatePath) {
2101
+ return true;
2102
+ }
2103
+ const graph = buildDependencyGraph(schema);
2104
+ const seen = new Set();
2105
+ const queue = [candidatePath];
2106
+ while (queue.length) {
2107
+ const node = queue.shift();
2108
+ if (node === fieldPath) {
2109
+ return true;
2110
+ }
2111
+ if (seen.has(node)) {
2112
+ continue;
2113
+ }
2114
+ seen.add(node);
2115
+ (graph.get(node) || []).forEach(next => queue.push(next));
2116
+ }
2117
+ return false;
2118
+ };
2119
+ const mapFieldList = (list, mapper) => Array.isArray(list) ? list.map(mapper) : list;
2120
+ const mapBlockFields = (block, mapper) => {
2121
+ if (!block) {
2122
+ return block;
2123
+ }
2124
+ const next = {
2125
+ ...block,
2126
+ list: mapFieldList(block.list, mapper)
2127
+ };
2128
+ if (Array.isArray(block.items)) {
2129
+ next.items = block.items.map(step => ({
2130
+ ...step,
2131
+ list: mapFieldList(step.list, mapper),
2132
+ blocks: mapBlocksFields(step.blocks, mapper)
2133
+ }));
2134
+ }
2135
+ if (Array.isArray(block.options)) {
2136
+ next.options = block.options.map(option => ({
2137
+ ...option,
2138
+ list: mapFieldList(option.list, mapper),
2139
+ blocks: mapBlocksFields(option.blocks, mapper)
2140
+ }));
2141
+ }
2142
+ if (Array.isArray(block.blocks)) {
2143
+ next.blocks = mapBlocksFields(block.blocks, mapper);
2144
+ }
2145
+ if (Array.isArray(block.itemBlocks)) {
2146
+ next.itemBlocks = mapBlocksFields(block.itemBlocks, mapper);
2147
+ }
2148
+ return next;
2149
+ };
2150
+ const mapBlocksFields = (blocks, mapper) => Array.isArray(blocks) ? blocks.map(block => mapBlockFields(block, mapper)) : blocks;
2151
+
2152
+ /** 触发字段改名后,同步所有条件中的引用 */
2153
+ const renameConditionReferences = (schema, oldPath, newPath) => {
2154
+ if (!oldPath || !newPath || oldPath === newPath) {
2155
+ return schema;
2156
+ }
2157
+ return {
2158
+ ...schema,
2159
+ blocks: mapBlocksFields(schema?.blocks, field => {
2160
+ if (!hasVisibleWhen(field) || !field.visibleWhen.conditions.some(condition => condition?.field === oldPath)) {
2161
+ return field;
2162
+ }
2163
+ return {
2164
+ ...field,
2165
+ visibleWhen: {
2166
+ ...field.visibleWhen,
2167
+ conditions: field.visibleWhen.conditions.map(condition => condition?.field === oldPath ? {
2168
+ ...condition,
2169
+ field: newPath
2170
+ } : condition)
2171
+ }
2172
+ };
2173
+ })
2174
+ };
2175
+ };
2176
+
2177
+ /**
2178
+ * 触发字段的值类型,决定可用运算符与值输入方式:
2179
+ * options(单值选项)/ multiOptions(多值选项)/ number / boolean / text
2180
+ * definition 为字段注册定义(getFieldDefinition(field.type)),由调用方传入
2181
+ */
2182
+ const getConditionValueKind = (field, definition) => {
2183
+ const props = field?.props || {};
2184
+ if (field?.type === 'CheckboxGroup' || definition?.isSuperSelect || field?.type === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
2185
+ return 'multiOptions';
2186
+ }
2187
+ if (definition?.hasOptions) {
2188
+ return 'options';
2189
+ }
2190
+ if (field?.type === 'Switch' || field?.type === 'Checkbox') {
2191
+ return 'boolean';
2192
+ }
2193
+ const valueSchema = typeof definition?.valueSchema === 'function' ? definition.valueSchema(field) : definition?.valueSchema;
2194
+ if (valueSchema?.type === 'number' || valueSchema?.type === 'integer') {
2195
+ return 'number';
2196
+ }
2197
+ return 'text';
2198
+ };
2199
+ const OPERATORS_BY_KIND = {
2200
+ options: ['eq', 'neq', 'in', 'empty', 'notEmpty'],
2201
+ multiOptions: ['includesAny', 'empty', 'notEmpty', 'regex'],
2202
+ number: ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'empty', 'notEmpty', 'regex'],
2203
+ boolean: ['eq', 'neq'],
2204
+ text: ['eq', 'neq', 'empty', 'notEmpty', 'regex']
2205
+ };
2206
+ const getConditionOperators = (field, definition) => OPERATORS_BY_KIND[getConditionValueKind(field, definition)] || OPERATORS_BY_KIND.text;
2207
+
2208
+ /** 去掉空条件,规范 logic / flags;无有效条件返回 undefined(不写入 schema) */
2209
+ const normalizeVisibleWhen = visibleWhen => {
2210
+ const conditions = (visibleWhen?.conditions || []).filter(condition => condition?.field && CONDITION_OPERATORS.includes(condition.operator)).map(condition => {
2211
+ const next = {
2212
+ field: condition.field,
2213
+ operator: condition.operator
2214
+ };
2215
+ if (!NO_VALUE_OPERATORS.includes(condition.operator)) {
2216
+ next.value = condition.value;
2217
+ }
2218
+ if (condition.operator === 'regex') {
2219
+ const flags = sanitizeRegexFlags(condition.flags);
2220
+ if (flags) {
2221
+ next.flags = flags;
2222
+ }
2223
+ }
2224
+ return next;
2225
+ });
2226
+ if (!conditions.length) {
2227
+ return undefined;
2228
+ }
2229
+ return {
2230
+ logic: visibleWhen.logic === 'or' ? 'or' : 'and',
2231
+ conditions
2232
+ };
2233
+ };
2234
+ const formatConditionValue = (condition, optionLabelOf) => {
2235
+ if (condition.operator === 'regex') {
2236
+ return `/${condition.value ?? ''}/${sanitizeRegexFlags(condition.flags)}`;
2237
+ }
2238
+ return toArray(condition.value).map(item => optionLabelOf(item)).join(', ');
2239
+ };
2240
+
2241
+ /**
2242
+ * 条件的可读摘要,如「是否通过 等于 不通过」
2243
+ * formatMessage 需含 conditionOperator_* / conditionLogic_* 文案;fieldLookup 为 path → field
2244
+ */
2245
+ const formatVisibleWhen = (visibleWhen, {
2246
+ formatMessage,
2247
+ fieldLookup = new Map(),
2248
+ resolveText = text => text
2249
+ } = {}) => {
2250
+ const conditions = visibleWhen?.conditions || [];
2251
+ const parts = conditions.map(condition => {
2252
+ const trigger = fieldLookup.get(condition.field);
2253
+ const fieldLabel = trigger && resolveText(trigger.label) || condition.field;
2254
+ const optionLabelOf = value => {
2255
+ const option = (trigger?.props?.options || []).find(item => sameValue(item?.value, value));
2256
+ if (option) {
2257
+ return resolveText(option.label);
2258
+ }
2259
+ if (typeof value === 'boolean') {
2260
+ return formatMessage({
2261
+ id: value ? 'conditionValueTrue' : 'conditionValueFalse'
2262
+ });
2263
+ }
2264
+ return String(toComparable(value));
2265
+ };
2266
+ const operatorText = formatMessage({
2267
+ id: `conditionOperator_${condition.operator}`
2268
+ });
2269
+ if (NO_VALUE_OPERATORS.includes(condition.operator)) {
2270
+ return `${fieldLabel} ${operatorText}`;
2271
+ }
2272
+ return `${fieldLabel} ${operatorText} ${formatConditionValue(condition, optionLabelOf)}`;
2273
+ });
2274
+ return parts.join(formatMessage({
2275
+ id: visibleWhen?.logic === 'or' ? 'conditionJoinOr' : 'conditionJoinAnd'
2276
+ }));
2277
+ };
2278
+
1738
2279
  const registry = new Map();
1739
2280
  const defineField = (type, definition) => {
1740
2281
  registry.set(type, {
@@ -2516,6 +3057,7 @@ const fieldToFormValues = field => {
2516
3057
  description: field.description || '',
2517
3058
  block: !!field.block,
2518
3059
  hidden: !!field.hidden,
3060
+ visibleWhen: field.visibleWhen,
2519
3061
  placeholder,
2520
3062
  options: options.length ? options : [{
2521
3063
  label: '',
@@ -2554,6 +3096,7 @@ const formValuesToField = (values, existingField = {}) => {
2554
3096
  props.children = values.label;
2555
3097
  }
2556
3098
  const rule = buildRuleString(values.ruleConfig);
3099
+ const visibleWhen = normalizeVisibleWhen(values.visibleWhen);
2557
3100
  return {
2558
3101
  id: existingField.id,
2559
3102
  type: values.type,
@@ -2564,6 +3107,9 @@ const formValuesToField = (values, existingField = {}) => {
2564
3107
  rule,
2565
3108
  block: values.block ?? definition.defaults?.block ?? false,
2566
3109
  hidden: !!values.hidden,
3110
+ ...(visibleWhen ? {
3111
+ visibleWhen
3112
+ } : {}),
2567
3113
  props
2568
3114
  };
2569
3115
  };
@@ -2668,7 +3214,7 @@ const LocaleTextArea = props => {
2668
3214
  LocaleTextArea.field = LocaleTextAreaControl;
2669
3215
 
2670
3216
  const {
2671
- Text: Text$4
3217
+ Text: Text$5
2672
3218
  } = antd.Typography;
2673
3219
  const TYPE_TAG_COLORS = {
2674
3220
  Input: 'blue',
@@ -2688,13 +3234,35 @@ const TYPE_TAG_COLORS = {
2688
3234
  Checkbox: 'green',
2689
3235
  DatePicker: 'lime'
2690
3236
  };
3237
+ const TYPE_TAG_ICONS = {
3238
+ Input: icons.FontSizeOutlined,
3239
+ TextArea: icons.AlignLeftOutlined,
3240
+ InputNumber: icons.NumberOutlined,
3241
+ Select: icons.DownSquareOutlined,
3242
+ RadioGroup: icons.CheckCircleOutlined,
3243
+ CheckboxGroup: icons.CheckSquareOutlined,
3244
+ SuperSelectList: icons.AppstoreOutlined,
3245
+ SuperSelectTableList: icons.AppstoreOutlined,
3246
+ SuperSelectTree: icons.AppstoreOutlined,
3247
+ SuperSelectCascader: icons.AppstoreOutlined,
3248
+ SelectFunction: icons.ApartmentOutlined,
3249
+ SelectIndustry: icons.ShopOutlined,
3250
+ SelectAddress: icons.EnvironmentOutlined,
3251
+ Switch: icons.SwapOutlined,
3252
+ Checkbox: icons.CheckSquareOutlined,
3253
+ DatePicker: icons.CalendarOutlined
3254
+ };
3255
+ const getFieldTypeIcon = type => TYPE_TAG_ICONS[type] || icons.FormOutlined;
2691
3256
  const FieldRow = ({
2692
3257
  field,
2693
3258
  index,
2694
3259
  total,
2695
3260
  onEdit,
2696
3261
  onDelete,
2697
- onMove
3262
+ onMove,
3263
+ prevLocked,
3264
+ nextLocked,
3265
+ conditionContext
2698
3266
  }) => {
2699
3267
  const {
2700
3268
  formatMessage,
@@ -2702,40 +3270,81 @@ const FieldRow = ({
2702
3270
  } = reactIntl.useIntl();
2703
3271
  const languages = useLocaleTextLanguages();
2704
3272
  const definition = getFieldDefinition(field.type);
3273
+ const conditional = hasVisibleWhen(field);
3274
+ const conditionInvalid = conditional && conditionContext && hasInvalidCondition(field, conditionContext.triggerNames);
3275
+ const TypeIcon = getFieldTypeIcon(field.type);
2705
3276
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2706
3277
  className: style['field-row'],
2707
3278
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
2708
3279
  className: style['field-row-index'],
2709
3280
  children: index + 1
2710
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
3281
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
2711
3282
  className: style['field-row-main'],
2712
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
3283
+ children: [/*#__PURE__*/jsxRuntime.jsx(Text$5, {
3284
+ strong: true,
3285
+ className: style['field-row-label'],
3286
+ children: resolveLocaleText(field.label, locale, languages) || formatMessage({
3287
+ id: 'untitledField'
3288
+ })
3289
+ }), /*#__PURE__*/jsxRuntime.jsxs(antd.Space, {
2713
3290
  size: 6,
2714
3291
  wrap: true,
2715
- children: [/*#__PURE__*/jsxRuntime.jsx(Text$4, {
2716
- strong: true,
2717
- ellipsis: true,
2718
- children: resolveLocaleText(field.label, locale, languages) || formatMessage({
2719
- id: 'untitledField'
2720
- })
2721
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
3292
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
2722
3293
  bordered: false,
2723
3294
  color: TYPE_TAG_COLORS[field.type] || 'default',
3295
+ icon: /*#__PURE__*/jsxRuntime.jsx(TypeIcon, {}),
2724
3296
  children: resolveFieldTypeLabel(definition || field.type, formatMessage)
2725
- }), field.hidden ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
3297
+ }), field.locked ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
3298
+ bordered: false,
3299
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.LockOutlined, {}),
3300
+ title: formatMessage({
3301
+ id: 'fieldLockedTips'
3302
+ }),
3303
+ children: formatMessage({
3304
+ id: 'fieldLockedTag'
3305
+ })
3306
+ }) : null, field.hidden ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
2726
3307
  bordered: false,
3308
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.EyeInvisibleOutlined, {}),
2727
3309
  children: formatMessage({
2728
3310
  id: 'fieldHiddenTag'
2729
3311
  })
3312
+ }) : null, conditional ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
3313
+ title: formatVisibleWhen(field.visibleWhen, {
3314
+ formatMessage,
3315
+ fieldLookup: conditionContext?.fieldLookup,
3316
+ resolveText: value => resolveLocaleText(value, locale, languages)
3317
+ }),
3318
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
3319
+ bordered: false,
3320
+ color: "magenta",
3321
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.BranchesOutlined, {}),
3322
+ children: formatMessage({
3323
+ id: 'fieldConditionTag'
3324
+ })
3325
+ })
3326
+ }) : null, conditionInvalid ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
3327
+ title: formatMessage({
3328
+ id: 'fieldConditionInvalidTips'
3329
+ }),
3330
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
3331
+ bordered: false,
3332
+ color: "error",
3333
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.WarningOutlined, {}),
3334
+ children: formatMessage({
3335
+ id: 'fieldConditionInvalidTag'
3336
+ })
3337
+ })
2730
3338
  }) : null, field.block ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
2731
3339
  bordered: false,
2732
3340
  color: "processing",
3341
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.ColumnWidthOutlined, {}),
2733
3342
  children: formatMessage({
2734
3343
  id: 'fieldBlockTag'
2735
3344
  })
2736
3345
  }) : null]
2737
- })
2738
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
3346
+ })]
3347
+ }), field.locked ? null : /*#__PURE__*/jsxRuntime.jsxs("div", {
2739
3348
  className: style['action-group'],
2740
3349
  children: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2741
3350
  type: "text",
@@ -2745,7 +3354,7 @@ const FieldRow = ({
2745
3354
  id: 'moveUp'
2746
3355
  }),
2747
3356
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
2748
- disabled: index === 0,
3357
+ disabled: index === 0 || prevLocked,
2749
3358
  onClick: () => onMove(field.id, 'up')
2750
3359
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2751
3360
  type: "text",
@@ -2755,7 +3364,7 @@ const FieldRow = ({
2755
3364
  id: 'moveDown'
2756
3365
  }),
2757
3366
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
2758
- disabled: index === total - 1,
3367
+ disabled: index === total - 1 || nextLocked,
2759
3368
  onClick: () => onMove(field.id, 'down')
2760
3369
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
2761
3370
  type: "text",
@@ -2780,10 +3389,9 @@ const FieldRow = ({
2780
3389
  })]
2781
3390
  });
2782
3391
  };
2783
- var FieldRow$1 = FieldRow;
2784
3392
 
2785
3393
  const {
2786
- Text: Text$3
3394
+ Text: Text$4
2787
3395
  } = antd.Typography;
2788
3396
  const ActionGroup = ({
2789
3397
  children
@@ -2828,6 +3436,10 @@ const ROOT_ADD_OPTIONS = [{
2828
3436
  key: 'steps',
2829
3437
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.OrderedListOutlined, {})
2830
3438
  }];
3439
+ const BLOCK_KIND_ICONS = Object.fromEntries(ROOT_ADD_OPTIONS.map(({
3440
+ key,
3441
+ icon
3442
+ }) => [key, icon]));
2831
3443
 
2832
3444
  /** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
2833
3445
  const NESTED_ADD_OPTIONS = ROOT_ADD_OPTIONS.filter(opt => opt.key !== 'steps');
@@ -2861,6 +3473,15 @@ const BlockListPanel = ({
2861
3473
  const [addMenuOpen, setAddMenuOpen] = react.useState(false);
2862
3474
  const [addFieldMenuId, setAddFieldMenuId] = react.useState(null);
2863
3475
  const keepAddFieldMenuOpenRef = react.useRef(false);
3476
+ const conditionContext = react.useMemo(() => {
3477
+ const triggerFields = collectConditionFields({
3478
+ blocks
3479
+ }).filter(item => !item.inList);
3480
+ return {
3481
+ triggerNames: new Set(triggerFields.map(item => item.path)),
3482
+ fieldLookup: new Map(triggerFields.map(item => [item.path, item.field]))
3483
+ };
3484
+ }, [blocks]);
2864
3485
  const renderAddBlockMenu = (options, {
2865
3486
  onSelect,
2866
3487
  className
@@ -3022,7 +3643,7 @@ const BlockListPanel = ({
3022
3643
  optionId
3023
3644
  } = {}) => {
3024
3645
  if (!(fields || []).length) {
3025
- return /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3646
+ return /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3026
3647
  type: "secondary",
3027
3648
  className: style['inline-empty'],
3028
3649
  children: formatMessage({
@@ -3032,10 +3653,13 @@ const BlockListPanel = ({
3032
3653
  }
3033
3654
  return /*#__PURE__*/jsxRuntime.jsx("div", {
3034
3655
  className: style['field-list'],
3035
- children: fields.map((field, fieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FieldRow$1, {
3656
+ children: fields.map((field, fieldIndex) => /*#__PURE__*/jsxRuntime.jsx(FieldRow, {
3036
3657
  field: field,
3037
3658
  index: fieldIndex,
3038
3659
  total: fields.length,
3660
+ prevLocked: isFieldLocked(fields[fieldIndex - 1]),
3661
+ nextLocked: isFieldLocked(fields[fieldIndex + 1]),
3662
+ conditionContext: conditionContext,
3039
3663
  onEdit: fieldItem => onEditField(blockId, fieldItem, {
3040
3664
  stepId,
3041
3665
  optionId
@@ -3059,7 +3683,7 @@ const BlockListPanel = ({
3059
3683
  className: style['item-blocks-section'],
3060
3684
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
3061
3685
  className: style['nested-block-list'],
3062
- children: childBlocks.map((child, childIndex) => renderBlockSection(child, childIndex, childBlocks.length, depth + 1))
3686
+ children: childBlocks.map((child, childIndex) => renderBlockSection(child, childIndex, childBlocks, depth + 1))
3063
3687
  })
3064
3688
  });
3065
3689
  };
@@ -3070,7 +3694,7 @@ const BlockListPanel = ({
3070
3694
  className: style['block-body'],
3071
3695
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
3072
3696
  className: style['section-toolbar'],
3073
- children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
3697
+ children: [/*#__PURE__*/jsxRuntime.jsx(Text$4, {
3074
3698
  type: "secondary",
3075
3699
  className: style['section-toolbar-label'],
3076
3700
  children: formatMessage({
@@ -3099,14 +3723,14 @@ const BlockListPanel = ({
3099
3723
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
3100
3724
  className: style['step-index'],
3101
3725
  children: stepIndex + 1
3102
- }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3726
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3103
3727
  strong: true,
3104
3728
  children: text(step.title) || formatMessage({
3105
3729
  id: 'untitledStep'
3106
3730
  }, {
3107
3731
  index: stepIndex + 1
3108
3732
  })
3109
- }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3733
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3110
3734
  type: "secondary",
3111
3735
  children: (step.blocks || []).length ? formatMessage({
3112
3736
  id: 'fieldAndItemBlockCount'
@@ -3129,14 +3753,14 @@ const BlockListPanel = ({
3129
3753
  id: 'moveUp'
3130
3754
  }),
3131
3755
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
3132
- disabled: stepIndex === 0,
3756
+ disabled: stepIndex === 0 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex - 1]),
3133
3757
  onClick: () => onMoveStep(block.id, step.id, 'up')
3134
3758
  }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3135
3759
  title: formatMessage({
3136
3760
  id: 'moveDown'
3137
3761
  }),
3138
3762
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
3139
- disabled: stepIndex === (block.items?.length || 0) - 1,
3763
+ disabled: stepIndex === (block.items?.length || 0) - 1 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex + 1]),
3140
3764
  onClick: () => onMoveStep(block.id, step.id, 'down')
3141
3765
  }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3142
3766
  title: formatMessage({
@@ -3144,7 +3768,7 @@ const BlockListPanel = ({
3144
3768
  }),
3145
3769
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
3146
3770
  onClick: () => onEditStep(block.id, step)
3147
- }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3771
+ }), blockHasLockedField(step) ? null : /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3148
3772
  title: formatMessage({
3149
3773
  id: 'deleteStep'
3150
3774
  }),
@@ -3168,7 +3792,7 @@ const BlockListPanel = ({
3168
3792
  stepId: step.id
3169
3793
  }), renderNestedBlocks(step.blocks, depth)]
3170
3794
  }, step.id))
3171
- }) : /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3795
+ }) : /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3172
3796
  type: "secondary",
3173
3797
  className: style['inline-empty'],
3174
3798
  children: formatMessage({
@@ -3180,7 +3804,7 @@ const BlockListPanel = ({
3180
3804
  if (block.kind === 'multiField') {
3181
3805
  return /*#__PURE__*/jsxRuntime.jsx("div", {
3182
3806
  className: style['block-body'],
3183
- children: /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3807
+ children: /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3184
3808
  type: "secondary",
3185
3809
  children: formatMessage({
3186
3810
  id: 'multiFieldEditorHint'
@@ -3193,7 +3817,7 @@ const BlockListPanel = ({
3193
3817
  className: style['block-body'],
3194
3818
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
3195
3819
  className: style['section-toolbar'],
3196
- children: [/*#__PURE__*/jsxRuntime.jsx(Text$3, {
3820
+ children: [/*#__PURE__*/jsxRuntime.jsx(Text$4, {
3197
3821
  type: "secondary",
3198
3822
  className: style['section-toolbar-label'],
3199
3823
  children: formatMessage({
@@ -3222,14 +3846,14 @@ const BlockListPanel = ({
3222
3846
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
3223
3847
  className: style['step-index'],
3224
3848
  children: optionIndex + 1
3225
- }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3849
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3226
3850
  strong: true,
3227
3851
  children: text(option.title) || formatMessage({
3228
3852
  id: 'choiceOptionFallback'
3229
3853
  }, {
3230
3854
  index: optionIndex + 1
3231
3855
  })
3232
- }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3856
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3233
3857
  type: "secondary",
3234
3858
  children: (option.blocks || []).length ? formatMessage({
3235
3859
  id: 'fieldAndItemBlockCount'
@@ -3252,14 +3876,14 @@ const BlockListPanel = ({
3252
3876
  id: 'moveUp'
3253
3877
  }),
3254
3878
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
3255
- disabled: optionIndex === 0,
3879
+ disabled: optionIndex === 0 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex - 1]),
3256
3880
  onClick: () => onMoveChoiceOption(block.id, option.id, 'up')
3257
3881
  }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3258
3882
  title: formatMessage({
3259
3883
  id: 'moveDown'
3260
3884
  }),
3261
3885
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
3262
- disabled: optionIndex === (block.options?.length || 0) - 1,
3886
+ disabled: optionIndex === (block.options?.length || 0) - 1 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex + 1]),
3263
3887
  onClick: () => onMoveChoiceOption(block.id, option.id, 'down')
3264
3888
  }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3265
3889
  title: formatMessage({
@@ -3267,7 +3891,7 @@ const BlockListPanel = ({
3267
3891
  }),
3268
3892
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.EditOutlined, {}),
3269
3893
  onClick: () => onEditChoiceOption(block.id, option)
3270
- }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3894
+ }), blockHasLockedField(option) ? null : /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3271
3895
  title: formatMessage({
3272
3896
  id: 'deleteChoiceOption'
3273
3897
  }),
@@ -3291,7 +3915,7 @@ const BlockListPanel = ({
3291
3915
  optionId: option.id
3292
3916
  }), renderNestedBlocks(option.blocks, depth)]
3293
3917
  }, option.id))
3294
- }) : /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3918
+ }) : /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3295
3919
  type: "secondary",
3296
3920
  className: style['inline-empty'],
3297
3921
  children: formatMessage({
@@ -3307,7 +3931,9 @@ const BlockListPanel = ({
3307
3931
  children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
3308
3932
  });
3309
3933
  };
3310
- const renderBlockSection = (block, blockIndex, total, depth = 0) => {
3934
+ const renderBlockSection = (block, blockIndex, siblings, depth = 0) => {
3935
+ const total = siblings.length;
3936
+ const locked = blockHasLockedField(block);
3311
3937
  const definition = getBlockDefinition(block.kind);
3312
3938
  const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
3313
3939
  const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
@@ -3321,7 +3947,10 @@ const BlockListPanel = ({
3321
3947
  }) : block.kind === 'multiField' ? formatMessage({
3322
3948
  id: 'multiFieldSummary'
3323
3949
  }, {
3324
- type: resolveFieldTypeLabel(block.fieldType, formatMessage)
3950
+ type: /*#__PURE__*/jsxRuntime.jsxs("span", {
3951
+ className: style['block-summary-type'],
3952
+ children: [/*#__PURE__*/react.createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
3953
+ })
3325
3954
  }) : block.kind === 'choice' ? formatMessage({
3326
3955
  id: 'choiceOptionCount'
3327
3956
  }, {
@@ -3345,10 +3974,11 @@ const BlockListPanel = ({
3345
3974
  children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
3346
3975
  bordered: false,
3347
3976
  color: definition?.color || 'default',
3977
+ icon: BLOCK_KIND_ICONS[block.kind],
3348
3978
  children: formatMessage({
3349
3979
  id: `blockKind_${block.kind}`
3350
3980
  })
3351
- }), /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3981
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$4, {
3352
3982
  strong: true,
3353
3983
  ellipsis: true,
3354
3984
  className: style['block-title'],
@@ -3369,14 +3999,14 @@ const BlockListPanel = ({
3369
3999
  id: 'moveUp'
3370
4000
  }),
3371
4001
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowUpOutlined, {}),
3372
- disabled: blockIndex === 0,
4002
+ disabled: blockIndex === 0 || locked || blockHasLockedField(siblings[blockIndex - 1]),
3373
4003
  onClick: () => onMoveBlock(block.id, 'up')
3374
4004
  }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3375
4005
  title: formatMessage({
3376
4006
  id: 'moveDown'
3377
4007
  }),
3378
4008
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ArrowDownOutlined, {}),
3379
- disabled: blockIndex === total - 1,
4009
+ disabled: blockIndex === total - 1 || locked || blockHasLockedField(siblings[blockIndex + 1]),
3380
4010
  onClick: () => onMoveBlock(block.id, 'down')
3381
4011
  }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3382
4012
  title: formatMessage({
@@ -3384,7 +4014,7 @@ const BlockListPanel = ({
3384
4014
  }),
3385
4015
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.SettingOutlined, {}),
3386
4016
  onClick: () => onEditBlock(block)
3387
- }), /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
4017
+ }), locked ? null : /*#__PURE__*/jsxRuntime.jsx(IconBtn, {
3388
4018
  title: formatMessage({
3389
4019
  id: 'deleteBlock'
3390
4020
  }),
@@ -3452,7 +4082,7 @@ const BlockListPanel = ({
3452
4082
  })
3453
4083
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
3454
4084
  className: style['block-list'],
3455
- children: blocks.map((block, blockIndex) => renderBlockSection(block, blockIndex, blocks.length, 0))
4085
+ children: blocks.map((block, blockIndex) => renderBlockSection(block, blockIndex, blocks, 0))
3456
4086
  })]
3457
4087
  });
3458
4088
  };
@@ -3873,7 +4503,7 @@ const ChoiceOptionEditorModal = ({
3873
4503
  var ChoiceOptionEditorModal$1 = ChoiceOptionEditorModal;
3874
4504
 
3875
4505
  const {
3876
- Text: Text$2
4506
+ Text: Text$3
3877
4507
  } = antd.Typography;
3878
4508
  const {
3879
4509
  useOnChange
@@ -3922,7 +4552,7 @@ const RulePresetEditor = () => {
3922
4552
  }) => (openApi?.data?.rulePresets || []).includes(RULE_LEN_PRESET)
3923
4553
  }, "lenMax"), /*#__PURE__*/jsxRuntime.jsx("div", {
3924
4554
  block: true,
3925
- children: /*#__PURE__*/jsxRuntime.jsx(Text$2, {
4555
+ children: /*#__PURE__*/jsxRuntime.jsx(Text$3, {
3926
4556
  type: "secondary",
3927
4557
  children: formatMessage({
3928
4558
  id: 'ruleEditorHint'
@@ -3940,7 +4570,7 @@ const RulePresetEditor = () => {
3940
4570
  var RulePresetEditor$1 = RulePresetEditor;
3941
4571
 
3942
4572
  const {
3943
- Text: Text$1
4573
+ Text: Text$2
3944
4574
  } = antd.Typography;
3945
4575
  const createOptionKey = () => createDataKey('opt');
3946
4576
  const EMPTY_OPTION = () => ({
@@ -4355,7 +4985,7 @@ const TableRowsEditor = ({
4355
4985
  column: 1,
4356
4986
  list: [/*#__PURE__*/jsxRuntime.jsx("div", {
4357
4987
  block: true,
4358
- children: /*#__PURE__*/jsxRuntime.jsx(Text$1, {
4988
+ children: /*#__PURE__*/jsxRuntime.jsx(Text$2, {
4359
4989
  type: "secondary",
4360
4990
  children: formatMessage({
4361
4991
  id: 'tableRowsNeedColumnsHint'
@@ -4914,6 +5544,391 @@ const hasFieldPropsEditor = (type, definition) => {
4914
5544
  };
4915
5545
  var FieldPropsEditor$1 = FieldPropsEditor;
4916
5546
 
5547
+ const {
5548
+ Text: Text$1
5549
+ } = antd.Typography;
5550
+ const MULTI_VALUE_OPERATORS = ['in', 'includesAny'];
5551
+ const createCondition = () => ({
5552
+ field: undefined,
5553
+ operator: undefined,
5554
+ value: undefined
5555
+ });
5556
+
5557
+ /** 编辑器提交前校验:返回错误文案 id,通过返回 null */
5558
+ const validateVisibleWhenDraft = visibleWhen => {
5559
+ if (!visibleWhen) {
5560
+ return null;
5561
+ }
5562
+ const incomplete = (visibleWhen.conditions || []).some(condition => {
5563
+ if (!condition?.field || !condition.operator) {
5564
+ return true;
5565
+ }
5566
+ if (NO_VALUE_OPERATORS.includes(condition.operator)) {
5567
+ return false;
5568
+ }
5569
+ const value = condition.value;
5570
+ return value === undefined || value === null || value === '' || Array.isArray(value) && !value.length;
5571
+ });
5572
+ if (incomplete || !(visibleWhen.conditions || []).length) {
5573
+ return 'visibleWhenConditionRequired';
5574
+ }
5575
+ if (visibleWhen.conditions.some(condition => condition.operator === 'regex' && !compileConditionRegex(condition.value, condition.flags))) {
5576
+ return 'visibleWhenRegexInvalid';
5577
+ }
5578
+ return null;
5579
+ };
5580
+ const RegexTester = ({
5581
+ condition
5582
+ }) => {
5583
+ const {
5584
+ formatMessage
5585
+ } = reactIntl.useIntl();
5586
+ const [text, setText] = react.useState('');
5587
+ const regex = compileConditionRegex(condition.value, condition.flags);
5588
+ const status = regex && text !== '' ? regex.test(text) : null;
5589
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
5590
+ gap: 8,
5591
+ align: "center",
5592
+ className: style['visible-when-regex-tester'],
5593
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
5594
+ size: "small",
5595
+ value: text,
5596
+ placeholder: formatMessage({
5597
+ id: 'visibleWhenRegexTester'
5598
+ }),
5599
+ onChange: e => setText(e.target.value)
5600
+ }), status === null ? null : /*#__PURE__*/jsxRuntime.jsx(Text$1, {
5601
+ type: status ? 'success' : 'warning',
5602
+ children: formatMessage({
5603
+ id: status ? 'visibleWhenRegexMatched' : 'visibleWhenRegexNotMatched'
5604
+ })
5605
+ })]
5606
+ });
5607
+ };
5608
+ const ConditionValueInput = ({
5609
+ condition,
5610
+ trigger,
5611
+ onChange
5612
+ }) => {
5613
+ const {
5614
+ formatMessage,
5615
+ locale
5616
+ } = reactIntl.useIntl();
5617
+ const definition = getFieldDefinition(trigger?.type);
5618
+ const kind = getConditionValueKind(trigger, definition);
5619
+ if (NO_VALUE_OPERATORS.includes(condition.operator)) {
5620
+ return null;
5621
+ }
5622
+ if (condition.operator === 'regex') {
5623
+ const regexInvalid = condition.value != null && condition.value !== '' && !compileConditionRegex(condition.value, condition.flags);
5624
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
5625
+ className: style['visible-when-regex'],
5626
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
5627
+ gap: 8,
5628
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Input, {
5629
+ prefix: "/",
5630
+ suffix: "/",
5631
+ status: regexInvalid ? 'error' : undefined,
5632
+ value: condition.value ?? '',
5633
+ placeholder: formatMessage({
5634
+ id: 'visibleWhenValue'
5635
+ }),
5636
+ onChange: e => onChange({
5637
+ value: e.target.value
5638
+ })
5639
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
5640
+ mode: "multiple",
5641
+ className: style['visible-when-flags'],
5642
+ placeholder: formatMessage({
5643
+ id: 'visibleWhenRegexFlags'
5644
+ }),
5645
+ value: String(condition.flags || '').split('').filter(Boolean),
5646
+ options: ALLOWED_REGEX_FLAGS.map(flag => ({
5647
+ value: flag,
5648
+ label: formatMessage({
5649
+ id: `visibleWhenRegexFlag_${flag}`
5650
+ })
5651
+ })),
5652
+ optionLabelProp: "value",
5653
+ onChange: flags => onChange({
5654
+ flags: flags.join('')
5655
+ })
5656
+ })]
5657
+ }), regexInvalid ? /*#__PURE__*/jsxRuntime.jsx(Text$1, {
5658
+ type: "danger",
5659
+ children: formatMessage({
5660
+ id: 'visibleWhenRegexInvalid'
5661
+ })
5662
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(RegexTester, {
5663
+ condition: condition
5664
+ })]
5665
+ });
5666
+ }
5667
+ if (kind === 'boolean') {
5668
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
5669
+ className: style['visible-when-value'],
5670
+ value: condition.value,
5671
+ placeholder: formatMessage({
5672
+ id: 'visibleWhenValue'
5673
+ }),
5674
+ options: [{
5675
+ value: true,
5676
+ label: formatMessage({
5677
+ id: 'conditionValueTrue'
5678
+ })
5679
+ }, {
5680
+ value: false,
5681
+ label: formatMessage({
5682
+ id: 'conditionValueFalse'
5683
+ })
5684
+ }],
5685
+ onChange: value => onChange({
5686
+ value
5687
+ })
5688
+ });
5689
+ }
5690
+ if (kind === 'options' || kind === 'multiOptions') {
5691
+ const multiple = MULTI_VALUE_OPERATORS.includes(condition.operator);
5692
+ const options = (trigger?.props?.options || []).filter(item => item?.value != null && item.value !== '').map(item => ({
5693
+ value: item.value,
5694
+ label: resolveLocaleText(item.label, locale) || String(item.value)
5695
+ }));
5696
+ const value = multiple ? Array.isArray(condition.value) ? condition.value : condition.value != null ? [condition.value] : [] : Array.isArray(condition.value) ? condition.value[0] : condition.value;
5697
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
5698
+ className: style['visible-when-value']
5699
+ // 远程数据源没有静态选项时允许手动输入值
5700
+ ,
5701
+ mode: options.length ? multiple ? 'multiple' : undefined : 'tags',
5702
+ value: value,
5703
+ placeholder: formatMessage({
5704
+ id: 'visibleWhenValue'
5705
+ }),
5706
+ options: options,
5707
+ onChange: next => onChange({
5708
+ value: !options.length && !multiple && Array.isArray(next) ? next[next.length - 1] : next
5709
+ })
5710
+ });
5711
+ }
5712
+ if (kind === 'number') {
5713
+ return /*#__PURE__*/jsxRuntime.jsx(antd.InputNumber, {
5714
+ className: style['visible-when-value'],
5715
+ value: condition.value ?? null,
5716
+ placeholder: formatMessage({
5717
+ id: 'visibleWhenValue'
5718
+ }),
5719
+ onChange: value => onChange({
5720
+ value: value ?? undefined
5721
+ })
5722
+ });
5723
+ }
5724
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
5725
+ className: style['visible-when-value'],
5726
+ value: condition.value ?? '',
5727
+ placeholder: formatMessage({
5728
+ id: 'visibleWhenValue'
5729
+ }),
5730
+ onChange: e => onChange({
5731
+ value: e.target.value
5732
+ })
5733
+ });
5734
+ };
5735
+
5736
+ /**
5737
+ * 条件显示配置(受控):value 为 visibleWhen 草稿或 undefined
5738
+ * triggerFields:collectConditionFields 中可作为触发项的字段;scope:当前字段所在模块
5739
+ */
5740
+ const VisibleWhenEditor = ({
5741
+ value,
5742
+ onChange,
5743
+ schema,
5744
+ triggerFields = [],
5745
+ scope,
5746
+ fieldId
5747
+ }) => {
5748
+ const {
5749
+ formatMessage,
5750
+ locale
5751
+ } = reactIntl.useIntl();
5752
+ const {
5753
+ formData
5754
+ } = reactFormAntd.useFormContext() || {};
5755
+ const selfPath = getFieldConditionPath(scope, formData?.name ? String(formData.name).trim() : '');
5756
+ const candidates = react.useMemo(() => triggerFields.filter(item => item.id !== fieldId && item.path !== selfPath).map(item => ({
5757
+ ...item,
5758
+ disabled: selfPath ? wouldCreateCycle(schema, selfPath, item.path) : false
5759
+ })), [triggerFields, fieldId, selfPath, schema]);
5760
+ if (scope?.inList) {
5761
+ return /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
5762
+ title: formatMessage({
5763
+ id: 'visibleWhenTitle'
5764
+ }),
5765
+ column: 1,
5766
+ list: [/*#__PURE__*/jsxRuntime.jsx("div", {
5767
+ block: true,
5768
+ children: /*#__PURE__*/jsxRuntime.jsx(Text$1, {
5769
+ type: "secondary",
5770
+ children: formatMessage({
5771
+ id: 'visibleWhenListUnsupported'
5772
+ })
5773
+ })
5774
+ }, "unsupported")]
5775
+ });
5776
+ }
5777
+ const enabled = !!value;
5778
+ const conditions = value?.conditions || [];
5779
+ const updateConditions = next => onChange({
5780
+ ...value,
5781
+ conditions: next
5782
+ });
5783
+ const updateCondition = (index, patch) => updateConditions(conditions.map((item, itemIndex) => itemIndex === index ? {
5784
+ ...item,
5785
+ ...patch
5786
+ } : item));
5787
+ const body = /*#__PURE__*/jsxRuntime.jsxs("div", {
5788
+ block: true,
5789
+ className: style['visible-when-editor'],
5790
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
5791
+ gap: 8,
5792
+ align: "center",
5793
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Switch, {
5794
+ size: "small",
5795
+ checked: enabled,
5796
+ disabled: !enabled && !candidates.length,
5797
+ onChange: checked => onChange(checked ? {
5798
+ logic: 'and',
5799
+ conditions: [createCondition()]
5800
+ } : undefined)
5801
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$1, {
5802
+ children: formatMessage({
5803
+ id: 'visibleWhenEnable'
5804
+ })
5805
+ })]
5806
+ }), /*#__PURE__*/jsxRuntime.jsx(Text$1, {
5807
+ type: "secondary",
5808
+ className: style['visible-when-hint'],
5809
+ children: formatMessage({
5810
+ id: candidates.length || enabled ? 'visibleWhenEnableTips' : 'visibleWhenNoTrigger'
5811
+ })
5812
+ }), enabled ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
5813
+ children: [conditions.length > 1 ? /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
5814
+ gap: 8,
5815
+ align: "center",
5816
+ children: [/*#__PURE__*/jsxRuntime.jsx(Text$1, {
5817
+ children: formatMessage({
5818
+ id: 'visibleWhenLogic'
5819
+ })
5820
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Radio.Group, {
5821
+ size: "small",
5822
+ value: value.logic === 'or' ? 'or' : 'and',
5823
+ options: ['and', 'or'].map(logic => ({
5824
+ value: logic,
5825
+ label: formatMessage({
5826
+ id: `conditionLogic_${logic}`
5827
+ })
5828
+ })),
5829
+ onChange: e => onChange({
5830
+ ...value,
5831
+ logic: e.target.value
5832
+ })
5833
+ })]
5834
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
5835
+ className: style['visible-when-list'],
5836
+ children: conditions.map((condition, index) => {
5837
+ const trigger = triggerFields.find(item => item.path === condition.field)?.field;
5838
+ const operators = trigger ? getConditionOperators(trigger, getFieldDefinition(trigger.type)) : [];
5839
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
5840
+ gap: 8,
5841
+ align: "start",
5842
+ className: style['visible-when-row'],
5843
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
5844
+ className: style['visible-when-row-main'],
5845
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
5846
+ gap: 8,
5847
+ wrap: true,
5848
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Select, {
5849
+ showSearch: true,
5850
+ optionFilterProp: "label",
5851
+ className: style['visible-when-field'],
5852
+ status: condition.field && !trigger ? 'error' : undefined,
5853
+ value: condition.field,
5854
+ placeholder: formatMessage({
5855
+ id: 'visibleWhenField'
5856
+ }),
5857
+ options: candidates.map(item => ({
5858
+ value: item.path,
5859
+ disabled: item.disabled,
5860
+ label: `${resolveLocaleText(item.field.label, locale) || item.field.name}(${item.path})`
5861
+ })),
5862
+ onChange: path => {
5863
+ const nextTrigger = triggerFields.find(item => item.path === path)?.field;
5864
+ const nextOperators = getConditionOperators(nextTrigger, getFieldDefinition(nextTrigger?.type));
5865
+ updateCondition(index, {
5866
+ field: path,
5867
+ operator: nextOperators[0],
5868
+ value: undefined,
5869
+ flags: undefined
5870
+ });
5871
+ }
5872
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
5873
+ className: style['visible-when-operator'],
5874
+ value: condition.operator,
5875
+ disabled: !trigger,
5876
+ placeholder: formatMessage({
5877
+ id: 'visibleWhenOperator'
5878
+ }),
5879
+ options: operators.map(operator => ({
5880
+ value: operator,
5881
+ label: formatMessage({
5882
+ id: `conditionOperator_${operator}`
5883
+ })
5884
+ })),
5885
+ onChange: operator => updateCondition(index, {
5886
+ operator,
5887
+ value: undefined,
5888
+ flags: undefined
5889
+ })
5890
+ })]
5891
+ }), trigger && condition.operator ? /*#__PURE__*/jsxRuntime.jsx(ConditionValueInput, {
5892
+ condition: condition,
5893
+ trigger: trigger,
5894
+ onChange: patch => updateCondition(index, patch)
5895
+ }) : null]
5896
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
5897
+ type: "text",
5898
+ danger: true,
5899
+ className: style['icon-square-btn-sm'],
5900
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.DeleteOutlined, {}),
5901
+ onClick: () => {
5902
+ const next = conditions.filter((_, itemIndex) => itemIndex !== index);
5903
+ onChange(next.length ? {
5904
+ ...value,
5905
+ conditions: next
5906
+ } : undefined);
5907
+ }
5908
+ })]
5909
+ }, index);
5910
+ })
5911
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
5912
+ type: "dashed",
5913
+ block: true,
5914
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.PlusOutlined, {}),
5915
+ onClick: () => updateConditions([...conditions, createCondition()]),
5916
+ children: formatMessage({
5917
+ id: 'visibleWhenAddCondition'
5918
+ })
5919
+ })]
5920
+ }) : null]
5921
+ }, "visible-when");
5922
+ return /*#__PURE__*/jsxRuntime.jsx(FormInfo__default["default"], {
5923
+ title: formatMessage({
5924
+ id: 'visibleWhenTitle'
5925
+ }),
5926
+ column: 1,
5927
+ list: [body]
5928
+ });
5929
+ };
5930
+ var VisibleWhenEditor$1 = VisibleWhenEditor;
5931
+
4917
5932
  const {
4918
5933
  Text
4919
5934
  } = antd.Typography;
@@ -4937,7 +5952,10 @@ const FieldConfigFields = ({
4937
5952
  options,
4938
5953
  onOptionsChange,
4939
5954
  columns,
4940
- onColumnsChange
5955
+ onColumnsChange,
5956
+ visibleWhen,
5957
+ onVisibleWhenChange,
5958
+ conditionProps
4941
5959
  }) => {
4942
5960
  const {
4943
5961
  formatMessage
@@ -5060,6 +6078,10 @@ const FieldConfigFields = ({
5060
6078
  hasColumns: definition.hasColumns,
5061
6079
  columns: columns,
5062
6080
  onColumnsChange: onColumnsChange
6081
+ }) : null, conditionProps ? /*#__PURE__*/jsxRuntime.jsx(VisibleWhenEditor$1, {
6082
+ ...conditionProps,
6083
+ value: visibleWhen,
6084
+ onChange: onVisibleWhenChange
5063
6085
  }) : null]
5064
6086
  });
5065
6087
  };
@@ -5067,6 +6089,7 @@ const FieldEditorModal = ({
5067
6089
  open,
5068
6090
  field,
5069
6091
  fieldList,
6092
+ conditionProps,
5070
6093
  onCancel,
5071
6094
  onSave,
5072
6095
  renderModal
@@ -5103,6 +6126,7 @@ const FieldEditorModal = ({
5103
6126
  value: ''
5104
6127
  }]);
5105
6128
  const [columns, setColumns] = react.useState(() => [createEmptyColumn()]);
6129
+ const [visibleWhen, setVisibleWhen] = react.useState(undefined);
5106
6130
  react.useEffect(() => {
5107
6131
  if (!open) {
5108
6132
  return;
@@ -5112,6 +6136,7 @@ const FieldEditorModal = ({
5112
6136
  value: ''
5113
6137
  }]);
5114
6138
  setColumns(editorValues.selectProps?.columns?.length ? editorValues.selectProps.columns : [createEmptyColumn()]);
6139
+ setVisibleWhen(editorValues.visibleWhen);
5115
6140
  }, [open, editorValues]);
5116
6141
  const handleSubmit = function (values) {
5117
6142
  try {
@@ -5121,6 +6146,13 @@ const FieldEditorModal = ({
5121
6146
  }));
5122
6147
  return Promise.resolve(false);
5123
6148
  }
6149
+ const conditionError = conditionProps && !conditionProps.scope?.inList ? validateVisibleWhenDraft(visibleWhen) : null;
6150
+ if (conditionError) {
6151
+ antd.message.error(formatMessage({
6152
+ id: conditionError
6153
+ }));
6154
+ return Promise.resolve(false);
6155
+ }
5124
6156
  const definition = getFieldDefinition(values.type);
5125
6157
  const normalizedColumns = definition?.hasColumns ? normalizeColumns(columns) : [];
5126
6158
  const nextField = formValuesToField({
@@ -5138,13 +6170,13 @@ const FieldEditorModal = ({
5138
6170
  ...values,
5139
6171
  columns: normalizedColumns
5140
6172
  },
5141
- fieldProps: values
6173
+ fieldProps: values,
6174
+ visibleWhen
5142
6175
  }, field || createField$1());
5143
6176
  if (!nextField.id) {
5144
6177
  nextField.id = createField$1().id;
5145
6178
  }
5146
- onSave(nextField);
5147
- return Promise.resolve();
6179
+ return Promise.resolve(onSave(nextField));
5148
6180
  } catch (e) {
5149
6181
  return Promise.reject(e);
5150
6182
  }
@@ -5177,7 +6209,13 @@ const FieldEditorModal = ({
5177
6209
  options: options,
5178
6210
  onOptionsChange: setOptions,
5179
6211
  columns: columns,
5180
- onColumnsChange: setColumns
6212
+ onColumnsChange: setColumns,
6213
+ visibleWhen: visibleWhen,
6214
+ onVisibleWhenChange: setVisibleWhen,
6215
+ conditionProps: conditionProps ? {
6216
+ ...conditionProps,
6217
+ fieldId: field?.id
6218
+ } : null
5181
6219
  })
5182
6220
  }, modalKey);
5183
6221
  };
@@ -5627,6 +6665,50 @@ const ChoiceBlock = ({
5627
6665
  };
5628
6666
  var ChoiceBlock$1 = ChoiceBlock;
5629
6667
 
6668
+ /**
6669
+ * 按 visibleWhen 过滤字段的 FormInfo:
6670
+ * entries 为 [{ element, path, visibleWhen }],不满足条件的字段从 list 中移除(卸载即不参与校验),
6671
+ * 已有值的隐藏字段清空,避免提交残留
6672
+ */
6673
+ const ConditionalFormInfo = ({
6674
+ entries,
6675
+ nested = [],
6676
+ knownNames,
6677
+ ...formInfoProps
6678
+ }) => {
6679
+ const {
6680
+ formData,
6681
+ openApi
6682
+ } = reactFormAntd.useFormContext() || {};
6683
+ const hasForm = !!openApi;
6684
+ const hiddenPaths = react.useMemo(() => {
6685
+ if (!hasForm) {
6686
+ return [];
6687
+ }
6688
+ return entries.filter(entry => entry.visibleWhen && !evaluateVisibleWhen(entry.visibleWhen, formData, knownNames)).map(entry => entry.path);
6689
+ }, [entries, formData, knownNames, hasForm]);
6690
+ react.useEffect(() => {
6691
+ if (!hasForm) {
6692
+ return;
6693
+ }
6694
+ const toClear = hiddenPaths.filter(path => !isEmptyValue$1(getByPath$2(formData, path)));
6695
+ if (toClear.length) {
6696
+ openApi.setFields(toClear.map(name => ({
6697
+ name,
6698
+ value: undefined
6699
+ })), {
6700
+ runValidate: false
6701
+ });
6702
+ }
6703
+ }, [hiddenPaths, formData, openApi, hasForm]);
6704
+ const list = entries.filter(entry => !hiddenPaths.includes(entry.path)).map(entry => entry.element);
6705
+ return /*#__PURE__*/react.createElement(FormInfo__default["default"], {
6706
+ ...formInfoProps,
6707
+ list: [...list, ...nested]
6708
+ });
6709
+ };
6710
+ var ConditionalFormInfo$1 = ConditionalFormInfo;
6711
+
5630
6712
  // @kne/react-form 内置规则的错误提示写死中文;在 preset 覆盖前记下原函数,只替换未被业务覆盖的规则
5631
6713
  const BUILTIN_RULES = {
5632
6714
  TEL: reactFormAntd.RULES.TEL,
@@ -5708,11 +6790,11 @@ const buildIndexedLabelRender = index => {
5708
6790
  }, text) : null);
5709
6791
  };
5710
6792
  };
5711
- const renderFieldElements = (fields = [], preview = false, {
6793
+ const renderFieldEntries = (fields = [], preview = false, {
5712
6794
  namePrefix,
5713
6795
  locale,
5714
6796
  showIndex = false
5715
- } = {}) => fields.filter(field => !field.hidden).map((field, index) => {
6797
+ } = {}) => (fields || []).filter(field => !field.hidden).map((field, index) => {
5716
6798
  const Component = getFieldComponent(field.type, field);
5717
6799
  if (!Component) {
5718
6800
  return null;
@@ -5748,7 +6830,7 @@ const renderFieldElements = (fields = [], preview = false, {
5748
6830
  locale
5749
6831
  } : {};
5750
6832
  const label = buildFieldLabel(field);
5751
- return /*#__PURE__*/react.createElement(Component, {
6833
+ const element = /*#__PURE__*/react.createElement(Component, {
5752
6834
  key: field.id,
5753
6835
  name: fieldName,
5754
6836
  label: showIndex ? label || '\u200b' : label,
@@ -5762,7 +6844,29 @@ const renderFieldElements = (fields = [], preview = false, {
5762
6844
  labelTips: buildLabelTips(field.tips),
5763
6845
  description
5764
6846
  });
6847
+ return {
6848
+ element,
6849
+ path: fieldName,
6850
+ visibleWhen: hasVisibleWhen(field) ? field.visibleWhen : null
6851
+ };
5765
6852
  }).filter(Boolean);
6853
+ const renderFieldElements = (fields, preview, opts) => renderFieldEntries(fields, preview, opts).map(entry => entry.element);
6854
+
6855
+ /** 字段含 visibleWhen 时换成 ConditionalFormInfo,否则保持普通 FormInfo */
6856
+ const createFieldsFormInfo = (formInfoProps, entries, nested = [], knownNames) => {
6857
+ if (entries.some(entry => entry.visibleWhen)) {
6858
+ return /*#__PURE__*/react.createElement(ConditionalFormInfo$1, {
6859
+ ...formInfoProps,
6860
+ entries,
6861
+ nested,
6862
+ knownNames
6863
+ });
6864
+ }
6865
+ return /*#__PURE__*/react.createElement(FormInfo__default["default"], {
6866
+ ...formInfoProps,
6867
+ list: [...entries.map(entry => entry.element), ...nested]
6868
+ });
6869
+ };
5766
6870
  const withBlockLayout = (element, forceBlock) => {
5767
6871
  if (!element || !forceBlock) {
5768
6872
  return element;
@@ -5799,7 +6903,8 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
5799
6903
  formatMessage,
5800
6904
  depth = 0,
5801
6905
  asListItem = false,
5802
- locale
6906
+ locale,
6907
+ knownNames
5803
6908
  } = ctx;
5804
6909
  if (!block || depth > MAX_BLOCK_DEPTH) {
5805
6910
  return null;
@@ -5829,41 +6934,39 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
5829
6934
  case 'formInfo':
5830
6935
  {
5831
6936
  const showIndex = !!block.showIndex;
5832
- const fields = renderFieldElements(block.list, preview, {
6937
+ const entries = renderFieldEntries(block.list, preview, {
5833
6938
  ...fieldRenderOpts,
5834
6939
  showIndex
5835
6940
  });
5836
6941
  const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
5837
- return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo__default["default"], {
6942
+ return withBlockLayout(createFieldsFormInfo({
5838
6943
  key: block.id,
5839
6944
  title: block.title || undefined,
5840
6945
  subtitle: block.subtitle || undefined,
5841
6946
  column: block.column,
5842
6947
  gap: block.gap,
5843
6948
  bordered,
5844
- list: [...fields, ...nested],
5845
6949
  ...(listItemPartProps || {}),
5846
6950
  className: resolvePartRootClassName(depth, showIndex ? style['form-info-show-index'] : null)
5847
- }), asListItem);
6951
+ }, entries, nested, knownNames), asListItem);
5848
6952
  }
5849
6953
  case 'object':
5850
6954
  {
5851
- const fields = renderFieldElements(block.list, preview, {
6955
+ const entries = renderFieldEntries(block.list, preview, {
5852
6956
  ...fieldRenderOpts,
5853
6957
  namePrefix: block.name || ''
5854
6958
  });
5855
6959
  const nested = renderChildBlocks(block.blocks || [], nextCtx).map(node => withBlockLayout(node, true));
5856
- return withBlockLayout(/*#__PURE__*/react.createElement(FormInfo__default["default"], {
6960
+ return withBlockLayout(createFieldsFormInfo({
5857
6961
  key: block.id,
5858
6962
  title: block.title || undefined,
5859
6963
  subtitle: block.subtitle || undefined,
5860
6964
  column: block.column,
5861
6965
  gap: block.gap,
5862
6966
  bordered,
5863
- list: [...fields, ...nested],
5864
6967
  ...(listItemPartProps || {}),
5865
6968
  className: resolvePartRootClassName(depth)
5866
- }), asListItem);
6969
+ }, entries, nested, knownNames), asListItem);
5867
6970
  }
5868
6971
  case 'list':
5869
6972
  {
@@ -5958,10 +7061,11 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
5958
7061
  prevIcon: /*#__PURE__*/react.createElement(icons.ArrowLeftOutlined),
5959
7062
  nextIcon: /*#__PURE__*/react.createElement(icons.ArrowRightOutlined),
5960
7063
  items: (block.items || []).map(step => {
5961
- const fields = renderFieldElements(step.list, preview, fieldRenderOpts);
7064
+ const entries = renderFieldEntries(step.list, preview, fieldRenderOpts);
5962
7065
  const nested = renderChildBlocks(step.blocks || [], nextCtx);
5963
7066
  const fieldNames = [...(step.list || []).filter(field => field && !field.hidden && field.name).map(field => field.name), ...collectBlockFieldNames(step.blocks || [])];
5964
- if (nested.length) {
7067
+ const hasConditional = entries.some(entry => entry.visibleWhen);
7068
+ if (nested.length || hasConditional) {
5965
7069
  return {
5966
7070
  key: step.id,
5967
7071
  title: step.title,
@@ -5970,12 +7074,11 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
5970
7074
  fieldNames,
5971
7075
  children: /*#__PURE__*/react.createElement(react.Fragment, {
5972
7076
  key: `${step.id}-body`
5973
- }, fields.length ? /*#__PURE__*/react.createElement(FormInfo__default["default"], {
7077
+ }, entries.length ? createFieldsFormInfo({
5974
7078
  key: `${step.id}-fields`,
5975
7079
  column: step.column,
5976
- gap: block.gap,
5977
- list: fields
5978
- }) : null, ...nested)
7080
+ gap: block.gap
7081
+ }, entries, [], knownNames) : null, ...nested)
5979
7082
  };
5980
7083
  }
5981
7084
  return {
@@ -5983,7 +7086,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
5983
7086
  title: step.title,
5984
7087
  column: step.column,
5985
7088
  gap: block.gap,
5986
- list: fields,
7089
+ list: entries.map(entry => entry.element),
5987
7090
  fieldNames
5988
7091
  };
5989
7092
  })
@@ -6000,12 +7103,11 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
6000
7103
  renderOptionContent: option => {
6001
7104
  const nodes = [];
6002
7105
  if ((option.list || []).length) {
6003
- nodes.push(/*#__PURE__*/react.createElement(FormInfo__default["default"], {
7106
+ nodes.push(createFieldsFormInfo({
6004
7107
  key: `${option.id}-fields`,
6005
7108
  column: block.column || 2,
6006
- gap: block.gap,
6007
- list: renderFieldElements(option.list, preview)
6008
- }));
7109
+ gap: block.gap
7110
+ }, renderFieldEntries(option.list, preview), [], knownNames));
6009
7111
  }
6010
7112
  nodes.push(...renderChildBlocks(option.blocks || [], nextCtx));
6011
7113
  return nodes.filter(Boolean);
@@ -6027,10 +7129,12 @@ const renderSchemaInner = (schema, {
6027
7129
  } = {}) => {
6028
7130
  const normalized = normalizeSchema(schema);
6029
7131
  const blocks = normalized.blocks || [];
7132
+ const knownNames = collectTriggerNames(normalized);
6030
7133
  const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
6031
7134
  isMobile,
6032
7135
  formatMessage,
6033
- locale
7136
+ locale,
7137
+ knownNames
6034
7138
  })).filter(Boolean);
6035
7139
  if (!contentChildren.length && !children && !actionNode) {
6036
7140
  return null;
@@ -6056,10 +7160,12 @@ const renderSchemaContent = (schema, {
6056
7160
  } = {}) => {
6057
7161
  const normalized = normalizeSchema(schema);
6058
7162
  const blocks = normalized.blocks || [];
7163
+ const knownNames = collectTriggerNames(normalized);
6059
7164
  const contentChildren = blocks.map(block => renderBlockElement(block, preview, {
6060
7165
  isMobile,
6061
7166
  formatMessage,
6062
- locale
7167
+ locale,
7168
+ knownNames
6063
7169
  })).filter(Boolean);
6064
7170
  if (!contentChildren.length && !children) {
6065
7171
  return null;
@@ -6407,6 +7513,9 @@ const FormCreator = withLocale$1(({
6407
7513
  clearBlockEditor();
6408
7514
  };
6409
7515
  const handleDeleteBlock = blockId => {
7516
+ if (blockHasLockedField(findBlock(schema, blockId))) {
7517
+ return;
7518
+ }
6410
7519
  updateSchema(updateBlocks(schema, blocks => removeBlockInTree(blocks, blockId)));
6411
7520
  };
6412
7521
  const handleMoveBlock = (blockId, direction) => {
@@ -6443,13 +7552,13 @@ const FormCreator = withLocale$1(({
6443
7552
  const handleDeleteStep = (blockId, stepId) => {
6444
7553
  updateSchema(mapBlocks(schema, blockId, block => ({
6445
7554
  ...block,
6446
- items: (block.items || []).filter(item => item.id !== stepId)
7555
+ items: (block.items || []).filter(item => item.id !== stepId || blockHasLockedField(item))
6447
7556
  })));
6448
7557
  };
6449
7558
  const handleMoveStep = (blockId, stepId, direction) => {
6450
7559
  updateSchema(mapBlocks(schema, blockId, block => ({
6451
7560
  ...block,
6452
- items: moveItem(block.items || [], stepId, direction)
7561
+ items: moveItem(block.items || [], stepId, direction, blockHasLockedField)
6453
7562
  })));
6454
7563
  };
6455
7564
  const handleAddChoiceOption = blockId => {
@@ -6483,13 +7592,13 @@ const FormCreator = withLocale$1(({
6483
7592
  const handleDeleteChoiceOption = (blockId, optionId) => {
6484
7593
  updateSchema(mapBlocks(schema, blockId, block => ({
6485
7594
  ...block,
6486
- options: (block.options || []).filter(item => item.id !== optionId)
7595
+ options: (block.options || []).filter(item => item.id !== optionId || blockHasLockedField(item))
6487
7596
  })));
6488
7597
  };
6489
7598
  const handleMoveChoiceOption = (blockId, optionId, direction) => {
6490
7599
  updateSchema(mapBlocks(schema, blockId, block => ({
6491
7600
  ...block,
6492
- options: moveItem(block.options || [], optionId, direction)
7601
+ options: moveItem(block.options || [], optionId, direction, blockHasLockedField)
6493
7602
  })));
6494
7603
  };
6495
7604
  const normalizeFieldScope = scope => {
@@ -6509,6 +7618,9 @@ const FormCreator = withLocale$1(({
6509
7618
  setFieldEditorOpen(true);
6510
7619
  };
6511
7620
  const handleEditField = (blockId, field, scope) => {
7621
+ if (isFieldLocked(field)) {
7622
+ return;
7623
+ }
6512
7624
  setFieldContext({
6513
7625
  blockId,
6514
7626
  ...normalizeFieldScope(scope)
@@ -6522,7 +7634,7 @@ const FormCreator = withLocale$1(({
6522
7634
  stepId,
6523
7635
  optionId
6524
7636
  } = fieldContext || {};
6525
- updateSchema(mapBlocks(schema, blockId, block => {
7637
+ let nextSchema = mapBlocks(schema, blockId, block => {
6526
7638
  if (block.kind === 'steps') {
6527
7639
  return {
6528
7640
  ...block,
@@ -6558,7 +7670,21 @@ const FormCreator = withLocale$1(({
6558
7670
  ...block,
6559
7671
  list: exists ? block.list.map(item => item.id === field.id ? field : item) : [...(block.list || []), field]
6560
7672
  };
6561
- }));
7673
+ });
7674
+ if (editingField?.name && editingField.name !== field.name) {
7675
+ const scope = getBlockConditionScope(schema, blockId);
7676
+ nextSchema = renameConditionReferences(nextSchema, getFieldConditionPath(scope, editingField.name), getFieldConditionPath(scope, field.name));
7677
+ }
7678
+ const cycle = findConditionCycle(nextSchema);
7679
+ if (cycle) {
7680
+ antd.message.error(formatMessage({
7681
+ id: 'visibleWhenCycle'
7682
+ }, {
7683
+ path: cycle.join(' → ')
7684
+ }));
7685
+ return false;
7686
+ }
7687
+ updateSchema(nextSchema);
6562
7688
  setFieldEditorOpen(false);
6563
7689
  setFieldContext(null);
6564
7690
  setEditingField(null);
@@ -6574,7 +7700,7 @@ const FormCreator = withLocale$1(({
6574
7700
  ...block,
6575
7701
  items: (block.items || []).map(step => step.id === stepId ? {
6576
7702
  ...step,
6577
- list: (step.list || []).filter(item => item.id !== fieldId)
7703
+ list: (step.list || []).filter(item => item.id !== fieldId || isFieldLocked(item))
6578
7704
  } : step)
6579
7705
  };
6580
7706
  }
@@ -6583,13 +7709,13 @@ const FormCreator = withLocale$1(({
6583
7709
  ...block,
6584
7710
  options: (block.options || []).map(option => option.id === optionId ? {
6585
7711
  ...option,
6586
- list: (option.list || []).filter(item => item.id !== fieldId)
7712
+ list: (option.list || []).filter(item => item.id !== fieldId || isFieldLocked(item))
6587
7713
  } : option)
6588
7714
  };
6589
7715
  }
6590
7716
  return {
6591
7717
  ...block,
6592
- list: (block.list || []).filter(item => item.id !== fieldId)
7718
+ list: (block.list || []).filter(item => item.id !== fieldId || isFieldLocked(item))
6593
7719
  };
6594
7720
  }));
6595
7721
  };
@@ -6628,6 +7754,11 @@ const FormCreator = withLocale$1(({
6628
7754
  stepId: fieldContext.stepId,
6629
7755
  optionId: fieldContext.optionId
6630
7756
  }) : [];
7757
+ const conditionProps = react.useMemo(() => fieldContext ? {
7758
+ schema,
7759
+ scope: getBlockConditionScope(schema, fieldContext.blockId),
7760
+ triggerFields: collectConditionFields(schema).filter(item => !item.inList)
7761
+ } : null, [schema, fieldContext]);
6631
7762
  const toolbarExtra = typeof extraToolbar === 'function' ? extraToolbar({
6632
7763
  schema
6633
7764
  }) : extraToolbar;
@@ -6703,6 +7834,7 @@ const FormCreator = withLocale$1(({
6703
7834
  open: fieldEditorOpen,
6704
7835
  field: editingField,
6705
7836
  fieldList: currentFieldScope,
7837
+ conditionProps: conditionProps,
6706
7838
  renderModal: renderModal,
6707
7839
  onCancel: () => {
6708
7840
  setFieldEditorOpen(false);
@@ -7036,7 +8168,7 @@ const formatDateToToday = (value, itemSchema, ctx) => {
7036
8168
  if (items[1] == null || items[1] === '' || items[1] === true) {
7037
8169
  const until = ctx.formatMessage?.({
7038
8170
  id: 'schemaContentUntilToday'
7039
- }) || defaultLocale.schemaContentUntilToday;
8171
+ }) || zhCN.schemaContentUntilToday;
7040
8172
  return [start, until].filter(Boolean).join(' ~ ');
7041
8173
  }
7042
8174
  const end = formatByValueSchema(items[1], itemSchema, ctx);
@@ -7091,11 +8223,11 @@ const formatBoolean = (value, field, ctx) => {
7091
8223
  if (value) {
7092
8224
  return props.checkedChildren || ctx.formatMessage?.({
7093
8225
  id: 'schemaContentYes'
7094
- }) || defaultLocale.schemaContentYes;
8226
+ }) || zhCN.schemaContentYes;
7095
8227
  }
7096
8228
  return props.unCheckedChildren || ctx.formatMessage?.({
7097
8229
  id: 'schemaContentNo'
7098
- }) || defaultLocale.schemaContentNo;
8230
+ }) || zhCN.schemaContentNo;
7099
8231
  };
7100
8232
  const stringifyFallback = value => {
7101
8233
  if (value == null) {
@@ -7314,8 +8446,41 @@ const resolveChoiceSelectorName$1 = block => {
7314
8446
  }
7315
8447
  return `__choice_${block.id}`;
7316
8448
  };
8449
+
8450
+ /** 条件说明文案:按 options.locale 取包内语言包,英文以外回退中文 */
8451
+ const createConditionContext = (normalized, locale) => {
8452
+ const messages = String(locale || '').startsWith('en') ? enUS : zhCN;
8453
+ const formatMessage = ({
8454
+ id
8455
+ }, values = {}) => String(messages[id] ?? id).replace(/\{(\w+)\}/g, (match, key) => values[key] != null ? values[key] : match);
8456
+ const conditionFields = collectConditionFields(normalized).filter(item => !item.inList);
8457
+ return {
8458
+ formatMessage,
8459
+ knownNames: new Set(conditionFields.map(item => item.path)),
8460
+ fieldLookup: new Map(conditionFields.map(item => [item.path, item.field]))
8461
+ };
8462
+ };
8463
+ const describeVisibleWhen = (field, ctx) => {
8464
+ const visibleWhen = {
8465
+ ...field.visibleWhen,
8466
+ conditions: field.visibleWhen.conditions.filter(condition => ctx.knownNames.has(condition?.field))
8467
+ };
8468
+ if (!visibleWhen.conditions.length) {
8469
+ return '';
8470
+ }
8471
+ const condition = formatVisibleWhen(visibleWhen, {
8472
+ formatMessage: ctx.formatMessage,
8473
+ fieldLookup: ctx.fieldLookup
8474
+ });
8475
+ return ctx.formatMessage({
8476
+ id: 'conditionDescription'
8477
+ }, {
8478
+ condition
8479
+ });
8480
+ };
7317
8481
  const mergeFieldIntoLayer = (layer, field, {
7318
- allowRequired = true
8482
+ allowRequired = true,
8483
+ ctx
7319
8484
  } = {}) => {
7320
8485
  if (!field?.name) {
7321
8486
  return;
@@ -7324,8 +8489,14 @@ const mergeFieldIntoLayer = (layer, field, {
7324
8489
  if (!name) {
7325
8490
  return;
7326
8491
  }
7327
- layer.properties[name] = resolveFieldValueSchema(field);
7328
- if (allowRequired && isReq(field.rule) && !layer.required.includes(name)) {
8492
+ const valueSchema = resolveFieldValueSchema(field);
8493
+ const conditionText = ctx?.formatMessage && hasVisibleWhen(field) ? describeVisibleWhen(field, ctx) : '';
8494
+ if (conditionText) {
8495
+ valueSchema.description = valueSchema.description ? `${valueSchema.description}\n${conditionText}` : conditionText;
8496
+ }
8497
+ layer.properties[name] = valueSchema;
8498
+ // 条件显示字段可能不出现在提交数据中,不进 required
8499
+ if (allowRequired && !conditionText && isReq(field.rule) && !layer.required.includes(name)) {
7329
8500
  layer.required.push(name);
7330
8501
  }
7331
8502
  };
@@ -7369,33 +8540,39 @@ const finalizeObjectSchema = (layer, {
7369
8540
  }
7370
8541
  return schema;
7371
8542
  };
7372
- const walkBlocks = (blocks, layer, depth = 0) => {
8543
+ const walkBlocks = (blocks, layer, depth = 0, ctx = {}) => {
7373
8544
  (blocks || []).forEach(block => {
7374
8545
  if (!block) {
7375
8546
  return;
7376
8547
  }
7377
- walkBlock(block, layer, depth);
8548
+ walkBlock(block, layer, depth, ctx);
7378
8549
  });
7379
8550
  };
7380
- const walkBlock = (block, layer, depth = 0) => {
8551
+ const walkBlock = (block, layer, depth = 0, ctx = {}) => {
7381
8552
  switch (block.kind) {
7382
8553
  case 'formInfo':
7383
8554
  {
7384
- mergeFieldsIntoLayer(layer, block.list);
7385
- walkBlocks(block.blocks, layer, depth + 1);
8555
+ mergeFieldsIntoLayer(layer, block.list, {
8556
+ ctx
8557
+ });
8558
+ walkBlocks(block.blocks, layer, depth + 1, ctx);
7386
8559
  return;
7387
8560
  }
7388
8561
  case 'object':
7389
8562
  {
7390
8563
  const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
7391
8564
  if (!name) {
7392
- mergeFieldsIntoLayer(layer, block.list);
7393
- walkBlocks(block.blocks, layer, depth + 1);
8565
+ mergeFieldsIntoLayer(layer, block.list, {
8566
+ ctx
8567
+ });
8568
+ walkBlocks(block.blocks, layer, depth + 1, ctx);
7394
8569
  return;
7395
8570
  }
7396
8571
  const nested = createObjectLayer();
7397
- mergeFieldsIntoLayer(nested, block.list);
7398
- walkBlocks(block.blocks, nested, depth + 1);
8572
+ mergeFieldsIntoLayer(nested, block.list, {
8573
+ ctx
8574
+ });
8575
+ walkBlocks(block.blocks, nested, depth + 1, ctx);
7399
8576
  layer.properties[name] = finalizeObjectSchema(nested, {
7400
8577
  title: block.title || undefined,
7401
8578
  description: block.subtitle || undefined
@@ -7458,14 +8635,16 @@ const walkBlock = (block, layer, depth = 0) => {
7458
8635
  case 'steps':
7459
8636
  {
7460
8637
  (block.items || []).forEach(step => {
7461
- mergeFieldsIntoLayer(layer, step?.list);
7462
- walkBlocks(step?.blocks, layer, depth + 1);
8638
+ mergeFieldsIntoLayer(layer, step?.list, {
8639
+ ctx
8640
+ });
8641
+ walkBlocks(step?.blocks, layer, depth + 1, ctx);
7463
8642
  });
7464
8643
  return;
7465
8644
  }
7466
8645
  case 'choice':
7467
8646
  {
7468
- mergeChoiceIntoLayer(layer, block, depth);
8647
+ mergeChoiceIntoLayer(layer, block, depth, ctx);
7469
8648
  return;
7470
8649
  }
7471
8650
  default:
@@ -7478,7 +8657,7 @@ const walkBlock = (block, layer, depth = 0) => {
7478
8657
  * 每支为 object:单选支含 selector const;多选支为该 option 字段,selector 数组放在当前层。
7479
8658
  * 支内 REQ 可进 required;hidden 字段仍进入 schema。
7480
8659
  */
7481
- const mergeChoiceIntoLayer = (layer, block, depth) => {
8660
+ const mergeChoiceIntoLayer = (layer, block, depth, ctx) => {
7482
8661
  const mode = block.mode === 'multiple' ? 'multiple' : 'single';
7483
8662
  const selectorInData = block.selectorInData !== false;
7484
8663
  const selectorName = resolveChoiceSelectorName$1(block);
@@ -7497,9 +8676,10 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
7497
8676
  branch.required.push(selectorName);
7498
8677
  }
7499
8678
  mergeFieldsIntoLayer(branch, option.list, {
7500
- allowRequired: true
8679
+ allowRequired: true,
8680
+ ctx
7501
8681
  });
7502
- walkBlocks(option.blocks, branch, depth + 1);
8682
+ walkBlocks(option.blocks, branch, depth + 1, ctx);
7503
8683
  return finalizeObjectSchema(branch, {
7504
8684
  title: optionTitle
7505
8685
  });
@@ -7581,7 +8761,7 @@ const mergeChoiceIntoLayer = (layer, block, depth) => {
7581
8761
  const schemaToDataSchema = (schema, options = {}) => {
7582
8762
  const normalized = normalizeSchema(localizeSchema(schema || {}, options.locale, options.languages));
7583
8763
  const layer = createObjectLayer();
7584
- walkBlocks(normalized.blocks, layer, 0);
8764
+ walkBlocks(normalized.blocks, layer, 0, createConditionContext(normalized, options.locale));
7585
8765
  const root = finalizeObjectSchema(layer, {
7586
8766
  title: normalized.title || undefined,
7587
8767
  description: options.description
@@ -7616,9 +8796,10 @@ const formatFieldValue = (field, value, formatMessage) => formatFieldDisplayValu
7616
8796
  * 改为 label 在上、值在下,避免窄栏(如弹窗双栏预览)被撑乱。
7617
8797
  */
7618
8798
  const renderFieldsContent = (fields, data, formatMessage, column, {
7619
- showIndex = false
8799
+ showIndex = false,
8800
+ isFieldVisible
7620
8801
  } = {}) => {
7621
- const list = (fields || []).filter(field => field && !field.hidden && field.name).map((field, index) => {
8802
+ const list = (fields || []).filter(field => field && !field.hidden && field.name && (!isFieldVisible || isFieldVisible(field))).map((field, index) => {
7622
8803
  const baseLabel = field.label || field.name;
7623
8804
  const label = showIndex ? `${index + 1}. ${baseLabel}` : baseLabel;
7624
8805
  return {
@@ -7653,7 +8834,8 @@ const renderBlock = (block, data, ctx) => {
7653
8834
  const {
7654
8835
  formatMessage,
7655
8836
  isMobile,
7656
- depth = 0
8837
+ depth = 0,
8838
+ isFieldVisible
7657
8839
  } = ctx;
7658
8840
  if (!block || depth > MAX_BLOCK_DEPTH) {
7659
8841
  return null;
@@ -7676,7 +8858,8 @@ const renderBlock = (block, data, ctx) => {
7676
8858
  return /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
7677
8859
  ...partProps,
7678
8860
  children: [renderFieldsContent(block.list, data, formatMessage, block.column, {
7679
- showIndex: !!block.showIndex
8861
+ showIndex: !!block.showIndex,
8862
+ isFieldVisible
7680
8863
  }), renderBlockList(block.blocks, data, nextCtx)]
7681
8864
  });
7682
8865
  }
@@ -7686,7 +8869,9 @@ const renderBlock = (block, data, ctx) => {
7686
8869
  const nestedData = name ? getByPath(data, name) || {} : data;
7687
8870
  return /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
7688
8871
  ...partProps,
7689
- children: [renderFieldsContent(block.list, nestedData, formatMessage, block.column), renderBlockList(block.blocks, nestedData, nextCtx)]
8872
+ children: [renderFieldsContent(block.list, nestedData, formatMessage, block.column, {
8873
+ isFieldVisible
8874
+ }), renderBlockList(block.blocks, nestedData, nextCtx)]
7690
8875
  });
7691
8876
  }
7692
8877
  case 'list':
@@ -7747,7 +8932,9 @@ const renderBlock = (block, data, ctx) => {
7747
8932
  children: (block.items || []).map(step => /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
7748
8933
  title: step.title || undefined,
7749
8934
  bordered: bordered,
7750
- children: [renderFieldsContent(step.list, data, formatMessage, step.column || 2), renderBlockList(step.blocks, data, nextCtx)]
8935
+ children: [renderFieldsContent(step.list, data, formatMessage, step.column || 2, {
8936
+ isFieldVisible
8937
+ }), renderBlockList(step.blocks, data, nextCtx)]
7751
8938
  }, step.id))
7752
8939
  }, block.id);
7753
8940
  }
@@ -7763,7 +8950,9 @@ const renderBlock = (block, data, ctx) => {
7763
8950
  children: visibleOptions.map(option => /*#__PURE__*/jsxRuntime.jsxs(InfoPage__default["default"].Part, {
7764
8951
  title: option.title || undefined,
7765
8952
  bordered: false,
7766
- children: [renderFieldsContent(option.list, data, formatMessage, block.column), renderBlockList(option.blocks, data, nextCtx)]
8953
+ children: [renderFieldsContent(option.list, data, formatMessage, block.column, {
8954
+ isFieldVisible
8955
+ }), renderBlockList(option.blocks, data, nextCtx)]
7767
8956
  }, option.id))
7768
8957
  });
7769
8958
  }
@@ -7783,10 +8972,15 @@ const SchemaContentInnerView = ({
7783
8972
  } = reactIntl.useIntl();
7784
8973
  const isMobile = responsiveUtils.useIsMobile();
7785
8974
  const normalized = normalizeSchema(localizeSchema(schema, locale, languages));
7786
- const children = renderBlockList(normalized.blocks, data || {}, {
8975
+ const rootData = data || {};
8976
+ const knownNames = collectTriggerNames(normalized);
8977
+ // 条件按提交数据根路径判断(object 内字段同样用完整路径)
8978
+ const isFieldVisible = field => evaluateVisibleWhen(field.visibleWhen, rootData, knownNames);
8979
+ const children = renderBlockList(normalized.blocks, rootData, {
7787
8980
  formatMessage,
7788
8981
  isMobile,
7789
- depth: 0
8982
+ depth: 0,
8983
+ isFieldVisible
7790
8984
  });
7791
8985
  if (!children.length) {
7792
8986
  return null;
@@ -7833,6 +9027,7 @@ const SchemaContent = withLocale$1(({
7833
9027
  });
7834
9028
  var SchemaContent$1 = SchemaContent;
7835
9029
 
9030
+ exports.CONDITION_OPERATORS = CONDITION_OPERATORS;
7836
9031
  exports.FormCreator = FormCreator$1;
7837
9032
  exports.LocaleInput = LocaleInput;
7838
9033
  exports.LocaleTextArea = LocaleTextArea;
@@ -7846,9 +9041,11 @@ exports.SchemaContentInner = SchemaContentInner;
7846
9041
  exports.SchemaRenderer = SchemaRenderer$1;
7847
9042
  exports.SchemaRendererInner = SchemaRendererInner;
7848
9043
  exports.applyFromPropsSchema = applyFromPropsSchema;
9044
+ exports.blockHasLockedField = blockHasLockedField;
7849
9045
  exports.blockToFormValues = blockToFormValues;
7850
9046
  exports.buildRuleString = buildRuleString;
7851
9047
  exports.collectBlockFieldNames = collectBlockFieldNames;
9048
+ exports.collectConditionFields = collectConditionFields;
7852
9049
  exports.collectSchemaFields = collectSchemaFields;
7853
9050
  exports.createBlock = createBlock;
7854
9051
  exports.createChoiceOption = createChoiceOption;
@@ -7858,9 +9055,12 @@ exports.createStep = createStep;
7858
9055
  exports["default"] = FormCreator$1;
7859
9056
  exports.defaultFormActions = defaultFormActions;
7860
9057
  exports.defaultSchema = defaultSchema;
9058
+ exports.evaluateCondition = evaluateCondition;
9059
+ exports.evaluateVisibleWhen = evaluateVisibleWhen;
7861
9060
  exports.fieldToFormValues = fieldToFormValues;
7862
9061
  exports.findBlock = findBlock;
7863
9062
  exports.findBlockInTree = findBlockInTree;
9063
+ exports.findConditionCycle = findConditionCycle;
7864
9064
  exports.formValuesToBlock = formValuesToBlock;
7865
9065
  exports.formValuesToField = formValuesToField;
7866
9066
  exports.formatByValueSchema = formatByValueSchema;
@@ -7873,6 +9073,8 @@ exports.getFieldTypes = getFieldTypes;
7873
9073
  exports.getRulePresetItems = getRulePresetItems;
7874
9074
  exports.hasLocaleText = hasLocaleText;
7875
9075
  exports.hasRenderableContent = hasRenderableContent;
9076
+ exports.hasVisibleWhen = hasVisibleWhen;
9077
+ exports.isFieldLocked = isFieldLocked;
7876
9078
  exports.isFieldNameUnique = isFieldNameUnique;
7877
9079
  exports.isLocaleText = isLocaleText;
7878
9080
  exports.localizeSchema = localizeSchema;
@@ -7889,6 +9091,7 @@ exports.pickFromPropsSchema = pickFromPropsSchema;
7889
9091
  exports.preset = preset;
7890
9092
  exports.registerField = registerField;
7891
9093
  exports.removeBlockInTree = removeBlockInTree;
9094
+ exports.renameConditionReferences = renameConditionReferences;
7892
9095
  exports.resolveFieldTypeLabel = resolveFieldTypeLabel;
7893
9096
  exports.resolveFieldValueSchema = resolveFieldValueSchema;
7894
9097
  exports.resolveLocaleText = resolveLocaleText;