@kne/form-creator 0.1.27 → 0.1.29

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.
@@ -2,22 +2,23 @@ import '@kne/form-info/dist/index.css';
2
2
  import '@kne/info-page/dist/index.css';
3
3
  import '@kne/button-group/dist/index.css';
4
4
  import { createContext, useContext, useRef, useCallback, useEffect, useState, useMemo, createElement, Fragment as Fragment$1 } from 'react';
5
- import { Input as Input$1, Space, Tag, Tooltip, Button, Typography, Flex, Dropdown, Empty, message, Checkbox as Checkbox$1, InputNumber as InputNumber$1, Card, Switch as Switch$1, Radio, Select as Select$1 } from 'antd';
5
+ import { Button, Input as Input$1, Space, Tag, Tooltip, Typography, Flex, Dropdown, Empty, message, Checkbox as Checkbox$1, InputNumber as InputNumber$1, Card, Switch as Switch$1, Radio, Select as Select$1 } from 'antd';
6
6
  import { createWithIntlProvider, useIntl } from '@kne/react-intl';
7
7
  import { useIsMobile, RESPONSIVE_BOUNDARY_CLASS } from '@kne/responsive-utils';
8
- import { FormOutlined, FontSizeOutlined, AlignLeftOutlined, NumberOutlined, DownSquareOutlined, CheckCircleOutlined, CheckSquareOutlined, AppstoreOutlined, ApartmentOutlined, ShopOutlined, EnvironmentOutlined, SwapOutlined, CalendarOutlined, LockOutlined, EyeInvisibleOutlined, BranchesOutlined, WarningOutlined, ColumnWidthOutlined, ArrowUpOutlined, ArrowDownOutlined, EditOutlined, DeleteOutlined, PlusOutlined, SettingOutlined, UnorderedListOutlined, TableOutlined, ProfileOutlined, ClusterOutlined, PartitionOutlined, BorderOuterOutlined, OrderedListOutlined, SelectOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined } from '@ant-design/icons';
8
+ import { FormOutlined, FontSizeOutlined, AlignLeftOutlined, NumberOutlined, DownSquareOutlined, CheckCircleOutlined, CheckSquareOutlined, AppstoreOutlined, ApartmentOutlined, ShopOutlined, EnvironmentOutlined, SwapOutlined, CalendarOutlined, HolderOutlined, LockOutlined, EyeInvisibleOutlined, BranchesOutlined, WarningOutlined, ColumnWidthOutlined, ArrowUpOutlined, ArrowDownOutlined, EditOutlined, DeleteOutlined, PlusOutlined, SettingOutlined, RightOutlined, UnorderedListOutlined, TableOutlined, ProfileOutlined, ClusterOutlined, PartitionOutlined, BorderOuterOutlined, OrderedListOutlined, SelectOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined } from '@ant-design/icons';
9
9
  import { hooks, Input, TextArea, InputNumber, Select, RadioGroup, CheckboxGroup, RadioGroupOther, CheckboxGroupOther, Switch, Checkbox, DatePicker, useFormContext, Slider, RULES, SubmitButton, ResetButton, CancelButton, preset as preset$1 } from '@kne/react-form-antd';
10
10
  import SelectList, { SelectTableList, SelectTree, SelectCascader } from '@kne/super-select';
11
11
  import { SelectFunction, SelectIndustry, SelectAddress } from '@kne/super-select-plus';
12
12
  import '@kne/super-select/dist/index.css';
13
13
  import '@kne/super-select-plus/dist/index.css';
14
+ import ButtonGroup, { ButtonFooter } from '@kne/button-group';
14
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
15
- import FormInfo, { FormModal, Form, Steps, MatrixScale, MultiField, EditableList, TableList, List } from '@kne/form-info';
16
- import { ButtonFooter } from '@kne/button-group';
16
+ import { ReactSortable } from 'react-sortablejs';
17
+ import FormInfo, { FormModal, Steps, validateFieldsByName, Form, MatrixScale, MultiField, EditableList, TableList, List } from '@kne/form-info';
17
18
  import InfoPage from '@kne/info-page';
18
19
  import { createWithRemoteLoader } from '@kne/remote-loader';
19
20
 
20
- 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-matrixScale":"kne-form-creator_CFlQv","matrix-scale-editor-title":"kne-form-creator_Zo1Rz","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","options-header":"kne-form-creator_As4L6","options-locale-text":"kne-form-creator_7-99l","options-header-label":"kne-form-creator_UhnVH","options-header-value":"kne-form-creator_2c35V","options-header-description":"kne-form-creator_ibWvX","icon-square-btn-sm":"kne-form-creator_GAh-t","options-header-action":"kne-form-creator_nTN1E","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","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","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz"};
21
+ 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-matrixScale":"kne-form-creator_CFlQv","matrix-scale-editor-title":"kne-form-creator_Zo1Rz","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-meta":"kne-form-creator_PQiYV","block-title":"kne-form-creator_wSVJf","block-collapse-btn":"kne-form-creator_Ufp-W","is-expanded":"kne-form-creator_OjfBl","drag-handle":"kne-form-creator_7GuXk","more-btn":"kne-form-creator_paWIZ","drag-handle-action":"kne-form-creator_lhTrX","sortable-ghost":"kne-form-creator_7ZIH8","sortable-drag":"kne-form-creator_dxhFH","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","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-index":"kne-form-creator_CCKZZ","step-section-text":"kne-form-creator_hRFew","step-section-count":"kne-form-creator_G6Quc","step-section-actions":"kne-form-creator_es-FC","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","has-handle":"kne-form-creator_vbTgK","field-row-index-num":"kne-form-creator_e4yEp","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","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","property-modal":"kne-form-creator_wRSZC","editor-intro":"kne-form-creator_uOGOq","field-editor-form":"kne-form-creator_PGPHL","editor-toggles":"kne-form-creator_Dfyhx","options-editor":"kne-form-creator_AK4yO","columns-editor":"kne-form-creator_DQW1N","table-rows-editor":"kne-form-creator_-meJG","is-plain":"kne-form-creator_IiViE","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-align-group":"kne-form-creator_51ZsV","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","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","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-header":"kne-form-creator_As4L6","options-locale-text":"kne-form-creator_7-99l","options-header-label":"kne-form-creator_UhnVH","options-header-value":"kne-form-creator_2c35V","options-header-description":"kne-form-creator_ibWvX","icon-square-btn-sm":"kne-form-creator_GAh-t","options-header-action":"kne-form-creator_nTN1E","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","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","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz","add-inline-btn-icon":"kne-form-creator_jbBze","steps-focus":"kne-form-creator_BzrAJ","steps-focus-header":"kne-form-creator_fF02T","steps-focus-meta":"kne-form-creator_4Q3Nt","steps-focus-count":"kne-form-creator_-vGec","steps-focus-count-current":"kne-form-creator_vXk2o","steps-focus-count-total":"kne-form-creator_bpGjx","steps-focus-next":"kne-form-creator_a2ZfJ","steps-focus-title":"kne-form-creator_Q5bvO","steps-focus-track":"kne-form-creator_Cdvj5","steps-focus-segment":"kne-form-creator_4z3t0","is-done":"kne-form-creator_nBNzi","is-current":"kne-form-creator_a8lqo","steps-focus-actions":"kne-form-creator_NgZBR","steps-focus-actions-side":"kne-form-creator_ynPls","is-end":"kne-form-creator_syD91","steps-focus-prev":"kne-form-creator_5NtBV","steps-focus-next-btn":"kne-form-creator_1mMAJ","steps-focus-next-btn-icon":"kne-form-creator_OQvek","steps-focus-done-hint":"kne-form-creator_b0T7j"};
21
22
 
