@kne/form-creator 0.1.32 → 0.1.34
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 +1 -1
- package/dist/index.css +52 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +242 -98
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +252 -110
- package/dist/index.modern.js.map +1 -1
- package/dist/locale/en-US.js +12 -4
- package/dist/locale/en-US.js.map +1 -1
- package/dist/locale/en-US.modern.js +12 -4
- package/dist/locale/en-US.modern.js.map +1 -1
- package/dist/locale/zh-CN.js +12 -4
- package/dist/locale/zh-CN.js.map +1 -1
- package/dist/locale/zh-CN.modern.js +12 -4
- package/dist/locale/zh-CN.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -2,7 +2,7 @@ import '@kne/form-info/dist/index.css';
|
|
|
2
2
|
import '@kne/info-page/dist/index.css';
|
|
3
3
|
import '@kne/button-group/dist/index.css';
|
|
4
4
|
import { createContext, useContext, useRef, useCallback, useEffect, useState, useMemo, createElement, Fragment as Fragment$1 } from 'react';
|
|
5
|
-
import { Button, Input as Input$1, Space, Tag, Tooltip, Typography, Flex, Dropdown, Empty, message, Checkbox as Checkbox$1,
|
|
5
|
+
import { Button, Input as Input$1, Space, Tag, Tooltip, Typography, Flex, InputNumber as InputNumber$1, Dropdown, Empty, message, Checkbox as Checkbox$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
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, CheckOutlined } from '@ant-design/icons';
|
|
@@ -18,7 +18,7 @@ import FormInfo, { FormModal, Steps, validateFieldsByName, Form, MatrixScale, Mu
|
|
|
18
18
|
import InfoPage from '@kne/info-page';
|
|
19
19
|
import { createWithRemoteLoader } from '@kne/remote-loader';
|
|
20
20
|
|
|
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-list-items":"kne-form-creator_Xpl6K","_":"kne-form-creator_jWWXR","schema-content-list-item":"kne-form-creator_dBG5B","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","schema-content-matrix":"kne-form-creator_Wj4Oi","schema-content-matrix-inner":"kne-form-creator_g0-ex","schema-content-matrix-header":"kne-form-creator_6Ew-1","schema-content-matrix-row-title":"kne-form-creator_QQ9-w","schema-content-matrix-option-title":"kne-form-creator_OuEl1","is-choice":"kne-form-creator_xnHgj","schema-content-matrix-row":"kne-form-creator_fFwMK","schema-content-matrix-row-label":"kne-form-creator_W09sG","schema-content-matrix-cell":"kne-form-creator_T3bcF","is-cells":"kne-form-creator_buqr3","is-selected":"kne-form-creator_NadyF","is-mobile":"kne-form-creator_LtgJz","schema-content-matrix-mobile-row":"kne-form-creator_MCWtM","schema-content-matrix-mobile-label":"kne-form-creator_CSjHH","schema-content-matrix-mobile-value":"kne-form-creator_qtvEn","schema-content-matrix-mobile-cell":"kne-form-creator_G-a37","schema-content-matrix-mobile-cell-label":"kne-form-creator_Mjuwi","schema-content-steps":"kne-form-creator_WUBdi","schema-content-step":"kne-form-creator_WJ8b8","schema-content-step-body":"kne-form-creator_JH8KR","schema-content-step-subtitle":"kne-form-creator_jfPgO","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-
|
|
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-list-items":"kne-form-creator_Xpl6K","_":"kne-form-creator_jWWXR","schema-content-list-item":"kne-form-creator_dBG5B","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","schema-content-matrix":"kne-form-creator_Wj4Oi","schema-content-matrix-inner":"kne-form-creator_g0-ex","schema-content-matrix-header":"kne-form-creator_6Ew-1","schema-content-matrix-row-title":"kne-form-creator_QQ9-w","schema-content-matrix-option-title":"kne-form-creator_OuEl1","is-choice":"kne-form-creator_xnHgj","schema-content-matrix-row":"kne-form-creator_fFwMK","schema-content-matrix-row-label":"kne-form-creator_W09sG","schema-content-matrix-cell":"kne-form-creator_T3bcF","is-cells":"kne-form-creator_buqr3","is-selected":"kne-form-creator_NadyF","is-mobile":"kne-form-creator_LtgJz","schema-content-matrix-mobile-row":"kne-form-creator_MCWtM","schema-content-matrix-mobile-label":"kne-form-creator_CSjHH","schema-content-matrix-mobile-value":"kne-form-creator_qtvEn","schema-content-matrix-mobile-cell":"kne-form-creator_G-a37","schema-content-matrix-mobile-cell-label":"kne-form-creator_Mjuwi","schema-content-steps":"kne-form-creator_WUBdi","schema-content-step":"kne-form-creator_WJ8b8","schema-content-step-body":"kne-form-creator_JH8KR","schema-content-step-subtitle":"kne-form-creator_jfPgO","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-span-input":"kne-form-creator_7flo9","matrix-scale-min-input":"kne-form-creator_iZaOM","matrix-scale-input-affix":"kne-form-creator_5ROXL","matrix-scale-options-row":"kne-form-creator_HRx5W","options-list":"kne-form-creator_GUBNS","icon-square-btn-sm":"kne-form-creator_GAh-t","has-column-layout":"kne-form-creator_f4F8Q","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-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","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","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"};
|
|
22
22
|
|
|
23
23
|
function _extends() {
|
|
24
24
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -140,15 +140,15 @@ const locale$1 = {
|
|
|
140
140
|
multiFieldEditorHint: '同类多值模块会根据你选择的填写项类型,自动生成可增减的多个输入框。',
|
|
141
141
|
matrixScaleRowTitle: '行标题列名',
|
|
142
142
|
matrixScaleRowTitlePlaceholder: '例如:活动',
|
|
143
|
-
|
|
143
|
+
matrixScaleRowTitleWidth: '问题列最小宽度(px)',
|
|
144
144
|
matrixScaleLayout_options: '选项矩阵',
|
|
145
145
|
matrixScaleLayout_columns: '单元格矩阵',
|
|
146
146
|
matrixScaleLayout_field: '每行一个字段',
|
|
147
147
|
matrixScaleRequired: '每行(每格)必填',
|
|
148
148
|
matrixScaleSummary: '{type} · {layout} · {rows} 行',
|
|
149
|
-
matrixScaleEditorHint_options: '
|
|
150
|
-
matrixScaleEditorHint_columns: '
|
|
151
|
-
matrixScaleEditorHint_field: '
|
|
149
|
+
matrixScaleEditorHint_options: '填写项为单选/多选:量表选项即表头各列,每行选一个(或多个)。',
|
|
150
|
+
matrixScaleEditorHint_columns: '每个格子是一个填写项;删光列则变为每行一个填写项。',
|
|
151
|
+
matrixScaleEditorHint_field: '当前每行一个填写项;添加列后变为每格一个填写项。',
|
|
152
152
|
matrixScaleRowsTitle: '行配置',
|
|
153
153
|
matrixScaleRowsHint: '左侧为行标题,右侧为保存用的名称',
|
|
154
154
|
matrixScaleRowLabelPlaceholder: '例如:工作/学习',
|
|
@@ -156,9 +156,17 @@ const locale$1 = {
|
|
|
156
156
|
matrixScaleOptionsTitle: '量表选项(列)',
|
|
157
157
|
matrixScaleColumnsTitle: '列配置',
|
|
158
158
|
matrixScaleColumnsHint: '左侧为列标题,右侧为保存用的名称',
|
|
159
|
+
matrixScaleColumnLayoutHint: '「比例」控制相对宽度(如 1:2:1);「最小宽」为该列最小宽度(单位 px,可选);横向滚动时行标题列固定并带阴影',
|
|
160
|
+
matrixScaleColumnSpan: '列显示比例',
|
|
161
|
+
matrixScaleColumnSpanShort: '比例',
|
|
162
|
+
matrixScaleColumnMin: '列最小宽度',
|
|
163
|
+
matrixScaleColumnMinShort: '最小宽',
|
|
164
|
+
matrixScaleColumnMinUnit: 'px',
|
|
159
165
|
matrixScaleColumnLabelPlaceholder: '例如:周一',
|
|
160
166
|
matrixScaleColumnNamePlaceholder: '例如:mon',
|
|
161
167
|
matrixScaleAddRow: '添加一行',
|
|
168
|
+
matrixScaleAddColumn: '添加一列',
|
|
169
|
+
matrixScaleColumnsOptionalHint: '可选;「比例」控制相对宽度,「最小宽」单位为 px',
|
|
162
170
|
stepListTitle: '步骤列表',
|
|
163
171
|
addStep: '添加步骤',
|
|
164
172
|
editStep: '编辑步骤',
|
|
@@ -502,15 +510,15 @@ const locale = {
|
|
|
502
510
|
multiFieldEditorHint: 'This section auto-generates repeatable inputs based on the field type you choose.',
|
|
503
511
|
matrixScaleRowTitle: 'Row header title',
|
|
504
512
|
matrixScaleRowTitlePlaceholder: 'e.g. Activity',
|
|
505
|
-
|
|
513
|
+
matrixScaleRowTitleWidth: 'Question column min width (px)',
|
|
506
514
|
matrixScaleLayout_options: 'Option matrix',
|
|
507
515
|
matrixScaleLayout_columns: 'Cell matrix',
|
|
508
516
|
matrixScaleLayout_field: 'One field per row',
|
|
509
517
|
matrixScaleRequired: 'Required for each row/cell',
|
|
510
518
|
matrixScaleSummary: '{type} · {layout} · {rows} rows',
|
|
511
|
-
matrixScaleEditorHint_options: '
|
|
512
|
-
matrixScaleEditorHint_columns: '
|
|
513
|
-
matrixScaleEditorHint_field: '
|
|
519
|
+
matrixScaleEditorHint_options: 'Field type is radio/checkbox: scale options become the header columns.',
|
|
520
|
+
matrixScaleEditorHint_columns: 'Each cell is one field; remove all columns to get one field per row.',
|
|
521
|
+
matrixScaleEditorHint_field: 'One field per row; add columns to get one field per cell.',
|
|
514
522
|
matrixScaleRowsTitle: 'Rows',
|
|
515
523
|
matrixScaleRowsHint: 'Left is the row label; right is the data key',
|
|
516
524
|
matrixScaleRowLabelPlaceholder: 'e.g. Work / Study',
|
|
@@ -518,9 +526,17 @@ const locale = {
|
|
|
518
526
|
matrixScaleOptionsTitle: 'Scale options (columns)',
|
|
519
527
|
matrixScaleColumnsTitle: 'Columns',
|
|
520
528
|
matrixScaleColumnsHint: 'Left is the column label; right is the data key',
|
|
529
|
+
matrixScaleColumnLayoutHint: '“Span” sets relative width (e.g. 1:2:1); “Min width” is optional, unit px; row title stays sticky with a scroll shadow',
|
|
530
|
+
matrixScaleColumnSpan: 'Column span ratio',
|
|
531
|
+
matrixScaleColumnSpanShort: 'Span',
|
|
532
|
+
matrixScaleColumnMin: 'Column min width',
|
|
533
|
+
matrixScaleColumnMinShort: 'Min width',
|
|
534
|
+
matrixScaleColumnMinUnit: 'px',
|
|
521
535
|
matrixScaleColumnLabelPlaceholder: 'e.g. Monday',
|
|
522
536
|
matrixScaleColumnNamePlaceholder: 'e.g. mon',
|
|
523
537
|
matrixScaleAddRow: 'Add row',
|
|
538
|
+
matrixScaleAddColumn: 'Add column',
|
|
539
|
+
matrixScaleColumnsOptionalHint: 'Optional; “Span” sets relative width, “Min width” unit is px',
|
|
524
540
|
stepListTitle: 'Steps',
|
|
525
541
|
addStep: 'Add Step',
|
|
526
542
|
editStep: 'Edit Step',
|
|
@@ -895,6 +911,49 @@ const createEmptyColumn = () => ({
|
|
|
895
911
|
name: createDataKey('col'),
|
|
896
912
|
width: undefined
|
|
897
913
|
});
|
|
914
|
+
|
|
915
|
+
/** 选项作为矩阵列的填写项类型(RadioGroup/CheckboxGroup 在 MatrixScale 里隐藏选项文案,只留圆点/方框) */
|
|
916
|
+
const MATRIX_CHOICE_FIELD_TYPES = ['RadioGroup', 'CheckboxGroup'];
|
|
917
|
+
const hasMatrixColumns = columns => Array.isArray(columns) && columns.some(column => column && String(column.name || '').trim());
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* 矩阵结构由填写项类型推断,不单独配置:
|
|
921
|
+
* - 单选/多选 → options(选项作列)
|
|
922
|
+
* - 其他类型且配了列 → columns(每格一个填写项)
|
|
923
|
+
* - 其他类型未配列 → field(每行一个填写项)
|
|
924
|
+
*/
|
|
925
|
+
const resolveMatrixLayout = block => {
|
|
926
|
+
if (MATRIX_CHOICE_FIELD_TYPES.includes((block == null ? void 0 : block.fieldType) || 'RadioGroup')) {
|
|
927
|
+
return 'options';
|
|
928
|
+
}
|
|
929
|
+
return hasMatrixColumns(block == null ? void 0 : block.columns) ? 'columns' : 'field';
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
/** 矩阵列/选项显示比例(span,兼容 ratio);默认 1 不落盘。可选 width 定宽 */
|
|
933
|
+
const pickMatrixColumnLayout = item => {
|
|
934
|
+
var _item$span;
|
|
935
|
+
const layout = {};
|
|
936
|
+
if ((item == null ? void 0 : item.width) != null && item.width !== '') {
|
|
937
|
+
const width = Number(item.width);
|
|
938
|
+
if (!Number.isNaN(width) && width > 0) {
|
|
939
|
+
layout.width = width;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
const spanRaw = (_item$span = item == null ? void 0 : item.span) != null ? _item$span : item == null ? void 0 : item.ratio;
|
|
943
|
+
if (spanRaw != null && spanRaw !== '' && Number(spanRaw) !== 1) {
|
|
944
|
+
const span = Number(spanRaw);
|
|
945
|
+
if (!Number.isNaN(span) && span > 0) {
|
|
946
|
+
layout.span = span;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
if ((item == null ? void 0 : item.min) != null && item.min !== '' && layout.width == null) {
|
|
950
|
+
const min = Number(item.min);
|
|
951
|
+
if (!Number.isNaN(min) && min > 0) {
|
|
952
|
+
layout.min = min;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
return layout;
|
|
956
|
+
};
|
|
898
957
|
const defaultSchema = () => ({
|
|
899
958
|
title: '',
|
|
900
959
|
subtitle: '',
|
|
@@ -1033,7 +1092,7 @@ const createBlock = (kind, overrides = {}) => {
|
|
|
1033
1092
|
label: '',
|
|
1034
1093
|
value: ''
|
|
1035
1094
|
}],
|
|
1036
|
-
columns:
|
|
1095
|
+
columns: []
|
|
1037
1096
|
}, overrides);
|
|
1038
1097
|
}
|
|
1039
1098
|
if (kind === 'choice') {
|
|
@@ -1153,14 +1212,18 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
1153
1212
|
return normalized;
|
|
1154
1213
|
}
|
|
1155
1214
|
if (kind === 'matrixScale') {
|
|
1156
|
-
const layout = block.layout === 'columns' || block.layout === 'field' ? block.layout : 'options';
|
|
1157
1215
|
normalized.list = undefined;
|
|
1158
1216
|
normalized.items = undefined;
|
|
1159
1217
|
normalized.itemBlocks = undefined;
|
|
1160
1218
|
normalized.blocks = undefined;
|
|
1161
|
-
normalized.layout = layout;
|
|
1162
1219
|
normalized.fieldType = block.fieldType || 'RadioGroup';
|
|
1163
1220
|
normalized.rowTitle = block.rowTitle != null ? block.rowTitle : '';
|
|
1221
|
+
const rowTitleWidth = block.rowTitleWidth != null && block.rowTitleWidth !== '' ? Number(block.rowTitleWidth) : undefined;
|
|
1222
|
+
if (rowTitleWidth && rowTitleWidth !== 160) {
|
|
1223
|
+
normalized.rowTitleWidth = rowTitleWidth;
|
|
1224
|
+
} else {
|
|
1225
|
+
delete normalized.rowTitleWidth;
|
|
1226
|
+
}
|
|
1164
1227
|
normalized.rule = block.rule != null ? block.rule : '';
|
|
1165
1228
|
// 保留编辑器侧的 _key:MatrixScaleEditor 用它做行 key;normalize 若剥掉会触发 ensureKeys→onChange 死循环(React #185)
|
|
1166
1229
|
const keepKey = item => item != null && item._key ? {
|
|
@@ -1179,33 +1242,27 @@ const normalizeBlock = (block, depth = 0) => {
|
|
|
1179
1242
|
name: createDataKey('row')
|
|
1180
1243
|
}];
|
|
1181
1244
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
}];
|
|
1204
|
-
}
|
|
1205
|
-
normalized.options = undefined;
|
|
1206
|
-
} else {
|
|
1207
|
-
normalized.options = undefined;
|
|
1208
|
-
normalized.columns = undefined;
|
|
1245
|
+
// options / columns 都保留:切换填写项类型时不丢另一边已填的配置
|
|
1246
|
+
normalized.options = Array.isArray(block.options) ? block.options.map(option => {
|
|
1247
|
+
var _option$label, _option$value;
|
|
1248
|
+
return _extends({}, keepKey(option), {
|
|
1249
|
+
label: (_option$label = option == null ? void 0 : option.label) != null ? _option$label : '',
|
|
1250
|
+
value: (_option$value = option == null ? void 0 : option.value) != null ? _option$value : ''
|
|
1251
|
+
}, pickMatrixColumnLayout(option));
|
|
1252
|
+
}) : [];
|
|
1253
|
+
normalized.columns = Array.isArray(block.columns) ? block.columns.map(column => {
|
|
1254
|
+
var _ref, _column$label;
|
|
1255
|
+
return _extends({}, keepKey(column), {
|
|
1256
|
+
label: (_ref = (_column$label = column == null ? void 0 : column.label) != null ? _column$label : column == null ? void 0 : column.title) != null ? _ref : '',
|
|
1257
|
+
name: String((column == null ? void 0 : column.name) || '').trim() || createDataKey('col')
|
|
1258
|
+
}, pickMatrixColumnLayout(column));
|
|
1259
|
+
}) : [];
|
|
1260
|
+
normalized.layout = resolveMatrixLayout(normalized);
|
|
1261
|
+
if (normalized.layout === 'options' && !normalized.options.length) {
|
|
1262
|
+
normalized.options = [{
|
|
1263
|
+
label: '',
|
|
1264
|
+
value: ''
|
|
1265
|
+
}];
|
|
1209
1266
|
}
|
|
1210
1267
|
return normalized;
|
|
1211
1268
|
}
|
|
@@ -1724,9 +1781,6 @@ const BLOCK_KINDS = {
|
|
|
1724
1781
|
/** editableList 添加按钮位置,与 @kne/form-info EditableList addPosition 一致 */
|
|
1725
1782
|
const ADD_POSITIONS = ['bottom', 'top', 'both'];
|
|
1726
1783
|
|
|
1727
|
-
/** matrixScale 布局:options 选项组矩阵 / columns 单元格矩阵 / field 每行一个字段 */
|
|
1728
|
-
const MATRIX_LAYOUTS = ['options', 'columns', 'field'];
|
|
1729
|
-
|
|
1730
1784
|
/** steps 导航样式:default 为 antd 完整步骤条;focus 突出当前步骤标题,其余收成序号 */
|
|
1731
1785
|
const STEPS_STYLES = ['default', 'focus'];
|
|
1732
1786
|
const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([value, config]) => ({
|
|
@@ -1737,7 +1791,7 @@ const getBlockKindOptions = formatMessage => Object.entries(BLOCK_KINDS).map(([v
|
|
|
1737
1791
|
}));
|
|
1738
1792
|
const getBlockDefinition = kind => BLOCK_KINDS[kind];
|
|
1739
1793
|
const blockToFormValues = block => {
|
|
1740
|
-
var _block$column, _block$gap, _block$maxLength, _block$minLength;
|
|
1794
|
+
var _block$column, _block$gap, _block$maxLength, _block$minLength, _block$rowTitleWidth;
|
|
1741
1795
|
return {
|
|
1742
1796
|
kind: block.kind,
|
|
1743
1797
|
title: block.title || '',
|
|
@@ -1754,8 +1808,8 @@ const blockToFormValues = block => {
|
|
|
1754
1808
|
minLength: (_block$minLength = block.minLength) != null ? _block$minLength : null,
|
|
1755
1809
|
addPosition: ADD_POSITIONS.includes(block.addPosition) ? block.addPosition : 'bottom',
|
|
1756
1810
|
fieldType: block.fieldType || (block.kind === 'matrixScale' ? 'RadioGroup' : 'Input'),
|
|
1757
|
-
layout: MATRIX_LAYOUTS.includes(block.layout) ? block.layout : 'options',
|
|
1758
1811
|
rowTitle: block.rowTitle || '',
|
|
1812
|
+
rowTitleWidth: (_block$rowTitleWidth = block.rowTitleWidth) != null ? _block$rowTitleWidth : null,
|
|
1759
1813
|
required: typeof block.rule === 'string' && block.rule.split(' ').includes('REQ'),
|
|
1760
1814
|
autoStep: block.autoStep !== false,
|
|
1761
1815
|
stepsStyle: STEPS_STYLES.includes(block.stepsStyle) ? block.stepsStyle : 'default',
|
|
@@ -1791,29 +1845,21 @@ const formValuesToBlock = (values, existingBlock = {}) => {
|
|
|
1791
1845
|
selectorInData: values.selectorInData !== false
|
|
1792
1846
|
});
|
|
1793
1847
|
if (kind === 'matrixScale') {
|
|
1794
|
-
const layout = MATRIX_LAYOUTS.includes(values.layout) ? values.layout : 'options';
|
|
1795
|
-
next.layout = layout;
|
|
1796
1848
|
next.rowTitle = values.rowTitle || undefined;
|
|
1849
|
+
next.rowTitleWidth = values.rowTitleWidth != null && values.rowTitleWidth !== '' ? Number(values.rowTitleWidth) : undefined;
|
|
1850
|
+
if (next.rowTitleWidth === 160 || !next.rowTitleWidth) {
|
|
1851
|
+
delete next.rowTitleWidth;
|
|
1852
|
+
}
|
|
1797
1853
|
next.rule = values.required ? 'REQ' : undefined;
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
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;
|
|
1854
|
+
// 不清空 options / columns:切回原类型时配置还在
|
|
1855
|
+
next.options = Array.isArray(next.options) ? next.options : [];
|
|
1856
|
+
next.columns = Array.isArray(next.columns) ? next.columns : [];
|
|
1857
|
+
next.layout = resolveMatrixLayout(next);
|
|
1858
|
+
if (next.layout === 'options' && !next.options.length) {
|
|
1859
|
+
next.options = [{
|
|
1860
|
+
label: '',
|
|
1861
|
+
value: ''
|
|
1862
|
+
}];
|
|
1817
1863
|
}
|
|
1818
1864
|
if (!Array.isArray(next.rows) || !next.rows.length) {
|
|
1819
1865
|
next.rows = [{
|
|
@@ -3904,17 +3950,35 @@ const createEmptyMatrixRow = () => ({
|
|
|
3904
3950
|
const createEmptyMatrixColumn = () => ({
|
|
3905
3951
|
_key: createColKey(),
|
|
3906
3952
|
label: '',
|
|
3907
|
-
name: createDataKey('col')
|
|
3953
|
+
name: createDataKey('col'),
|
|
3954
|
+
span: 1
|
|
3908
3955
|
});
|
|
3909
3956
|
const createEmptyMatrixOption = () => ({
|
|
3910
3957
|
_key: createOptKey(),
|
|
3911
3958
|
label: '',
|
|
3912
|
-
value: ''
|
|
3959
|
+
value: '',
|
|
3960
|
+
span: 1
|
|
3913
3961
|
});
|
|
3914
3962
|
const ensureKeys = (list = [], createKey) => list.map(item => _extends({}, item, {
|
|
3915
3963
|
_key: item._key || createKey()
|
|
3916
3964
|
}));
|
|
3917
3965
|
const hasMissingKey = (list = []) => list.some(item => !(item != null && item._key));
|
|
3966
|
+
const getItemSpan = item => {
|
|
3967
|
+
var _item$span;
|
|
3968
|
+
const raw = (_item$span = item == null ? void 0 : item.span) != null ? _item$span : item == null ? void 0 : item.ratio;
|
|
3969
|
+
if (raw == null || raw === '') {
|
|
3970
|
+
return 1;
|
|
3971
|
+
}
|
|
3972
|
+
const n = Number(raw);
|
|
3973
|
+
return !Number.isNaN(n) && n > 0 ? n : 1;
|
|
3974
|
+
};
|
|
3975
|
+
const getItemMin = item => {
|
|
3976
|
+
if ((item == null ? void 0 : item.min) == null || item.min === '') {
|
|
3977
|
+
return null;
|
|
3978
|
+
}
|
|
3979
|
+
const n = Number(item.min);
|
|
3980
|
+
return !Number.isNaN(n) && n > 0 ? n : null;
|
|
3981
|
+
};
|
|
3918
3982
|
|
|
3919
3983
|
/** 勿在此用 FormInfo:模块列不在 Form 内,FormInfo→FieldList 会读不到 openApiRef */
|
|
3920
3984
|
const EditorSection = ({
|
|
@@ -3933,6 +3997,59 @@ const EditorSection = ({
|
|
|
3933
3997
|
children: tip
|
|
3934
3998
|
}) : null]
|
|
3935
3999
|
});
|
|
4000
|
+
|
|
4001
|
+
/** 列比例 + 最小宽:与 table-view 一致,写入 span / min */
|
|
4002
|
+
const ColumnLayoutInputs = ({
|
|
4003
|
+
item,
|
|
4004
|
+
onPatch,
|
|
4005
|
+
formatMessage
|
|
4006
|
+
}) => /*#__PURE__*/jsxs(Fragment, {
|
|
4007
|
+
children: [/*#__PURE__*/jsx(InputNumber$1, {
|
|
4008
|
+
className: style['matrix-scale-span-input'],
|
|
4009
|
+
min: 1,
|
|
4010
|
+
max: 24,
|
|
4011
|
+
precision: 0,
|
|
4012
|
+
value: getItemSpan(item),
|
|
4013
|
+
prefix: /*#__PURE__*/jsx("span", {
|
|
4014
|
+
className: style['matrix-scale-input-affix'],
|
|
4015
|
+
children: formatMessage({
|
|
4016
|
+
id: 'matrixScaleColumnSpanShort'
|
|
4017
|
+
})
|
|
4018
|
+
}),
|
|
4019
|
+
title: formatMessage({
|
|
4020
|
+
id: 'matrixScaleColumnSpan'
|
|
4021
|
+
}),
|
|
4022
|
+
onChange: value => onPatch({
|
|
4023
|
+
span: value == null || value < 1 ? 1 : value,
|
|
4024
|
+
ratio: undefined
|
|
4025
|
+
})
|
|
4026
|
+
}), /*#__PURE__*/jsx(InputNumber$1, {
|
|
4027
|
+
className: style['matrix-scale-min-input'],
|
|
4028
|
+
min: 40,
|
|
4029
|
+
max: 800,
|
|
4030
|
+
precision: 0,
|
|
4031
|
+
value: getItemMin(item),
|
|
4032
|
+
prefix: /*#__PURE__*/jsx("span", {
|
|
4033
|
+
className: style['matrix-scale-input-affix'],
|
|
4034
|
+
children: formatMessage({
|
|
4035
|
+
id: 'matrixScaleColumnMinShort'
|
|
4036
|
+
})
|
|
4037
|
+
}),
|
|
4038
|
+
suffix: /*#__PURE__*/jsx("span", {
|
|
4039
|
+
className: style['matrix-scale-input-affix'],
|
|
4040
|
+
children: formatMessage({
|
|
4041
|
+
id: 'matrixScaleColumnMinUnit'
|
|
4042
|
+
})
|
|
4043
|
+
}),
|
|
4044
|
+
title: formatMessage({
|
|
4045
|
+
id: 'matrixScaleColumnMin'
|
|
4046
|
+
}),
|
|
4047
|
+
placeholder: "\u2014",
|
|
4048
|
+
onChange: value => onPatch({
|
|
4049
|
+
min: value == null || value < 1 ? undefined : value
|
|
4050
|
+
})
|
|
4051
|
+
})]
|
|
4052
|
+
});
|
|
3936
4053
|
const LabelNameRows = ({
|
|
3937
4054
|
title,
|
|
3938
4055
|
tip,
|
|
@@ -3942,18 +4059,24 @@ const LabelNameRows = ({
|
|
|
3942
4059
|
createKey,
|
|
3943
4060
|
labelPlaceholder,
|
|
3944
4061
|
namePlaceholder,
|
|
3945
|
-
addText
|
|
4062
|
+
addText,
|
|
4063
|
+
withColumnLayout,
|
|
4064
|
+
allowEmpty
|
|
3946
4065
|
}) => {
|
|
3947
|
-
|
|
4066
|
+
const {
|
|
4067
|
+
formatMessage
|
|
4068
|
+
} = useIntl();
|
|
3948
4069
|
useEffect(() => {
|
|
3949
4070
|
if (!list.length) {
|
|
3950
|
-
|
|
4071
|
+
if (!allowEmpty) {
|
|
4072
|
+
onChange([createEmpty()]);
|
|
4073
|
+
}
|
|
3951
4074
|
return;
|
|
3952
4075
|
}
|
|
3953
4076
|
if (hasMissingKey(list)) {
|
|
3954
4077
|
onChange(ensureKeys(list, createKey));
|
|
3955
4078
|
}
|
|
3956
|
-
}, [list, onChange, createEmpty, createKey]);
|
|
4079
|
+
}, [list, onChange, createEmpty, createKey, allowEmpty]);
|
|
3957
4080
|
const rows = list.length ? list : [];
|
|
3958
4081
|
const updateItem = (index, patch) => {
|
|
3959
4082
|
onChange(rows.map((item, itemIndex) => itemIndex === index ? _extends({}, item, patch) : item));
|
|
@@ -3965,8 +4088,9 @@ const LabelNameRows = ({
|
|
|
3965
4088
|
className: style['options-list'],
|
|
3966
4089
|
children: rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
3967
4090
|
gap: 8,
|
|
4091
|
+
wrap: "wrap",
|
|
3968
4092
|
align: "start",
|
|
3969
|
-
className: style['options-row'],
|
|
4093
|
+
className: [style['options-row'], style['matrix-scale-options-row'], withColumnLayout ? style['has-column-layout'] : null].filter(Boolean).join(' '),
|
|
3970
4094
|
children: [/*#__PURE__*/jsx(Input$1, {
|
|
3971
4095
|
value: item.label || '',
|
|
3972
4096
|
placeholder: labelPlaceholder,
|
|
@@ -3979,15 +4103,19 @@ const LabelNameRows = ({
|
|
|
3979
4103
|
onChange: e => updateItem(index, {
|
|
3980
4104
|
name: e.target.value
|
|
3981
4105
|
})
|
|
3982
|
-
}), /*#__PURE__*/jsx(
|
|
4106
|
+
}), withColumnLayout ? /*#__PURE__*/jsx(ColumnLayoutInputs, {
|
|
4107
|
+
item: item,
|
|
4108
|
+
onPatch: patch => updateItem(index, patch),
|
|
4109
|
+
formatMessage: formatMessage
|
|
4110
|
+
}) : null, /*#__PURE__*/jsx(Button, {
|
|
3983
4111
|
type: "text",
|
|
3984
4112
|
danger: true,
|
|
3985
4113
|
className: style['icon-square-btn-sm'],
|
|
3986
4114
|
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
3987
|
-
disabled: rows.length <= 1,
|
|
4115
|
+
disabled: !allowEmpty && rows.length <= 1,
|
|
3988
4116
|
onClick: () => {
|
|
3989
4117
|
const next = rows.filter((_, i) => i !== index);
|
|
3990
|
-
onChange(next.length ? next : [createEmpty()]);
|
|
4118
|
+
onChange(next.length || allowEmpty ? next : [createEmpty()]);
|
|
3991
4119
|
}
|
|
3992
4120
|
})]
|
|
3993
4121
|
}, item._key || `row-${index}`))
|
|
@@ -4024,12 +4152,16 @@ const MatrixOptionsEditor = ({
|
|
|
4024
4152
|
title: formatMessage({
|
|
4025
4153
|
id: 'matrixScaleOptionsTitle'
|
|
4026
4154
|
}),
|
|
4155
|
+
tip: formatMessage({
|
|
4156
|
+
id: 'matrixScaleColumnLayoutHint'
|
|
4157
|
+
}),
|
|
4027
4158
|
children: [/*#__PURE__*/jsx("div", {
|
|
4028
4159
|
className: style['options-list'],
|
|
4029
4160
|
children: rows.map((item, index) => /*#__PURE__*/jsxs(Flex, {
|
|
4030
4161
|
gap: 8,
|
|
4162
|
+
wrap: "wrap",
|
|
4031
4163
|
align: "start",
|
|
4032
|
-
className: style['options-row']
|
|
4164
|
+
className: `${style['options-row']} ${style['matrix-scale-options-row']} ${style['has-column-layout']}`,
|
|
4033
4165
|
children: [/*#__PURE__*/jsx(Input$1, {
|
|
4034
4166
|
value: item.label || '',
|
|
4035
4167
|
placeholder: formatMessage({
|
|
@@ -4053,6 +4185,10 @@ const MatrixOptionsEditor = ({
|
|
|
4053
4185
|
onChange: e => updateItem(index, {
|
|
4054
4186
|
value: e.target.value
|
|
4055
4187
|
})
|
|
4188
|
+
}), /*#__PURE__*/jsx(ColumnLayoutInputs, {
|
|
4189
|
+
item: item,
|
|
4190
|
+
onPatch: patch => updateItem(index, patch),
|
|
4191
|
+
formatMessage: formatMessage
|
|
4056
4192
|
}), /*#__PURE__*/jsx(Button, {
|
|
4057
4193
|
type: "text",
|
|
4058
4194
|
danger: true,
|
|
@@ -4083,13 +4219,11 @@ const MatrixScaleEditor = ({
|
|
|
4083
4219
|
const {
|
|
4084
4220
|
formatMessage
|
|
4085
4221
|
} = useIntl();
|
|
4086
|
-
const layout = block
|
|
4222
|
+
const layout = resolveMatrixLayout(block);
|
|
4087
4223
|
const blockRef = useRef(block);
|
|
4088
4224
|
blockRef.current = block;
|
|
4089
4225
|
const onChangeRef = useRef(onChange);
|
|
4090
4226
|
onChangeRef.current = onChange;
|
|
4091
|
-
|
|
4092
|
-
// 用 ref 保持回调稳定,避免输入时子组件 useEffect 反复触发
|
|
4093
4227
|
const handleRowsChange = useCallback(rows => onChangeRef.current(_extends({}, blockRef.current, {
|
|
4094
4228
|
rows
|
|
4095
4229
|
})), []);
|
|
@@ -4130,12 +4264,12 @@ const MatrixScaleEditor = ({
|
|
|
4130
4264
|
}), layout === 'options' ? /*#__PURE__*/jsx(MatrixOptionsEditor, {
|
|
4131
4265
|
value: block.options || [],
|
|
4132
4266
|
onChange: handleOptionsChange
|
|
4133
|
-
}) :
|
|
4267
|
+
}) : /*#__PURE__*/jsx(LabelNameRows, {
|
|
4134
4268
|
title: formatMessage({
|
|
4135
4269
|
id: 'matrixScaleColumnsTitle'
|
|
4136
4270
|
}),
|
|
4137
4271
|
tip: formatMessage({
|
|
4138
|
-
id: '
|
|
4272
|
+
id: 'matrixScaleColumnsOptionalHint'
|
|
4139
4273
|
}),
|
|
4140
4274
|
list: block.columns || [],
|
|
4141
4275
|
onChange: handleColumnsChange,
|
|
@@ -4148,9 +4282,11 @@ const MatrixScaleEditor = ({
|
|
|
4148
4282
|
id: 'matrixScaleColumnNamePlaceholder'
|
|
4149
4283
|
}),
|
|
4150
4284
|
addText: formatMessage({
|
|
4151
|
-
id: '
|
|
4152
|
-
})
|
|
4153
|
-
|
|
4285
|
+
id: 'matrixScaleAddColumn'
|
|
4286
|
+
}),
|
|
4287
|
+
withColumnLayout: true,
|
|
4288
|
+
allowEmpty: true
|
|
4289
|
+
})]
|
|
4154
4290
|
});
|
|
4155
4291
|
};
|
|
4156
4292
|
var MatrixScaleEditor$1 = MatrixScaleEditor;
|
|
@@ -4813,7 +4949,7 @@ const BlockListPanel = ({
|
|
|
4813
4949
|
const supportsBlocks = block.kind === 'formInfo' || block.kind === 'object';
|
|
4814
4950
|
const supportsChildModules = supportsItemBlocks$1 || supportsBlocks;
|
|
4815
4951
|
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;
|
|
4816
|
-
const matrixLayout = block
|
|
4952
|
+
const matrixLayout = resolveMatrixLayout(block);
|
|
4817
4953
|
const summary = block.kind === 'steps' ? formatMessage({
|
|
4818
4954
|
id: 'stepCount'
|
|
4819
4955
|
}, {
|
|
@@ -5263,26 +5399,22 @@ const BlockConfigFields = ({
|
|
|
5263
5399
|
placeholder: formatMessage({
|
|
5264
5400
|
id: 'matrixScaleRowTitlePlaceholder'
|
|
5265
5401
|
})
|
|
5266
|
-
}, "rowTitle"),
|
|
5402
|
+
}, "rowTitle"), /*#__PURE__*/jsx(InputNumber, {
|
|
5403
|
+
name: "rowTitleWidth",
|
|
5404
|
+
label: formatMessage({
|
|
5405
|
+
id: 'matrixScaleRowTitleWidth'
|
|
5406
|
+
}),
|
|
5407
|
+
min: 80,
|
|
5408
|
+
max: 640,
|
|
5409
|
+
placeholder: "160"
|
|
5410
|
+
}, "rowTitleWidth"), fieldTypeSelect);
|
|
5267
5411
|
add('rule', /*#__PURE__*/jsx(Checkbox, {
|
|
5268
5412
|
name: "required",
|
|
5269
5413
|
children: formatMessage({
|
|
5270
5414
|
id: 'matrixScaleRequired'
|
|
5271
5415
|
})
|
|
5272
5416
|
}, "required"));
|
|
5273
|
-
add('layout',
|
|
5274
|
-
name: "layout",
|
|
5275
|
-
label: formatMessage({
|
|
5276
|
-
id: 'matrixScaleLayout'
|
|
5277
|
-
}),
|
|
5278
|
-
rule: "REQ",
|
|
5279
|
-
options: MATRIX_LAYOUTS.map(value => ({
|
|
5280
|
-
label: formatMessage({
|
|
5281
|
-
id: `matrixScaleLayout_${value}`
|
|
5282
|
-
}),
|
|
5283
|
-
value
|
|
5284
|
-
}))
|
|
5285
|
-
}, "layout"), borderedCheckbox);
|
|
5417
|
+
add('layout', borderedCheckbox);
|
|
5286
5418
|
}
|
|
5287
5419
|
if (kind === 'steps') {
|
|
5288
5420
|
add('basic', titleInput(), subtitleInput);
|
|
@@ -8601,12 +8733,15 @@ const renderBlockElement = (block, preview = false, ctx = {}) => {
|
|
|
8601
8733
|
if (!FieldComponent) {
|
|
8602
8734
|
return null;
|
|
8603
8735
|
}
|
|
8604
|
-
const layout = block
|
|
8736
|
+
const layout = resolveMatrixLayout(block);
|
|
8605
8737
|
return withBlockLayout(/*#__PURE__*/createElement(MatrixScale, _extends({
|
|
8606
8738
|
key: block.id,
|
|
8607
8739
|
name: block.name,
|
|
8608
8740
|
title: block.title || undefined,
|
|
8609
|
-
rowTitle: block.rowTitle || undefined
|
|
8741
|
+
rowTitle: block.rowTitle || undefined
|
|
8742
|
+
}, block.rowTitleWidth != null && block.rowTitleWidth !== '' ? {
|
|
8743
|
+
rowTitleWidth: block.rowTitleWidth
|
|
8744
|
+
} : null, {
|
|
8610
8745
|
bordered,
|
|
8611
8746
|
field: FieldComponent,
|
|
8612
8747
|
rule: block.rule || undefined,
|
|
@@ -10196,7 +10331,7 @@ const walkBlock = (block, layer, depth = 0, ctx = {}) => {
|
|
|
10196
10331
|
if (!name) {
|
|
10197
10332
|
return;
|
|
10198
10333
|
}
|
|
10199
|
-
const layout = block
|
|
10334
|
+
const layout = resolveMatrixLayout(block);
|
|
10200
10335
|
const fieldType = block.fieldType || 'RadioGroup';
|
|
10201
10336
|
const required = typeof block.rule === 'string' && block.rule.split(' ').includes('REQ');
|
|
10202
10337
|
const properties = {};
|
|
@@ -10402,7 +10537,7 @@ const isMatrixChoiceSelected = (cellValue, optionValue) => {
|
|
|
10402
10537
|
|
|
10403
10538
|
/** 只读矩阵:对齐填写态 MatrixScale 的表头 + 行列网格,而不是摊成普通字段列表 */
|
|
10404
10539
|
const renderMatrixScaleContent = (block, matrixData, formatMessage, isMobile) => {
|
|
10405
|
-
const layout = block
|
|
10540
|
+
const layout = resolveMatrixLayout(block);
|
|
10406
10541
|
const fieldType = block.fieldType || 'RadioGroup';
|
|
10407
10542
|
const rows = (block.rows || []).filter(row => row && row.name != null && String(row.name).trim());
|
|
10408
10543
|
if (!rows.length) {
|
|
@@ -10412,6 +10547,13 @@ const renderMatrixScaleContent = (block, matrixData, formatMessage, isMobile) =>
|
|
|
10412
10547
|
id: 'schemaContentEmptyValue'
|
|
10413
10548
|
});
|
|
10414
10549
|
const rowTitle = block.rowTitle || '';
|
|
10550
|
+
const rowTitleWidthPx = (() => {
|
|
10551
|
+
const n = Number(block.rowTitleWidth);
|
|
10552
|
+
return !Number.isNaN(n) && n > 0 ? n : 160;
|
|
10553
|
+
})();
|
|
10554
|
+
const matrixTitleStyle = {
|
|
10555
|
+
'--matrix-scale-title-width': `${rowTitleWidthPx}px`
|
|
10556
|
+
};
|
|
10415
10557
|
if (layout === 'options') {
|
|
10416
10558
|
const options = (block.options || []).filter(option => option && (option.value != null || option.label != null));
|
|
10417
10559
|
const optionCount = Math.max(options.length, 1);
|
|
@@ -10443,9 +10585,9 @@ const renderMatrixScaleContent = (block, matrixData, formatMessage, isMobile) =>
|
|
|
10443
10585
|
className: [style['schema-content-matrix'], style['is-choice']].join(' '),
|
|
10444
10586
|
children: /*#__PURE__*/jsxs("div", {
|
|
10445
10587
|
className: style['schema-content-matrix-inner'],
|
|
10446
|
-
style: {
|
|
10588
|
+
style: _extends({}, matrixTitleStyle, {
|
|
10447
10589
|
'--matrix-scale-option-count': optionCount
|
|
10448
|
-
},
|
|
10590
|
+
}),
|
|
10449
10591
|
children: [/*#__PURE__*/jsxs("div", {
|
|
10450
10592
|
className: style['schema-content-matrix-header'],
|
|
10451
10593
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -10516,9 +10658,9 @@ const renderMatrixScaleContent = (block, matrixData, formatMessage, isMobile) =>
|
|
|
10516
10658
|
className: style['schema-content-matrix'],
|
|
10517
10659
|
children: /*#__PURE__*/jsxs("div", {
|
|
10518
10660
|
className: style['schema-content-matrix-inner'],
|
|
10519
|
-
style: {
|
|
10661
|
+
style: _extends({}, matrixTitleStyle, {
|
|
10520
10662
|
'--matrix-scale-option-count': optionCount
|
|
10521
|
-
},
|
|
10663
|
+
}),
|
|
10522
10664
|
children: [/*#__PURE__*/jsxs("div", {
|
|
10523
10665
|
className: style['schema-content-matrix-header'],
|
|
10524
10666
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -10570,9 +10712,9 @@ const renderMatrixScaleContent = (block, matrixData, formatMessage, isMobile) =>
|
|
|
10570
10712
|
}, rowName);
|
|
10571
10713
|
}) : /*#__PURE__*/jsxs("div", {
|
|
10572
10714
|
className: style['schema-content-matrix-inner'],
|
|
10573
|
-
style: {
|
|
10715
|
+
style: _extends({}, matrixTitleStyle, {
|
|
10574
10716
|
'--matrix-scale-option-count': 1
|
|
10575
|
-
},
|
|
10717
|
+
}),
|
|
10576
10718
|
children: [rowTitle ? /*#__PURE__*/jsxs("div", {
|
|
10577
10719
|
className: style['schema-content-matrix-header'],
|
|
10578
10720
|
children: [/*#__PURE__*/jsx("div", {
|