@kne/form-creator 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +343 -22
- package/dist/index.css +584 -79
- package/dist/index.css.map +1 -1
- package/dist/index.js +1910 -472
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1924 -513
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +65 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +65 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +65 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +65 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +9 -7
package/dist/index.modern.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
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
|
-
import { createContext, useContext,
|
|
5
|
-
import { Input as Input$1, Space, Tag, Tooltip,
|
|
4
|
+
import { createContext, useContext, useRef, useCallback, useEffect, useState, useMemo, createElement, Fragment as Fragment$1 } from 'react';
|
|
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, OrderedListOutlined, SelectOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
9
|
-
import { hooks, Input, TextArea, InputNumber, Select, RadioGroup, CheckboxGroup, Switch, Checkbox, DatePicker, useFormContext, Slider, RULES, SubmitButton, ResetButton, CancelButton, preset as preset$1 } from '@kne/react-form-antd';
|
|
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
|
+
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
|
|
16
|
-
import {
|
|
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-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-
|
|
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: '表单结构',
|
|
@@ -65,6 +68,7 @@ const locale$1 = {
|
|
|
65
68
|
blockKind_tableList: '表格列表',
|
|
66
69
|
blockKind_editableList: '行内编辑列表',
|
|
67
70
|
blockKind_multiField: '同类多值',
|
|
71
|
+
blockKind_matrixScale: '矩阵量表',
|
|
68
72
|
blockKind_object: '分组信息',
|
|
69
73
|
blockKind_choice: '选项切换',
|
|
70
74
|
blockKind_steps: '分步表单',
|
|
@@ -73,6 +77,7 @@ const locale$1 = {
|
|
|
73
77
|
blockKindDesc_tableList: '以表格形式展示的可增减列表',
|
|
74
78
|
blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
|
|
75
79
|
blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
|
|
80
|
+
blockKindDesc_matrixScale: '行为题目、列为选项或字段格子,每行共用同一填写项类型',
|
|
76
81
|
blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
|
|
77
82
|
blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
|
|
78
83
|
blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
@@ -122,9 +127,38 @@ const locale$1 = {
|
|
|
122
127
|
blockAddPosition_top: '标题右侧(插入到第一项)',
|
|
123
128
|
blockAddPosition_both: '两处都显示',
|
|
124
129
|
blockAutoStep: '填写完成后自动进入下一步',
|
|
130
|
+
stepsStyle: '步骤展示样式',
|
|
131
|
+
stepsStyle_default: '完整步骤条',
|
|
132
|
+
stepsStyle_focus: '聚焦当前步骤',
|
|
133
|
+
stepsFocusNext: '下一步:{title}',
|
|
134
|
+
stepsFocusLast: '最后一步',
|
|
135
|
+
stepsFocusPrev: '上一步',
|
|
136
|
+
stepsFocusNextBtn: '下一步',
|
|
137
|
+
stepsFocusSubmitHint: '已是最后一步,确认无误后提交',
|
|
125
138
|
multiFieldType: '填写项类型',
|
|
126
139
|
multiFieldSummary: '填写类型:{type}',
|
|
127
140
|
multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
|
|
141
|
+
matrixScaleRowTitle: '行标题列名',
|
|
142
|
+
matrixScaleRowTitlePlaceholder: '例如:活动',
|
|
143
|
+
matrixScaleLayout: '矩阵布局',
|
|
144
|
+
matrixScaleLayout_options: '选项矩阵',
|
|
145
|
+
matrixScaleLayout_columns: '单元格矩阵',
|
|
146
|
+
matrixScaleLayout_field: '每行一个字段',
|
|
147
|
+
matrixScaleRequired: '每行(每格)必填',
|
|
148
|
+
matrixScaleSummary: '{type} · {layout} · {rows} 行',
|
|
149
|
+
matrixScaleEditorHint_options: '配置行题目与量表选项;预览中每行是同一个选择字段。',
|
|
150
|
+
matrixScaleEditorHint_columns: '配置行题目与列字段;每个格子是同一个填写项类型(如数字、评分)。',
|
|
151
|
+
matrixScaleEditorHint_field: '只配置行题目;每行右侧放一个填写项(不传列)。',
|
|
152
|
+
matrixScaleRowsTitle: '行配置',
|
|
153
|
+
matrixScaleRowsHint: '左侧为行标题,右侧为保存用的名称',
|
|
154
|
+
matrixScaleRowLabelPlaceholder: '例如:工作/学习',
|
|
155
|
+
matrixScaleRowNamePlaceholder: '例如:work',
|
|
156
|
+
matrixScaleOptionsTitle: '量表选项(列)',
|
|
157
|
+
matrixScaleColumnsTitle: '列配置',
|
|
158
|
+
matrixScaleColumnsHint: '左侧为列标题,右侧为保存用的名称',
|
|
159
|
+
matrixScaleColumnLabelPlaceholder: '例如:周一',
|
|
160
|
+
matrixScaleColumnNamePlaceholder: '例如:mon',
|
|
161
|
+
matrixScaleAddRow: '添加一行',
|
|
128
162
|
stepListTitle: '步骤列表',
|
|
129
163
|
addStep: '添加步骤',
|
|
130
164
|
editStep: '编辑步骤',
|
|
@@ -148,6 +182,19 @@ const locale$1 = {
|
|
|
148
182
|
FieldTypeSelect: '下拉选择',
|
|
149
183
|
FieldTypeRadioGroup: '单选组',
|
|
150
184
|
FieldTypeCheckboxGroup: '复选组',
|
|
185
|
+
FieldTypeRadioGroupOther: '单选组(含其他)',
|
|
186
|
+
FieldTypeCheckboxGroupOther: '复选组(含其他)',
|
|
187
|
+
FieldTypeOtherOption: '其他',
|
|
188
|
+
propChoiceModern: '新版样式(序号色块)',
|
|
189
|
+
propChoiceBlock: '块级选项(纵向占满)',
|
|
190
|
+
propChoiceIndexType: '序号类型',
|
|
191
|
+
propChoiceIndexTypeLetter: '字母 A/B/C',
|
|
192
|
+
propChoiceIndexTypeNumber: '数字 1/2/3',
|
|
193
|
+
propChoiceIndexTypeCheck: '对勾(无序号)',
|
|
194
|
+
propChoiceOtherLabel: '「其他」选项文案',
|
|
195
|
+
propChoiceOtherLabelHint: '默认:其他',
|
|
196
|
+
propChoiceOtherPlaceholder: '「其他」输入框提示',
|
|
197
|
+
propChoiceOtherPlaceholderHint: '选中「其他」后补充说明',
|
|
151
198
|
FieldTypeSuperSelectList: '普通下拉',
|
|
152
199
|
FieldTypeSuperSelectTableList: '表格选择',
|
|
153
200
|
FieldTypeSuperSelectTree: '树形选择',
|
|
@@ -202,6 +249,25 @@ const locale$1 = {
|
|
|
202
249
|
formActionsGapHint: '默认 16',
|
|
203
250
|
formActionsLayoutSection: '布局',
|
|
204
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: '按钮的对齐方式与间距',
|
|
205
271
|
optionLabelColumn: '选项名称',
|
|
206
272
|
optionValueColumn: '选项值',
|
|
207
273
|
optionDescColumn: '选项描述',
|
|
@@ -341,6 +407,8 @@ const locale = {
|
|
|
341
407
|
deleteField: 'Delete',
|
|
342
408
|
moveUp: 'Move Up',
|
|
343
409
|
moveDown: 'Move Down',
|
|
410
|
+
dragSort: 'Drag to reorder',
|
|
411
|
+
moreActions: 'More actions',
|
|
344
412
|
fieldListTitle: 'Field Configuration',
|
|
345
413
|
fieldListSubtitle: 'Manage fields and preview the form on the right',
|
|
346
414
|
blockListTitle: 'Form Structure',
|
|
@@ -362,6 +430,7 @@ const locale = {
|
|
|
362
430
|
blockKind_tableList: 'Table List',
|
|
363
431
|
blockKind_editableList: 'Inline Edit List',
|
|
364
432
|
blockKind_multiField: 'Multi-Value',
|
|
433
|
+
blockKind_matrixScale: 'Matrix Scale',
|
|
365
434
|
blockKind_object: 'Grouped Fields',
|
|
366
435
|
blockKind_choice: 'Options',
|
|
367
436
|
blockKind_steps: 'Step-by-Step',
|
|
@@ -370,6 +439,7 @@ const locale = {
|
|
|
370
439
|
blockKindDesc_tableList: 'A repeatable list displayed as a table',
|
|
371
440
|
blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
|
|
372
441
|
blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
|
|
442
|
+
blockKindDesc_matrixScale: 'Rows are questions; columns are options or cell fields; every row shares one field type',
|
|
373
443
|
blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
|
|
374
444
|
blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
|
|
375
445
|
blockKindDesc_steps: 'Split the form into steps to guide users through it',
|
|
@@ -419,9 +489,38 @@ const locale = {
|
|
|
419
489
|
blockAddPosition_top: 'Title right (insert as first)',
|
|
420
490
|
blockAddPosition_both: 'Both',
|
|
421
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',
|
|
422
500
|
multiFieldType: 'Field Type',
|
|
423
501
|
multiFieldSummary: 'Field type: {type}',
|
|
424
502
|
multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
|
|
503
|
+
matrixScaleRowTitle: 'Row header title',
|
|
504
|
+
matrixScaleRowTitlePlaceholder: 'e.g. Activity',
|
|
505
|
+
matrixScaleLayout: 'Matrix layout',
|
|
506
|
+
matrixScaleLayout_options: 'Option matrix',
|
|
507
|
+
matrixScaleLayout_columns: 'Cell matrix',
|
|
508
|
+
matrixScaleLayout_field: 'One field per row',
|
|
509
|
+
matrixScaleRequired: 'Required for each row/cell',
|
|
510
|
+
matrixScaleSummary: '{type} · {layout} · {rows} rows',
|
|
511
|
+
matrixScaleEditorHint_options: 'Configure row labels and scale options; each row uses the same choice field.',
|
|
512
|
+
matrixScaleEditorHint_columns: 'Configure rows and columns; each cell uses the same field type (e.g. number, rate).',
|
|
513
|
+
matrixScaleEditorHint_field: 'Configure row labels only; each row shows one field without columns.',
|
|
514
|
+
matrixScaleRowsTitle: 'Rows',
|
|
515
|
+
matrixScaleRowsHint: 'Left is the row label; right is the data key',
|
|
516
|
+
matrixScaleRowLabelPlaceholder: 'e.g. Work / Study',
|
|
517
|
+
matrixScaleRowNamePlaceholder: 'e.g. work',
|
|
518
|
+
matrixScaleOptionsTitle: 'Scale options (columns)',
|
|
519
|
+
matrixScaleColumnsTitle: 'Columns',
|
|
520
|
+
matrixScaleColumnsHint: 'Left is the column label; right is the data key',
|
|
521
|
+
matrixScaleColumnLabelPlaceholder: 'e.g. Monday',
|
|
522
|
+
matrixScaleColumnNamePlaceholder: 'e.g. mon',
|
|
523
|
+
matrixScaleAddRow: 'Add row',
|
|
425
524
|
stepListTitle: 'Steps',
|
|
426
525
|
addStep: 'Add Step',
|
|
427
526
|
editStep: 'Edit Step',
|
|
@@ -445,6 +544,19 @@ const locale = {
|
|
|
445
544
|
FieldTypeSelect: 'Dropdown',
|
|
446
545
|
FieldTypeRadioGroup: 'Radio Group',
|
|
447
546
|
FieldTypeCheckboxGroup: 'Checkbox Group',
|
|
547
|
+
FieldTypeRadioGroupOther: 'Radio Group (with Other)',
|
|
548
|
+
FieldTypeCheckboxGroupOther: 'Checkbox Group (with Other)',
|
|
549
|
+
FieldTypeOtherOption: 'Other',
|
|
550
|
+
propChoiceModern: 'Modern style (indexed chips)',
|
|
551
|
+
propChoiceBlock: 'Block options (full-width stack)',
|
|
552
|
+
propChoiceIndexType: 'Index type',
|
|
553
|
+
propChoiceIndexTypeLetter: 'Letters A/B/C',
|
|
554
|
+
propChoiceIndexTypeNumber: 'Numbers 1/2/3',
|
|
555
|
+
propChoiceIndexTypeCheck: 'Checkmark (no index)',
|
|
556
|
+
propChoiceOtherLabel: '"Other" option label',
|
|
557
|
+
propChoiceOtherLabelHint: 'Default: Other',
|
|
558
|
+
propChoiceOtherPlaceholder: '"Other" textarea placeholder',
|
|
559
|
+
propChoiceOtherPlaceholderHint: 'Extra note when Other is selected',
|
|
448
560
|
FieldTypeSuperSelectList: 'Select List',
|
|
449
561
|
FieldTypeSuperSelectTableList: 'Table Select',
|
|
450
562
|
FieldTypeSuperSelectTree: 'Tree Select',
|
|
@@ -499,6 +611,25 @@ const locale = {
|
|
|
499
611
|
formActionsGapHint: 'Default: 16',
|
|
500
612
|
formActionsLayoutSection: 'Layout',
|
|
501
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',
|
|
502
633
|
optionLabelColumn: 'Option Label',
|
|
503
634
|
optionValueColumn: 'Option Value',
|
|
504
635
|
optionDescColumn: 'Option Description',
|
|
@@ -830,7 +961,7 @@ const createChoiceOption = (overrides = {}) => _extends({
|
|
|
830
961
|
blocks: []
|
|
831
962
|
}, overrides);
|
|
832
963
|
const createBlock = (kind, overrides = {}) => {
|
|
833
|
-
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
|
|
964
|
+
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale', 'object'].includes(kind);
|
|
834
965
|
const base = {
|
|
835
966
|
id: createFieldId(),
|
|
836
967
|
kind,
|
|
@@ -846,7 +977,12 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
846
977
|
addText: '',
|
|
847
978
|
maxLength: undefined,
|
|
848
979
|
minLength: undefined,
|
|
849
|
-
fieldType: 'Input',
|
|
980
|
+
fieldType: kind === 'matrixScale' ? 'RadioGroup' : 'Input',
|
|
981
|
+
layout: 'options',
|
|
982
|
+
rowTitle: '',
|
|
983
|
+
rule: '',
|
|
984
|
+
rows: [],
|
|
985
|
+
columns: [],
|
|
850
986
|
autoStep: true,
|
|
851
987
|
mode: 'single',
|
|
852
988
|
selectorName: '',
|
|
@@ -873,7 +1009,31 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
873
1009
|
itemBlocks: undefined,
|
|
874
1010
|
blocks: undefined,
|
|
875
1011
|
options: undefined,
|
|
876
|
-
items: undefined
|
|
1012
|
+
items: undefined,
|
|
1013
|
+
rows: undefined,
|
|
1014
|
+
columns: undefined,
|
|
1015
|
+
layout: undefined,
|
|
1016
|
+
rowTitle: undefined,
|
|
1017
|
+
rule: undefined
|
|
1018
|
+
}, overrides);
|
|
1019
|
+
}
|
|
1020
|
+
if (kind === 'matrixScale') {
|
|
1021
|
+
return _extends({}, base, {
|
|
1022
|
+
list: undefined,
|
|
1023
|
+
itemBlocks: undefined,
|
|
1024
|
+
blocks: undefined,
|
|
1025
|
+
items: undefined,
|
|
1026
|
+
fieldType: 'RadioGroup',
|
|
1027
|
+
layout: 'options',
|
|
1028
|
+
rows: [{
|
|
1029
|
+
label: '',
|
|
1030
|
+
name: createDataKey('row')
|
|
1031
|
+
}],
|
|
1032
|
+
options: [{
|
|
1033
|
+
label: '',
|
|
1034
|
+
value: ''
|
|
1035
|
+
}],
|
|
1036
|
+
columns: undefined
|
|
877
1037
|
}, overrides);
|
|
878
1038
|
}
|
|
879
1039
|
if (kind === 'choice') {
|
|
@@ -985,6 +1145,68 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
985
1145
|
normalized.itemBlocks = undefined;
|
|
986
1146
|
normalized.blocks = undefined;
|
|
987
1147
|
normalized.options = undefined;
|
|
1148
|
+
normalized.rows = undefined;
|
|
1149
|
+
normalized.columns = undefined;
|
|
1150
|
+
normalized.layout = undefined;
|
|
1151
|
+
normalized.rowTitle = undefined;
|
|
1152
|
+
normalized.rule = undefined;
|
|
1153
|
+
return normalized;
|
|
1154
|
+
}
|
|
1155
|
+
if (kind === 'matrixScale') {
|
|
1156
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
1157
|
+
normalized.list = undefined;
|
|
1158
|
+
normalized.items = undefined;
|
|
1159
|
+
normalized.itemBlocks = undefined;
|
|
1160
|
+
normalized.blocks = undefined;
|
|
1161
|
+
normalized.layout = layout;
|
|
1162
|
+
normalized.fieldType = block.fieldType || 'RadioGroup';
|
|
1163
|
+
normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
|
|
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
|
+
} : {};
|
|
1169
|
+
normalized.rows = Array.isArray(block.rows) ? block.rows.map(row => {
|
|
1170
|
+
var _row$label;
|
|
1171
|
+
return _extends({}, keepKey(row), {
|
|
1172
|
+
label: (_row$label = row == null ? void 0 : row.label) != null ? _row$label : '',
|
|
1173
|
+
name: String((row == null ? void 0 : row.name) || '').trim() || createDataKey('row')
|
|
1174
|
+
});
|
|
1175
|
+
}).filter(row => String(row.label || '').trim() || String(row.name || '').trim()) : [];
|
|
1176
|
+
if (!normalized.rows.length) {
|
|
1177
|
+
normalized.rows = [{
|
|
1178
|
+
label: '',
|
|
1179
|
+
name: createDataKey('row')
|
|
1180
|
+
}];
|
|
1181
|
+
}
|
|
1182
|
+
if (layout === '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
|
+
}) : [];
|
|
1190
|
+
normalized.columns = undefined;
|
|
1191
|
+
} else if (layout === 'columns') {
|
|
1192
|
+
normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => {
|
|
1193
|
+
var _ref, _column$label;
|
|
1194
|
+
return _extends({}, keepKey(column), {
|
|
1195
|
+
label: (_ref = (_column$label = column == null ? void 0 : column.label) != null ? _column$label : column == null ? void 0 : column.title) != null ? _ref : '',
|
|
1196
|
+
name: String((column == null ? void 0 : column.name) || '').trim() || createDataKey('col')
|
|
1197
|
+
});
|
|
1198
|
+
}).filter(column => String(column.label || '').trim() || String(column.name || '').trim()) : [];
|
|
1199
|
+
if (!normalized.columns.length) {
|
|
1200
|
+
normalized.columns = [{
|
|
1201
|
+
label: '',
|
|
1202
|
+
name: createDataKey('col')
|
|
1203
|
+
}];
|
|
1204
|
+
}
|
|
1205
|
+
normalized.options = undefined;
|
|
1206
|
+
} else {
|
|
1207
|
+
normalized.options = undefined;
|
|
1208
|
+
normalized.columns = undefined;
|
|
1209
|
+
}
|
|
988
1210
|
return normalized;
|
|
989
1211
|
}
|
|
990
1212
|
if (kind === 'choice') {
|
|
@@ -1074,16 +1296,23 @@ const blockHasLockedField = block => {
|
|
|
1074
1296
|
};
|
|
1075
1297
|
|
|
1076
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' 移动一位;数字为目标下标(拖拽排序) */
|
|
1077
1309
|
const moveItem = (list, id, direction, isFixed = isFieldLocked) => {
|
|
1078
1310
|
const index = list.findIndex(item => item.id === id);
|
|
1079
1311
|
if (index < 0) {
|
|
1080
1312
|
return list;
|
|
1081
1313
|
}
|
|
1082
|
-
const targetIndex = direction === 'up' ? index - 1 : index + 1;
|
|
1083
|
-
if (
|
|
1084
|
-
return list;
|
|
1085
|
-
}
|
|
1086
|
-
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)) {
|
|
1087
1316
|
return list;
|
|
1088
1317
|
}
|
|
1089
1318
|
const next = [...list];
|
|
@@ -1116,7 +1345,7 @@ const collectFieldsFromBlocks = (blocks = [], acc = []) => {
|
|
|
1116
1345
|
});
|
|
1117
1346
|
return;
|
|
1118
1347
|
}
|
|
1119
|
-
if (block.kind !== 'multiField' && Array.isArray(block.list)) {
|
|
1348
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale' && Array.isArray(block.list)) {
|
|
1120
1349
|
acc.push(...block.list);
|
|
1121
1350
|
}
|
|
1122
1351
|
if (Array.isArray(block.itemBlocks)) {
|
|
@@ -1161,7 +1390,7 @@ const collectSchemaFields = (schema, {
|
|
|
1161
1390
|
});
|
|
1162
1391
|
return fields;
|
|
1163
1392
|
}
|
|
1164
|
-
if (block.kind !== 'multiField') {
|
|
1393
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1165
1394
|
fields.push(...(block.list || []));
|
|
1166
1395
|
}
|
|
1167
1396
|
return fields;
|
|
@@ -1209,7 +1438,7 @@ const collectBlockFieldNames = (blocks = [], {
|
|
|
1209
1438
|
});
|
|
1210
1439
|
return;
|
|
1211
1440
|
}
|
|
1212
|
-
if (block.kind !== 'multiField') {
|
|
1441
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1213
1442
|
(block.list || []).forEach(field => {
|
|
1214
1443
|
if (field != null && field.name) {
|
|
1215
1444
|
names.push(prefix ? `${prefix}.${field.name}` : field.name);
|
|
@@ -1412,7 +1641,7 @@ const blockHasContent = block => {
|
|
|
1412
1641
|
if (block.kind === 'steps') {
|
|
1413
1642
|
return (block.items || []).some(step => (step.list || []).length > 0 || (step.blocks || []).some(blockHasContent) || step.title);
|
|
1414
1643
|
}
|
|
1415
|
-
if (block.kind === 'multiField') {
|
|
1644
|
+
if (block.kind === 'multiField' || block.kind === 'matrixScale') {
|
|
1416
1645
|
return !!block.name;
|
|
1417
1646
|
}
|
|
1418
1647
|
if (block.kind === 'choice') {
|
|
@@ -1465,6 +1694,12 @@ const BLOCK_KINDS = {
|
|
|
1465
1694
|
requiresName: true,
|
|
1466
1695
|
descriptionId: 'blockKindDesc_multiField'
|
|
1467
1696
|
},
|
|
1697
|
+
matrixScale: {
|
|
1698
|
+
labelId: 'blockKind_matrixScale',
|
|
1699
|
+
color: 'volcano',
|
|
1700
|
+
requiresName: true,
|
|
1701
|
+
descriptionId: 'blockKindDesc_matrixScale'
|
|
1702
|
+
},
|
|
1468
1703
|
object: {
|
|
1469
1704
|
labelId: 'blockKind_object',
|
|
1470
1705
|
color: 'orange',
|
|
@@ -1488,6 +1723,12 @@ const BLOCK_KINDS = {
|
|
|
1488
1723
|
|
|
1489
1724
|
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1490
1725
|
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1726
|
+
|
|
1727
|
+
/** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
|
|
1728
|
+
const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
|
|
1729
|
+
|
|
1730
|
+
/** steps 导航样式:default 为 antd 完整步骤条;focus 突出当前步骤标题,其余收成序号 */
|
|
1731
|
+
const STEPS_STYLES = ['default', 'focus'];
|
|
1491
1732
|
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1492
1733
|
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1493
1734
|
id: config.labelId
|
|
@@ -1512,8 +1753,12 @@ const blockToFormValues = block => {
|
|
|
1512
1753
|
maxLength: (_block$maxLength = block.maxLength) != null ? _block$maxLength : null,
|
|
1513
1754
|
minLength: (_block$minLength = block.minLength) != null ? _block$minLength : null,
|
|
1514
1755
|
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1515
|
-
fieldType: block.fieldType || 'Input',
|
|
1756
|
+
fieldType: block.fieldType || (block.kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1757
|
+
layout: MATRIX_LAYOUTS.includes(block.layout) ? block.layout : 'options',
|
|
1758
|
+
rowTitle: block.rowTitle || '',
|
|
1759
|
+
required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
|
|
1516
1760
|
autoStep: block.autoStep !== false,
|
|
1761
|
+
stepsStyle: STEPS_STYLES.includes(block.stepsStyle) ? block.stepsStyle : 'default',
|
|
1517
1762
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
1518
1763
|
selectorName: block.selectorName || '',
|
|
1519
1764
|
selectorInData: block.selectorInData !== false
|
|
@@ -1538,12 +1783,45 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1538
1783
|
maxLength: (_values$maxLength = values.maxLength) != null ? _values$maxLength : undefined,
|
|
1539
1784
|
minLength: (_values$minLength = values.minLength) != null ? _values$minLength : undefined,
|
|
1540
1785
|
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1541
|
-
fieldType: values.fieldType || 'Input',
|
|
1786
|
+
fieldType: values.fieldType || (kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1542
1787
|
autoStep: values.autoStep !== false,
|
|
1788
|
+
stepsStyle: kind === 'steps' && STEPS_STYLES.includes(values.stepsStyle) && values.stepsStyle !== 'default' ? values.stepsStyle : undefined,
|
|
1543
1789
|
mode,
|
|
1544
1790
|
selectorName: values.selectorName || '',
|
|
1545
1791
|
selectorInData: values.selectorInData !== false
|
|
1546
1792
|
});
|
|
1793
|
+
if (kind === 'matrixScale') {
|
|
1794
|
+
const layout = MATRIX_LAYOUTS.includes(values.layout) ? values.layout : 'options';
|
|
1795
|
+
next.layout = layout;
|
|
1796
|
+
next.rowTitle = values.rowTitle || undefined;
|
|
1797
|
+
next.rule = values.required ? 'REQ' : undefined;
|
|
1798
|
+
if (layout === 'options') {
|
|
1799
|
+
next.columns = undefined;
|
|
1800
|
+
if (!Array.isArray(next.options) || !next.options.length) {
|
|
1801
|
+
next.options = [{
|
|
1802
|
+
label: '',
|
|
1803
|
+
value: ''
|
|
1804
|
+
}];
|
|
1805
|
+
}
|
|
1806
|
+
} else if (layout === 'columns') {
|
|
1807
|
+
next.options = undefined;
|
|
1808
|
+
if (!Array.isArray(next.columns) || !next.columns.length) {
|
|
1809
|
+
next.columns = [{
|
|
1810
|
+
label: '',
|
|
1811
|
+
name: createDataKey('col')
|
|
1812
|
+
}];
|
|
1813
|
+
}
|
|
1814
|
+
} else {
|
|
1815
|
+
next.options = undefined;
|
|
1816
|
+
next.columns = undefined;
|
|
1817
|
+
}
|
|
1818
|
+
if (!Array.isArray(next.rows) || !next.rows.length) {
|
|
1819
|
+
next.rows = [{
|
|
1820
|
+
label: '',
|
|
1821
|
+
name: createDataKey('row')
|
|
1822
|
+
}];
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1547
1825
|
if (kind === 'choice' && mode !== 'multiple') {
|
|
1548
1826
|
next.minLength = undefined;
|
|
1549
1827
|
next.maxLength = undefined;
|
|
@@ -1571,7 +1849,7 @@ const formValuesToChoiceOption = (values, existingOption = {}) => _extends({}, e
|
|
|
1571
1849
|
title: values.title
|
|
1572
1850
|
});
|
|
1573
1851
|
|
|
1574
|
-
const _excluded$
|
|
1852
|
+
const _excluded$6 = ["children"];
|
|
1575
1853
|
const mapOptionItem = item => {
|
|
1576
1854
|
if (!item || typeof item !== 'object') {
|
|
1577
1855
|
return item;
|
|
@@ -1579,7 +1857,7 @@ const mapOptionItem = item => {
|
|
|
1579
1857
|
const {
|
|
1580
1858
|
children
|
|
1581
1859
|
} = item,
|
|
1582
|
-
rest = _objectWithoutPropertiesLoose(item, _excluded$
|
|
1860
|
+
rest = _objectWithoutPropertiesLoose(item, _excluded$6);
|
|
1583
1861
|
const next = _extends({}, rest);
|
|
1584
1862
|
if (Array.isArray(children) && children.length) {
|
|
1585
1863
|
next.children = children.map(mapOptionItem);
|
|
@@ -1667,7 +1945,7 @@ const createApiFromOptions = (options = []) => ({
|
|
|
1667
1945
|
})
|
|
1668
1946
|
});
|
|
1669
1947
|
|
|
1670
|
-
const _excluded$
|
|
1948
|
+
const _excluded$5 = ["options", "api", "placeholder"];
|
|
1671
1949
|
const {
|
|
1672
1950
|
useOnChange: useOnChange$2
|
|
1673
1951
|
} = hooks;
|
|
@@ -1686,7 +1964,7 @@ const createField = (Component, {
|
|
|
1686
1964
|
api,
|
|
1687
1965
|
placeholder
|
|
1688
1966
|
} = props,
|
|
1689
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$
|
|
1967
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
1690
1968
|
const valueKey = rest.valueKey || 'value';
|
|
1691
1969
|
const labelKey = rest.labelKey || 'label';
|
|
1692
1970
|
const parentKey = rest.parentKey || 'parentId';
|
|
@@ -1814,14 +2092,25 @@ const NO_VALUE_OPERATORS = ['empty', 'notEmpty'];
|
|
|
1814
2092
|
const ALLOWED_REGEX_FLAGS = ['i', 'm', 's', 'u'];
|
|
1815
2093
|
|
|
1816
2094
|
// 列表类模块内的字段会重复出现,单个 name 定位不到具体条目,不参与条件
|
|
1817
|
-
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField'];
|
|
2095
|
+
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale'];
|
|
1818
2096
|
const getByPath$2 = (data, path) => {
|
|
1819
2097
|
if (data == null || path == null || path === '') {
|
|
1820
2098
|
return undefined;
|
|
1821
2099
|
}
|
|
1822
2100
|
return String(path).split('.').reduce((current, key) => current == null ? undefined : current[key], data);
|
|
1823
2101
|
};
|
|
1824
|
-
|
|
2102
|
+
|
|
2103
|
+
/** RadioGroupOther / CheckboxGroupOther 提交值为 { value, other? },比较前先取 value */
|
|
2104
|
+
const unwrapChoiceOtherValue = value => {
|
|
2105
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && Object.prototype.hasOwnProperty.call(value, 'other') && Object.prototype.hasOwnProperty.call(value, 'value')) {
|
|
2106
|
+
return value.value;
|
|
2107
|
+
}
|
|
2108
|
+
return value;
|
|
2109
|
+
};
|
|
2110
|
+
const isEmptyValue$1 = value => {
|
|
2111
|
+
const next = unwrapChoiceOtherValue(value);
|
|
2112
|
+
return next === undefined || next === null || next === '' || Array.isArray(next) && next.length === 0;
|
|
2113
|
+
};
|
|
1825
2114
|
|
|
1826
2115
|
// SuperSelect 等字段的值是 { label, value } 对象,比较时统一取 value
|
|
1827
2116
|
const toComparable = item => {
|
|
@@ -1869,7 +2158,7 @@ const evaluateCondition = (condition, formData) => {
|
|
|
1869
2158
|
if (!(condition != null && condition.field) || !CONDITION_OPERATORS.includes(condition.operator)) {
|
|
1870
2159
|
return null;
|
|
1871
2160
|
}
|
|
1872
|
-
const actual = getByPath$2(formData, condition.field);
|
|
2161
|
+
const actual = unwrapChoiceOtherValue(getByPath$2(formData, condition.field));
|
|
1873
2162
|
const expected = condition.value;
|
|
1874
2163
|
switch (condition.operator) {
|
|
1875
2164
|
case 'empty':
|
|
@@ -2145,7 +2434,7 @@ const renameConditionReferences = (schema, oldPath, newPath) => {
|
|
|
2145
2434
|
*/
|
|
2146
2435
|
const getConditionValueKind = (field, definition) => {
|
|
2147
2436
|
const props = (field == null ? void 0 : field.props) || {};
|
|
2148
|
-
if ((field == null ? void 0 : field.type) === 'CheckboxGroup' || definition != null && definition.isSuperSelect || (field == null ? void 0 : field.type) === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
|
|
2437
|
+
if ((field == null ? void 0 : field.type) === 'CheckboxGroup' || (field == null ? void 0 : field.type) === 'CheckboxGroupOther' || definition != null && definition.isSuperSelect || (field == null ? void 0 : field.type) === 'Select' && (props.mode === 'multiple' || props.mode === 'tags')) {
|
|
2149
2438
|
return 'multiOptions';
|
|
2150
2439
|
}
|
|
2151
2440
|
if (definition != null && definition.hasOptions) {
|
|
@@ -2222,6 +2511,16 @@ const formatVisibleWhen = (visibleWhen, {
|
|
|
2222
2511
|
if (option) {
|
|
2223
2512
|
return _resolveText(option.label);
|
|
2224
2513
|
}
|
|
2514
|
+
if ((trigger == null ? void 0 : trigger.type) === 'RadioGroupOther' || (trigger == null ? void 0 : trigger.type) === 'CheckboxGroupOther') {
|
|
2515
|
+
var _trigger$props2;
|
|
2516
|
+
const otherValue = (trigger == null || (_trigger$props2 = trigger.props) == null || (_trigger$props2 = _trigger$props2.otherOption) == null ? void 0 : _trigger$props2.value) != null && String(trigger.props.otherOption.value).trim() ? String(trigger.props.otherOption.value).trim() : 'other';
|
|
2517
|
+
if (sameValue(otherValue, value)) {
|
|
2518
|
+
var _trigger$props3;
|
|
2519
|
+
return _resolveText(trigger == null || (_trigger$props3 = trigger.props) == null || (_trigger$props3 = _trigger$props3.otherOption) == null ? void 0 : _trigger$props3.label) || formatMessage({
|
|
2520
|
+
id: 'FieldTypeOtherOption'
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2225
2524
|
if (typeof value === 'boolean') {
|
|
2226
2525
|
return formatMessage({
|
|
2227
2526
|
id: value ? 'conditionValueTrue' : 'conditionValueFalse'
|
|
@@ -2253,7 +2552,7 @@ const FIELD_GROUPS = [{
|
|
|
2253
2552
|
types: ['Input', 'TextArea', 'InputNumber', 'Switch', 'Checkbox', 'DatePicker']
|
|
2254
2553
|
}, {
|
|
2255
2554
|
labelId: 'FieldGroupSelect',
|
|
2256
|
-
types: ['Select', 'RadioGroup', 'CheckboxGroup']
|
|
2555
|
+
types: ['Select', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther']
|
|
2257
2556
|
}, {
|
|
2258
2557
|
labelId: 'FieldGroupAdvancedSelect',
|
|
2259
2558
|
types: ['SuperSelectList', 'SuperSelectTableList', 'SuperSelectTree', 'SuperSelectCascader']
|
|
@@ -2409,6 +2708,97 @@ defineField('CheckboxGroup', {
|
|
|
2409
2708
|
};
|
|
2410
2709
|
}
|
|
2411
2710
|
});
|
|
2711
|
+
const resolveOtherOptionValue = field => {
|
|
2712
|
+
var _field$props6;
|
|
2713
|
+
const raw = field == null || (_field$props6 = field.props) == null || (_field$props6 = _field$props6.otherOption) == null ? void 0 : _field$props6.value;
|
|
2714
|
+
return raw != null && String(raw).trim() ? String(raw).trim() : 'other';
|
|
2715
|
+
};
|
|
2716
|
+
const choiceOtherEnums = field => {
|
|
2717
|
+
const enums = optionEnumValues(field) || [];
|
|
2718
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2719
|
+
return enums.includes(otherValue) ? enums : [...enums, otherValue];
|
|
2720
|
+
};
|
|
2721
|
+
const choiceOtherValueSchema = (field, multiple) => {
|
|
2722
|
+
const enums = choiceOtherEnums(field);
|
|
2723
|
+
const selected = multiple ? {
|
|
2724
|
+
type: 'array',
|
|
2725
|
+
items: {
|
|
2726
|
+
type: 'string',
|
|
2727
|
+
enum: enums
|
|
2728
|
+
}
|
|
2729
|
+
} : {
|
|
2730
|
+
type: 'string',
|
|
2731
|
+
enum: enums
|
|
2732
|
+
};
|
|
2733
|
+
return {
|
|
2734
|
+
type: 'object',
|
|
2735
|
+
properties: {
|
|
2736
|
+
value: selected,
|
|
2737
|
+
other: {
|
|
2738
|
+
type: 'string'
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
};
|
|
2742
|
+
};
|
|
2743
|
+
const formatChoiceOtherDisplay = (value, field, {
|
|
2744
|
+
formatMessage
|
|
2745
|
+
} = {}) => {
|
|
2746
|
+
var _field$props7, _field$props8;
|
|
2747
|
+
if (value == null || typeof value !== 'object') {
|
|
2748
|
+
return '';
|
|
2749
|
+
}
|
|
2750
|
+
const options = field == null || (_field$props7 = field.props) == null ? void 0 : _field$props7.options;
|
|
2751
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2752
|
+
const otherFallback = resolveLocaleText(field == null || (_field$props8 = field.props) == null || (_field$props8 = _field$props8.otherOption) == null ? void 0 : _field$props8.label) || (formatMessage == null ? void 0 : formatMessage({
|
|
2753
|
+
id: 'FieldTypeOtherOption'
|
|
2754
|
+
})) || '其他';
|
|
2755
|
+
const mapOne = item => {
|
|
2756
|
+
if (item === otherValue) {
|
|
2757
|
+
return otherFallback;
|
|
2758
|
+
}
|
|
2759
|
+
if (!Array.isArray(options) || !options.length) {
|
|
2760
|
+
return item == null ? '' : String(item);
|
|
2761
|
+
}
|
|
2762
|
+
const match = options.find(opt => opt && opt.value === item);
|
|
2763
|
+
if ((match == null ? void 0 : match.label) != null) {
|
|
2764
|
+
return resolveLocaleText(match.label) || String(match.label);
|
|
2765
|
+
}
|
|
2766
|
+
return item == null ? '' : String(item);
|
|
2767
|
+
};
|
|
2768
|
+
const selected = Array.isArray(value.value) ? value.value.map(mapOne).filter(Boolean).join('、') : mapOne(value.value);
|
|
2769
|
+
const otherText = value.other != null && String(value.other).trim() ? String(value.other).trim() : '';
|
|
2770
|
+
if (selected && otherText) {
|
|
2771
|
+
return `${selected}(${otherFallback}: ${otherText})`;
|
|
2772
|
+
}
|
|
2773
|
+
if (otherText) {
|
|
2774
|
+
return `${otherFallback}: ${otherText}`;
|
|
2775
|
+
}
|
|
2776
|
+
return selected;
|
|
2777
|
+
};
|
|
2778
|
+
defineField('RadioGroupOther', {
|
|
2779
|
+
labelId: 'FieldTypeRadioGroupOther',
|
|
2780
|
+
component: RadioGroupOther,
|
|
2781
|
+
defaultProps: {
|
|
2782
|
+
options: [],
|
|
2783
|
+
inline: true
|
|
2784
|
+
},
|
|
2785
|
+
hasOptions: true,
|
|
2786
|
+
hasFieldProps: true,
|
|
2787
|
+
valueSchema: field => choiceOtherValueSchema(field, false),
|
|
2788
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2789
|
+
});
|
|
2790
|
+
defineField('CheckboxGroupOther', {
|
|
2791
|
+
labelId: 'FieldTypeCheckboxGroupOther',
|
|
2792
|
+
component: CheckboxGroupOther,
|
|
2793
|
+
defaultProps: {
|
|
2794
|
+
options: [],
|
|
2795
|
+
inline: true
|
|
2796
|
+
},
|
|
2797
|
+
hasOptions: true,
|
|
2798
|
+
hasFieldProps: true,
|
|
2799
|
+
valueSchema: field => choiceOtherValueSchema(field, true),
|
|
2800
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2801
|
+
});
|
|
2412
2802
|
defineField('SuperSelectList', {
|
|
2413
2803
|
labelId: 'FieldTypeSuperSelectList',
|
|
2414
2804
|
component: SuperSelectList,
|
|
@@ -2867,7 +3257,7 @@ const setOptionalString = (props, key, value) => {
|
|
|
2867
3257
|
}
|
|
2868
3258
|
};
|
|
2869
3259
|
const pickFieldProps = (field, definition) => {
|
|
2870
|
-
var _props$rows, _definition$propsSche;
|
|
3260
|
+
var _props$rows, _props$otherOption, _props$otherProps, _definition$propsSche;
|
|
2871
3261
|
const props = field.props || {};
|
|
2872
3262
|
const type = (definition == null ? void 0 : definition.type) || field.type;
|
|
2873
3263
|
switch (type) {
|
|
@@ -2918,8 +3308,15 @@ const pickFieldProps = (field, definition) => {
|
|
|
2918
3308
|
};
|
|
2919
3309
|
case 'RadioGroup':
|
|
2920
3310
|
case 'CheckboxGroup':
|
|
3311
|
+
case 'RadioGroupOther':
|
|
3312
|
+
case 'CheckboxGroupOther':
|
|
2921
3313
|
return {
|
|
2922
|
-
inline: props.inline !== false
|
|
3314
|
+
inline: props.inline !== false,
|
|
3315
|
+
modern: !!props.modern,
|
|
3316
|
+
block: !!props.block,
|
|
3317
|
+
indexType: props.indexType === 'number' || props.indexType === 'check' ? props.indexType : 'letter',
|
|
3318
|
+
otherLabel: ((_props$otherOption = props.otherOption) == null ? void 0 : _props$otherOption.label) || '',
|
|
3319
|
+
otherPlaceholder: ((_props$otherProps = props.otherProps) == null ? void 0 : _props$otherProps.placeholder) || ''
|
|
2923
3320
|
};
|
|
2924
3321
|
default:
|
|
2925
3322
|
if (definition != null && (_definition$propsSche = definition.propsSchema) != null && _definition$propsSche.length) {
|
|
@@ -2994,8 +3391,49 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2994
3391
|
break;
|
|
2995
3392
|
case 'RadioGroup':
|
|
2996
3393
|
case 'CheckboxGroup':
|
|
3394
|
+
case 'RadioGroupOther':
|
|
3395
|
+
case 'CheckboxGroupOther':
|
|
2997
3396
|
// 始终落盘布尔值,避免 Checkbox 未勾选时字段缺失被当成默认横向
|
|
2998
3397
|
props.inline = values.inline !== false;
|
|
3398
|
+
props.modern = !!values.modern;
|
|
3399
|
+
props.block = !!values.block;
|
|
3400
|
+
if (values.modern && (values.indexType === 'number' || values.indexType === 'check')) {
|
|
3401
|
+
props.indexType = values.indexType;
|
|
3402
|
+
} else {
|
|
3403
|
+
delete props.indexType;
|
|
3404
|
+
}
|
|
3405
|
+
if (!props.modern) {
|
|
3406
|
+
delete props.indexType;
|
|
3407
|
+
}
|
|
3408
|
+
if (type === 'RadioGroupOther' || type === 'CheckboxGroupOther') {
|
|
3409
|
+
if (hasLocaleText(values.otherLabel)) {
|
|
3410
|
+
var _props$otherOption2;
|
|
3411
|
+
props.otherOption = _extends({}, props.otherOption && typeof props.otherOption === 'object' ? props.otherOption : {}, {
|
|
3412
|
+
label: trimLocaleText(values.otherLabel),
|
|
3413
|
+
value: ((_props$otherOption2 = props.otherOption) == null ? void 0 : _props$otherOption2.value) || 'other'
|
|
3414
|
+
});
|
|
3415
|
+
} else {
|
|
3416
|
+
delete props.otherOption;
|
|
3417
|
+
}
|
|
3418
|
+
if (hasLocaleText(values.otherPlaceholder)) {
|
|
3419
|
+
props.otherProps = _extends({}, props.otherProps && typeof props.otherProps === 'object' ? props.otherProps : {}, {
|
|
3420
|
+
placeholder: trimLocaleText(values.otherPlaceholder)
|
|
3421
|
+
});
|
|
3422
|
+
} else if (props.otherProps && typeof props.otherProps === 'object') {
|
|
3423
|
+
const nextOtherProps = _extends({}, props.otherProps);
|
|
3424
|
+
delete nextOtherProps.placeholder;
|
|
3425
|
+
if (Object.keys(nextOtherProps).length) {
|
|
3426
|
+
props.otherProps = nextOtherProps;
|
|
3427
|
+
} else {
|
|
3428
|
+
delete props.otherProps;
|
|
3429
|
+
}
|
|
3430
|
+
} else {
|
|
3431
|
+
delete props.otherProps;
|
|
3432
|
+
}
|
|
3433
|
+
} else {
|
|
3434
|
+
delete props.otherOption;
|
|
3435
|
+
delete props.otherProps;
|
|
3436
|
+
}
|
|
2999
3437
|
break;
|
|
3000
3438
|
default:
|
|
3001
3439
|
if (definition != null && (_definition$propsSche2 = definition.propsSchema) != null && _definition$propsSche2.length) {
|
|
@@ -3005,16 +3443,16 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
3005
3443
|
}
|
|
3006
3444
|
};
|
|
3007
3445
|
const fieldToFormValues = field => {
|
|
3008
|
-
var _field$
|
|
3446
|
+
var _field$props9, _field$props0, _field$props1;
|
|
3009
3447
|
const definition = getFieldDefinition(field.type);
|
|
3010
3448
|
const ruleConfig = parseRuleString(field.rule);
|
|
3011
3449
|
const allowChildren = !!(definition != null && definition.optionsAllowChildren);
|
|
3012
|
-
const columns = definition != null && definition.hasColumns ? normalizeColumns((_field$
|
|
3013
|
-
const options = normalizeOptions((_field$
|
|
3450
|
+
const columns = definition != null && definition.hasColumns ? normalizeColumns((_field$props9 = field.props) == null ? void 0 : _field$props9.columns) : [];
|
|
3451
|
+
const options = normalizeOptions((_field$props0 = field.props) == null ? void 0 : _field$props0.options, {
|
|
3014
3452
|
allowChildren,
|
|
3015
3453
|
columns
|
|
3016
3454
|
});
|
|
3017
|
-
const rawPlaceholder = (_field$
|
|
3455
|
+
const rawPlaceholder = (_field$props1 = field.props) == null ? void 0 : _field$props1.placeholder;
|
|
3018
3456
|
const placeholder = Array.isArray(rawPlaceholder) ? rawPlaceholder[0] || '' : rawPlaceholder || '';
|
|
3019
3457
|
return {
|
|
3020
3458
|
type: field.type,
|
|
@@ -3080,6 +3518,78 @@ const formValuesToField = (values, existingField = {}) => {
|
|
|
3080
3518
|
});
|
|
3081
3519
|
};
|
|
3082
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
|
+
|
|
3083
3593
|
const {
|
|
3084
3594
|
useOnChange: useOnChange$1
|
|
3085
3595
|
} = hooks;
|
|
@@ -3176,6 +3686,7 @@ const LocaleTextArea = props => {
|
|
|
3176
3686
|
};
|
|
3177
3687
|
LocaleTextArea.field = LocaleTextAreaControl;
|
|
3178
3688
|
|
|
3689
|
+
const _excluded$4 = ["field", "index", "total", "onEdit", "onDelete", "onMove", "prevLocked", "nextLocked", "conditionContext", "dragHandleProps", "isMobile", "className"];
|
|
3179
3690
|
const {
|
|
3180
3691
|
Text: Text$5
|
|
3181
3692
|
} = Typography;
|
|
@@ -3186,6 +3697,8 @@ const TYPE_TAG_COLORS = {
|
|
|
3186
3697
|
Select: 'geekblue',
|
|
3187
3698
|
RadioGroup: 'purple',
|
|
3188
3699
|
CheckboxGroup: 'purple',
|
|
3700
|
+
RadioGroupOther: 'purple',
|
|
3701
|
+
CheckboxGroupOther: 'purple',
|
|
3189
3702
|
SuperSelectList: 'gold',
|
|
3190
3703
|
SuperSelectTableList: 'gold',
|
|
3191
3704
|
SuperSelectTree: 'gold',
|
|
@@ -3204,6 +3717,8 @@ const TYPE_TAG_ICONS = {
|
|
|
3204
3717
|
Select: DownSquareOutlined,
|
|
3205
3718
|
RadioGroup: CheckCircleOutlined,
|
|
3206
3719
|
CheckboxGroup: CheckSquareOutlined,
|
|
3720
|
+
RadioGroupOther: CheckCircleOutlined,
|
|
3721
|
+
CheckboxGroupOther: CheckSquareOutlined,
|
|
3207
3722
|
SuperSelectList: AppstoreOutlined,
|
|
3208
3723
|
SuperSelectTableList: AppstoreOutlined,
|
|
3209
3724
|
SuperSelectTree: AppstoreOutlined,
|
|
@@ -3216,17 +3731,22 @@ const TYPE_TAG_ICONS = {
|
|
|
3216
3731
|
DatePicker: CalendarOutlined
|
|
3217
3732
|
};
|
|
3218
3733
|
const getFieldTypeIcon = type => TYPE_TAG_ICONS[type] || FormOutlined;
|
|
3219
|
-
const FieldRow =
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
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);
|
|
3230
3750
|
const {
|
|
3231
3751
|
formatMessage,
|
|
3232
3752
|
locale
|
|
@@ -3236,15 +3756,34 @@ const FieldRow = ({
|
|
|
3236
3756
|
const conditional = hasVisibleWhen(field);
|
|
3237
3757
|
const conditionInvalid = conditional && conditionContext && hasInvalidCondition(field, conditionContext.triggerNames);
|
|
3238
3758
|
const TypeIcon = getFieldTypeIcon(field.type);
|
|
3239
|
-
return /*#__PURE__*/jsxs("div", {
|
|
3240
|
-
className: style['field-row'],
|
|
3241
|
-
children: [/*#__PURE__*/
|
|
3242
|
-
className: style['field-row-index'],
|
|
3243
|
-
children:
|
|
3244
|
-
|
|
3245
|
-
|
|
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, {
|
|
3246
3786
|
children: [/*#__PURE__*/jsx(Text$5, {
|
|
3247
|
-
strong: true,
|
|
3248
3787
|
className: style['field-row-label'],
|
|
3249
3788
|
children: resolveLocaleText(field.label, locale, languages) || formatMessage({
|
|
3250
3789
|
id: 'untitledField'
|
|
@@ -3307,76 +3846,363 @@ const FieldRow = ({
|
|
|
3307
3846
|
})
|
|
3308
3847
|
}) : null]
|
|
3309
3848
|
})]
|
|
3310
|
-
}), field.locked ? null : /*#__PURE__*/
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
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({
|
|
3317
3857
|
id: 'moveUp'
|
|
3318
3858
|
}),
|
|
3319
3859
|
icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
|
|
3320
3860
|
disabled: index === 0 || prevLocked,
|
|
3321
3861
|
onClick: () => onMove(field.id, 'up')
|
|
3322
|
-
}
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
className: style['action-btn'],
|
|
3326
|
-
title: formatMessage({
|
|
3862
|
+
}, {
|
|
3863
|
+
key: 'down',
|
|
3864
|
+
label: formatMessage({
|
|
3327
3865
|
id: 'moveDown'
|
|
3328
3866
|
}),
|
|
3329
3867
|
icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
|
|
3330
3868
|
disabled: index === total - 1 || nextLocked,
|
|
3331
3869
|
onClick: () => onMove(field.id, 'down')
|
|
3332
|
-
}
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
className: style['action-btn'],
|
|
3336
|
-
title: formatMessage({
|
|
3870
|
+
}, {
|
|
3871
|
+
key: 'edit',
|
|
3872
|
+
label: formatMessage({
|
|
3337
3873
|
id: 'editField'
|
|
3338
3874
|
}),
|
|
3339
3875
|
icon: /*#__PURE__*/jsx(EditOutlined, {}),
|
|
3340
3876
|
onClick: () => onEdit(field)
|
|
3341
|
-
}
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
danger: true,
|
|
3345
|
-
className: style['action-btn'],
|
|
3346
|
-
title: formatMessage({
|
|
3877
|
+
}, {
|
|
3878
|
+
key: 'delete',
|
|
3879
|
+
label: formatMessage({
|
|
3347
3880
|
id: 'deleteField'
|
|
3348
3881
|
}),
|
|
3349
3882
|
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
3883
|
+
danger: true,
|
|
3350
3884
|
onClick: () => onDelete(field.id)
|
|
3351
|
-
})
|
|
3885
|
+
}])
|
|
3352
3886
|
})]
|
|
3353
|
-
});
|
|
3887
|
+
}));
|
|
3354
3888
|
};
|
|
3355
3889
|
|
|
3356
|
-
const _excluded$3 = ["title", "danger"];
|
|
3357
3890
|
const {
|
|
3358
|
-
Text: Text$4
|
|
3891
|
+
Text: Text$4,
|
|
3892
|
+
Title
|
|
3359
3893
|
} = Typography;
|
|
3360
|
-
const
|
|
3894
|
+
const createRowKey = () => createDataKey('mrow');
|
|
3895
|
+
const createColKey = () => createDataKey('mcol');
|
|
3896
|
+
const createOptKey = () => createDataKey('mopt');
|
|
3897
|
+
const createEmptyMatrixRow = () => ({
|
|
3898
|
+
_key: createRowKey(),
|
|
3899
|
+
label: '',
|
|
3900
|
+
name: createDataKey('row')
|
|
3901
|
+
});
|
|
3902
|
+
const createEmptyMatrixColumn = () => ({
|
|
3903
|
+
_key: createColKey(),
|
|
3904
|
+
label: '',
|
|
3905
|
+
name: createDataKey('col')
|
|
3906
|
+
});
|
|
3907
|
+
const createEmptyMatrixOption = () => ({
|
|
3908
|
+
_key: createOptKey(),
|
|
3909
|
+
label: '',
|
|
3910
|
+
value: ''
|
|
3911
|
+
});
|
|
3912
|
+
const ensureKeys = (list = [], createKey) => list.map(item => _extends({}, item, {
|
|
3913
|
+
_key: item._key || createKey()
|
|
3914
|
+
}));
|
|
3915
|
+
const hasMissingKey = (list = []) => list.some(item => !(item != null && item._key));
|
|
3916
|
+
|
|
3917
|
+
/** 勿在此用 FormInfo:模块列不在 Form 内,FormInfo→FieldList 会读不到 openApiRef */
|
|
3918
|
+
const EditorSection = ({
|
|
3919
|
+
title,
|
|
3920
|
+
tip,
|
|
3361
3921
|
children
|
|
3362
|
-
}) => /*#__PURE__*/
|
|
3363
|
-
className: style['
|
|
3364
|
-
children:
|
|
3922
|
+
}) => /*#__PURE__*/jsxs("div", {
|
|
3923
|
+
className: style['columns-editor'],
|
|
3924
|
+
children: [title ? /*#__PURE__*/jsx(Title, {
|
|
3925
|
+
level: 5,
|
|
3926
|
+
className: style['matrix-scale-editor-title'],
|
|
3927
|
+
children: title
|
|
3928
|
+
}) : null, children, tip ? /*#__PURE__*/jsx(Space, {
|
|
3929
|
+
size: 4,
|
|
3930
|
+
className: style['options-tip'],
|
|
3931
|
+
children: tip
|
|
3932
|
+
}) : null]
|
|
3365
3933
|
});
|
|
3366
|
-
const
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3934
|
+
const LabelNameRows = ({
|
|
3935
|
+
title,
|
|
3936
|
+
tip,
|
|
3937
|
+
list,
|
|
3938
|
+
onChange,
|
|
3939
|
+
createEmpty,
|
|
3940
|
+
createKey,
|
|
3941
|
+
labelPlaceholder,
|
|
3942
|
+
namePlaceholder,
|
|
3943
|
+
addText
|
|
3944
|
+
}) => {
|
|
3945
|
+
// 只展示已落盘数据;缺 key / 空列表由 effect 补齐,避免每次 render 新建临时项导致丢焦点
|
|
3946
|
+
useEffect(() => {
|
|
3947
|
+
if (!list.length) {
|
|
3948
|
+
onChange([createEmpty()]);
|
|
3949
|
+
return;
|
|
3950
|
+
}
|
|
3951
|
+
if (hasMissingKey(list)) {
|
|
3952
|
+
onChange(ensureKeys(list, createKey));
|
|
3953
|
+
}
|
|
3954
|
+
}, [list, onChange, createEmpty, createKey]);
|
|
3955
|
+
const rows = list.length ? list : [];
|
|
3956
|
+
const updateItem = (index, patch) => {
|
|
3957
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? _extends({}, item, patch) : item));
|
|
3958
|
+
};
|
|
3959
|
+
return /*#__PURE__*/jsxs(EditorSection, {
|
|
3375
3960
|
title: title,
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3961
|
+
tip: tip,
|
|
3962
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3963
|
+
className: style['options-list'],
|
|
3964
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
3965
|
+
gap: 8,
|
|
3966
|
+
align: "start",
|
|
3967
|
+
className: style['options-row'],
|
|
3968
|
+
children: [/*#__PURE__*/jsx(Input$1, {
|
|
3969
|
+
value: item.label || '',
|
|
3970
|
+
placeholder: labelPlaceholder,
|
|
3971
|
+
onChange: e => updateItem(index, {
|
|
3972
|
+
label: e.target.value
|
|
3973
|
+
})
|
|
3974
|
+
}), /*#__PURE__*/jsx(Input$1, {
|
|
3975
|
+
value: item.name || '',
|
|
3976
|
+
placeholder: namePlaceholder,
|
|
3977
|
+
onChange: e => updateItem(index, {
|
|
3978
|
+
name: e.target.value
|
|
3979
|
+
})
|
|
3980
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3981
|
+
type: "text",
|
|
3982
|
+
danger: true,
|
|
3983
|
+
className: style['icon-square-btn-sm'],
|
|
3984
|
+
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
3985
|
+
disabled: rows.length <= 1,
|
|
3986
|
+
onClick: () => {
|
|
3987
|
+
const next = rows.filter((_, i) => i !== index);
|
|
3988
|
+
onChange(next.length ? next : [createEmpty()]);
|
|
3989
|
+
}
|
|
3990
|
+
})]
|
|
3991
|
+
}, item._key || `row-${index}`))
|
|
3992
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3993
|
+
type: "dashed",
|
|
3994
|
+
block: true,
|
|
3995
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
3996
|
+
onClick: () => onChange([...rows, createEmpty()]),
|
|
3997
|
+
children: addText
|
|
3998
|
+
})]
|
|
3999
|
+
});
|
|
3379
4000
|
};
|
|
4001
|
+
const MatrixOptionsEditor = ({
|
|
4002
|
+
value: _value = [],
|
|
4003
|
+
onChange
|
|
4004
|
+
}) => {
|
|
4005
|
+
const {
|
|
4006
|
+
formatMessage
|
|
4007
|
+
} = useIntl();
|
|
4008
|
+
useEffect(() => {
|
|
4009
|
+
if (!_value.length) {
|
|
4010
|
+
onChange([createEmptyMatrixOption()]);
|
|
4011
|
+
return;
|
|
4012
|
+
}
|
|
4013
|
+
if (hasMissingKey(_value)) {
|
|
4014
|
+
onChange(ensureKeys(_value, createOptKey));
|
|
4015
|
+
}
|
|
4016
|
+
}, [_value, onChange]);
|
|
4017
|
+
const rows = _value.length ? _value : [];
|
|
4018
|
+
const updateItem = (index, patch) => {
|
|
4019
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? _extends({}, item, patch) : item));
|
|
4020
|
+
};
|
|
4021
|
+
return /*#__PURE__*/jsxs(EditorSection, {
|
|
4022
|
+
title: formatMessage({
|
|
4023
|
+
id: 'matrixScaleOptionsTitle'
|
|
4024
|
+
}),
|
|
4025
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
4026
|
+
className: style['options-list'],
|
|
4027
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
4028
|
+
gap: 8,
|
|
4029
|
+
align: "start",
|
|
4030
|
+
className: style['options-row'],
|
|
4031
|
+
children: [/*#__PURE__*/jsx(Input$1, {
|
|
4032
|
+
value: item.label || '',
|
|
4033
|
+
placeholder: formatMessage({
|
|
4034
|
+
id: 'optionLabelPlaceholder'
|
|
4035
|
+
}),
|
|
4036
|
+
onChange: e => {
|
|
4037
|
+
const label = e.target.value;
|
|
4038
|
+
const patch = {
|
|
4039
|
+
label
|
|
4040
|
+
};
|
|
4041
|
+
if (!item.value || item.value === item.label) {
|
|
4042
|
+
patch.value = label;
|
|
4043
|
+
}
|
|
4044
|
+
updateItem(index, patch);
|
|
4045
|
+
}
|
|
4046
|
+
}), /*#__PURE__*/jsx(Input$1, {
|
|
4047
|
+
value: item.value || '',
|
|
4048
|
+
placeholder: formatMessage({
|
|
4049
|
+
id: 'optionValuePlaceholder'
|
|
4050
|
+
}),
|
|
4051
|
+
onChange: e => updateItem(index, {
|
|
4052
|
+
value: e.target.value
|
|
4053
|
+
})
|
|
4054
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
4055
|
+
type: "text",
|
|
4056
|
+
danger: true,
|
|
4057
|
+
className: style['icon-square-btn-sm'],
|
|
4058
|
+
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
4059
|
+
disabled: rows.length <= 1,
|
|
4060
|
+
onClick: () => {
|
|
4061
|
+
const next = rows.filter((_, i) => i !== index);
|
|
4062
|
+
onChange(next.length ? next : [createEmptyMatrixOption()]);
|
|
4063
|
+
}
|
|
4064
|
+
})]
|
|
4065
|
+
}, item._key || `opt-${index}`))
|
|
4066
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
4067
|
+
type: "dashed",
|
|
4068
|
+
block: true,
|
|
4069
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
4070
|
+
onClick: () => onChange([...rows, createEmptyMatrixOption()]),
|
|
4071
|
+
children: formatMessage({
|
|
4072
|
+
id: 'addOption'
|
|
4073
|
+
})
|
|
4074
|
+
})]
|
|
4075
|
+
});
|
|
4076
|
+
};
|
|
4077
|
+
const MatrixScaleEditor = ({
|
|
4078
|
+
block,
|
|
4079
|
+
onChange
|
|
4080
|
+
}) => {
|
|
4081
|
+
const {
|
|
4082
|
+
formatMessage
|
|
4083
|
+
} = useIntl();
|
|
4084
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
4085
|
+
const blockRef = useRef(block);
|
|
4086
|
+
blockRef.current = block;
|
|
4087
|
+
const onChangeRef = useRef(onChange);
|
|
4088
|
+
onChangeRef.current = onChange;
|
|
4089
|
+
|
|
4090
|
+
// 用 ref 保持回调稳定,避免输入时子组件 useEffect 反复触发
|
|
4091
|
+
const handleRowsChange = useCallback(rows => onChangeRef.current(_extends({}, blockRef.current, {
|
|
4092
|
+
rows
|
|
4093
|
+
})), []);
|
|
4094
|
+
const handleOptionsChange = useCallback(options => onChangeRef.current(_extends({}, blockRef.current, {
|
|
4095
|
+
options
|
|
4096
|
+
})), []);
|
|
4097
|
+
const handleColumnsChange = useCallback(columns => onChangeRef.current(_extends({}, blockRef.current, {
|
|
4098
|
+
columns
|
|
4099
|
+
})), []);
|
|
4100
|
+
return /*#__PURE__*/jsxs("div", {
|
|
4101
|
+
className: style['block-body'],
|
|
4102
|
+
children: [/*#__PURE__*/jsx(Text$4, {
|
|
4103
|
+
type: "secondary",
|
|
4104
|
+
className: style['inline-empty'],
|
|
4105
|
+
children: formatMessage({
|
|
4106
|
+
id: `matrixScaleEditorHint_${layout}`
|
|
4107
|
+
})
|
|
4108
|
+
}), /*#__PURE__*/jsx(LabelNameRows, {
|
|
4109
|
+
title: formatMessage({
|
|
4110
|
+
id: 'matrixScaleRowsTitle'
|
|
4111
|
+
}),
|
|
4112
|
+
tip: formatMessage({
|
|
4113
|
+
id: 'matrixScaleRowsHint'
|
|
4114
|
+
}),
|
|
4115
|
+
list: block.rows || [],
|
|
4116
|
+
onChange: handleRowsChange,
|
|
4117
|
+
createEmpty: createEmptyMatrixRow,
|
|
4118
|
+
createKey: createRowKey,
|
|
4119
|
+
labelPlaceholder: formatMessage({
|
|
4120
|
+
id: 'matrixScaleRowLabelPlaceholder'
|
|
4121
|
+
}),
|
|
4122
|
+
namePlaceholder: formatMessage({
|
|
4123
|
+
id: 'matrixScaleRowNamePlaceholder'
|
|
4124
|
+
}),
|
|
4125
|
+
addText: formatMessage({
|
|
4126
|
+
id: 'matrixScaleAddRow'
|
|
4127
|
+
})
|
|
4128
|
+
}), layout === 'options' ? /*#__PURE__*/jsx(MatrixOptionsEditor, {
|
|
4129
|
+
value: block.options || [],
|
|
4130
|
+
onChange: handleOptionsChange
|
|
4131
|
+
}) : null, layout === 'columns' ? /*#__PURE__*/jsx(LabelNameRows, {
|
|
4132
|
+
title: formatMessage({
|
|
4133
|
+
id: 'matrixScaleColumnsTitle'
|
|
4134
|
+
}),
|
|
4135
|
+
tip: formatMessage({
|
|
4136
|
+
id: 'matrixScaleColumnsHint'
|
|
4137
|
+
}),
|
|
4138
|
+
list: block.columns || [],
|
|
4139
|
+
onChange: handleColumnsChange,
|
|
4140
|
+
createEmpty: createEmptyMatrixColumn,
|
|
4141
|
+
createKey: createColKey,
|
|
4142
|
+
labelPlaceholder: formatMessage({
|
|
4143
|
+
id: 'matrixScaleColumnLabelPlaceholder'
|
|
4144
|
+
}),
|
|
4145
|
+
namePlaceholder: formatMessage({
|
|
4146
|
+
id: 'matrixScaleColumnNamePlaceholder'
|
|
4147
|
+
}),
|
|
4148
|
+
addText: formatMessage({
|
|
4149
|
+
id: 'matrixScaleAddRow'
|
|
4150
|
+
})
|
|
4151
|
+
}) : null]
|
|
4152
|
+
});
|
|
4153
|
+
};
|
|
4154
|
+
var MatrixScaleEditor$1 = MatrixScaleEditor;
|
|
4155
|
+
|
|
4156
|
+
const noop = () => {};
|
|
4157
|
+
|
|
4158
|
+
/** 拖柄属性:按 scope 区分,嵌套列表的拖柄不会被外层列表识别 */
|
|
4159
|
+
const getSortHandleProps = scope => ({
|
|
4160
|
+
'data-sort-handle': scope
|
|
4161
|
+
});
|
|
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
|
+
});
|
|
4200
|
+
};
|
|
4201
|
+
var SortableList$1 = SortableList;
|
|
4202
|
+
|
|
4203
|
+
const {
|
|
4204
|
+
Text: Text$3
|
|
4205
|
+
} = Typography;
|
|
3380
4206
|
const ROOT_ADD_OPTIONS = [{
|
|
3381
4207
|
key: 'formInfo',
|
|
3382
4208
|
icon: /*#__PURE__*/jsx(FormOutlined, {})
|
|
@@ -3398,6 +4224,9 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
3398
4224
|
}, {
|
|
3399
4225
|
key: 'multiField',
|
|
3400
4226
|
icon: /*#__PURE__*/jsx(AppstoreOutlined, {})
|
|
4227
|
+
}, {
|
|
4228
|
+
key: 'matrixScale',
|
|
4229
|
+
icon: /*#__PURE__*/jsx(BorderOuterOutlined, {})
|
|
3401
4230
|
}, {
|
|
3402
4231
|
key: 'steps',
|
|
3403
4232
|
icon: /*#__PURE__*/jsx(OrderedListOutlined, {})
|
|
@@ -3409,6 +4238,9 @@ const BLOCK_KIND_ICONS = Object.fromEntries(ROOT_ADD_OPTIONS.map(({
|
|
|
3409
4238
|
|
|
3410
4239
|
/** 可挂子模块的容器;表格列表 / 同类多值本身不支持子模块 */
|
|
3411
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}`;
|
|
3412
4244
|
const BlockListPanel = ({
|
|
3413
4245
|
blocks,
|
|
3414
4246
|
onAddBlock,
|
|
@@ -3428,17 +4260,33 @@ const BlockListPanel = ({
|
|
|
3428
4260
|
onDeleteChoiceOption,
|
|
3429
4261
|
onMoveChoiceOption,
|
|
3430
4262
|
onOpenFormActions,
|
|
4263
|
+
onPatchBlock,
|
|
3431
4264
|
extraToolbar
|
|
3432
4265
|
}) => {
|
|
3433
4266
|
const {
|
|
3434
4267
|
formatMessage,
|
|
3435
4268
|
locale
|
|
3436
4269
|
} = useIntl();
|
|
4270
|
+
const isMobile = useIsMobile();
|
|
3437
4271
|
const languages = useLocaleTextLanguages();
|
|
3438
4272
|
const text = value => resolveLocaleText(value, locale, languages);
|
|
3439
4273
|
const [addMenuOpen, setAddMenuOpen] = useState(false);
|
|
3440
4274
|
const [addFieldMenuId, setAddFieldMenuId] = useState(null);
|
|
3441
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
|
+
}));
|
|
3442
4290
|
const conditionContext = useMemo(() => {
|
|
3443
4291
|
const triggerFields = collectConditionFields({
|
|
3444
4292
|
blocks
|
|
@@ -3493,17 +4341,19 @@ const BlockListPanel = ({
|
|
|
3493
4341
|
}) => {
|
|
3494
4342
|
const canAddChild = typeof onAddChildBlock === 'function' && depth < MAX_BLOCK_DEPTH;
|
|
3495
4343
|
const menuOpen = addFieldMenuId === menuKey;
|
|
3496
|
-
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
|
+
});
|
|
3497
4348
|
if (!canAddChild) {
|
|
3498
4349
|
return /*#__PURE__*/jsx(Button, {
|
|
3499
4350
|
type: "text",
|
|
3500
4351
|
size: "small",
|
|
3501
4352
|
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
3502
4353
|
className: btnClass,
|
|
4354
|
+
title: addFieldText,
|
|
3503
4355
|
onClick: onAddFieldClick,
|
|
3504
|
-
children:
|
|
3505
|
-
id: 'addField'
|
|
3506
|
-
})
|
|
4356
|
+
children: isMobile ? null : addFieldText
|
|
3507
4357
|
});
|
|
3508
4358
|
}
|
|
3509
4359
|
return /*#__PURE__*/jsx(Dropdown, {
|
|
@@ -3597,10 +4447,9 @@ const BlockListPanel = ({
|
|
|
3597
4447
|
keepAddFieldMenuOpenRef.current = true;
|
|
3598
4448
|
}
|
|
3599
4449
|
},
|
|
4450
|
+
title: addFieldText,
|
|
3600
4451
|
onClick: () => setAddFieldMenuId(menuKey),
|
|
3601
|
-
children:
|
|
3602
|
-
id: 'addField'
|
|
3603
|
-
})
|
|
4452
|
+
children: isMobile ? null : addFieldText
|
|
3604
4453
|
})
|
|
3605
4454
|
});
|
|
3606
4455
|
};
|
|
@@ -3609,7 +4458,7 @@ const BlockListPanel = ({
|
|
|
3609
4458
|
optionId
|
|
3610
4459
|
} = {}) => {
|
|
3611
4460
|
if (!(fields || []).length) {
|
|
3612
|
-
return /*#__PURE__*/jsx(Text$
|
|
4461
|
+
return /*#__PURE__*/jsx(Text$3, {
|
|
3613
4462
|
type: "secondary",
|
|
3614
4463
|
className: style['inline-empty'],
|
|
3615
4464
|
children: formatMessage({
|
|
@@ -3617,9 +4466,20 @@ const BlockListPanel = ({
|
|
|
3617
4466
|
})
|
|
3618
4467
|
});
|
|
3619
4468
|
}
|
|
3620
|
-
|
|
4469
|
+
const scope = `fields:${blockId}:${stepId || ''}:${optionId || ''}`;
|
|
4470
|
+
const canDrag = fields.length > 1;
|
|
4471
|
+
return /*#__PURE__*/jsx(SortableList$1, {
|
|
3621
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
|
+
}),
|
|
3622
4480
|
children: fields.map((field, fieldIndex) => /*#__PURE__*/jsx(FieldRow, {
|
|
4481
|
+
isMobile: isMobile,
|
|
4482
|
+
dragHandleProps: canDrag && !isFieldLocked(field) ? getSortHandleProps(scope) : null,
|
|
3623
4483
|
field: field,
|
|
3624
4484
|
index: fieldIndex,
|
|
3625
4485
|
total: fields.length,
|
|
@@ -3641,26 +4501,30 @@ const BlockListPanel = ({
|
|
|
3641
4501
|
}, field.id))
|
|
3642
4502
|
});
|
|
3643
4503
|
};
|
|
3644
|
-
const renderNestedBlocks = (childBlocks, depth) => {
|
|
4504
|
+
const renderNestedBlocks = (childBlocks, depth, parentKey) => {
|
|
3645
4505
|
if (!(childBlocks || []).length) {
|
|
3646
4506
|
return null;
|
|
3647
4507
|
}
|
|
3648
4508
|
return /*#__PURE__*/jsx("div", {
|
|
3649
4509
|
className: style['item-blocks-section'],
|
|
3650
|
-
children: /*#__PURE__*/jsx(
|
|
4510
|
+
children: /*#__PURE__*/jsx(SortableList$1, {
|
|
3651
4511
|
className: style['nested-block-list'],
|
|
3652
|
-
|
|
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))
|
|
3653
4517
|
})
|
|
3654
4518
|
});
|
|
3655
4519
|
};
|
|
3656
|
-
const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth);
|
|
4520
|
+
const renderItemBlocks = (parentBlock, depth) => renderNestedBlocks(parentBlock.itemBlocks, depth, `item:${parentBlock.id}`);
|
|
3657
4521
|
const renderBlockChildren = (block, depth) => {
|
|
3658
4522
|
if (block.kind === 'steps') {
|
|
3659
4523
|
return /*#__PURE__*/jsxs("div", {
|
|
3660
4524
|
className: style['block-body'],
|
|
3661
4525
|
children: [/*#__PURE__*/jsxs("div", {
|
|
3662
4526
|
className: style['section-toolbar'],
|
|
3663
|
-
children: [/*#__PURE__*/jsx(Text$
|
|
4527
|
+
children: [/*#__PURE__*/jsx(Text$3, {
|
|
3664
4528
|
type: "secondary",
|
|
3665
4529
|
className: style['section-toolbar-label'],
|
|
3666
4530
|
children: formatMessage({
|
|
@@ -3676,74 +4540,88 @@ const BlockListPanel = ({
|
|
|
3676
4540
|
id: 'addStep'
|
|
3677
4541
|
})
|
|
3678
4542
|
})]
|
|
3679
|
-
}), (block.items || []).length ? /*#__PURE__*/jsx(
|
|
4543
|
+
}), (block.items || []).length ? /*#__PURE__*/jsx(SortableList$1, {
|
|
3680
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),
|
|
3681
4549
|
children: (block.items || []).map((step, stepIndex) => {
|
|
3682
4550
|
var _step$list, _step$list2, _block$items;
|
|
3683
4551
|
return /*#__PURE__*/jsxs("div", {
|
|
3684
4552
|
className: style['step-section'],
|
|
3685
4553
|
children: [/*#__PURE__*/jsxs("div", {
|
|
3686
4554
|
className: style['step-section-header'],
|
|
3687
|
-
children: [/*#__PURE__*/jsxs(
|
|
3688
|
-
size: 8,
|
|
3689
|
-
wrap: true,
|
|
4555
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
3690
4556
|
className: style['step-section-title'],
|
|
3691
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
4557
|
+
children: [isMobile && block.items.length > 1 && !blockHasLockedField(step) ? renderDragHandle(`steps:${block.id}`, true) : null, /*#__PURE__*/jsx("span", {
|
|
3692
4558
|
className: style['step-index'],
|
|
3693
4559
|
children: stepIndex + 1
|
|
3694
|
-
}), /*#__PURE__*/
|
|
3695
|
-
|
|
3696
|
-
children:
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
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
|
+
})]
|
|
3713
4583
|
})]
|
|
3714
4584
|
}), /*#__PURE__*/jsxs(Space, {
|
|
3715
4585
|
size: 4,
|
|
3716
|
-
wrap: true,
|
|
3717
4586
|
className: style['step-section-actions'],
|
|
3718
|
-
children: [/*#__PURE__*/
|
|
3719
|
-
|
|
3720
|
-
|
|
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({
|
|
3721
4596
|
id: 'moveUp'
|
|
3722
4597
|
}),
|
|
3723
4598
|
icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
|
|
3724
4599
|
disabled: stepIndex === 0 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex - 1]),
|
|
3725
4600
|
onClick: () => onMoveStep(block.id, step.id, 'up')
|
|
3726
|
-
}
|
|
3727
|
-
|
|
4601
|
+
}, {
|
|
4602
|
+
key: 'down',
|
|
4603
|
+
label: formatMessage({
|
|
3728
4604
|
id: 'moveDown'
|
|
3729
4605
|
}),
|
|
3730
4606
|
icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
|
|
3731
4607
|
disabled: stepIndex === (((_block$items = block.items) == null ? void 0 : _block$items.length) || 0) - 1 || blockHasLockedField(step) || blockHasLockedField(block.items[stepIndex + 1]),
|
|
3732
4608
|
onClick: () => onMoveStep(block.id, step.id, 'down')
|
|
3733
|
-
}
|
|
3734
|
-
|
|
4609
|
+
}, {
|
|
4610
|
+
key: 'edit',
|
|
4611
|
+
label: formatMessage({
|
|
3735
4612
|
id: 'editStep'
|
|
3736
4613
|
}),
|
|
3737
4614
|
icon: /*#__PURE__*/jsx(EditOutlined, {}),
|
|
3738
4615
|
onClick: () => onEditStep(block.id, step)
|
|
3739
|
-
}
|
|
3740
|
-
|
|
4616
|
+
}, blockHasLockedField(step) ? null : {
|
|
4617
|
+
key: 'delete',
|
|
4618
|
+
label: formatMessage({
|
|
3741
4619
|
id: 'deleteStep'
|
|
3742
4620
|
}),
|
|
3743
|
-
danger: true,
|
|
3744
4621
|
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
4622
|
+
danger: true,
|
|
3745
4623
|
onClick: () => onDeleteStep(block.id, step.id)
|
|
3746
|
-
})
|
|
4624
|
+
}])
|
|
3747
4625
|
}), renderAddFieldButton({
|
|
3748
4626
|
menuKey: `${block.id}:${step.id}`,
|
|
3749
4627
|
depth,
|
|
@@ -3758,10 +4636,10 @@ const BlockListPanel = ({
|
|
|
3758
4636
|
})]
|
|
3759
4637
|
}), renderFieldList(step.list, block.id, {
|
|
3760
4638
|
stepId: step.id
|
|
3761
|
-
}), renderNestedBlocks(step.blocks, depth)]
|
|
4639
|
+
}), renderNestedBlocks(step.blocks, depth, `step:${step.id}`)]
|
|
3762
4640
|
}, step.id);
|
|
3763
4641
|
})
|
|
3764
|
-
}) : /*#__PURE__*/jsx(Text$
|
|
4642
|
+
}) : /*#__PURE__*/jsx(Text$3, {
|
|
3765
4643
|
type: "secondary",
|
|
3766
4644
|
className: style['inline-empty'],
|
|
3767
4645
|
children: formatMessage({
|
|
@@ -3773,7 +4651,7 @@ const BlockListPanel = ({
|
|
|
3773
4651
|
if (block.kind === 'multiField') {
|
|
3774
4652
|
return /*#__PURE__*/jsx("div", {
|
|
3775
4653
|
className: style['block-body'],
|
|
3776
|
-
children: /*#__PURE__*/jsx(Text$
|
|
4654
|
+
children: /*#__PURE__*/jsx(Text$3, {
|
|
3777
4655
|
type: "secondary",
|
|
3778
4656
|
children: formatMessage({
|
|
3779
4657
|
id: 'multiFieldEditorHint'
|
|
@@ -3781,12 +4659,18 @@ const BlockListPanel = ({
|
|
|
3781
4659
|
})
|
|
3782
4660
|
});
|
|
3783
4661
|
}
|
|
4662
|
+
if (block.kind === 'matrixScale') {
|
|
4663
|
+
return /*#__PURE__*/jsx(MatrixScaleEditor$1, {
|
|
4664
|
+
block: block,
|
|
4665
|
+
onChange: next => onPatchBlock == null ? void 0 : onPatchBlock(next)
|
|
4666
|
+
});
|
|
4667
|
+
}
|
|
3784
4668
|
if (block.kind === 'choice') {
|
|
3785
4669
|
return /*#__PURE__*/jsxs("div", {
|
|
3786
4670
|
className: style['block-body'],
|
|
3787
4671
|
children: [/*#__PURE__*/jsxs("div", {
|
|
3788
4672
|
className: style['section-toolbar'],
|
|
3789
|
-
children: [/*#__PURE__*/jsx(Text$
|
|
4673
|
+
children: [/*#__PURE__*/jsx(Text$3, {
|
|
3790
4674
|
type: "secondary",
|
|
3791
4675
|
className: style['section-toolbar-label'],
|
|
3792
4676
|
children: formatMessage({
|
|
@@ -3802,74 +4686,88 @@ const BlockListPanel = ({
|
|
|
3802
4686
|
id: 'addChoiceOption'
|
|
3803
4687
|
})
|
|
3804
4688
|
})]
|
|
3805
|
-
}), (block.options || []).length ? /*#__PURE__*/jsx(
|
|
4689
|
+
}), (block.options || []).length ? /*#__PURE__*/jsx(SortableList$1, {
|
|
3806
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),
|
|
3807
4695
|
children: (block.options || []).map((option, optionIndex) => {
|
|
3808
4696
|
var _option$list, _option$list2, _block$options;
|
|
3809
4697
|
return /*#__PURE__*/jsxs("div", {
|
|
3810
4698
|
className: style['step-section'],
|
|
3811
4699
|
children: [/*#__PURE__*/jsxs("div", {
|
|
3812
4700
|
className: style['step-section-header'],
|
|
3813
|
-
children: [/*#__PURE__*/jsxs(
|
|
3814
|
-
size: 8,
|
|
3815
|
-
wrap: true,
|
|
4701
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
3816
4702
|
className: style['step-section-title'],
|
|
3817
|
-
children: [/*#__PURE__*/jsx("span", {
|
|
4703
|
+
children: [isMobile && block.options.length > 1 && !blockHasLockedField(option) ? renderDragHandle(`options:${block.id}`, true) : null, /*#__PURE__*/jsx("span", {
|
|
3818
4704
|
className: style['step-index'],
|
|
3819
4705
|
children: optionIndex + 1
|
|
3820
|
-
}), /*#__PURE__*/
|
|
3821
|
-
|
|
3822
|
-
children:
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
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
|
+
})]
|
|
3839
4729
|
})]
|
|
3840
4730
|
}), /*#__PURE__*/jsxs(Space, {
|
|
3841
4731
|
size: 4,
|
|
3842
|
-
wrap: true,
|
|
3843
4732
|
className: style['step-section-actions'],
|
|
3844
|
-
children: [/*#__PURE__*/
|
|
3845
|
-
|
|
3846
|
-
|
|
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({
|
|
3847
4742
|
id: 'moveUp'
|
|
3848
4743
|
}),
|
|
3849
4744
|
icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
|
|
3850
4745
|
disabled: optionIndex === 0 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex - 1]),
|
|
3851
4746
|
onClick: () => onMoveChoiceOption(block.id, option.id, 'up')
|
|
3852
|
-
}
|
|
3853
|
-
|
|
4747
|
+
}, {
|
|
4748
|
+
key: 'down',
|
|
4749
|
+
label: formatMessage({
|
|
3854
4750
|
id: 'moveDown'
|
|
3855
4751
|
}),
|
|
3856
4752
|
icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
|
|
3857
4753
|
disabled: optionIndex === (((_block$options = block.options) == null ? void 0 : _block$options.length) || 0) - 1 || blockHasLockedField(option) || blockHasLockedField(block.options[optionIndex + 1]),
|
|
3858
4754
|
onClick: () => onMoveChoiceOption(block.id, option.id, 'down')
|
|
3859
|
-
}
|
|
3860
|
-
|
|
4755
|
+
}, {
|
|
4756
|
+
key: 'edit',
|
|
4757
|
+
label: formatMessage({
|
|
3861
4758
|
id: 'editChoiceOption'
|
|
3862
4759
|
}),
|
|
3863
4760
|
icon: /*#__PURE__*/jsx(EditOutlined, {}),
|
|
3864
4761
|
onClick: () => onEditChoiceOption(block.id, option)
|
|
3865
|
-
}
|
|
3866
|
-
|
|
4762
|
+
}, blockHasLockedField(option) ? null : {
|
|
4763
|
+
key: 'delete',
|
|
4764
|
+
label: formatMessage({
|
|
3867
4765
|
id: 'deleteChoiceOption'
|
|
3868
4766
|
}),
|
|
3869
|
-
danger: true,
|
|
3870
4767
|
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
4768
|
+
danger: true,
|
|
3871
4769
|
onClick: () => onDeleteChoiceOption(block.id, option.id)
|
|
3872
|
-
})
|
|
4770
|
+
}])
|
|
3873
4771
|
}), renderAddFieldButton({
|
|
3874
4772
|
menuKey: `${block.id}:opt:${option.id}`,
|
|
3875
4773
|
depth,
|
|
@@ -3884,10 +4782,10 @@ const BlockListPanel = ({
|
|
|
3884
4782
|
})]
|
|
3885
4783
|
}), renderFieldList(option.list, block.id, {
|
|
3886
4784
|
optionId: option.id
|
|
3887
|
-
}), renderNestedBlocks(option.blocks, depth)]
|
|
4785
|
+
}), renderNestedBlocks(option.blocks, depth, `option:${option.id}`)]
|
|
3888
4786
|
}, option.id);
|
|
3889
4787
|
})
|
|
3890
|
-
}) : /*#__PURE__*/jsx(Text$
|
|
4788
|
+
}) : /*#__PURE__*/jsx(Text$3, {
|
|
3891
4789
|
type: "secondary",
|
|
3892
4790
|
className: style['inline-empty'],
|
|
3893
4791
|
children: formatMessage({
|
|
@@ -3900,19 +4798,20 @@ const BlockListPanel = ({
|
|
|
3900
4798
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3901
4799
|
return /*#__PURE__*/jsxs("div", {
|
|
3902
4800
|
className: style['block-body'],
|
|
3903
|
-
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]
|
|
3904
4802
|
});
|
|
3905
4803
|
};
|
|
3906
|
-
const renderBlockSection = (block, blockIndex, siblings, depth = 0) => {
|
|
3907
|
-
var _block$itemBlocks, _block$blocks, _block$items2, _block$options2, _block$list, _block$list2;
|
|
4804
|
+
const renderBlockSection = (block, blockIndex, siblings, depth = 0, parentKey = 'root') => {
|
|
4805
|
+
var _block$itemBlocks, _block$blocks, _block$items2, _block$rows, _block$options2, _block$list, _block$list2;
|
|
3908
4806
|
const total = siblings.length;
|
|
3909
4807
|
const locked = blockHasLockedField(block);
|
|
3910
4808
|
const definition = getBlockDefinition(block.kind);
|
|
3911
|
-
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
|
|
4809
|
+
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'matrixScale' && block.kind !== 'choice';
|
|
3912
4810
|
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
3913
4811
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3914
4812
|
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
3915
4813
|
const nestCount = supportsItemBlocks$1 ? ((_block$itemBlocks = block.itemBlocks) == null ? void 0 : _block$itemBlocks.length) || 0 : ((_block$blocks = block.blocks) == null ? void 0 : _block$blocks.length) || 0;
|
|
4814
|
+
const matrixLayout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
3916
4815
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
3917
4816
|
id: 'stepCount'
|
|
3918
4817
|
}, {
|
|
@@ -3923,7 +4822,18 @@ const BlockListPanel = ({
|
|
|
3923
4822
|
type: /*#__PURE__*/jsxs("span", {
|
|
3924
4823
|
className: style['block-summary-type'],
|
|
3925
4824
|
children: [/*#__PURE__*/createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
|
|
3926
|
-
})
|
|
4825
|
+
}, "type")
|
|
4826
|
+
}) : block.kind === 'matrixScale' ? formatMessage({
|
|
4827
|
+
id: 'matrixScaleSummary'
|
|
4828
|
+
}, {
|
|
4829
|
+
type: /*#__PURE__*/jsxs("span", {
|
|
4830
|
+
className: style['block-summary-type'],
|
|
4831
|
+
children: [/*#__PURE__*/createElement(getFieldTypeIcon(block.fieldType || 'RadioGroup')), resolveFieldTypeLabel(block.fieldType || 'RadioGroup', formatMessage)]
|
|
4832
|
+
}, "type"),
|
|
4833
|
+
layout: formatMessage({
|
|
4834
|
+
id: `matrixScaleLayout_${matrixLayout}`
|
|
4835
|
+
}),
|
|
4836
|
+
rows: ((_block$rows = block.rows) == null ? void 0 : _block$rows.length) || 0
|
|
3927
4837
|
}) : block.kind === 'choice' ? formatMessage({
|
|
3928
4838
|
id: 'choiceOptionCount'
|
|
3929
4839
|
}, {
|
|
@@ -3938,73 +4848,92 @@ const BlockListPanel = ({
|
|
|
3938
4848
|
}, {
|
|
3939
4849
|
count: ((_block$list2 = block.list) == null ? void 0 : _block$list2.length) || 0
|
|
3940
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
|
+
});
|
|
3941
4856
|
return /*#__PURE__*/jsxs("section", {
|
|
3942
|
-
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(),
|
|
3943
4858
|
children: [/*#__PURE__*/jsxs("header", {
|
|
3944
4859
|
className: style['block-section-header'],
|
|
3945
4860
|
children: [/*#__PURE__*/jsxs("div", {
|
|
3946
|
-
className: style['block-header-
|
|
3947
|
-
children: [/*#__PURE__*/jsx(
|
|
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, {
|
|
3948
4872
|
bordered: false,
|
|
3949
4873
|
color: (definition == null ? void 0 : definition.color) || 'default',
|
|
3950
4874
|
icon: BLOCK_KIND_ICONS[block.kind],
|
|
3951
4875
|
children: formatMessage({
|
|
3952
4876
|
id: `blockKind_${block.kind}`
|
|
3953
4877
|
})
|
|
3954
|
-
}), /*#__PURE__*/jsx(Text$4, {
|
|
3955
|
-
strong: true,
|
|
3956
|
-
ellipsis: true,
|
|
3957
|
-
className: style['block-title'],
|
|
3958
|
-
children: text(block.title) || text(block.label) || block.name || formatMessage({
|
|
3959
|
-
id: 'untitledBlock'
|
|
3960
|
-
})
|
|
3961
4878
|
}), /*#__PURE__*/jsx("span", {
|
|
3962
4879
|
className: style['block-summary'],
|
|
3963
4880
|
children: summary
|
|
3964
|
-
})
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
title: formatMessage({
|
|
3972
|
-
id: 'moveUp'
|
|
3973
|
-
}),
|
|
3974
|
-
icon: /*#__PURE__*/jsx(ArrowUpOutlined, {}),
|
|
3975
|
-
disabled: blockIndex === 0 || locked || blockHasLockedField(siblings[blockIndex - 1]),
|
|
3976
|
-
onClick: () => onMoveBlock(block.id, 'up')
|
|
3977
|
-
}), /*#__PURE__*/jsx(IconBtn, {
|
|
3978
|
-
title: formatMessage({
|
|
3979
|
-
id: 'moveDown'
|
|
3980
|
-
}),
|
|
3981
|
-
icon: /*#__PURE__*/jsx(ArrowDownOutlined, {}),
|
|
3982
|
-
disabled: blockIndex === total - 1 || locked || blockHasLockedField(siblings[blockIndex + 1]),
|
|
3983
|
-
onClick: () => onMoveBlock(block.id, 'down')
|
|
3984
|
-
}), /*#__PURE__*/jsx(IconBtn, {
|
|
3985
|
-
title: formatMessage({
|
|
3986
|
-
id: 'editBlock'
|
|
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'
|
|
3987
4888
|
}),
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
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
|
|
4006
4935
|
})]
|
|
4007
|
-
}), renderBlockChildren(block, depth)]
|
|
4936
|
+
}), collapsed ? null : renderBlockChildren(block, depth)]
|
|
4008
4937
|
}, block.id);
|
|
4009
4938
|
};
|
|
4010
4939
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -4053,88 +4982,163 @@ const BlockListPanel = ({
|
|
|
4053
4982
|
description: formatMessage({
|
|
4054
4983
|
id: 'emptyBlockList'
|
|
4055
4984
|
})
|
|
4056
|
-
}) : /*#__PURE__*/jsx(
|
|
4985
|
+
}) : /*#__PURE__*/jsx(SortableList$1, {
|
|
4057
4986
|
className: style['block-list'],
|
|
4987
|
+
scope: getBlockScope('root'),
|
|
4988
|
+
list: blocks,
|
|
4989
|
+
isFixed: blockHasLockedField,
|
|
4990
|
+
onMove: onMoveBlock,
|
|
4058
4991
|
children: blocks.map((block, blockIndex) => renderBlockSection(block, blockIndex, blocks, 0))
|
|
4059
4992
|
})]
|
|
4060
4993
|
});
|
|
4061
4994
|
};
|
|
4062
4995
|
var BlockListPanel$1 = BlockListPanel;
|
|
4063
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
|
+
};
|
|
4064
5034
|
const BlockConfigFields = ({
|
|
4065
5035
|
kind
|
|
4066
5036
|
}) => {
|
|
4067
5037
|
const {
|
|
4068
5038
|
formatMessage
|
|
4069
5039
|
} = useIntl();
|
|
5040
|
+
const column = getEditorColumn(useIsMobile());
|
|
4070
5041
|
const definition = getBlockDefinition(kind);
|
|
4071
5042
|
const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
4072
|
-
const
|
|
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));
|
|
4073
5052
|
const isListKind = kind === 'list' || kind === 'tableList' || kind === 'editableList';
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
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, {
|
|
4108
5115
|
name: "gap",
|
|
4109
5116
|
label: formatMessage({
|
|
4110
5117
|
id: 'blockGap'
|
|
4111
5118
|
}),
|
|
4112
5119
|
min: 0,
|
|
4113
5120
|
max: 48
|
|
4114
|
-
}, "gap")
|
|
4115
|
-
name: "bordered",
|
|
4116
|
-
children: formatMessage({
|
|
4117
|
-
id: 'blockBordered'
|
|
4118
|
-
})
|
|
4119
|
-
}, "bordered"), kind === 'formInfo' ? /*#__PURE__*/jsx(Checkbox, {
|
|
5121
|
+
}, "gap"), borderedCheckbox, /*#__PURE__*/jsx(Checkbox, {
|
|
4120
5122
|
name: "showIndex",
|
|
4121
5123
|
children: formatMessage({
|
|
4122
5124
|
id: 'blockShowIndex'
|
|
4123
5125
|
})
|
|
4124
|
-
}, "showIndex")
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
name: "addText",
|
|
5126
|
+
}, "showIndex"));
|
|
5127
|
+
}
|
|
5128
|
+
if (kind === 'object') {
|
|
5129
|
+
add('basic', titleInput(), nameInput);
|
|
5130
|
+
add('layout', columnInput, /*#__PURE__*/jsx(InputNumber, {
|
|
5131
|
+
name: "gap",
|
|
4131
5132
|
label: formatMessage({
|
|
4132
|
-
id: '
|
|
5133
|
+
id: 'blockGap'
|
|
4133
5134
|
}),
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
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, {
|
|
4138
5142
|
name: "addPosition",
|
|
4139
5143
|
label: formatMessage({
|
|
4140
5144
|
id: 'blockAddPosition'
|
|
@@ -4145,30 +5149,29 @@ const BlockConfigFields = ({
|
|
|
4145
5149
|
}),
|
|
4146
5150
|
value
|
|
4147
5151
|
}))
|
|
4148
|
-
}, "addPosition") : null,
|
|
4149
|
-
name: "maxLength",
|
|
4150
|
-
label: formatMessage({
|
|
4151
|
-
id: 'blockMaxLength'
|
|
4152
|
-
}),
|
|
4153
|
-
min: 1
|
|
4154
|
-
}, "maxLength") : null, isListKind ? /*#__PURE__*/jsx(InputNumber, {
|
|
5152
|
+
}, "addPosition") : null, /*#__PURE__*/jsx(InputNumber, {
|
|
4155
5153
|
name: "minLength",
|
|
4156
5154
|
label: formatMessage({
|
|
4157
5155
|
id: 'blockMinLength'
|
|
4158
5156
|
}),
|
|
4159
5157
|
min: 0
|
|
4160
|
-
}, "minLength")
|
|
4161
|
-
|
|
4162
|
-
if (kind === 'choice') {
|
|
4163
|
-
list.push(/*#__PURE__*/jsx(LocaleInput, {
|
|
4164
|
-
name: "title",
|
|
5158
|
+
}, "minLength"), /*#__PURE__*/jsx(InputNumber, {
|
|
5159
|
+
name: "maxLength",
|
|
4165
5160
|
label: formatMessage({
|
|
4166
|
-
id: '
|
|
5161
|
+
id: 'blockMaxLength'
|
|
4167
5162
|
}),
|
|
4168
|
-
|
|
4169
|
-
|
|
5163
|
+
min: 1
|
|
5164
|
+
}, "maxLength"));
|
|
5165
|
+
add('layout', columnInput, borderedCheckbox, kind === 'list' ? /*#__PURE__*/jsx(Checkbox, {
|
|
5166
|
+
name: "important",
|
|
5167
|
+
children: formatMessage({
|
|
5168
|
+
id: 'blockImportant'
|
|
4170
5169
|
})
|
|
4171
|
-
}, "
|
|
5170
|
+
}, "important") : null);
|
|
5171
|
+
}
|
|
5172
|
+
if (kind === 'choice') {
|
|
5173
|
+
add('basic', titleInput('choiceTitlePlaceholder'));
|
|
5174
|
+
add('choiceRule', /*#__PURE__*/jsx(Select, {
|
|
4172
5175
|
name: "mode",
|
|
4173
5176
|
label: formatMessage({
|
|
4174
5177
|
id: 'choiceMode'
|
|
@@ -4215,12 +5218,8 @@ const BlockConfigFields = ({
|
|
|
4215
5218
|
var _openApi$data2;
|
|
4216
5219
|
return (openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.mode) === 'multiple';
|
|
4217
5220
|
}
|
|
4218
|
-
}, "maxLength")
|
|
4219
|
-
|
|
4220
|
-
children: formatMessage({
|
|
4221
|
-
id: 'choiceSelectorInData'
|
|
4222
|
-
})
|
|
4223
|
-
}, "selectorInData"), /*#__PURE__*/jsx(Input, {
|
|
5221
|
+
}, "maxLength"));
|
|
5222
|
+
add('choiceData', /*#__PURE__*/jsx(Input, {
|
|
4224
5223
|
name: "selectorName",
|
|
4225
5224
|
label: formatMessage({
|
|
4226
5225
|
id: 'choiceSelectorName'
|
|
@@ -4234,19 +5233,15 @@ const BlockConfigFields = ({
|
|
|
4234
5233
|
var _openApi$data3;
|
|
4235
5234
|
return (openApi == null || (_openApi$data3 = openApi.data) == null ? void 0 : _openApi$data3.selectorInData) !== false;
|
|
4236
5235
|
}
|
|
4237
|
-
}, "selectorName")
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
name: "name",
|
|
4242
|
-
label: formatMessage({
|
|
4243
|
-
id: 'blockName'
|
|
4244
|
-
}),
|
|
4245
|
-
rule: "REQ",
|
|
4246
|
-
placeholder: formatMessage({
|
|
4247
|
-
id: 'fieldNamePlaceholder'
|
|
5236
|
+
}, "selectorName"), /*#__PURE__*/jsx(Checkbox, {
|
|
5237
|
+
name: "selectorInData",
|
|
5238
|
+
children: formatMessage({
|
|
5239
|
+
id: 'choiceSelectorInData'
|
|
4248
5240
|
})
|
|
4249
|
-
}, "
|
|
5241
|
+
}, "selectorInData"));
|
|
5242
|
+
}
|
|
5243
|
+
if (kind === 'multiField') {
|
|
5244
|
+
add('basic', nameInput, /*#__PURE__*/jsx(LocaleInput, {
|
|
4250
5245
|
name: "label",
|
|
4251
5246
|
label: formatMessage({
|
|
4252
5247
|
id: 'fieldLabel'
|
|
@@ -4255,64 +5250,85 @@ const BlockConfigFields = ({
|
|
|
4255
5250
|
placeholder: formatMessage({
|
|
4256
5251
|
id: 'fieldLabelPlaceholder'
|
|
4257
5252
|
})
|
|
4258
|
-
}, "label"),
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
rule: "REQ",
|
|
4264
|
-
options: fieldTypeOptions
|
|
4265
|
-
}, "fieldType"), /*#__PURE__*/jsx(LocaleInput, {
|
|
4266
|
-
name: "addText",
|
|
5253
|
+
}, "label"), fieldTypeSelect, addTextInput);
|
|
5254
|
+
}
|
|
5255
|
+
if (kind === 'matrixScale') {
|
|
5256
|
+
add('basic', titleInput(), nameInput, /*#__PURE__*/jsx(LocaleInput, {
|
|
5257
|
+
name: "rowTitle",
|
|
4267
5258
|
label: formatMessage({
|
|
4268
|
-
id: '
|
|
5259
|
+
id: 'matrixScaleRowTitle'
|
|
4269
5260
|
}),
|
|
4270
5261
|
placeholder: formatMessage({
|
|
4271
|
-
id: '
|
|
5262
|
+
id: 'matrixScaleRowTitlePlaceholder'
|
|
4272
5263
|
})
|
|
4273
|
-
}, "
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
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, {
|
|
5272
|
+
name: "layout",
|
|
4278
5273
|
label: formatMessage({
|
|
4279
|
-
id: '
|
|
5274
|
+
id: 'matrixScaleLayout'
|
|
4280
5275
|
}),
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
5276
|
+
rule: "REQ",
|
|
5277
|
+
options: MATRIX_LAYOUTS.map(value => ({
|
|
5278
|
+
label: formatMessage({
|
|
5279
|
+
id: `matrixScaleLayout_${value}`
|
|
5280
|
+
}),
|
|
5281
|
+
value
|
|
5282
|
+
}))
|
|
5283
|
+
}, "layout"), borderedCheckbox);
|
|
5284
|
+
}
|
|
5285
|
+
if (kind === 'steps') {
|
|
5286
|
+
add('basic', titleInput(), subtitleInput);
|
|
5287
|
+
add('layout', /*#__PURE__*/jsx(Select, {
|
|
5288
|
+
name: "stepsStyle",
|
|
4286
5289
|
label: formatMessage({
|
|
4287
|
-
id: '
|
|
5290
|
+
id: 'stepsStyle'
|
|
4288
5291
|
}),
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
})
|
|
4297
|
-
}, "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, {
|
|
4298
5299
|
name: "autoStep",
|
|
4299
5300
|
children: formatMessage({
|
|
4300
5301
|
id: 'blockAutoStep'
|
|
4301
5302
|
})
|
|
4302
5303
|
}, "autoStep"));
|
|
4303
5304
|
}
|
|
4304
|
-
return /*#__PURE__*/
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
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
|
+
})]
|
|
4316
5332
|
});
|
|
4317
5333
|
};
|
|
4318
5334
|
const BlockEditorModal = ({
|
|
@@ -4345,9 +5361,8 @@ const BlockEditorModal = ({
|
|
|
4345
5361
|
id: isEdit ? 'editBlock' : 'addBlock'
|
|
4346
5362
|
}),
|
|
4347
5363
|
open: open,
|
|
4348
|
-
onCancel: onCancel
|
|
4349
|
-
|
|
4350
|
-
}, renderModal ? {
|
|
5364
|
+
onCancel: onCancel
|
|
5365
|
+
}, getPropertyModalProps(isMobile, 720), renderModal ? {
|
|
4351
5366
|
renderModal
|
|
4352
5367
|
} : {}, {
|
|
4353
5368
|
formProps: {
|
|
@@ -4386,9 +5401,8 @@ const StepEditorModal = ({
|
|
|
4386
5401
|
id: step != null && step.id ? 'editStep' : 'addStep'
|
|
4387
5402
|
}),
|
|
4388
5403
|
open: open,
|
|
4389
|
-
onCancel: onCancel
|
|
4390
|
-
|
|
4391
|
-
}, renderModal ? {
|
|
5404
|
+
onCancel: onCancel
|
|
5405
|
+
}, getPropertyModalProps(isMobile, 560), renderModal ? {
|
|
4392
5406
|
renderModal
|
|
4393
5407
|
} : {}, {
|
|
4394
5408
|
formProps: {
|
|
@@ -4403,25 +5417,28 @@ const StepEditorModal = ({
|
|
|
4403
5417
|
cancelText: formatMessage({
|
|
4404
5418
|
id: 'cancel'
|
|
4405
5419
|
}),
|
|
4406
|
-
children: /*#__PURE__*/jsx(
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
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
|
+
})
|
|
4425
5442
|
})
|
|
4426
5443
|
}), open ? step != null && step.id ? `edit-${step.id}` : `add-step-${formData.title || 'new'}` : 'closed');
|
|
4427
5444
|
};
|
|
@@ -4446,9 +5463,8 @@ const ChoiceOptionEditorModal = ({
|
|
|
4446
5463
|
id: option != null && option.id ? 'editChoiceOption' : 'addChoiceOption'
|
|
4447
5464
|
}),
|
|
4448
5465
|
open: open,
|
|
4449
|
-
onCancel: onCancel
|
|
4450
|
-
|
|
4451
|
-
}, renderModal ? {
|
|
5466
|
+
onCancel: onCancel
|
|
5467
|
+
}, getPropertyModalProps(isMobile, 560), renderModal ? {
|
|
4452
5468
|
renderModal
|
|
4453
5469
|
} : {}, {
|
|
4454
5470
|
formProps: {
|
|
@@ -4463,26 +5479,26 @@ const ChoiceOptionEditorModal = ({
|
|
|
4463
5479
|
cancelText: formatMessage({
|
|
4464
5480
|
id: 'cancel'
|
|
4465
5481
|
}),
|
|
4466
|
-
children: /*#__PURE__*/jsx(
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
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
|
+
})
|
|
4478
5497
|
})
|
|
4479
5498
|
}), open ? option != null && option.id ? `edit-option-${option.id}` : `add-option-${formData.title || 'new'}` : 'closed');
|
|
4480
5499
|
};
|
|
4481
5500
|
var ChoiceOptionEditorModal$1 = ChoiceOptionEditorModal;
|
|
4482
5501
|
|
|
4483
|
-
const {
|
|
4484
|
-
Text: Text$3
|
|
4485
|
-
} = Typography;
|
|
4486
5502
|
const {
|
|
4487
5503
|
useOnChange
|
|
4488
5504
|
} = hooks;
|
|
@@ -4491,7 +5507,9 @@ const RulePresetsGroup = props => {
|
|
|
4491
5507
|
return render(Checkbox$1.Group);
|
|
4492
5508
|
};
|
|
4493
5509
|
RulePresetsGroup.field = Checkbox$1.Group;
|
|
4494
|
-
const RulePresetEditor = (
|
|
5510
|
+
const RulePresetEditor = ({
|
|
5511
|
+
column: _column = 1
|
|
5512
|
+
}) => {
|
|
4495
5513
|
const {
|
|
4496
5514
|
formatMessage
|
|
4497
5515
|
} = useIntl();
|
|
@@ -4534,20 +5552,15 @@ const RulePresetEditor = () => {
|
|
|
4534
5552
|
var _openApi$data2;
|
|
4535
5553
|
return ((openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.rulePresets) || []).includes(RULE_LEN_PRESET);
|
|
4536
5554
|
}
|
|
4537
|
-
}, "lenMax")
|
|
4538
|
-
block: true,
|
|
4539
|
-
children: /*#__PURE__*/jsx(Text$3, {
|
|
4540
|
-
type: "secondary",
|
|
4541
|
-
children: formatMessage({
|
|
4542
|
-
id: 'ruleEditorHint'
|
|
4543
|
-
})
|
|
4544
|
-
})
|
|
4545
|
-
}, "rule-hint")];
|
|
5555
|
+
}, "lenMax")];
|
|
4546
5556
|
return /*#__PURE__*/jsx(FormInfo, {
|
|
4547
5557
|
title: formatMessage({
|
|
4548
5558
|
id: 'fieldRule'
|
|
4549
5559
|
}),
|
|
4550
|
-
|
|
5560
|
+
subtitle: formatMessage({
|
|
5561
|
+
id: 'ruleEditorHint'
|
|
5562
|
+
}),
|
|
5563
|
+
column: _column,
|
|
4551
5564
|
list: list
|
|
4552
5565
|
});
|
|
4553
5566
|
};
|
|
@@ -5146,6 +6159,9 @@ const OptionsEditor = ({
|
|
|
5146
6159
|
title: formatMessage({
|
|
5147
6160
|
id: 'fieldOptions'
|
|
5148
6161
|
}),
|
|
6162
|
+
subtitle: formatMessage({
|
|
6163
|
+
id: 'fieldOptionsDesc'
|
|
6164
|
+
}),
|
|
5149
6165
|
column: 1,
|
|
5150
6166
|
list: [/*#__PURE__*/jsxs("div", {
|
|
5151
6167
|
block: true,
|
|
@@ -5171,7 +6187,8 @@ const OptionsEditor = ({
|
|
|
5171
6187
|
var OptionsEditor$1 = OptionsEditor;
|
|
5172
6188
|
|
|
5173
6189
|
const SuperSelectPropsEditor = ({
|
|
5174
|
-
definition
|
|
6190
|
+
definition,
|
|
6191
|
+
column: _column = 1
|
|
5175
6192
|
}) => {
|
|
5176
6193
|
const {
|
|
5177
6194
|
formatMessage
|
|
@@ -5266,13 +6283,17 @@ const SuperSelectPropsEditor = ({
|
|
|
5266
6283
|
title: formatMessage({
|
|
5267
6284
|
id: 'superSelectPropsSection'
|
|
5268
6285
|
}),
|
|
5269
|
-
|
|
5270
|
-
|
|
6286
|
+
subtitle: formatMessage({
|
|
6287
|
+
id: 'fieldPropsSectionDesc'
|
|
6288
|
+
}),
|
|
6289
|
+
column: _column,
|
|
6290
|
+
list: arrangeEditorItems(list, _column)
|
|
5271
6291
|
});
|
|
5272
6292
|
};
|
|
5273
6293
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
5274
6294
|
|
|
5275
|
-
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup'];
|
|
6295
|
+
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther'];
|
|
6296
|
+
const CHOICE_OTHER_TYPES = ['RadioGroupOther', 'CheckboxGroupOther'];
|
|
5276
6297
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item == null ? void 0 : item.name).map(item => {
|
|
5277
6298
|
if (item.type === 'boolean') {
|
|
5278
6299
|
return /*#__PURE__*/jsx(Checkbox, {
|
|
@@ -5509,19 +6530,81 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
5509
6530
|
}, "unCheckedChildren")];
|
|
5510
6531
|
case 'RadioGroup':
|
|
5511
6532
|
case 'CheckboxGroup':
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
6533
|
+
case 'RadioGroupOther':
|
|
6534
|
+
case 'CheckboxGroupOther':
|
|
6535
|
+
{
|
|
6536
|
+
const list = [/*#__PURE__*/jsx(Checkbox, {
|
|
6537
|
+
name: "inline",
|
|
6538
|
+
children: formatMessage({
|
|
6539
|
+
id: 'propOptionsInline'
|
|
6540
|
+
})
|
|
6541
|
+
}, "inline"), /*#__PURE__*/jsx(Checkbox, {
|
|
6542
|
+
name: "modern",
|
|
6543
|
+
children: formatMessage({
|
|
6544
|
+
id: 'propChoiceModern'
|
|
6545
|
+
})
|
|
6546
|
+
}, "modern"), /*#__PURE__*/jsx(Checkbox, {
|
|
6547
|
+
name: "block",
|
|
6548
|
+
children: formatMessage({
|
|
6549
|
+
id: 'propChoiceBlock'
|
|
6550
|
+
})
|
|
6551
|
+
}, "block"), /*#__PURE__*/jsx(Select, {
|
|
6552
|
+
name: "indexType",
|
|
6553
|
+
label: formatMessage({
|
|
6554
|
+
id: 'propChoiceIndexType'
|
|
6555
|
+
}),
|
|
6556
|
+
options: [{
|
|
6557
|
+
label: formatMessage({
|
|
6558
|
+
id: 'propChoiceIndexTypeLetter'
|
|
6559
|
+
}),
|
|
6560
|
+
value: 'letter'
|
|
6561
|
+
}, {
|
|
6562
|
+
label: formatMessage({
|
|
6563
|
+
id: 'propChoiceIndexTypeNumber'
|
|
6564
|
+
}),
|
|
6565
|
+
value: 'number'
|
|
6566
|
+
}, {
|
|
6567
|
+
label: formatMessage({
|
|
6568
|
+
id: 'propChoiceIndexTypeCheck'
|
|
6569
|
+
}),
|
|
6570
|
+
value: 'check'
|
|
6571
|
+
}],
|
|
6572
|
+
display: ({
|
|
6573
|
+
openApi
|
|
6574
|
+
}) => {
|
|
6575
|
+
var _openApi$data2;
|
|
6576
|
+
return !!(openApi != null && (_openApi$data2 = openApi.data) != null && _openApi$data2.modern);
|
|
6577
|
+
}
|
|
6578
|
+
}, "indexType")];
|
|
6579
|
+
if (CHOICE_OTHER_TYPES.includes(type)) {
|
|
6580
|
+
list.push(/*#__PURE__*/jsx(LocaleInput, {
|
|
6581
|
+
name: "otherLabel",
|
|
6582
|
+
label: formatMessage({
|
|
6583
|
+
id: 'propChoiceOtherLabel'
|
|
6584
|
+
}),
|
|
6585
|
+
placeholder: formatMessage({
|
|
6586
|
+
id: 'propChoiceOtherLabelHint'
|
|
6587
|
+
})
|
|
6588
|
+
}, "otherLabel"), /*#__PURE__*/jsx(LocaleInput, {
|
|
6589
|
+
name: "otherPlaceholder",
|
|
6590
|
+
label: formatMessage({
|
|
6591
|
+
id: 'propChoiceOtherPlaceholder'
|
|
6592
|
+
}),
|
|
6593
|
+
placeholder: formatMessage({
|
|
6594
|
+
id: 'propChoiceOtherPlaceholderHint'
|
|
6595
|
+
})
|
|
6596
|
+
}, "otherPlaceholder"));
|
|
6597
|
+
}
|
|
6598
|
+
return list;
|
|
6599
|
+
}
|
|
5518
6600
|
default:
|
|
5519
6601
|
return [];
|
|
5520
6602
|
}
|
|
5521
6603
|
};
|
|
5522
6604
|
const FieldPropsEditor = ({
|
|
5523
6605
|
type,
|
|
5524
|
-
definition: definitionProp
|
|
6606
|
+
definition: definitionProp,
|
|
6607
|
+
column: _column = 1
|
|
5525
6608
|
}) => {
|
|
5526
6609
|
const {
|
|
5527
6610
|
formatMessage
|
|
@@ -5544,8 +6627,11 @@ const FieldPropsEditor = ({
|
|
|
5544
6627
|
title: formatMessage({
|
|
5545
6628
|
id: 'fieldPropsSection'
|
|
5546
6629
|
}),
|
|
5547
|
-
|
|
5548
|
-
|
|
6630
|
+
subtitle: formatMessage({
|
|
6631
|
+
id: 'fieldPropsSectionDesc'
|
|
6632
|
+
}),
|
|
6633
|
+
column: _column,
|
|
6634
|
+
list: arrangeEditorItems(list, _column)
|
|
5549
6635
|
});
|
|
5550
6636
|
};
|
|
5551
6637
|
const hasFieldPropsEditor = (type, definition) => {
|
|
@@ -5710,6 +6796,19 @@ const ConditionValueInput = ({
|
|
|
5710
6796
|
value: item.value,
|
|
5711
6797
|
label: resolveLocaleText(item.label, locale) || String(item.value)
|
|
5712
6798
|
}));
|
|
6799
|
+
if ((trigger == null ? void 0 : trigger.type) === 'RadioGroupOther' || (trigger == null ? void 0 : trigger.type) === 'CheckboxGroupOther') {
|
|
6800
|
+
var _trigger$props2;
|
|
6801
|
+
const otherValue = (trigger == null || (_trigger$props2 = trigger.props) == null || (_trigger$props2 = _trigger$props2.otherOption) == null ? void 0 : _trigger$props2.value) != null && String(trigger.props.otherOption.value).trim() ? String(trigger.props.otherOption.value).trim() : 'other';
|
|
6802
|
+
if (!options.some(item => String(item.value) === otherValue)) {
|
|
6803
|
+
var _trigger$props3;
|
|
6804
|
+
options.push({
|
|
6805
|
+
value: otherValue,
|
|
6806
|
+
label: resolveLocaleText(trigger == null || (_trigger$props3 = trigger.props) == null || (_trigger$props3 = _trigger$props3.otherOption) == null ? void 0 : _trigger$props3.label, locale) || formatMessage({
|
|
6807
|
+
id: 'FieldTypeOtherOption'
|
|
6808
|
+
})
|
|
6809
|
+
});
|
|
6810
|
+
}
|
|
6811
|
+
}
|
|
5713
6812
|
const value = multiple ? Array.isArray(condition.value) ? condition.value : condition.value != null ? [condition.value] : [] : Array.isArray(condition.value) ? condition.value[0] : condition.value;
|
|
5714
6813
|
return /*#__PURE__*/jsx(Select$1, {
|
|
5715
6814
|
className: style['visible-when-value']
|
|
@@ -5942,7 +7041,7 @@ const VisibleWhenEditor = ({
|
|
|
5942
7041
|
};
|
|
5943
7042
|
var VisibleWhenEditor$1 = VisibleWhenEditor;
|
|
5944
7043
|
|
|
5945
|
-
const _excluded$
|
|
7044
|
+
const _excluded$3 = ["columns"];
|
|
5946
7045
|
const {
|
|
5947
7046
|
Text
|
|
5948
7047
|
} = Typography;
|
|
@@ -5958,7 +7057,7 @@ const getDefaultSelectProps = () => ({
|
|
|
5958
7057
|
columns: [createEmptyColumn()]
|
|
5959
7058
|
});
|
|
5960
7059
|
const omitColumns = (_ref = {}) => {
|
|
5961
|
-
let rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
7060
|
+
let rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
5962
7061
|
return rest;
|
|
5963
7062
|
};
|
|
5964
7063
|
const FieldConfigFields = ({
|
|
@@ -5977,6 +7076,7 @@ const FieldConfigFields = ({
|
|
|
5977
7076
|
const {
|
|
5978
7077
|
openApi
|
|
5979
7078
|
} = useFormContext();
|
|
7079
|
+
const column = getEditorColumn(useIsMobile());
|
|
5980
7080
|
const [fieldType, setFieldType] = useState(initialType);
|
|
5981
7081
|
const fieldTypeOptions = useMemo(() => getFieldTypes(formatMessage), [formatMessage]);
|
|
5982
7082
|
const definition = getFieldDefinition(fieldType);
|
|
@@ -6009,7 +7109,7 @@ const FieldConfigFields = ({
|
|
|
6009
7109
|
});
|
|
6010
7110
|
});
|
|
6011
7111
|
};
|
|
6012
|
-
const
|
|
7112
|
+
const basicList = [/*#__PURE__*/jsx(Select, {
|
|
6013
7113
|
name: "type",
|
|
6014
7114
|
label: formatMessage({
|
|
6015
7115
|
id: 'fieldType'
|
|
@@ -6048,6 +7148,7 @@ const FieldConfigFields = ({
|
|
|
6048
7148
|
})
|
|
6049
7149
|
}, "tips"), /*#__PURE__*/jsx(LocaleTextArea, {
|
|
6050
7150
|
name: "description",
|
|
7151
|
+
block: true,
|
|
6051
7152
|
label: formatMessage({
|
|
6052
7153
|
id: 'fieldDescription'
|
|
6053
7154
|
}),
|
|
@@ -6056,7 +7157,7 @@ const FieldConfigFields = ({
|
|
|
6056
7157
|
}),
|
|
6057
7158
|
rows: 2
|
|
6058
7159
|
}, "description")];
|
|
6059
|
-
|
|
7160
|
+
const displayList = [/*#__PURE__*/jsx(Checkbox, {
|
|
6060
7161
|
name: "block",
|
|
6061
7162
|
children: formatMessage({
|
|
6062
7163
|
id: 'fieldBlock'
|
|
@@ -6066,21 +7167,26 @@ const FieldConfigFields = ({
|
|
|
6066
7167
|
children: formatMessage({
|
|
6067
7168
|
id: 'fieldHidden'
|
|
6068
7169
|
})
|
|
6069
|
-
}, "hidden")
|
|
7170
|
+
}, "hidden")];
|
|
6070
7171
|
return /*#__PURE__*/jsxs("div", {
|
|
6071
7172
|
className: style['field-editor-form'],
|
|
6072
7173
|
children: [/*#__PURE__*/jsx(FormInfo, {
|
|
6073
7174
|
title: formatMessage({
|
|
6074
7175
|
id: 'fieldBasicSection'
|
|
6075
7176
|
}),
|
|
6076
|
-
|
|
6077
|
-
|
|
7177
|
+
subtitle: formatMessage({
|
|
7178
|
+
id: 'fieldBasicSectionDesc'
|
|
7179
|
+
}),
|
|
7180
|
+
column: column,
|
|
7181
|
+
list: basicList
|
|
6078
7182
|
}), definition != null && definition.isSuperSelect ? /*#__PURE__*/jsx(SuperSelectPropsEditor$1, {
|
|
6079
|
-
definition: definition
|
|
7183
|
+
definition: definition,
|
|
7184
|
+
column: column
|
|
6080
7185
|
}) : hasFieldPropsEditor(fieldType, definition) ? /*#__PURE__*/jsx(FieldPropsEditor$1, {
|
|
6081
7186
|
type: fieldType,
|
|
6082
|
-
definition: definition
|
|
6083
|
-
|
|
7187
|
+
definition: definition,
|
|
7188
|
+
column: column
|
|
7189
|
+
}) : null, definition != null && definition.hasBuiltinData ? /*#__PURE__*/jsx(Text, {
|
|
6084
7190
|
type: "secondary",
|
|
6085
7191
|
children: formatMessage({
|
|
6086
7192
|
id: 'builtinDataHint'
|
|
@@ -6093,7 +7199,18 @@ const FieldConfigFields = ({
|
|
|
6093
7199
|
hasColumns: definition.hasColumns,
|
|
6094
7200
|
columns: columns,
|
|
6095
7201
|
onColumnsChange: onColumnsChange
|
|
6096
|
-
}) : null,
|
|
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, {
|
|
6097
7214
|
value: visibleWhen,
|
|
6098
7215
|
onChange: onVisibleWhenChange
|
|
6099
7216
|
})) : null]
|
|
@@ -6198,9 +7315,8 @@ const FieldEditorModal = ({
|
|
|
6198
7315
|
id: isEdit ? 'editField' : 'addField'
|
|
6199
7316
|
}),
|
|
6200
7317
|
open: open,
|
|
6201
|
-
onCancel: onCancel
|
|
6202
|
-
|
|
6203
|
-
}, renderModal ? {
|
|
7318
|
+
onCancel: onCancel
|
|
7319
|
+
}, getPropertyModalProps(isMobile, 760), renderModal ? {
|
|
6204
7320
|
renderModal
|
|
6205
7321
|
} : {}, {
|
|
6206
7322
|
formProps: {
|
|
@@ -6240,6 +7356,7 @@ const FormActionsEditor = ({
|
|
|
6240
7356
|
formatMessage
|
|
6241
7357
|
} = useIntl();
|
|
6242
7358
|
const isMobile = useIsMobile();
|
|
7359
|
+
const column = getEditorColumn(isMobile);
|
|
6243
7360
|
const formData = useMemo(() => normalizeFormActions(value), [value, open]);
|
|
6244
7361
|
const alignOptions = useMemo(() => [{
|
|
6245
7362
|
label: formatMessage({
|
|
@@ -6271,9 +7388,8 @@ const FormActionsEditor = ({
|
|
|
6271
7388
|
id: 'formActionsSection'
|
|
6272
7389
|
}),
|
|
6273
7390
|
open: open,
|
|
6274
|
-
onCancel: onCancel
|
|
6275
|
-
|
|
6276
|
-
}, renderModal ? {
|
|
7391
|
+
onCancel: onCancel
|
|
7392
|
+
}, getPropertyModalProps(isMobile, 560), renderModal ? {
|
|
6277
7393
|
renderModal
|
|
6278
7394
|
} : {}, {
|
|
6279
7395
|
formProps: {
|
|
@@ -6289,9 +7405,15 @@ const FormActionsEditor = ({
|
|
|
6289
7405
|
id: 'cancel'
|
|
6290
7406
|
}),
|
|
6291
7407
|
children: /*#__PURE__*/jsxs("div", {
|
|
6292
|
-
className: style['form-actions-editor']
|
|
7408
|
+
className: `${style['field-editor-form']} ${style['form-actions-editor']}`,
|
|
6293
7409
|
children: [/*#__PURE__*/jsx(FormInfo, {
|
|
6294
|
-
|
|
7410
|
+
title: formatMessage({
|
|
7411
|
+
id: 'formActionsButtonsSection'
|
|
7412
|
+
}),
|
|
7413
|
+
subtitle: formatMessage({
|
|
7414
|
+
id: 'formActionsButtonsSectionDesc'
|
|
7415
|
+
}),
|
|
7416
|
+
column: column,
|
|
6295
7417
|
list: [/*#__PURE__*/jsx(Switch, {
|
|
6296
7418
|
name: "showSubmit",
|
|
6297
7419
|
label: formatMessage({
|
|
@@ -6312,10 +7434,7 @@ const FormActionsEditor = ({
|
|
|
6312
7434
|
var _openApi$data;
|
|
6313
7435
|
return Boolean(openApi == null || (_openApi$data = openApi.data) == null ? void 0 : _openApi$data.showSubmit);
|
|
6314
7436
|
}
|
|
6315
|
-
}, "submitText")
|
|
6316
|
-
}), /*#__PURE__*/jsx(FormInfo, {
|
|
6317
|
-
column: 2,
|
|
6318
|
-
list: [/*#__PURE__*/jsx(Switch, {
|
|
7437
|
+
}, "submitText"), /*#__PURE__*/jsx(Switch, {
|
|
6319
7438
|
name: "showReset",
|
|
6320
7439
|
label: formatMessage({
|
|
6321
7440
|
id: 'formActionsShowReset'
|
|
@@ -6335,10 +7454,7 @@ const FormActionsEditor = ({
|
|
|
6335
7454
|
var _openApi$data2;
|
|
6336
7455
|
return Boolean(openApi == null || (_openApi$data2 = openApi.data) == null ? void 0 : _openApi$data2.showReset);
|
|
6337
7456
|
}
|
|
6338
|
-
}, "resetText")
|
|
6339
|
-
}), /*#__PURE__*/jsx(FormInfo, {
|
|
6340
|
-
column: 2,
|
|
6341
|
-
list: [/*#__PURE__*/jsx(Switch, {
|
|
7457
|
+
}, "resetText"), /*#__PURE__*/jsx(Switch, {
|
|
6342
7458
|
name: "showCancel",
|
|
6343
7459
|
label: formatMessage({
|
|
6344
7460
|
id: 'formActionsShowCancel'
|
|
@@ -6359,39 +7475,37 @@ const FormActionsEditor = ({
|
|
|
6359
7475
|
return Boolean(openApi == null || (_openApi$data3 = openApi.data) == null ? void 0 : _openApi$data3.showCancel);
|
|
6360
7476
|
}
|
|
6361
7477
|
}, "cancelText")]
|
|
6362
|
-
}), /*#__PURE__*/
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
}, "gap")]
|
|
6394
|
-
})]
|
|
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")]
|
|
6395
7509
|
})]
|
|
6396
7510
|
})
|
|
6397
7511
|
}), open ? 'form-actions-open' : 'form-actions-closed');
|
|
@@ -6680,6 +7794,203 @@ const ChoiceBlock = ({
|
|
|
6680
7794
|
};
|
|
6681
7795
|
var ChoiceBlock$1 = ChoiceBlock;
|
|
6682
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
|
+
if (await validateFieldsByName(openApi, getStepFieldNames(items[current]))) {
|
|
7875
|
+
onChange(current + 1);
|
|
7876
|
+
}
|
|
7877
|
+
} finally {
|
|
7878
|
+
setLoading(false);
|
|
7879
|
+
}
|
|
7880
|
+
};
|
|
7881
|
+
return /*#__PURE__*/jsxs("div", {
|
|
7882
|
+
className: style['steps-focus-actions'],
|
|
7883
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
7884
|
+
className: style['steps-focus-actions-side'],
|
|
7885
|
+
children: !isFirst ? /*#__PURE__*/jsx(Button, {
|
|
7886
|
+
className: style['steps-focus-prev'],
|
|
7887
|
+
variant: "text",
|
|
7888
|
+
color: "default",
|
|
7889
|
+
icon: /*#__PURE__*/jsx(ArrowLeftOutlined, {}),
|
|
7890
|
+
onClick: () => onChange(current - 1),
|
|
7891
|
+
children: formatMessage({
|
|
7892
|
+
id: 'stepsFocusPrev'
|
|
7893
|
+
})
|
|
7894
|
+
}) : null
|
|
7895
|
+
}), /*#__PURE__*/jsx("div", {
|
|
7896
|
+
className: cx(style['steps-focus-actions-side'], style['is-end']),
|
|
7897
|
+
children: isLast ? /*#__PURE__*/jsx("span", {
|
|
7898
|
+
className: style['steps-focus-done-hint'],
|
|
7899
|
+
children: formatMessage({
|
|
7900
|
+
id: 'stepsFocusSubmitHint'
|
|
7901
|
+
})
|
|
7902
|
+
}) : /*#__PURE__*/jsxs(Button, {
|
|
7903
|
+
className: style['steps-focus-next-btn'],
|
|
7904
|
+
variant: "filled",
|
|
7905
|
+
color: "primary",
|
|
7906
|
+
loading: loading,
|
|
7907
|
+
onClick: handleNext,
|
|
7908
|
+
children: [formatMessage({
|
|
7909
|
+
id: 'stepsFocusNextBtn'
|
|
7910
|
+
}), /*#__PURE__*/jsx(ArrowRightOutlined, {
|
|
7911
|
+
className: style['steps-focus-next-btn-icon']
|
|
7912
|
+
})]
|
|
7913
|
+
})
|
|
7914
|
+
})]
|
|
7915
|
+
});
|
|
7916
|
+
};
|
|
7917
|
+
|
|
7918
|
+
/**
|
|
7919
|
+
* stepsStyle: 'focus':受控 current,用自绘头部(序号 / 标题 / 分段进度)替换 antd 步骤条,
|
|
7920
|
+
* 并用自绘底部操作区替换 form-info 的链接式上一步 / 下一步;提交失败跳错步、重置仍由 form-info Steps 负责。
|
|
7921
|
+
*/
|
|
7922
|
+
const FocusSteps = _ref => {
|
|
7923
|
+
let {
|
|
7924
|
+
items = [],
|
|
7925
|
+
formatMessage,
|
|
7926
|
+
stepsClassName
|
|
7927
|
+
} = _ref,
|
|
7928
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
7929
|
+
const [current, setCurrent] = useState(0);
|
|
7930
|
+
const headerRef = useRef(null);
|
|
7931
|
+
const mountedRef = useRef(false);
|
|
7932
|
+
const safeCurrent = Math.min(current, Math.max(items.length - 1, 0));
|
|
7933
|
+
const stepTitle = index => {
|
|
7934
|
+
var _items$index;
|
|
7935
|
+
return ((_items$index = items[index]) == null ? void 0 : _items$index.title) || formatMessage({
|
|
7936
|
+
id: 'untitledStep'
|
|
7937
|
+
}, {
|
|
7938
|
+
index: index + 1
|
|
7939
|
+
});
|
|
7940
|
+
};
|
|
7941
|
+
useEffect(() => {
|
|
7942
|
+
if (!mountedRef.current) {
|
|
7943
|
+
mountedRef.current = true;
|
|
7944
|
+
return;
|
|
7945
|
+
}
|
|
7946
|
+
const node = headerRef.current;
|
|
7947
|
+
if (node && node.getBoundingClientRect().top < 0) {
|
|
7948
|
+
node.scrollIntoView({
|
|
7949
|
+
behavior: 'smooth',
|
|
7950
|
+
block: 'start'
|
|
7951
|
+
});
|
|
7952
|
+
}
|
|
7953
|
+
}, [safeCurrent]);
|
|
7954
|
+
const focusItems = items.map((item, index) => {
|
|
7955
|
+
if (index !== safeCurrent) {
|
|
7956
|
+
return item;
|
|
7957
|
+
}
|
|
7958
|
+
return _extends({}, item, {
|
|
7959
|
+
title: /*#__PURE__*/jsx("div", {
|
|
7960
|
+
ref: headerRef,
|
|
7961
|
+
children: /*#__PURE__*/jsx(FocusStepsHeader, {
|
|
7962
|
+
items: items,
|
|
7963
|
+
current: safeCurrent,
|
|
7964
|
+
stepTitle: stepTitle,
|
|
7965
|
+
formatMessage: formatMessage,
|
|
7966
|
+
onJump: setCurrent
|
|
7967
|
+
})
|
|
7968
|
+
}),
|
|
7969
|
+
children: /*#__PURE__*/jsxs(Fragment, {
|
|
7970
|
+
children: [item.children != null ? item.children : /*#__PURE__*/jsx(FormInfo, {
|
|
7971
|
+
column: item.column,
|
|
7972
|
+
gap: item.gap,
|
|
7973
|
+
list: item.list || []
|
|
7974
|
+
}), /*#__PURE__*/jsx(FocusStepsActions, {
|
|
7975
|
+
items: items,
|
|
7976
|
+
current: safeCurrent,
|
|
7977
|
+
formatMessage: formatMessage,
|
|
7978
|
+
onChange: setCurrent
|
|
7979
|
+
})]
|
|
7980
|
+
})
|
|
7981
|
+
});
|
|
7982
|
+
});
|
|
7983
|
+
return /*#__PURE__*/jsx(Steps, _extends({}, props, {
|
|
7984
|
+
showActions: false,
|
|
7985
|
+
orientation: "horizontal",
|
|
7986
|
+
stepsClassName: cx(stepsClassName, style['steps-focus']),
|
|
7987
|
+
items: focusItems,
|
|
7988
|
+
current: safeCurrent,
|
|
7989
|
+
onChange: setCurrent
|
|
7990
|
+
}));
|
|
7991
|
+
};
|
|
7992
|
+
var FocusSteps$1 = FocusSteps;
|
|
7993
|
+
|
|
6683
7994
|
const _excluded$1 = ["entries", "nested", "knownNames"];
|
|
6684
7995
|
|
|
6685
7996
|
/**
|
|
@@ -6825,12 +8136,13 @@ const renderFieldEntries = (fields = [], preview = false, {
|
|
|
6825
8136
|
}
|
|
6826
8137
|
delete props.range;
|
|
6827
8138
|
|
|
6828
|
-
//
|
|
6829
|
-
|
|
8139
|
+
// 选择组:form-creator 的 inline 仅编辑器用;渲染时删掉。block/modern 交给 react-form-antd;
|
|
8140
|
+
// 未开 block 且 inline=false 时沿用旧纵向兜底
|
|
8141
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup' || field.type === 'RadioGroupOther' || field.type === 'CheckboxGroupOther') {
|
|
6830
8142
|
const optionsInline = props.inline !== false;
|
|
6831
8143
|
delete props.inline;
|
|
6832
|
-
if (!optionsInline) {
|
|
6833
|
-
if (field.type === 'RadioGroup') {
|
|
8144
|
+
if (!props.block && !optionsInline) {
|
|
8145
|
+
if (field.type === 'RadioGroup' || field.type === 'RadioGroupOther') {
|
|
6834
8146
|
props.vertical = true;
|
|
6835
8147
|
}
|
|
6836
8148
|
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
@@ -7052,14 +8364,44 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7052
8364
|
addText: block.addText
|
|
7053
8365
|
} : {})), asListItem);
|
|
7054
8366
|
}
|
|
8367
|
+
case 'matrixScale':
|
|
8368
|
+
{
|
|
8369
|
+
const FieldComponent = getFieldComponent(block.fieldType || 'RadioGroup');
|
|
8370
|
+
if (!FieldComponent) {
|
|
8371
|
+
return null;
|
|
8372
|
+
}
|
|
8373
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
8374
|
+
return withBlockLayout(/*#__PURE__*/createElement(MatrixScale, _extends({
|
|
8375
|
+
key: block.id,
|
|
8376
|
+
name: block.name,
|
|
8377
|
+
title: block.title || undefined,
|
|
8378
|
+
rowTitle: block.rowTitle || undefined,
|
|
8379
|
+
bordered,
|
|
8380
|
+
field: FieldComponent,
|
|
8381
|
+
rule: block.rule || undefined,
|
|
8382
|
+
rows: block.rows || []
|
|
8383
|
+
}, layout === 'options' ? {
|
|
8384
|
+
options: block.options || []
|
|
8385
|
+
} : null, layout === 'columns' ? {
|
|
8386
|
+
columns: block.columns || []
|
|
8387
|
+
} : null, listItemPartProps || {}, {
|
|
8388
|
+
className: resolvePartRootClassName(depth)
|
|
8389
|
+
}, locale ? {
|
|
8390
|
+
locale
|
|
8391
|
+
} : {})), asListItem);
|
|
8392
|
+
}
|
|
7055
8393
|
case 'steps':
|
|
7056
8394
|
{
|
|
7057
|
-
|
|
8395
|
+
const isFocusSteps = block.stepsStyle === 'focus';
|
|
8396
|
+
return withBlockLayout(/*#__PURE__*/createElement(isFocusSteps ? FocusSteps$1 : Steps, _extends({
|
|
7058
8397
|
key: block.id,
|
|
7059
8398
|
title: block.title || undefined,
|
|
7060
8399
|
subtitle: block.subtitle || undefined,
|
|
7061
8400
|
bordered,
|
|
7062
|
-
className: resolvePartRootClassName(depth)
|
|
8401
|
+
className: resolvePartRootClassName(depth)
|
|
8402
|
+
}, isFocusSteps ? {
|
|
8403
|
+
formatMessage
|
|
8404
|
+
} : null, {
|
|
7063
8405
|
prevIcon: /*#__PURE__*/createElement(ArrowLeftOutlined),
|
|
7064
8406
|
nextIcon: /*#__PURE__*/createElement(ArrowRightOutlined),
|
|
7065
8407
|
items: (block.items || []).map(step => {
|
|
@@ -7092,7 +8434,7 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7092
8434
|
fieldNames
|
|
7093
8435
|
};
|
|
7094
8436
|
})
|
|
7095
|
-
}), asListItem);
|
|
8437
|
+
})), asListItem);
|
|
7096
8438
|
}
|
|
7097
8439
|
case 'choice':
|
|
7098
8440
|
return withBlockLayout(/*#__PURE__*/createElement(ChoiceBlock$1, {
|
|
@@ -7500,6 +8842,12 @@ const FormCreator = withLocale$1(({
|
|
|
7500
8842
|
const handleMoveBlock = (blockId, direction) => {
|
|
7501
8843
|
updateSchema(updateBlocks(schema, blocks => moveBlockInTree(blocks, blockId, direction)));
|
|
7502
8844
|
};
|
|
8845
|
+
const handlePatchBlock = block => {
|
|
8846
|
+
if (!(block != null && block.id)) {
|
|
8847
|
+
return;
|
|
8848
|
+
}
|
|
8849
|
+
updateSchema(mapBlocks(schema, block.id, () => block));
|
|
8850
|
+
};
|
|
7503
8851
|
const handleAddStep = blockId => {
|
|
7504
8852
|
setStepContext({
|
|
7505
8853
|
blockId,
|
|
@@ -7730,6 +9078,7 @@ const FormCreator = withLocale$1(({
|
|
|
7730
9078
|
onEditBlock: handleEditBlock,
|
|
7731
9079
|
onDeleteBlock: handleDeleteBlock,
|
|
7732
9080
|
onMoveBlock: handleMoveBlock,
|
|
9081
|
+
onPatchBlock: handlePatchBlock,
|
|
7733
9082
|
onAddField: handleAddField,
|
|
7734
9083
|
onEditField: handleEditField,
|
|
7735
9084
|
onDeleteField: handleDeleteField,
|
|
@@ -8592,6 +9941,68 @@ const walkBlock = (block, layer, depth = 0, ctx = {}) => {
|
|
|
8592
9941
|
layer.properties[name] = arraySchema;
|
|
8593
9942
|
return;
|
|
8594
9943
|
}
|
|
9944
|
+
case 'matrixScale':
|
|
9945
|
+
{
|
|
9946
|
+
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
9947
|
+
if (!name) {
|
|
9948
|
+
return;
|
|
9949
|
+
}
|
|
9950
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
9951
|
+
const fieldType = block.fieldType || 'RadioGroup';
|
|
9952
|
+
const required = typeof block.rule === 'string' && block.rule.split(' ').includes('REQ');
|
|
9953
|
+
const properties = {};
|
|
9954
|
+
const requiredKeys = [];
|
|
9955
|
+
(block.rows || []).forEach(row => {
|
|
9956
|
+
const rowName = (row == null ? void 0 : row.name) != null && String(row.name).trim() ? String(row.name).trim() : '';
|
|
9957
|
+
if (!rowName) {
|
|
9958
|
+
return;
|
|
9959
|
+
}
|
|
9960
|
+
if (layout === 'columns') {
|
|
9961
|
+
const columnProperties = {};
|
|
9962
|
+
(block.columns || []).forEach(column => {
|
|
9963
|
+
const columnName = (column == null ? void 0 : column.name) != null && String(column.name).trim() ? String(column.name).trim() : '';
|
|
9964
|
+
if (!columnName) {
|
|
9965
|
+
return;
|
|
9966
|
+
}
|
|
9967
|
+
columnProperties[columnName] = resolveFieldValueSchema({
|
|
9968
|
+
type: fieldType,
|
|
9969
|
+
label: column.label,
|
|
9970
|
+
rule: block.rule,
|
|
9971
|
+
props: {}
|
|
9972
|
+
});
|
|
9973
|
+
});
|
|
9974
|
+
properties[rowName] = {
|
|
9975
|
+
type: 'object',
|
|
9976
|
+
title: row.label || undefined,
|
|
9977
|
+
properties: columnProperties
|
|
9978
|
+
};
|
|
9979
|
+
} else {
|
|
9980
|
+
properties[rowName] = resolveFieldValueSchema({
|
|
9981
|
+
type: fieldType,
|
|
9982
|
+
label: row.label,
|
|
9983
|
+
rule: block.rule,
|
|
9984
|
+
props: layout === 'options' ? {
|
|
9985
|
+
options: block.options || []
|
|
9986
|
+
} : {}
|
|
9987
|
+
});
|
|
9988
|
+
}
|
|
9989
|
+
if (required) {
|
|
9990
|
+
requiredKeys.push(rowName);
|
|
9991
|
+
}
|
|
9992
|
+
});
|
|
9993
|
+
const objectSchema = {
|
|
9994
|
+
type: 'object',
|
|
9995
|
+
properties
|
|
9996
|
+
};
|
|
9997
|
+
if (block.title) {
|
|
9998
|
+
objectSchema.title = block.title;
|
|
9999
|
+
}
|
|
10000
|
+
if (requiredKeys.length) {
|
|
10001
|
+
objectSchema.required = requiredKeys;
|
|
10002
|
+
}
|
|
10003
|
+
layer.properties[name] = objectSchema;
|
|
10004
|
+
return;
|
|
10005
|
+
}
|
|
8595
10006
|
case 'steps':
|
|
8596
10007
|
{
|
|
8597
10008
|
(block.items || []).forEach(step => {
|