@luck-design-biz/luckda 1.0.6-13tl → 1.0.7
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/components/Builder/index.js +37 -27
- package/es/components/ComplexItem/index.js +5 -3
- package/es/components/ComplexItem/service.js +6 -3
- package/es/components/LdAutoForm/index.js +25 -12
- package/es/components/LdCard/index.js +10 -8
- package/es/components/LdCom/index.js +3 -2
- package/es/components/LdFormList/index.js +5 -4
- package/es/components/LdGrid/index.js +29 -20
- package/es/components/LdGridForm/index.js +16 -7
- package/es/components/LdInfoPanel/index.js +16 -10
- package/es/helper/FromItems.js +64 -5
- package/es/helper/form.js +8 -2
- package/es/helper/ldBuilder.js +9 -5
- package/es/helper/ldComBuild.js +16 -11
- package/es/locales/zh-CN.js +40 -4
- package/es/lowcode/constants/api-url.js +202 -175
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/constants/index.js +5 -4
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/es/lowcode/engine/meta/fielddate.props.json +48 -0
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +5 -0
- package/es/lowcode/engine/meta/pagecomponent.props.default.json +8 -0
- package/es/lowcode/engine/meta/pagecomponent.props.json +41 -0
- package/es/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/es/lowcode/engine/meta/proxy.props.json +66 -0
- package/es/lowcode/engine/provider/ContextProvider/index.js +45 -9
- package/es/lowcode/engine/provider/ContextProvider/usePageDataStore.js +36 -30
- package/es/lowcode/engine/provider/ContextProvider/usePageVar.js +11 -5
- package/es/lowcode/engine/provider/ContextProvider/useTodo.js +2 -4
- package/es/lowcode/engine/provider/EventBusProvider.js +14 -4
- package/es/lowcode/engine/provider/PageProxyProvider.js +95 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +10 -12
- package/es/lowcode/engine/tools/helper.js +44 -5
- package/es/lowcode/engine/tools/initDS.js +4 -4
- package/es/lowcode/painter/Design.js +1 -0
- package/es/lowcode/painter/DesignOperator.js +129 -27
- package/es/lowcode/painter/DesignToolbar.js +88 -173
- package/es/lowcode/painter/components/AdvancePanel.js +28 -10
- package/es/lowcode/painter/components/TipIcon.js +12 -4
- package/es/lowcode/painter/components/field-setting/SettingUI.js +56 -4
- package/es/lowcode/painter/components/field-setting/index.js +24 -1
- package/es/lowcode/painter/components/shortcut-modal/KeyIcon.js +11 -0
- package/es/lowcode/painter/components/shortcut-modal/index.js +208 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +10 -19
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +4 -1
- package/es/lowcode/painter/panel-section/ConditionCheck.js +0 -1
- package/es/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/es/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +2 -1
- package/es/lowcode/painter/panel-section/JSEditor/ToolBar.js +7 -4
- package/es/lowcode/painter/panel-section/JSEditor/index.js +15 -5
- package/es/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/es/lowcode/painter/panel-section/ProxyLinker.js +137 -0
- package/es/lowcode/painter/panel-section/ProxyParams.js +28 -0
- package/es/lowcode/painter/panel-section/ProxyParamsSetter.js +240 -0
- package/es/lowcode/painter/style/panel-item.less +1 -0
- package/es/lowcode/preview/DebugTool.js +78 -0
- package/es/lowcode/preview/DebugToolDetail.js +103 -0
- package/es/lowcode/preview/index.js +10 -17
- package/es/lowcode/preview/useDebugSettings.js +62 -0
- package/es/lowcode/view/Canvas.js +5 -1
- package/es/lowcode/view/Page.js +8 -3
- package/es/lowcode/view/lc-components/CardList/index.js +3 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +9 -7
- package/es/lowcode/view/lc-components/Drawer/index.js +2 -0
- package/es/lowcode/view/lc-components/FieldDate/meta.json +48 -0
- package/es/lowcode/view/lc-components/Form/index.js +3 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionDesign.js +17 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionLive.js +23 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionPreview.js +23 -0
- package/es/lowcode/view/lc-components/Proxy/index.js +42 -0
- package/es/lowcode/view/lc-components/Proxy/index.less +5 -0
- package/es/lowcode/view/lc-components/Proxy/meta.json +66 -0
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +5 -23
- package/es/lowcode/view/lc-components/Table/index.js +12 -6
- package/es/lowcode/view/lc-components/Tabs/index.js +6 -2
- package/es/lowcode/view/lc-components/Tree/index.js +3 -0
- package/es/lowcode/view/lc-components/Wrapper.js +7 -1
- package/es/services.js +25 -7
- package/es/utils/action.js +3 -2
- package/es/utils/form.js +37 -4
- package/es/utils/grid.js +2 -1
- package/lib/components/Builder/index.js +36 -26
- package/lib/components/ComplexItem/index.js +5 -3
- package/lib/components/ComplexItem/service.js +6 -3
- package/lib/components/LdAutoForm/index.js +22 -9
- package/lib/components/LdCard/index.js +10 -8
- package/lib/components/LdCom/index.js +3 -2
- package/lib/components/LdFormList/index.js +4 -3
- package/lib/components/LdGrid/index.js +29 -20
- package/lib/components/LdGridForm/index.js +13 -4
- package/lib/components/LdInfoPanel/index.js +15 -9
- package/lib/helper/FromItems.js +64 -5
- package/lib/helper/form.js +8 -2
- package/lib/helper/ldBuilder.js +8 -5
- package/lib/helper/ldComBuild.js +14 -9
- package/lib/locales/zh-CN.js +40 -4
- package/lib/lowcode/constants/api-url.js +204 -175
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/constants/index.js +6 -5
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +48 -0
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +5 -0
- package/lib/lowcode/engine/meta/pagecomponent.props.default.json +8 -0
- package/lib/lowcode/engine/meta/pagecomponent.props.json +41 -0
- package/lib/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/lib/lowcode/engine/meta/proxy.props.json +66 -0
- package/lib/lowcode/engine/provider/ContextProvider/index.js +50 -13
- package/lib/lowcode/engine/provider/ContextProvider/usePageDataStore.js +37 -31
- package/lib/lowcode/engine/provider/ContextProvider/usePageVar.js +10 -4
- package/lib/lowcode/engine/provider/ContextProvider/useTodo.js +1 -3
- package/lib/lowcode/engine/provider/EventBusProvider.js +14 -4
- package/lib/lowcode/engine/provider/PageProxyProvider.js +103 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +10 -12
- package/lib/lowcode/engine/tools/helper.js +44 -4
- package/lib/lowcode/engine/tools/initDS.js +4 -4
- package/lib/lowcode/painter/Design.js +1 -0
- package/lib/lowcode/painter/DesignOperator.js +126 -24
- package/lib/lowcode/painter/DesignToolbar.js +84 -169
- package/lib/lowcode/painter/components/AdvancePanel.js +27 -9
- package/lib/lowcode/painter/components/TipIcon.js +12 -4
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +55 -3
- package/lib/lowcode/painter/components/field-setting/index.js +24 -1
- package/lib/lowcode/painter/components/shortcut-modal/KeyIcon.js +18 -0
- package/lib/lowcode/painter/components/shortcut-modal/index.js +215 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +9 -18
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +4 -1
- package/lib/lowcode/painter/panel-section/ConditionCheck.js +0 -1
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +2 -1
- package/lib/lowcode/painter/panel-section/JSEditor/ToolBar.js +7 -4
- package/lib/lowcode/painter/panel-section/JSEditor/index.js +14 -4
- package/lib/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/lib/lowcode/painter/panel-section/ProxyLinker.js +145 -0
- package/lib/lowcode/painter/panel-section/ProxyParams.js +35 -0
- package/lib/lowcode/painter/panel-section/ProxyParamsSetter.js +248 -0
- package/lib/lowcode/painter/style/panel-item.less +1 -0
- package/lib/lowcode/preview/DebugTool.js +86 -0
- package/lib/lowcode/preview/DebugToolDetail.js +111 -0
- package/lib/lowcode/preview/index.js +10 -18
- package/lib/lowcode/preview/useDebugSettings.js +69 -0
- package/lib/lowcode/view/Canvas.js +5 -1
- package/lib/lowcode/view/Page.js +8 -3
- package/lib/lowcode/view/lc-components/CardList/index.js +3 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +9 -7
- package/lib/lowcode/view/lc-components/Drawer/index.js +2 -0
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +48 -0
- package/lib/lowcode/view/lc-components/Form/index.js +3 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionDesign.js +24 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionLive.js +30 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionPreview.js +30 -0
- package/lib/lowcode/view/lc-components/Proxy/index.js +50 -0
- package/lib/lowcode/view/lc-components/Proxy/index.less +5 -0
- package/lib/lowcode/view/lc-components/Proxy/meta.json +66 -0
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +4 -22
- package/lib/lowcode/view/lc-components/Table/index.js +12 -6
- package/lib/lowcode/view/lc-components/Tabs/index.js +5 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +3 -0
- package/lib/lowcode/view/lc-components/Wrapper.js +6 -0
- package/lib/services.js +26 -7
- package/lib/utils/action.js +6 -0
- package/lib/utils/form.js +38 -4
- package/lib/utils/grid.js +2 -1
- package/package.json +1 -1
- package/es/lowcode/engine/meta/button.api.json +0 -0
- package/lib/lowcode/engine/meta/button.api.json +0 -0
|
@@ -9,11 +9,12 @@ import { formatMessage } from '@luck-design-biz/base/utils';
|
|
|
9
9
|
import { META_TAG_NAME, LC_RUNTIME_KEY } from "../../lowcode/constants";
|
|
10
10
|
import { setMetaAttrs } from "../../lowcode/engine/tools/helper";
|
|
11
11
|
import LdPop from "../LdPop";
|
|
12
|
-
import { readModlue, noAuthTransformCode } from "../../services";
|
|
12
|
+
import { readModlue, noAuthTransformCode, readUI } from "../../services";
|
|
13
13
|
import { doAction as doActionUtils } from "../../helper/action";
|
|
14
14
|
export var LuckDaContext = /*#__PURE__*/createContext();
|
|
15
|
-
export var useLDCtx = function useLDCtx() {
|
|
16
|
-
|
|
15
|
+
export var useLDCtx = function useLDCtx(pageProxy) {
|
|
16
|
+
var ctx = useContext(LuckDaContext);
|
|
17
|
+
return ctx[(pageProxy === null || pageProxy === void 0 ? void 0 : pageProxy.proxyCode) || 'master'];
|
|
17
18
|
};
|
|
18
19
|
var builder = function builder(WrappedComponent, moduleCode) {
|
|
19
20
|
var Component = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -43,21 +44,28 @@ var builder = function builder(WrappedComponent, moduleCode) {
|
|
|
43
44
|
var _useRequest = useRequest(readModlue, {
|
|
44
45
|
defaultParams: [{
|
|
45
46
|
moduleCode: moduleCode
|
|
46
|
-
}]
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
isTree: data.isTree || [],
|
|
55
|
-
resources: data.resources || []
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
47
|
+
}]
|
|
48
|
+
}),
|
|
49
|
+
loading = _useRequest.loading,
|
|
50
|
+
moduleResult = _useRequest.data;
|
|
51
|
+
var _useRequest2 = useRequest(readUI, {
|
|
52
|
+
defaultParams: [{
|
|
53
|
+
moduleCode: moduleCode
|
|
54
|
+
}]
|
|
59
55
|
}),
|
|
60
|
-
|
|
56
|
+
loading1 = _useRequest2.loading,
|
|
57
|
+
uiResult = _useRequest2.data;
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
if (!loading && !loading1 && (moduleResult === null || moduleResult === void 0 ? void 0 : moduleResult.code) === 1 && (uiResult === null || uiResult === void 0 ? void 0 : uiResult.code) === 1) {
|
|
60
|
+
setModuleData({
|
|
61
|
+
actions: moduleResult.data.actions || {},
|
|
62
|
+
dataSets: moduleResult.data.dataSets || {},
|
|
63
|
+
isTree: moduleResult.data.isTree || [],
|
|
64
|
+
resources: moduleResult.data.resources || [],
|
|
65
|
+
moduleUiList: uiResult.data.moduleUiList || {}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, [loading, loading1, moduleResult, uiResult]);
|
|
61
69
|
var openPop = useMemoizedFn(function (ldId, params) {
|
|
62
70
|
setPops(function (prev) {
|
|
63
71
|
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, ldId, _objectSpread(_objectSpread({}, prev[ldId]), params)));
|
|
@@ -107,8 +115,8 @@ var builder = function builder(WrappedComponent, moduleCode) {
|
|
|
107
115
|
var _props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
108
116
|
fieldProps.current = _objectSpread(_objectSpread({}, fieldProps.current), _props);
|
|
109
117
|
};
|
|
110
|
-
if (loading) return null;
|
|
111
|
-
if (!moduleData) return formatMessage({
|
|
118
|
+
if (loading || loading1) return null;
|
|
119
|
+
if (!moduleData) if (!moduleData) return formatMessage({
|
|
112
120
|
id: 'luckda.module.loadFailed',
|
|
113
121
|
label: '模块信息加载失败'
|
|
114
122
|
});
|
|
@@ -117,14 +125,16 @@ var builder = function builder(WrappedComponent, moduleCode) {
|
|
|
117
125
|
label: '模块缺少数据集'
|
|
118
126
|
});
|
|
119
127
|
return /*#__PURE__*/React.createElement(LuckDaContext.Provider, {
|
|
120
|
-
value:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
value: {
|
|
129
|
+
master: _objectSpread(_objectSpread({}, moduleData), {}, {
|
|
130
|
+
doAction: doAction,
|
|
131
|
+
openPop: openPop,
|
|
132
|
+
closePop: closePop,
|
|
133
|
+
readFieldProps: readFieldProps,
|
|
134
|
+
setFieldProps: setFieldProps,
|
|
135
|
+
moduleCode: moduleCode
|
|
136
|
+
})
|
|
137
|
+
}
|
|
128
138
|
}, /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
|
129
139
|
ref: ref
|
|
130
140
|
}, moduleData || {}, {
|
|
@@ -42,7 +42,7 @@ var Index = function Index(_ref) {
|
|
|
42
42
|
keyName: keyField,
|
|
43
43
|
titleKey: "title",
|
|
44
44
|
api: ( /*#__PURE__*/function () {
|
|
45
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(get) {
|
|
45
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(get, post) {
|
|
46
46
|
var res, formatData, detail;
|
|
47
47
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
48
48
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -51,7 +51,9 @@ var Index = function Index(_ref) {
|
|
|
51
51
|
return fetchContent(dataModel, _objectSpread({
|
|
52
52
|
datasetCode: dataSetCode,
|
|
53
53
|
moduleCode: moduleCode
|
|
54
|
-
}, get)
|
|
54
|
+
}, get), {
|
|
55
|
+
_AutoFilter: post
|
|
56
|
+
});
|
|
55
57
|
case 2:
|
|
56
58
|
res = _context.sent;
|
|
57
59
|
formatData = (res === null || res === void 0 ? void 0 : res.data.map(function (i) {
|
|
@@ -72,7 +74,7 @@ var Index = function Index(_ref) {
|
|
|
72
74
|
}
|
|
73
75
|
}, _callee);
|
|
74
76
|
}));
|
|
75
|
-
return function (_x) {
|
|
77
|
+
return function (_x, _x2) {
|
|
76
78
|
return _ref2.apply(this, arguments);
|
|
77
79
|
};
|
|
78
80
|
}()),
|
|
@@ -4,18 +4,21 @@ import { stringify } from 'qs';
|
|
|
4
4
|
import { request } from '@luck-design-biz/base/utils';
|
|
5
5
|
import api from "@/services/ApiConfig";
|
|
6
6
|
export var fetchContent = /*#__PURE__*/function () {
|
|
7
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dmCode, get) {
|
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dmCode, get, post) {
|
|
8
8
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9
9
|
while (1) switch (_context.prev = _context.next) {
|
|
10
10
|
case 0:
|
|
11
|
-
return _context.abrupt("return", request("".concat(api.API_HOST, "/").concat(dmCode, "/ui/builder/complex/noAuthFetchContent?").concat(stringify(get))
|
|
11
|
+
return _context.abrupt("return", request("".concat(api.API_HOST, "/").concat(dmCode, "/ui/builder/complex/noAuthFetchContent?").concat(stringify(get)), {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: post
|
|
14
|
+
}));
|
|
12
15
|
case 1:
|
|
13
16
|
case "end":
|
|
14
17
|
return _context.stop();
|
|
15
18
|
}
|
|
16
19
|
}, _callee);
|
|
17
20
|
}));
|
|
18
|
-
return function fetchContent(_x, _x2) {
|
|
21
|
+
return function fetchContent(_x, _x2, _x3) {
|
|
19
22
|
return _ref.apply(this, arguments);
|
|
20
23
|
};
|
|
21
24
|
}();
|
|
@@ -2,14 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData", "relationKey", "fields", "setVerifyRules"];
|
|
6
|
-
import React, { createRef
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "uiSettings", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData", "relationKey", "fields", "setVerifyRules", "pageProxy"];
|
|
6
|
+
import React, { createRef } from 'react';
|
|
7
7
|
import { reduce, keyBy, isEmpty, pick, union, omit, forEach, debounce, isNil } from 'lodash';
|
|
8
8
|
import { BasicDivider } from 'luck-design';
|
|
9
9
|
import { AutoForm } from '@luck-design-biz/base/FormList';
|
|
10
10
|
import ldBuilder from "../../helper/ldBuilder";
|
|
11
|
-
import { getFormItem, formItemDataFormat, dataFormat, behaviorCall } from "../../utils";
|
|
12
|
-
import {
|
|
11
|
+
import { getFormItem, formItemDataFormat, dataFormat, behaviorCall, mergeAndSort } from "../../utils";
|
|
12
|
+
import { useLDCtx } from "../Builder";
|
|
13
13
|
var didMount = false;
|
|
14
14
|
var debounceFunc = debounce(function (fields, changedValues, allValues, props) {
|
|
15
15
|
forEach(changedValues, function (val, key) {
|
|
@@ -31,6 +31,8 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
31
31
|
actions = _ref$actions === void 0 ? {} : _ref$actions,
|
|
32
32
|
_ref$doAction = _ref.doAction,
|
|
33
33
|
doAction = _ref$doAction === void 0 ? function () {} : _ref$doAction,
|
|
34
|
+
_ref$uiSettings = _ref.uiSettings,
|
|
35
|
+
uiSettings = _ref$uiSettings === void 0 ? {} : _ref$uiSettings,
|
|
34
36
|
ldId = _ref.ldId,
|
|
35
37
|
dataSetKey = _ref.dataSetKey,
|
|
36
38
|
_ref$filedsRewrite = _ref.filedsRewrite,
|
|
@@ -57,14 +59,21 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
57
59
|
_ref$fields = _ref.fields,
|
|
58
60
|
fields = _ref$fields === void 0 ? [] : _ref$fields,
|
|
59
61
|
setVerifyRules = _ref.setVerifyRules,
|
|
62
|
+
pageProxy = _ref.pageProxy,
|
|
60
63
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
61
|
-
var _ref2 =
|
|
64
|
+
var _ref2 = useLDCtx(pageProxy) || {},
|
|
62
65
|
setFieldProps = _ref2.setFieldProps;
|
|
63
66
|
var defaultValues = /*#__PURE__*/createRef({});
|
|
64
67
|
var isMain = ldId === mainFormLdId;
|
|
65
|
-
var
|
|
68
|
+
var formPreset = uiSettings && uiSettings.form && uiSettings.form[0] && uiSettings.form[0].preset ? JSON.parse(uiSettings.form[0].preset) : {};
|
|
69
|
+
var basicItems = function (_formPreset$formField) {
|
|
66
70
|
var fieldsObj = keyBy(fields, 'field');
|
|
67
|
-
var
|
|
71
|
+
var mergedArray = mergeAndSort(columns, formPreset.formFieldPreset || [], 'aliaName');
|
|
72
|
+
var columnsObj = keyBy(mergedArray, 'aliaName');
|
|
73
|
+
var fieldPresetMap = reduce((_formPreset$formField = formPreset.formFieldPreset) !== null && _formPreset$formField !== void 0 ? _formPreset$formField : [], function (ret, _item) {
|
|
74
|
+
ret[_item.aliasName] = _item;
|
|
75
|
+
return ret;
|
|
76
|
+
}, {});
|
|
68
77
|
var keys = isEmpty(fields) ? Object.keys(columnsObj) : union(Object.keys(fieldsObj), Object.keys(columnsObj));
|
|
69
78
|
var _defaultValues = {};
|
|
70
79
|
var _nodes = reduce(keys, function (result, key) {
|
|
@@ -76,6 +85,7 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
76
85
|
key: key
|
|
77
86
|
}));
|
|
78
87
|
} else if (col !== null && col !== void 0 && col.isShowInForm && (isNil(setting) || setting !== null && setting !== void 0 && setting.isShow)) {
|
|
88
|
+
var _fieldPresetMap$col$a;
|
|
79
89
|
var customFiled = filedsRewrite.find(function (_field) {
|
|
80
90
|
return _field.name === col.aliaName;
|
|
81
91
|
}) || {};
|
|
@@ -85,6 +95,8 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
85
95
|
setVerifyRules: setVerifyRules,
|
|
86
96
|
fieldName: (setting === null || setting === void 0 ? void 0 : setting.fieldAliasName) || col.fieldName
|
|
87
97
|
}, pick(setting, defaultSet));
|
|
98
|
+
// 该字段配置的表单显示信息
|
|
99
|
+
var colUiData = (_fieldPresetMap$col$a = fieldPresetMap[col.aliaName]) !== null && _fieldPresetMap$col$a !== void 0 ? _fieldPresetMap$col$a : {};
|
|
88
100
|
result.push(getFormItem(newCol, _objectSpread(_objectSpread({
|
|
89
101
|
formId: ldId,
|
|
90
102
|
moduleCode: moduleCode
|
|
@@ -92,8 +104,8 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
92
104
|
handleValueChange: function handleValueChange(value) {
|
|
93
105
|
return onValueChange(_defineProperty({}, ldId, _defineProperty({}, col.aliaName, value)));
|
|
94
106
|
},
|
|
95
|
-
setting: omit(setting, [].concat(defaultSet, ['uid', 'field']))
|
|
96
|
-
})));
|
|
107
|
+
setting: omit(setting, [].concat(defaultSet, ['uid', 'field', 'aliaName']))
|
|
108
|
+
}), colUiData));
|
|
97
109
|
}
|
|
98
110
|
return result;
|
|
99
111
|
}, []);
|
|
@@ -109,8 +121,9 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
109
121
|
formId: ldId,
|
|
110
122
|
isMain: isMain,
|
|
111
123
|
defaultDataSource: _objectSpread(_objectSpread({}, formItemDataFormat(columns.map(function (c) {
|
|
112
|
-
return _objectSpread(_objectSpread({}, c), keyBy(fields, 'field')[c.
|
|
113
|
-
}), defaultValues.current)), defaultDataSourceFormat(defaultValues.current))
|
|
124
|
+
return _objectSpread(_objectSpread({}, c), keyBy(fields, 'field')[c.aliaName]);
|
|
125
|
+
}), defaultValues.current)), defaultDataSourceFormat(defaultValues.current)),
|
|
126
|
+
col: formPreset.formCol
|
|
114
127
|
};
|
|
115
128
|
var onOperate = function onOperate() {
|
|
116
129
|
var _onOperate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -158,7 +171,7 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
158
171
|
}, onQuery), {}, {
|
|
159
172
|
format: function format(data, res) {
|
|
160
173
|
var formItemData = _objectSpread({}, formItemDataFormat(columns.map(function (c) {
|
|
161
|
-
return _objectSpread(_objectSpread({}, c), keyBy(fields, 'field')[c.
|
|
174
|
+
return _objectSpread(_objectSpread({}, c), keyBy(fields, 'field')[c.aliaName]);
|
|
162
175
|
}), data));
|
|
163
176
|
if (onQuery !== null && onQuery !== void 0 && onQuery.format) return onQuery.format(data, formItemData, res); // 以预设为主
|
|
164
177
|
return formItemData;
|
|
@@ -104,11 +104,13 @@ var LdCard = function LdCard(_ref2) {
|
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
},
|
|
107
|
-
onLdQuery: function onLdQuery() {
|
|
108
|
-
var
|
|
109
|
-
doQuery({
|
|
107
|
+
onLdQuery: function onLdQuery(_params) {
|
|
108
|
+
var _getDvaApp2;
|
|
109
|
+
if (_params) doQuery({
|
|
110
110
|
params: _params,
|
|
111
111
|
callback: afterInit
|
|
112
|
+
});else (_getDvaApp2 = getDvaApp()) === null || _getDvaApp2 === void 0 || _getDvaApp2._store.dispatch({
|
|
113
|
+
type: "".concat(namespace, "/doQuery")
|
|
112
114
|
});
|
|
113
115
|
}
|
|
114
116
|
});
|
|
@@ -220,11 +222,11 @@ var LdIndex = function LdIndex(_ref4) {
|
|
|
220
222
|
label: '此数据集为树形数据集,请选择非树形数据集'
|
|
221
223
|
});
|
|
222
224
|
var Component = useCreation(function () {
|
|
223
|
-
var
|
|
224
|
-
(
|
|
225
|
-
if (!((
|
|
226
|
-
var
|
|
227
|
-
(
|
|
225
|
+
var _getDvaApp3, _getDvaApp4;
|
|
226
|
+
(_getDvaApp3 = getDvaApp()) === null || _getDvaApp3 === void 0 || _getDvaApp3.unmodel(namespace);
|
|
227
|
+
if (!((_getDvaApp4 = getDvaApp()) !== null && _getDvaApp4 !== void 0 && _getDvaApp4._store.getState()[namespace])) {
|
|
228
|
+
var _getDvaApp5;
|
|
229
|
+
(_getDvaApp5 = getDvaApp()) === null || _getDvaApp5 === void 0 || _getDvaApp5.model(createModel(namespace, _objectSpread(_objectSpread({
|
|
228
230
|
isFlow: !!props.isFlow
|
|
229
231
|
}, overModel), {}, {
|
|
230
232
|
dataSetKey: props.dataSetKey,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["options"];
|
|
3
|
+
var _excluded = ["options", "pageProxy"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Button, Tabs } from 'luck-design/antd';
|
|
6
6
|
import { Collapse, ButtonRadio } from '@luck-design-biz/base';
|
|
@@ -11,9 +11,10 @@ export var LdCollapse = ldComBuilder(Collapse);
|
|
|
11
11
|
export var LdButtonRadio = function LdButtonRadio(_ref) {
|
|
12
12
|
var _ref$options = _ref.options,
|
|
13
13
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
14
|
+
pageProxy = _ref.pageProxy,
|
|
14
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
16
|
return /*#__PURE__*/React.createElement(ButtonRadio, _extends({}, props, {
|
|
16
|
-
options: filterOptions(options)
|
|
17
|
+
options: filterOptions(options, pageProxy)
|
|
17
18
|
}));
|
|
18
19
|
};
|
|
19
20
|
export var LdIconFont = ldComBuilder(IconFont);
|
|
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
9
|
-
var _excluded = ["namespace", "formState", "formMode", "formOperates", "loading", "apiRef", "wrapperRef", "readOnly", "mainFormLdId", "renderFormList", "renderAffixLeft", "renderAffixRight", "beforeSubmit", "showSaveBtn", "saveBtnTitle", "affixLayout", "getContainer", "onValueChange", "afterSubmit", "renderFormExtra", "bpmButtonProps", "setVerifyRules", "afterSubmitLoading", "validateErrorCallback", "showConfigBtn", "affixBarZIndex"],
|
|
9
|
+
var _excluded = ["namespace", "formState", "formMode", "formOperates", "loading", "apiRef", "wrapperRef", "pageProxy", "readOnly", "mainFormLdId", "renderFormList", "renderAffixLeft", "renderAffixRight", "beforeSubmit", "showSaveBtn", "saveBtnTitle", "affixLayout", "getContainer", "onValueChange", "afterSubmit", "renderFormExtra", "bpmButtonProps", "setVerifyRules", "afterSubmitLoading", "validateErrorCallback", "showConfigBtn", "affixBarZIndex"],
|
|
10
10
|
_excluded2 = ["dataSets", "doAction", "resources"],
|
|
11
11
|
_excluded3 = ["id", "header", "title", "readOnly", "extraConfig", "renderTopLeft", "serial"],
|
|
12
12
|
_excluded4 = ["ldId", "initData", "overModel"];
|
|
@@ -22,7 +22,7 @@ import { FormList, FormListAffix, FormBtn } from '@luck-design-biz/base/FormList
|
|
|
22
22
|
import buildLdAutoForm from "../LdAutoForm";
|
|
23
23
|
import buildLdGridForm from "../LdGridForm";
|
|
24
24
|
import { Collapse } from '@luck-design-biz/base';
|
|
25
|
-
import {
|
|
25
|
+
import { useLDCtx } from "../Builder";
|
|
26
26
|
import { LuckDaPopContext } from "../LdPop";
|
|
27
27
|
import createModel from "./model";
|
|
28
28
|
import { onBatchSubmitAction } from "../../helper/action";
|
|
@@ -38,6 +38,7 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
38
38
|
loading = _ref.loading,
|
|
39
39
|
apiRef = _ref.apiRef,
|
|
40
40
|
wrapperRef = _ref.wrapperRef,
|
|
41
|
+
pageProxy = _ref.pageProxy,
|
|
41
42
|
readOnly = _ref.readOnly,
|
|
42
43
|
mainFormLdId = _ref.mainFormLdId,
|
|
43
44
|
renderFormList = _ref.renderFormList,
|
|
@@ -83,7 +84,7 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
83
84
|
}, []);
|
|
84
85
|
var _ref2 = useContext(LuckDaPopContext) || {},
|
|
85
86
|
defaultLayout = _ref2.affixLayout;
|
|
86
|
-
var _ref3 =
|
|
87
|
+
var _ref3 = useLDCtx(pageProxy) || {},
|
|
87
88
|
dataSets = _ref3.dataSets,
|
|
88
89
|
doAction = _ref3.doAction,
|
|
89
90
|
resources = _ref3.resources,
|
|
@@ -292,7 +293,7 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
292
293
|
getContainer: getContainer
|
|
293
294
|
}), sortBy([].concat(_toConsumableArray(formList), _toConsumableArray(formExtra)), function (o) {
|
|
294
295
|
var _o$props;
|
|
295
|
-
return o.order || ((_o$props = o.props) === null || _o$props === void 0 ? void 0 : _o$props.order);
|
|
296
|
+
return (o === null || o === void 0 ? void 0 : o.order) || (o === null || o === void 0 || (_o$props = o.props) === null || _o$props === void 0 ? void 0 : _o$props.order);
|
|
296
297
|
}).map(function (formProps) {
|
|
297
298
|
var _formProps$type = formProps.type,
|
|
298
299
|
type = _formProps$type === void 0 ? 'auto' : _formProps$type;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "afterInit", "namespace", "wrapperRef", "list", "detail", "params", "filters", "_loading", "loading", "unclosableSet", "onQuery", "doQuery", "pagination", "pageno", "pagesize", "totalCount", "columnsRewrite", "columnsReset", "batchOperations", "formatDataSource", "resultSet", "actionsColumn", "readFilter", "isFlow", "isTreeGrid", "writable"],
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "afterInit", "uiSettings", "namespace", "wrapperRef", "list", "detail", "params", "filters", "_loading", "loading", "unclosableSet", "onQuery", "doQuery", "pagination", "pageno", "pagesize", "totalCount", "columnsRewrite", "columnsReset", "batchOperations", "formatDataSource", "resultSet", "actionsColumn", "readFilter", "isFlow", "isTreeGrid", "writable"],
|
|
6
6
|
_excluded2 = ["ldId", "moduleCode", "suppressInit", "overModel", "afterQuery", "isTreeGrid"];
|
|
7
7
|
import React, { forwardRef, useImperativeHandle, useRef, useEffect } from 'react';
|
|
8
8
|
import { getDvaApp } from 'umi';
|
|
@@ -20,6 +20,8 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
20
20
|
actions = _ref.actions,
|
|
21
21
|
doAction = _ref.doAction,
|
|
22
22
|
afterInit = _ref.afterInit,
|
|
23
|
+
_ref$uiSettings = _ref.uiSettings,
|
|
24
|
+
uiSettings = _ref$uiSettings === void 0 ? {} : _ref$uiSettings,
|
|
23
25
|
namespace = _ref.namespace,
|
|
24
26
|
wrapperRef = _ref.wrapperRef,
|
|
25
27
|
list = _ref.list,
|
|
@@ -77,10 +79,12 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
},
|
|
80
|
-
onLdQuery: function onLdQuery() {
|
|
81
|
-
var
|
|
82
|
-
doQuery({
|
|
82
|
+
onLdQuery: function onLdQuery(_params) {
|
|
83
|
+
var _getDvaApp2;
|
|
84
|
+
if (_params) doQuery({
|
|
83
85
|
params: _params
|
|
86
|
+
});else (_getDvaApp2 = getDvaApp()) === null || _getDvaApp2 === void 0 || _getDvaApp2._store.dispatch({
|
|
87
|
+
type: "".concat(namespace, "/doQuery")
|
|
84
88
|
});
|
|
85
89
|
}
|
|
86
90
|
});
|
|
@@ -92,6 +96,7 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
92
96
|
});
|
|
93
97
|
});
|
|
94
98
|
}, [batchOperations]);
|
|
99
|
+
var gridPresetData = uiSettings && uiSettings.grid && uiSettings.grid[0] && uiSettings.grid[0].preset ? JSON.parse(uiSettings.grid[0].preset) : {};
|
|
95
100
|
|
|
96
101
|
/**
|
|
97
102
|
* 优先级
|
|
@@ -107,18 +112,24 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
107
112
|
}
|
|
108
113
|
var _columnsRewrite = isFunction(columnsRewrite) ? columnsRewrite(columns) : columnsRewrite;
|
|
109
114
|
var defaultColumns = keyBy(columns, 'aliaName');
|
|
110
|
-
var customColumns = keyBy(_columnsRewrite, '
|
|
111
|
-
var
|
|
115
|
+
var customColumns = keyBy(_columnsRewrite, 'aliaName');
|
|
116
|
+
var presetColumns = keyBy(gridPresetData.gridPreset, 'aliaName'); // ui配置的已排序的列
|
|
117
|
+
var mergeFields = union(keys(presetColumns), keys(defaultColumns), keys(customColumns)); // 以UI配置的列排序
|
|
112
118
|
return transform(mergeFields, function (result, field) {
|
|
113
|
-
var _customColumns$field;
|
|
119
|
+
var _customColumns$field, _defaultColumns$field;
|
|
114
120
|
if ((_customColumns$field = customColumns[field]) !== null && _customColumns$field !== void 0 && _customColumns$field.hide) {
|
|
115
121
|
// 任何情况都不显示
|
|
116
|
-
} else if (
|
|
122
|
+
} else if ((_defaultColumns$field = defaultColumns[field]) !== null && _defaultColumns$field !== void 0 && _defaultColumns$field.isShowInGrid) {
|
|
123
|
+
// 该字段配置的表单显示信息
|
|
124
|
+
var columnUiData = gridPresetData.gridPreset ? gridPresetData.gridPreset.find(function (c) {
|
|
125
|
+
return c.field === field;
|
|
126
|
+
}) : {};
|
|
127
|
+
// 数据集中存在的字段和自定义结合展示
|
|
128
|
+
result.push(getGridColumn(defaultColumns[field], customColumns[field] || {}, isTreeGrid, writable, columnUiData));
|
|
129
|
+
} else if (!defaultColumns[field] && customColumns[field]) {
|
|
117
130
|
// 数据集中不存在的字段以自定义的形式展示
|
|
118
131
|
result.push(customColumns[field]);
|
|
119
|
-
}
|
|
120
|
-
// 数据集中存在的字段和自定义结合展示
|
|
121
|
-
result.push(getGridColumn(defaultColumns[field], customColumns[field] || {}, isTreeGrid, writable));
|
|
132
|
+
}
|
|
122
133
|
}, []);
|
|
123
134
|
}, [columns, columnsRewrite, columnsReset]);
|
|
124
135
|
var _actionsColumn = useCreation(function () {
|
|
@@ -181,11 +192,11 @@ var LdIndex = function LdIndex(_ref2) {
|
|
|
181
192
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
182
193
|
var isTreeGrid = isNil(_isTreeGrid) ? includes(props.isTree, props.dataSetKey) : _isTreeGrid;
|
|
183
194
|
var Component = useCreation(function () {
|
|
184
|
-
var
|
|
185
|
-
(
|
|
186
|
-
if (!((
|
|
187
|
-
var
|
|
188
|
-
(
|
|
195
|
+
var _getDvaApp3, _getDvaApp4;
|
|
196
|
+
(_getDvaApp3 = getDvaApp()) === null || _getDvaApp3 === void 0 || _getDvaApp3.unmodel(namespace);
|
|
197
|
+
if (!((_getDvaApp4 = getDvaApp()) !== null && _getDvaApp4 !== void 0 && _getDvaApp4._store.getState()[namespace])) {
|
|
198
|
+
var _getDvaApp5, _props$pagination;
|
|
199
|
+
(_getDvaApp5 = getDvaApp()) === null || _getDvaApp5 === void 0 || _getDvaApp5.model(createModel(namespace, _objectSpread(_objectSpread({
|
|
189
200
|
behaviorKey: isTreeGrid ? 'readTree' : 'readGrid'
|
|
190
201
|
}, overModel), {}, {
|
|
191
202
|
pageSize: overModel.pageSize || ((_props$pagination = props.pagination) === null || _props$pagination === void 0 ? void 0 : _props$pagination.pageSize) || props.pageSize,
|
|
@@ -213,10 +224,8 @@ Index.propTypes = {
|
|
|
213
224
|
// 数据集key
|
|
214
225
|
readOnly: PropTypes.bool,
|
|
215
226
|
// 是否只读
|
|
216
|
-
columnsRewrite: PropTypes.arrayOf(
|
|
217
|
-
|
|
218
|
-
PropTypes.shape({
|
|
219
|
-
field: PropTypes.string.isRequired
|
|
227
|
+
columnsRewrite: PropTypes.arrayOf(PropTypes.shape({
|
|
228
|
+
aliaName: PropTypes.string.isRequired
|
|
220
229
|
})),
|
|
221
230
|
pagination: PropTypes.shape({
|
|
222
231
|
pageSize: PropTypes.number,
|
|
@@ -2,15 +2,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "columnsRewrite", "columnsReset", "onQuery", "onAdd", "onUpdate", "onDelete", "mainFormLdId", "mainDataSetKey", "onValueChange", "type", "afterOperate", "moduleCode", "defaultDataSourceFormat", "ticketData", "className", "formRef", "formMode", "fields", "setVerifyRules"];
|
|
6
|
-
import React, { createRef
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "uiSettings", "ldId", "dataSetKey", "columnsRewrite", "columnsReset", "onQuery", "onAdd", "onUpdate", "onDelete", "mainFormLdId", "mainDataSetKey", "onValueChange", "type", "afterOperate", "moduleCode", "defaultDataSourceFormat", "ticketData", "className", "formRef", "formMode", "fields", "setVerifyRules", "pageProxy"];
|
|
6
|
+
import React, { createRef } from 'react';
|
|
7
7
|
import { reduce, keyBy, isEmpty, pick, omit } from 'lodash';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import ldBuilder from "../../helper/ldBuilder";
|
|
10
10
|
import { GridForm } from '@luck-design-biz/base/FormList';
|
|
11
|
-
import { getFormColumn, formItemDataFormat, dataFormat, behaviorCall } from "../../utils";
|
|
11
|
+
import { getFormColumn, formItemDataFormat, dataFormat, behaviorCall, mergeAndSort } from "../../utils";
|
|
12
12
|
import { defaultComName } from "../../helper/form";
|
|
13
|
-
import {
|
|
13
|
+
import { useLDCtx } from "../Builder";
|
|
14
14
|
import styles from "./index.less";
|
|
15
15
|
var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
16
16
|
var _ref$columns = _ref.columns,
|
|
@@ -21,6 +21,8 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
21
21
|
actions = _ref$actions === void 0 ? {} : _ref$actions,
|
|
22
22
|
_ref$doAction = _ref.doAction,
|
|
23
23
|
doAction = _ref$doAction === void 0 ? function () {} : _ref$doAction,
|
|
24
|
+
_ref$uiSettings = _ref.uiSettings,
|
|
25
|
+
uiSettings = _ref$uiSettings === void 0 ? {} : _ref$uiSettings,
|
|
24
26
|
ldId = _ref.ldId,
|
|
25
27
|
dataSetKey = _ref.dataSetKey,
|
|
26
28
|
_ref$columnsRewrite = _ref.columnsRewrite,
|
|
@@ -53,8 +55,9 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
53
55
|
formMode = _ref.formMode,
|
|
54
56
|
fields = _ref.fields,
|
|
55
57
|
setVerifyRules = _ref.setVerifyRules,
|
|
58
|
+
pageProxy = _ref.pageProxy,
|
|
56
59
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
-
var _ref2 =
|
|
60
|
+
var _ref2 = useLDCtx(pageProxy) || {},
|
|
58
61
|
setFieldProps = _ref2.setFieldProps;
|
|
59
62
|
var defaultValues = /*#__PURE__*/createRef({});
|
|
60
63
|
var isMain = ldId === mainFormLdId;
|
|
@@ -64,9 +67,11 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
64
67
|
});
|
|
65
68
|
return col;
|
|
66
69
|
});
|
|
70
|
+
var gridPresetData = uiSettings && uiSettings.grid && uiSettings.grid[0] && uiSettings.grid[0].preset ? JSON.parse(uiSettings.grid[0].preset) : {};
|
|
67
71
|
var _columns = function () {
|
|
72
|
+
var mergedArray = mergeAndSort(gridColumns, gridPresetData.gridPreset || [], 'field');
|
|
68
73
|
var fieldsObj = keyBy(fields, 'field');
|
|
69
|
-
var columnsObj = keyBy(
|
|
74
|
+
var columnsObj = keyBy(mergedArray, 'field');
|
|
70
75
|
var keys = isEmpty(fields) ? Object.keys(columnsObj) : Object.keys(fieldsObj);
|
|
71
76
|
var _defaultValues = {};
|
|
72
77
|
var _nodes = reduce(keys, function (result, key) {
|
|
@@ -104,6 +109,10 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
104
109
|
fieldName: (setting === null || setting === void 0 ? void 0 : setting.fieldAliasName) || col.fieldName
|
|
105
110
|
});
|
|
106
111
|
var defaultSet = ['width', 'align', 'headerAlign', 'pinned', 'tip', 'formMode'];
|
|
112
|
+
// 该字段配置的表单显示信息
|
|
113
|
+
var columnUiData = gridPresetData.gridPreset ? gridPresetData.gridPreset.find(function (c) {
|
|
114
|
+
return c.field === col.field;
|
|
115
|
+
}) : {};
|
|
107
116
|
result.push(getFormColumn(type, newCol, _objectSpread(_objectSpread(_objectSpread({}, pick(setting, defaultSet)), customColumn), {}, {
|
|
108
117
|
formItemRewrite: _objectSpread(_objectSpread({}, (_customColumn = customColumn) === null || _customColumn === void 0 ? void 0 : _customColumn.formItemRewrite), {}, {
|
|
109
118
|
moduleCode: moduleCode,
|
|
@@ -112,7 +121,7 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
112
121
|
render: setting === null || setting === void 0 ? void 0 : setting.render,
|
|
113
122
|
setting: omit(setting, [].concat(defaultSet, ['uid', 'field', 'render']))
|
|
114
123
|
})
|
|
115
|
-
})));
|
|
124
|
+
}), columnUiData));
|
|
116
125
|
return result;
|
|
117
126
|
}, []);
|
|
118
127
|
defaultValues.current = _defaultValues;
|
|
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { useCreation, useRequest } from 'ahooks';
|
|
9
9
|
import { InfoPanel } from 'luck-design';
|
|
10
10
|
import { behaviorCall } from "../../utils";
|
|
11
|
-
import { transform } from 'lodash';
|
|
11
|
+
import { transform, isArray, isFunction } from 'lodash';
|
|
12
12
|
import ldBuilder from "../../helper/ldBuilder";
|
|
13
13
|
var formatInfoPanelData = function formatInfoPanelData(columns, data) {
|
|
14
14
|
return transform(columns, function (result, col) {
|
|
@@ -51,14 +51,20 @@ var LdInfoPanel = function LdInfoPanel(_ref) {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
var _columns = useCreation(function () {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
if (isArray(customColumns)) {
|
|
55
|
+
return customColumns.map(function (col) {
|
|
56
|
+
var xCol = columns.find(function (column) {
|
|
57
|
+
return column.aliaName === col.dataIndex;
|
|
58
|
+
}) || {};
|
|
59
|
+
return _objectSpread({
|
|
60
|
+
title: xCol.fieldName
|
|
61
|
+
}, col);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (isFunction(customColumns)) {
|
|
65
|
+
return customColumns(columns);
|
|
66
|
+
}
|
|
67
|
+
return transform(columns, function (result, item) {
|
|
62
68
|
if (item.isShowInForm) {
|
|
63
69
|
result.push({
|
|
64
70
|
title: item.fieldName,
|
|
@@ -103,7 +109,7 @@ Index.propTypes = {
|
|
|
103
109
|
// 抑制初始化
|
|
104
110
|
afterInit: PropTypes.func,
|
|
105
111
|
// 初始化后
|
|
106
|
-
customColumns: PropTypes.array,
|
|
112
|
+
customColumns: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
|
|
107
113
|
defaultParmas: PropTypes.object
|
|
108
114
|
};
|
|
109
115
|
Index.defaultProps = {
|