@luck-design-biz/luckda 1.0.0-1-alpha → 1.0.0-10-alpha
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/ComplexItem/index.js +65 -49
- package/es/components/LdAutoForm/index.js +4 -3
- package/es/components/LdGridForm/index.js +2 -1
- package/es/helper/form.js +1 -0
- package/es/helper/ldBuilder.js +8 -3
- package/es/locales/zh-CN.js +35 -0
- package/es/lowcode/engine/meta/fieldcomplex.props.default.json +1 -0
- package/es/lowcode/engine/meta/fieldcomplex.props.json +7 -0
- package/es/lowcode/engine/meta/form.props.json +3 -3
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +18 -0
- package/es/lowcode/engine/meta/page.props.json +6 -0
- package/es/lowcode/engine/provider/ContextProvider/index.js +28 -5
- package/es/lowcode/engine/provider/ContextProvider/router.js +1 -1
- package/es/lowcode/engine/{tools → provider/ContextProvider}/usePageDataStore.js +9 -7
- package/es/lowcode/engine/{tools → provider/ContextProvider}/useTodo.js +4 -6
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +1 -2
- package/es/lowcode/engine/tools/helper.js +7 -2
- package/es/lowcode/engine/tools/initDS.js +263 -0
- package/es/lowcode/engine/tools/useCombinedRefs.js +3 -2
- package/es/lowcode/painter/DesignOperator.js +2 -0
- package/es/lowcode/painter/components/TipIcon.js +16 -0
- package/es/lowcode/painter/components/VarEditor.js +456 -0
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +2 -2
- package/es/lowcode/painter/components/code-editor/JSEditor.js +3 -1
- package/es/lowcode/painter/components/code-editor/VisionEditor.js +81 -0
- package/es/lowcode/painter/components/field-setting/SettingUI.js +17 -3
- package/es/lowcode/painter/components/field-setting/index.js +1 -1
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +1 -0
- package/es/lowcode/painter/index.js +1 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +14 -9
- package/es/lowcode/painter/panel-section/ComplexPop.js +242 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +8 -0
- package/es/lowcode/painter/panel-section/FieldsSetting.js +9 -1
- package/es/lowcode/painter/panel-section/ImpExp.js +1 -27
- package/es/lowcode/painter/panel-section/PageVars.js +300 -0
- package/es/lowcode/painter/services/complexPop.js +21 -0
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/page-vars.less +25 -0
- package/es/lowcode/preview/index.js +1 -0
- package/es/lowcode/view/Canvas.js +11 -34
- package/es/lowcode/view/Loading.js +5 -7
- package/es/lowcode/view/Page.js +37 -15
- package/es/lowcode/view/index.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +4 -6
- package/es/lowcode/view/lc-components/FieldComplex/meta.json +7 -0
- package/es/lowcode/view/lc-components/Form/index.js +11 -4
- package/es/lowcode/view/lc-components/Form/meta.json +3 -3
- package/es/lowcode/view/lc-components/Page/meta.json +6 -0
- package/es/lowcode/view/lc-components/Table/index.js +17 -3
- package/es/lowcode/view/style/loading.less +14 -0
- package/es/utils/form.js +4 -4
- package/es/utils/grid.js +1 -1
- package/lib/components/ComplexItem/index.js +62 -47
- package/lib/components/LdAutoForm/index.js +3 -2
- package/lib/components/LdGridForm/index.js +2 -1
- package/lib/helper/form.js +1 -0
- package/lib/helper/ldBuilder.js +8 -3
- package/lib/locales/zh-CN.js +35 -0
- package/lib/lowcode/engine/meta/fieldcomplex.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fieldcomplex.props.json +7 -0
- package/lib/lowcode/engine/meta/form.props.json +3 -3
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +18 -0
- package/lib/lowcode/engine/meta/page.props.json +6 -0
- package/lib/lowcode/engine/provider/ContextProvider/index.js +29 -12
- package/lib/lowcode/engine/provider/ContextProvider/router.js +1 -1
- package/lib/lowcode/engine/{tools → provider/ContextProvider}/usePageDataStore.js +9 -7
- package/lib/lowcode/engine/{tools → provider/ContextProvider}/useTodo.js +4 -6
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +2 -3
- package/lib/lowcode/engine/tools/helper.js +7 -2
- package/lib/lowcode/engine/tools/initDS.js +270 -0
- package/lib/lowcode/engine/tools/useCombinedRefs.js +2 -1
- package/lib/lowcode/painter/DesignOperator.js +2 -0
- package/lib/lowcode/painter/components/TipIcon.js +23 -0
- package/lib/lowcode/painter/components/VarEditor.js +463 -0
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +2 -2
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +3 -1
- package/lib/lowcode/painter/components/code-editor/VisionEditor.js +88 -0
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +17 -3
- package/lib/lowcode/painter/components/field-setting/index.js +1 -1
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +1 -0
- package/lib/lowcode/painter/index.js +1 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +13 -8
- package/lib/lowcode/painter/panel-section/ComplexPop.js +250 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +8 -0
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +9 -1
- package/lib/lowcode/painter/panel-section/ImpExp.js +0 -26
- package/lib/lowcode/painter/panel-section/PageVars.js +308 -0
- package/lib/lowcode/painter/services/complexPop.js +28 -0
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/page-vars.less +25 -0
- package/lib/lowcode/preview/index.js +1 -0
- package/lib/lowcode/view/Canvas.js +12 -35
- package/lib/lowcode/view/Loading.js +5 -7
- package/lib/lowcode/view/Page.js +35 -13
- package/lib/lowcode/view/index.js +1 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +4 -6
- package/lib/lowcode/view/lc-components/FieldComplex/meta.json +7 -0
- package/lib/lowcode/view/lc-components/Form/index.js +11 -4
- package/lib/lowcode/view/lc-components/Form/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Page/meta.json +6 -0
- package/lib/lowcode/view/lc-components/Table/index.js +18 -4
- package/lib/lowcode/view/style/loading.less +14 -0
- package/lib/utils/form.js +3 -3
- package/lib/utils/grid.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import { stringify } from 'qs';
|
|
4
|
+
import { request } from '@luck-design-biz/base/utils';
|
|
5
|
+
import api from "@/services/ApiConfig";
|
|
6
|
+
export var getFields = /*#__PURE__*/function () {
|
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(get) {
|
|
8
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9
|
+
while (1) switch (_context.prev = _context.next) {
|
|
10
|
+
case 0:
|
|
11
|
+
return _context.abrupt("return", request("".concat(api.BASE_HOST, "/logic/field/noAuthGetFields?").concat(stringify(get))));
|
|
12
|
+
case 1:
|
|
13
|
+
case "end":
|
|
14
|
+
return _context.stop();
|
|
15
|
+
}
|
|
16
|
+
}, _callee);
|
|
17
|
+
}));
|
|
18
|
+
return function getFields(_x) {
|
|
19
|
+
return _ref.apply(this, arguments);
|
|
20
|
+
};
|
|
21
|
+
}();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.lc-painter-panel-page-vars-drawer {
|
|
2
|
+
:global {
|
|
3
|
+
.ant-drawer-header {
|
|
4
|
+
height: 38px;
|
|
5
|
+
padding: 8px 16px;
|
|
6
|
+
.ant-drawer-close {
|
|
7
|
+
width: 38px !important;
|
|
8
|
+
height: 38px !important;
|
|
9
|
+
line-height: 38px !important;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.ant-drawer-body {
|
|
13
|
+
height: calc(100% - 38px);
|
|
14
|
+
overflow-y: auto;
|
|
15
|
+
padding: 8px 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
input,
|
|
19
|
+
button,
|
|
20
|
+
.ant-radio-wrapper,
|
|
21
|
+
.ant-select-sm {
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
|
-
import { useMemoizedFn } from 'ahooks';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
|
-
import { reduce } from 'lodash';
|
|
7
5
|
import classNames from 'classnames';
|
|
8
|
-
import { useContext, useGet
|
|
6
|
+
import { useContext, useGet } from "../engine/provider/ContextProvider";
|
|
7
|
+
import { useStateStore } from "../engine/provider/ContextProvider/usePageVar";
|
|
9
8
|
import PageHeader from "./lc-components/PageHeader";
|
|
10
9
|
import PageContent from "./lc-components/PageContent";
|
|
11
10
|
import PageFooter from "./lc-components/PageFooter";
|
|
@@ -20,7 +19,10 @@ var PageRoot = styled.div.withConfig({
|
|
|
20
19
|
return props.$css;
|
|
21
20
|
});
|
|
22
21
|
var Canvas = function Canvas(_ref) {
|
|
23
|
-
var
|
|
22
|
+
var _dsRef$current;
|
|
23
|
+
var className = _ref.className,
|
|
24
|
+
dsRef = _ref.dsRef;
|
|
25
|
+
(_dsRef$current = dsRef.current) === null || _dsRef$current === void 0 || _dsRef$current.read();
|
|
24
26
|
var _useGet = useGet(['props.css', 'props.advance', 'props.enableHeader', 'props.enableFooter', 'props.vars']),
|
|
25
27
|
_useGet2 = _slicedToArray(_useGet, 5),
|
|
26
28
|
pagerootCss = _useGet2[0],
|
|
@@ -29,49 +31,24 @@ var Canvas = function Canvas(_ref) {
|
|
|
29
31
|
enableFooter = _useGet2[3],
|
|
30
32
|
pageVars = _useGet2[4];
|
|
31
33
|
var ctx = useContext();
|
|
32
|
-
var handleMount = useMemoizedFn(function () {
|
|
33
|
-
var _advance$events;
|
|
34
|
-
ctx.doAction(advance === null || advance === void 0 || (_advance$events = advance.events) === null || _advance$events === void 0 ? void 0 : _advance$events.onPageMount);
|
|
35
|
-
});
|
|
36
|
-
var handleStateChanged = useMemoizedFn(function (_ref2) {
|
|
37
|
-
var _advance$events2;
|
|
38
|
-
var state = _ref2.state,
|
|
39
|
-
prevState = _ref2.prevState,
|
|
40
|
-
diff = _ref2.diff;
|
|
41
|
-
ctx.doAction(advance === null || advance === void 0 || (_advance$events2 = advance.events) === null || _advance$events2 === void 0 ? void 0 : _advance$events2.onStateChanged, {
|
|
42
|
-
state: state,
|
|
43
|
-
prevState: prevState,
|
|
44
|
-
diff: diff
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
34
|
useEffect(function () {
|
|
48
|
-
|
|
49
|
-
useStateStore.getState().initialize(reduce(pageVars, function (ret, val) {
|
|
50
|
-
if (val.type === 'var') {
|
|
51
|
-
ret[val.name] = val.data;
|
|
52
|
-
}
|
|
53
|
-
return ret;
|
|
54
|
-
}, {}));
|
|
55
|
-
}
|
|
35
|
+
var _advance$events2;
|
|
56
36
|
var unsub = useStateStore.subscribe(function (store) {
|
|
57
37
|
return store.state;
|
|
58
38
|
}, function (state, prevState) {
|
|
39
|
+
var _advance$events;
|
|
59
40
|
var _diff = diff(prevState, state);
|
|
60
|
-
|
|
41
|
+
ctx.doAction(advance === null || advance === void 0 || (_advance$events = advance.events) === null || _advance$events === void 0 ? void 0 : _advance$events.onStateChanged, {
|
|
61
42
|
state: state,
|
|
62
43
|
prevState: prevState,
|
|
63
44
|
diff: _diff
|
|
64
45
|
});
|
|
65
46
|
});
|
|
47
|
+
ctx.doAction(advance === null || advance === void 0 || (_advance$events2 = advance.events) === null || _advance$events2 === void 0 ? void 0 : _advance$events2.onPageMount);
|
|
66
48
|
return function () {
|
|
49
|
+
var _advance$events3;
|
|
67
50
|
unsub();
|
|
68
51
|
useStateStore.getState().clear();
|
|
69
|
-
};
|
|
70
|
-
}, [pageVars]);
|
|
71
|
-
useEffect(function () {
|
|
72
|
-
ctx.$subscriber(ctx.topics.PAGE_LOAD_MOUNT).once(handleMount).watch();
|
|
73
|
-
return function () {
|
|
74
|
-
var _advance$events3;
|
|
75
52
|
ctx.doAction(advance === null || advance === void 0 || (_advance$events3 = advance.events) === null || _advance$events3 === void 0 ? void 0 : _advance$events3.onPageUnmount);
|
|
76
53
|
};
|
|
77
54
|
}, []);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import styles from "./style/loading.less";
|
|
5
|
-
var Loading = function Loading(
|
|
6
|
-
var className = _ref.className,
|
|
7
|
-
style = _ref.style;
|
|
4
|
+
var Loading = function Loading() {
|
|
8
5
|
return /*#__PURE__*/React.createElement("div", {
|
|
9
|
-
className:
|
|
10
|
-
|
|
6
|
+
className: styles.masker
|
|
7
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
8
|
+
className: styles['lc-painter-loading']
|
|
11
9
|
}, /*#__PURE__*/React.createElement("div", {
|
|
12
10
|
className: styles['cube']
|
|
13
11
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -22,6 +20,6 @@ var Loading = function Loading(_ref) {
|
|
|
22
20
|
className: classNames(styles['side'], styles['side5'])
|
|
23
21
|
}), /*#__PURE__*/React.createElement("div", {
|
|
24
22
|
className: classNames(styles['side'], styles['side6'])
|
|
25
|
-
})));
|
|
23
|
+
}))));
|
|
26
24
|
};
|
|
27
25
|
export default Loading;
|
package/es/lowcode/view/Page.js
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
5
|
var _excluded = ["className"];
|
|
5
|
-
import React, { useRef,
|
|
6
|
-
import { useMemoizedFn } from 'ahooks';
|
|
6
|
+
import React, { forwardRef, useRef, Suspense } from 'react';
|
|
7
|
+
import { useMemoizedFn, useCreation, useBoolean } from 'ahooks';
|
|
8
|
+
import { Skeleton } from 'luck-design/antd';
|
|
7
9
|
import classNames from 'classnames';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
10
|
import { useRemoteSource, useContext } from "../engine/provider/ContextProvider";
|
|
11
|
+
import initDS from "../engine/tools/initDS";
|
|
10
12
|
import Loading from "./Loading";
|
|
11
13
|
import Wrapper from "./lc-components/Wrapper";
|
|
12
14
|
import Canvas from "./Canvas";
|
|
13
15
|
import { LC_BUILDIN_UNIT_KEY } from "../constants";
|
|
16
|
+
import useCombinedRefs from "../engine/tools/useCombinedRefs";
|
|
14
17
|
import ErrorBoundary from "./errorBoundary";
|
|
15
18
|
import styles from "./style/page.less";
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
var className = _ref2.className,
|
|
22
|
-
props = _objectWithoutProperties(_ref2, _excluded);
|
|
23
|
-
var _ref = useRef(null);
|
|
24
|
-
var _rootRef = ref || _ref;
|
|
19
|
+
var LCPage = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
|
+
var className = _ref.className,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _rootRef = useCombinedRefs(ref);
|
|
23
|
+
var _dsRef = useRef();
|
|
25
24
|
var _useRemoteSource = useRemoteSource(),
|
|
26
25
|
loading = _useRemoteSource.loading;
|
|
27
|
-
var
|
|
26
|
+
var _useBoolean = useBoolean(false),
|
|
27
|
+
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
28
|
+
loadMount = _useBoolean2[0],
|
|
29
|
+
setTrue = _useBoolean2[1].setTrue;
|
|
30
|
+
var ctx = useContext();
|
|
31
|
+
var handlePageLoadMount = useMemoizedFn(function () {
|
|
32
|
+
_dsRef.current = initDS(ctx);
|
|
33
|
+
setTrue();
|
|
34
|
+
});
|
|
35
|
+
useCreation(function () {
|
|
36
|
+
ctx.$subscriber(ctx.topics.PAGE_LOAD_MOUNT).once(handlePageLoadMount).watch();
|
|
37
|
+
}, []);
|
|
28
38
|
var getTargetDom = useMemoizedFn(function () {
|
|
29
39
|
return _rootRef.current;
|
|
30
40
|
});
|
|
31
41
|
var handleClear = useMemoizedFn(function () {
|
|
32
|
-
|
|
42
|
+
ctx.$publisher(ctx.topics.COMPONENT_ACTIVE, null);
|
|
33
43
|
});
|
|
34
44
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
35
45
|
onClear: handleClear
|
|
@@ -39,6 +49,18 @@ var LCPage = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
39
49
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
40
50
|
ref: _rootRef,
|
|
41
51
|
className: classNames(styles['lc-view-page'], _defineProperty(_defineProperty({}, styles.isloading, loading), className, !!className))
|
|
42
|
-
}, props), /*#__PURE__*/React.createElement(
|
|
52
|
+
}, props), /*#__PURE__*/React.createElement(Suspense, {
|
|
53
|
+
fallback: /*#__PURE__*/React.createElement(Skeleton, {
|
|
54
|
+
active: true,
|
|
55
|
+
title: {
|
|
56
|
+
width: '70%'
|
|
57
|
+
},
|
|
58
|
+
paragraph: {
|
|
59
|
+
rows: 9
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}, loadMount ? /*#__PURE__*/React.createElement(Canvas, {
|
|
63
|
+
dsRef: _dsRef
|
|
64
|
+
}) : null))), loading ? /*#__PURE__*/React.createElement(Loading, null) : null);
|
|
43
65
|
});
|
|
44
66
|
export default LCPage;
|
package/es/lowcode/view/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var View = function View(_ref) {
|
|
|
9
9
|
var code = _ref.code,
|
|
10
10
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
11
|
return /*#__PURE__*/React.createElement(EventBusProvider, {
|
|
12
|
+
key: code,
|
|
12
13
|
runtime: RUNTIME.LIVE
|
|
13
14
|
}, /*#__PURE__*/React.createElement(ContextProvider, {
|
|
14
15
|
code: code
|
|
@@ -86,13 +86,9 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
86
86
|
}, _callee);
|
|
87
87
|
})));
|
|
88
88
|
var _footer = useCreation(function () {
|
|
89
|
-
var _btnGroup$todoList;
|
|
90
89
|
if (!footer) return {
|
|
91
90
|
footer: null
|
|
92
91
|
};
|
|
93
|
-
if (!(btnGroup !== null && btnGroup !== void 0 && (_btnGroup$todoList = btnGroup.todoList) !== null && _btnGroup$todoList !== void 0 && _btnGroup$todoList.length)) return {
|
|
94
|
-
confirmLoading: loading
|
|
95
|
-
};
|
|
96
92
|
return {
|
|
97
93
|
footer: /*#__PURE__*/React.createElement(Footer, null, /*#__PURE__*/React.createElement(LDActions, _extends({}, btnGroup, {
|
|
98
94
|
doAction: function doAction(action) {
|
|
@@ -155,7 +151,6 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
155
151
|
}, /*#__PURE__*/React.createElement(Modal, _extends({
|
|
156
152
|
title: _title,
|
|
157
153
|
visible: open,
|
|
158
|
-
getContainer: getContainer,
|
|
159
154
|
width: width,
|
|
160
155
|
mask: mask,
|
|
161
156
|
maskStyle: maskStyle,
|
|
@@ -164,7 +159,10 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
164
159
|
overflowY: 'auto',
|
|
165
160
|
marginTop: 0
|
|
166
161
|
},
|
|
167
|
-
wrapClassName: classNames(styles['lc-component-dialog-wrapper'], _defineProperty({}, wrapClassName, !!wrapClassName))
|
|
162
|
+
wrapClassName: classNames(styles['lc-component-dialog-wrapper'], _defineProperty({}, wrapClassName, !!wrapClassName)),
|
|
163
|
+
getContainer: getContainer || function () {
|
|
164
|
+
return document.getElementById('root') || document.getElementById('react-content') || document.body;
|
|
165
|
+
}
|
|
168
166
|
}, _footer, {
|
|
169
167
|
onOk: handleOk,
|
|
170
168
|
onCancel: function onCancel() {
|
|
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _excluded = ["advance", "state"];
|
|
6
|
+
var _excluded = ["advance", "state", "render"];
|
|
7
7
|
import React, { useRef, forwardRef, Fragment, useImperativeHandle } from 'react';
|
|
8
8
|
import { useMemoizedFn, useCreation, useUnmount } from 'ahooks';
|
|
9
9
|
import classNames from 'classnames';
|
|
@@ -228,9 +228,7 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
228
228
|
return wrapperRef.current;
|
|
229
229
|
});
|
|
230
230
|
var handleDefaultDataSourceFormat = useMemoizedFn(function (defaultDataSourceFormat, defaultValues) {
|
|
231
|
-
if (isNil(defaultDataSourceFormat)) return function () {
|
|
232
|
-
return defaultValues;
|
|
233
|
-
};
|
|
231
|
+
if (isNil(defaultDataSourceFormat)) return function () {};
|
|
234
232
|
return executeCode(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
|
|
235
233
|
});
|
|
236
234
|
var handleDataSourceFormat = useMemoizedFn(function (type, dataSourceFormat, dataSetKey, _ref6) {
|
|
@@ -323,6 +321,7 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
323
321
|
return reduce(fields, function (result, setting) {
|
|
324
322
|
var advance = setting.advance,
|
|
325
323
|
_state = setting.state,
|
|
324
|
+
render = setting.render,
|
|
326
325
|
rest = _objectWithoutProperties(setting, _excluded);
|
|
327
326
|
var isShow = true;
|
|
328
327
|
if (ctx.runtime !== RUNTIME.DESIGN && _state) {
|
|
@@ -355,6 +354,14 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
355
354
|
};
|
|
356
355
|
}
|
|
357
356
|
result.push(_objectSpread(_objectSpread({}, _props), {}, {
|
|
357
|
+
render: render ? function (v, d, i, p) {
|
|
358
|
+
return /*#__PURE__*/React.createElement(RuntimeComp, {
|
|
359
|
+
value: v,
|
|
360
|
+
data: d,
|
|
361
|
+
rowIndex: i,
|
|
362
|
+
params: p
|
|
363
|
+
}, render.replace(/(function\s*\w*\s*)\([^)]*\)(\s*{)/, '$1()$2'));
|
|
364
|
+
} : null,
|
|
358
365
|
events: advance !== null && advance !== void 0 && advance.events ? reduce(advance.events, function (result, value, key) {
|
|
359
366
|
//处理事件
|
|
360
367
|
result[key] = function () {
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
"name": "格式化默认数据",
|
|
245
245
|
"desc": "格式化新增时默认数据",
|
|
246
246
|
"type": "_JSEditor",
|
|
247
|
-
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return
|
|
247
|
+
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return {}; \n}",
|
|
248
248
|
"mustConfirm": true,
|
|
249
249
|
"wrapper": "collapse",
|
|
250
250
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
"name": "格式化默认数据",
|
|
336
336
|
"desc": "格式化新增时默认数据",
|
|
337
337
|
"type": "_JSEditor",
|
|
338
|
-
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return
|
|
338
|
+
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return {}; \n}",
|
|
339
339
|
"mustConfirm": true,
|
|
340
340
|
"wrapper": "collapse",
|
|
341
341
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -446,7 +446,7 @@
|
|
|
446
446
|
"name": "格式化默认数据",
|
|
447
447
|
"desc": "格式化新增时默认数据",
|
|
448
448
|
"type": "_JSEditor",
|
|
449
|
-
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return
|
|
449
|
+
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return {}; \n}",
|
|
450
450
|
"mustConfirm": true,
|
|
451
451
|
"wrapper": "collapse",
|
|
452
452
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
4
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
|
+
var _excluded = ["render"];
|
|
6
8
|
import React, { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
|
|
7
9
|
import PropTypes from 'prop-types';
|
|
8
10
|
import { useMemoizedFn, useCreation, useRequest, useUnmount } from 'ahooks';
|
|
@@ -14,6 +16,7 @@ import Wrapper from "../Wrapper";
|
|
|
14
16
|
import { LdGrid, LDActions } from "../../../../index";
|
|
15
17
|
import TopFilter from "./components/TopFilter";
|
|
16
18
|
import { TopUpload, TopExport } from "./components/TopImex";
|
|
19
|
+
import RuntimeComp from "../JSX/RuntimeComp";
|
|
17
20
|
import { omitBadProps, executeCode, getLDMetaAttr } from "../../../engine/tools/helper";
|
|
18
21
|
import useCombinedRefs from "../../../engine/tools/useCombinedRefs";
|
|
19
22
|
import defaultMeta from "../../../engine/meta/table.props.default.json";
|
|
@@ -380,8 +383,19 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
380
383
|
if (!isNil(columnsRewrite) || !isNil(fields)) {
|
|
381
384
|
temp.columnsRewrite = function (cols) {
|
|
382
385
|
var colsMap = keyBy(cols, 'field');
|
|
383
|
-
var _cols = isNil(fields) ? cols : fields.map(function (
|
|
384
|
-
|
|
386
|
+
var _cols = isNil(fields) ? cols : fields.map(function (_ref4) {
|
|
387
|
+
var render = _ref4.render,
|
|
388
|
+
_field = _objectWithoutProperties(_ref4, _excluded);
|
|
389
|
+
return _objectSpread(_objectSpread({}, colsMap[_field.field]), {}, {
|
|
390
|
+
render: render ? function (v, d, i, p) {
|
|
391
|
+
return /*#__PURE__*/React.createElement(RuntimeComp, {
|
|
392
|
+
value: v,
|
|
393
|
+
data: d,
|
|
394
|
+
rowIndex: i,
|
|
395
|
+
params: p
|
|
396
|
+
}, render.replace(/(function\s*\w*\s*)\([^)]*\)(\s*{)/, '$1()$2'));
|
|
397
|
+
} : null
|
|
398
|
+
}, _field);
|
|
385
399
|
});
|
|
386
400
|
return isNil(columnsRewrite) ? _cols : executeCode(ctx, columnsRewrite, ['columns'], _cols);
|
|
387
401
|
};
|
|
@@ -524,7 +538,7 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
524
538
|
});
|
|
525
539
|
});
|
|
526
540
|
var _afterQuery = useMemoizedFn(function (res) {
|
|
527
|
-
if (res.code === 1 && !res.list.includes(instanceRef.current.expectRowKey)) {
|
|
541
|
+
if (res.code === 1 && instanceRef.current && !res.list.includes(instanceRef.current.expectRowKey)) {
|
|
528
542
|
instanceRef.current.expectRowKey = res.list[0];
|
|
529
543
|
ctx.doAction(advance.events.onExpectRowChanged, {
|
|
530
544
|
data: res.detail[res.list[0]]
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
.masker {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
z-index: 1000;
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
backdrop-filter: blur(6px);
|
|
10
|
+
cursor: none;
|
|
11
|
+
}
|
|
12
|
+
*:has(> .masker) {
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
1
15
|
.lc-painter-loading {
|
|
2
16
|
position: absolute;
|
|
3
17
|
height: 64px;
|
package/es/utils/form.js
CHANGED
|
@@ -12,7 +12,7 @@ var _excluded = ["comName", "property"],
|
|
|
12
12
|
_excluded9 = ["type", "name"];
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import moment from 'moment';
|
|
15
|
-
import { capitalize, merge, transform, isArray, omit, isNil, clone } from 'lodash';
|
|
15
|
+
import { capitalize, merge, transform, isArray, omit, isNil, clone, cloneDeep } from 'lodash';
|
|
16
16
|
import api from "@/services/ApiConfig";
|
|
17
17
|
import { defaultComName, translator, splitStrToObj, formatCustomProps } from "../helper/form";
|
|
18
18
|
import { getColumnRender } from "./grid";
|
|
@@ -31,7 +31,7 @@ export function getFormItem() {
|
|
|
31
31
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
32
|
var customProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
33
33
|
if (!property) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
34
|
-
if (property === 'sint' || property === 'number') props.opt_decimal = 0;
|
|
34
|
+
if (property === 'sint' || property === 'number' || property === 'long') props.opt_decimal = 0;
|
|
35
35
|
var comType = comName || defaultComName[property];
|
|
36
36
|
var _translator = translator(props),
|
|
37
37
|
name = _translator.name,
|
|
@@ -65,7 +65,7 @@ export function getFormItem() {
|
|
|
65
65
|
export var formItemDataFormat = function formItemDataFormat() {
|
|
66
66
|
var propsList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
67
67
|
var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68
|
-
var omitValues =
|
|
68
|
+
var omitValues = cloneDeep(values);
|
|
69
69
|
var data = transform(propsList, function (result, n) {
|
|
70
70
|
var _ref2 = n || {},
|
|
71
71
|
comName = _ref2.comName,
|
|
@@ -125,7 +125,7 @@ export var formItemDataFormat = function formItemDataFormat() {
|
|
|
125
125
|
default:
|
|
126
126
|
if (!isNil(values["".concat(name, "_virtual")] || values[name])) result[name] = values["".concat(name, "_virtual")] || values[name];
|
|
127
127
|
}
|
|
128
|
-
omitValues = omit(
|
|
128
|
+
omitValues = omit(omitValues, [name, "".concat(name, "_virtual")]);
|
|
129
129
|
}, {});
|
|
130
130
|
return _objectSpread(_objectSpread({}, omitValues), data);
|
|
131
131
|
};
|