lu-lowcode-package-form 0.9.93 → 0.9.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +271 -251
- package/dist/index.es.js +32730 -29157
- package/dist/style.css +1 -1
- package/dist/tinymce/icons/default/icons.min.js +1 -0
- package/dist/tinymce/langs/README.md +3 -0
- package/dist/tinymce/license.md +6 -0
- package/dist/tinymce/models/dom/model.min.js +4 -0
- package/dist/tinymce/plugins/accordion/plugin.min.js +4 -0
- package/dist/tinymce/plugins/advlist/plugin.min.js +4 -0
- package/dist/tinymce/plugins/anchor/plugin.min.js +4 -0
- package/dist/tinymce/plugins/autolink/plugin.min.js +4 -0
- package/dist/tinymce/plugins/autoresize/plugin.min.js +4 -0
- package/dist/tinymce/plugins/autosave/plugin.min.js +4 -0
- package/dist/tinymce/plugins/charmap/plugin.min.js +4 -0
- package/dist/tinymce/plugins/code/plugin.min.js +4 -0
- package/dist/tinymce/plugins/codesample/plugin.min.js +4 -0
- package/dist/tinymce/plugins/directionality/plugin.min.js +4 -0
- package/dist/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
- package/dist/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
- package/dist/tinymce/plugins/emoticons/js/emojis.js +1 -0
- package/dist/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
- package/dist/tinymce/plugins/emoticons/plugin.min.js +4 -0
- package/dist/tinymce/plugins/fullscreen/plugin.min.js +4 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
- package/dist/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
- package/dist/tinymce/plugins/help/plugin.min.js +4 -0
- package/dist/tinymce/plugins/image/plugin.min.js +4 -0
- package/dist/tinymce/plugins/importcss/plugin.min.js +4 -0
- package/dist/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
- package/dist/tinymce/plugins/link/plugin.min.js +4 -0
- package/dist/tinymce/plugins/lists/plugin.min.js +4 -0
- package/dist/tinymce/plugins/media/plugin.min.js +4 -0
- package/dist/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
- package/dist/tinymce/plugins/pagebreak/plugin.min.js +4 -0
- package/dist/tinymce/plugins/preview/plugin.min.js +4 -0
- package/dist/tinymce/plugins/quickbars/plugin.min.js +4 -0
- package/dist/tinymce/plugins/save/plugin.min.js +4 -0
- package/dist/tinymce/plugins/searchreplace/plugin.min.js +4 -0
- package/dist/tinymce/plugins/table/plugin.min.js +4 -0
- package/dist/tinymce/plugins/visualblocks/plugin.min.js +4 -0
- package/dist/tinymce/plugins/visualchars/plugin.min.js +4 -0
- package/dist/tinymce/plugins/wordcount/plugin.min.js +4 -0
- package/dist/tinymce/skins/content/dark/content.js +1 -0
- package/dist/tinymce/skins/content/dark/content.min.css +1 -0
- package/dist/tinymce/skins/content/default/content.js +1 -0
- package/dist/tinymce/skins/content/default/content.min.css +1 -0
- package/dist/tinymce/skins/content/document/content.js +1 -0
- package/dist/tinymce/skins/content/document/content.min.css +1 -0
- package/dist/tinymce/skins/content/tinymce-5/content.js +1 -0
- package/dist/tinymce/skins/content/tinymce-5/content.min.css +1 -0
- package/dist/tinymce/skins/content/tinymce-5-dark/content.js +1 -0
- package/dist/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
- package/dist/tinymce/skins/content/writer/content.js +1 -0
- package/dist/tinymce/skins/content/writer/content.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide/content.inline.js +1 -0
- package/dist/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide/content.js +1 -0
- package/dist/tinymce/skins/ui/oxide/content.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide/skin.js +1 -0
- package/dist/tinymce/skins/ui/oxide/skin.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
- package/dist/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/content.inline.js +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/content.js +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/skin.js +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
- package/dist/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/content.inline.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/content.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/skin.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/content.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
- package/dist/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/dist/tinymce/themes/silver/theme.min.js +4 -0
- package/dist/tinymce/tinymce.d.ts +3254 -0
- package/dist/tinymce/tinymce.min.js +4 -0
- package/package.json +5 -1
- package/public/tinymce/icons/default/icons.min.js +1 -0
- package/public/tinymce/langs/README.md +3 -0
- package/public/tinymce/license.md +6 -0
- package/public/tinymce/models/dom/model.min.js +4 -0
- package/public/tinymce/plugins/accordion/plugin.min.js +4 -0
- package/public/tinymce/plugins/advlist/plugin.min.js +4 -0
- package/public/tinymce/plugins/anchor/plugin.min.js +4 -0
- package/public/tinymce/plugins/autolink/plugin.min.js +4 -0
- package/public/tinymce/plugins/autoresize/plugin.min.js +4 -0
- package/public/tinymce/plugins/autosave/plugin.min.js +4 -0
- package/public/tinymce/plugins/charmap/plugin.min.js +4 -0
- package/public/tinymce/plugins/code/plugin.min.js +4 -0
- package/public/tinymce/plugins/codesample/plugin.min.js +4 -0
- package/public/tinymce/plugins/directionality/plugin.min.js +4 -0
- package/public/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
- package/public/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
- package/public/tinymce/plugins/emoticons/js/emojis.js +1 -0
- package/public/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
- package/public/tinymce/plugins/emoticons/plugin.min.js +4 -0
- package/public/tinymce/plugins/fullscreen/plugin.min.js +4 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
- package/public/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
- package/public/tinymce/plugins/help/plugin.min.js +4 -0
- package/public/tinymce/plugins/image/plugin.min.js +4 -0
- package/public/tinymce/plugins/importcss/plugin.min.js +4 -0
- package/public/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
- package/public/tinymce/plugins/link/plugin.min.js +4 -0
- package/public/tinymce/plugins/lists/plugin.min.js +4 -0
- package/public/tinymce/plugins/media/plugin.min.js +4 -0
- package/public/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
- package/public/tinymce/plugins/pagebreak/plugin.min.js +4 -0
- package/public/tinymce/plugins/preview/plugin.min.js +4 -0
- package/public/tinymce/plugins/quickbars/plugin.min.js +4 -0
- package/public/tinymce/plugins/save/plugin.min.js +4 -0
- package/public/tinymce/plugins/searchreplace/plugin.min.js +4 -0
- package/public/tinymce/plugins/table/plugin.min.js +4 -0
- package/public/tinymce/plugins/visualblocks/plugin.min.js +4 -0
- package/public/tinymce/plugins/visualchars/plugin.min.js +4 -0
- package/public/tinymce/plugins/wordcount/plugin.min.js +4 -0
- package/public/tinymce/skins/content/dark/content.js +1 -0
- package/public/tinymce/skins/content/dark/content.min.css +1 -0
- package/public/tinymce/skins/content/default/content.js +1 -0
- package/public/tinymce/skins/content/default/content.min.css +1 -0
- package/public/tinymce/skins/content/document/content.js +1 -0
- package/public/tinymce/skins/content/document/content.min.css +1 -0
- package/public/tinymce/skins/content/tinymce-5/content.js +1 -0
- package/public/tinymce/skins/content/tinymce-5/content.min.css +1 -0
- package/public/tinymce/skins/content/tinymce-5-dark/content.js +1 -0
- package/public/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
- package/public/tinymce/skins/content/writer/content.js +1 -0
- package/public/tinymce/skins/content/writer/content.min.css +1 -0
- package/public/tinymce/skins/ui/oxide/content.inline.js +1 -0
- package/public/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
- package/public/tinymce/skins/ui/oxide/content.js +1 -0
- package/public/tinymce/skins/ui/oxide/content.min.css +1 -0
- package/public/tinymce/skins/ui/oxide/skin.js +1 -0
- package/public/tinymce/skins/ui/oxide/skin.min.css +1 -0
- package/public/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
- package/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
- package/public/tinymce/skins/ui/oxide-dark/content.inline.js +1 -0
- package/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
- package/public/tinymce/skins/ui/oxide-dark/content.js +1 -0
- package/public/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
- package/public/tinymce/skins/ui/oxide-dark/skin.js +1 -0
- package/public/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
- package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
- package/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5/content.inline.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5/content.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5/skin.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/content.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
- package/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/public/tinymce/themes/silver/theme.min.js +4 -0
- package/public/tinymce/tinymce.d.ts +3254 -0
- package/public/tinymce/tinymce.min.js +4 -0
- package/src/App.jsx +95 -24
- package/src/components/TinyMCEEditor/index.jsx +23 -0
- package/src/components/field/select/search-select.jsx +47 -20
- package/src/components/field/select/select.jsx +5 -4
- package/src/components/field/table/index.jsx +61 -23
- package/src/components/form-container/index.jsx +52 -16
- package/src/components/index.jsx +3 -1
- package/src/components/sortList/index.jsx +70 -0
- package/src/components/wangEditor/index.jsx +27 -30
- package/src/components/wangEditorNext/index.jsx +71 -2
- package/src/components/wangEditorNext/menu/custom-menu.jsx +23 -0
package/src/App.jsx
CHANGED
@@ -3,7 +3,10 @@ import './App.css';
|
|
3
3
|
import { Button, Input, Select } from 'antd';
|
4
4
|
import React, { useEffect, useState } from 'react';
|
5
5
|
import Draggable from 'react-draggable';
|
6
|
-
|
6
|
+
import { throttle } from 'lodash';
|
7
|
+
import { SortList } from "./components"
|
8
|
+
import { TinyMCEEditor } from './components'
|
9
|
+
import { PrinterOutlined } from '@ant-design/icons';
|
7
10
|
const searchSelectOptions = [
|
8
11
|
{ id: 1, name: "1111" },
|
9
12
|
{ id: 2, name: "2222" },
|
@@ -99,13 +102,16 @@ function App() {
|
|
99
102
|
}
|
100
103
|
}
|
101
104
|
const setFormFields = () => {
|
102
|
-
formRef?.current?.formRef?.setFieldsValue({"userselect":"1213131","remark11":{"label":"选项1","value":"1","name":"1111","table":"[{\"price\":1,\"num\":2, \"remark11\":\"{ label: '选项3', value: '3' }\"},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]"},"table":[{"product_num1":"123","product_sum1":"","node_oclxmzswzti":"","select2":"","switch_table":false,"remark11":{"label":"选项2","value":"2"},"product_price12":""},{"product_num1":"213","product_sum1":"","node_oclxmzswzti":"","select2":"","switch_table":false,"datetime2":"2024-08-22 11:09:07","product_price13":1,"product_price14":2,"product_price12":"","remark11":{"label":"选项3","value":"3"}}],"product_total_price":"0.00","DeptSelect":["leaf11"],"PostSelect":["parent 1-1","leaf11"],"searchuser":[{"id":2,"name":"2222","label":"2222","value":2},{"id":4,"name":"4444","label":"4444","value":4}],"product_price":"213","product_num":"21","product_num_range":[1,22],"product_sum":"4473","switch":false,"datetime":"2024-08-25","datetime2":"2024-08-25","datetime3":"","datetime4":"2024-08-22 11:09:04","remark12":[{"label":"选项1","value":"1"},{"label":"选项2","value":"2"}]})
|
105
|
+
formRef?.current?.formRef?.setFieldsValue({ "userselect": "1213131", "remark11": { "label": "选项1", "value": "1", "name": "1111", "table": "[{\"price\":1,\"num\":2, \"remark11\":\"{ label: '选项3', value: '3' }\"},{\"price\":2,\"num\":2},{\"price\":3,\"num\":3},{\"price\":3,\"num\":3}]" }, "table": [{ "product_num1": "123", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "remark11": { "label": "选项2", "value": "2" }, "product_price12": "" }, { "product_num1": "213", "product_sum1": "", "node_oclxmzswzti": "", "select2": "", "switch_table": false, "datetime2": "2024-08-22 11:09:07", "product_price13": 1, "product_price14": 2, "product_price12": "", "remark11": { "label": "选项3", "value": "3" } }], "product_total_price": "0.00", "DeptSelect": ["leaf11"], "PostSelect": ["parent 1-1", "leaf11"], "searchuser": [{ "id": 2, "name": "2222", "label": "2222", "value": 2 }, { "id": 4, "name": "4444", "label": "4444", "value": 4 }], "product_price": "213", "product_num": "21", "product_num_range": [1, 22], "product_sum": "4473", "switch": false, "datetime": "2024-08-25", "datetime2": "2024-08-25", "datetime3": "", "datetime4": "2024-08-22 11:09:04", "remark12": [{ "label": "选项1", "value": "1" }, { "label": "选项2", "value": "2" }] })
|
103
106
|
}
|
104
107
|
const handleCols = () => {
|
105
108
|
setCols(cols - 1)
|
106
109
|
}
|
107
110
|
|
111
|
+
const [items, setItems] = useState(['Item 1', 'Item 2', 'Item 3', 'Item 4']);
|
112
|
+
|
108
113
|
|
114
|
+
const [sortItems, setSortItems] = useState([{ id: 1, content: "sdfsfd" }, { id: 2, content: "sdfsfd2" }, { id: 3, content: "sdfsfd3" }]);
|
109
115
|
return (
|
110
116
|
<div className='fflex fflex-col fitems-center fh-screen '>
|
111
117
|
<div className='fflex fgap-2 fitems-center fjustify-center fw-full'>
|
@@ -121,12 +127,33 @@ function App() {
|
|
121
127
|
<div className=" fflex fflex-col fitems-center fflex-1 foverflow-y-auto">
|
122
128
|
<DraggableBtn />
|
123
129
|
{/* <MyPureComponentWithRef ref={testRef} />; */}
|
124
|
-
|
130
|
+
<div className=' fp-4 fflex fjustify-center fw-[1336px]'>
|
131
|
+
<div className='fflex fflex-col'>
|
132
|
+
<SortList
|
133
|
+
items={sortItems}
|
134
|
+
setItems={setSortItems}
|
135
|
+
renderItem={(item, index, isDragging) => (
|
136
|
+
<div
|
137
|
+
style={{
|
138
|
+
padding: '8px',
|
139
|
+
margin: '4px',
|
140
|
+
border: '1px solid gray',
|
141
|
+
cursor: 'move',
|
142
|
+
opacity: isDragging ? 0.2 : 1,
|
143
|
+
|
144
|
+
}}
|
145
|
+
>
|
146
|
+
{item.content}
|
147
|
+
</div>
|
148
|
+
)}
|
149
|
+
/></div>
|
150
|
+
</div>
|
151
|
+
{/* <div className=' fp-4 fflex fjustify-center fw-[1336px]'>
|
125
152
|
<WangEditorNext />
|
126
153
|
</div> */}
|
127
|
-
|
128
|
-
|
129
|
-
|
154
|
+
<div className='fw-full fp-4 fflex fjustify-center'>
|
155
|
+
<TinyMCEEditor />
|
156
|
+
</div>
|
130
157
|
{/* <div className='fw-full fp-4 fflex fjustify-center'>
|
131
158
|
<EditorWang />
|
132
159
|
</div> */}
|
@@ -148,6 +175,24 @@ function App() {
|
|
148
175
|
<FormContainerWrapper cols={cols} className="" ref={formRef} >
|
149
176
|
<Field.UserSelect label="选择用户" __id="userselect" defaultValue={[{ id: 1, username: "十天" }]} />
|
150
177
|
<Layout.FormGroupTitle title={"基本信息"} />
|
178
|
+
<Field.WithSingleSelect
|
179
|
+
rightIconRender={({ form, fieldName }) => {
|
180
|
+
console.log("rightIconRender form", form,)
|
181
|
+
console.log("rightIconRender fieldName", fieldName)
|
182
|
+
return <><PrinterOutlined /></>
|
183
|
+
}}
|
184
|
+
isRequired={true} ref={testRef} fillRules={[
|
185
|
+
{
|
186
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
187
|
+
"type": 0,
|
188
|
+
"source": "shuilv",
|
189
|
+
"target": "shuilv",
|
190
|
+
"subRules": [
|
191
|
+
]
|
192
|
+
},
|
193
|
+
|
194
|
+
]} label="发票类型" options={[{ label: '选项1', value: '1', shuilv: 15, }, { label: '选项2', value: '2', shuilv: 50 }, { label: '选项3', value: '3', shuilv: 2 }]} __id="fapiaoleixing" />
|
195
|
+
|
151
196
|
<Field.Number label="税率(%)" __id="shuilv" />
|
152
197
|
|
153
198
|
<Field.WithSingleSelect isRequired={true} ref={testRef} fillRules={[
|
@@ -209,27 +254,53 @@ function App() {
|
|
209
254
|
}} />
|
210
255
|
<Field.DatePicker defaultNow={true} label="日期时间" prompt="" datetype="date" __id="datetime2" />
|
211
256
|
|
212
|
-
<Field.WithSingleSelect ref={testRef}
|
213
|
-
{
|
214
|
-
"
|
215
|
-
"
|
216
|
-
|
217
|
-
"
|
218
|
-
|
257
|
+
<Field.WithSingleSelect ref={testRef}
|
258
|
+
request={async (params)=>{
|
259
|
+
console.log("WithSingleSelect params", params)
|
260
|
+
if (params?.node_ocm009lpxt2 == "111")
|
261
|
+
return {code:0,data:{ list:[{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' }, { label: '选项3', value: '3' }]}}
|
262
|
+
else return {code:0,data:{ list:[{ label: '选项1', value: '1', product_price11: "1111", product_price12: "2222", product_price1: 111 }, { label: '选项2', value: '2' },]}}
|
263
|
+
}}
|
264
|
+
option_label="label"
|
265
|
+
option_value="value"
|
266
|
+
filterRules={[
|
267
|
+
{
|
268
|
+
"value": {
|
269
|
+
"parent": "",
|
270
|
+
"field_key": "shuilv",
|
271
|
+
"group_key": "fieldsValue",
|
272
|
+
"field_name": "当前表单.税率"
|
273
|
+
},
|
274
|
+
"column": {
|
275
|
+
"label": "库存表.所在仓库",
|
276
|
+
"value": "node_ocm009lpxt2",
|
277
|
+
"column_name": "node_ocm009lpxt2",
|
278
|
+
"column_type": ""
|
279
|
+
}
|
280
|
+
}
|
281
|
+
]}
|
219
282
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
"subRules": [
|
283
|
+
fillRules={[
|
284
|
+
{
|
285
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
286
|
+
"type": 0,
|
287
|
+
"source": "product_price11",
|
288
|
+
"target": "product_price11",
|
289
|
+
"subRules": [
|
228
290
|
|
229
|
-
|
230
|
-
|
291
|
+
]
|
292
|
+
},
|
293
|
+
{
|
294
|
+
"id": "636d3924-0298-4e9b-809a-26d4a10d7b89",
|
295
|
+
"type": 0,
|
296
|
+
"source": "product_price1",
|
297
|
+
"target": "product_price1",
|
298
|
+
"subRules": [
|
299
|
+
|
300
|
+
]
|
301
|
+
},
|
231
302
|
|
232
|
-
|
303
|
+
]} label="测试关联单选" __id="remark11" />
|
233
304
|
|
234
305
|
<Field.Switch label="开关" __id="switch_table"></Field.Switch>
|
235
306
|
<Field.Input defaultValue={3} isRequired={true} label="含税单价" __id="product_price11" />
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Editor } from '@tinymce/tinymce-react';
|
3
|
+
|
4
|
+
const TinyMCEEditor = () => {
|
5
|
+
return (
|
6
|
+
<Editor
|
7
|
+
initialValue="<p>一些内容。</p>"
|
8
|
+
tinymceScriptSrc="/tinymce/tinymce.min.js"
|
9
|
+
init={{
|
10
|
+
height: 500,
|
11
|
+
menubar: false,
|
12
|
+
plugins: 'lists link image table',
|
13
|
+
toolbar: 'undo redo | styleselect | bold italic | link image | table',
|
14
|
+
language: 'zh_CN', // 设置中文
|
15
|
+
}}
|
16
|
+
onEditorChange={(content, editor) => {
|
17
|
+
console.log(content);
|
18
|
+
}}
|
19
|
+
/>
|
20
|
+
);
|
21
|
+
};
|
22
|
+
|
23
|
+
export {TinyMCEEditor};
|
@@ -6,18 +6,37 @@ import { BaseWrapper } from "../base"
|
|
6
6
|
import { debounce, isEqual } from 'lodash';
|
7
7
|
|
8
8
|
|
9
|
-
const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIcon, rightIconClick, ...props }) => {
|
9
|
+
const SearchSelect = ({ addWrapper = true, form, fieldName, fieldsValue, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIconRender, rightIcon, rightIconClick, ...props }) => {
|
10
10
|
const [nOptions, setNOptions] = React.useState([])
|
11
11
|
const [fetching, setFetching] = useState(false);
|
12
12
|
useEffect(() => {
|
13
13
|
initData(requestParams)
|
14
|
-
}, [requestParams])
|
15
|
-
|
14
|
+
}, [requestParams, fieldsValue])
|
15
|
+
// useEffect(() => {
|
16
|
+
// console.log("WithSingleSelect useEffect fieldsValue",fieldsValue)
|
17
|
+
// if(fieldsValue)
|
18
|
+
// {
|
19
|
+
// form.setFieldValue(fieldName,value )
|
20
|
+
// console.log("onChange undefined")
|
21
|
+
// onChange(undefined)
|
22
|
+
// }
|
23
|
+
// },[fieldsValue])
|
16
24
|
const initData = async (params) => {
|
17
25
|
let item = null
|
18
|
-
|
26
|
+
const ruleParams = {}
|
27
|
+
if (Array.isArray(props?.filterRules)) {
|
28
|
+
// 验证关联表字段是否需要重新渲染
|
29
|
+
for (let rule of props?.filterRules) {
|
30
|
+
let ruleValue;
|
31
|
+
if (rule.value.parent === "")
|
32
|
+
ruleValue = fieldsValue?.[rule.value.field_key];
|
33
|
+
else
|
34
|
+
ruleValue = fieldsValue?.[rule.value.parent]?.[fieldName?.[1]]?.[rule.value.field_key];
|
35
|
+
ruleParams[rule.column.column_name] = ruleValue ?? "##norequest##";
|
36
|
+
}
|
37
|
+
}
|
19
38
|
if (request && typeof request === 'function') {
|
20
|
-
const list = await fetchOptions(params)
|
39
|
+
const list = await fetchOptions(params, ruleParams)
|
21
40
|
if (list && Array.isArray(list)) {
|
22
41
|
item = value ? list.find(item => item.value == value) : null
|
23
42
|
console.log("SearchSelect value", value)
|
@@ -30,9 +49,9 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
30
49
|
setNOptions(options)
|
31
50
|
}
|
32
51
|
|
33
|
-
if (item) {
|
34
|
-
|
35
|
-
}
|
52
|
+
// if (item) {
|
53
|
+
// onChange(item)
|
54
|
+
// }
|
36
55
|
|
37
56
|
}
|
38
57
|
|
@@ -63,15 +82,19 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
63
82
|
await fetchOptions(params)
|
64
83
|
}, 200)
|
65
84
|
|
66
|
-
const fetchOptions = async (params) => {
|
85
|
+
const fetchOptions = async (params, ruleParams) => {
|
67
86
|
try {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
87
|
+
let list = []
|
88
|
+
if (!(ruleParams && Object.values(ruleParams).some(value => value === "##norequest##"))) {
|
89
|
+
setFetching(true)
|
90
|
+
const response = await request({ ...params, ...ruleParams });
|
91
|
+
setFetching(false)
|
92
|
+
if (response.code > 0) {
|
93
|
+
callError && typeof callError === 'function' && callError(response.message);
|
94
|
+
}
|
95
|
+
else list = response.data?.list || response.data
|
73
96
|
}
|
74
|
-
|
97
|
+
|
75
98
|
if (Array.isArray(list)) {
|
76
99
|
for (let index = 0; index < list.length; index++) {
|
77
100
|
const item = list[index];
|
@@ -84,19 +107,20 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
84
107
|
list[index] = { ...item, label: item[option_label], title: item[option_label], options: subList }
|
85
108
|
}
|
86
109
|
list[index] = { ...item, label: item[option_label], value: item[option_value] }
|
87
|
-
|
88
110
|
}
|
89
|
-
|
111
|
+
if (nOptions.length > 0 && !isEqual(nOptions, list))
|
112
|
+
{
|
113
|
+
typeof onChange === 'function' && onChange(undefined)
|
114
|
+
}
|
90
115
|
setNOptions(list)
|
91
116
|
}
|
92
|
-
|
93
117
|
else setNOptions([])
|
94
118
|
return list
|
95
119
|
} catch (error) {
|
96
120
|
console.error("fetchOptions", error)
|
121
|
+
setFetching(false)
|
97
122
|
}
|
98
123
|
finally {
|
99
|
-
setFetching(false)
|
100
124
|
}
|
101
125
|
}
|
102
126
|
|
@@ -127,6 +151,7 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
127
151
|
|
128
152
|
</OriginalSelect>
|
129
153
|
{!props?.disabled && rightIcon}
|
154
|
+
{!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName })}
|
130
155
|
</BaseWrapper>
|
131
156
|
) : (<>
|
132
157
|
<OriginalSelect
|
@@ -142,7 +167,9 @@ const SearchSelect = ({ addWrapper = true, value, type, defaultValue, onChange,
|
|
142
167
|
mode={mode} >
|
143
168
|
|
144
169
|
</OriginalSelect>
|
145
|
-
{!props?.disabled && rightIcon}
|
170
|
+
{!props?.disabled && rightIcon}
|
171
|
+
{!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName })}
|
172
|
+
</>
|
146
173
|
)
|
147
174
|
|
148
175
|
}
|
@@ -71,8 +71,9 @@ const MultipleSelect = ({ onChange, value, ...props }) => {
|
|
71
71
|
* @param {*}
|
72
72
|
* @returns
|
73
73
|
*/
|
74
|
-
const WithSingleSelect = ({ readItemRender, readonly, onChange, onCustomChange,value, form,fieldName
|
74
|
+
const WithSingleSelect = ({ readItemRender, readonly, onChange, onCustomChange,value, form,fieldName,...props }) => {
|
75
75
|
|
76
|
+
|
76
77
|
React.useEffect(() => {
|
77
78
|
if (value && typeof value === "string") {
|
78
79
|
try {
|
@@ -93,7 +94,7 @@ const WithSingleSelect = ({ readItemRender, readonly, onChange, onCustomChange,v
|
|
93
94
|
{value && value.label && <>{readItemRender && typeof readItemRender === "function" ? readItemRender(value) : <span key={`btn_${value?.value}`}>{value?.label}</span>}</>}
|
94
95
|
</div>
|
95
96
|
return (
|
96
|
-
<SearchSelect addWrapper={false}
|
97
|
+
<SearchSelect addWrapper={false} form={form} fieldName={fieldName} {...props} onChange={onChange} value={value} mode="single" className=" fflex-1 foverflow-hidden" />
|
97
98
|
|
98
99
|
)
|
99
100
|
}
|
@@ -103,7 +104,7 @@ const WithSingleSelect = ({ readItemRender, readonly, onChange, onCustomChange,v
|
|
103
104
|
* @param {*}
|
104
105
|
* @returns
|
105
106
|
*/
|
106
|
-
const WithMultipleSelect = ({ readItemRender, readonly, onChange, value, ...props }) => {
|
107
|
+
const WithMultipleSelect = ({ readItemRender, readonly, onChange, value, form,fieldName, ...props }) => {
|
107
108
|
|
108
109
|
React.useEffect(() => {
|
109
110
|
if (value && typeof value === "string") {
|
@@ -123,7 +124,7 @@ const WithMultipleSelect = ({ readItemRender, readonly, onChange, value, ...prop
|
|
123
124
|
}{index < value.length - 1 ? <span className=" ftext-gray-400">,</span> : null}</>)}
|
124
125
|
</div>
|
125
126
|
return (
|
126
|
-
<SearchSelect addWrapper={false} {...props} onChange={onChange} value={value} mode="multiple" className=" fflex-1 foverflow-hidden" />
|
127
|
+
<SearchSelect addWrapper={false} form={form} fieldName={fieldName} {...props} onChange={onChange} value={value} mode="multiple" className=" fflex-1 foverflow-hidden" />
|
127
128
|
)
|
128
129
|
}
|
129
130
|
|
@@ -28,14 +28,14 @@ const TableCol = ({ children, width, ...props }) => {
|
|
28
28
|
</div>
|
29
29
|
}
|
30
30
|
|
31
|
-
const Table = ({ children, onTableAddRow,disabled,readonly,onTableRemoveRow, form, fieldName
|
31
|
+
const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow, form, fieldName, ...props }) => {
|
32
32
|
const [init, setInit] = useState(false);
|
33
33
|
const name = props.componentId || props.__id
|
34
34
|
const childrenIds = React.Children.map(children, (child) => `${name}.${child.props.componentId || child.props.__id}`)
|
35
35
|
const rules = []
|
36
36
|
const handleAdd = () => {
|
37
37
|
if (!init) setInit(true);
|
38
|
-
form?.setFieldValue(fieldName, [{}]
|
38
|
+
form?.setFieldValue(fieldName, [{}])
|
39
39
|
}
|
40
40
|
|
41
41
|
if (props.isRequired)
|
@@ -56,12 +56,12 @@ const Table = ({ children, onTableAddRow,disabled,readonly,onTableRemoveRow, for
|
|
56
56
|
})}
|
57
57
|
</TableCol>
|
58
58
|
})}
|
59
|
-
{disabled != true
|
59
|
+
{disabled != true && readonly != true && <TableAction subTableHead={true} key={`row_${0}_action`} subTable={true} subTableIndex={0} label={"操作"}>
|
60
60
|
</TableAction>}
|
61
61
|
</div>}
|
62
62
|
{fields.map((field, index) => (
|
63
63
|
<div key={field.key} className="fborder-b fflex flex-nowrap fmin-w-full ">
|
64
|
-
|
64
|
+
|
65
65
|
{React.Children.map(children, (child, childIndex) => {
|
66
66
|
let { props } = child;
|
67
67
|
const col_id = child?.props?.componentId || child?.props?.__id || childIndex;
|
@@ -78,36 +78,74 @@ const Table = ({ children, onTableAddRow,disabled,readonly,onTableRemoveRow, for
|
|
78
78
|
rules.push({ pattern: new RegExp(props.rules), message: props.rulesFailMessage ? props.rulesFailMessage : `${props.label}格式错误` })
|
79
79
|
}
|
80
80
|
|
81
|
+
const { componentId, __id, _componentName, ...otherProps } = child.props;
|
82
|
+
const componentName = child.type?.displayName || _componentName;
|
83
|
+
const identifier = componentId || __id;
|
81
84
|
return <TableCol width={150} key={`row_${field.key}_col_${childIndex}`}>
|
82
85
|
<Form.Item
|
83
|
-
style={{
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
style={{ margin: 0 }}
|
87
|
+
shouldUpdate={(prevValues, curValues) => {
|
88
|
+
let result = false;
|
89
|
+
if (
|
90
|
+
(componentName === "Field.WithSingleSelect" || componentName === "Field.WithMultipleSelect") &&
|
91
|
+
Array.isArray(otherProps.filterRules) &&
|
92
|
+
otherProps.filterRules.length > 0
|
93
|
+
) {
|
94
|
+
// 验证关联表字段是否需要重新渲染
|
95
|
+
for (let rule of otherProps.filterRules) {
|
96
|
+
let prevFieldValue, curFieldValue;
|
97
|
+
|
98
|
+
if (rule.value.parent === "") {
|
99
|
+
prevFieldValue = prevValues?.[rule.value.field_key];
|
100
|
+
curFieldValue = curValues?.[rule.value.field_key];
|
101
|
+
} else {
|
102
|
+
prevFieldValue = prevValues?.[rule.value.parent]?.[field.name]?.[rule.value.field_key];
|
103
|
+
curFieldValue = curValues?.[rule.value.parent]?.[field.name]?.[rule.value.field_key];
|
104
|
+
}
|
105
|
+
|
106
|
+
if (prevFieldValue !== curFieldValue) {
|
107
|
+
result = true;
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
return result;
|
113
|
+
}}
|
88
114
|
>
|
89
|
-
{
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
115
|
+
{( {getFieldsValue}) => {
|
116
|
+
const fieldsValue = getFieldsValue();
|
117
|
+
return <Form.Item
|
118
|
+
label=""
|
119
|
+
style={{ marginBottom: 0 }}
|
120
|
+
name={[field.name, col_id]}
|
121
|
+
rules={rules}
|
122
|
+
>
|
123
|
+
{React.cloneElement(child, {
|
124
|
+
key: `row_${field.key}_child_${childIndex}`,
|
125
|
+
subTable: true,
|
126
|
+
subTableIndex: index,
|
127
|
+
subTableHead: index === 0,
|
128
|
+
form,
|
129
|
+
fieldName: [fieldName, field.name, col_id],
|
130
|
+
fieldsValue:fieldsValue,
|
131
|
+
})}
|
132
|
+
</Form.Item>
|
133
|
+
}}
|
97
134
|
</Form.Item>
|
135
|
+
|
98
136
|
</TableCol>
|
99
137
|
})}
|
100
|
-
{disabled != true
|
101
|
-
<DeleteOutlined className="fcursor-pointer" onClick={() =>{
|
102
|
-
|
103
|
-
|
138
|
+
{disabled != true && readonly != true && <TableAction subTableHead={index == 0} key={`row_${index}_action`} subTable={true} subTableIndex={index} label={"操作"}>
|
139
|
+
<DeleteOutlined className="fcursor-pointer" onClick={() => {
|
140
|
+
remove(index)
|
141
|
+
typeof onTableRemoveRow === "function" && onTableRemoveRow(childrenIds);
|
104
142
|
}} />
|
105
143
|
</TableAction>}
|
106
144
|
</div>
|
107
145
|
))}
|
108
146
|
</div>
|
109
|
-
{disabled != true
|
110
|
-
add({ key: nanoid() })
|
147
|
+
{disabled != true && readonly != true && <Button onClick={() => {
|
148
|
+
add({ key: nanoid() })
|
111
149
|
typeof onTableAddRow === "function" && onTableAddRow(childrenIds);
|
112
150
|
}} className="fmy-2">新增一行</Button>}
|
113
151
|
</div>
|
@@ -51,7 +51,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
51
51
|
|
52
52
|
React.useImperativeHandle(ref, () => ({
|
53
53
|
formRef: form,
|
54
|
-
setFieldsValue: (values)=>{
|
54
|
+
setFieldsValue: (values) => {
|
55
55
|
changedFieldsState.current = {};
|
56
56
|
form.setFieldsValue(values)
|
57
57
|
},
|
@@ -463,25 +463,61 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
463
463
|
else {
|
464
464
|
rules.push({ pattern: new RegExp(props.rules), message: props.rulesFailMessage ? props.rulesFailMessage : `${props.label}格式错误` })
|
465
465
|
}
|
466
|
-
const onCustomChange = (value) =>{
|
467
|
-
form.setFieldValue(identifier,value)
|
466
|
+
const onCustomChange = (value) => {
|
467
|
+
form.setFieldValue(identifier, value)
|
468
468
|
}
|
469
469
|
let childComponent
|
470
|
-
if (isTable || isLayoutComponent)
|
471
|
-
childComponent = React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName:identifier,onCustomChange })
|
472
|
-
else {
|
473
|
-
childComponent =
|
470
|
+
if (isTable || isLayoutComponent)
|
471
|
+
childComponent = React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange })
|
472
|
+
else if (componentName === "Field.WithSingleSelect" || componentName === "Field.WithMultipleSelect") {
|
473
|
+
childComponent = <Form.Item
|
474
|
+
style={{ margin: 0 }}
|
475
|
+
shouldUpdate={(prevValues, curValues) => {
|
476
|
+
let result = false;
|
477
|
+
if (Array.isArray(props.filterRules) &&
|
478
|
+
props.filterRules.length > 0
|
479
|
+
) {
|
480
|
+
// 验证关联表字段是否需要重新渲染
|
481
|
+
for (let rule of props.filterRules) {
|
482
|
+
if (rule.value.parent != "") continue
|
483
|
+
let prevFieldValue, curFieldValue;
|
484
|
+
|
485
|
+
prevFieldValue = prevValues?.[rule.value.field_key];
|
486
|
+
curFieldValue = curValues?.[rule.value.field_key];
|
487
|
+
if (prevFieldValue !== curFieldValue) {
|
488
|
+
result = true;
|
489
|
+
break;
|
490
|
+
}
|
491
|
+
}
|
492
|
+
}
|
493
|
+
return result;
|
494
|
+
}}
|
495
|
+
>
|
496
|
+
{({getFieldsValue}) => {
|
497
|
+
const fieldsValue = getFieldsValue();
|
498
|
+
return <Form.Item
|
499
|
+
style={{ marginBottom: 0 }}
|
500
|
+
label=""
|
501
|
+
name={identifier}
|
502
|
+
rules={rules}
|
503
|
+
>
|
504
|
+
{React.cloneElement(child, { onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange, fieldsValue })}
|
505
|
+
</Form.Item>
|
506
|
+
}}
|
507
|
+
</Form.Item>
|
508
|
+
} else {
|
509
|
+
childComponent = <Form.Item
|
510
|
+
style={{ marginBottom: 0 }}
|
511
|
+
label=""
|
512
|
+
name={identifier}
|
513
|
+
rules={rules}
|
514
|
+
>
|
515
|
+
{React.cloneElement(child, { form: form, fieldName: identifier, onCustomChange })}
|
516
|
+
</Form.Item>
|
474
517
|
}
|
475
518
|
return (
|
476
519
|
<Col key={identifier || `col-${index}`} span={isLayoutComponent ? 24 : 24 / group.length} style={{ marginBottom: 0 }}>
|
477
|
-
{
|
478
|
-
style={{ marginBottom: 0 }}
|
479
|
-
label=""
|
480
|
-
name={identifier}
|
481
|
-
rules={rules}
|
482
|
-
>
|
483
|
-
{childComponent}
|
484
|
-
</Form.Item>}
|
520
|
+
{childComponent}
|
485
521
|
</Col>
|
486
522
|
);
|
487
523
|
})}
|
@@ -490,7 +526,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
|
|
490
526
|
};
|
491
527
|
|
492
528
|
return (
|
493
|
-
<Form form={form} className={"form-container fp-0 fw-full fh-full box-border fflex fflex-col fgap-y-2" + (mode == "desgin" ? " fp-6" : "")} onValuesChange={(changedValues, allValues)=>{
|
529
|
+
<Form form={form} className={"form-container fp-0 fw-full fh-full box-border fflex fflex-col fgap-y-2" + (mode == "desgin" ? " fp-6" : "")} onValuesChange={(changedValues, allValues) => {
|
494
530
|
console.log("changedValues", changedValues)
|
495
531
|
// console.log("allValues", allValues)
|
496
532
|
}} onFieldsChange={handleFieldsChange}>
|