@kne/form-creator 0.1.25 → 0.1.27
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 +94 -6
- package/dist/index.css +69 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +938 -30
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +946 -41
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +39 -0
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +39 -0
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +39 -0
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +39 -0
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +5 -5
package/dist/index.modern.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
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,
|
|
4
|
+
import { createContext, useContext, useRef, useCallback, useEffect, useState, useMemo, createElement, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { Input as Input$1, Space, Tag, Tooltip, Button, Typography, Flex, Dropdown, Empty, message, Checkbox as Checkbox$1, InputNumber as InputNumber$1, Card, Switch as Switch$1, Radio, Select as Select$1 } from 'antd';
|
|
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, LockOutlined, EyeInvisibleOutlined, BranchesOutlined, WarningOutlined, ColumnWidthOutlined, ArrowUpOutlined, ArrowDownOutlined, EditOutlined, DeleteOutlined, PlusOutlined, SettingOutlined, UnorderedListOutlined, TableOutlined, ProfileOutlined, ClusterOutlined, PartitionOutlined, BorderOuterOutlined, OrderedListOutlined, SelectOutlined, ArrowLeftOutlined, ArrowRightOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
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
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
|
-
import FormInfo, { FormModal, Form, Steps, MultiField, EditableList, TableList, List } from '@kne/form-info';
|
|
15
|
+
import FormInfo, { FormModal, Form, Steps, MatrixScale, MultiField, EditableList, TableList, List } from '@kne/form-info';
|
|
16
16
|
import { ButtonFooter } from '@kne/button-group';
|
|
17
17
|
import InfoPage from '@kne/info-page';
|
|
18
18
|
import { createWithRemoteLoader } from '@kne/remote-loader';
|
|
19
19
|
|
|
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-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-summary-type":"kne-form-creator_0iyhP","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","visible-when-editor":"kne-form-creator_ttGnB","visible-when-hint":"kne-form-creator_hPtdv","visible-when-list":"kne-form-creator_aoAt6","visible-when-row":"kne-form-creator_phRgr","visible-when-row-main":"kne-form-creator_l-J7d","visible-when-field":"kne-form-creator_YRh5W","visible-when-operator":"kne-form-creator_DIqFq","visible-when-value":"kne-form-creator_CHcia","visible-when-regex":"kne-form-creator_lKpVo","visible-when-flags":"kne-form-creator_Ps-cu","visible-when-regex-tester":"kne-form-creator_Wf4eG","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","
|
|
20
|
+
var style = {"kne-responsive-boundary":"kne-form-creator_gh14z","kne-responsive-scroll":"kne-form-creator_Kfn6L","option-group-stack":"kne-form-creator_TgBT-","form-info-show-index":"kne-form-creator_rqCos","field-label-index":"kne-form-creator_MLY0O","field-label-main":"kne-form-creator_UOUb4","form-creator":"kne-form-creator_Xrjrk","editor-pane":"kne-form-creator_Skfuv","preview-pane":"kne-form-creator_v4Lsp","editor-header":"kne-form-creator_WaSS-","block-list-panel":"kne-form-creator_lx8An","form-actions-setting-btn":"kne-form-creator_NekU2","panel-toolbar":"kne-form-creator_t0WxZ","panel-toolbar-extra":"kne-form-creator_O22ZM","schema-content":"kne-form-creator_9bWOD","schema-content-fields":"kne-form-creator_EmRDV","schema-content-field":"kne-form-creator_0Lanz","schema-content-field-block":"kne-form-creator_TQd-w","schema-content-field-label":"kne-form-creator_czEK3","schema-content-field-value":"kne-form-creator_YFKTK","schema-content-file-list":"kne-form-creator_UGdXA","schema-content-file":"kne-form-creator_75EtE","schema-content-file-image":"kne-form-creator_P-be6","schema-content-file-name":"kne-form-creator_NXpTS","add-block-btn":"kne-form-creator_16Zre","add-inline-btn":"kne-form-creator_iCYdB","ant-btn-disabled":"kne-form-creator_LdGtv","block-list":"kne-form-creator_wK5eK","block-section":"kne-form-creator_15IiK","block-kind-formInfo":"kne-form-creator_D0hoK","block-kind-list":"kne-form-creator_JdPhy","block-kind-tableList":"kne-form-creator_gzd64","block-kind-editableList":"kne-form-creator_JzwrQ","block-kind-multiField":"kne-form-creator_t0iOJ","block-kind-matrixScale":"kne-form-creator_CFlQv","matrix-scale-editor-title":"kne-form-creator_Zo1Rz","block-kind-steps":"kne-form-creator_QNF9W","step-section":"kne-form-creator_22ajp","block-section-header":"kne-form-creator_wS4rL","block-header-left":"kne-form-creator_t4awC","block-title":"kne-form-creator_wSVJf","block-summary":"kne-form-creator_GzeW8","block-summary-type":"kne-form-creator_0iyhP","block-header-actions":"kne-form-creator_Ue-nT","block-body":"kne-form-creator_je1H0","item-blocks-section":"kne-form-creator_wq4bT","nested-block-list":"kne-form-creator_4NWH4","block-section-nested":"kne-form-creator_mUKom","add-field-dropdown":"kne-form-creator_9JS0d","add-field-dropdown-item":"kne-form-creator_Ql1z3","add-field-dropdown-item-icon":"kne-form-creator_ZHB5O","add-field-dropdown-item-desc":"kne-form-creator_dcsOS","add-field-dropdown-divider":"kne-form-creator_CUK0H","add-field-dropdown-label":"kne-form-creator_bPJ-2","section-toolbar":"kne-form-creator_LUO8S","section-toolbar-label":"kne-form-creator_7KQ79","field-list":"kne-form-creator_-B7WZ","step-list":"kne-form-creator_kc1pH","step-section-header":"kne-form-creator_wkhEX","step-section-title":"kne-form-creator_NBinE","step-section-actions":"kne-form-creator_es-FC","step-index":"kne-form-creator_CCKZZ","field-row":"kne-form-creator_XMkdt","field-row-index":"kne-form-creator_a-cDo","field-row-main":"kne-form-creator_ftlwp","field-row-label":"kne-form-creator_XAxbE","inline-empty":"kne-form-creator_yP-RF","action-group":"kne-form-creator_773yo","hover-reveal":"kne-form-creator_S234h","hover-reveal-active":"kne-form-creator_AE-6r","action-btn":"kne-form-creator_mLgqh","add-block-dropdown":"kne-form-creator_vmS-e","add-block-option":"kne-form-creator_gjg2Y","add-block-option-icon":"kne-form-creator_qh1hh","add-block-option-text":"kne-form-creator_G8iJO","add-block-option-title":"kne-form-creator_ETSvm","add-block-option-desc":"kne-form-creator_O0C3l","field-empty":"kne-form-creator_Nmpfl","field-label-tips-icon":"kne-form-creator_0VVaO","preview-header":"kne-form-creator_c4BT0","preview-title":"kne-form-creator_fPkK4","preview-body":"kne-form-creator_6JntQ","schema-form":"kne-form-creator_MxCWP","schema-body":"kne-form-creator_q9ydz","schema-actions":"kne-form-creator_Y4eEH","schema-actions-inner":"kne-form-creator_FT9Zf","choice-block":"kne-form-creator_RllJe","choice-selector":"kne-form-creator_5A1eM","choice-panels":"kne-form-creator_IO0MY","choice-panels-empty":"kne-form-creator_T0nND","choice-option-panel":"kne-form-creator_FQixN","choice-option-panel-title":"kne-form-creator_ofRo2","choice-option-summary":"kne-form-creator_pksH8","field-editor-form":"kne-form-creator_PGPHL","form-actions-editor":"kne-form-creator_fchMy","form-actions-switch-field":"kne-form-creator_6JE9x","form-actions-layout-panel":"kne-form-creator_rtm9D","form-actions-align-group":"kne-form-creator_51ZsV","form-actions-layout-title":"kne-form-creator_hFeiC","form-actions-gap-slider":"kne-form-creator_Gq0bk","editor-section":"kne-form-creator_jJy85","section-divider":"kne-form-creator_zA7L-","rule-editor":"kne-form-creator_bAlGU","options-editor":"kne-form-creator_AK4yO","super-select-props":"kne-form-creator_Iawhh","field-props-editor":"kne-form-creator_Gabf2","columns-editor":"kne-form-creator_DQW1N","prop-row":"kne-form-creator_7K54P","prop-label":"kne-form-creator_HAAyH","options-item":"kne-form-creator_dnOd2","table-row-card":"kne-form-creator_cwCYp","tree-options-editor":"kne-form-creator_s3nHO","tree-options-list":"kne-form-creator_Djs-E","tree-option-node":"kne-form-creator_XAcut","tree-option-row":"kne-form-creator_4K4Rj","tree-option-fields":"kne-form-creator_-4cjc","tree-option-actions":"kne-form-creator_IjCNI","tree-option-children":"kne-form-creator_pVPGJ","tree-add-sibling":"kne-form-creator_bl46P","rule-checkbox-group":"kne-form-creator_tDgVP","rule-len-row":"kne-form-creator_ATsae","rule-len-input":"kne-form-creator_jY4Ld","rule-len-sep":"kne-form-creator_jBDC8","options-list":"kne-form-creator_GUBNS","options-row":"kne-form-creator_uohD0","options-header":"kne-form-creator_As4L6","options-locale-text":"kne-form-creator_7-99l","options-header-label":"kne-form-creator_UhnVH","options-header-value":"kne-form-creator_2c35V","options-header-description":"kne-form-creator_ibWvX","icon-square-btn-sm":"kne-form-creator_GAh-t","options-header-action":"kne-form-creator_nTN1E","visible-when-editor":"kne-form-creator_ttGnB","visible-when-hint":"kne-form-creator_hPtdv","visible-when-list":"kne-form-creator_aoAt6","visible-when-row":"kne-form-creator_phRgr","visible-when-row-main":"kne-form-creator_l-J7d","visible-when-field":"kne-form-creator_YRh5W","visible-when-operator":"kne-form-creator_DIqFq","visible-when-value":"kne-form-creator_CHcia","visible-when-regex":"kne-form-creator_lKpVo","visible-when-flags":"kne-form-creator_Ps-cu","visible-when-regex-tester":"kne-form-creator_Wf4eG","options-tip":"kne-form-creator_vrTmK","icon-square-btn":"kne-form-creator_DZjCf","locale-text":"kne-form-creator_hMXkE","is-compact":"kne-form-creator_jBFpL","locale-text-item":"kne-form-creator_NqCQD","locale-text-prefix":"kne-form-creator_BQl2X","locale-text-tag":"kne-form-creator_65OWA","is-mobile":"kne-form-creator_LtgJz"};
|
|
21
21
|
|
|
22
22
|
function _extends() {
|
|
23
23
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -65,6 +65,7 @@ const locale$1 = {
|
|
|
65
65
|
blockKind_tableList: '表格列表',
|
|
66
66
|
blockKind_editableList: '行内编辑列表',
|
|
67
67
|
blockKind_multiField: '同类多值',
|
|
68
|
+
blockKind_matrixScale: '矩阵量表',
|
|
68
69
|
blockKind_object: '分组信息',
|
|
69
70
|
blockKind_choice: '选项切换',
|
|
70
71
|
blockKind_steps: '分步表单',
|
|
@@ -73,6 +74,7 @@ const locale$1 = {
|
|
|
73
74
|
blockKindDesc_tableList: '以表格形式展示的可增减列表',
|
|
74
75
|
blockKindDesc_editableList: '每条记录只读展示,点击编辑后单独填写并保存;数据量大时不卡顿',
|
|
75
76
|
blockKindDesc_multiField: '同一种填写项可以输入多个值,例如多个手机号',
|
|
77
|
+
blockKindDesc_matrixScale: '行为题目、列为选项或字段格子,每行共用同一填写项类型',
|
|
76
78
|
blockKindDesc_object: '把相关的填写项放在一起,例如「在校时间」下的开始与结束',
|
|
77
79
|
blockKindDesc_choice: '先选一类情况,再填写对应内容;可设为单选或多选',
|
|
78
80
|
blockKindDesc_steps: '将表单拆分成多个步骤,引导用户逐步填写',
|
|
@@ -125,6 +127,27 @@ const locale$1 = {
|
|
|
125
127
|
multiFieldType: '填写项类型',
|
|
126
128
|
multiFieldSummary: '填写类型:{type}',
|
|
127
129
|
multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
|
|
130
|
+
matrixScaleRowTitle: '行标题列名',
|
|
131
|
+
matrixScaleRowTitlePlaceholder: '例如:活动',
|
|
132
|
+
matrixScaleLayout: '矩阵布局',
|
|
133
|
+
matrixScaleLayout_options: '选项矩阵',
|
|
134
|
+
matrixScaleLayout_columns: '单元格矩阵',
|
|
135
|
+
matrixScaleLayout_field: '每行一个字段',
|
|
136
|
+
matrixScaleRequired: '每行(每格)必填',
|
|
137
|
+
matrixScaleSummary: '{type} · {layout} · {rows} 行',
|
|
138
|
+
matrixScaleEditorHint_options: '配置行题目与量表选项;预览中每行是同一个选择字段。',
|
|
139
|
+
matrixScaleEditorHint_columns: '配置行题目与列字段;每个格子是同一个填写项类型(如数字、评分)。',
|
|
140
|
+
matrixScaleEditorHint_field: '只配置行题目;每行右侧放一个填写项(不传列)。',
|
|
141
|
+
matrixScaleRowsTitle: '行配置',
|
|
142
|
+
matrixScaleRowsHint: '左侧为行标题,右侧为保存用的名称',
|
|
143
|
+
matrixScaleRowLabelPlaceholder: '例如:工作/学习',
|
|
144
|
+
matrixScaleRowNamePlaceholder: '例如:work',
|
|
145
|
+
matrixScaleOptionsTitle: '量表选项(列)',
|
|
146
|
+
matrixScaleColumnsTitle: '列配置',
|
|
147
|
+
matrixScaleColumnsHint: '左侧为列标题,右侧为保存用的名称',
|
|
148
|
+
matrixScaleColumnLabelPlaceholder: '例如:周一',
|
|
149
|
+
matrixScaleColumnNamePlaceholder: '例如:mon',
|
|
150
|
+
matrixScaleAddRow: '添加一行',
|
|
128
151
|
stepListTitle: '步骤列表',
|
|
129
152
|
addStep: '添加步骤',
|
|
130
153
|
editStep: '编辑步骤',
|
|
@@ -148,6 +171,19 @@ const locale$1 = {
|
|
|
148
171
|
FieldTypeSelect: '下拉选择',
|
|
149
172
|
FieldTypeRadioGroup: '单选组',
|
|
150
173
|
FieldTypeCheckboxGroup: '复选组',
|
|
174
|
+
FieldTypeRadioGroupOther: '单选组(含其他)',
|
|
175
|
+
FieldTypeCheckboxGroupOther: '复选组(含其他)',
|
|
176
|
+
FieldTypeOtherOption: '其他',
|
|
177
|
+
propChoiceModern: '新版样式(序号色块)',
|
|
178
|
+
propChoiceBlock: '块级选项(纵向占满)',
|
|
179
|
+
propChoiceIndexType: '序号类型',
|
|
180
|
+
propChoiceIndexTypeLetter: '字母 A/B/C',
|
|
181
|
+
propChoiceIndexTypeNumber: '数字 1/2/3',
|
|
182
|
+
propChoiceIndexTypeCheck: '对勾(无序号)',
|
|
183
|
+
propChoiceOtherLabel: '「其他」选项文案',
|
|
184
|
+
propChoiceOtherLabelHint: '默认:其他',
|
|
185
|
+
propChoiceOtherPlaceholder: '「其他」输入框提示',
|
|
186
|
+
propChoiceOtherPlaceholderHint: '选中「其他」后补充说明',
|
|
151
187
|
FieldTypeSuperSelectList: '普通下拉',
|
|
152
188
|
FieldTypeSuperSelectTableList: '表格选择',
|
|
153
189
|
FieldTypeSuperSelectTree: '树形选择',
|
|
@@ -202,6 +238,9 @@ const locale$1 = {
|
|
|
202
238
|
formActionsGapHint: '默认 16',
|
|
203
239
|
formActionsLayoutSection: '布局',
|
|
204
240
|
fieldBasicSection: '基本设置',
|
|
241
|
+
optionLabelColumn: '选项名称',
|
|
242
|
+
optionValueColumn: '选项值',
|
|
243
|
+
optionDescColumn: '选项描述',
|
|
205
244
|
optionLabelPlaceholder: '显示文字',
|
|
206
245
|
optionValuePlaceholder: '对应值',
|
|
207
246
|
optionDescPlaceholder: '补充说明(可选)',
|
|
@@ -359,6 +398,7 @@ const locale = {
|
|
|
359
398
|
blockKind_tableList: 'Table List',
|
|
360
399
|
blockKind_editableList: 'Inline Edit List',
|
|
361
400
|
blockKind_multiField: 'Multi-Value',
|
|
401
|
+
blockKind_matrixScale: 'Matrix Scale',
|
|
362
402
|
blockKind_object: 'Grouped Fields',
|
|
363
403
|
blockKind_choice: 'Options',
|
|
364
404
|
blockKind_steps: 'Step-by-Step',
|
|
@@ -367,6 +407,7 @@ const locale = {
|
|
|
367
407
|
blockKindDesc_tableList: 'A repeatable list displayed as a table',
|
|
368
408
|
blockKindDesc_editableList: 'Records are shown read-only; click edit to fill in and save each one. Stays fast with lots of data',
|
|
369
409
|
blockKindDesc_multiField: 'Enter multiple values for the same field, e.g. several phone numbers',
|
|
410
|
+
blockKindDesc_matrixScale: 'Rows are questions; columns are options or cell fields; every row shares one field type',
|
|
370
411
|
blockKindDesc_object: 'Group related fields together, e.g. start and end under "School period"',
|
|
371
412
|
blockKindDesc_choice: 'Pick a case first, then fill in the matching content; single or multiple selection',
|
|
372
413
|
blockKindDesc_steps: 'Split the form into steps to guide users through it',
|
|
@@ -419,6 +460,27 @@ const locale = {
|
|
|
419
460
|
multiFieldType: 'Field Type',
|
|
420
461
|
multiFieldSummary: 'Field type: {type}',
|
|
421
462
|
multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
|
|
463
|
+
matrixScaleRowTitle: 'Row header title',
|
|
464
|
+
matrixScaleRowTitlePlaceholder: 'e.g. Activity',
|
|
465
|
+
matrixScaleLayout: 'Matrix layout',
|
|
466
|
+
matrixScaleLayout_options: 'Option matrix',
|
|
467
|
+
matrixScaleLayout_columns: 'Cell matrix',
|
|
468
|
+
matrixScaleLayout_field: 'One field per row',
|
|
469
|
+
matrixScaleRequired: 'Required for each row/cell',
|
|
470
|
+
matrixScaleSummary: '{type} · {layout} · {rows} rows',
|
|
471
|
+
matrixScaleEditorHint_options: 'Configure row labels and scale options; each row uses the same choice field.',
|
|
472
|
+
matrixScaleEditorHint_columns: 'Configure rows and columns; each cell uses the same field type (e.g. number, rate).',
|
|
473
|
+
matrixScaleEditorHint_field: 'Configure row labels only; each row shows one field without columns.',
|
|
474
|
+
matrixScaleRowsTitle: 'Rows',
|
|
475
|
+
matrixScaleRowsHint: 'Left is the row label; right is the data key',
|
|
476
|
+
matrixScaleRowLabelPlaceholder: 'e.g. Work / Study',
|
|
477
|
+
matrixScaleRowNamePlaceholder: 'e.g. work',
|
|
478
|
+
matrixScaleOptionsTitle: 'Scale options (columns)',
|
|
479
|
+
matrixScaleColumnsTitle: 'Columns',
|
|
480
|
+
matrixScaleColumnsHint: 'Left is the column label; right is the data key',
|
|
481
|
+
matrixScaleColumnLabelPlaceholder: 'e.g. Monday',
|
|
482
|
+
matrixScaleColumnNamePlaceholder: 'e.g. mon',
|
|
483
|
+
matrixScaleAddRow: 'Add row',
|
|
422
484
|
stepListTitle: 'Steps',
|
|
423
485
|
addStep: 'Add Step',
|
|
424
486
|
editStep: 'Edit Step',
|
|
@@ -442,6 +504,19 @@ const locale = {
|
|
|
442
504
|
FieldTypeSelect: 'Dropdown',
|
|
443
505
|
FieldTypeRadioGroup: 'Radio Group',
|
|
444
506
|
FieldTypeCheckboxGroup: 'Checkbox Group',
|
|
507
|
+
FieldTypeRadioGroupOther: 'Radio Group (with Other)',
|
|
508
|
+
FieldTypeCheckboxGroupOther: 'Checkbox Group (with Other)',
|
|
509
|
+
FieldTypeOtherOption: 'Other',
|
|
510
|
+
propChoiceModern: 'Modern style (indexed chips)',
|
|
511
|
+
propChoiceBlock: 'Block options (full-width stack)',
|
|
512
|
+
propChoiceIndexType: 'Index type',
|
|
513
|
+
propChoiceIndexTypeLetter: 'Letters A/B/C',
|
|
514
|
+
propChoiceIndexTypeNumber: 'Numbers 1/2/3',
|
|
515
|
+
propChoiceIndexTypeCheck: 'Checkmark (no index)',
|
|
516
|
+
propChoiceOtherLabel: '"Other" option label',
|
|
517
|
+
propChoiceOtherLabelHint: 'Default: Other',
|
|
518
|
+
propChoiceOtherPlaceholder: '"Other" textarea placeholder',
|
|
519
|
+
propChoiceOtherPlaceholderHint: 'Extra note when Other is selected',
|
|
445
520
|
FieldTypeSuperSelectList: 'Select List',
|
|
446
521
|
FieldTypeSuperSelectTableList: 'Table Select',
|
|
447
522
|
FieldTypeSuperSelectTree: 'Tree Select',
|
|
@@ -496,6 +571,9 @@ const locale = {
|
|
|
496
571
|
formActionsGapHint: 'Default: 16',
|
|
497
572
|
formActionsLayoutSection: 'Layout',
|
|
498
573
|
fieldBasicSection: 'Basic Settings',
|
|
574
|
+
optionLabelColumn: 'Option Label',
|
|
575
|
+
optionValueColumn: 'Option Value',
|
|
576
|
+
optionDescColumn: 'Option Description',
|
|
499
577
|
optionLabelPlaceholder: 'Display text',
|
|
500
578
|
optionValuePlaceholder: 'Value',
|
|
501
579
|
optionDescPlaceholder: 'Description (optional)',
|
|
@@ -824,7 +902,7 @@ const createChoiceOption = (overrides = {}) => _extends({
|
|
|
824
902
|
blocks: []
|
|
825
903
|
}, overrides);
|
|
826
904
|
const createBlock = (kind, overrides = {}) => {
|
|
827
|
-
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'object'].includes(kind);
|
|
905
|
+
const needsName = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale', 'object'].includes(kind);
|
|
828
906
|
const base = {
|
|
829
907
|
id: createFieldId(),
|
|
830
908
|
kind,
|
|
@@ -840,7 +918,12 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
840
918
|
addText: '',
|
|
841
919
|
maxLength: undefined,
|
|
842
920
|
minLength: undefined,
|
|
843
|
-
fieldType: 'Input',
|
|
921
|
+
fieldType: kind === 'matrixScale' ? 'RadioGroup' : 'Input',
|
|
922
|
+
layout: 'options',
|
|
923
|
+
rowTitle: '',
|
|
924
|
+
rule: '',
|
|
925
|
+
rows: [],
|
|
926
|
+
columns: [],
|
|
844
927
|
autoStep: true,
|
|
845
928
|
mode: 'single',
|
|
846
929
|
selectorName: '',
|
|
@@ -867,7 +950,31 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
867
950
|
itemBlocks: undefined,
|
|
868
951
|
blocks: undefined,
|
|
869
952
|
options: undefined,
|
|
870
|
-
items: undefined
|
|
953
|
+
items: undefined,
|
|
954
|
+
rows: undefined,
|
|
955
|
+
columns: undefined,
|
|
956
|
+
layout: undefined,
|
|
957
|
+
rowTitle: undefined,
|
|
958
|
+
rule: undefined
|
|
959
|
+
}, overrides);
|
|
960
|
+
}
|
|
961
|
+
if (kind === 'matrixScale') {
|
|
962
|
+
return _extends({}, base, {
|
|
963
|
+
list: undefined,
|
|
964
|
+
itemBlocks: undefined,
|
|
965
|
+
blocks: undefined,
|
|
966
|
+
items: undefined,
|
|
967
|
+
fieldType: 'RadioGroup',
|
|
968
|
+
layout: 'options',
|
|
969
|
+
rows: [{
|
|
970
|
+
label: '',
|
|
971
|
+
name: createDataKey('row')
|
|
972
|
+
}],
|
|
973
|
+
options: [{
|
|
974
|
+
label: '',
|
|
975
|
+
value: ''
|
|
976
|
+
}],
|
|
977
|
+
columns: undefined
|
|
871
978
|
}, overrides);
|
|
872
979
|
}
|
|
873
980
|
if (kind === 'choice') {
|
|
@@ -979,6 +1086,58 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
979
1086
|
normalized.itemBlocks = undefined;
|
|
980
1087
|
normalized.blocks = undefined;
|
|
981
1088
|
normalized.options = undefined;
|
|
1089
|
+
normalized.rows = undefined;
|
|
1090
|
+
normalized.columns = undefined;
|
|
1091
|
+
normalized.layout = undefined;
|
|
1092
|
+
normalized.rowTitle = undefined;
|
|
1093
|
+
normalized.rule = undefined;
|
|
1094
|
+
return normalized;
|
|
1095
|
+
}
|
|
1096
|
+
if (kind === 'matrixScale') {
|
|
1097
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
1098
|
+
normalized.list = undefined;
|
|
1099
|
+
normalized.items = undefined;
|
|
1100
|
+
normalized.itemBlocks = undefined;
|
|
1101
|
+
normalized.blocks = undefined;
|
|
1102
|
+
normalized.layout = layout;
|
|
1103
|
+
normalized.fieldType = block.fieldType || 'RadioGroup';
|
|
1104
|
+
normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
|
|
1105
|
+
normalized.rule = block.rule != null ? block.rule : '';
|
|
1106
|
+
normalized.rows = Array.isArray(block.rows) ? block.rows.map(row => {
|
|
1107
|
+
var _row$label;
|
|
1108
|
+
return {
|
|
1109
|
+
label: (_row$label = row == null ? void 0 : row.label) != null ? _row$label : '',
|
|
1110
|
+
name: String((row == null ? void 0 : row.name) || '').trim() || createDataKey('row')
|
|
1111
|
+
};
|
|
1112
|
+
}).filter(row => String(row.label || '').trim() || String(row.name || '').trim()) : [];
|
|
1113
|
+
if (!normalized.rows.length) {
|
|
1114
|
+
normalized.rows = [{
|
|
1115
|
+
label: '',
|
|
1116
|
+
name: createDataKey('row')
|
|
1117
|
+
}];
|
|
1118
|
+
}
|
|
1119
|
+
if (layout === 'options') {
|
|
1120
|
+
normalized.options = Array.isArray(block.options) ? block.options : [];
|
|
1121
|
+
normalized.columns = undefined;
|
|
1122
|
+
} else if (layout === 'columns') {
|
|
1123
|
+
normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => {
|
|
1124
|
+
var _ref, _column$label;
|
|
1125
|
+
return {
|
|
1126
|
+
label: (_ref = (_column$label = column == null ? void 0 : column.label) != null ? _column$label : column == null ? void 0 : column.title) != null ? _ref : '',
|
|
1127
|
+
name: String((column == null ? void 0 : column.name) || '').trim() || createDataKey('col')
|
|
1128
|
+
};
|
|
1129
|
+
}).filter(column => String(column.label || '').trim() || String(column.name || '').trim()) : [];
|
|
1130
|
+
if (!normalized.columns.length) {
|
|
1131
|
+
normalized.columns = [{
|
|
1132
|
+
label: '',
|
|
1133
|
+
name: createDataKey('col')
|
|
1134
|
+
}];
|
|
1135
|
+
}
|
|
1136
|
+
normalized.options = undefined;
|
|
1137
|
+
} else {
|
|
1138
|
+
normalized.options = undefined;
|
|
1139
|
+
normalized.columns = undefined;
|
|
1140
|
+
}
|
|
982
1141
|
return normalized;
|
|
983
1142
|
}
|
|
984
1143
|
if (kind === 'choice') {
|
|
@@ -1110,7 +1269,7 @@ const collectFieldsFromBlocks = (blocks = [], acc = []) => {
|
|
|
1110
1269
|
});
|
|
1111
1270
|
return;
|
|
1112
1271
|
}
|
|
1113
|
-
if (block.kind !== 'multiField' && Array.isArray(block.list)) {
|
|
1272
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale' && Array.isArray(block.list)) {
|
|
1114
1273
|
acc.push(...block.list);
|
|
1115
1274
|
}
|
|
1116
1275
|
if (Array.isArray(block.itemBlocks)) {
|
|
@@ -1155,7 +1314,7 @@ const collectSchemaFields = (schema, {
|
|
|
1155
1314
|
});
|
|
1156
1315
|
return fields;
|
|
1157
1316
|
}
|
|
1158
|
-
if (block.kind !== 'multiField') {
|
|
1317
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1159
1318
|
fields.push(...(block.list || []));
|
|
1160
1319
|
}
|
|
1161
1320
|
return fields;
|
|
@@ -1203,7 +1362,7 @@ const collectBlockFieldNames = (blocks = [], {
|
|
|
1203
1362
|
});
|
|
1204
1363
|
return;
|
|
1205
1364
|
}
|
|
1206
|
-
if (block.kind !== 'multiField') {
|
|
1365
|
+
if (block.kind !== 'multiField' && block.kind !== 'matrixScale') {
|
|
1207
1366
|
(block.list || []).forEach(field => {
|
|
1208
1367
|
if (field != null && field.name) {
|
|
1209
1368
|
names.push(prefix ? `${prefix}.${field.name}` : field.name);
|
|
@@ -1406,7 +1565,7 @@ const blockHasContent = block => {
|
|
|
1406
1565
|
if (block.kind === 'steps') {
|
|
1407
1566
|
return (block.items || []).some(step => (step.list || []).length > 0 || (step.blocks || []).some(blockHasContent) || step.title);
|
|
1408
1567
|
}
|
|
1409
|
-
if (block.kind === 'multiField') {
|
|
1568
|
+
if (block.kind === 'multiField' || block.kind === 'matrixScale') {
|
|
1410
1569
|
return !!block.name;
|
|
1411
1570
|
}
|
|
1412
1571
|
if (block.kind === 'choice') {
|
|
@@ -1459,6 +1618,12 @@ const BLOCK_KINDS = {
|
|
|
1459
1618
|
requiresName: true,
|
|
1460
1619
|
descriptionId: 'blockKindDesc_multiField'
|
|
1461
1620
|
},
|
|
1621
|
+
matrixScale: {
|
|
1622
|
+
labelId: 'blockKind_matrixScale',
|
|
1623
|
+
color: 'volcano',
|
|
1624
|
+
requiresName: true,
|
|
1625
|
+
descriptionId: 'blockKindDesc_matrixScale'
|
|
1626
|
+
},
|
|
1462
1627
|
object: {
|
|
1463
1628
|
labelId: 'blockKind_object',
|
|
1464
1629
|
color: 'orange',
|
|
@@ -1482,6 +1647,9 @@ const BLOCK_KINDS = {
|
|
|
1482
1647
|
|
|
1483
1648
|
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1484
1649
|
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1650
|
+
|
|
1651
|
+
/** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
|
|
1652
|
+
const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
|
|
1485
1653
|
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
1486
1654
|
label: typeof formatMessage === 'function' ? formatMessage({
|
|
1487
1655
|
id: config.labelId
|
|
@@ -1506,7 +1674,10 @@ const blockToFormValues = block => {
|
|
|
1506
1674
|
maxLength: (_block$maxLength = block.maxLength) != null ? _block$maxLength : null,
|
|
1507
1675
|
minLength: (_block$minLength = block.minLength) != null ? _block$minLength : null,
|
|
1508
1676
|
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1509
|
-
fieldType: block.fieldType || 'Input',
|
|
1677
|
+
fieldType: block.fieldType || (block.kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1678
|
+
layout: MATRIX_LAYOUTS.includes(block.layout) ? block.layout : 'options',
|
|
1679
|
+
rowTitle: block.rowTitle || '',
|
|
1680
|
+
required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
|
|
1510
1681
|
autoStep: block.autoStep !== false,
|
|
1511
1682
|
mode: block.mode === 'multiple' ? 'multiple' : 'single',
|
|
1512
1683
|
selectorName: block.selectorName || '',
|
|
@@ -1532,12 +1703,44 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1532
1703
|
maxLength: (_values$maxLength = values.maxLength) != null ? _values$maxLength : undefined,
|
|
1533
1704
|
minLength: (_values$minLength = values.minLength) != null ? _values$minLength : undefined,
|
|
1534
1705
|
addPosition: kind === 'editableList' && ADD_POSITIONS.includes(values.addPosition) && values.addPosition !== 'bottom' ? values.addPosition : undefined,
|
|
1535
|
-
fieldType: values.fieldType || 'Input',
|
|
1706
|
+
fieldType: values.fieldType || (kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1536
1707
|
autoStep: values.autoStep !== false,
|
|
1537
1708
|
mode,
|
|
1538
1709
|
selectorName: values.selectorName || '',
|
|
1539
1710
|
selectorInData: values.selectorInData !== false
|
|
1540
1711
|
});
|
|
1712
|
+
if (kind === 'matrixScale') {
|
|
1713
|
+
const layout = MATRIX_LAYOUTS.includes(values.layout) ? values.layout : 'options';
|
|
1714
|
+
next.layout = layout;
|
|
1715
|
+
next.rowTitle = values.rowTitle || undefined;
|
|
1716
|
+
next.rule = values.required ? 'REQ' : undefined;
|
|
1717
|
+
if (layout === 'options') {
|
|
1718
|
+
next.columns = undefined;
|
|
1719
|
+
if (!Array.isArray(next.options) || !next.options.length) {
|
|
1720
|
+
next.options = [{
|
|
1721
|
+
label: '',
|
|
1722
|
+
value: ''
|
|
1723
|
+
}];
|
|
1724
|
+
}
|
|
1725
|
+
} else if (layout === 'columns') {
|
|
1726
|
+
next.options = undefined;
|
|
1727
|
+
if (!Array.isArray(next.columns) || !next.columns.length) {
|
|
1728
|
+
next.columns = [{
|
|
1729
|
+
label: '',
|
|
1730
|
+
name: createDataKey('col')
|
|
1731
|
+
}];
|
|
1732
|
+
}
|
|
1733
|
+
} else {
|
|
1734
|
+
next.options = undefined;
|
|
1735
|
+
next.columns = undefined;
|
|
1736
|
+
}
|
|
1737
|
+
if (!Array.isArray(next.rows) || !next.rows.length) {
|
|
1738
|
+
next.rows = [{
|
|
1739
|
+
label: '',
|
|
1740
|
+
name: createDataKey('row')
|
|
1741
|
+
}];
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1541
1744
|
if (kind === 'choice' && mode !== 'multiple') {
|
|
1542
1745
|
next.minLength = undefined;
|
|
1543
1746
|
next.maxLength = undefined;
|
|
@@ -1808,14 +2011,25 @@ const NO_VALUE_OPERATORS = ['empty', 'notEmpty'];
|
|
|
1808
2011
|
const ALLOWED_REGEX_FLAGS = ['i', 'm', 's', 'u'];
|
|
1809
2012
|
|
|
1810
2013
|
// 列表类模块内的字段会重复出现,单个 name 定位不到具体条目,不参与条件
|
|
1811
|
-
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField'];
|
|
2014
|
+
const LIST_BLOCK_KINDS = ['list', 'tableList', 'editableList', 'multiField', 'matrixScale'];
|
|
1812
2015
|
const getByPath$2 = (data, path) => {
|
|
1813
2016
|
if (data == null || path == null || path === '') {
|
|
1814
2017
|
return undefined;
|
|
1815
2018
|
}
|
|
1816
2019
|
return String(path).split('.').reduce((current, key) => current == null ? undefined : current[key], data);
|
|
1817
2020
|
};
|
|
1818
|
-
|
|
2021
|
+
|
|
2022
|
+
/** RadioGroupOther / CheckboxGroupOther 提交值为 { value, other? },比较前先取 value */
|
|
2023
|
+
const unwrapChoiceOtherValue = value => {
|
|
2024
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && Object.prototype.hasOwnProperty.call(value, 'other') && Object.prototype.hasOwnProperty.call(value, 'value')) {
|
|
2025
|
+
return value.value;
|
|
2026
|
+
}
|
|
2027
|
+
return value;
|
|
2028
|
+
};
|
|
2029
|
+
const isEmptyValue$1 = value => {
|
|
2030
|
+
const next = unwrapChoiceOtherValue(value);
|
|
2031
|
+
return next === undefined || next === null || next === '' || Array.isArray(next) && next.length === 0;
|
|
2032
|
+
};
|
|
1819
2033
|
|
|
1820
2034
|
// SuperSelect 等字段的值是 { label, value } 对象,比较时统一取 value
|
|
1821
2035
|
const toComparable = item => {
|
|
@@ -1863,7 +2077,7 @@ const evaluateCondition = (condition, formData) => {
|
|
|
1863
2077
|
if (!(condition != null && condition.field) || !CONDITION_OPERATORS.includes(condition.operator)) {
|
|
1864
2078
|
return null;
|
|
1865
2079
|
}
|
|
1866
|
-
const actual = getByPath$2(formData, condition.field);
|
|
2080
|
+
const actual = unwrapChoiceOtherValue(getByPath$2(formData, condition.field));
|
|
1867
2081
|
const expected = condition.value;
|
|
1868
2082
|
switch (condition.operator) {
|
|
1869
2083
|
case 'empty':
|
|
@@ -2139,7 +2353,7 @@ const renameConditionReferences = (schema, oldPath, newPath) => {
|
|
|
2139
2353
|
*/
|
|
2140
2354
|
const getConditionValueKind = (field, definition) => {
|
|
2141
2355
|
const props = (field == null ? void 0 : field.props) || {};
|
|
2142
|
-
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')) {
|
|
2356
|
+
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')) {
|
|
2143
2357
|
return 'multiOptions';
|
|
2144
2358
|
}
|
|
2145
2359
|
if (definition != null && definition.hasOptions) {
|
|
@@ -2216,6 +2430,16 @@ const formatVisibleWhen = (visibleWhen, {
|
|
|
2216
2430
|
if (option) {
|
|
2217
2431
|
return _resolveText(option.label);
|
|
2218
2432
|
}
|
|
2433
|
+
if ((trigger == null ? void 0 : trigger.type) === 'RadioGroupOther' || (trigger == null ? void 0 : trigger.type) === 'CheckboxGroupOther') {
|
|
2434
|
+
var _trigger$props2;
|
|
2435
|
+
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';
|
|
2436
|
+
if (sameValue(otherValue, value)) {
|
|
2437
|
+
var _trigger$props3;
|
|
2438
|
+
return _resolveText(trigger == null || (_trigger$props3 = trigger.props) == null || (_trigger$props3 = _trigger$props3.otherOption) == null ? void 0 : _trigger$props3.label) || formatMessage({
|
|
2439
|
+
id: 'FieldTypeOtherOption'
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2219
2443
|
if (typeof value === 'boolean') {
|
|
2220
2444
|
return formatMessage({
|
|
2221
2445
|
id: value ? 'conditionValueTrue' : 'conditionValueFalse'
|
|
@@ -2247,7 +2471,7 @@ const FIELD_GROUPS = [{
|
|
|
2247
2471
|
types: ['Input', 'TextArea', 'InputNumber', 'Switch', 'Checkbox', 'DatePicker']
|
|
2248
2472
|
}, {
|
|
2249
2473
|
labelId: 'FieldGroupSelect',
|
|
2250
|
-
types: ['Select', 'RadioGroup', 'CheckboxGroup']
|
|
2474
|
+
types: ['Select', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther']
|
|
2251
2475
|
}, {
|
|
2252
2476
|
labelId: 'FieldGroupAdvancedSelect',
|
|
2253
2477
|
types: ['SuperSelectList', 'SuperSelectTableList', 'SuperSelectTree', 'SuperSelectCascader']
|
|
@@ -2403,6 +2627,97 @@ defineField('CheckboxGroup', {
|
|
|
2403
2627
|
};
|
|
2404
2628
|
}
|
|
2405
2629
|
});
|
|
2630
|
+
const resolveOtherOptionValue = field => {
|
|
2631
|
+
var _field$props6;
|
|
2632
|
+
const raw = field == null || (_field$props6 = field.props) == null || (_field$props6 = _field$props6.otherOption) == null ? void 0 : _field$props6.value;
|
|
2633
|
+
return raw != null && String(raw).trim() ? String(raw).trim() : 'other';
|
|
2634
|
+
};
|
|
2635
|
+
const choiceOtherEnums = field => {
|
|
2636
|
+
const enums = optionEnumValues(field) || [];
|
|
2637
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2638
|
+
return enums.includes(otherValue) ? enums : [...enums, otherValue];
|
|
2639
|
+
};
|
|
2640
|
+
const choiceOtherValueSchema = (field, multiple) => {
|
|
2641
|
+
const enums = choiceOtherEnums(field);
|
|
2642
|
+
const selected = multiple ? {
|
|
2643
|
+
type: 'array',
|
|
2644
|
+
items: {
|
|
2645
|
+
type: 'string',
|
|
2646
|
+
enum: enums
|
|
2647
|
+
}
|
|
2648
|
+
} : {
|
|
2649
|
+
type: 'string',
|
|
2650
|
+
enum: enums
|
|
2651
|
+
};
|
|
2652
|
+
return {
|
|
2653
|
+
type: 'object',
|
|
2654
|
+
properties: {
|
|
2655
|
+
value: selected,
|
|
2656
|
+
other: {
|
|
2657
|
+
type: 'string'
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
};
|
|
2661
|
+
};
|
|
2662
|
+
const formatChoiceOtherDisplay = (value, field, {
|
|
2663
|
+
formatMessage
|
|
2664
|
+
} = {}) => {
|
|
2665
|
+
var _field$props7, _field$props8;
|
|
2666
|
+
if (value == null || typeof value !== 'object') {
|
|
2667
|
+
return '';
|
|
2668
|
+
}
|
|
2669
|
+
const options = field == null || (_field$props7 = field.props) == null ? void 0 : _field$props7.options;
|
|
2670
|
+
const otherValue = resolveOtherOptionValue(field);
|
|
2671
|
+
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({
|
|
2672
|
+
id: 'FieldTypeOtherOption'
|
|
2673
|
+
})) || '其他';
|
|
2674
|
+
const mapOne = item => {
|
|
2675
|
+
if (item === otherValue) {
|
|
2676
|
+
return otherFallback;
|
|
2677
|
+
}
|
|
2678
|
+
if (!Array.isArray(options) || !options.length) {
|
|
2679
|
+
return item == null ? '' : String(item);
|
|
2680
|
+
}
|
|
2681
|
+
const match = options.find(opt => opt && opt.value === item);
|
|
2682
|
+
if ((match == null ? void 0 : match.label) != null) {
|
|
2683
|
+
return resolveLocaleText(match.label) || String(match.label);
|
|
2684
|
+
}
|
|
2685
|
+
return item == null ? '' : String(item);
|
|
2686
|
+
};
|
|
2687
|
+
const selected = Array.isArray(value.value) ? value.value.map(mapOne).filter(Boolean).join('、') : mapOne(value.value);
|
|
2688
|
+
const otherText = value.other != null && String(value.other).trim() ? String(value.other).trim() : '';
|
|
2689
|
+
if (selected && otherText) {
|
|
2690
|
+
return `${selected}(${otherFallback}: ${otherText})`;
|
|
2691
|
+
}
|
|
2692
|
+
if (otherText) {
|
|
2693
|
+
return `${otherFallback}: ${otherText}`;
|
|
2694
|
+
}
|
|
2695
|
+
return selected;
|
|
2696
|
+
};
|
|
2697
|
+
defineField('RadioGroupOther', {
|
|
2698
|
+
labelId: 'FieldTypeRadioGroupOther',
|
|
2699
|
+
component: RadioGroupOther,
|
|
2700
|
+
defaultProps: {
|
|
2701
|
+
options: [],
|
|
2702
|
+
inline: true
|
|
2703
|
+
},
|
|
2704
|
+
hasOptions: true,
|
|
2705
|
+
hasFieldProps: true,
|
|
2706
|
+
valueSchema: field => choiceOtherValueSchema(field, false),
|
|
2707
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2708
|
+
});
|
|
2709
|
+
defineField('CheckboxGroupOther', {
|
|
2710
|
+
labelId: 'FieldTypeCheckboxGroupOther',
|
|
2711
|
+
component: CheckboxGroupOther,
|
|
2712
|
+
defaultProps: {
|
|
2713
|
+
options: [],
|
|
2714
|
+
inline: true
|
|
2715
|
+
},
|
|
2716
|
+
hasOptions: true,
|
|
2717
|
+
hasFieldProps: true,
|
|
2718
|
+
valueSchema: field => choiceOtherValueSchema(field, true),
|
|
2719
|
+
formatDisplayValue: formatChoiceOtherDisplay
|
|
2720
|
+
});
|
|
2406
2721
|
defineField('SuperSelectList', {
|
|
2407
2722
|
labelId: 'FieldTypeSuperSelectList',
|
|
2408
2723
|
component: SuperSelectList,
|
|
@@ -2861,7 +3176,7 @@ const setOptionalString = (props, key, value) => {
|
|
|
2861
3176
|
}
|
|
2862
3177
|
};
|
|
2863
3178
|
const pickFieldProps = (field, definition) => {
|
|
2864
|
-
var _props$rows, _definition$propsSche;
|
|
3179
|
+
var _props$rows, _props$otherOption, _props$otherProps, _definition$propsSche;
|
|
2865
3180
|
const props = field.props || {};
|
|
2866
3181
|
const type = (definition == null ? void 0 : definition.type) || field.type;
|
|
2867
3182
|
switch (type) {
|
|
@@ -2912,8 +3227,15 @@ const pickFieldProps = (field, definition) => {
|
|
|
2912
3227
|
};
|
|
2913
3228
|
case 'RadioGroup':
|
|
2914
3229
|
case 'CheckboxGroup':
|
|
3230
|
+
case 'RadioGroupOther':
|
|
3231
|
+
case 'CheckboxGroupOther':
|
|
2915
3232
|
return {
|
|
2916
|
-
inline: props.inline !== false
|
|
3233
|
+
inline: props.inline !== false,
|
|
3234
|
+
modern: !!props.modern,
|
|
3235
|
+
block: !!props.block,
|
|
3236
|
+
indexType: props.indexType === 'number' || props.indexType === 'check' ? props.indexType : 'letter',
|
|
3237
|
+
otherLabel: ((_props$otherOption = props.otherOption) == null ? void 0 : _props$otherOption.label) || '',
|
|
3238
|
+
otherPlaceholder: ((_props$otherProps = props.otherProps) == null ? void 0 : _props$otherProps.placeholder) || ''
|
|
2917
3239
|
};
|
|
2918
3240
|
default:
|
|
2919
3241
|
if (definition != null && (_definition$propsSche = definition.propsSchema) != null && _definition$propsSche.length) {
|
|
@@ -2988,8 +3310,49 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2988
3310
|
break;
|
|
2989
3311
|
case 'RadioGroup':
|
|
2990
3312
|
case 'CheckboxGroup':
|
|
3313
|
+
case 'RadioGroupOther':
|
|
3314
|
+
case 'CheckboxGroupOther':
|
|
2991
3315
|
// 始终落盘布尔值,避免 Checkbox 未勾选时字段缺失被当成默认横向
|
|
2992
3316
|
props.inline = values.inline !== false;
|
|
3317
|
+
props.modern = !!values.modern;
|
|
3318
|
+
props.block = !!values.block;
|
|
3319
|
+
if (values.modern && (values.indexType === 'number' || values.indexType === 'check')) {
|
|
3320
|
+
props.indexType = values.indexType;
|
|
3321
|
+
} else {
|
|
3322
|
+
delete props.indexType;
|
|
3323
|
+
}
|
|
3324
|
+
if (!props.modern) {
|
|
3325
|
+
delete props.indexType;
|
|
3326
|
+
}
|
|
3327
|
+
if (type === 'RadioGroupOther' || type === 'CheckboxGroupOther') {
|
|
3328
|
+
if (hasLocaleText(values.otherLabel)) {
|
|
3329
|
+
var _props$otherOption2;
|
|
3330
|
+
props.otherOption = _extends({}, props.otherOption && typeof props.otherOption === 'object' ? props.otherOption : {}, {
|
|
3331
|
+
label: trimLocaleText(values.otherLabel),
|
|
3332
|
+
value: ((_props$otherOption2 = props.otherOption) == null ? void 0 : _props$otherOption2.value) || 'other'
|
|
3333
|
+
});
|
|
3334
|
+
} else {
|
|
3335
|
+
delete props.otherOption;
|
|
3336
|
+
}
|
|
3337
|
+
if (hasLocaleText(values.otherPlaceholder)) {
|
|
3338
|
+
props.otherProps = _extends({}, props.otherProps && typeof props.otherProps === 'object' ? props.otherProps : {}, {
|
|
3339
|
+
placeholder: trimLocaleText(values.otherPlaceholder)
|
|
3340
|
+
});
|
|
3341
|
+
} else if (props.otherProps && typeof props.otherProps === 'object') {
|
|
3342
|
+
const nextOtherProps = _extends({}, props.otherProps);
|
|
3343
|
+
delete nextOtherProps.placeholder;
|
|
3344
|
+
if (Object.keys(nextOtherProps).length) {
|
|
3345
|
+
props.otherProps = nextOtherProps;
|
|
3346
|
+
} else {
|
|
3347
|
+
delete props.otherProps;
|
|
3348
|
+
}
|
|
3349
|
+
} else {
|
|
3350
|
+
delete props.otherProps;
|
|
3351
|
+
}
|
|
3352
|
+
} else {
|
|
3353
|
+
delete props.otherOption;
|
|
3354
|
+
delete props.otherProps;
|
|
3355
|
+
}
|
|
2993
3356
|
break;
|
|
2994
3357
|
default:
|
|
2995
3358
|
if (definition != null && (_definition$propsSche2 = definition.propsSchema) != null && _definition$propsSche2.length) {
|
|
@@ -2999,16 +3362,16 @@ const applyFieldProps = (props, values, definition) => {
|
|
|
2999
3362
|
}
|
|
3000
3363
|
};
|
|
3001
3364
|
const fieldToFormValues = field => {
|
|
3002
|
-
var _field$
|
|
3365
|
+
var _field$props9, _field$props0, _field$props1;
|
|
3003
3366
|
const definition = getFieldDefinition(field.type);
|
|
3004
3367
|
const ruleConfig = parseRuleString(field.rule);
|
|
3005
3368
|
const allowChildren = !!(definition != null && definition.optionsAllowChildren);
|
|
3006
|
-
const columns = definition != null && definition.hasColumns ? normalizeColumns((_field$
|
|
3007
|
-
const options = normalizeOptions((_field$
|
|
3369
|
+
const columns = definition != null && definition.hasColumns ? normalizeColumns((_field$props9 = field.props) == null ? void 0 : _field$props9.columns) : [];
|
|
3370
|
+
const options = normalizeOptions((_field$props0 = field.props) == null ? void 0 : _field$props0.options, {
|
|
3008
3371
|
allowChildren,
|
|
3009
3372
|
columns
|
|
3010
3373
|
});
|
|
3011
|
-
const rawPlaceholder = (_field$
|
|
3374
|
+
const rawPlaceholder = (_field$props1 = field.props) == null ? void 0 : _field$props1.placeholder;
|
|
3012
3375
|
const placeholder = Array.isArray(rawPlaceholder) ? rawPlaceholder[0] || '' : rawPlaceholder || '';
|
|
3013
3376
|
return {
|
|
3014
3377
|
type: field.type,
|
|
@@ -3171,7 +3534,7 @@ const LocaleTextArea = props => {
|
|
|
3171
3534
|
LocaleTextArea.field = LocaleTextAreaControl;
|
|
3172
3535
|
|
|
3173
3536
|
const {
|
|
3174
|
-
Text: Text$
|
|
3537
|
+
Text: Text$6
|
|
3175
3538
|
} = Typography;
|
|
3176
3539
|
const TYPE_TAG_COLORS = {
|
|
3177
3540
|
Input: 'blue',
|
|
@@ -3180,6 +3543,8 @@ const TYPE_TAG_COLORS = {
|
|
|
3180
3543
|
Select: 'geekblue',
|
|
3181
3544
|
RadioGroup: 'purple',
|
|
3182
3545
|
CheckboxGroup: 'purple',
|
|
3546
|
+
RadioGroupOther: 'purple',
|
|
3547
|
+
CheckboxGroupOther: 'purple',
|
|
3183
3548
|
SuperSelectList: 'gold',
|
|
3184
3549
|
SuperSelectTableList: 'gold',
|
|
3185
3550
|
SuperSelectTree: 'gold',
|
|
@@ -3198,6 +3563,8 @@ const TYPE_TAG_ICONS = {
|
|
|
3198
3563
|
Select: DownSquareOutlined,
|
|
3199
3564
|
RadioGroup: CheckCircleOutlined,
|
|
3200
3565
|
CheckboxGroup: CheckSquareOutlined,
|
|
3566
|
+
RadioGroupOther: CheckCircleOutlined,
|
|
3567
|
+
CheckboxGroupOther: CheckSquareOutlined,
|
|
3201
3568
|
SuperSelectList: AppstoreOutlined,
|
|
3202
3569
|
SuperSelectTableList: AppstoreOutlined,
|
|
3203
3570
|
SuperSelectTree: AppstoreOutlined,
|
|
@@ -3237,7 +3604,7 @@ const FieldRow = ({
|
|
|
3237
3604
|
children: index + 1
|
|
3238
3605
|
}), /*#__PURE__*/jsxs("div", {
|
|
3239
3606
|
className: style['field-row-main'],
|
|
3240
|
-
children: [/*#__PURE__*/jsx(Text$
|
|
3607
|
+
children: [/*#__PURE__*/jsx(Text$6, {
|
|
3241
3608
|
strong: true,
|
|
3242
3609
|
className: style['field-row-label'],
|
|
3243
3610
|
children: resolveLocaleText(field.label, locale, languages) || formatMessage({
|
|
@@ -3347,6 +3714,272 @@ const FieldRow = ({
|
|
|
3347
3714
|
});
|
|
3348
3715
|
};
|
|
3349
3716
|
|
|
3717
|
+
const {
|
|
3718
|
+
Text: Text$5,
|
|
3719
|
+
Title
|
|
3720
|
+
} = Typography;
|
|
3721
|
+
const createRowKey = () => createDataKey('mrow');
|
|
3722
|
+
const createColKey = () => createDataKey('mcol');
|
|
3723
|
+
const createOptKey = () => createDataKey('mopt');
|
|
3724
|
+
const createEmptyMatrixRow = () => ({
|
|
3725
|
+
_key: createRowKey(),
|
|
3726
|
+
label: '',
|
|
3727
|
+
name: createDataKey('row')
|
|
3728
|
+
});
|
|
3729
|
+
const createEmptyMatrixColumn = () => ({
|
|
3730
|
+
_key: createColKey(),
|
|
3731
|
+
label: '',
|
|
3732
|
+
name: createDataKey('col')
|
|
3733
|
+
});
|
|
3734
|
+
const createEmptyMatrixOption = () => ({
|
|
3735
|
+
_key: createOptKey(),
|
|
3736
|
+
label: '',
|
|
3737
|
+
value: ''
|
|
3738
|
+
});
|
|
3739
|
+
const ensureKeys = (list = [], createKey) => list.map(item => _extends({}, item, {
|
|
3740
|
+
_key: item._key || createKey()
|
|
3741
|
+
}));
|
|
3742
|
+
const hasMissingKey = (list = []) => list.some(item => !(item != null && item._key));
|
|
3743
|
+
|
|
3744
|
+
/** 勿在此用 FormInfo:模块列不在 Form 内,FormInfo→FieldList 会读不到 openApiRef */
|
|
3745
|
+
const EditorSection = ({
|
|
3746
|
+
title,
|
|
3747
|
+
tip,
|
|
3748
|
+
children
|
|
3749
|
+
}) => /*#__PURE__*/jsxs("div", {
|
|
3750
|
+
className: style['columns-editor'],
|
|
3751
|
+
children: [title ? /*#__PURE__*/jsx(Title, {
|
|
3752
|
+
level: 5,
|
|
3753
|
+
className: style['matrix-scale-editor-title'],
|
|
3754
|
+
children: title
|
|
3755
|
+
}) : null, children, tip ? /*#__PURE__*/jsx(Space, {
|
|
3756
|
+
size: 4,
|
|
3757
|
+
className: style['options-tip'],
|
|
3758
|
+
children: tip
|
|
3759
|
+
}) : null]
|
|
3760
|
+
});
|
|
3761
|
+
const LabelNameRows = ({
|
|
3762
|
+
title,
|
|
3763
|
+
tip,
|
|
3764
|
+
list,
|
|
3765
|
+
onChange,
|
|
3766
|
+
createEmpty,
|
|
3767
|
+
createKey,
|
|
3768
|
+
labelPlaceholder,
|
|
3769
|
+
namePlaceholder,
|
|
3770
|
+
addText
|
|
3771
|
+
}) => {
|
|
3772
|
+
// 只展示已落盘数据;缺 key / 空列表由 effect 补齐,避免每次 render 新建临时项导致丢焦点
|
|
3773
|
+
useEffect(() => {
|
|
3774
|
+
if (!list.length) {
|
|
3775
|
+
onChange([createEmpty()]);
|
|
3776
|
+
return;
|
|
3777
|
+
}
|
|
3778
|
+
if (hasMissingKey(list)) {
|
|
3779
|
+
onChange(ensureKeys(list, createKey));
|
|
3780
|
+
}
|
|
3781
|
+
}, [list, onChange, createEmpty, createKey]);
|
|
3782
|
+
const rows = list.length ? list : [];
|
|
3783
|
+
const updateItem = (index, patch) => {
|
|
3784
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? _extends({}, item, patch) : item));
|
|
3785
|
+
};
|
|
3786
|
+
return /*#__PURE__*/jsxs(EditorSection, {
|
|
3787
|
+
title: title,
|
|
3788
|
+
tip: tip,
|
|
3789
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3790
|
+
className: style['options-list'],
|
|
3791
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
3792
|
+
gap: 8,
|
|
3793
|
+
align: "start",
|
|
3794
|
+
className: style['options-row'],
|
|
3795
|
+
children: [/*#__PURE__*/jsx(Input$1, {
|
|
3796
|
+
value: item.label || '',
|
|
3797
|
+
placeholder: labelPlaceholder,
|
|
3798
|
+
onChange: e => updateItem(index, {
|
|
3799
|
+
label: e.target.value
|
|
3800
|
+
})
|
|
3801
|
+
}), /*#__PURE__*/jsx(Input$1, {
|
|
3802
|
+
value: item.name || '',
|
|
3803
|
+
placeholder: namePlaceholder,
|
|
3804
|
+
onChange: e => updateItem(index, {
|
|
3805
|
+
name: e.target.value
|
|
3806
|
+
})
|
|
3807
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3808
|
+
type: "text",
|
|
3809
|
+
danger: true,
|
|
3810
|
+
className: style['icon-square-btn-sm'],
|
|
3811
|
+
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
3812
|
+
disabled: rows.length <= 1,
|
|
3813
|
+
onClick: () => {
|
|
3814
|
+
const next = rows.filter((_, i) => i !== index);
|
|
3815
|
+
onChange(next.length ? next : [createEmpty()]);
|
|
3816
|
+
}
|
|
3817
|
+
})]
|
|
3818
|
+
}, item._key || `row-${index}`))
|
|
3819
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3820
|
+
type: "dashed",
|
|
3821
|
+
block: true,
|
|
3822
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
3823
|
+
onClick: () => onChange([...rows, createEmpty()]),
|
|
3824
|
+
children: addText
|
|
3825
|
+
})]
|
|
3826
|
+
});
|
|
3827
|
+
};
|
|
3828
|
+
const MatrixOptionsEditor = ({
|
|
3829
|
+
value: _value = [],
|
|
3830
|
+
onChange
|
|
3831
|
+
}) => {
|
|
3832
|
+
const {
|
|
3833
|
+
formatMessage
|
|
3834
|
+
} = useIntl();
|
|
3835
|
+
useEffect(() => {
|
|
3836
|
+
if (!_value.length) {
|
|
3837
|
+
onChange([createEmptyMatrixOption()]);
|
|
3838
|
+
return;
|
|
3839
|
+
}
|
|
3840
|
+
if (hasMissingKey(_value)) {
|
|
3841
|
+
onChange(ensureKeys(_value, createOptKey));
|
|
3842
|
+
}
|
|
3843
|
+
}, [_value, onChange]);
|
|
3844
|
+
const rows = _value.length ? _value : [];
|
|
3845
|
+
const updateItem = (index, patch) => {
|
|
3846
|
+
onChange(rows.map((item, itemIndex) => itemIndex === index ? _extends({}, item, patch) : item));
|
|
3847
|
+
};
|
|
3848
|
+
return /*#__PURE__*/jsxs(EditorSection, {
|
|
3849
|
+
title: formatMessage({
|
|
3850
|
+
id: 'matrixScaleOptionsTitle'
|
|
3851
|
+
}),
|
|
3852
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3853
|
+
className: style['options-list'],
|
|
3854
|
+
children: rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
3855
|
+
gap: 8,
|
|
3856
|
+
align: "start",
|
|
3857
|
+
className: style['options-row'],
|
|
3858
|
+
children: [/*#__PURE__*/jsx(Input$1, {
|
|
3859
|
+
value: item.label || '',
|
|
3860
|
+
placeholder: formatMessage({
|
|
3861
|
+
id: 'optionLabelPlaceholder'
|
|
3862
|
+
}),
|
|
3863
|
+
onChange: e => {
|
|
3864
|
+
const label = e.target.value;
|
|
3865
|
+
const patch = {
|
|
3866
|
+
label
|
|
3867
|
+
};
|
|
3868
|
+
if (!item.value || item.value === item.label) {
|
|
3869
|
+
patch.value = label;
|
|
3870
|
+
}
|
|
3871
|
+
updateItem(index, patch);
|
|
3872
|
+
}
|
|
3873
|
+
}), /*#__PURE__*/jsx(Input$1, {
|
|
3874
|
+
value: item.value || '',
|
|
3875
|
+
placeholder: formatMessage({
|
|
3876
|
+
id: 'optionValuePlaceholder'
|
|
3877
|
+
}),
|
|
3878
|
+
onChange: e => updateItem(index, {
|
|
3879
|
+
value: e.target.value
|
|
3880
|
+
})
|
|
3881
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3882
|
+
type: "text",
|
|
3883
|
+
danger: true,
|
|
3884
|
+
className: style['icon-square-btn-sm'],
|
|
3885
|
+
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
3886
|
+
disabled: rows.length <= 1,
|
|
3887
|
+
onClick: () => {
|
|
3888
|
+
const next = rows.filter((_, i) => i !== index);
|
|
3889
|
+
onChange(next.length ? next : [createEmptyMatrixOption()]);
|
|
3890
|
+
}
|
|
3891
|
+
})]
|
|
3892
|
+
}, item._key || `opt-${index}`))
|
|
3893
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3894
|
+
type: "dashed",
|
|
3895
|
+
block: true,
|
|
3896
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
3897
|
+
onClick: () => onChange([...rows, createEmptyMatrixOption()]),
|
|
3898
|
+
children: formatMessage({
|
|
3899
|
+
id: 'addOption'
|
|
3900
|
+
})
|
|
3901
|
+
})]
|
|
3902
|
+
});
|
|
3903
|
+
};
|
|
3904
|
+
const MatrixScaleEditor = ({
|
|
3905
|
+
block,
|
|
3906
|
+
onChange
|
|
3907
|
+
}) => {
|
|
3908
|
+
const {
|
|
3909
|
+
formatMessage
|
|
3910
|
+
} = useIntl();
|
|
3911
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
3912
|
+
const blockRef = useRef(block);
|
|
3913
|
+
blockRef.current = block;
|
|
3914
|
+
const onChangeRef = useRef(onChange);
|
|
3915
|
+
onChangeRef.current = onChange;
|
|
3916
|
+
|
|
3917
|
+
// 用 ref 保持回调稳定,避免输入时子组件 useEffect 反复触发
|
|
3918
|
+
const handleRowsChange = useCallback(rows => onChangeRef.current(_extends({}, blockRef.current, {
|
|
3919
|
+
rows
|
|
3920
|
+
})), []);
|
|
3921
|
+
const handleOptionsChange = useCallback(options => onChangeRef.current(_extends({}, blockRef.current, {
|
|
3922
|
+
options
|
|
3923
|
+
})), []);
|
|
3924
|
+
const handleColumnsChange = useCallback(columns => onChangeRef.current(_extends({}, blockRef.current, {
|
|
3925
|
+
columns
|
|
3926
|
+
})), []);
|
|
3927
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3928
|
+
className: style['block-body'],
|
|
3929
|
+
children: [/*#__PURE__*/jsx(Text$5, {
|
|
3930
|
+
type: "secondary",
|
|
3931
|
+
className: style['inline-empty'],
|
|
3932
|
+
children: formatMessage({
|
|
3933
|
+
id: `matrixScaleEditorHint_${layout}`
|
|
3934
|
+
})
|
|
3935
|
+
}), /*#__PURE__*/jsx(LabelNameRows, {
|
|
3936
|
+
title: formatMessage({
|
|
3937
|
+
id: 'matrixScaleRowsTitle'
|
|
3938
|
+
}),
|
|
3939
|
+
tip: formatMessage({
|
|
3940
|
+
id: 'matrixScaleRowsHint'
|
|
3941
|
+
}),
|
|
3942
|
+
list: block.rows || [],
|
|
3943
|
+
onChange: handleRowsChange,
|
|
3944
|
+
createEmpty: createEmptyMatrixRow,
|
|
3945
|
+
createKey: createRowKey,
|
|
3946
|
+
labelPlaceholder: formatMessage({
|
|
3947
|
+
id: 'matrixScaleRowLabelPlaceholder'
|
|
3948
|
+
}),
|
|
3949
|
+
namePlaceholder: formatMessage({
|
|
3950
|
+
id: 'matrixScaleRowNamePlaceholder'
|
|
3951
|
+
}),
|
|
3952
|
+
addText: formatMessage({
|
|
3953
|
+
id: 'matrixScaleAddRow'
|
|
3954
|
+
})
|
|
3955
|
+
}), layout === 'options' ? /*#__PURE__*/jsx(MatrixOptionsEditor, {
|
|
3956
|
+
value: block.options || [],
|
|
3957
|
+
onChange: handleOptionsChange
|
|
3958
|
+
}) : null, layout === 'columns' ? /*#__PURE__*/jsx(LabelNameRows, {
|
|
3959
|
+
title: formatMessage({
|
|
3960
|
+
id: 'matrixScaleColumnsTitle'
|
|
3961
|
+
}),
|
|
3962
|
+
tip: formatMessage({
|
|
3963
|
+
id: 'matrixScaleColumnsHint'
|
|
3964
|
+
}),
|
|
3965
|
+
list: block.columns || [],
|
|
3966
|
+
onChange: handleColumnsChange,
|
|
3967
|
+
createEmpty: createEmptyMatrixColumn,
|
|
3968
|
+
createKey: createColKey,
|
|
3969
|
+
labelPlaceholder: formatMessage({
|
|
3970
|
+
id: 'matrixScaleColumnLabelPlaceholder'
|
|
3971
|
+
}),
|
|
3972
|
+
namePlaceholder: formatMessage({
|
|
3973
|
+
id: 'matrixScaleColumnNamePlaceholder'
|
|
3974
|
+
}),
|
|
3975
|
+
addText: formatMessage({
|
|
3976
|
+
id: 'matrixScaleAddRow'
|
|
3977
|
+
})
|
|
3978
|
+
}) : null]
|
|
3979
|
+
});
|
|
3980
|
+
};
|
|
3981
|
+
var MatrixScaleEditor$1 = MatrixScaleEditor;
|
|
3982
|
+
|
|
3350
3983
|
const _excluded$3 = ["title", "danger"];
|
|
3351
3984
|
const {
|
|
3352
3985
|
Text: Text$4
|
|
@@ -3392,6 +4025,9 @@ const ROOT_ADD_OPTIONS = [{
|
|
|
3392
4025
|
}, {
|
|
3393
4026
|
key: 'multiField',
|
|
3394
4027
|
icon: /*#__PURE__*/jsx(AppstoreOutlined, {})
|
|
4028
|
+
}, {
|
|
4029
|
+
key: 'matrixScale',
|
|
4030
|
+
icon: /*#__PURE__*/jsx(BorderOuterOutlined, {})
|
|
3395
4031
|
}, {
|
|
3396
4032
|
key: 'steps',
|
|
3397
4033
|
icon: /*#__PURE__*/jsx(OrderedListOutlined, {})
|
|
@@ -3422,6 +4058,7 @@ const BlockListPanel = ({
|
|
|
3422
4058
|
onDeleteChoiceOption,
|
|
3423
4059
|
onMoveChoiceOption,
|
|
3424
4060
|
onOpenFormActions,
|
|
4061
|
+
onPatchBlock,
|
|
3425
4062
|
extraToolbar
|
|
3426
4063
|
}) => {
|
|
3427
4064
|
const {
|
|
@@ -3775,6 +4412,12 @@ const BlockListPanel = ({
|
|
|
3775
4412
|
})
|
|
3776
4413
|
});
|
|
3777
4414
|
}
|
|
4415
|
+
if (block.kind === 'matrixScale') {
|
|
4416
|
+
return /*#__PURE__*/jsx(MatrixScaleEditor$1, {
|
|
4417
|
+
block: block,
|
|
4418
|
+
onChange: next => onPatchBlock == null ? void 0 : onPatchBlock(next)
|
|
4419
|
+
});
|
|
4420
|
+
}
|
|
3778
4421
|
if (block.kind === 'choice') {
|
|
3779
4422
|
return /*#__PURE__*/jsxs("div", {
|
|
3780
4423
|
className: style['block-body'],
|
|
@@ -3898,15 +4541,16 @@ const BlockListPanel = ({
|
|
|
3898
4541
|
});
|
|
3899
4542
|
};
|
|
3900
4543
|
const renderBlockSection = (block, blockIndex, siblings, depth = 0) => {
|
|
3901
|
-
var _block$itemBlocks, _block$blocks, _block$items2, _block$options2, _block$list, _block$list2;
|
|
4544
|
+
var _block$itemBlocks, _block$blocks, _block$items2, _block$rows, _block$options2, _block$list, _block$list2;
|
|
3902
4545
|
const total = siblings.length;
|
|
3903
4546
|
const locked = blockHasLockedField(block);
|
|
3904
4547
|
const definition = getBlockDefinition(block.kind);
|
|
3905
|
-
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'choice';
|
|
4548
|
+
const canAddField = block.kind !== 'steps' && block.kind !== 'multiField' && block.kind !== 'matrixScale' && block.kind !== 'choice';
|
|
3906
4549
|
const supportsItemBlocks$1 = supportsItemBlocks(block.kind);
|
|
3907
4550
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
3908
4551
|
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
3909
4552
|
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;
|
|
4553
|
+
const matrixLayout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
3910
4554
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
3911
4555
|
id: 'stepCount'
|
|
3912
4556
|
}, {
|
|
@@ -3918,6 +4562,17 @@ const BlockListPanel = ({
|
|
|
3918
4562
|
className: style['block-summary-type'],
|
|
3919
4563
|
children: [/*#__PURE__*/createElement(getFieldTypeIcon(block.fieldType || 'Input')), resolveFieldTypeLabel(block.fieldType, formatMessage)]
|
|
3920
4564
|
})
|
|
4565
|
+
}) : block.kind === 'matrixScale' ? formatMessage({
|
|
4566
|
+
id: 'matrixScaleSummary'
|
|
4567
|
+
}, {
|
|
4568
|
+
type: /*#__PURE__*/jsxs("span", {
|
|
4569
|
+
className: style['block-summary-type'],
|
|
4570
|
+
children: [/*#__PURE__*/createElement(getFieldTypeIcon(block.fieldType || 'RadioGroup')), resolveFieldTypeLabel(block.fieldType || 'RadioGroup', formatMessage)]
|
|
4571
|
+
}),
|
|
4572
|
+
layout: formatMessage({
|
|
4573
|
+
id: `matrixScaleLayout_${matrixLayout}`
|
|
4574
|
+
}),
|
|
4575
|
+
rows: ((_block$rows = block.rows) == null ? void 0 : _block$rows.length) || 0
|
|
3921
4576
|
}) : block.kind === 'choice' ? formatMessage({
|
|
3922
4577
|
id: 'choiceOptionCount'
|
|
3923
4578
|
}, {
|
|
@@ -4266,6 +4921,63 @@ const BlockConfigFields = ({
|
|
|
4266
4921
|
})
|
|
4267
4922
|
}, "addText"));
|
|
4268
4923
|
}
|
|
4924
|
+
if (kind === 'matrixScale') {
|
|
4925
|
+
list.push(/*#__PURE__*/jsx(LocaleInput, {
|
|
4926
|
+
name: "title",
|
|
4927
|
+
label: formatMessage({
|
|
4928
|
+
id: 'blockTitle'
|
|
4929
|
+
}),
|
|
4930
|
+
placeholder: formatMessage({
|
|
4931
|
+
id: 'blockTitlePlaceholder'
|
|
4932
|
+
})
|
|
4933
|
+
}, "title"), /*#__PURE__*/jsx(Input, {
|
|
4934
|
+
name: "name",
|
|
4935
|
+
label: formatMessage({
|
|
4936
|
+
id: 'blockName'
|
|
4937
|
+
}),
|
|
4938
|
+
rule: "REQ",
|
|
4939
|
+
placeholder: formatMessage({
|
|
4940
|
+
id: 'fieldNamePlaceholder'
|
|
4941
|
+
})
|
|
4942
|
+
}, "name"), /*#__PURE__*/jsx(LocaleInput, {
|
|
4943
|
+
name: "rowTitle",
|
|
4944
|
+
label: formatMessage({
|
|
4945
|
+
id: 'matrixScaleRowTitle'
|
|
4946
|
+
}),
|
|
4947
|
+
placeholder: formatMessage({
|
|
4948
|
+
id: 'matrixScaleRowTitlePlaceholder'
|
|
4949
|
+
})
|
|
4950
|
+
}, "rowTitle"), /*#__PURE__*/jsx(Select, {
|
|
4951
|
+
name: "layout",
|
|
4952
|
+
label: formatMessage({
|
|
4953
|
+
id: 'matrixScaleLayout'
|
|
4954
|
+
}),
|
|
4955
|
+
rule: "REQ",
|
|
4956
|
+
options: MATRIX_LAYOUTS.map(value => ({
|
|
4957
|
+
label: formatMessage({
|
|
4958
|
+
id: `matrixScaleLayout_${value}`
|
|
4959
|
+
}),
|
|
4960
|
+
value
|
|
4961
|
+
}))
|
|
4962
|
+
}, "layout"), /*#__PURE__*/jsx(Select, {
|
|
4963
|
+
name: "fieldType",
|
|
4964
|
+
label: formatMessage({
|
|
4965
|
+
id: 'multiFieldType'
|
|
4966
|
+
}),
|
|
4967
|
+
rule: "REQ",
|
|
4968
|
+
options: fieldTypeOptions
|
|
4969
|
+
}, "fieldType"), /*#__PURE__*/jsx(Checkbox, {
|
|
4970
|
+
name: "bordered",
|
|
4971
|
+
children: formatMessage({
|
|
4972
|
+
id: 'blockBordered'
|
|
4973
|
+
})
|
|
4974
|
+
}, "bordered"), /*#__PURE__*/jsx(Checkbox, {
|
|
4975
|
+
name: "required",
|
|
4976
|
+
children: formatMessage({
|
|
4977
|
+
id: 'matrixScaleRequired'
|
|
4978
|
+
})
|
|
4979
|
+
}, "required"));
|
|
4980
|
+
}
|
|
4269
4981
|
if (kind === 'steps') {
|
|
4270
4982
|
list.push(/*#__PURE__*/jsx(LocaleInput, {
|
|
4271
4983
|
name: "title",
|
|
@@ -4619,7 +5331,28 @@ const FlatOptionRows = ({
|
|
|
4619
5331
|
};
|
|
4620
5332
|
return /*#__PURE__*/jsxs("div", {
|
|
4621
5333
|
className: style['options-list'],
|
|
4622
|
-
children: [
|
|
5334
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
5335
|
+
className: style['options-header'],
|
|
5336
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
5337
|
+
className: style['options-header-label'],
|
|
5338
|
+
children: formatMessage({
|
|
5339
|
+
id: 'optionLabelColumn'
|
|
5340
|
+
})
|
|
5341
|
+
}), /*#__PURE__*/jsx("span", {
|
|
5342
|
+
className: style['options-header-value'],
|
|
5343
|
+
children: formatMessage({
|
|
5344
|
+
id: 'optionValueColumn'
|
|
5345
|
+
})
|
|
5346
|
+
}), allowDescription ? /*#__PURE__*/jsx("span", {
|
|
5347
|
+
className: style['options-header-description'],
|
|
5348
|
+
children: formatMessage({
|
|
5349
|
+
id: 'optionDescColumn'
|
|
5350
|
+
})
|
|
5351
|
+
}) : null, /*#__PURE__*/jsx("span", {
|
|
5352
|
+
className: style['options-header-action'],
|
|
5353
|
+
"aria-hidden": "true"
|
|
5354
|
+
})]
|
|
5355
|
+
}), rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
4623
5356
|
gap: 8,
|
|
4624
5357
|
align: "start",
|
|
4625
5358
|
className: style['options-row'],
|
|
@@ -5012,6 +5745,7 @@ const TableRowsEditor = ({
|
|
|
5012
5745
|
},
|
|
5013
5746
|
children: [/*#__PURE__*/jsxs(Flex, {
|
|
5014
5747
|
gap: 8,
|
|
5748
|
+
className: style['options-row'],
|
|
5015
5749
|
children: [/*#__PURE__*/jsx(Input$1, {
|
|
5016
5750
|
value: item.value || '',
|
|
5017
5751
|
placeholder: formatMessage({
|
|
@@ -5244,7 +5978,8 @@ const SuperSelectPropsEditor = ({
|
|
|
5244
5978
|
};
|
|
5245
5979
|
var SuperSelectPropsEditor$1 = SuperSelectPropsEditor;
|
|
5246
5980
|
|
|
5247
|
-
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup'];
|
|
5981
|
+
const BUILTIN_PROP_TYPES = ['Input', 'TextArea', 'InputNumber', 'Select', 'DatePicker', 'Switch', 'RadioGroup', 'CheckboxGroup', 'RadioGroupOther', 'CheckboxGroupOther'];
|
|
5982
|
+
const CHOICE_OTHER_TYPES = ['RadioGroupOther', 'CheckboxGroupOther'];
|
|
5248
5983
|
const buildPropsSchemaList = (schema, formatMessage) => (schema || []).filter(item => item == null ? void 0 : item.name).map(item => {
|
|
5249
5984
|
if (item.type === 'boolean') {
|
|
5250
5985
|
return /*#__PURE__*/jsx(Checkbox, {
|
|
@@ -5481,12 +6216,73 @@ const buildBuiltinList = (type, formatMessage) => {
|
|
|
5481
6216
|
}, "unCheckedChildren")];
|
|
5482
6217
|
case 'RadioGroup':
|
|
5483
6218
|
case 'CheckboxGroup':
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
6219
|
+
case 'RadioGroupOther':
|
|
6220
|
+
case 'CheckboxGroupOther':
|
|
6221
|
+
{
|
|
6222
|
+
const list = [/*#__PURE__*/jsx(Checkbox, {
|
|
6223
|
+
name: "inline",
|
|
6224
|
+
children: formatMessage({
|
|
6225
|
+
id: 'propOptionsInline'
|
|
6226
|
+
})
|
|
6227
|
+
}, "inline"), /*#__PURE__*/jsx(Checkbox, {
|
|
6228
|
+
name: "modern",
|
|
6229
|
+
children: formatMessage({
|
|
6230
|
+
id: 'propChoiceModern'
|
|
6231
|
+
})
|
|
6232
|
+
}, "modern"), /*#__PURE__*/jsx(Checkbox, {
|
|
6233
|
+
name: "block",
|
|
6234
|
+
children: formatMessage({
|
|
6235
|
+
id: 'propChoiceBlock'
|
|
6236
|
+
})
|
|
6237
|
+
}, "block"), /*#__PURE__*/jsx(Select, {
|
|
6238
|
+
name: "indexType",
|
|
6239
|
+
label: formatMessage({
|
|
6240
|
+
id: 'propChoiceIndexType'
|
|
6241
|
+
}),
|
|
6242
|
+
options: [{
|
|
6243
|
+
label: formatMessage({
|
|
6244
|
+
id: 'propChoiceIndexTypeLetter'
|
|
6245
|
+
}),
|
|
6246
|
+
value: 'letter'
|
|
6247
|
+
}, {
|
|
6248
|
+
label: formatMessage({
|
|
6249
|
+
id: 'propChoiceIndexTypeNumber'
|
|
6250
|
+
}),
|
|
6251
|
+
value: 'number'
|
|
6252
|
+
}, {
|
|
6253
|
+
label: formatMessage({
|
|
6254
|
+
id: 'propChoiceIndexTypeCheck'
|
|
6255
|
+
}),
|
|
6256
|
+
value: 'check'
|
|
6257
|
+
}],
|
|
6258
|
+
display: ({
|
|
6259
|
+
openApi
|
|
6260
|
+
}) => {
|
|
6261
|
+
var _openApi$data2;
|
|
6262
|
+
return !!(openApi != null && (_openApi$data2 = openApi.data) != null && _openApi$data2.modern);
|
|
6263
|
+
}
|
|
6264
|
+
}, "indexType")];
|
|
6265
|
+
if (CHOICE_OTHER_TYPES.includes(type)) {
|
|
6266
|
+
list.push(/*#__PURE__*/jsx(LocaleInput, {
|
|
6267
|
+
name: "otherLabel",
|
|
6268
|
+
label: formatMessage({
|
|
6269
|
+
id: 'propChoiceOtherLabel'
|
|
6270
|
+
}),
|
|
6271
|
+
placeholder: formatMessage({
|
|
6272
|
+
id: 'propChoiceOtherLabelHint'
|
|
6273
|
+
})
|
|
6274
|
+
}, "otherLabel"), /*#__PURE__*/jsx(LocaleInput, {
|
|
6275
|
+
name: "otherPlaceholder",
|
|
6276
|
+
label: formatMessage({
|
|
6277
|
+
id: 'propChoiceOtherPlaceholder'
|
|
6278
|
+
}),
|
|
6279
|
+
placeholder: formatMessage({
|
|
6280
|
+
id: 'propChoiceOtherPlaceholderHint'
|
|
6281
|
+
})
|
|
6282
|
+
}, "otherPlaceholder"));
|
|
6283
|
+
}
|
|
6284
|
+
return list;
|
|
6285
|
+
}
|
|
5490
6286
|
default:
|
|
5491
6287
|
return [];
|
|
5492
6288
|
}
|
|
@@ -5682,6 +6478,19 @@ const ConditionValueInput = ({
|
|
|
5682
6478
|
value: item.value,
|
|
5683
6479
|
label: resolveLocaleText(item.label, locale) || String(item.value)
|
|
5684
6480
|
}));
|
|
6481
|
+
if ((trigger == null ? void 0 : trigger.type) === 'RadioGroupOther' || (trigger == null ? void 0 : trigger.type) === 'CheckboxGroupOther') {
|
|
6482
|
+
var _trigger$props2;
|
|
6483
|
+
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';
|
|
6484
|
+
if (!options.some(item => String(item.value) === otherValue)) {
|
|
6485
|
+
var _trigger$props3;
|
|
6486
|
+
options.push({
|
|
6487
|
+
value: otherValue,
|
|
6488
|
+
label: resolveLocaleText(trigger == null || (_trigger$props3 = trigger.props) == null || (_trigger$props3 = _trigger$props3.otherOption) == null ? void 0 : _trigger$props3.label, locale) || formatMessage({
|
|
6489
|
+
id: 'FieldTypeOtherOption'
|
|
6490
|
+
})
|
|
6491
|
+
});
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
5685
6494
|
const value = multiple ? Array.isArray(condition.value) ? condition.value : condition.value != null ? [condition.value] : [] : Array.isArray(condition.value) ? condition.value[0] : condition.value;
|
|
5686
6495
|
return /*#__PURE__*/jsx(Select$1, {
|
|
5687
6496
|
className: style['visible-when-value']
|
|
@@ -6797,12 +7606,13 @@ const renderFieldEntries = (fields = [], preview = false, {
|
|
|
6797
7606
|
}
|
|
6798
7607
|
delete props.range;
|
|
6799
7608
|
|
|
6800
|
-
//
|
|
6801
|
-
|
|
7609
|
+
// 选择组:form-creator 的 inline 仅编辑器用;渲染时删掉。block/modern 交给 react-form-antd;
|
|
7610
|
+
// 未开 block 且 inline=false 时沿用旧纵向兜底
|
|
7611
|
+
if (field.type === 'RadioGroup' || field.type === 'CheckboxGroup' || field.type === 'RadioGroupOther' || field.type === 'CheckboxGroupOther') {
|
|
6802
7612
|
const optionsInline = props.inline !== false;
|
|
6803
7613
|
delete props.inline;
|
|
6804
|
-
if (!optionsInline) {
|
|
6805
|
-
if (field.type === 'RadioGroup') {
|
|
7614
|
+
if (!props.block && !optionsInline) {
|
|
7615
|
+
if (field.type === 'RadioGroup' || field.type === 'RadioGroupOther') {
|
|
6806
7616
|
props.vertical = true;
|
|
6807
7617
|
}
|
|
6808
7618
|
props.className = [props.className, style['option-group-stack']].filter(Boolean).join(' ');
|
|
@@ -7024,6 +7834,32 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
7024
7834
|
addText: block.addText
|
|
7025
7835
|
} : {})), asListItem);
|
|
7026
7836
|
}
|
|
7837
|
+
case 'matrixScale':
|
|
7838
|
+
{
|
|
7839
|
+
const FieldComponent = getFieldComponent(block.fieldType || 'RadioGroup');
|
|
7840
|
+
if (!FieldComponent) {
|
|
7841
|
+
return null;
|
|
7842
|
+
}
|
|
7843
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
7844
|
+
return withBlockLayout(/*#__PURE__*/createElement(MatrixScale, _extends({
|
|
7845
|
+
key: block.id,
|
|
7846
|
+
name: block.name,
|
|
7847
|
+
title: block.title || undefined,
|
|
7848
|
+
rowTitle: block.rowTitle || undefined,
|
|
7849
|
+
bordered,
|
|
7850
|
+
field: FieldComponent,
|
|
7851
|
+
rule: block.rule || undefined,
|
|
7852
|
+
rows: block.rows || []
|
|
7853
|
+
}, layout === 'options' ? {
|
|
7854
|
+
options: block.options || []
|
|
7855
|
+
} : null, layout === 'columns' ? {
|
|
7856
|
+
columns: block.columns || []
|
|
7857
|
+
} : null, listItemPartProps || {}, {
|
|
7858
|
+
className: resolvePartRootClassName(depth)
|
|
7859
|
+
}, locale ? {
|
|
7860
|
+
locale
|
|
7861
|
+
} : {})), asListItem);
|
|
7862
|
+
}
|
|
7027
7863
|
case 'steps':
|
|
7028
7864
|
{
|
|
7029
7865
|
return withBlockLayout(/*#__PURE__*/createElement(Steps, {
|
|
@@ -7472,6 +8308,12 @@ const FormCreator = withLocale$1(({
|
|
|
7472
8308
|
const handleMoveBlock = (blockId, direction) => {
|
|
7473
8309
|
updateSchema(updateBlocks(schema, blocks => moveBlockInTree(blocks, blockId, direction)));
|
|
7474
8310
|
};
|
|
8311
|
+
const handlePatchBlock = block => {
|
|
8312
|
+
if (!(block != null && block.id)) {
|
|
8313
|
+
return;
|
|
8314
|
+
}
|
|
8315
|
+
updateSchema(mapBlocks(schema, block.id, () => block));
|
|
8316
|
+
};
|
|
7475
8317
|
const handleAddStep = blockId => {
|
|
7476
8318
|
setStepContext({
|
|
7477
8319
|
blockId,
|
|
@@ -7702,6 +8544,7 @@ const FormCreator = withLocale$1(({
|
|
|
7702
8544
|
onEditBlock: handleEditBlock,
|
|
7703
8545
|
onDeleteBlock: handleDeleteBlock,
|
|
7704
8546
|
onMoveBlock: handleMoveBlock,
|
|
8547
|
+
onPatchBlock: handlePatchBlock,
|
|
7705
8548
|
onAddField: handleAddField,
|
|
7706
8549
|
onEditField: handleEditField,
|
|
7707
8550
|
onDeleteField: handleDeleteField,
|
|
@@ -8564,6 +9407,68 @@ const walkBlock = (block, layer, depth = 0, ctx = {}) => {
|
|
|
8564
9407
|
layer.properties[name] = arraySchema;
|
|
8565
9408
|
return;
|
|
8566
9409
|
}
|
|
9410
|
+
case 'matrixScale':
|
|
9411
|
+
{
|
|
9412
|
+
const name = block.name != null && String(block.name).trim() ? String(block.name).trim() : '';
|
|
9413
|
+
if (!name) {
|
|
9414
|
+
return;
|
|
9415
|
+
}
|
|
9416
|
+
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
9417
|
+
const fieldType = block.fieldType || 'RadioGroup';
|
|
9418
|
+
const required = typeof block.rule === 'string' && block.rule.split(' ').includes('REQ');
|
|
9419
|
+
const properties = {};
|
|
9420
|
+
const requiredKeys = [];
|
|
9421
|
+
(block.rows || []).forEach(row => {
|
|
9422
|
+
const rowName = (row == null ? void 0 : row.name) != null && String(row.name).trim() ? String(row.name).trim() : '';
|
|
9423
|
+
if (!rowName) {
|
|
9424
|
+
return;
|
|
9425
|
+
}
|
|
9426
|
+
if (layout === 'columns') {
|
|
9427
|
+
const columnProperties = {};
|
|
9428
|
+
(block.columns || []).forEach(column => {
|
|
9429
|
+
const columnName = (column == null ? void 0 : column.name) != null && String(column.name).trim() ? String(column.name).trim() : '';
|
|
9430
|
+
if (!columnName) {
|
|
9431
|
+
return;
|
|
9432
|
+
}
|
|
9433
|
+
columnProperties[columnName] = resolveFieldValueSchema({
|
|
9434
|
+
type: fieldType,
|
|
9435
|
+
label: column.label,
|
|
9436
|
+
rule: block.rule,
|
|
9437
|
+
props: {}
|
|
9438
|
+
});
|
|
9439
|
+
});
|
|
9440
|
+
properties[rowName] = {
|
|
9441
|
+
type: 'object',
|
|
9442
|
+
title: row.label || undefined,
|
|
9443
|
+
properties: columnProperties
|
|
9444
|
+
};
|
|
9445
|
+
} else {
|
|
9446
|
+
properties[rowName] = resolveFieldValueSchema({
|
|
9447
|
+
type: fieldType,
|
|
9448
|
+
label: row.label,
|
|
9449
|
+
rule: block.rule,
|
|
9450
|
+
props: layout === 'options' ? {
|
|
9451
|
+
options: block.options || []
|
|
9452
|
+
} : {}
|
|
9453
|
+
});
|
|
9454
|
+
}
|
|
9455
|
+
if (required) {
|
|
9456
|
+
requiredKeys.push(rowName);
|
|
9457
|
+
}
|
|
9458
|
+
});
|
|
9459
|
+
const objectSchema = {
|
|
9460
|
+
type: 'object',
|
|
9461
|
+
properties
|
|
9462
|
+
};
|
|
9463
|
+
if (block.title) {
|
|
9464
|
+
objectSchema.title = block.title;
|
|
9465
|
+
}
|
|
9466
|
+
if (requiredKeys.length) {
|
|
9467
|
+
objectSchema.required = requiredKeys;
|
|
9468
|
+
}
|
|
9469
|
+
layer.properties[name] = objectSchema;
|
|
9470
|
+
return;
|
|
9471
|
+
}
|
|
8567
9472
|
case 'steps':
|
|
8568
9473
|
{
|
|
8569
9474
|
(block.items || []).forEach(step => {
|