22
23
  function _extends() {
23
24
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -44,6 +45,8 @@ const locale$1 = {
44
45
  deleteField: '删除填写项',
45
46
  moveUp: '上移',
46
47
  moveDown: '下移',
48
+ dragSort: '拖动排序',
49
+ moreActions: '更多操作',
47
50
  fieldListTitle: '填写项配置',
48
51
  fieldListSubtitle: '通过列表管理填写项,右侧实时预览表单效果',
49
52
  blockListTitle: '表单结构',
@@ -124,6 +127,14 @@ const locale$1 = {
124
127
  blockAddPosition_top: '标题右侧(插入到第一项)',
125
128
  blockAddPosition_both: '两处都显示',
126
129
  blockAutoStep: '填写完成后自动进入下一步',
130
+ stepsStyle: '步骤展示样式',
131
+ stepsStyle_default: '完整步骤条',
132
+ stepsStyle_focus: '聚焦当前步骤',
133
+ stepsFocusNext: '下一步:{title}',
134
+ stepsFocusLast: '最后一步',
135
+ stepsFocusPrev: '上一步',
136
+ stepsFocusNextBtn: '下一步',
137
+ stepsFocusSubmitHint: '已是最后一步,确认无误后提交',
127
138
  multiFieldType: '填写项类型',
128
139
  multiFieldSummary: '填写类型:{type}',
129
140
  multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
@@ -238,6 +249,25 @@ const locale$1 = {
238
249
  formActionsGapHint: '默认 16',
239
250
  formActionsLayoutSection: '布局',
240
251
  fieldBasicSection: '基本设置',
252
+ fieldBasicSectionDesc: '填写项类型、提交用的名称和展示给填写人的文案',
253
+ fieldOptionsDesc: '填写人可选择的选项,以及提交时对应的值',
254
+ fieldPropsSectionDesc: '输入控件的提示语、交互方式与格式',
255
+ fieldDisplaySection: '显示与布局',
256
+ fieldDisplaySectionDesc: '该项在表单中的占位与可见性',
257
+ blockBasicSection: '基本信息',
258
+ blockBasicSectionDesc: '模块标题与提交时使用的数据名称',
259
+ blockLayoutSection: '展示与布局',
260
+ blockLayoutSectionDesc: '模块的列数、间距与外观',
261
+ blockListRuleSection: '增减规则',
262
+ blockListRuleSectionDesc: '添加按钮文案与条目数量限制',
263
+ choiceRuleSection: '选择规则',
264
+ choiceRuleSectionDesc: '单选或多选,以及可选数量',
265
+ choiceDataSection: '数据存储',
266
+ choiceDataSectionDesc: '是否把选中的选项写入提交数据',
267
+ matrixScaleRuleDesc: '控制每一行是否必须作答',
268
+ formActionsButtonsSection: '按钮',
269
+ formActionsButtonsSectionDesc: '选择表单底部显示哪些按钮,并设置按钮文案',
270
+ formActionsLayoutSectionDesc: '按钮的对齐方式与间距',
241
271
  optionLabelColumn: '选项名称',
242
272
  optionValueColumn: '选项值',
243
273
  optionDescColumn: '选项描述',
@@ -377,6 +407,8 @@ const locale = {
377
407
  deleteField: 'Delete',
378
408
  moveUp: 'Move Up',
379
409
  moveDown: 'Move Down',
410
+ dragSort: 'Drag to reorder',
411
+ moreActions: 'More actions',
380
412
  fieldListTitle: 'Field Configuration',
381
413
  fieldListSubtitle: 'Manage fields and preview the form on the right',
382
414
  blockListTitle: 'Form Structure',
@@ -457,6 +489,14 @@ const locale = {
457
489
  blockAddPosition_top: 'Title right (insert as first)',
458
490
  blockAddPosition_both: 'Both',
459
491
  blockAutoStep: 'Auto proceed to next step after completion',
492
+ stepsStyle: 'Steps display',
493
+ stepsStyle_default: 'Full steps bar',
494
+ stepsStyle_focus: 'Focus current step',
495
+ stepsFocusNext: 'Next: {title}',
496
+ stepsFocusLast: 'Final step',
497
+ stepsFocusPrev: 'Back',
498
+ stepsFocusNextBtn: 'Next',
499
+ stepsFocusSubmitHint: 'Final step — review and submit',
460
500
  multiFieldType: 'Field Type',
461
501
  multiFieldSummary: 'Field type: {type}',
462
502
  multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
@@ -571,6 +611,25 @@ const locale = {
571
611
  formActionsGapHint: 'Default: 16',
572
612
  formActionsLayoutSection: 'Layout',
573
613
  fieldBasicSection: 'Basic Settings',
614
+ fieldBasicSectionDesc: 'Field type, submit key and the text shown to respondents',
615
+ fieldOptionsDesc: 'Options respondents can pick and the value submitted for each',
616
+ fieldPropsSectionDesc: 'Placeholder, interaction and format of the input',
617
+ fieldDisplaySection: 'Display & layout',
618
+ fieldDisplaySectionDesc: 'How much space this field takes and whether it is visible',
619
+ blockBasicSection: 'Basics',
620
+ blockBasicSectionDesc: 'Module title and the data key used on submit',
621
+ blockLayoutSection: 'Display & layout',
622
+ blockLayoutSectionDesc: 'Columns, spacing and appearance of the module',
623
+ blockListRuleSection: 'Item rules',
624
+ blockListRuleSectionDesc: 'Add button text and item count limits',
625
+ choiceRuleSection: 'Selection rules',
626
+ choiceRuleSectionDesc: 'Single or multiple choice, and how many can be selected',
627
+ choiceDataSection: 'Data',
628
+ choiceDataSectionDesc: 'Whether the selected options are included in submitted data',
629
+ matrixScaleRuleDesc: 'Whether every row must be answered',
630
+ formActionsButtonsSection: 'Buttons',
631
+ formActionsButtonsSectionDesc: 'Choose which buttons appear at the bottom of the form and set their text',
632
+ formActionsLayoutSectionDesc: 'Alignment and spacing of the buttons',
574
633
  optionLabelColumn: 'Option Label',
575
634
  optionValueColumn: 'Option Value',
576
635
  optionDescColumn: 'Option Description',
@@ -1103,12 +1162,16 @@ const normalizeBlock = (block, depth = 0) => {
1103
1162
  normalized.fieldType = block.fieldType || 'RadioGroup';
1104
1163
  normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
1105
1164
  normalized.rule = block.rule != null ? block.rule : '';
1165
+ // 保留编辑器侧的 _key:MatrixScaleEditor 用它做行 key;normalize 若剥掉会触发 ensureKeys→onChange 死循环(React #185)
1166
+ const keepKey = item => item != null && item._key ? {
1167
+ _key: item._key
1168
+ } : {};
1106
1169
  normalized.rows = Array.isArray(block.rows) ? block.rows.map(row => {
1107
1170
  var _row$label;
1108
- return {
1171
+ return _extends({}, keepKey(row), {
1109
1172
  label: (_row$label = row == null ? void 0 : row.label) != null ? _row$label : '',
1110
1173
  name: String((row == null ? void 0 : row.name) || '').trim() || createDataKey('row')
1111
- };
1174
+ });
1112
1175
  }).filter(row => String(row.label || '').trim() || String(row.name || '').trim()) : [];
1113
1176
  if (!normalized.rows.length) {
1114
1177
  normalized.rows = [{
@@ -1117,15 +1180,21 @@ const normalizeBlock = (block, depth = 0) => {
1117
1180
  }];
1118
1181
  }
1119
1182
  if (layout === 'options') {
1120
- normalized.options = Array.isArray(block.options) ? block.options : [];
1183
+ normalized.options = Array.isArray(block.options) ? block.options.map(option => {
1184
+ var _option$label, _option$value;
1185
+ return _extends({}, option, keepKey(option), {
1186
+ label: (_option$label = option == null ? void 0 : option.label) != null ? _option$label : '',
1187
+ value: (_option$value = option == null ? void 0 : option.value) != null ? _option$value : ''
1188
+ });
1189
+ }) : [];
1121
1190
  normalized.columns = undefined;
1122
1191
  } else if (layout === 'columns') {
1123
1192
  normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => {
1124
1193
  var _ref, _column$label;
1125
- return {
1194
+ return _extends({}, keepKey(column), {
1126
1195
  label: (_ref = (_column$label = column == null ? void 0 : column.label) != null ? _column$label : column == null ? void 0 : column.title) != null ? _ref : '',
1127
1196
  name: String((column == null ? void 0 : column.name) || '').trim() || createDataKey('col')
1128
- };
1197
+ });
1129
1198
  }).filter(column => String(column.label || '').trim() || String(column.name || '').trim()) : [];
1130
1199
  if (!normalized.columns.length) {
1131
1200
  normalized.columns = [{
@@ -1227,16 +1296,23 @@ const blockHasLockedField = block => {
1227
1296
  };
1228
1297
 
1229
1298
  // 锁定项(locked 字段 / 含锁定字段的模块)位置固定:自身不能移动,其他项也不能与其交换位置
1299
+ /** 从 index 移到 targetIndex 时,区间内(含两端)任一固定项都会被挪位,因此不允许 */
1300
+ const canMoveItemTo = (list, index, targetIndex, isFixed = isFieldLocked) => {
1301
+ if (index < 0 || targetIndex < 0 || targetIndex >= list.length || index === targetIndex) {
1302
+ return false;
1303
+ }
1304
+ const [start, end] = index < targetIndex ? [index, targetIndex] : [targetIndex, index];
1305
+ return !list.slice(start, end + 1).some(item => isFixed(item));
1306
+ };
1307
+
1308
+ /** direction:'up' | 'down' 移动一位;数字为目标下标(拖拽排序) */
1230
1309
  const moveItem = (list, id, direction, isFixed = isFieldLocked) => {
1231
1310
  const index = list.findIndex(item => item.id === id);
1232
1311
  if (index < 0) {
1233
1312
  return list;
1234
1313
  }
1235
- const targetIndex = direction === 'up' ? index - 1 : index + 1;
1236
- if (targetIndex < 0 || targetIndex >= list.length) {
1237
- return list;
1238
- }
1239
- if (isFixed(list[index]) || isFixed(list[targetIndex])) {
1314
+ const targetIndex = typeof direction === 'number' ? direction : direction === 'up' ? index - 1 : index + 1;
1315
+ if (!canMoveItemTo(list, index, targetIndex, isFixed)) {
1240
1316
  return list;
1241
1317
  }
1242
1318
  const next = [...list];
@@ -1650,6 +1726,9 @@ const ADD_POSITIONS = ['bottom', 'top', 'both'];
1650
1726
 
1651
1727
  /** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
1652
1728
  const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
1729
+
1730
+ /** steps 导航样式:default 为 antd 完整步骤条;focus 突出当前步骤标题,其余收成序号 */
1731
+ const STEPS_STYLES = ['default', 'focus'];
1653
1732
  const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
1654
1733
  label: typeof formatMessage === 'function' ? formatMessage({
1655
1734
  id: config.labelId
@@ -1679,6 +1758,7 @@ const blockToFormValues = block => {
1679
1758
  rowTitle: block.rowTitle || '',
1680
1759
  required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
1681
1760
  autoStep: block.autoStep !== false,
1761
+ stepsStyle: STEPS_STYLES.includes(block.stepsStyle) ? block.stepsStyle : 'default',
1682
1762
  mode: block.mode === 'multiple' ? 'multiple' : 'single',
1683
1763
  selectorName: block.selectorName || '',
1684
1764
  selectorInData: block.selectorInData !== false
@@ -1705,6 +1785,7 @@ const formValuesToBlock = (values, existingBlock = {}) => {
1705
1785
  addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
1706
1786
  fieldType: values.fieldType || (kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
1707
1787
  autoStep: values.autoStep !== false,
1788
+ stepsStyle: kind === 'steps' && STEPS_STYLES.includes(values.stepsStyle) && values.stepsStyle !== 'default' ? values.stepsStyle : undefined,
1708
1789
  mode,
1709
1790
  selectorName: values.selectorName || '',
1710
1791
  selectorInData: values.selectorInData !== false
@@ -1768,7 +1849,7 @@ const formValuesToChoiceOption = (values, existingOption = {}) => _extends({}, e
1768
1849
  title: values.title
1769
1850
  });
1770
1851
 
1771
- const _excluded$5 = ["children"];
1852
+ const _excluded$6 = ["children"];
1772
1853
  const mapOptionItem = item => {
1773
1854
  if (!item || typeof item !== 'object') {
1774
1855
  return item;
@@ -1776,7 +1857,7 @@ const mapOptionItem = item => {
1776
1857
  const {
1777
1858
  children
1778
1859
  } = item,
1779
- rest = _objectWithoutPropertiesLoose(item, _excluded$5);
1860
+ rest = _objectWithoutPropertiesLoose(item, _excluded$6);
1780
1861
  const next = _extends({}, rest);
1781
1862
  if (Array.isArray(children) && children.length) {
1782
1863
  next.children = children.map(mapOptionItem);
@@ -1864,7 +1945,7 @@ const createApiFromOptions = (options = []) => ({
1864
1945
  })
1865
1946
  });
1866
1947
 
1867
- const _excluded$4 = ["options", "api", "placeholder"];
1948
+ const _excluded$5 = ["options", "api", "placeholder"];
1868
1949
  const {
1869
1950
  useOnChange: useOnChange$2
1870
1951
  } = hooks;
@@ -1883,7 +1964,7 @@ const createField = (Component, {
1883
1964
  api,
1884
1965
  placeholder
1885
1966
  } = props,
1886
- rest = _objectWithoutPropertiesLoose(props, _excluded$4);
1967
+ rest = _objectWithoutPropertiesLoose(props, _excluded$5);
1887
1968
  const valueKey = rest.valueKey || 'value';
1888
1969
  const labelKey = rest.labelKey || 'label';
1889
1970
  const parentKey = rest.parentKey || 'parentId';
@@ -3437,6 +3518,78 @@ const formValuesToField = (values, existingField = {}) => {
3437
3518
  });
3438
3519
  };
3439
3520
 
3521
+ const orderActions = (isMobile, actions) => {
3522
+ if (!isMobile) {
3523
+ return actions;
3524
+ }
3525
+ const primary = actions.filter(item => item && (item.key === 'edit' || item.key === 'setting'));
3526
+ return [...primary, ...actions.filter(item => !primary.includes(item))];
3527
+ };
3528
+
3529
+ /**
3530
+ * 行操作:桌面端为悬停显示的图标组;移动端全部收进 ButtonGroup 的「⋯」,点击弹出底部动作面板。
3531
+ * actions: [{ key, label, icon, danger, disabled, onClick }],falsy 项忽略
3532
+ */
3533
+ const RowActions = ({
3534
+ isMobile,
3535
+ actions,
3536
+ moreTitle,
3537
+ prefix
3538
+ }) => {
3539
+ const items = (actions || []).filter(Boolean);
3540
+ if (isMobile) {
3541
+ if (!items.length) {
3542
+ return null;
3543
+ }
3544
+ // 动作面板经 portal 渲染,React 事件仍会冒泡到行上的「点击编辑」,需在外层拦截
3545
+ return /*#__PURE__*/jsx("span", {
3546
+ className: style['more-btn'],
3547
+ title: moreTitle,
3548
+ onClick: e => e.stopPropagation(),
3549
+ children: /*#__PURE__*/jsx(ButtonGroup, {
3550
+ showLength: 0,
3551
+ moreType: "link",
3552
+ list: items.map(({
3553
+ key,
3554
+ label,
3555
+ icon,
3556
+ danger,
3557
+ disabled,
3558
+ onClick
3559
+ }) => ({
3560
+ key,
3561
+ children: label,
3562
+ icon,
3563
+ danger,
3564
+ disabled,
3565
+ onClick
3566
+ }))
3567
+ })
3568
+ });
3569
+ }
3570
+ return /*#__PURE__*/jsxs("div", {
3571
+ className: style['action-group'],
3572
+ children: [prefix, items.map(({
3573
+ key,
3574
+ label,
3575
+ icon,
3576
+ danger,
3577
+ disabled,
3578
+ onClick
3579
+ }) => /*#__PURE__*/jsx(Button, {
3580
+ type: "text",
3581
+ size: "small",
3582
+ title: label,
3583
+ danger: danger,
3584
+ disabled: disabled,
3585
+ icon: icon,
3586
+ className: style['action-btn'],
3587
+ onClick: onClick
3588
+ }, key))]
3589
+ });
3590
+ };
3591
+ var RowActions$1 = RowActions;
3592
+
3440
3593
  const {
3441
3594
  useOnChange: useOnChange$1
3442
3595
  } = hooks;
@@ -3533,8 +3686,9 @@ const LocaleTextArea = props => {
3533
3686
  };
3534
3687
  LocaleTextArea.field = LocaleTextAreaControl;
3535
3688
 
3689
+ const _excluded$4 = ["field", "index", "total", "onEdit", "onDelete", "onMove", "prevLocked", "nextLocked", "conditionContext", "dragHandleProps", "isMobile", "className"];
3536
3690
  const {
3537
- Text: Text$6
3691
+ Text: Text$5
3538
3692
  } = Typography;
3539
3693
  const TYPE_TAG_COLORS = {
3540
3694
  Input: 'blue',
@@ -3577,17 +3731,22 @@ const TYPE_TAG_ICONS = {
3577
3731
  DatePicker: CalendarOutlined
3578
3732
  };
3579
3733
  const getFieldTypeIcon = type => TYPE_TAG_ICONS[type] || FormOutlined;
3580
- const FieldRow = ({
3581
- field,
3582
- index,
3583
- total,
3584
- onEdit,
3585
- onDelete,
3586
- onMove,
3587
- prevLocked,
3588
- nextLocked,
3589
- conditionContext
3590
- }) => {
3734
+ const FieldRow = _ref => {
3735
+ let {
3736
+ field,
3737
+ index,
3738
+ total,
3739
+ onEdit,
3740
+ onDelete,
3741
+ onMove,
3742
+ prevLocked,
3743
+ nextLocked,
3744
+ conditionContext,
3745
+ dragHandleProps,
3746
+ isMobile,
3747
+ className
3748
+ } = _ref,
3749
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
3591
3750
  const {
3592
3751
  formatMessage,
3593
3752
  locale
@@ -3597,15 +3756,34 @@ const FieldRow = ({
3597
3756
  const conditional = hasVisibleWhen(field);
3598
3757
  const conditionInvalid = conditional && conditionContext && hasInvalidCondition(field, conditionContext.triggerNames);
3599
3758
  const TypeIcon = getFieldTypeIcon(field.type);
3600
- return /*#__PURE__*/jsxs("div", {
3601
- className: style['field-row'],
3602
- children: [/*#__PURE__*/jsx("span", {
3603
- className: style['field-row-index'],
3604
- children: index + 1
3605
- }), /*#__PURE__*/jsxs("div", {
3606
- className: style['field-row-main'],
3607
- children: [/*#__PURE__*/jsx(Text$6, {
3608
- strong: true,
3759
+ return /*#__PURE__*/jsxs("div", _extends({}, rest, {
3760
+ className: `${style['field-row']} ${className || ''}`.trim(),
3761
+ children: [/*#__PURE__*/jsxs("span", {
3762
+ className: `${style['field-row-index']} ${dragHandleProps ? style['has-handle'] : ''}`.trim(),
3763
+ children: [/*#__PURE__*/jsx("span", {
3764
+ className: style['field-row-index-num'],
3765
+ children: index + 1
3766
+ }), dragHandleProps ? /*#__PURE__*/jsx("span", _extends({
3767
+ className: style['drag-handle'],
3768
+ title: formatMessage({
3769
+ id: 'dragSort'
3770
+ })
3771
+ }, dragHandleProps, {
3772
+ children: /*#__PURE__*/jsx(HolderOutlined, {})
3773
+ })) : null]
3774
+ }), /*#__PURE__*/jsxs("div", _extends({
3775
+ className: style['field-row-main']
3776
+ }, isMobile && !field.locked ? {
3777
+ role: 'button',
3778
+ tabIndex: 0,
3779
+ onClick: () => onEdit(field),
3780
+ onKeyDown: e => {
3781
+ if (e.key === 'Enter') {
3782
+ onEdit(field);
3783
+ }
3784
+ }
3785
+ } : null, {
3786
+ children: [/*#__PURE__*/jsx(Text$5, {
3609
3787
  className: style['field-row-label'],
3610
3788
  children: resolveLocaleText(field.label, locale, languages) || formatMessage({
3611
3789
  id: 'untitledField'
@@ -3668,54 +3846,49 @@ const FieldRow = ({
3668
3846
  })
3669
3847
  }) : null]
3670
3848
  })]
3671
- }), field.locked ? null : /*#__PURE__*/jsxs("div", {
3672
- className: style['action-group'],
3673
- children: [/*#__PURE__*/jsx(Button, {
3674
- type: "text",
3675
- size: "small",
3676
- className: style['action-btn'],
3677
- title: formatMessage({
3849
+ })), field.locked ? null : /*#__PURE__*/jsx(RowActions$1, {
3850
+ isMobile: isMobile,
3851
+ moreTitle: formatMessage({
3852
+ id: 'moreActions'
3853
+ }),
3854
+ actions: orderActions(isMobile, [{
3855
+ key: 'up',
3856
+ label: formatMessage({
3678
3857
  id: 'moveUp'
3679
3858
  }),
3680
3859
  icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
3681
3860
  disabled: index === 0 || prevLocked,
3682
3861
  onClick: () => onMove(field.id, 'up')
3683
- }), /*#__PURE__*/jsx(Button, {
3684
- type: "text",
3685
- size: "small",
3686
- className: style['action-btn'],
3687
- title: formatMessage({
3862
+ }, {
3863
+ key: 'down',
3864
+ label: formatMessage({
3688
3865
  id: 'moveDown'
3689
3866
  }),
3690
3867
  icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
3691
3868
  disabled: index === total - 1 || nextLocked,
3692
3869
  onClick: () => onMove(field.id, 'down')
3693
- }), /*#__PURE__*/jsx(Button, {
3694
- type: "text",
3695
- size: "small",
3696
- className: style['action-btn'],
3697
- title: formatMessage({
3870
+ }, {
3871
+ key: 'edit',
3872
+ label: formatMessage({
3698
3873
  id: 'editField'
3699
3874
  }),
3700
3875
  icon: /*#__PURE__*/jsx(EditOutlined, {}),
3701
3876
  onClick: () => onEdit(field)
3702
- }), /*#__PURE__*/jsx(Button, {
3703
- type: "text",
3704
- size: "small",
3705
- danger: true,
3706
- className: style['action-btn'],
3707
- title: formatMessage({
3877
+ }, {
3878
+ key: 'delete',
3879
+ label: formatMessage({
3708
3880
  id: 'deleteField'
3709
3881
  }),
3710
3882
  icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
3883
+ danger: true,
3711
3884
  onClick: () => onDelete(field.id)
3712
- })]
3885
+ }])
3713
3886
  })]
3714
- });
3887
+ }));
3715
3888
  };
3716
3889
 
3717
3890
  const {
3718
- Text: Text$5,
3891
+ Text: Text$4,
3719
3892
  Title
3720
3893
  } = Typography;
3721
3894
  const createRowKey = () => createDataKey('mrow');
@@ -3926,7 +4099,7 @@ const MatrixScaleEditor = ({
3926
4099
  })), []);
3927
4100
  return /*#__PURE__*/jsxs("div", {
3928
4101
  className: style['block-body'],
3929
- children: [/*#__PURE__*/jsx(Text$5, {
4102
+ children: [/*#__PURE__*/jsx(Text$4, {
3930
4103
  type: "secondary",
3931
4104
  className: style['inline-empty'],
3932
4105
  children: formatMessage({
@@ -3980,30 +4153,56 @@ const MatrixScaleEditor = ({
3980
4153
  };
3981
4154
  var MatrixScaleEditor$1 = MatrixScaleEditor;
3982
4155
 
3983
- const _excluded$3 = ["title", "danger"];
3984
- const {
3985
- Text: Text$4
3986
- } = Typography;
3987
- const ActionGroup = ({
3988
- children
3989
- }) => /*#__PURE__*/jsx("div", {
3990
- className: style['action-group'],
3991
- children: children
4156
+ const noop = () => {};
4157
+
4158
+ /** 拖柄属性:按 scope 区分,嵌套列表的拖柄不会被外层列表识别 */
4159
+ const getSortHandleProps = scope => ({
4160
+ 'data-sort-handle': scope
3992
4161
  });
3993
- const IconBtn = _ref => {
3994
- let {
3995
- title,
3996
- danger
3997
- } = _ref,
3998
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
3999
- return /*#__PURE__*/jsx(Button, _extends({
4000
- type: "text",
4001
- size: "small",
4002
- title: title,
4003
- danger: danger,
4004
- className: style['action-btn']
4005
- }, props));
4162
+
4163
+ /**
4164
+ * 同一列表内拖拽排序:顺序以 schema 为准,setList 不接管;
4165
+ * onMove 拦截跨越固定项的位置,onEnd 通过 onMove(id, 目标下标) 写回。
4166
+ */
4167
+ const SortableList = ({
4168
+ scope,
4169
+ list,
4170
+ isFixed,
4171
+ onMove,
4172
+ className,
4173
+ children
4174
+ }) => {
4175
+ const getIndex = el => list.findIndex(item => {
4176
+ var _el$dataset;
4177
+ return String(item.id) === (el == null || (_el$dataset = el.dataset) == null ? void 0 : _el$dataset.id);
4178
+ });
4179
+ return /*#__PURE__*/jsx(ReactSortable, {
4180
+ tag: "div",
4181
+ className: className,
4182
+ list: list,
4183
+ setList: noop,
4184
+ handle: `[data-sort-handle="${scope}"]`,
4185
+ animation: 180,
4186
+ easing: "cubic-bezier(0.2, 0, 0, 1)",
4187
+ forceFallback: true,
4188
+ fallbackOnBody: true,
4189
+ ghostClass: style['sortable-ghost'],
4190
+ chosenClass: style['sortable-chosen'],
4191
+ dragClass: style['sortable-drag'],
4192
+ onMove: evt => canMoveItemTo(list, getIndex(evt.dragged), getIndex(evt.related), isFixed),
4193
+ onEnd: evt => {
4194
+ if (evt.oldIndex !== evt.newIndex && list[evt.oldIndex]) {
4195
+ onMove(list[evt.oldIndex].id, evt.newIndex);
4196
+ }
4197
+ },
4198
+ children: children
4199
+ });
4006
4200
  };
4201
+ var SortableList$1 = SortableList;
4202
+
4203
+ const {
4204
+ Text: Text$3
4205
+ } = Typography;
4007
4206
  const ROOT_ADD_OPTIONS = [{
4008
4207
  key: 'formInfo',
4009
4208
  icon: /*#__PURE__*/jsx(FormOutlined, {})
@@ -4039,6 +4238,9 @@ const BLOCK_KIND_ICONS = Object.fromEntries(ROOT_ADD_OPTIONS.map(({
4039
4238
 
4040
4239
  /** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
4041
4240
  const NESTED_ADD_OPTIONS = ROOT_ADD_OPTIONS.filter(opt => opt.key !== 'steps');
4241
+
4242
+ /** 模块列表的拖柄 scope 须稳定:ReactSortable 只在挂载时读取 handle,scope 随列表内容变化会导致拖柄失效 */
4243
+ const getBlockScope = parentKey => `blocks:${parentKey}`;
4042
4244
  const BlockListPanel = ({
4043
4245
  blocks,
4044
4246
  onAddBlock,
@@ -4065,11 +4267,26 @@ const BlockListPanel = ({
4065
4267
  formatMessage,
4066
4268
  locale
4067
4269
  } = useIntl();
4270
+ const isMobile = useIsMobile();
4068
4271
  const languages = useLocaleTextLanguages();
4069
4272
  const text = value => resolveLocaleText(value, locale, languages);
4070
4273
  const [addMenuOpen, setAddMenuOpen] = useState(false);
4071
4274
  const [addFieldMenuId, setAddFieldMenuId] = useState(null);
4072
4275
  const keepAddFieldMenuOpenRef = useRef(false);
4276
+ const [collapsedIds, setCollapsedIds] = useState(() => new Set());
4277
+ const toggleCollapsed = id => setCollapsedIds(prev => {
4278
+ const next = new Set(prev);
4279
+ next.has(id) ? next.delete(id) : next.add(id);
4280
+ return next;
4281
+ });
4282
+ const renderDragHandle = (scope, standalone) => /*#__PURE__*/jsx("span", _extends({
4283
+ className: standalone ? style['drag-handle'] : `${style['drag-handle']} ${style['drag-handle-action']}`,
4284
+ title: formatMessage({
4285
+ id: 'dragSort'
4286
+ })
4287
+ }, getSortHandleProps(scope), {
4288
+ children: /*#__PURE__*/jsx(HolderOutlined, {})
4289
+ }));
4073
4290
  const conditionContext = useMemo(() => {
4074
4291
  const triggerFields = collectConditionFields({
4075
4292
  blocks
@@ -4124,17 +4341,19 @@ const BlockListPanel = ({
4124
4341
  }) => {
4125
4342
  const canAddChild = typeof onAddChildBlock === 'function' && depth < MAX_BLOCK_DEPTH;
4126
4343
  const menuOpen = addFieldMenuId === menuKey;
4127
- const btnClass = `${style['add-inline-btn']} ${style['hover-reveal']} ${menuOpen ? style['hover-reveal-active'] : ''}`.trim();
4344
+ const btnClass = `${style['add-inline-btn']} ${style['hover-reveal']} ${menuOpen ? style['hover-reveal-active'] : ''} ${isMobile ? style['add-inline-btn-icon'] : ''}`.trim();
4345
+ const addFieldText = formatMessage({
4346
+ id: 'addField'
4347
+ });
4128
4348
  if (!canAddChild) {
4129
4349
  return /*#__PURE__*/jsx(Button, {
4130
4350
  type: "text",
4131
4351
  size: "small",
4132
4352
  icon: /*#__PURE__*/jsx(PlusOutlined, {}),
4133
4353
  className: btnClass,
4354
+ title: addFieldText,
4134
4355
  onClick: onAddFieldClick,
4135
- children: formatMessage({
4136
- id: 'addField'
4137
- })
4356
+ children: isMobile ? null : addFieldText
4138
4357
  });
4139
4358
  }
4140
4359
  return /*#__PURE__*/jsx(Dropdown, {
@@ -4228,10 +4447,9 @@ const BlockListPanel = ({
4228
4447
  keepAddFieldMenuOpenRef.current = true;
4229
4448
  }
4230
4449
  },
4450
+ title: addFieldText,
4231
4451
  onClick: () => setAddFieldMenuId(menuKey),
4232
- children: formatMessage({
4233
- id: 'addField'
4234
- })
4452
+ children: isMobile ? null : addFieldText
4235
4453
  })
4236
4454
  });
4237
4455
  };
@@ -4240,7 +4458,7 @@ const BlockListPanel = ({
4240
4458
  optionId
4241
4459
  } = {}) => {
4242
4460
  if (!(fields || []).length) {
4243
- return /*#__PURE__*/jsx(Text$4, {
4461
+ return /*#__PURE__*/jsx(Text$3, {
4244
4462
  type: "secondary",
4245
4463
  className: style['inline-empty'],
4246
4464
  children: formatMessage({
@@ -4248,9 +4466,20 @@ const BlockListPanel = ({
4248
4466
  })
4249
4467
  });
4250
4468
  }
4251
- return /*#__PURE__*/jsx("div", {
4469
+ const scope = `fields:${blockId}:${stepId || ''}:${optionId || ''}`;
4470
+ const canDrag = fields.length > 1;
4471
+ return /*#__PURE__*/jsx(SortableList$1, {
4252
4472
  className: style['field-list'],
4473
+ scope: scope,
4474
+ list: fields,
4475
+ isFixed: isFieldLocked,
4476
+ onMove: (fieldId, to) => onMoveField(blockId, fieldId, to, {
4477
+ stepId,
4478
+ optionId
4479
+ }),
4253
4480
  children: fields.map((field, fieldIndex) => /*#__PURE__*/jsx(FieldRow, {
4481
+ isMobile: isMobile,
4482
+ dragHandleProps: canDrag && !isFieldLocked(field) ? getSortHandleProps(scope) : null,
4254
4483
  field: field,
4255
4484
  index: fieldIndex,
4256
4485
  total: fields.length,
@@ -4272,26 +4501,30 @@ const BlockListPanel = ({
4272
4501
  }, field.id))
4273
4502
  });
4274
4503
  };
4275
- const renderNestedBlocks = (childBlocks, depth) => {
4504
+ const renderNestedBlocks = (childBlocks, depth, parentKey) => {
4276
4505
  if (!(childBlocks || []).length) {
4277
4506
  return null;
4278
4507
  }
4279
4508
  return /*#__PURE__*/jsx("div", {
4280
4509
  className: style['item-blocks-section'],
4281
- children: /*#__PURE__*/jsx("div", {
4510
+ children: /*#__PURE__*/jsx(SortableList$1, {
4282
4511
  className: style['nested-block-list'],
4283
- children: childBlocks.map((child, childIndex) => renderBlockSection(child, childIndex, childBlocks, depth + 1))
4512
+ scope: getBlockScope(parentKey),
4513
+ list: childBlocks,
4514
+ isFixed: blockHasLockedField,
4515
+ onMove: onMoveBlock,
4516
+ children: childBlocks.map((child, childIndex) => renderBlockSection(child, childIndex, childBlocks, depth + 1, parentKey))
4284
4517
  })
4285
4518
  });
4286
4519
  };
4287
- const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth);
4520
+ const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth, `item:${parentBlock.id}`);
4288
4521
  const renderBlockChildren = (block, depth) => {
4289
4522
  if (block.kind === 'steps') {
4290
4523
  return /*#__PURE__*/jsxs("div", {
4291
4524
  className: style['block-body'],
4292
4525
  children: [/*#__PURE__*/jsxs("div", {
4293
4526
  className: style['section-toolbar'],
4294
- children: [/*#__PURE__*/jsx(Text$4, {
4527
+ children: [/*#__PURE__*/jsx(Text$3, {
4295
4528
  type: "secondary",
4296
4529
  className: style['section-toolbar-label'],
4297
4530
  children: formatMessage({
@@ -4307,74 +4540,88 @@ const BlockListPanel = ({
4307
4540
  id: 'addStep'
4308
4541
  })
4309
4542
  })]
4310
- }), (block.items || []).length ? /*#__PURE__*/jsx("div", {
4543
+ }), (block.items || []).length ? /*#__PURE__*/jsx(SortableList$1, {
4311
4544
  className: style['step-list'],
4545
+ scope: `steps:${block.id}`,
4546
+ list: block.items,
4547
+ isFixed: blockHasLockedField,
4548
+ onMove: (stepId, to) => onMoveStep(block.id, stepId, to),
4312
4549
  children: (block.items || []).map((step, stepIndex) => {
4313
4550
  var _step$list, _step$list2, _block$items;
4314
4551
  return /*#__PURE__*/jsxs("div", {
4315
4552
  className: style['step-section'],
4316
4553
  children: [/*#__PURE__*/jsxs("div", {
4317
4554
  className: style['step-section-header'],
4318
- children: [/*#__PURE__*/jsxs(Space, {
4319
- size: 8,
4320
- wrap: true,
4555
+ children: [/*#__PURE__*/jsxs("div", {
4321
4556
  className: style['step-section-title'],
4322
- children: [/*#__PURE__*/jsx("span", {
4557
+ children: [isMobile && block.items.length > 1 && !blockHasLockedField(step) ? renderDragHandle(`steps:${block.id}`, true) : null, /*#__PURE__*/jsx("span", {
4323
4558
  className: style['step-index'],
4324
4559
  children: stepIndex + 1
4325
- }), /*#__PURE__*/jsx(Text$4, {
4326
- strong: true,
4327
- children: text(step.title) || formatMessage({
4328
- id: 'untitledStep'
4329
- }, {
4330
- index: stepIndex + 1
4331
- })
4332
- }), /*#__PURE__*/jsx(Text$4, {
4333
- type: "secondary",
4334
- children: (step.blocks || []).length ? formatMessage({
4335
- id: 'fieldAndItemBlockCount'
4336
- }, {
4337
- fields: ((_step$list = step.list) == null ? void 0 : _step$list.length) || 0,
4338
- nests: step.blocks.length
4339
- }) : formatMessage({
4340
- id: 'fieldCount'
4341
- }, {
4342
- count: ((_step$list2 = step.list) == null ? void 0 : _step$list2.length) || 0
4343
- })
4560
+ }), /*#__PURE__*/jsxs("div", {
4561
+ className: style['step-section-text'],
4562
+ children: [/*#__PURE__*/jsx(Text$3, {
4563
+ strong: true,
4564
+ children: text(step.title) || formatMessage({
4565
+ id: 'untitledStep'
4566
+ }, {
4567
+ index: stepIndex + 1
4568
+ })
4569
+ }), /*#__PURE__*/jsx(Text$3, {
4570
+ type: "secondary",
4571
+ className: style['step-section-count'],
4572
+ children: (step.blocks || []).length ? formatMessage({
4573
+ id: 'fieldAndItemBlockCount'
4574
+ }, {
4575
+ fields: ((_step$list = step.list) == null ? void 0 : _step$list.length) || 0,
4576
+ nests: step.blocks.length
4577
+ }) : formatMessage({
4578
+ id: 'fieldCount'
4579
+ }, {
4580
+ count: ((_step$list2 = step.list) == null ? void 0 : _step$list2.length) || 0
4581
+ })
4582
+ })]
4344
4583
  })]
4345
4584
  }), /*#__PURE__*/jsxs(Space, {
4346
4585
  size: 4,
4347
- wrap: true,
4348
4586
  className: style['step-section-actions'],
4349
- children: [/*#__PURE__*/jsxs(ActionGroup, {
4350
- children: [/*#__PURE__*/jsx(IconBtn, {
4351
- title: formatMessage({
4587
+ children: [/*#__PURE__*/jsx(RowActions$1, {
4588
+ isMobile: isMobile,
4589
+ moreTitle: formatMessage({
4590
+ id: 'moreActions'
4591
+ }),
4592
+ prefix: !isMobile && block.items.length > 1 && !blockHasLockedField(step) ? renderDragHandle(`steps:${block.id}`) : null,
4593
+ actions: orderActions(isMobile, [{
4594
+ key: 'up',
4595
+ label: formatMessage({
4352
4596
  id: 'moveUp'
4353
4597
  }),
4354
4598
  icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
4355
4599
  disabled: stepIndex === 0 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex - 1]),
4356
4600
  onClick: () => onMoveStep(block.id, step.id, 'up')
4357
- }), /*#__PURE__*/jsx(IconBtn, {
4358
- title: formatMessage({
4601
+ }, {
4602
+ key: 'down',
4603
+ label: formatMessage({
4359
4604
  id: 'moveDown'
4360
4605
  }),
4361
4606
  icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
4362
4607
  disabled: stepIndex === (((_block$items = block.items) == null ? void 0 : _block$items.length) || 0) - 1 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex + 1]),
4363
4608
  onClick: () => onMoveStep(block.id, step.id, 'down')
4364
- }), /*#__PURE__*/jsx(IconBtn, {
4365
- title: formatMessage({
4609
+ }, {
4610
+ key: 'edit',
4611
+ label: formatMessage({
4366
4612
  id: 'editStep'
4367
4613
  }),
4368
4614
  icon: /*#__PURE__*/jsx(EditOutlined, {}),
4369
4615
  onClick: () => onEditStep(block.id, step)
4370
- }), blockHasLockedField(step) ? null : /*#__PURE__*/jsx(IconBtn, {
4371
- title: formatMessage({
4616
+ }, blockHasLockedField(step) ? null : {
4617
+ key: 'delete',
4618
+ label: formatMessage({
4372
4619
  id: 'deleteStep'
4373
4620
  }),
4374
- danger: true,
4375
4621
  icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
4622
+ danger: true,
4376
4623
  onClick: () => onDeleteStep(block.id, step.id)
4377
- })]
4624
+ }])
4378
4625
  }), renderAddFieldButton({
4379
4626
  menuKey: `${block.id}:${step.id}`,
4380
4627
  depth,
@@ -4389,10 +4636,10 @@ const BlockListPanel = ({
4389
4636
  })]
4390
4637
  }), renderFieldList(step.list, block.id, {
4391
4638
  stepId: step.id
4392
- }), renderNestedBlocks(step.blocks, depth)]
4639
+ }), renderNestedBlocks(step.blocks, depth, `step:${step.id}`)]
4393
4640
  }, step.id);
4394
4641
  })
4395
- }) : /*#__PURE__*/jsx(Text$4, {
4642
+ }) : /*#__PURE__*/jsx(Text$3, {
4396
4643
  type: "secondary",
4397
4644
  className: style['inline-empty'],
4398
4645
  children: formatMessage({
@@ -4404,7 +4651,7 @@ const BlockListPanel = ({
4404
4651
  if (block.kind === 'multiField') {
4405
4652
  return /*#__PURE__*/jsx("div", {
4406
4653
  className: style['block-body'],
4407
- children: /*#__PURE__*/jsx(Text$4, {
4654
+ children: /*#__PURE__*/jsx(Text$3, {
4408
4655
  type: "secondary",
4409
4656
  children: formatMessage({
4410
4657
  id: 'multiFieldEditorHint'
@@ -4423,7 +4670,7 @@ const BlockListPanel = ({
4423
4670
  className: style['block-body'],
4424
4671
  children: [/*#__PURE__*/jsxs("div", {
4425
4672
  className: style['section-toolbar'],
4426
- children: [/*#__PURE__*/jsx(Text$4, {
4673
+ children: [/*#__PURE__*/jsx(Text$3, {
4427
4674
  type: "secondary",
4428
4675
  className: style['section-toolbar-label'],
4429
4676
  children: formatMessage({
@@ -4439,74 +4686,88 @@ const BlockListPanel = ({
4439
4686
  id: 'addChoiceOption'
4440
4687
  })
4441
4688
  })]
4442
- }), (block.options || []).length ? /*#__PURE__*/jsx("div", {
4689
+ }), (block.options || []).length ? /*#__PURE__*/jsx(SortableList$1, {
4443
4690
  className: style['step-list'],
4691
+ scope: `options:${block.id}`,
4692
+ list: block.options,
4693
+ isFixed: blockHasLockedField,
4694
+ onMove: (optionId, to) => onMoveChoiceOption(block.id, optionId, to),
4444
4695
  children: (block.options || []).map((option, optionIndex) => {
4445
4696
  var _option$list, _option$list2, _block$options;
4446
4697
  return /*#__PURE__*/jsxs("div", {
4447
4698
  className: style['step-section'],
4448
4699
  children: [/*#__PURE__*/jsxs("div", {
4449
4700
  className: style['step-section-header'],
4450
- children: [/*#__PURE__*/jsxs(Space, {
4451
- size: 8,
4452
- wrap: true,
4701
+ children: [/*#__PURE__*/jsxs("div", {
4453
4702
  className: style['step-section-title'],
4454
- children: [/*#__PURE__*/jsx("span", {
4703
+ children: [isMobile && block.options.length > 1 && !blockHasLockedField(option) ? renderDragHandle(`options:${block.id}`, true) : null, /*#__PURE__*/jsx("span", {
4455
4704
  className: style['step-index'],
4456
4705
  children: optionIndex + 1
4457
- }), /*#__PURE__*/jsx(Text$4, {
4458
- strong: true,
4459
- children: text(option.title) || formatMessage({
4460
- id: 'choiceOptionFallback'
4461
- }, {
4462
- index: optionIndex + 1
4463
- })
4464
- }), /*#__PURE__*/jsx(Text$4, {
4465
- type: "secondary",
4466
- children: (option.blocks || []).length ? formatMessage({
4467
- id: 'fieldAndItemBlockCount'
4468
- }, {
4469
- fields: ((_option$list = option.list) == null ? void 0 : _option$list.length) || 0,
4470
- nests: option.blocks.length
4471
- }) : formatMessage({
4472
- id: 'fieldCount'
4473
- }, {
4474
- count: ((_option$list2 = option.list) == null ? void 0 : _option$list2.length) || 0
4475
- })
4706
+ }), /*#__PURE__*/jsxs("div", {
4707
+ className: style['step-section-text'],
4708
+ children: [/*#__PURE__*/jsx(Text$3, {
4709
+ strong: true,
4710
+ children: text(option.title) || formatMessage({
4711
+ id: 'choiceOptionFallback'
4712
+ }, {
4713
+ index: optionIndex + 1
4714
+ })
4715
+ }), /*#__PURE__*/jsx(Text$3, {
4716
+ type: "secondary",
4717
+ className: style['step-section-count'],
4718
+ children: (option.blocks || []).length ? formatMessage({
4719
+ id: 'fieldAndItemBlockCount'
4720
+ }, {
4721
+ fields: ((_option$list = option.list) == null ? void 0 : _option$list.length) || 0,
4722
+ nests: option.blocks.length
4723
+ }) : formatMessage({
4724
+ id: 'fieldCount'
4725
+ }, {
4726
+ count: ((_option$list2 = option.list) == null ? void 0 : _option$list2.length) || 0
4727
+ })
4728
+ })]
4476
4729
  })]
4477
4730
  }), /*#__PURE__*/jsxs(Space, {
4478
4731
  size: 4,
4479
- wrap: true,
4480
4732
  className: style['step-section-actions'],
4481
- children: [/*#__PURE__*/jsxs(ActionGroup, {
4482
- children: [/*#__PURE__*/jsx(IconBtn, {
4483
- title: formatMessage({
4733
+ children: [/*#__PURE__*/jsx(RowActions$1, {
4734
+ isMobile: isMobile,
4735
+ moreTitle: formatMessage({
4736
+ id: 'moreActions'
4737
+ }),
4738
+ prefix: !isMobile && block.options.length > 1 && !blockHasLockedField(option) ? renderDragHandle(`options:${block.id}`) : null,
4739
+ actions: orderActions(isMobile, [{
4740
+ key: 'up',
4741
+ label: formatMessage({
4484
4742
  id: 'moveUp'
4485
4743
  }),
4486
4744
  icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
4487
4745
  disabled: optionIndex === 0 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex - 1]),
4488
4746
  onClick: () => onMoveChoiceOption(block.id, option.id, 'up')
4489
- }), /*#__PURE__*/jsx(IconBtn, {
4490
- title: formatMessage({
4747
+ }, {
4748
+ key: 'down',
4749
+ label: formatMessage({
4491
4750
  id: 'moveDown'
4492
4751
  }),
4493
4752
  icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
4494
4753
  disabled: optionIndex === (((_block$options = block.options) == null ? void 0 : _block$options.length) || 0) - 1 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex + 1]),
4495
4754
  onClick: () => onMoveChoiceOption(block.id, option.id, 'down')
4496
- }), /*#__PURE__*/jsx(IconBtn, {
4497
- title: formatMessage({
4755
+ }, {
4756
+ key: 'edit',
4757
+ label: formatMessage({
4498
4758
  id: 'editChoiceOption'
4499
4759
  }),
4500
4760
  icon: /*#__PURE__*/jsx(EditOutlined, {}),
4501
4761
  onClick: () => onEditChoiceOption(block.id, option)
4502
- }), blockHasLockedField(option) ? null : /*#__PURE__*/jsx(IconBtn, {
4503
- title: formatMessage({
4762
+ }, blockHasLockedField(option) ? null : {
4763
+ key: 'delete',
4764
+ label: formatMessage({
4504
4765
  id: 'deleteChoiceOption'
4505
4766
  }),
4506
- danger: true,
4507
4767
  icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
4768
+ danger: true,
4508
4769
  onClick: () => onDeleteChoiceOption(block.id, option.id)
4509
- })]
4770
+ }])
4510
4771
  }), renderAddFieldButton({
4511
4772
  menuKey: `${block.id}:opt:${option.id}`,
4512
4773
  depth,
@@ -4521,10 +4782,10 @@ const BlockListPanel = ({
4521
4782
  })]
4522
4783
  }), renderFieldList(option.list, block.id, {
4523
4784
  optionId: option.id
4524
- }), renderNestedBlocks(option.blocks, depth)]
4785
+ }), renderNestedBlocks(option.blocks, depth, `option:${option.id}`)]
4525
4786
  }, option.id);
4526
4787
  })
4527
- }) : /*#__PURE__*/jsx(Text$4, {
4788
+ }) : /*#__PURE__*/jsx(Text$3, {
4528
4789
  type: "secondary",
4529
4790
  className: style['inline-empty'],
4530
4791
  children: formatMessage({
@@ -4537,10 +4798,10 @@ const BlockListPanel = ({
4537
4798
  const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
4538
4799
  return /*#__PURE__*/jsxs("div", {
4539
4800
  className: style['block-body'],
4540
- children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth) : null]
4801
+ children: [renderFieldList(block.list, block.id), supportsItemBlocks$1 ? renderItemBlocks(block, depth) : null, supportsBlocks ? renderNestedBlocks(block.blocks, depth, `block:${block.id}`) : null]
4541
4802
  });
4542
4803
  };
4543
- const renderBlockSection = (block, blockIndex, siblings, depth = 0) => {
4804
+ const renderBlockSection = (block, blockIndex, siblings, depth = 0, parentKey = 'root') => {
4544
4805
  var _block$itemBlocks, _block$blocks, _block$items2, _block$rows, _block$options2, _block$list, _block$list2;
4545
4806
  const total = siblings.length;
4546
4807
  const locked = blockHasLockedField(block);
@@ -4561,14 +4822,14 @@ const BlockListPanel = ({
4561
4822
  type: /*#__PURE__*/jsxs("span", {
4562
4823
  className: style['block-summary-type'],
4563
4824
  children: [/*#__PURE__*/createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
4564
- })
4825
+ }, "type")
4565
4826
  }) : block.kind === 'matrixScale' ? formatMessage({
4566
4827
  id: 'matrixScaleSummary'
4567
4828
  }, {
4568
4829
  type: /*#__PURE__*/jsxs("span", {
4569
4830
  className: style['block-summary-type'],
4570
4831
  children: [/*#__PURE__*/createElement(getFieldTypeIcon(block.fieldType || 'RadioGroup')), resolveFieldTypeLabel(block.fieldType || 'RadioGroup', formatMessage)]
4571
- }),
4832
+ }, "type"),
4572
4833
  layout: formatMessage({
4573
4834
  id: `matrixScaleLayout_${matrixLayout}`
4574
4835
  }),
@@ -4587,73 +4848,92 @@ const BlockListPanel = ({
4587
4848
  }, {
4588
4849
  count: ((_block$list2 = block.list) == null ? void 0 : _block$list2.length) || 0
4589
4850
  });
4851
+ const collapsed = collapsedIds.has(block.id);
4852
+ const canDragBlock = total > 1 && !locked;
4853
+ const blockTitle = text(block.title) || text(block.label) || block.name || formatMessage({
4854
+ id: 'untitledBlock'
4855
+ });
4590
4856
  return /*#__PURE__*/jsxs("section", {
4591
- className: `${style['block-section']} ${style[`block-kind-${block.kind}`] || ''} ${depth > 0 ? style['block-section-nested'] : ''}`.trim(),
4857
+ className: `${style['block-section']} ${style[`block-kind-${block.kind}`] || ''} ${depth > 0 ? style['block-section-nested'] : ''} ${collapsed ? style['is-collapsed'] : ''}`.trim(),
4592
4858
  children: [/*#__PURE__*/jsxs("header", {
4593
4859
  className: style['block-section-header'],
4594
4860
  children: [/*#__PURE__*/jsxs("div", {
4595
- className: style['block-header-left'],
4596
- children: [/*#__PURE__*/jsx(Tag, {
4861
+ className: style['block-header-meta'],
4862
+ children: [/*#__PURE__*/jsx("button", {
4863
+ type: "button",
4864
+ className: `${style['block-collapse-btn']} ${collapsed ? '' : style['is-expanded']}`.trim(),
4865
+ title: formatMessage({
4866
+ id: collapsed ? 'expandBlock' : 'collapseBlock'
4867
+ }),
4868
+ "aria-expanded": !collapsed,
4869
+ onClick: () => toggleCollapsed(block.id),
4870
+ children: /*#__PURE__*/jsx(RightOutlined, {})
4871
+ }), isMobile && canDragBlock ? renderDragHandle(getBlockScope(parentKey), true) : null, /*#__PURE__*/jsx(Tag, {
4597
4872
  bordered: false,
4598
4873
  color: (definition == null ? void 0 : definition.color) || 'default',
4599
4874
  icon: BLOCK_KIND_ICONS[block.kind],
4600
4875
  children: formatMessage({
4601
4876
  id: `blockKind_${block.kind}`
4602
4877
  })
4603
- }), /*#__PURE__*/jsx(Text$4, {
4604
- strong: true,
4605
- ellipsis: true,
4606
- className: style['block-title'],
4607
- children: text(block.title) || text(block.label) || block.name || formatMessage({
4608
- id: 'untitledBlock'
4609
- })
4610
4878
  }), /*#__PURE__*/jsx("span", {
4611
4879
  className: style['block-summary'],
4612
4880
  children: summary
4613
- })]
4614
- }), /*#__PURE__*/jsxs(Space, {
4615
- size: 4,
4616
- wrap: true,
4617
- className: style['block-header-actions'],
4618
- children: [/*#__PURE__*/jsxs(ActionGroup, {
4619
- children: [/*#__PURE__*/jsx(IconBtn, {
4620
- title: formatMessage({
4621
- id: 'moveUp'
4622
- }),
4623
- icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
4624
- disabled: blockIndex === 0 || locked || blockHasLockedField(siblings[blockIndex - 1]),
4625
- onClick: () => onMoveBlock(block.id, 'up')
4626
- }), /*#__PURE__*/jsx(IconBtn, {
4627
- title: formatMessage({
4628
- id: 'moveDown'
4629
- }),
4630
- icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
4631
- disabled: blockIndex === total - 1 || locked || blockHasLockedField(siblings[blockIndex + 1]),
4632
- onClick: () => onMoveBlock(block.id, 'down')
4633
- }), /*#__PURE__*/jsx(IconBtn, {
4634
- title: formatMessage({
4635
- id: 'editBlock'
4636
- }),
4637
- icon: /*#__PURE__*/jsx(SettingOutlined, {}),
4638
- onClick: () => onEditBlock(block)
4639
- }), locked ? null : /*#__PURE__*/jsx(IconBtn, {
4640
- title: formatMessage({
4641
- id: 'deleteBlock'
4881
+ }), /*#__PURE__*/jsxs(Space, {
4882
+ size: 4,
4883
+ className: style['block-header-actions'],
4884
+ children: [/*#__PURE__*/jsx(RowActions$1, {
4885
+ isMobile: isMobile,
4886
+ moreTitle: formatMessage({
4887
+ id: 'moreActions'
4642
4888
  }),
4643
- danger: true,
4644
- icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
4645
- onClick: () => onDeleteBlock(block.id)
4646
- })]
4647
- }), canAddField ? renderAddFieldButton({
4648
- menuKey: block.id,
4649
- depth,
4650
- onAddFieldClick: () => onAddField(block.id),
4651
- onAddChildBlock: supportsChildModules ? kind => onAddBlock(kind, {
4652
- parentBlockId: block.id
4653
- }) : undefined
4654
- }) : null]
4889
+ prefix: !isMobile && canDragBlock ? renderDragHandle(getBlockScope(parentKey)) : null,
4890
+ actions: orderActions(isMobile, [{
4891
+ key: 'up',
4892
+ label: formatMessage({
4893
+ id: 'moveUp'
4894
+ }),
4895
+ icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
4896
+ disabled: blockIndex === 0 || locked || blockHasLockedField(siblings[blockIndex - 1]),
4897
+ onClick: () => onMoveBlock(block.id, 'up')
4898
+ }, {
4899
+ key: 'down',
4900
+ label: formatMessage({
4901
+ id: 'moveDown'
4902
+ }),
4903
+ icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
4904
+ disabled: blockIndex === total - 1 || locked || blockHasLockedField(siblings[blockIndex + 1]),
4905
+ onClick: () => onMoveBlock(block.id, 'down')
4906
+ }, {
4907
+ key: 'setting',
4908
+ label: formatMessage({
4909
+ id: 'editBlock'
4910
+ }),
4911
+ icon: /*#__PURE__*/jsx(SettingOutlined, {}),
4912
+ onClick: () => onEditBlock(block)
4913
+ }, locked ? null : {
4914
+ key: 'delete',
4915
+ label: formatMessage({
4916
+ id: 'deleteBlock'
4917
+ }),
4918
+ icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
4919
+ danger: true,
4920
+ onClick: () => onDeleteBlock(block.id)
4921
+ }])
4922
+ }), canAddField ? renderAddFieldButton({
4923
+ menuKey: block.id,
4924
+ depth,
4925
+ onAddFieldClick: () => onAddField(block.id),
4926
+ onAddChildBlock: supportsChildModules ? kind => onAddBlock(kind, {
4927
+ parentBlockId: block.id
4928
+ }) : undefined
4929
+ }) : null]
4930
+ })]
4931
+ }), /*#__PURE__*/jsx("div", {
4932
+ className: style['block-title'],
4933
+ title: blockTitle,
4934
+ children: blockTitle
4655
4935
  })]
4656
- }), renderBlockChildren(block, depth)]
4936
+ }), collapsed ? null : renderBlockChildren(block, depth)]
4657
4937
  }, block.id);
4658
4938
  };
4659
4939
  return /*#__PURE__*/jsxs("div", {
@@ -4702,88 +4982,163 @@ const BlockListPanel = ({
4702
4982
  description: formatMessage({
4703
4983
  id: 'emptyBlockList'
4704
4984
  })
4705
- }) : /*#__PURE__*/jsx("div", {
4985
+ }) : /*#__PURE__*/jsx(SortableList$1, {
4706
4986
  className: style['block-list'],
4987
+ scope: getBlockScope('root'),
4988
+ list: blocks,
4989
+ isFixed: blockHasLockedField,
4990
+ onMove: onMoveBlock,
4707
4991
  children: blocks.map((block, blockIndex) => renderBlockSection(block, blockIndex, blocks, 0))
4708
4992
  })]
4709
4993
  });
4710
4994
  };
4711
4995
  var BlockListPanel$1 = BlockListPanel;
4712
4996
 
4997
+ const TOGGLE_TYPES = [Checkbox, Switch];
4998
+
4999
+ /**
5000
+ * 输入类在前、开关类在后。开关包进独立网格:输入项为奇数或带 display 条件时,
5001
+ * 开关仍从新的一行开始,不会补进输入框旁的空位。
5002
+ */
5003
+ const arrangeEditorItems = (list, column = 1) => {
5004
+ const items = (list || []).filter(Boolean);
5005
+ const isToggle = item => TOGGLE_TYPES.includes(item.type);
5006
+ const inputs = items.filter(item => !isToggle(item));
5007
+ const toggles = items.filter(isToggle);
5008
+ if (!inputs.length || !toggles.length) {
5009
+ return [...inputs, ...toggles];
5010
+ }
5011
+ return [...inputs, /*#__PURE__*/jsx(FormInfo, {
5012
+ block: true,
5013
+ className: style['editor-toggles'],
5014
+ column: column,
5015
+ gap: 12,
5016
+ list: toggles
5017
+ }, "editor-toggles")];
5018
+ };
5019
+ const getEditorColumn = isMobile => isMobile ? 1 : 2;
5020
+ const getPropertyModalProps = (isMobile, width) => ({
5021
+ className: style['property-modal'],
5022
+ width: isMobile ? 'calc(100vw - 32px)' : width
5023
+ });
5024
+
5025
+ const SECTION_ORDER = ['basic', 'listRule', 'choiceRule', 'choiceData', 'rule', 'layout'];
5026
+ const SECTION_TEXT = {
5027
+ basic: ['blockBasicSection', 'blockBasicSectionDesc'],
5028
+ listRule: ['blockListRuleSection', 'blockListRuleSectionDesc'],
5029
+ choiceRule: ['choiceRuleSection', 'choiceRuleSectionDesc'],
5030
+ choiceData: ['choiceDataSection', 'choiceDataSectionDesc'],
5031
+ rule: ['fieldRule', 'matrixScaleRuleDesc'],
5032
+ layout: ['blockLayoutSection', 'blockLayoutSectionDesc']
5033
+ };
4713
5034
  const BlockConfigFields = ({
4714
5035
  kind
4715
5036
  }) => {
4716
5037
  const {
4717
5038
  formatMessage
4718
5039
  } = useIntl();
5040
+ const column = getEditorColumn(useIsMobile());
4719
5041
  const definition = getBlockDefinition(kind);
4720
5042
  const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
4721
- const list = [];
5043
+ const sections = {
5044
+ basic: [],
5045
+ listRule: [],
5046
+ choiceRule: [],
5047
+ choiceData: [],
5048
+ rule: [],
5049
+ layout: []
5050
+ };
5051
+ const add = (section, ...items) => sections[section].push(...items.filter(Boolean));
4722
5052
  const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
4723
- if (kind === 'formInfo' || kind === 'list' || kind === 'tableList' || kind === 'editableList' || kind === 'object') {
4724
- list.push(/*#__PURE__*/jsx(LocaleInput, {
4725
- name: "title",
4726
- label: formatMessage({
4727
- id: 'blockTitle'
4728
- }),
4729
- placeholder: formatMessage({
4730
- id: 'blockTitlePlaceholder'
4731
- })
4732
- }, "title"), kind === 'formInfo' ? /*#__PURE__*/jsx(LocaleInput, {
4733
- name: "subtitle",
4734
- label: formatMessage({
4735
- id: 'blockSubtitle'
4736
- }),
4737
- placeholder: formatMessage({
4738
- id: 'blockSubtitlePlaceholder'
4739
- })
4740
- }, "subtitle") : null, kind !== 'formInfo' ? /*#__PURE__*/jsx(Input, {
4741
- name: "name",
4742
- label: formatMessage({
4743
- id: 'blockName'
4744
- }),
4745
- rule: "REQ",
4746
- placeholder: formatMessage({
4747
- id: 'fieldNamePlaceholder'
4748
- })
4749
- }, "name") : null, /*#__PURE__*/jsx(InputNumber, {
4750
- name: "column",
4751
- label: formatMessage({
4752
- id: 'formColumnPlaceholder'
4753
- }),
4754
- min: 1,
4755
- max: 4
4756
- }, "column"), kind === 'formInfo' || kind === 'object' ? /*#__PURE__*/jsx(InputNumber, {
5053
+ const titleInput = placeholderId => /*#__PURE__*/jsx(LocaleInput, {
5054
+ name: "title",
5055
+ label: formatMessage({
5056
+ id: 'blockTitle'
5057
+ }),
5058
+ placeholder: formatMessage({
5059
+ id: placeholderId || 'blockTitlePlaceholder'
5060
+ })
5061
+ }, "title");
5062
+ const subtitleInput = /*#__PURE__*/jsx(LocaleInput, {
5063
+ name: "subtitle",
5064
+ label: formatMessage({
5065
+ id: 'blockSubtitle'
5066
+ }),
5067
+ placeholder: formatMessage({
5068
+ id: 'blockSubtitlePlaceholder'
5069
+ })
5070
+ }, "subtitle");
5071
+ const nameInput = /*#__PURE__*/jsx(Input, {
5072
+ name: "name",
5073
+ label: formatMessage({
5074
+ id: 'blockName'
5075
+ }),
5076
+ rule: "REQ",
5077
+ placeholder: formatMessage({
5078
+ id: 'fieldNamePlaceholder'
5079
+ })
5080
+ }, "name");
5081
+ const columnInput = /*#__PURE__*/jsx(InputNumber, {
5082
+ name: "column",
5083
+ label: formatMessage({
5084
+ id: 'formColumnPlaceholder'
5085
+ }),
5086
+ min: 1,
5087
+ max: 4
5088
+ }, "column");
5089
+ const borderedCheckbox = /*#__PURE__*/jsx(Checkbox, {
5090
+ name: "bordered",
5091
+ children: formatMessage({
5092
+ id: 'blockBordered'
5093
+ })
5094
+ }, "bordered");
5095
+ const fieldTypeSelect = /*#__PURE__*/jsx(Select, {
5096
+ name: "fieldType",
5097
+ label: formatMessage({
5098
+ id: 'multiFieldType'
5099
+ }),
5100
+ rule: "REQ",
5101
+ options: fieldTypeOptions
5102
+ }, "fieldType");
5103
+ const addTextInput = /*#__PURE__*/jsx(LocaleInput, {
5104
+ name: "addText",
5105
+ label: formatMessage({
5106
+ id: 'blockAddText'
5107
+ }),
5108
+ placeholder: formatMessage({
5109
+ id: 'blockAddTextPlaceholder'
5110
+ })
5111
+ }, "addText");
5112
+ if (kind === 'formInfo') {
5113
+ add('basic', titleInput(), subtitleInput);
5114
+ add('layout', columnInput, /*#__PURE__*/jsx(InputNumber, {
4757
5115
  name: "gap",
4758
5116
  label: formatMessage({
4759
5117
  id: 'blockGap'
4760
5118
  }),
4761
5119
  min: 0,
4762
5120
  max: 48
4763
- }, "gap") : null, /*#__PURE__*/jsx(Checkbox, {
4764
- name: "bordered",
4765
- children: formatMessage({
4766
- id: 'blockBordered'
4767
- })
4768
- }, "bordered"), kind === 'formInfo' ? /*#__PURE__*/jsx(Checkbox, {
5121
+ }, "gap"), borderedCheckbox, /*#__PURE__*/jsx(Checkbox, {
4769
5122
  name: "showIndex",
4770
5123
  children: formatMessage({
4771
5124
  id: 'blockShowIndex'
4772
5125
  })
4773
- }, "showIndex") : null, kind === 'list' ? /*#__PURE__*/jsx(Checkbox, {
4774
- name: "important",
4775
- children: formatMessage({
4776
- id: 'blockImportant'
4777
- })
4778
- }, "important") : null, isListKind ? /*#__PURE__*/jsx(LocaleInput, {
4779
- name: "addText",
5126
+ }, "showIndex"));
5127
+ }
5128
+ if (kind === 'object') {
5129
+ add('basic', titleInput(), nameInput);
5130
+ add('layout', columnInput, /*#__PURE__*/jsx(InputNumber, {
5131
+ name: "gap",
4780
5132
  label: formatMessage({
4781
- id: 'blockAddText'
5133
+ id: 'blockGap'
4782
5134
  }),
4783
- placeholder: formatMessage({
4784
- id: 'blockAddTextPlaceholder'
4785
- })
4786
- }, "addText") : null, kind === 'editableList' ? /*#__PURE__*/jsx(Select, {
5135
+ min: 0,
5136
+ max: 48
5137
+ }, "gap"), borderedCheckbox);
5138
+ }
5139
+ if (isListKind) {
5140
+ add('basic', titleInput(), nameInput);
5141
+ add('listRule', addTextInput, kind === 'editableList' ? /*#__PURE__*/jsx(Select, {
4787
5142
  name: "addPosition",
4788
5143
  label: formatMessage({
4789
5144
  id: 'blockAddPosition'
@@ -4794,30 +5149,29 @@ const BlockConfigFields = ({
4794
5149
  }),
4795
5150
  value
4796
5151
  }))
4797
- }, "addPosition") : null, isListKind ? /*#__PURE__*/jsx(InputNumber, {
4798
- name: "maxLength",
4799
- label: formatMessage({
4800
- id: 'blockMaxLength'
4801
- }),
4802
- min: 1
4803
- }, "maxLength") : null, isListKind ? /*#__PURE__*/jsx(InputNumber, {
5152
+ }, "addPosition") : null, /*#__PURE__*/jsx(InputNumber, {
4804
5153
  name: "minLength",
4805
5154
  label: formatMessage({
4806
5155
  id: 'blockMinLength'
4807
5156
  }),
4808
5157
  min: 0
4809
- }, "minLength") : null);
4810
- }
4811
- if (kind === 'choice') {
4812
- list.push(/*#__PURE__*/jsx(LocaleInput, {
4813
- name: "title",
5158
+ }, "minLength"), /*#__PURE__*/jsx(InputNumber, {
5159
+ name: "maxLength",
4814
5160
  label: formatMessage({
4815
- id: 'blockTitle'
5161
+ id: 'blockMaxLength'
4816
5162
  }),
4817
- placeholder: formatMessage({
4818
- id: 'choiceTitlePlaceholder'
5163
+ min: 1
5164
+ }, "maxLength"));
5165
+ add('layout', columnInput, borderedCheckbox, kind === 'list' ? /*#__PURE__*/jsx(Checkbox, {
5166
+ name: "important",
5167
+ children: formatMessage({
5168
+ id: 'blockImportant'
4819
5169
  })
4820
- }, "title"), /*#__PURE__*/jsx(Select, {
5170
+ }, "important") : null);
5171
+ }
5172
+ if (kind === 'choice') {
5173
+ add('basic', titleInput('choiceTitlePlaceholder'));
5174
+ add('choiceRule', /*#__PURE__*/jsx(Select, {
4821
5175
  name: "mode",
4822
5176
  label: formatMessage({
4823
5177
  id: 'choiceMode'
@@ -4864,12 +5218,8 @@ const BlockConfigFields = ({
4864
5218
  var _openApi$data2;
4865
5219
  return (openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.mode) === 'multiple';
4866
5220
  }
4867
- }, "maxLength"), /*#__PURE__*/jsx(Checkbox, {
4868
- name: "selectorInData",
4869
- children: formatMessage({
4870
- id: 'choiceSelectorInData'
4871
- })
4872
- }, "selectorInData"), /*#__PURE__*/jsx(Input, {
5221
+ }, "maxLength"));
5222
+ add('choiceData', /*#__PURE__*/jsx(Input, {
4873
5223
  name: "selectorName",
4874
5224
  label: formatMessage({
4875
5225
  id: 'choiceSelectorName'
@@ -4883,19 +5233,15 @@ const BlockConfigFields = ({
4883
5233
  var _openApi$data3;
4884
5234
  return (openApi == null || (_openApi$data3 = openApi.data) == null ? void 0 : _openApi$data3.selectorInData) !== false;
4885
5235
  }
4886
- }, "selectorName"));
5236
+ }, "selectorName"), /*#__PURE__*/jsx(Checkbox, {
5237
+ name: "selectorInData",
5238
+ children: formatMessage({
5239
+ id: 'choiceSelectorInData'
5240
+ })
5241
+ }, "selectorInData"));
4887
5242
  }
4888
5243
  if (kind === 'multiField') {
4889
- list.push(/*#__PURE__*/jsx(Input, {
4890
- name: "name",
4891
- label: formatMessage({
4892
- id: 'blockName'
4893
- }),
4894
- rule: "REQ",
4895
- placeholder: formatMessage({
4896
- id: 'fieldNamePlaceholder'
4897
- })
4898
- }, "name"), /*#__PURE__*/jsx(LocaleInput, {
5244
+ add('basic', nameInput, /*#__PURE__*/jsx(LocaleInput, {
4899
5245
  name: "label",
4900
5246
  label: formatMessage({
4901
5247
  id: 'fieldLabel'
@@ -4904,42 +5250,10 @@ const BlockConfigFields = ({
4904
5250
  placeholder: formatMessage({
4905
5251
  id: 'fieldLabelPlaceholder'
4906
5252
  })
4907
- }, "label"), /*#__PURE__*/jsx(Select, {
4908
- name: "fieldType",
4909
- label: formatMessage({
4910
- id: 'multiFieldType'
4911
- }),
4912
- rule: "REQ",
4913
- options: fieldTypeOptions
4914
- }, "fieldType"), /*#__PURE__*/jsx(LocaleInput, {
4915
- name: "addText",
4916
- label: formatMessage({
4917
- id: 'blockAddText'
4918
- }),
4919
- placeholder: formatMessage({
4920
- id: 'blockAddTextPlaceholder'
4921
- })
4922
- }, "addText"));
5253
+ }, "label"), fieldTypeSelect, addTextInput);
4923
5254
  }
4924
5255
  if (kind === 'matrixScale') {
4925
- list.push(/*#__PURE__*/jsx(LocaleInput, {
4926
- name: "title",
4927
- label: formatMessage({
4928
- id: 'blockTitle'
4929
- }),
4930
- placeholder: formatMessage({
4931
- id: 'blockTitlePlaceholder'
4932
- })
4933
- }, "title"), /*#__PURE__*/jsx(Input, {
4934
- name: "name",
4935
- label: formatMessage({
4936
- id: 'blockName'
4937
- }),
4938
- rule: "REQ",
4939
- placeholder: formatMessage({
4940
- id: 'fieldNamePlaceholder'
4941
- })
4942
- }, "name"), /*#__PURE__*/jsx(LocaleInput, {
5256
+ add('basic', titleInput(), nameInput, /*#__PURE__*/jsx(LocaleInput, {
4943
5257
  name: "rowTitle",
4944
5258
  label: formatMessage({
4945
5259
  id: 'matrixScaleRowTitle'
@@ -4947,7 +5261,14 @@ const BlockConfigFields = ({
4947
5261
  placeholder: formatMessage({
4948
5262
  id: 'matrixScaleRowTitlePlaceholder'
4949
5263
  })
4950
- }, "rowTitle"), /*#__PURE__*/jsx(Select, {
5264
+ }, "rowTitle"), fieldTypeSelect);
5265
+ add('rule', /*#__PURE__*/jsx(Checkbox, {
5266
+ name: "required",
5267
+ children: formatMessage({
5268
+ id: 'matrixScaleRequired'
5269
+ })
5270
+ }, "required"));
5271
+ add('layout', /*#__PURE__*/jsx(Select, {
4951
5272
  name: "layout",
4952
5273
  label: formatMessage({
4953
5274
  id: 'matrixScaleLayout'
@@ -4959,66 +5280,55 @@ const BlockConfigFields = ({
4959
5280
  }),
4960
5281
  value
4961
5282
  }))
4962
- }, "layout"), /*#__PURE__*/jsx(Select, {
4963
- name: "fieldType",
4964
- label: formatMessage({
4965
- id: 'multiFieldType'
4966
- }),
4967
- rule: "REQ",
4968
- options: fieldTypeOptions
4969
- }, "fieldType"), /*#__PURE__*/jsx(Checkbox, {
4970
- name: "bordered",
4971
- children: formatMessage({
4972
- id: 'blockBordered'
4973
- })
4974
- }, "bordered"), /*#__PURE__*/jsx(Checkbox, {
4975
- name: "required",
4976
- children: formatMessage({
4977
- id: 'matrixScaleRequired'
4978
- })
4979
- }, "required"));
5283
+ }, "layout"), borderedCheckbox);
4980
5284
  }
4981
5285
  if (kind === 'steps') {
4982
- list.push(/*#__PURE__*/jsx(LocaleInput, {
4983
- name: "title",
4984
- label: formatMessage({
4985
- id: 'blockTitle'
4986
- }),
4987
- placeholder: formatMessage({
4988
- id: 'blockTitlePlaceholder'
4989
- })
4990
- }, "title"), /*#__PURE__*/jsx(LocaleInput, {
4991
- name: "subtitle",
5286
+ add('basic', titleInput(), subtitleInput);
5287
+ add('layout', /*#__PURE__*/jsx(Select, {
5288
+ name: "stepsStyle",
4992
5289
  label: formatMessage({
4993
- id: 'blockSubtitle'
5290
+ id: 'stepsStyle'
4994
5291
  }),
4995
- placeholder: formatMessage({
4996
- id: 'blockSubtitlePlaceholder'
4997
- })
4998
- }, "subtitle"), /*#__PURE__*/jsx(Checkbox, {
4999
- name: "bordered",
5000
- children: formatMessage({
5001
- id: 'blockBordered'
5002
- })
5003
- }, "bordered"), /*#__PURE__*/jsx(Checkbox, {
5292
+ options: STEPS_STYLES.map(value => ({
5293
+ label: formatMessage({
5294
+ id: `stepsStyle_${value}`
5295
+ }),
5296
+ value
5297
+ }))
5298
+ }, "stepsStyle"), borderedCheckbox, /*#__PURE__*/jsx(Checkbox, {
5004
5299
  name: "autoStep",
5005
5300
  children: formatMessage({
5006
5301
  id: 'blockAutoStep'
5007
5302
  })
5008
5303
  }, "autoStep"));
5009
5304
  }
5010
- return /*#__PURE__*/jsx("div", {
5011
- className: style['field-editor-form'],
5012
- children: /*#__PURE__*/jsx(FormInfo, {
5013
- title: formatMessage({
5014
- id: `blockKind_${kind}`
5015
- }),
5016
- subtitle: definition ? formatMessage({
5017
- id: definition.descriptionId
5018
- }) : undefined,
5019
- column: 1,
5020
- list: list.filter(Boolean)
5021
- })
5305
+ return /*#__PURE__*/jsxs(Fragment, {
5306
+ children: [/*#__PURE__*/jsxs("div", {
5307
+ className: style['editor-intro'],
5308
+ children: [/*#__PURE__*/jsx(Tag, {
5309
+ bordered: false,
5310
+ color: (definition == null ? void 0 : definition.color) || 'default',
5311
+ children: formatMessage({
5312
+ id: `blockKind_${kind}`
5313
+ })
5314
+ }), definition ? /*#__PURE__*/jsx("span", {
5315
+ children: formatMessage({
5316
+ id: definition.descriptionId
5317
+ })
5318
+ }) : null]
5319
+ }), /*#__PURE__*/jsx("div", {
5320
+ className: style['field-editor-form'],
5321
+ children: SECTION_ORDER.filter(key => sections[key].length).map(key => /*#__PURE__*/jsx(FormInfo, {
5322
+ title: formatMessage({
5323
+ id: SECTION_TEXT[key][0]
5324
+ }),
5325
+ subtitle: formatMessage({
5326
+ id: SECTION_TEXT[key][1]
5327
+ }),
5328
+ column: column,
5329
+ list: arrangeEditorItems(sections[key], column)
5330
+ }, key))
5331
+ })]
5022
5332
  });
5023
5333
  };
5024
5334
  const BlockEditorModal = ({
@@ -5051,9 +5361,8 @@ const BlockEditorModal = ({
5051
5361
  id: isEdit ? 'editBlock' : 'addBlock'
5052
5362
  }),
5053
5363
  open: open,
5054
- onCancel: onCancel,
5055
- width: isMobile ? 'calc(100vw - 32px)' : 720
5056
- }, renderModal ? {
5364
+ onCancel: onCancel
5365
+ }, getPropertyModalProps(isMobile, 720), renderModal ? {
5057
5366
  renderModal
5058
5367
  } : {}, {
5059
5368
  formProps: {
@@ -5092,9 +5401,8 @@ const StepEditorModal = ({
5092
5401
  id: step != null && step.id ? 'editStep' : 'addStep'
5093
5402
  }),
5094
5403
  open: open,
5095
- onCancel: onCancel,
5096
- width: isMobile ? 'calc(100vw - 32px)' : 560
5097
- }, renderModal ? {
5404
+ onCancel: onCancel
5405
+ }, getPropertyModalProps(isMobile, 560), renderModal ? {
5098
5406
  renderModal
5099
5407
  } : {}, {
5100
5408
  formProps: {
@@ -5109,25 +5417,28 @@ const StepEditorModal = ({
5109
5417
  cancelText: formatMessage({
5110
5418
  id: 'cancel'
5111
5419
  }),
5112
- children: /*#__PURE__*/jsx(FormInfo, {
5113
- column: 1,
5114
- list: [/*#__PURE__*/jsx(LocaleInput, {
5115
- name: "title",
5116
- label: formatMessage({
5117
- id: 'stepTitle'
5118
- }),
5119
- rule: "REQ",
5120
- placeholder: formatMessage({
5121
- id: 'stepTitlePlaceholder'
5122
- })
5123
- }, "title"), /*#__PURE__*/jsx(InputNumber, {
5124
- name: "column",
5125
- label: formatMessage({
5126
- id: 'formColumnPlaceholder'
5127
- }),
5128
- min: 1,
5129
- max: 4
5130
- }, "column")]
5420
+ children: /*#__PURE__*/jsx("div", {
5421
+ className: `${style['field-editor-form']} ${style['is-plain']}`,
5422
+ children: /*#__PURE__*/jsx(FormInfo, {
5423
+ column: getEditorColumn(isMobile),
5424
+ list: [/*#__PURE__*/jsx(LocaleInput, {
5425
+ name: "title",
5426
+ label: formatMessage({
5427
+ id: 'stepTitle'
5428
+ }),
5429
+ rule: "REQ",
5430
+ placeholder: formatMessage({
5431
+ id: 'stepTitlePlaceholder'
5432
+ })
5433
+ }, "title"), /*#__PURE__*/jsx(InputNumber, {
5434
+ name: "column",
5435
+ label: formatMessage({
5436
+ id: 'formColumnPlaceholder'
5437
+ }),
5438
+ min: 1,
5439
+ max: 4
5440
+ }, "column")]
5441
+ })
5131
5442
  })
5132
5443
  }), open ? step != null && step.id ? `edit-${step.id}` : `add-step-${formData.title || 'new'}` : 'closed');
5133
5444
  };
@@ -5152,9 +5463,8 @@ const ChoiceOptionEditorModal = ({
5152
5463
  id: option != null && option.id ? 'editChoiceOption' : 'addChoiceOption'
5153
5464
  }),
5154
5465
  open: open,
5155
- onCancel: onCancel,
5156
- width: isMobile ? 'calc(100vw - 32px)' : 560
5157
- }, renderModal ? {
5466
+ onCancel: onCancel
5467
+ }, getPropertyModalProps(isMobile, 560), renderModal ? {
5158
5468
  renderModal
5159
5469
  } : {}, {
5160
5470
  formProps: {
@@ -5169,26 +5479,26 @@ const ChoiceOptionEditorModal = ({
5169
5479
  cancelText: formatMessage({
5170
5480
  id: 'cancel'
5171
5481
  }),
5172
- children: /*#__PURE__*/jsx(FormInfo, {
5173
- column: 1,
5174
- list: [/*#__PURE__*/jsx(LocaleInput, {
5175
- name: "title",
5176
- label: formatMessage({
5177
- id: 'choiceOptionTitle'
5178
- }),
5179
- rule: "REQ",
5180
- placeholder: formatMessage({
5181
- id: 'choiceOptionTitlePlaceholder'
5182
- })
5183
- }, "title")]
5482
+ children: /*#__PURE__*/jsx("div", {
5483
+ className: `${style['field-editor-form']} ${style['is-plain']}`,
5484
+ children: /*#__PURE__*/jsx(FormInfo, {
5485
+ column: 1,
5486
+ list: [/*#__PURE__*/jsx(LocaleInput, {
5487
+ name: "title",
5488
+ label: formatMessage({
5489
+ id: 'choiceOptionTitle'
5490
+ }),
5491
+ rule: "REQ",
5492
+ placeholder: formatMessage({
5493
+ id: 'choiceOptionTitlePlaceholder'
5494
+ })
5495
+ }, "title")]
5496
+ })
5184
5497
  })
5185
5498
  }), open ? option != null && option.id ? `edit-option-${option.id}` : `add-option-${formData.title || 'new'}` : 'closed');
5186
5499
  };
5187
5500
  var ChoiceOptionEditorModal$1 = ChoiceOptionEditorModal;
5188
5501
 
5189
- const {
5190
- Text: Text$3
5191
- } = Typography;
5192
5502
  const {
5193
5503
  useOnChange
5194
5504
  } = hooks;
@@ -5197,7 +5507,9 @@ const RulePresetsGroup = props => {
5197
5507
  return render(Checkbox$1.Group);
5198
5508
  };
5199
5509
  RulePresetsGroup.field = Checkbox$1.Group;
5200
- const RulePresetEditor = () => {
5510
+ const RulePresetEditor = ({
5511
+ column: _column = 1
5512
+ }) => {
5201
5513
  const {
5202
5514
  formatMessage
5203
5515
  } = useIntl();
@@ -5240,20 +5552,15 @@ const RulePresetEditor = () => {
5240
5552
  var _openApi$data2;
5241
5553
  return ((openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.rulePresets) || []).includes(RULE_LEN_PRESET);
5242
5554
  }
5243
- }, "lenMax"), /*#__PURE__*/jsx("div", {
5244
- block: true,
5245
- children: /*#__PURE__*/jsx(Text$3, {
5246
- type: "secondary",
5247
- children: formatMessage({
5248
- id: 'ruleEditorHint'
5249
- })
5250
- })
5251
- }, "rule-hint")];
5555
+ }, "lenMax")];
5252
5556
  return /*#__PURE__*/jsx(FormInfo, {
5253
5557
  title: formatMessage({
5254
5558
  id: 'fieldRule'
5255
5559
  }),
5256
- column: 1,
5560
+ subtitle: formatMessage({
5561
+ id: 'ruleEditorHint'
5562
+ }),
5563
+ column: _column,
5257
5564
  list: list
5258
5565
  });
5259
5566
  };
@@ -5852,6 +6159,9 @@ const OptionsEditor = ({
5852
6159
  title: formatMessage({
5853
6160
  id: 'fieldOptions'
5854
6161
  }),
6162
+ subtitle: formatMessage({
6163
+ id: 'fieldOptionsDesc'
6164
+ }),
5855
6165
  column: 1,
5856
6166
  list: [/*#__PURE__*/jsxs("div", {
5857
6167
  block: true,
@@ -5877,7 +6187,8 @@ const OptionsEditor = ({
5877
6187
  var OptionsEditor$1 = OptionsEditor;
5878
6188
 
5879
6189
  const SuperSelectPropsEditor = ({
5880
- definition
6190
+ definition,
6191
+ column: _column = 1
5881
6192
  }) => {
5882
6193
  const {
5883
6194
  formatMessage
@@ -5972,8 +6283,11 @@ const SuperSelectPropsEditor = ({
5972
6283
  title: formatMessage({
5973
6284
  id: 'superSelectPropsSection'
5974
6285
  }),
5975
- column: 1,
5976
- list: list
6286
+ subtitle: formatMessage({
6287
+ id: 'fieldPropsSectionDesc'
6288
+ }),
6289
+ column: _column,
6290
+ list: arrangeEditorItems(list, _column)
5977
6291
  });
5978
6292
  };
5979
6293
  var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
@@ -6289,7 +6603,8 @@ const buildBuiltinList = (type, formatMessage) => {
6289
6603
  };
6290
6604
  const FieldPropsEditor = ({
6291
6605
  type,
6292
- definition: definitionProp
6606
+ definition: definitionProp,
6607
+ column: _column = 1
6293
6608
  }) => {
6294
6609
  const {
6295
6610
  formatMessage
@@ -6312,8 +6627,11 @@ const FieldPropsEditor = ({
6312
6627
  title: formatMessage({
6313
6628
  id: 'fieldPropsSection'
6314
6629
  }),
6315
- column: 1,
6316
- list: list
6630
+ subtitle: formatMessage({
6631
+ id: 'fieldPropsSectionDesc'
6632
+ }),
6633
+ column: _column,
6634
+ list: arrangeEditorItems(list, _column)
6317
6635
  });
6318
6636
  };
6319
6637
  const hasFieldPropsEditor = (type, definition) => {
@@ -6723,7 +7041,7 @@ const VisibleWhenEditor = ({
6723
7041
  };
6724
7042
  var VisibleWhenEditor$1 = VisibleWhenEditor;
6725
7043
 
6726
- const _excluded$2 = ["columns"];
7044
+ const _excluded$3 = ["columns"];
6727
7045
  const {
6728
7046
  Text
6729
7047
  } = Typography;
@@ -6739,7 +7057,7 @@ const getDefaultSelectProps = () => ({
6739
7057
  columns: [createEmptyColumn()]
6740
7058
  });
6741
7059
  const omitColumns = (_ref = {}) => {
6742
- let rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
7060
+ let rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
6743
7061
  return rest;
6744
7062
  };
6745
7063
  const FieldConfigFields = ({
@@ -6758,6 +7076,7 @@ const FieldConfigFields = ({
6758
7076
  const {
6759
7077
  openApi
6760
7078
  } = useFormContext();
7079
+ const column = getEditorColumn(useIsMobile());
6761
7080
  const [fieldType, setFieldType] = useState(initialType);
6762
7081
  const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
6763
7082
  const definition = getFieldDefinition(fieldType);
@@ -6790,7 +7109,7 @@ const FieldConfigFields = ({
6790
7109
  });
6791
7110
  });
6792
7111
  };
6793
- const list = [/*#__PURE__*/jsx(Select, {
7112
+ const basicList = [/*#__PURE__*/jsx(Select, {
6794
7113
  name: "type",
6795
7114
  label: formatMessage({
6796
7115
  id: 'fieldType'
@@ -6829,6 +7148,7 @@ const FieldConfigFields = ({
6829
7148
  })
6830
7149
  }, "tips"), /*#__PURE__*/jsx(LocaleTextArea, {
6831
7150
  name: "description",
7151
+ block: true,
6832
7152
  label: formatMessage({
6833
7153
  id: 'fieldDescription'
6834
7154
  }),
@@ -6837,7 +7157,7 @@ const FieldConfigFields = ({
6837
7157
  }),
6838
7158
  rows: 2
6839
7159
  }, "description")];
6840
- list.push(/*#__PURE__*/jsx(Checkbox, {
7160
+ const displayList = [/*#__PURE__*/jsx(Checkbox, {
6841
7161
  name: "block",
6842
7162
  children: formatMessage({
6843
7163
  id: 'fieldBlock'
@@ -6847,21 +7167,26 @@ const FieldConfigFields = ({
6847
7167
  children: formatMessage({
6848
7168
  id: 'fieldHidden'
6849
7169
  })
6850
- }, "hidden"));
7170
+ }, "hidden")];
6851
7171
  return /*#__PURE__*/jsxs("div", {
6852
7172
  className: style['field-editor-form'],
6853
7173
  children: [/*#__PURE__*/jsx(FormInfo, {
6854
7174
  title: formatMessage({
6855
7175
  id: 'fieldBasicSection'
6856
7176
  }),
6857
- column: 1,
6858
- list: list
7177
+ subtitle: formatMessage({
7178
+ id: 'fieldBasicSectionDesc'
7179
+ }),
7180
+ column: column,
7181
+ list: basicList
6859
7182
  }), definition != null && definition.isSuperSelect ? /*#__PURE__*/jsx(SuperSelectPropsEditor$1, {
6860
- definition: definition
7183
+ definition: definition,
7184
+ column: column
6861
7185
  }) : hasFieldPropsEditor(fieldType, definition) ? /*#__PURE__*/jsx(FieldPropsEditor$1, {
6862
7186
  type: fieldType,
6863
- definition: definition
6864
- }) : null, /*#__PURE__*/jsx(RulePresetEditor$1, {}), definition != null && definition.hasBuiltinData ? /*#__PURE__*/jsx(Text, {
7187
+ definition: definition,
7188
+ column: column
7189
+ }) : null, definition != null && definition.hasBuiltinData ? /*#__PURE__*/jsx(Text, {
6865
7190
  type: "secondary",
6866
7191
  children: formatMessage({
6867
7192
  id: 'builtinDataHint'
@@ -6874,7 +7199,18 @@ const FieldConfigFields = ({
6874
7199
  hasColumns: definition.hasColumns,
6875
7200
  columns: columns,
6876
7201
  onColumnsChange: onColumnsChange
6877
- }) : null, conditionProps ? /*#__PURE__*/jsx(VisibleWhenEditor$1, _extends({}, conditionProps, {
7202
+ }) : null, /*#__PURE__*/jsx(RulePresetEditor$1, {
7203
+ column: column
7204
+ }), /*#__PURE__*/jsx(FormInfo, {
7205
+ title: formatMessage({
7206
+ id: 'fieldDisplaySection'
7207
+ }),
7208
+ subtitle: formatMessage({
7209
+ id: 'fieldDisplaySectionDesc'
7210
+ }),
7211
+ column: column,
7212
+ list: displayList
7213
+ }), conditionProps ? /*#__PURE__*/jsx(VisibleWhenEditor$1, _extends({}, conditionProps, {
6878
7214
  value: visibleWhen,
6879
7215
  onChange: onVisibleWhenChange
6880
7216
  })) : null]
@@ -6979,9 +7315,8 @@ const FieldEditorModal = ({
6979
7315
  id: isEdit ? 'editField' : 'addField'
6980
7316
  }),
6981
7317
  open: open,
6982
- onCancel: onCancel,
6983
- width: isMobile ? 'calc(100vw - 32px)' : 760
6984
- }, renderModal ? {
7318
+ onCancel: onCancel
7319
+ }, getPropertyModalProps(isMobile, 760), renderModal ? {
6985
7320
  renderModal
6986
7321
  } : {}, {
6987
7322
  formProps: {
@@ -7021,6 +7356,7 @@ const FormActionsEditor = ({
7021
7356
  formatMessage
7022
7357
  } = useIntl();
7023
7358
  const isMobile = useIsMobile();
7359
+ const column = getEditorColumn(isMobile);
7024
7360
  const formData = useMemo(() => normalizeFormActions(value), [value, open]);
7025
7361
  const alignOptions = useMemo(() => [{
7026
7362
  label: formatMessage({
@@ -7052,9 +7388,8 @@ const FormActionsEditor = ({
7052
7388
  id: 'formActionsSection'
7053
7389
  }),
7054
7390
  open: open,
7055
- onCancel: onCancel,
7056
- width: isMobile ? 'calc(100vw - 32px)' : 520
7057
- }, renderModal ? {
7391
+ onCancel: onCancel
7392
+ }, getPropertyModalProps(isMobile, 560), renderModal ? {
7058
7393
  renderModal
7059
7394
  } : {}, {
7060
7395
  formProps: {
@@ -7070,9 +7405,15 @@ const FormActionsEditor = ({
7070
7405
  id: 'cancel'
7071
7406
  }),
7072
7407
  children: /*#__PURE__*/jsxs("div", {
7073
- className: style['form-actions-editor'],
7408
+ className: `${style['field-editor-form']} ${style['form-actions-editor']}`,
7074
7409
  children: [/*#__PURE__*/jsx(FormInfo, {
7075
- column: 2,
7410
+ title: formatMessage({
7411
+ id: 'formActionsButtonsSection'
7412
+ }),
7413
+ subtitle: formatMessage({
7414
+ id: 'formActionsButtonsSectionDesc'
7415
+ }),
7416
+ column: column,
7076
7417
  list: [/*#__PURE__*/jsx(Switch, {
7077
7418
  name: "showSubmit",
7078
7419
  label: formatMessage({
@@ -7093,10 +7434,7 @@ const FormActionsEditor = ({
7093
7434
  var _openApi$data;
7094
7435
  return Boolean(openApi == null || (_openApi$data = openApi.data) == null ? void 0 : _openApi$data.showSubmit);
7095
7436
  }
7096
- }, "submitText")]
7097
- }), /*#__PURE__*/jsx(FormInfo, {
7098
- column: 2,
7099
- list: [/*#__PURE__*/jsx(Switch, {
7437
+ }, "submitText"), /*#__PURE__*/jsx(Switch, {
7100
7438
  name: "showReset",
7101
7439
  label: formatMessage({
7102
7440
  id: 'formActionsShowReset'
@@ -7116,10 +7454,7 @@ const FormActionsEditor = ({
7116
7454
  var _openApi$data2;
7117
7455
  return Boolean(openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.showReset);
7118
7456
  }
7119
- }, "resetText")]
7120
- }), /*#__PURE__*/jsx(FormInfo, {
7121
- column: 2,
7122
- list: [/*#__PURE__*/jsx(Switch, {
7457
+ }, "resetText"), /*#__PURE__*/jsx(Switch, {
7123
7458
  name: "showCancel",
7124
7459
  label: formatMessage({
7125
7460
  id: 'formActionsShowCancel'
@@ -7140,39 +7475,37 @@ const FormActionsEditor = ({
7140
7475
  return Boolean(openApi == null || (_openApi$data3 = openApi.data) == null ? void 0 : _openApi$data3.showCancel);
7141
7476
  }
7142
7477
  }, "cancelText")]
7143
- }), /*#__PURE__*/jsxs("div", {
7144
- className: style['form-actions-layout-panel'],
7145
- children: [/*#__PURE__*/jsx("div", {
7146
- className: style['form-actions-layout-title'],
7147
- children: formatMessage({
7148
- id: 'formActionsLayoutSection'
7149
- })
7150
- }), /*#__PURE__*/jsx(FormInfo, {
7151
- column: 1,
7152
- list: [/*#__PURE__*/jsx(RadioGroup, {
7153
- name: "align",
7154
- label: formatMessage({
7155
- id: 'formActionsAlign'
7156
- }),
7157
- optionType: "button",
7158
- buttonStyle: "solid",
7159
- options: alignOptions,
7160
- className: style['form-actions-align-group']
7161
- }, "align"), /*#__PURE__*/jsx(Slider, {
7162
- name: "gap",
7163
- label: formatMessage({
7164
- id: 'formActionsGap'
7165
- }),
7166
- min: 0,
7167
- max: 64,
7168
- step: 1,
7169
- marks: gapMarks,
7170
- tooltip: {
7171
- formatter: v => `${v != null ? v : 0}px`
7172
- },
7173
- className: style['form-actions-gap-slider']
7174
- }, "gap")]
7175
- })]
7478
+ }), /*#__PURE__*/jsx(FormInfo, {
7479
+ title: formatMessage({
7480
+ id: 'formActionsLayoutSection'
7481
+ }),
7482
+ subtitle: formatMessage({
7483
+ id: 'formActionsLayoutSectionDesc'
7484
+ }),
7485
+ column: 1,
7486
+ list: [/*#__PURE__*/jsx(RadioGroup, {
7487
+ name: "align",
7488
+ label: formatMessage({
7489
+ id: 'formActionsAlign'
7490
+ }),
7491
+ optionType: "button",
7492
+ buttonStyle: "solid",
7493
+ options: alignOptions,
7494
+ className: style['form-actions-align-group']
7495
+ }, "align"), /*#__PURE__*/jsx(Slider, {
7496
+ name: "gap",
7497
+ label: formatMessage({
7498
+ id: 'formActionsGap'
7499
+ }),
7500
+ min: 0,
7501
+ max: 64,
7502
+ step: 1,
7503
+ marks: gapMarks,
7504
+ tooltip: {
7505
+ formatter: v => `${v != null ? v : 0}px`
7506
+ },
7507
+ className: style['form-actions-gap-slider']
7508
+ }, "gap")]
7176
7509
  })]
7177
7510
  })
7178
7511
  }), open ? 'form-actions-open' : 'form-actions-closed');
@@ -7461,6 +7794,261 @@ const ChoiceBlock = ({
7461
7794
  };
7462
7795
  var ChoiceBlock$1 = ChoiceBlock;
7463
7796
 
7797
+ const _excluded$2 = ["items", "formatMessage", "stepsClassName"];
7798
+ const cx = (...names) => names.filter(Boolean).join(' ');
7799
+ const getStepFieldNames = item => (Array.isArray(item == null ? void 0 : item.fieldNames) && item.fieldNames.length ? item.fieldNames : ((item == null ? void 0 : item.list) || []).map(field => {
7800
+ var _field$props;
7801
+ return field == null || (_field$props = field.props) == null ? void 0 : _field$props.name;
7802
+ })).filter(Boolean);
7803
+ const FocusStepsHeader = ({
7804
+ items,
7805
+ current,
7806
+ stepTitle,
7807
+ formatMessage,
7808
+ onJump
7809
+ }) => {
7810
+ const total = items.length;
7811
+ const isLast = current >= total - 1;
7812
+ return /*#__PURE__*/jsxs("div", {
7813
+ className: style['steps-focus-header'],
7814
+ children: [/*#__PURE__*/jsxs("div", {
7815
+ className: style['steps-focus-meta'],
7816
+ children: [/*#__PURE__*/jsxs("span", {
7817
+ className: style['steps-focus-count'],
7818
+ children: [/*#__PURE__*/jsx("span", {
7819
+ className: style['steps-focus-count-current'],
7820
+ children: String(current + 1).padStart(2, '0')
7821
+ }), /*#__PURE__*/jsxs("span", {
7822
+ className: style['steps-focus-count-total'],
7823
+ children: ["/ ", String(total).padStart(2, '0')]
7824
+ })]
7825
+ }), /*#__PURE__*/jsx("span", {
7826
+ className: style['steps-focus-next'],
7827
+ title: isLast ? undefined : stepTitle(current + 1),
7828
+ children: isLast ? formatMessage({
7829
+ id: 'stepsFocusLast'
7830
+ }) : formatMessage({
7831
+ id: 'stepsFocusNext'
7832
+ }, {
7833
+ title: stepTitle(current + 1)
7834
+ })
7835
+ })]
7836
+ }), /*#__PURE__*/jsx("div", {
7837
+ className: style['steps-focus-title'],
7838
+ children: stepTitle(current)
7839
+ }), /*#__PURE__*/jsx("div", {
7840
+ className: style['steps-focus-track'],
7841
+ role: "progressbar",
7842
+ "aria-valuemin": 1,
7843
+ "aria-valuemax": total,
7844
+ "aria-valuenow": current + 1,
7845
+ children: items.map((item, index) => /*#__PURE__*/jsx("button", {
7846
+ type: "button",
7847
+ className: cx(style['steps-focus-segment'], index < current && style['is-done'], index === current && style['is-current']),
7848
+ title: stepTitle(index),
7849
+ "aria-label": stepTitle(index),
7850
+ disabled: index >= current,
7851
+ onClick: () => onJump(index)
7852
+ }, item.key || index))
7853
+ })]
7854
+ });
7855
+ };
7856
+ const FocusStepsActions = ({
7857
+ items,
7858
+ current,
7859
+ formatMessage,
7860
+ onChange
7861
+ }) => {
7862
+ const {
7863
+ openApi
7864
+ } = useFormContext() || {};
7865
+ const [loading, setLoading] = useState(false);
7866
+ const isFirst = current <= 0;
7867
+ const isLast = current >= items.length - 1;
7868
+ const handleNext = async () => {
7869
+ if (loading || isLast) {
7870
+ return;
7871
+ }
7872
+ setLoading(true);
7873
+ try {
7874
+ var _openApi$getField;
7875
+ const names = getStepFieldNames(items[current]);
7876
+ // validateFieldsByName 失败时会滚到首个错字段(同提交 ScrollToError);旧版 form-info 无此行为时下方兜底
7877
+ if (await validateFieldsByName(openApi, names)) {
7878
+ onChange(current + 1);
7879
+ return;
7880
+ }
7881
+ const firstInvalid = names.find(name => {
7882
+ const field = openApi == null || openApi.getField == null ? void 0 : openApi.getField({
7883
+ name
7884
+ });
7885
+ return field && field.isPass === false;
7886
+ });
7887
+ const el = firstInvalid ? openApi == null || openApi.getField == null || (_openApi$getField = openApi.getField({
7888
+ name: firstInvalid
7889
+ })) == null || (_openApi$getField = _openApi$getField.fieldRef) == null ? void 0 : _openApi$getField.current : null;
7890
+ if (el && typeof el.scrollIntoView === 'function') {
7891
+ requestAnimationFrame(() => {
7892
+ el.scrollIntoView();
7893
+ });
7894
+ }
7895
+ } finally {
7896
+ setLoading(false);
7897
+ }
7898
+ };
7899
+ return /*#__PURE__*/jsxs("div", {
7900
+ className: style['steps-focus-actions'],
7901
+ children: [/*#__PURE__*/jsx("div", {
7902
+ className: style['steps-focus-actions-side'],
7903
+ children: !isFirst ? /*#__PURE__*/jsx(Button, {
7904
+ className: style['steps-focus-prev'],
7905
+ variant: "text",
7906
+ color: "default",
7907
+ icon: /*#__PURE__*/jsx(ArrowLeftOutlined, {}),
7908
+ onClick: () => onChange(current - 1),
7909
+ children: formatMessage({
7910
+ id: 'stepsFocusPrev'
7911
+ })
7912
+ }) : null
7913
+ }), /*#__PURE__*/jsx("div", {
7914
+ className: cx(style['steps-focus-actions-side'], style['is-end']),
7915
+ children: isLast ? /*#__PURE__*/jsx("span", {
7916
+ className: style['steps-focus-done-hint'],
7917
+ children: formatMessage({
7918
+ id: 'stepsFocusSubmitHint'
7919
+ })
7920
+ }) : /*#__PURE__*/jsxs(Button, {
7921
+ className: style['steps-focus-next-btn'],
7922
+ variant: "filled",
7923
+ color: "primary",
7924
+ loading: loading,
7925
+ onClick: handleNext,
7926
+ children: [formatMessage({
7927
+ id: 'stepsFocusNextBtn'
7928
+ }), /*#__PURE__*/jsx(ArrowRightOutlined, {
7929
+ className: style['steps-focus-next-btn-icon']
7930
+ })]
7931
+ })
7932
+ })]
7933
+ });
7934
+ };
7935
+
7936
+ /**
7937
+ * stepsStyle: 'focus':受控 current,用自绘头部(序号 / 标题 / 分段进度)替换 antd 步骤条,
7938
+ * 并用自绘底部操作区替换 form-info 的链接式上一步 / 下一步;提交失败跳错步、重置仍由 form-info Steps 负责。
7939
+ */
7940
+ const FocusSteps = _ref => {
7941
+ let {
7942
+ items = [],
7943
+ formatMessage,
7944
+ stepsClassName
7945
+ } = _ref,
7946
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
7947
+ const {
7948
+ openApi
7949
+ } = useFormContext() || {};
7950
+ const [current, setCurrent] = useState(0);
7951
+ const headerRef = useRef(null);
7952
+ const mountedRef = useRef(false);
7953
+ const safeCurrent = Math.min(current, Math.max(items.length - 1, 0));
7954
+ const currentRef = useRef(safeCurrent);
7955
+ currentRef.current = safeCurrent;
7956
+ const itemsRef = useRef(items);
7957
+ itemsRef.current = items;
7958
+ const stepTitle = index => {
7959
+ var _items$index;
7960
+ return ((_items$index = items[index]) == null ? void 0 : _items$index.title) || formatMessage({
7961
+ id: 'untitledStep'
7962
+ }, {
7963
+ index: index + 1
7964
+ });
7965
+ };
7966
+ useEffect(() => {
7967
+ if (!mountedRef.current) {
7968
+ mountedRef.current = true;
7969
+ return;
7970
+ }
7971
+ const node = headerRef.current;
7972
+ if (node && node.getBoundingClientRect().top < 0) {
7973
+ node.scrollIntoView({
7974
+ behavior: 'smooth',
7975
+ block: 'start'
7976
+ });
7977
+ }
7978
+ }, [safeCurrent]);
7979
+
7980
+ // 提交失败时:若当前步字段有错则强制留在当前步,避免误跳到后续错步
7981
+ useEffect(() => {
7982
+ const emitter = openApi == null ? void 0 : openApi.emitter;
7983
+ if (!(emitter != null && emitter.addListener)) {
7984
+ return undefined;
7985
+ }
7986
+ const stayIfCurrentHasError = errors => {
7987
+ const step = itemsRef.current[currentRef.current];
7988
+ const names = new Set(getStepFieldNames(step));
7989
+ if (!names.size) {
7990
+ return;
7991
+ }
7992
+ const currentHasError = (errors || []).some(item => names.has(item == null ? void 0 : item.name) || names.has(item == null ? void 0 : item.groupName));
7993
+ if (currentHasError) {
7994
+ setCurrent(currentRef.current);
7995
+ }
7996
+ };
7997
+ const errorSub = emitter.addListener('form:submit:error', stayIfCurrentHasError);
7998
+ const completeSub = emitter.addListener('form:submit:complete', ({
7999
+ isPass,
8000
+ errors
8001
+ } = {}) => {
8002
+ if (!isPass) {
8003
+ stayIfCurrentHasError(errors);
8004
+ }
8005
+ });
8006
+ return () => {
8007
+ errorSub == null || errorSub.remove == null || errorSub.remove();
8008
+ completeSub == null || completeSub.remove == null || completeSub.remove();
8009
+ };
8010
+ }, [openApi]);
8011
+ const focusItems = items.map((item, index) => {
8012
+ if (index !== safeCurrent) {
8013
+ return item;
8014
+ }
8015
+ return _extends({}, item, {
8016
+ title: /*#__PURE__*/jsx("div", {
8017
+ ref: headerRef,
8018
+ children: /*#__PURE__*/jsx(FocusStepsHeader, {
8019
+ items: items,
8020
+ current: safeCurrent,
8021
+ stepTitle: stepTitle,
8022
+ formatMessage: formatMessage,
8023
+ onJump: setCurrent
8024
+ })
8025
+ }),
8026
+ children: /*#__PURE__*/jsxs(Fragment, {
8027
+ children: [item.children != null ? item.children : /*#__PURE__*/jsx(FormInfo, {
8028
+ column: item.column,
8029
+ gap: item.gap,
8030
+ list: item.list || [],
8031
+ className: item.className
8032
+ }), /*#__PURE__*/jsx(FocusStepsActions, {
8033
+ items: items,
8034
+ current: safeCurrent,
8035
+ formatMessage: formatMessage,
8036
+ onChange: setCurrent
8037
+ })]
8038
+ })
8039
+ });
8040
+ });
8041
+ return /*#__PURE__*/jsx(Steps, _extends({}, props, {
8042
+ showActions: false,
8043
+ orientation: "horizontal",
8044
+ stepsClassName: cx(stepsClassName, style['steps-focus']),
8045
+ items: focusItems,
8046
+ current: safeCurrent,
8047
+ onChange: setCurrent
8048
+ }));
8049
+ };
8050
+ var FocusSteps$1 = FocusSteps;
8051
+
7464
8052
  const _excluded$1 = ["entries", "nested", "knownNames"];
7465
8053
 
7466
8054
  /**
@@ -7862,19 +8450,29 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
7862
8450
  }
7863
8451
  case 'steps':
7864
8452
  {
7865
- return withBlockLayout(/*#__PURE__*/createElement(Steps, {
8453
+ const isFocusSteps = block.stepsStyle === 'focus';
8454
+ // 与 formInfo 一致:block.showIndex(或 step 上覆盖)时给题干加序号
8455
+ const blockShowIndex = !!block.showIndex;
8456
+ return withBlockLayout(/*#__PURE__*/createElement(isFocusSteps ? FocusSteps$1 : Steps, _extends({
7866
8457
  key: block.id,
7867
8458
  title: block.title || undefined,
7868
8459
  subtitle: block.subtitle || undefined,
7869
8460
  bordered,
7870
- className: resolvePartRootClassName(depth),
8461
+ className: resolvePartRootClassName(depth)
8462
+ }, isFocusSteps ? {
8463
+ formatMessage
8464
+ } : null, {
7871
8465
  prevIcon: /*#__PURE__*/createElement(ArrowLeftOutlined),
7872
8466
  nextIcon: /*#__PURE__*/createElement(ArrowRightOutlined),
7873
8467
  items: (block.items || []).map(step => {
7874
- const entries = renderFieldEntries(step.list, preview, fieldRenderOpts);
8468
+ const showIndex = step.showIndex != null ? !!step.showIndex : blockShowIndex;
8469
+ const entries = renderFieldEntries(step.list, preview, _extends({}, fieldRenderOpts, {
8470
+ showIndex
8471
+ }));
7875
8472
  const nested = renderChildBlocks(step.blocks || [], nextCtx);
7876
8473
  const fieldNames = [...(step.list || []).filter(field => field && !field.hidden && field.name).map(field => field.name), ...collectBlockFieldNames(step.blocks || [])];
7877
8474
  const hasConditional = entries.some(entry => entry.visibleWhen);
8475
+ const indexClassName = showIndex ? style['form-info-show-index'] : null;
7878
8476
  if (nested.length || hasConditional) {
7879
8477
  return {
7880
8478
  key: step.id,
@@ -7887,7 +8485,8 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
7887
8485
  }, entries.length ? createFieldsFormInfo({
7888
8486
  key: `${step.id}-fields`,
7889
8487
  column: step.column,
7890
- gap: block.gap
8488
+ gap: block.gap,
8489
+ className: indexClassName
7891
8490
  }, entries, [], knownNames) : null, ...nested)
7892
8491
  };
7893
8492
  }
@@ -7897,10 +8496,11 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
7897
8496
  column: step.column,
7898
8497
  gap: block.gap,
7899
8498
  list: entries.map(entry => entry.element),
8499
+ className: indexClassName,
7900
8500
  fieldNames
7901
8501
  };
7902
8502
  })
7903
- }), asListItem);
8503
+ })), asListItem);
7904
8504
  }
7905
8505
  case 'choice':
7906
8506
  return withBlockLayout(/*#__PURE__*/createElement(ChoiceBlock$1, {