@luck-design-biz/luckda 0.0.25-7 → 0.0.25-8
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/LDActions/index.js +8 -10
- package/es/components/LDActions/index.less +7 -4
- package/es/components/LdAutoForm/index.js +8 -6
- package/es/components/LdFormList/index.js +12 -4
- package/es/components/LdGrid/index.js +11 -5
- package/es/components/LdGridForm/index.js +4 -2
- package/es/components/LdTree/index.js +30 -13
- package/es/helper/form.js +9 -5
- package/es/locales/zh-CN.js +15 -10
- package/es/lowcode/constants/api-url.js +112 -26
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/engine/meta/box.props.json +3 -3
- package/es/lowcode/engine/meta/button.props.json +3 -3
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/dialog.props.json +5 -5
- package/es/lowcode/engine/meta/drawer.props.json +8 -20
- package/es/lowcode/engine/meta/form.props.json +13 -7
- package/es/lowcode/engine/meta/imex.props.default.json +8 -1
- package/es/lowcode/engine/meta/imex.props.json +54 -22
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/es/lowcode/engine/meta/layout.props.json +2 -2
- package/es/lowcode/engine/meta/page.props.json +2 -2
- package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/es/lowcode/engine/meta/section.props.json +2 -2
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +4 -4
- package/es/lowcode/engine/meta/table.props.json +15 -9
- package/es/lowcode/engine/meta/tabs.props.json +3 -3
- package/es/lowcode/engine/meta/tree.props.default.json +1 -0
- package/es/lowcode/engine/meta/tree.props.json +55 -6
- package/es/lowcode/engine/provider/ContextProvider/index.js +12 -3
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +55 -6
- package/es/lowcode/engine/tools/dataProcess.js +4 -0
- package/es/lowcode/engine/tools/usePageDataStore.js +4 -2
- package/es/lowcode/painter/DesignOperator.js +1 -1
- package/es/lowcode/painter/DesignToolbar.js +2 -1
- package/es/lowcode/painter/Panel.js +3 -3
- package/es/lowcode/painter/components/ActionBindModal.js +25 -13
- package/es/lowcode/painter/components/AdvancePanel.js +6 -1
- package/es/lowcode/painter/components/AttrsPanel.js +13 -11
- package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
- package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
- package/es/lowcode/painter/components/field-setting/SettingUI.js +156 -24
- package/es/lowcode/painter/components/field-setting/index.js +32 -63
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +6 -9
- package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -12
- package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -0
- package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
- package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
- package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/es/lowcode/painter/style/action-bind-modal.less +3 -3
- package/es/lowcode/painter/style/page-layout-display.less +28 -0
- package/es/lowcode/painter/style/split-display.less +0 -9
- package/es/lowcode/preview/index.js +4 -2
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/es/lowcode/view/lc-components/Box/meta.json +3 -3
- package/es/lowcode/view/lc-components/Button/index.js +2 -6
- package/es/lowcode/view/lc-components/Button/meta.json +3 -3
- package/es/lowcode/view/lc-components/Dialog/index.js +27 -2
- package/es/lowcode/view/lc-components/Dialog/meta.json +5 -5
- package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/es/lowcode/view/lc-components/Form/index.js +99 -21
- package/es/lowcode/view/lc-components/Form/meta.json +13 -7
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
- package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/es/lowcode/view/lc-components/Page/meta.json +2 -2
- package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
- package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/es/lowcode/view/lc-components/Section/meta.json +2 -2
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +11 -5
- package/es/lowcode/view/lc-components/Split/index.js +5 -9
- package/es/lowcode/view/lc-components/Split/meta.json +4 -4
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
- package/es/lowcode/view/lc-components/Table/index.js +60 -17
- package/es/lowcode/view/lc-components/Table/meta.json +15 -9
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/es/lowcode/view/lc-components/Tree/index.js +60 -18
- package/es/lowcode/view/lc-components/Tree/meta.json +55 -7
- package/es/upload/FormItem/index.js +1 -4
- package/lib/components/LDActions/index.js +7 -9
- package/lib/components/LDActions/index.less +7 -4
- package/lib/components/LdAutoForm/index.js +7 -5
- package/lib/components/LdFormList/index.js +11 -3
- package/lib/components/LdGrid/index.js +11 -5
- package/lib/components/LdGridForm/index.js +4 -2
- package/lib/components/LdTree/index.js +30 -13
- package/lib/helper/form.js +8 -4
- package/lib/locales/zh-CN.js +15 -10
- package/lib/lowcode/constants/api-url.js +113 -26
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/engine/meta/box.props.json +3 -3
- package/lib/lowcode/engine/meta/button.props.json +3 -3
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/dialog.props.json +5 -5
- package/lib/lowcode/engine/meta/drawer.props.json +8 -20
- package/lib/lowcode/engine/meta/form.props.json +13 -7
- package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
- package/lib/lowcode/engine/meta/imex.props.json +54 -22
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/lib/lowcode/engine/meta/layout.props.json +2 -2
- package/lib/lowcode/engine/meta/page.props.json +2 -2
- package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/lib/lowcode/engine/meta/section.props.json +2 -2
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +4 -4
- package/lib/lowcode/engine/meta/table.props.json +15 -9
- package/lib/lowcode/engine/meta/tabs.props.json +3 -3
- package/lib/lowcode/engine/meta/tree.props.default.json +1 -0
- package/lib/lowcode/engine/meta/tree.props.json +55 -6
- package/lib/lowcode/engine/provider/ContextProvider/index.js +11 -2
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +54 -5
- package/lib/lowcode/engine/tools/dataProcess.js +4 -0
- package/lib/lowcode/engine/tools/usePageDataStore.js +4 -2
- package/lib/lowcode/painter/DesignOperator.js +1 -1
- package/lib/lowcode/painter/DesignToolbar.js +2 -1
- package/lib/lowcode/painter/Panel.js +3 -3
- package/lib/lowcode/painter/components/ActionBindModal.js +23 -11
- package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
- package/lib/lowcode/painter/components/AttrsPanel.js +12 -10
- package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
- package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +153 -21
- package/lib/lowcode/painter/components/field-setting/index.js +32 -63
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +6 -9
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -12
- package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -0
- package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
- package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
- package/lib/lowcode/painter/style/page-layout-display.less +28 -0
- package/lib/lowcode/painter/style/split-display.less +0 -9
- package/lib/lowcode/preview/index.js +4 -2
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Button/index.js +2 -6
- package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Dialog/index.js +29 -4
- package/lib/lowcode/view/lc-components/Dialog/meta.json +5 -5
- package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/lib/lowcode/view/lc-components/Form/index.js +96 -18
- package/lib/lowcode/view/lc-components/Form/meta.json +13 -7
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
- package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
- package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +12 -6
- package/lib/lowcode/view/lc-components/Split/index.js +2 -6
- package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
- package/lib/lowcode/view/lc-components/Table/index.js +59 -16
- package/lib/lowcode/view/lc-components/Table/meta.json +15 -9
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +3 -2
- package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +58 -16
- package/lib/lowcode/view/lc-components/Tree/meta.json +55 -7
- package/lib/upload/FormItem/index.js +1 -4
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _ahooks = require("ahooks");
|
|
14
14
|
var _utils = require("@luck-design-biz/base/utils");
|
|
15
|
+
var _lodash = require("lodash");
|
|
15
16
|
var _ContextProvider = require("../../../engine/provider/ContextProvider");
|
|
16
17
|
var _index = _interopRequireDefault(require("./index"));
|
|
17
18
|
var _boxPropsDefault = _interopRequireDefault(require("../../../engine/meta/box.props.default.json"));
|
|
@@ -26,13 +27,15 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
26
27
|
id: id
|
|
27
28
|
});
|
|
28
29
|
var refreshChild = (0, _ahooks.useMemoizedFn)(function () {
|
|
29
|
-
var
|
|
30
|
-
|
|
30
|
+
var _current$children;
|
|
31
|
+
var ratioArr = display.ratio.split(':');
|
|
32
|
+
if (ratioArr.length === ((_current$children = current.children) === null || _current$children === void 0 ? void 0 : _current$children.length)) return;
|
|
33
|
+
(0, _lodash.drop)(current.children, ratioArr.length).forEach(function (boxId) {
|
|
31
34
|
(0, _ContextProvider.deleteNode)(boxId);
|
|
32
35
|
});
|
|
33
36
|
ratioArr.forEach(function (_, index) {
|
|
34
|
-
var _current$
|
|
35
|
-
if (!((_current$
|
|
37
|
+
var _current$children2;
|
|
38
|
+
if (!((_current$children2 = current.children) !== null && _current$children2 !== void 0 && _current$children2[index])) {
|
|
36
39
|
(0, _ContextProvider.addNode)(id, "box_".concat((0, _utils.suid)()), (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _boxPropsDefault.default), {}, {
|
|
37
40
|
buildIn: true
|
|
38
41
|
}));
|
|
@@ -49,9 +52,12 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
49
52
|
}, []);
|
|
50
53
|
(0, _react.useEffect)(function () {
|
|
51
54
|
var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
|
|
52
|
-
var compId = _ref3.id
|
|
55
|
+
var compId = _ref3.id,
|
|
56
|
+
newValue = _ref3.newValue;
|
|
53
57
|
if (compId !== id) return;
|
|
54
|
-
|
|
58
|
+
if (newValue.hasOwnProperty('display')) {
|
|
59
|
+
refreshChild();
|
|
60
|
+
}
|
|
55
61
|
}).watch();
|
|
56
62
|
return function () {
|
|
57
63
|
return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);
|
|
@@ -29,13 +29,11 @@ var LCSplit = function LCSplit(_ref) {
|
|
|
29
29
|
children = _ref.children,
|
|
30
30
|
css = _ref.css,
|
|
31
31
|
display = _ref.display;
|
|
32
|
-
var prevDisplay = (0, _ahooks.usePrevious)(display);
|
|
33
32
|
var ref = (0, _react.useRef)();
|
|
34
33
|
var getTargetDom = (0, _ahooks.useMemoizedFn)(function () {
|
|
35
34
|
return ref.current;
|
|
36
35
|
});
|
|
37
36
|
var _useCreation = (0, _ahooks.useCreation)(function () {
|
|
38
|
-
if ((0, _lodash.isNil)(display.ratio)) return {};
|
|
39
37
|
var arr = display.ratio.split(':').map(function (r) {
|
|
40
38
|
return parseInt(r);
|
|
41
39
|
});
|
|
@@ -53,7 +51,7 @@ var LCSplit = function LCSplit(_ref) {
|
|
|
53
51
|
}, /*#__PURE__*/_react.default.createElement(Div, {
|
|
54
52
|
ref: ref,
|
|
55
53
|
$css: css
|
|
56
|
-
},
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_base.MemorySplit, {
|
|
57
55
|
split: display.split
|
|
58
56
|
}, ratioArr.map(function (r, i) {
|
|
59
57
|
return /*#__PURE__*/_react.default.createElement(_base.MemorySplit.Pane, {
|
|
@@ -61,8 +59,6 @@ var LCSplit = function LCSplit(_ref) {
|
|
|
61
59
|
initialSize: "".concat(r / total * 100, "%"),
|
|
62
60
|
key: i
|
|
63
61
|
}, children === null || children === void 0 ? void 0 : children[i]);
|
|
64
|
-
}))
|
|
65
|
-
split: display.type === 'ltb' ? 'horizontal' : 'vertical'
|
|
66
|
-
}, children === null || children === void 0 ? void 0 : children[1], children === null || children === void 0 ? void 0 : children[2])))));
|
|
62
|
+
}))));
|
|
67
63
|
};
|
|
68
64
|
var _default = exports.default = LCSplit;
|
|
@@ -27,26 +27,26 @@
|
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
-
"css": "background-color: transparent",
|
|
30
|
+
"css": "width: 100%, height: 100%, background-color: transparent",
|
|
31
31
|
"advance": {
|
|
32
32
|
"events": [
|
|
33
33
|
{
|
|
34
34
|
"key": "onMount",
|
|
35
35
|
"name": "组件首次渲染时",
|
|
36
36
|
"desc": "在组件首次渲染时,执行方法",
|
|
37
|
-
"func": "(
|
|
37
|
+
"func": "function onMount() {\n\t\n}"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
"key": "onUnmount",
|
|
41
41
|
"name": "组件卸载时",
|
|
42
42
|
"desc": "在组件卸载时,执行方法。",
|
|
43
|
-
"func": "(
|
|
43
|
+
"func": "function onUnmount() {\n\t\n}"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"key": "onChange",
|
|
47
47
|
"name": "尺寸变化事件",
|
|
48
48
|
"desc": "在面板尺寸发生变化时,执行方法",
|
|
49
|
-
"func": "(value)
|
|
49
|
+
"func": "function onChange(value) {\n\t\n}"
|
|
50
50
|
}
|
|
51
51
|
]
|
|
52
52
|
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TopUpload = exports.TopExport = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _antd = require("luck-design/antd");
|
|
15
|
+
var _apiUrl = require("../../../../constants/api-url");
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
var _ahooks = require("ahooks");
|
|
18
|
+
var _index = _interopRequireDefault(require("../../ImEx/index.less"));
|
|
19
|
+
var _excluded = ["options"],
|
|
20
|
+
_excluded2 = ["options", "apiUrl", "tableRef"];
|
|
21
|
+
var TopUpload = exports.TopUpload = function TopUpload(_ref) {
|
|
22
|
+
var options = _ref.options,
|
|
23
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
24
|
+
var UploadConfig = {
|
|
25
|
+
name: 'file',
|
|
26
|
+
action: 'https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload',
|
|
27
|
+
headers: {
|
|
28
|
+
authorization: 'authorization-text'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Upload, UploadConfig, /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
32
|
+
type: "primary"
|
|
33
|
+
}, "\u5BFC\u5165"));
|
|
34
|
+
};
|
|
35
|
+
var TopExport = exports.TopExport = function TopExport(_ref2) {
|
|
36
|
+
var options = _ref2.options,
|
|
37
|
+
apiUrl = _ref2.apiUrl,
|
|
38
|
+
tableRef = _ref2.tableRef,
|
|
39
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
40
|
+
var _useRequest = (0, _ahooks.useRequest)(_apiUrl.exportExcel, {
|
|
41
|
+
manual: true
|
|
42
|
+
}),
|
|
43
|
+
loading = _useRequest.loading,
|
|
44
|
+
runAsync = _useRequest.runAsync,
|
|
45
|
+
data = _useRequest.data;
|
|
46
|
+
var fecthExcelState = function fecthExcelState(payload, procress, resolve, reject) {
|
|
47
|
+
// 查询进度
|
|
48
|
+
(0, _apiUrl.readExportExcelState)(payload).then(function (ret) {
|
|
49
|
+
var cpage = ret.cpage,
|
|
50
|
+
total = ret.total,
|
|
51
|
+
downloadUrl = ret.downloadUrl;
|
|
52
|
+
if (cpage >= total) {
|
|
53
|
+
resolve("".concat(window.location.origin, "/api").concat(downloadUrl));
|
|
54
|
+
} else {
|
|
55
|
+
procress(cpage / total * 100);
|
|
56
|
+
fecthExcelState(payload, procress, resolve, reject);
|
|
57
|
+
}
|
|
58
|
+
}).catch(function () {
|
|
59
|
+
reject();
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var handleExportAll = function handleExportAll(procress) {
|
|
63
|
+
return new Promise( /*#__PURE__*/function () {
|
|
64
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(resolve, reject) {
|
|
65
|
+
var joiner, payload;
|
|
66
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
67
|
+
while (1) switch (_context.prev = _context.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
joiner = apiUrl.indexOf('?') !== -1 ? '&' : '?';
|
|
70
|
+
_context.next = 3;
|
|
71
|
+
return runAsync({
|
|
72
|
+
apiUrl: "".concat(apiUrl).concat(joiner, "token=").concat(window.cookie.get(window.appConfig.authSaveKey)),
|
|
73
|
+
code: options.export
|
|
74
|
+
});
|
|
75
|
+
case 3:
|
|
76
|
+
payload = _context.sent;
|
|
77
|
+
if (payload && typeof payload === 'string') {
|
|
78
|
+
fecthExcelState(payload, procress, resolve, reject);
|
|
79
|
+
} else {
|
|
80
|
+
reject();
|
|
81
|
+
}
|
|
82
|
+
case 5:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee);
|
|
87
|
+
}));
|
|
88
|
+
return function (_x, _x2) {
|
|
89
|
+
return _ref3.apply(this, arguments);
|
|
90
|
+
};
|
|
91
|
+
}());
|
|
92
|
+
};
|
|
93
|
+
var doExportAll = function doExportAll(onExportAll) {
|
|
94
|
+
var key = 'exportAll';
|
|
95
|
+
var notificationConfig = {
|
|
96
|
+
key: key,
|
|
97
|
+
duration: null,
|
|
98
|
+
message: '正在导出数据...',
|
|
99
|
+
placement: 'bottomRight',
|
|
100
|
+
closeIcon: /*#__PURE__*/_react.default.createElement("div", null),
|
|
101
|
+
icon: /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
102
|
+
type: "cloud-download",
|
|
103
|
+
className: _index.default.exportTheme
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
var process = function process(i) {
|
|
107
|
+
_antd.notification.open((0, _objectSpread2.default)((0, _objectSpread2.default)({}, notificationConfig), {}, {
|
|
108
|
+
description: /*#__PURE__*/_react.default.createElement(_antd.Progress, {
|
|
109
|
+
percent: i
|
|
110
|
+
})
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
_antd.notification.open((0, _objectSpread2.default)((0, _objectSpread2.default)({}, notificationConfig), {}, {
|
|
114
|
+
description: /*#__PURE__*/_react.default.createElement(_antd.Progress, {
|
|
115
|
+
percent: 0
|
|
116
|
+
})
|
|
117
|
+
}));
|
|
118
|
+
onExportAll(process).then(function (ret) {
|
|
119
|
+
if (ret) {
|
|
120
|
+
window.location.href = ret;
|
|
121
|
+
}
|
|
122
|
+
_antd.notification.close(key);
|
|
123
|
+
}).catch(function () {
|
|
124
|
+
return _antd.notification.open((0, _objectSpread2.default)((0, _objectSpread2.default)({}, notificationConfig), {}, {
|
|
125
|
+
icon: /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
126
|
+
type: "cloud-download",
|
|
127
|
+
className: _index.default.exportErrorTheme
|
|
128
|
+
}),
|
|
129
|
+
message: '导出失败',
|
|
130
|
+
duration: 4
|
|
131
|
+
}));
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
135
|
+
type: "primary",
|
|
136
|
+
onClick: function onClick() {
|
|
137
|
+
if (!(0, _lodash.isString)(options.export)) {
|
|
138
|
+
// 默认右击导出行为
|
|
139
|
+
tableRef.doExportAll(tableRef.props.onExportAll);
|
|
140
|
+
} else {
|
|
141
|
+
doExportAll(handleExportAll);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, "\u5BFC\u51FA");
|
|
145
|
+
};
|
|
@@ -22,6 +22,7 @@ var _TopFilter = _interopRequireDefault(require("./components/TopFilter"));
|
|
|
22
22
|
var _helper = require("../../../engine/tools/helper");
|
|
23
23
|
var _tablePropsDefault = _interopRequireDefault(require("../../../engine/meta/table.props.default.json"));
|
|
24
24
|
var _constants = require("../../../constants");
|
|
25
|
+
var _TopImex = require("./components/TopImex");
|
|
25
26
|
var LCTable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
26
27
|
var id = _ref.id,
|
|
27
28
|
className = _ref.className,
|
|
@@ -69,6 +70,10 @@ var LCTable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
69
70
|
var instanceRef = (0, _react.useRef)();
|
|
70
71
|
(0, _react.useImperativeHandle)(apiRef, function () {
|
|
71
72
|
return {
|
|
73
|
+
/**
|
|
74
|
+
* 获取表格实例
|
|
75
|
+
* @method
|
|
76
|
+
*/
|
|
72
77
|
getInstance: function getInstance() {
|
|
73
78
|
return instanceRef.current;
|
|
74
79
|
}
|
|
@@ -176,10 +181,13 @@ var LCTable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
176
181
|
} : false;
|
|
177
182
|
}, [rowSelection, suppressRowSelectionPagination, rowSelectionMode, defaultRowSelectedCode, rowSelectableCode]);
|
|
178
183
|
var _export = (0, _ahooks.useCreation)(function () {
|
|
179
|
-
|
|
180
|
-
enableExportAll: !!impexp.export
|
|
181
|
-
apiUrl: (0, _lodash.isString)(impexp.export) ? impexp.export : void 0
|
|
184
|
+
var _temp = {
|
|
185
|
+
enableExportAll: !!impexp.export
|
|
182
186
|
};
|
|
187
|
+
if ((0, _lodash.isString)(impexp.export)) {
|
|
188
|
+
_temp.apiUrl = impexp.export;
|
|
189
|
+
}
|
|
190
|
+
return _temp;
|
|
183
191
|
}, [impexp.export]);
|
|
184
192
|
var _batchActions = (0, _ahooks.useCreation)(function () {
|
|
185
193
|
return {
|
|
@@ -236,17 +244,42 @@ var LCTable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
236
244
|
}, [fields, formatDataSource, getDataPath, columnsRewrite, columnsReset, modelParams, draggable]);
|
|
237
245
|
var renderFunctionArea = (0, _ahooks.useMemoizedFn)(function () {
|
|
238
246
|
var _topActionGroup$todoL;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
var resultComp = [];
|
|
248
|
+
if (!!(topActionGroup !== null && topActionGroup !== void 0 && (_topActionGroup$todoL = topActionGroup.todoList) !== null && _topActionGroup$todoL !== void 0 && _topActionGroup$todoL.length)) {
|
|
249
|
+
resultComp.push( /*#__PURE__*/_react.default.createElement(_index.LDActions, (0, _extends2.default)({}, topActionGroup, {
|
|
250
|
+
doAction: function doAction(action) {
|
|
251
|
+
return ctx.doAction(action, {
|
|
252
|
+
datasetCode: dataset.code
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
})));
|
|
256
|
+
}
|
|
257
|
+
if (impexp.import) {
|
|
258
|
+
var _ref2;
|
|
259
|
+
var _getProps = (_ref2 = instanceRef.current || ref.current) === null || _ref2 === void 0 ? void 0 : _ref2.getProps(),
|
|
260
|
+
apiUrl = _getProps.apiUrl;
|
|
261
|
+
resultComp.push( /*#__PURE__*/_react.default.createElement(_TopImex.TopUpload, {
|
|
262
|
+
apiUrl: apiUrl,
|
|
263
|
+
options: impexp,
|
|
264
|
+
tableRef: instanceRef.current || ref.current
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
if (impexp.export) {
|
|
268
|
+
var _ref3;
|
|
269
|
+
var _getProps2 = (_ref3 = instanceRef.current || ref.current) === null || _ref3 === void 0 ? void 0 : _ref3.getProps(),
|
|
270
|
+
_apiUrl = _getProps2.apiUrl;
|
|
271
|
+
resultComp.push( /*#__PURE__*/_react.default.createElement(_TopImex.TopExport, {
|
|
272
|
+
apiUrl: _apiUrl,
|
|
273
|
+
options: impexp,
|
|
274
|
+
tableRef: instanceRef.current || ref.current
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
return resultComp;
|
|
246
278
|
});
|
|
247
279
|
var renderFilterArea = (0, _ahooks.useMemoizedFn)(function () {
|
|
248
280
|
return topFilter ? /*#__PURE__*/_react.default.createElement(_TopFilter.default, {
|
|
249
|
-
filter: topFilter
|
|
281
|
+
filter: topFilter,
|
|
282
|
+
instance: instanceRef
|
|
250
283
|
}) : null;
|
|
251
284
|
});
|
|
252
285
|
var _wrapperProps = (0, _ahooks.useCreation)(function () {
|
|
@@ -335,11 +368,21 @@ var LCTable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
335
368
|
datasetCode: dataset.code
|
|
336
369
|
});
|
|
337
370
|
});
|
|
338
|
-
(0,
|
|
339
|
-
ctx
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
371
|
+
(0, _react.useEffect)(function () {
|
|
372
|
+
var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref5) {
|
|
373
|
+
var resource = _ref5.resource;
|
|
374
|
+
ctx.doAction(advance.events.onPagePublicResourceChanged, {
|
|
375
|
+
resource: resource,
|
|
376
|
+
instance: instanceRef.current
|
|
377
|
+
});
|
|
378
|
+
}).watch();
|
|
379
|
+
return function () {
|
|
380
|
+
ctx.$unsubscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED, tid);
|
|
381
|
+
ctx.doAction(advance.events.onUnmount, {
|
|
382
|
+
datasetCode: dataset === null || dataset === void 0 ? void 0 : dataset.code
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
}, []);
|
|
343
386
|
var getTargetDom = (0, _ahooks.useMemoizedFn)(function () {
|
|
344
387
|
return wrapperRef.current;
|
|
345
388
|
});
|
|
@@ -344,55 +344,61 @@
|
|
|
344
344
|
"key": "onMount",
|
|
345
345
|
"name": "组件首次渲染时",
|
|
346
346
|
"desc": "在组件首次渲染时,执行方法",
|
|
347
|
-
"func": "(params)
|
|
347
|
+
"func": "function onMount(params) {\n\t\n}"
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
350
|
"key": "onUnmount",
|
|
351
351
|
"name": "组件卸载时",
|
|
352
352
|
"desc": "在组件卸载时,执行方法。",
|
|
353
|
-
"func": "()
|
|
353
|
+
"func": "function onUnmount() {\n\t\n}"
|
|
354
354
|
},
|
|
355
355
|
{
|
|
356
356
|
"key": "onRowClick",
|
|
357
357
|
"name": "行单击",
|
|
358
358
|
"desc": "单击表格行时,执行方法",
|
|
359
|
-
"func": "(data, rowIndex, params)
|
|
359
|
+
"func": "function onRowClick(data, rowIndex, params) {\n\t\n}"
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
"key": "onRowDoubleClick",
|
|
363
363
|
"name": "行双击",
|
|
364
364
|
"desc": "双击表格行时,执行方法",
|
|
365
|
-
"func": "(data, rowIndex, params)
|
|
365
|
+
"func": "function onRowDoubleClick(data, rowIndex, params) {\n\t\n}"
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
"key": "onRowSelected",
|
|
369
369
|
"name": "行选择",
|
|
370
370
|
"desc": "选中行时,执行方法",
|
|
371
|
-
"func": "(data, isSelected, SelectedRows, params)
|
|
371
|
+
"func": "function onRowSelected(data, isSelected, SelectedRows, params) {\n\t\n}"
|
|
372
372
|
},
|
|
373
373
|
{
|
|
374
374
|
"key": "onRowSelectChange",
|
|
375
375
|
"name": "行选择变化",
|
|
376
376
|
"desc": "行选中发生变化时,执行方法",
|
|
377
|
-
"func": "(rows, nodes, params)
|
|
377
|
+
"func": "function onRowSelectChange(rows, nodes, params) {\n\t\n}"
|
|
378
378
|
},
|
|
379
379
|
{
|
|
380
380
|
"key": "onRowDragged",
|
|
381
381
|
"name": "行拖拽后",
|
|
382
382
|
"desc": "拖拽行使其顺序发生变化后,执行方法",
|
|
383
|
-
"func": "(toId, fromId, params)
|
|
383
|
+
"func": "function onRowDragged(toId, fromId, params) {\n\t\n}"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"key": "onPagePublicResourceChanged",
|
|
387
|
+
"name": "页面共享资源变化后",
|
|
388
|
+
"desc": "当页面共享资源发生变化后(pagePublicResourceChanged),执行方法",
|
|
389
|
+
"func": "function onPagePublicResourceChanged(resource, instance) {\n\t\n}"
|
|
384
390
|
},
|
|
385
391
|
{
|
|
386
392
|
"key": "afterInit",
|
|
387
393
|
"name": "初始化后的回调",
|
|
388
394
|
"desc": "组件及数据加载完成后,执行方法",
|
|
389
|
-
"func": "(res, dispatch, props)
|
|
395
|
+
"func": "function afterInit(res, dispatch, props) {\n\t\n}"
|
|
390
396
|
},
|
|
391
397
|
{
|
|
392
398
|
"key": "afterQuery",
|
|
393
399
|
"name": "数据读取回调",
|
|
394
400
|
"desc": "读取数据源后执行方法,返回接口中原始数据",
|
|
395
|
-
"func": "(res)
|
|
401
|
+
"func": "function afterQuery(res) {\n\t\n}"
|
|
396
402
|
}
|
|
397
403
|
]
|
|
398
404
|
}
|
|
@@ -13,6 +13,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _index = _interopRequireDefault(require("./index"));
|
|
15
15
|
var _ahooks = require("ahooks");
|
|
16
|
+
var _lodash = require("lodash");
|
|
16
17
|
var _utils = require("@luck-design-biz/base/utils");
|
|
17
18
|
var _ContextProvider = require("../../../engine/provider/ContextProvider");
|
|
18
19
|
var _boxPropsDefault = _interopRequireDefault(require("../../../engine/meta/box.props.default.json"));
|
|
@@ -45,7 +46,7 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
45
46
|
oldValue = _ref3.oldValue;
|
|
46
47
|
if (compId !== id || !newValue.hasOwnProperty('items')) return;
|
|
47
48
|
if (newValue.items.length > oldValue.items.length) {
|
|
48
|
-
var _differenceBy = differenceBy(newValue.items, oldValue.items, 'id'),
|
|
49
|
+
var _differenceBy = (0, _lodash.differenceBy)(newValue.items, oldValue.items, 'id'),
|
|
49
50
|
_differenceBy2 = (0, _slicedToArray2.default)(_differenceBy, 1),
|
|
50
51
|
newItem = _differenceBy2[0];
|
|
51
52
|
var boxId = "box_".concat((0, _utils.suid)());
|
|
@@ -54,7 +55,7 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
54
55
|
tabId: newItem.id
|
|
55
56
|
}));
|
|
56
57
|
} else if (newValue.items.length < oldValue.items.length) {
|
|
57
|
-
var _differenceBy3 = differenceBy(oldValue.items, newValue.items, 'id'),
|
|
58
|
+
var _differenceBy3 = (0, _lodash.differenceBy)(oldValue.items, newValue.items, 'id'),
|
|
58
59
|
_differenceBy4 = (0, _slicedToArray2.default)(_differenceBy3, 1),
|
|
59
60
|
removeItem = _differenceBy4[0];
|
|
60
61
|
var _boxId = current.children.find(function (childId) {
|
|
@@ -20,7 +20,9 @@ var _tabsPropsDefault = _interopRequireDefault(require("../../../engine/meta/tab
|
|
|
20
20
|
var StyledTabs = (0, _styledComponents.default)(_antd.Tabs).withConfig({
|
|
21
21
|
displayName: "StyledTabs",
|
|
22
22
|
componentId: "luckda-6530__sc-ht1jge-0"
|
|
23
|
-
})(["", ""], function (props) {
|
|
23
|
+
})([".ant-tabs-content{", " overflow-x:hidden;overflow-y:auto;}", ""], function (props) {
|
|
24
|
+
return props.type === 'line' ? 'height: calc(100% - 62px);' : 'height: calc(100% - 56px);';
|
|
25
|
+
}, function (props) {
|
|
24
26
|
return props.$css;
|
|
25
27
|
});
|
|
26
28
|
var LCTabs = function LCTabs(_ref) {
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
"key": "onMount",
|
|
95
95
|
"name": "组件首次渲染时",
|
|
96
96
|
"desc": "在组件首次渲染时,执行方法",
|
|
97
|
-
"func": "(
|
|
97
|
+
"func": "function onMount() {\n\t\n}"
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"key": "onUnmount",
|
|
101
101
|
"name": "组件卸载时",
|
|
102
102
|
"desc": "在组件卸载时,执行方法。",
|
|
103
|
-
"func": "(
|
|
103
|
+
"func": "function onUnmount() {\n\t\n}"
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"key": "onTabClick",
|
|
107
107
|
"name": "tab被点击的回调",
|
|
108
108
|
"desc": "当tab被点击时, 执行方法",
|
|
109
|
-
"func": "(tabKey, e)
|
|
109
|
+
"func": "function onTabClick(tabKey, e) {\n\t\n}"
|
|
110
110
|
}
|
|
111
111
|
]
|
|
112
112
|
}
|
|
@@ -71,7 +71,8 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
71
71
|
className: _index2.default['runtime-tree'],
|
|
72
72
|
draggable: false,
|
|
73
73
|
suppressInit: true,
|
|
74
|
-
onDataSetChange: handleDataSetChange
|
|
74
|
+
onDataSetChange: handleDataSetChange,
|
|
75
|
+
asyncLoad: false
|
|
75
76
|
}), children);
|
|
76
77
|
};
|
|
77
78
|
var _default = exports.default = FunctionDesign;
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -22,7 +23,8 @@ var _index = require("../../../../index");
|
|
|
22
23
|
var _helper = require("../../../engine/tools/helper");
|
|
23
24
|
var _treePropsDefault = _interopRequireDefault(require("../../../engine/meta/tree.props.default.json"));
|
|
24
25
|
var _index2 = _interopRequireDefault(require("./index.less"));
|
|
25
|
-
var _excluded = ["id", "wrapperRef", "className", "dataset", "width", "height", "showLine", "defaultExpandDeep", "actions", "editable", "showRootAdd", "onlyRoot", "rootAddSetting", "doubleClickExpand", "onDoubleClick", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "onTreeNodeRender", "treeNodeIcon", "advance"];
|
|
26
|
+
var _excluded = ["id", "wrapperRef", "className", "dataset", "width", "height", "showLine", "defaultExpandDeep", "actions", "editable", "showRootAdd", "onlyRoot", "rootAddSetting", "doubleClickExpand", "onDoubleClick", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "onTreeNodeRender", "treeNodeIcon", "advance", "cancelSelect", "defaultSelect"];
|
|
27
|
+
var PRIMARY = window.appConfig.constraintKeys.PRIMARY;
|
|
26
28
|
var LCTree = function LCTree(_ref) {
|
|
27
29
|
var id = _ref.id,
|
|
28
30
|
wrapperRef = _ref.wrapperRef,
|
|
@@ -45,16 +47,36 @@ var LCTree = function LCTree(_ref) {
|
|
|
45
47
|
onTreeNodeRender = _ref.onTreeNodeRender,
|
|
46
48
|
_treeNodeIcon = _ref.treeNodeIcon,
|
|
47
49
|
advance = _ref.advance,
|
|
50
|
+
cancelSelect = _ref.cancelSelect,
|
|
51
|
+
defaultSelect = _ref.defaultSelect,
|
|
48
52
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
49
53
|
var ctx = (0, _ContextProvider.useContext)();
|
|
50
54
|
var boxRef = (0, _react.useRef)();
|
|
51
55
|
var treeRef = (0, _react.useRef)();
|
|
56
|
+
var _useState = (0, _react.useState)([]),
|
|
57
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
58
|
+
selectedKeys = _useState2[0],
|
|
59
|
+
setSelectedKeys = _useState2[1];
|
|
52
60
|
var getTargetDom = (0, _ahooks.useMemoizedFn)(function () {
|
|
53
61
|
return boxRef.current;
|
|
54
62
|
});
|
|
55
63
|
(0, _react.useImperativeHandle)(wrapperRef, function () {
|
|
56
64
|
return treeRef.current;
|
|
57
65
|
});
|
|
66
|
+
(0, _react.useEffect)(function () {
|
|
67
|
+
var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref2) {
|
|
68
|
+
var resource = _ref2.resource,
|
|
69
|
+
prevResource = _ref2.prevResource;
|
|
70
|
+
ctx.doAction(advance.events.onPagePublicResourceChanged, {
|
|
71
|
+
resource: resource,
|
|
72
|
+
prevResource: prevResource,
|
|
73
|
+
instance: treeRef.current
|
|
74
|
+
});
|
|
75
|
+
}).watch();
|
|
76
|
+
return function () {
|
|
77
|
+
ctx.$unsubscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED, tid);
|
|
78
|
+
};
|
|
79
|
+
}, []);
|
|
58
80
|
var handleMount = (0, _ahooks.useMemoizedFn)(function (params) {
|
|
59
81
|
ctx.doAction(advance.events.onMount, {
|
|
60
82
|
params: params
|
|
@@ -80,6 +102,12 @@ var LCTree = function LCTree(_ref) {
|
|
|
80
102
|
e: e
|
|
81
103
|
});
|
|
82
104
|
});
|
|
105
|
+
var handleDrop = (0, _ahooks.useMemoizedFn)(function (info, dragInfo) {
|
|
106
|
+
ctx.doAction(advance.events.onCheck, {
|
|
107
|
+
info: info,
|
|
108
|
+
dragInfo: dragInfo
|
|
109
|
+
});
|
|
110
|
+
});
|
|
83
111
|
var events = (0, _ahooks.useCreation)(function () {
|
|
84
112
|
if (advance !== null && advance !== void 0 && advance.events) {
|
|
85
113
|
var _events = {};
|
|
@@ -88,24 +116,31 @@ var LCTree = function LCTree(_ref) {
|
|
|
88
116
|
if (advance.events.processDataSource) _events.dataToTreeFormat = handleProcessDataSource;
|
|
89
117
|
if (advance.events.onDoubleClick) _events.onNodeDoubleClick = handleNodeDoubleClick;
|
|
90
118
|
if (advance.events.onCheck) _events.onCheck = handleCheck;
|
|
119
|
+
if (advance.events.onDrop) _events.onDrop = handleDrop;
|
|
91
120
|
return _events;
|
|
92
121
|
}
|
|
93
122
|
return {};
|
|
94
123
|
}, [advance === null || advance === void 0 ? void 0 : advance.events]);
|
|
95
|
-
var
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// fromId: info.dragNode.props.dataRef[PRIMARY],
|
|
102
|
-
// toId: info.node.props.dataRef[PRIMARY],
|
|
103
|
-
// }
|
|
104
|
-
// }, {
|
|
105
|
-
// showConfirm: false,
|
|
106
|
-
// callback: (success) => success && onLdQuery()
|
|
107
|
-
// });
|
|
124
|
+
var handleSelect = (0, _ahooks.useMemoizedFn)(function (_selectedKeys, e) {
|
|
125
|
+
if (cancelSelect || e.selected) {
|
|
126
|
+
setSelectedKeys(_selectedKeys);
|
|
127
|
+
ctx.setPagePublicResource((0, _defineProperty2.default)({}, id, {
|
|
128
|
+
selectedNodes: e.selectedNodes
|
|
129
|
+
}));
|
|
108
130
|
}
|
|
131
|
+
ctx.doAction(advance.events.onSelect, {
|
|
132
|
+
checkedKeys: _selectedKeys,
|
|
133
|
+
e: e
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
var afterInit = (0, _ahooks.useMemoizedFn)(function (treeData, data) {
|
|
137
|
+
var selected = !(0, _lodash.isNil)(defaultSelect) ? (0, _helper.executeCode)(ctx, defaultSelect, ['treeData'], treeData) : null;
|
|
138
|
+
selected && handleSelect(selected, {
|
|
139
|
+
selected: true,
|
|
140
|
+
selectedNodes: selected.map(function (key) {
|
|
141
|
+
return (0, _lodash.keyBy)(data, PRIMARY)[key];
|
|
142
|
+
})
|
|
143
|
+
});
|
|
109
144
|
});
|
|
110
145
|
return /*#__PURE__*/_react.default.createElement(_Wrapper.default, {
|
|
111
146
|
id: id,
|
|
@@ -183,7 +218,9 @@ var LCTree = function LCTree(_ref) {
|
|
|
183
218
|
onTreeNodeRender: onTreeNodeRender ? function (title, i) {
|
|
184
219
|
return (0, _helper.executeCode)(ctx, onTreeNodeRender, ['title', 'item'], title, i);
|
|
185
220
|
} : null,
|
|
186
|
-
|
|
221
|
+
selectedKeys: selectedKeys,
|
|
222
|
+
onSelect: handleSelect,
|
|
223
|
+
afterInit: afterInit
|
|
187
224
|
}, events, props))));
|
|
188
225
|
};
|
|
189
226
|
LCTree.propTypes = {
|
|
@@ -340,7 +377,12 @@ LCTree.propTypes = {
|
|
|
340
377
|
* @name 复选框选择事件
|
|
341
378
|
* @type _JSEditor
|
|
342
379
|
*/
|
|
343
|
-
onCheck: _propTypes.default.string
|
|
380
|
+
onCheck: _propTypes.default.string,
|
|
381
|
+
/**
|
|
382
|
+
* @name 选中事件
|
|
383
|
+
* @type _JSEditor
|
|
384
|
+
*/
|
|
385
|
+
onSelect: _propTypes.default.string
|
|
344
386
|
};
|
|
345
387
|
LCTree.defaultProps = (0, _helper.omitBadProps)(_treePropsDefault.default);
|
|
346
388
|
var _default = exports.default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|