@luck-design-biz/luckda 0.0.25-1 → 0.0.25-3
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/es/locales/zh-CN.js +9 -0
- package/es/lowcode/constants/api-url.js +184 -100
- package/es/lowcode/constants/index.js +2 -1
- package/es/lowcode/engine/meta/box.props.default.json +1 -1
- package/es/lowcode/engine/meta/box.props.json +1 -1
- package/es/lowcode/engine/meta/button.props.json +1 -1
- package/es/lowcode/engine/meta/cardlist.props.json +1 -1
- package/es/lowcode/engine/meta/components-list.json +1 -1
- package/es/lowcode/engine/meta/dialog.props.json +1 -1
- package/es/lowcode/engine/meta/drawer.props.json +1 -1
- package/es/lowcode/engine/meta/form.props.default.json +4 -5
- package/es/lowcode/engine/meta/form.props.json +33 -30
- package/es/lowcode/engine/meta/image.props.json +2 -2
- package/es/lowcode/engine/meta/imex.props.json +1 -1
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/section.props.default.json +4 -6
- package/es/lowcode/engine/meta/section.props.json +52 -49
- package/es/lowcode/engine/meta/text.props.json +2 -2
- package/es/lowcode/engine/meta/tree.props.json +2 -2
- package/es/lowcode/engine/provider/ContextProvider/index.js +10 -2
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +28 -15
- package/es/lowcode/engine/tools/helper.js +23 -21
- package/es/lowcode/engine/tools/useCanvasRender.js +5 -7
- package/es/lowcode/engine/tools/usePromiseState.js +23 -14
- package/es/lowcode/painter/Design.js +34 -2
- package/es/lowcode/painter/DesignOperator.js +6 -8
- package/es/lowcode/painter/DesignToolbar.js +258 -21
- package/es/lowcode/painter/Panel.js +8 -9
- package/es/lowcode/painter/components/AttrsPanel.js +6 -6
- package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
- package/es/lowcode/painter/components/ListEditor.js +8 -2
- package/es/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
- package/es/lowcode/painter/components/field-setting/SettingUI.js +26 -7
- package/es/lowcode/painter/components/field-setting/index.js +18 -8
- package/es/lowcode/painter/index.js +1 -28
- package/es/lowcode/painter/panel-section/ActionsColumnWidth.js +25 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
- package/es/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +48 -15
- package/es/lowcode/painter/panel-section/FieldsSetting.js +48 -27
- package/es/lowcode/painter/panel-section/I18nInput.js +20 -0
- package/es/lowcode/painter/style/design.less +6 -2
- package/es/lowcode/painter/style/list-editor.less +36 -0
- package/es/lowcode/preview/index.js +17 -4
- package/es/lowcode/view/lc-components/Box/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Box/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Box/meta.json +1 -1
- package/es/lowcode/view/lc-components/Button/meta.json +1 -1
- package/es/lowcode/view/lc-components/CardList/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/CardList/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/CardList/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +1 -1
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -4
- package/es/lowcode/view/lc-components/Dialog/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/meta.json +1 -1
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +66 -4
- package/es/lowcode/view/lc-components/Form/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Form/index.js +232 -61
- package/es/lowcode/view/lc-components/Form/meta.json +33 -30
- package/es/lowcode/view/lc-components/Iframe/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/es/lowcode/view/lc-components/Image/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Image/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Image/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Image/meta.json +2 -2
- package/es/lowcode/view/lc-components/JSX/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/JSX/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/JSX/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -7
- package/es/lowcode/view/lc-components/Layout/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
- package/es/lowcode/view/lc-components/Section/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Section/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Section/index.js +114 -24
- package/es/lowcode/view/lc-components/Section/index.less +7 -0
- package/es/lowcode/view/lc-components/Section/meta.json +48 -49
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +4 -6
- package/es/lowcode/view/lc-components/Split/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Split/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Split/index.js +4 -4
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Table/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Table/index.js +7 -6
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +2 -4
- package/es/lowcode/view/lc-components/Text/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Text/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Text/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Text/meta.json +2 -2
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +2 -2
- package/es/upload/Form/gridForm.js +7 -3
- package/lib/locales/zh-CN.js +9 -0
- package/lib/lowcode/constants/api-url.js +183 -100
- package/lib/lowcode/constants/index.js +3 -2
- package/lib/lowcode/engine/meta/box.props.default.json +1 -1
- package/lib/lowcode/engine/meta/box.props.json +1 -1
- package/lib/lowcode/engine/meta/button.props.json +1 -1
- package/lib/lowcode/engine/meta/cardlist.props.json +1 -1
- package/lib/lowcode/engine/meta/components-list.json +1 -1
- package/lib/lowcode/engine/meta/dialog.props.json +1 -1
- package/lib/lowcode/engine/meta/drawer.props.json +1 -1
- package/lib/lowcode/engine/meta/form.props.default.json +4 -5
- package/lib/lowcode/engine/meta/form.props.json +33 -30
- package/lib/lowcode/engine/meta/image.props.json +2 -2
- package/lib/lowcode/engine/meta/imex.props.json +1 -1
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/section.props.default.json +4 -6
- package/lib/lowcode/engine/meta/section.props.json +52 -49
- package/lib/lowcode/engine/meta/text.props.json +2 -2
- package/lib/lowcode/engine/meta/tree.props.json +2 -2
- package/lib/lowcode/engine/provider/ContextProvider/index.js +10 -2
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +24 -11
- package/lib/lowcode/engine/tools/helper.js +23 -21
- package/lib/lowcode/engine/tools/useCanvasRender.js +3 -5
- package/lib/lowcode/engine/tools/usePromiseState.js +22 -14
- package/lib/lowcode/painter/Design.js +32 -0
- package/lib/lowcode/painter/DesignOperator.js +5 -7
- package/lib/lowcode/painter/DesignToolbar.js +256 -19
- package/lib/lowcode/painter/Panel.js +7 -8
- package/lib/lowcode/painter/components/AttrsPanel.js +6 -6
- package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
- package/lib/lowcode/painter/components/ListEditor.js +8 -2
- package/lib/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +26 -7
- package/lib/lowcode/painter/components/field-setting/index.js +18 -8
- package/lib/lowcode/painter/index.js +1 -30
- package/lib/lowcode/painter/panel-section/ActionsColumnWidth.js +32 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
- package/lib/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +47 -13
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +46 -25
- package/lib/lowcode/painter/panel-section/I18nInput.js +27 -0
- package/lib/lowcode/painter/style/design.less +6 -2
- package/lib/lowcode/painter/style/list-editor.less +36 -0
- package/lib/lowcode/preview/index.js +18 -4
- package/lib/lowcode/view/lc-components/Box/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Box/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Box/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Button/meta.json +1 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -4
- package/lib/lowcode/view/lc-components/Dialog/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Dialog/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Dialog/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +64 -2
- package/lib/lowcode/view/lc-components/Form/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Form/index.js +230 -59
- package/lib/lowcode/view/lc-components/Form/meta.json +33 -30
- package/lib/lowcode/view/lc-components/Iframe/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Iframe/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Iframe/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Image/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Image/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Image/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Image/meta.json +2 -2
- package/lib/lowcode/view/lc-components/JSX/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +5 -6
- package/lib/lowcode/view/lc-components/Layout/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
- package/lib/lowcode/view/lc-components/Section/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Section/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Section/index.js +113 -23
- package/lib/lowcode/view/lc-components/Section/index.less +7 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +48 -49
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +5 -7
- package/lib/lowcode/view/lc-components/Split/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Split/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Split/index.js +4 -4
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Table/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Table/index.js +7 -6
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +4 -6
- package/lib/lowcode/view/lc-components/Text/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Text/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Text/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Text/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/meta.json +2 -2
- package/lib/upload/Form/gridForm.js +7 -3
- package/package.json +1 -1
- package/es/lowcode/painter/services/toolbar.js +0 -25
- package/lib/lowcode/painter/services/toolbar.js +0 -32
|
@@ -1,30 +1,82 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import React, { useRef, forwardRef } from 'react';
|
|
6
|
-
import { useMemoizedFn } from 'ahooks';
|
|
3
|
+
import React, { useRef, forwardRef, Fragment, useImperativeHandle } from 'react';
|
|
4
|
+
import { useMemoizedFn, useCreation, useMount, useUnmount } from 'ahooks';
|
|
7
5
|
import classNames from 'classnames';
|
|
8
6
|
import { reduce, includes, isNil } from 'lodash';
|
|
7
|
+
import { BasicDivider } from 'luck-design';
|
|
8
|
+
import { Collapse } from '@luck-design-biz/base';
|
|
9
9
|
import Wrapper from "../Wrapper";
|
|
10
10
|
import { LdFormList } from "../../../../index";
|
|
11
11
|
import { omitBadProps, executeCode } from "../../../engine/tools/helper";
|
|
12
|
-
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
12
|
+
import { useContext, useRemoteSource } from "../../../engine/provider/ContextProvider";
|
|
13
|
+
import buildUploadForm from "../../../../upload/Form";
|
|
14
|
+
import LdRuntimeCom from "../../../../components/LdRuntimeCom";
|
|
13
15
|
import defaultMeta from "../../../engine/meta/form.props.default.json";
|
|
14
16
|
import styles from "./index.less";
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
var Header = function Header(_ref) {
|
|
18
|
+
var _ref$header = _ref.header,
|
|
19
|
+
header = _ref$header === void 0 ? 'collapse' : _ref$header,
|
|
20
|
+
title = _ref.title,
|
|
21
|
+
ldId = _ref.ldId,
|
|
22
|
+
children = _ref.children;
|
|
23
|
+
if (header === 'collapse' || header === 'collapseFollow') return /*#__PURE__*/React.createElement(Collapse, {
|
|
24
|
+
title: title || ldId,
|
|
25
|
+
id: ldId,
|
|
26
|
+
key: ldId,
|
|
27
|
+
mode: header === 'collapse' && 'tab'
|
|
28
|
+
}, children);
|
|
29
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
30
|
+
key: ldId
|
|
31
|
+
}, header === 'divider' && /*#__PURE__*/React.createElement(BasicDivider, {
|
|
32
|
+
title: title || ldId,
|
|
33
|
+
id: ldId
|
|
34
|
+
}), children);
|
|
35
|
+
};
|
|
36
|
+
var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
37
|
+
var id = _ref2.id,
|
|
38
|
+
parentId = _ref2.parentId,
|
|
39
|
+
width = _ref2.width,
|
|
40
|
+
height = _ref2.height,
|
|
41
|
+
className = _ref2.className,
|
|
42
|
+
blocks = _ref2.blocks,
|
|
43
|
+
advance = _ref2.advance,
|
|
44
|
+
initData = _ref2.initData,
|
|
45
|
+
readOnly = _ref2.readOnly,
|
|
46
|
+
showSave = _ref2.showSave,
|
|
47
|
+
saveTitle = _ref2.saveTitle,
|
|
48
|
+
settingLayout = _ref2.settingLayout,
|
|
49
|
+
renderFormLeft = _ref2.renderFormLeft,
|
|
50
|
+
renderFormRight = _ref2.renderFormRight,
|
|
51
|
+
children = _ref2.children;
|
|
52
|
+
var apiRef = useRef();
|
|
26
53
|
var boxRef = useRef();
|
|
54
|
+
var formRef = useRef();
|
|
27
55
|
var ctx = useContext();
|
|
56
|
+
var remoteSource = useRemoteSource();
|
|
57
|
+
var serials = useCreation(function () {
|
|
58
|
+
var _remoteSource$serials;
|
|
59
|
+
return ((_remoteSource$serials = remoteSource.serials) === null || _remoteSource$serials === void 0 ? void 0 : _remoteSource$serials.map(function (i) {
|
|
60
|
+
return i.serial;
|
|
61
|
+
})) || [];
|
|
62
|
+
}, [remoteSource.serials]);
|
|
63
|
+
useMount(function () {
|
|
64
|
+
ctx.doAction(advance.events.onMount, {
|
|
65
|
+
instance: (ref || formRef).current
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
useUnmount(function () {
|
|
69
|
+
ctx.doAction(advance.events.onUnmount, {
|
|
70
|
+
instance: (ref || formRef).current
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
useImperativeHandle(apiRef, function () {
|
|
74
|
+
return {
|
|
75
|
+
getForm: function getForm() {
|
|
76
|
+
return (ref || formRef).current;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
});
|
|
28
80
|
var getTargetDom = useMemoizedFn(function () {
|
|
29
81
|
return boxRef.current;
|
|
30
82
|
});
|
|
@@ -34,9 +86,9 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
86
|
};
|
|
35
87
|
return executeCode(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
|
|
36
88
|
});
|
|
37
|
-
var handleDataSourceFormat = useMemoizedFn(function (dataSourceFormat,
|
|
38
|
-
var values =
|
|
39
|
-
submitData =
|
|
89
|
+
var handleDataSourceFormat = useMemoizedFn(function (dataSourceFormat, _ref3) {
|
|
90
|
+
var values = _ref3.values,
|
|
91
|
+
submitData = _ref3.submitData;
|
|
40
92
|
if (isNil(dataSourceFormat)) return submitData;
|
|
41
93
|
return executeCode(ctx, dataSourceFormat, ['values', 'submitData'], values, submitData);
|
|
42
94
|
});
|
|
@@ -50,61 +102,166 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
50
102
|
var handleGridFormReady = useMemoizedFn(function (onGridFormReady, ref, params, gridForm) {
|
|
51
103
|
if (!isNil(onGridFormReady)) return executeCode(ctx, onGridFormReady, ['ref', 'params', 'gridForm'], ref, params, gridForm);
|
|
52
104
|
});
|
|
105
|
+
var handleResetActions = useMemoizedFn(function (resetActions, data, index, actionList, params) {
|
|
106
|
+
if (isNil(resetActions)) return actionList;
|
|
107
|
+
return executeCode(ctx, resetActions, ['data', 'index', 'actionList', 'params'], data, index, actionList, params);
|
|
108
|
+
});
|
|
109
|
+
var handleForbiddenTypes = useMemoizedFn(function (forbiddenTypes) {
|
|
110
|
+
if (isNil(forbiddenTypes)) return [];
|
|
111
|
+
return executeCode(ctx, forbiddenTypes, []);
|
|
112
|
+
});
|
|
113
|
+
var handleBeforeUpload = useMemoizedFn(function (beforeUpload, file, fileList) {
|
|
114
|
+
if (isNil(beforeUpload)) return true;
|
|
115
|
+
return executeCode(ctx, beforeUpload, ['file', 'fileList'], file, fileList);
|
|
116
|
+
});
|
|
117
|
+
var handleUploadChange = useMemoizedFn(function (onUploadChange, e) {
|
|
118
|
+
if (!isNil(onUploadChange)) return executeCode(ctx, onUploadChange, ['event'], e);
|
|
119
|
+
});
|
|
120
|
+
var renderAffix = useMemoizedFn(function (_render) {
|
|
121
|
+
return _render ? /*#__PURE__*/React.createElement(LdRuntimeCom, null, _render) : null;
|
|
122
|
+
});
|
|
53
123
|
var renderFormList = useMemoizedFn(function (formConfig) {
|
|
54
|
-
|
|
55
|
-
if (includes(['auto', 'grid', 'writer'], item.type)) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
124
|
+
return reduce(blocks, function (result, item) {
|
|
125
|
+
if (includes(['auto', 'grid', 'writer'], item.type) && item.dataset && includes(item.mode, formConfig.formMode)) {
|
|
126
|
+
var data = {
|
|
127
|
+
id: item.id,
|
|
128
|
+
order: item.order,
|
|
129
|
+
type: item.type,
|
|
130
|
+
readOnly: item.readOnly,
|
|
131
|
+
title: item.name,
|
|
132
|
+
header: item.header,
|
|
133
|
+
dataSetKey: item.dataset.code,
|
|
134
|
+
serial: item.serial,
|
|
135
|
+
serialEffect: item.serialEffect,
|
|
136
|
+
defaultDataSourceFormat: function defaultDataSourceFormat(defaultValues) {
|
|
137
|
+
return handleDefaultDataSourceFormat(item.defaultDataSourceFormat, defaultValues);
|
|
138
|
+
},
|
|
139
|
+
onUpdate: {
|
|
140
|
+
post: function post(data) {
|
|
141
|
+
return handleDataSourceFormat(item.dataSourceFormat, data);
|
|
73
142
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
if (item.type === 'auto') data = _objectSpread(_objectSpread({}, data), {}, {
|
|
146
|
+
col: item.cols
|
|
147
|
+
});else data = _objectSpread(_objectSpread({}, data), {}, {
|
|
148
|
+
suppressPreset: item.suppressPreset,
|
|
149
|
+
height: item.height,
|
|
150
|
+
bordered: item.bordered,
|
|
151
|
+
draggable: item.draggable,
|
|
152
|
+
orderByAdd: item.orderByAdd,
|
|
153
|
+
hideActionsColumn: item.suppressActions,
|
|
154
|
+
actionsWidth: item.actionsColumnWidth,
|
|
155
|
+
columnsReset: function columnsReset(columns) {
|
|
156
|
+
return handleColumnsReset(item.columnsReset, columns);
|
|
157
|
+
},
|
|
158
|
+
onGridFormReady: function onGridFormReady(ref, params, gridForm) {
|
|
159
|
+
return handleGridFormReady(item.onGridFormReady, ref, params, gridForm);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
if (item.actionsColumnReset) data = _objectSpread(_objectSpread({}, data), {}, {
|
|
163
|
+
resetActionsColumn: function resetActionsColumn(data, index, actions, params) {
|
|
164
|
+
return handleResetActionsColumn(item.actionsColumnReset, data, index, actions, params);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
result.push(data);
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}, []);
|
|
171
|
+
});
|
|
172
|
+
var renderFormExtra = useMemoizedFn(function (formConfig) {
|
|
173
|
+
return reduce(blocks, function (result, item) {
|
|
174
|
+
if (includes(item.mode, formConfig.formMode) && !item.serial || item.serialEffect === 'disable' || includes(serials, item.serial)) {
|
|
175
|
+
if (item.type === 'uploadForm') {
|
|
176
|
+
var _remoteSource$pageinf;
|
|
177
|
+
var dom = /*#__PURE__*/React.createElement(Header, {
|
|
178
|
+
ldId: item.id,
|
|
179
|
+
key: item.id,
|
|
180
|
+
header: item.header,
|
|
181
|
+
title: item.name,
|
|
182
|
+
order: item.order
|
|
183
|
+
}, buildUploadForm(_objectSpread(_objectSpread({}, formConfig), {}, {
|
|
184
|
+
formId: item.id,
|
|
185
|
+
moduleCode: remoteSource === null || remoteSource === void 0 || (_remoteSource$pageinf = remoteSource.pageinfo) === null || _remoteSource$pageinf === void 0 || (_remoteSource$pageinf = _remoteSource$pageinf.relationship) === null || _remoteSource$pageinf === void 0 ? void 0 : _remoteSource$pageinf.moduleCode,
|
|
186
|
+
readOnly: item.readOnly || formConfig.readOnly || item.serial && !includes(serials, item.serial),
|
|
78
187
|
suppressPreset: item.suppressPreset,
|
|
79
188
|
height: item.height,
|
|
80
189
|
bordered: item.bordered,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
190
|
+
showNote: item.showNote,
|
|
191
|
+
zipName: "".concat(item.zipName || 'download', ".zip"),
|
|
192
|
+
uploadUrl: item.uploadUrl,
|
|
193
|
+
resetActions: item.useResetActions ? null : function () {
|
|
194
|
+
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
195
|
+
params[_key] = arguments[_key];
|
|
196
|
+
}
|
|
197
|
+
return handleResetActions.apply(void 0, [item.resetActions].concat(params));
|
|
87
198
|
},
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
199
|
+
forbiddenTypes: function forbiddenTypes() {
|
|
200
|
+
return handleForbiddenTypes(item.forbiddenTypes);
|
|
201
|
+
},
|
|
202
|
+
beforeUpload: function beforeUpload() {
|
|
203
|
+
for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
204
|
+
params[_key2] = arguments[_key2];
|
|
205
|
+
}
|
|
206
|
+
return handleBeforeUpload.apply(void 0, [item.beforeUpload].concat(params));
|
|
207
|
+
},
|
|
208
|
+
onUploadChange: function onUploadChange(e) {
|
|
209
|
+
return handleUploadChange(item.onUploadChange, e);
|
|
95
210
|
}
|
|
96
|
-
});
|
|
97
|
-
result.push(
|
|
211
|
+
})));
|
|
212
|
+
result.push(dom);
|
|
213
|
+
}
|
|
214
|
+
if (item.type === 'blank') {
|
|
215
|
+
var _dom = /*#__PURE__*/React.createElement(Header, {
|
|
216
|
+
ldId: item.id,
|
|
217
|
+
key: item.id,
|
|
218
|
+
header: item.header,
|
|
219
|
+
title: item.name,
|
|
220
|
+
order: item.order
|
|
221
|
+
}, children === null || children === void 0 ? void 0 : children.find(function (child) {
|
|
222
|
+
return child.props.formBoxId === item.id;
|
|
223
|
+
}));
|
|
224
|
+
result.push(_dom);
|
|
98
225
|
}
|
|
99
226
|
}
|
|
100
227
|
return result;
|
|
101
228
|
}, []);
|
|
102
|
-
|
|
229
|
+
});
|
|
230
|
+
var beforeSubmit = useMemoizedFn(function (values, data) {
|
|
231
|
+
return new Promise(function (resolve) {
|
|
232
|
+
if (isNil(advance.events.beforeSave)) resolve(values);else {
|
|
233
|
+
var _data = ctx.doAction(advance.events.beforeSave, {
|
|
234
|
+
values: values,
|
|
235
|
+
data: data
|
|
236
|
+
});
|
|
237
|
+
resolve(_data);
|
|
238
|
+
}
|
|
239
|
+
;
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
var afterSubmit = useMemoizedFn(function (success, mainKey, res) {
|
|
243
|
+
ctx.doAction(advance.events.onSaveCallback, {
|
|
244
|
+
success: success,
|
|
245
|
+
mainKey: mainKey,
|
|
246
|
+
res: res
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
var onValueChange = useMemoizedFn(function (change, data) {
|
|
250
|
+
ctx.doAction(advance.events.onValueChange, {
|
|
251
|
+
change: change,
|
|
252
|
+
data: data
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
var onChildChange = useMemoizedFn(function (instance) {
|
|
256
|
+
ctx.doAction(advance.events.onChildChange, {
|
|
257
|
+
instance: instance
|
|
258
|
+
});
|
|
103
259
|
});
|
|
104
260
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
105
261
|
id: id,
|
|
106
262
|
displayName: "Form",
|
|
107
|
-
getTargetDom: getTargetDom
|
|
263
|
+
getTargetDom: getTargetDom,
|
|
264
|
+
api: apiRef
|
|
108
265
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
266
|
ref: boxRef,
|
|
110
267
|
style: {
|
|
@@ -116,10 +273,24 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
116
273
|
ldId: id,
|
|
117
274
|
className: classNames(styles['lc-component-form'], _defineProperty({}, className, !!className)),
|
|
118
275
|
renderFormList: renderFormList,
|
|
276
|
+
renderFormExtra: renderFormExtra,
|
|
119
277
|
mainFormLdId: "block_main",
|
|
120
278
|
initData: initData,
|
|
121
|
-
ref: ref,
|
|
122
|
-
readOnly: readOnly
|
|
279
|
+
ref: ref || formRef,
|
|
280
|
+
readOnly: readOnly,
|
|
281
|
+
showSaveBtn: showSave,
|
|
282
|
+
saveBtnTitle: saveTitle,
|
|
283
|
+
affixLayout: settingLayout,
|
|
284
|
+
renderAffixLeft: function renderAffixLeft() {
|
|
285
|
+
return renderAffix(renderFormLeft);
|
|
286
|
+
},
|
|
287
|
+
renderAffixRight: function renderAffixRight() {
|
|
288
|
+
return renderAffix(renderFormRight);
|
|
289
|
+
},
|
|
290
|
+
beforeSubmit: beforeSubmit,
|
|
291
|
+
afterSubmit: advance.events.onSaveCallback ? afterSubmit : null,
|
|
292
|
+
onValueChange: onValueChange,
|
|
293
|
+
onChildChange: onChildChange
|
|
123
294
|
})));
|
|
124
295
|
});
|
|
125
296
|
LCForm.defaultProps = omitBadProps(defaultMeta);
|
|
@@ -94,7 +94,8 @@
|
|
|
94
94
|
"serialEffect": "disable",
|
|
95
95
|
"mode": ["add", "update", "edit", "info"],
|
|
96
96
|
"cols": 4,
|
|
97
|
-
"readOnly": false
|
|
97
|
+
"readOnly": false,
|
|
98
|
+
"order": 1
|
|
98
99
|
}
|
|
99
100
|
],
|
|
100
101
|
"wrapper": "hidden",
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
"key": "fields",
|
|
112
113
|
"name": "#字段配置器",
|
|
113
114
|
"type": "_FieldsSetting",
|
|
114
|
-
"component": "
|
|
115
|
+
"component": "form"
|
|
115
116
|
}
|
|
116
117
|
]
|
|
117
118
|
}
|
|
@@ -195,7 +196,6 @@
|
|
|
195
196
|
"table": {
|
|
196
197
|
"readOnly": false,
|
|
197
198
|
"suppressPreset": false,
|
|
198
|
-
"width": "100%",
|
|
199
199
|
"height": "100%",
|
|
200
200
|
"bordered": false,
|
|
201
201
|
"popTitleKey": "title",
|
|
@@ -207,12 +207,11 @@
|
|
|
207
207
|
"uploadForm": {
|
|
208
208
|
"readOnly": false,
|
|
209
209
|
"suppressPreset": false,
|
|
210
|
-
"
|
|
211
|
-
"height": "100%",
|
|
210
|
+
"height": "300px",
|
|
212
211
|
"bordered": false,
|
|
213
212
|
"showNote": false,
|
|
214
213
|
"zipName": "download",
|
|
215
|
-
"useResetActions":
|
|
214
|
+
"useResetActions": false
|
|
216
215
|
}
|
|
217
216
|
},
|
|
218
217
|
"next": {
|
|
@@ -305,7 +304,8 @@
|
|
|
305
304
|
{
|
|
306
305
|
"key": "actionsColumnWidth",
|
|
307
306
|
"name": "列宽",
|
|
308
|
-
"type": "
|
|
307
|
+
"type": "_ActionsColumnWidth",
|
|
308
|
+
"convertInt": true,
|
|
309
309
|
"options": [{ "label": "px", "value": "px" }]
|
|
310
310
|
},
|
|
311
311
|
{
|
|
@@ -415,13 +415,14 @@
|
|
|
415
415
|
{
|
|
416
416
|
"key": "actionsColumnWidth",
|
|
417
417
|
"name": "列宽",
|
|
418
|
-
"type": "
|
|
418
|
+
"type": "_ActionsColumnWidth",
|
|
419
|
+
"convertInt": true,
|
|
419
420
|
"options": [{ "label": "px", "value": "px" }]
|
|
420
421
|
},
|
|
421
422
|
{
|
|
422
423
|
"key": "actionsColumnReset",
|
|
423
|
-
"name": "
|
|
424
|
-
"desc": "
|
|
424
|
+
"name": "重写操作列",
|
|
425
|
+
"desc": "重写操作列",
|
|
425
426
|
"type": "_JSEditor",
|
|
426
427
|
"defaultCode": "function actionsColumnReset(data, index, actions, params) { \n \t \n}",
|
|
427
428
|
"mustConfirm": true,
|
|
@@ -477,21 +478,11 @@
|
|
|
477
478
|
"name": "只读",
|
|
478
479
|
"type": "switch"
|
|
479
480
|
},
|
|
480
|
-
{
|
|
481
|
-
"key": "colWidth",
|
|
482
|
-
"name": "默认列长度",
|
|
483
|
-
"type": "number"
|
|
484
|
-
},
|
|
485
481
|
{
|
|
486
482
|
"key": "suppressPreset",
|
|
487
483
|
"name": "关闭预设",
|
|
488
484
|
"type": "switch"
|
|
489
485
|
},
|
|
490
|
-
{
|
|
491
|
-
"key": "width",
|
|
492
|
-
"name": "宽度",
|
|
493
|
-
"type": "_WidthHeight"
|
|
494
|
-
},
|
|
495
486
|
{
|
|
496
487
|
"key": "height",
|
|
497
488
|
"name": "高度",
|
|
@@ -527,7 +518,7 @@
|
|
|
527
518
|
"key": "resetActions",
|
|
528
519
|
"name": "自定义操作列",
|
|
529
520
|
"type": "_JSEditor",
|
|
530
|
-
"defaultCode": "function resetActions(data, index, actionList, params) { \n\
|
|
521
|
+
"defaultCode": "function resetActions(data, index, actionList, params) { \n return actionList; \n}",
|
|
531
522
|
"mustConfirm": true,
|
|
532
523
|
"wrapper": "collapse",
|
|
533
524
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -571,25 +562,37 @@
|
|
|
571
562
|
"key": "onMount",
|
|
572
563
|
"name": "组件首次渲染时",
|
|
573
564
|
"desc": "在组件首次渲染时,执行方法",
|
|
574
|
-
"func": "(
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
"key": "onUnmount",
|
|
578
|
-
"name": "组件卸载时",
|
|
579
|
-
"desc": "在组件卸载时,执行方法。",
|
|
580
|
-
"func": "(params)=>{\n\t\n}"
|
|
565
|
+
"func": "(instance)=>{\n\t\n}"
|
|
581
566
|
},
|
|
582
567
|
{
|
|
583
568
|
"key": "beforeSave",
|
|
584
569
|
"name": "保存前置事件",
|
|
585
570
|
"desc": "保存前置事件,promise,返回false取消执行",
|
|
586
|
-
"func": "(
|
|
571
|
+
"func": "(values, data) => {\n return values; \n}"
|
|
587
572
|
},
|
|
588
573
|
{
|
|
589
574
|
"key": "onSaveCallback",
|
|
590
575
|
"name": "保存后回调",
|
|
591
576
|
"desc": "保存后回调事件",
|
|
592
|
-
"func": "(
|
|
577
|
+
"func": "(success, mainKey, res)=>{\n\t\n}"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"key": "onUnmount",
|
|
581
|
+
"name": "组件卸载时",
|
|
582
|
+
"desc": "在组件卸载时,执行方法",
|
|
583
|
+
"func": "(instance)=>{\n\t\n}"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"key": "onValueChange",
|
|
587
|
+
"name": "参数变化的事件",
|
|
588
|
+
"desc": "参数变化时,执行方法",
|
|
589
|
+
"func": "(change, data)=>{\n\t\n}"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"key": "onChildChange",
|
|
593
|
+
"name": "表单内容发生改变时的回调",
|
|
594
|
+
"desc": "表单内容发生改变时的回调",
|
|
595
|
+
"func": "(instance)=>{\n\t\n}"
|
|
593
596
|
}
|
|
594
597
|
]
|
|
595
598
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"key": "title",
|
|
73
73
|
"name": "标题",
|
|
74
74
|
"desc": "图片html原生title",
|
|
75
|
-
"type": "
|
|
75
|
+
"type": "_I18nInput"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"key": "alt",
|
|
79
79
|
"name": "替代文本",
|
|
80
80
|
"desc": "图片加载失败的占位文字",
|
|
81
|
-
"type": "
|
|
81
|
+
"type": "_I18nInput"
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"key": "preview",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|