@luck-design-biz/luckda 1.0.1-12 → 1.0.1-13
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/LdCard/index.js +147 -67
- package/es/components/LdTree/index.less +2 -0
- package/es/locales/zh-CN.js +4 -2
- package/es/lowcode/engine/meta/cardlist.props.default.json +27 -7
- package/es/lowcode/engine/meta/cardlist.props.json +252 -71
- package/es/lowcode/engine/meta/components-list.json +24 -0
- package/es/lowcode/engine/meta/iframe.props.default.json +1 -2
- package/es/lowcode/engine/meta/iframe.props.json +2 -3
- package/es/lowcode/engine/meta/image.props.default.json +3 -3
- package/es/lowcode/engine/meta/image.props.json +49 -15
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +14 -1
- package/es/lowcode/engine/meta/link.props.default.json +1 -2
- package/es/lowcode/engine/meta/link.props.json +8 -9
- package/es/lowcode/painter/Ribbon.js +12 -0
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +2 -1
- package/es/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +20 -2
- package/es/lowcode/painter/panel-section/ActionsEditor/index.js +18 -3
- package/es/lowcode/painter/panel-section/GroupClassSelector.js +1 -1
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +1 -0
- package/es/lowcode/painter/panel-section/TableTopFilter.js +3 -3
- package/es/lowcode/view/lc-components/CardList/index.js +476 -12
- package/es/lowcode/view/lc-components/CardList/meta.json +253 -72
- package/es/lowcode/view/lc-components/GroupTree/index.js +1 -1
- package/es/lowcode/view/lc-components/Iframe/index.js +57 -6
- package/es/lowcode/view/lc-components/Iframe/meta.json +2 -3
- package/es/lowcode/view/lc-components/Image/index.js +61 -5
- package/es/lowcode/view/lc-components/Image/index.less +27 -0
- package/es/lowcode/view/lc-components/Image/meta.json +49 -15
- package/es/lowcode/view/lc-components/Link/index.js +34 -4
- package/es/lowcode/view/lc-components/Link/index.less +15 -0
- package/es/lowcode/view/lc-components/Link/meta.json +8 -9
- package/es/lowcode/view/lc-components/Table/index.js +2 -2
- package/lib/components/LdCard/index.js +146 -66
- package/lib/components/LdTree/index.less +2 -0
- package/lib/locales/zh-CN.js +4 -2
- package/lib/lowcode/engine/meta/cardlist.props.default.json +27 -7
- package/lib/lowcode/engine/meta/cardlist.props.json +252 -71
- package/lib/lowcode/engine/meta/components-list.json +24 -0
- package/lib/lowcode/engine/meta/iframe.props.default.json +1 -2
- package/lib/lowcode/engine/meta/iframe.props.json +2 -3
- package/lib/lowcode/engine/meta/image.props.default.json +3 -3
- package/lib/lowcode/engine/meta/image.props.json +49 -15
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +14 -1
- package/lib/lowcode/engine/meta/link.props.default.json +1 -2
- package/lib/lowcode/engine/meta/link.props.json +8 -9
- package/lib/lowcode/painter/Ribbon.js +12 -0
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +2 -1
- package/lib/lowcode/painter/panel-section/ActionsEditor/ActionEditor.js +19 -1
- package/lib/lowcode/painter/panel-section/ActionsEditor/index.js +18 -3
- package/lib/lowcode/painter/panel-section/GroupClassSelector.js +1 -1
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +1 -0
- package/lib/lowcode/painter/panel-section/TableTopFilter.js +3 -3
- package/lib/lowcode/view/lc-components/CardList/index.js +475 -11
- package/lib/lowcode/view/lc-components/CardList/meta.json +253 -72
- package/lib/lowcode/view/lc-components/GroupTree/index.js +1 -1
- package/lib/lowcode/view/lc-components/Iframe/index.js +56 -5
- package/lib/lowcode/view/lc-components/Iframe/meta.json +2 -3
- package/lib/lowcode/view/lc-components/Image/index.js +60 -4
- package/lib/lowcode/view/lc-components/Image/index.less +27 -0
- package/lib/lowcode/view/lc-components/Image/meta.json +49 -15
- package/lib/lowcode/view/lc-components/Link/index.js +34 -4
- package/lib/lowcode/view/lc-components/Link/index.less +15 -0
- package/lib/lowcode/view/lc-components/Link/meta.json +8 -9
- package/lib/lowcode/view/lc-components/Table/index.js +2 -2
- package/package.json +176 -176
|
@@ -68,6 +68,10 @@ var Ribbon = function Ribbon() {
|
|
|
68
68
|
})
|
|
69
69
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
70
70
|
type: "apartment",
|
|
71
|
+
style: {
|
|
72
|
+
color: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_OUTLINE_.key && '#1d79f2',
|
|
73
|
+
fontSize: 20
|
|
74
|
+
},
|
|
71
75
|
onClick: function onClick() {
|
|
72
76
|
return setDrawer((drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_OUTLINE_.key ? null : _DRAWER_OUTLINE_);
|
|
73
77
|
}
|
|
@@ -79,6 +83,10 @@ var Ribbon = function Ribbon() {
|
|
|
79
83
|
})
|
|
80
84
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
81
85
|
type: "appstore",
|
|
86
|
+
style: {
|
|
87
|
+
color: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_COMPONENTS_.key && '#1d79f2',
|
|
88
|
+
fontSize: 20
|
|
89
|
+
},
|
|
82
90
|
onClick: function onClick() {
|
|
83
91
|
return setDrawer((drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_COMPONENTS_.key ? null : _DRAWER_COMPONENTS_);
|
|
84
92
|
}
|
|
@@ -90,6 +98,10 @@ var Ribbon = function Ribbon() {
|
|
|
90
98
|
})
|
|
91
99
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
92
100
|
type: "global",
|
|
101
|
+
style: {
|
|
102
|
+
color: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_I18N_.key && '#1d79f2',
|
|
103
|
+
fontSize: 20
|
|
104
|
+
},
|
|
93
105
|
onClick: function onClick() {
|
|
94
106
|
return setDrawer((drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_I18N_.key ? null : _DRAWER_I18N_);
|
|
95
107
|
}
|
|
@@ -76,7 +76,8 @@ var BaseEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
76
76
|
onDidChangeStorage: function onDidChangeStorage() {}
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
|
|
79
|
+
// 监听布局变化,重新赋值,解决编辑器全屏切换时,编辑器空白的问题
|
|
80
|
+
editorInstance.current.onDidLayoutChange(function (event) {
|
|
80
81
|
if (onChange) onChange(editorInstance.current.getValue(), event);
|
|
81
82
|
});
|
|
82
83
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { useMemoizedFn } from 'ahooks';
|
|
3
|
-
import { Input, Segmented } from 'luck-design/antd';
|
|
3
|
+
import { Input, Segmented, Popover } from 'luck-design/antd';
|
|
4
4
|
import { cloneDeep } from 'lodash';
|
|
5
5
|
import { PopForm, PopFormItem, PopFormItemLeft, PopFormItemRight } from "../../components/PopForm";
|
|
6
6
|
import SerialsSelector from "../SerialsSelector";
|
|
7
7
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
8
|
+
import IconChoice from "../Icon";
|
|
9
|
+
import IconSelector from "../IconSelector";
|
|
8
10
|
var _I18N_PREFIX_ = 'luckda.lowcode.painter.panel-section.actionEditor';
|
|
9
11
|
var _SERIAL_EFFECT_OPTIONS_ = [{
|
|
10
12
|
label: formatMessage({
|
|
@@ -48,6 +50,8 @@ var ActionEditor = function ActionEditor(_ref) {
|
|
|
48
50
|
var action = _ref.action,
|
|
49
51
|
onChange = _ref.onChange,
|
|
50
52
|
suppressName = _ref.suppressName,
|
|
53
|
+
_ref$suppressIcon = _ref.suppressIcon,
|
|
54
|
+
suppressIcon = _ref$suppressIcon === void 0 ? true : _ref$suppressIcon,
|
|
51
55
|
suppressRiskLevel = _ref.suppressRiskLevel;
|
|
52
56
|
var valueRef = useRef(cloneDeep(action));
|
|
53
57
|
var handleChange = useMemoizedFn(function (field, value) {
|
|
@@ -67,7 +71,21 @@ var ActionEditor = function ActionEditor(_ref) {
|
|
|
67
71
|
id: "".concat(_I18N_PREFIX_, ".name.placeholder"),
|
|
68
72
|
label: '请输入行为名称'
|
|
69
73
|
})
|
|
70
|
-
}))), /*#__PURE__*/React.createElement(PopFormItem, null, /*#__PURE__*/React.createElement(PopFormItemLeft, null, formatMessage({
|
|
74
|
+
}))), !suppressIcon && /*#__PURE__*/React.createElement(PopFormItem, null, /*#__PURE__*/React.createElement(PopFormItemLeft, null, formatMessage({
|
|
75
|
+
id: "".concat(_I18N_PREFIX_, ".icon"),
|
|
76
|
+
label: '图标'
|
|
77
|
+
})), /*#__PURE__*/React.createElement(PopFormItemRight, null, /*#__PURE__*/React.createElement(Popover, {
|
|
78
|
+
placement: "left",
|
|
79
|
+
content: /*#__PURE__*/React.createElement(IconSelector, {
|
|
80
|
+
value: action.icon,
|
|
81
|
+
onChange: function onChange(value) {
|
|
82
|
+
return handleChange('icon', value);
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
trigger: "click"
|
|
86
|
+
}, /*#__PURE__*/React.createElement(IconChoice, {
|
|
87
|
+
value: action.icon
|
|
88
|
+
})))), /*#__PURE__*/React.createElement(PopFormItem, null, /*#__PURE__*/React.createElement(PopFormItemLeft, null, formatMessage({
|
|
71
89
|
id: "".concat(_I18N_PREFIX_, ".serial"),
|
|
72
90
|
label: '资源串'
|
|
73
91
|
})), /*#__PURE__*/React.createElement(PopFormItemRight, null, /*#__PURE__*/React.createElement(SerialsSelector, {
|
|
@@ -12,6 +12,7 @@ import PopConfirm from "../../components/PopConfirm";
|
|
|
12
12
|
import ActionBindModal from "../../components/ActionBindModal";
|
|
13
13
|
import { formatMessage, suid } from '@luck-design-biz/base/utils';
|
|
14
14
|
import { listReducer } from "../../../engine/tools/helper";
|
|
15
|
+
import IconFont from "../../../../components/IconFont";
|
|
15
16
|
import styles from "../../style/actions-editor.less";
|
|
16
17
|
var _I18N_PREFIX_ = 'luckda.lowcode.painter.panel-section.actionsEditor';
|
|
17
18
|
var _DISPLAY_OPTIONS_ = [{
|
|
@@ -32,6 +33,8 @@ var ActionsEditor = function ActionsEditor(_ref) {
|
|
|
32
33
|
defaultValue = _ref.defaultValue,
|
|
33
34
|
onChange = _ref.onChange,
|
|
34
35
|
suppressDisplay = _ref.suppressDisplay,
|
|
36
|
+
_ref$suppressIcon = _ref.suppressIcon,
|
|
37
|
+
suppressIcon = _ref$suppressIcon === void 0 ? true : _ref$suppressIcon,
|
|
35
38
|
suppressMax = _ref.suppressMax,
|
|
36
39
|
suppressMore = _ref.suppressMore,
|
|
37
40
|
defaultCode = _ref.defaultCode;
|
|
@@ -53,7 +56,8 @@ var ActionsEditor = function ActionsEditor(_ref) {
|
|
|
53
56
|
serial: void 0,
|
|
54
57
|
serialEffect: 'hidden',
|
|
55
58
|
riskLevel: 'default',
|
|
56
|
-
actionPool: []
|
|
59
|
+
actionPool: [],
|
|
60
|
+
icon: suppressIcon ? null : 'iconyingyongguanli'
|
|
57
61
|
},
|
|
58
62
|
callback: function callback(newActions) {
|
|
59
63
|
valueRef.current.todoList = newActions;
|
|
@@ -110,7 +114,8 @@ var ActionsEditor = function ActionsEditor(_ref) {
|
|
|
110
114
|
action: action,
|
|
111
115
|
onChange: function onChange(value) {
|
|
112
116
|
return handleValueChange('action', value);
|
|
113
|
-
}
|
|
117
|
+
},
|
|
118
|
+
suppressIcon: suppressIcon
|
|
114
119
|
})
|
|
115
120
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
116
121
|
type: "edit",
|
|
@@ -207,11 +212,21 @@ var ActionsEditor = function ActionsEditor(_ref) {
|
|
|
207
212
|
}),
|
|
208
213
|
handleAdd: handleAdd
|
|
209
214
|
}, todoList.map(function (action) {
|
|
215
|
+
var _action$icon;
|
|
210
216
|
return /*#__PURE__*/React.createElement(SortItem, {
|
|
211
217
|
key: action.id,
|
|
212
218
|
id: action.id
|
|
213
219
|
}, /*#__PURE__*/React.createElement(ListEditorItem, {
|
|
214
|
-
left: /*#__PURE__*/React.createElement("
|
|
220
|
+
left: /*#__PURE__*/React.createElement("p", {
|
|
221
|
+
style: {
|
|
222
|
+
margin: 0
|
|
223
|
+
}
|
|
224
|
+
}, suppressIcon ? null : /*#__PURE__*/React.createElement(IconFont, {
|
|
225
|
+
type: (_action$icon = action.icon) !== null && _action$icon !== void 0 ? _action$icon : 'iconyingyongguanli',
|
|
226
|
+
style: {
|
|
227
|
+
marginRight: '4px'
|
|
228
|
+
}
|
|
229
|
+
}), /*#__PURE__*/React.createElement("span", null, action.name)),
|
|
215
230
|
right: renderItemRight(action),
|
|
216
231
|
item: action,
|
|
217
232
|
dispatch: dispatch
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
5
|
import { useAsyncEffect } from 'ahooks';
|
|
6
6
|
import { Select } from 'luck-design/antd';
|
|
7
|
-
import { readAllClass } from '@luck-design-biz/base/sys/services';
|
|
7
|
+
import { readAllClass } from '@luck-design-biz/base/lib/sys/services';
|
|
8
8
|
var GroupClassSelector = function GroupClassSelector(_ref) {
|
|
9
9
|
var defaultValue = _ref.defaultValue,
|
|
10
10
|
_onChange = _ref.onChange;
|
|
@@ -160,9 +160,9 @@ var TableTopFilter = function TableTopFilter(_ref) {
|
|
|
160
160
|
id: "".concat(_I18N_PREFIX_, ".field.placeholder"),
|
|
161
161
|
label: '请选择过滤字段'
|
|
162
162
|
}),
|
|
163
|
-
onChange: function onChange(
|
|
163
|
+
onChange: function onChange(value) {
|
|
164
164
|
return handleChange(_objectSpread(_objectSpread({}, opt), {}, {
|
|
165
|
-
field:
|
|
165
|
+
field: value
|
|
166
166
|
}));
|
|
167
167
|
}
|
|
168
168
|
}))))
|
|
@@ -184,7 +184,7 @@ var TableTopFilter = function TableTopFilter(_ref) {
|
|
|
184
184
|
cursor: 'pointer'
|
|
185
185
|
},
|
|
186
186
|
onClick: function onClick() {
|
|
187
|
-
return handleDelete(
|
|
187
|
+
return handleDelete(opt);
|
|
188
188
|
}
|
|
189
189
|
})));
|
|
190
190
|
});
|
|
@@ -1,21 +1,485 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import React, { useRef } from 'react';
|
|
4
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import React, { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { isNil, keyBy } from 'lodash';
|
|
8
|
+
import { Modal, recheck, IconFont } from '@luck-design-biz/base';
|
|
9
|
+
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
5
10
|
import Wrapper from "../Wrapper";
|
|
6
|
-
|
|
11
|
+
import { LdCard, LDActions } from "../../../../index";
|
|
12
|
+
import TopFilter from "../Table/components/TopFilter";
|
|
13
|
+
import { omitBadProps, executeCode } from "../../../engine/tools/helper";
|
|
14
|
+
import useCombinedRefs from "../../../engine/tools/useCombinedRefs";
|
|
15
|
+
import defaultMeta from "../../../engine/meta/cardlist.props.default.json";
|
|
16
|
+
import { LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT } from "../../../constants";
|
|
17
|
+
var LCCardList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
18
|
var id = _ref.id,
|
|
8
|
-
|
|
9
|
-
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
dataset = _ref.dataset,
|
|
21
|
+
readOnly = _ref.readOnly,
|
|
22
|
+
draggable = _ref.draggable,
|
|
23
|
+
col = _ref.col,
|
|
24
|
+
autoLoad = _ref.autoLoad,
|
|
25
|
+
pagination = _ref.pagination,
|
|
26
|
+
topActionGroup = _ref.topActionGroup,
|
|
27
|
+
topFilter = _ref.topFilter,
|
|
28
|
+
actions = _ref.actions,
|
|
29
|
+
suppressActions = _ref.suppressActions,
|
|
30
|
+
advance = _ref.advance,
|
|
31
|
+
showAddCard = _ref.showAddCard,
|
|
32
|
+
addCardHeight = _ref.addCardHeight,
|
|
33
|
+
addCardWords = _ref.addCardWords,
|
|
34
|
+
rowSelection = _ref.rowSelection,
|
|
35
|
+
disabledCheckbox = _ref.disabledCheckbox,
|
|
36
|
+
batchOperations = _ref.batchOperations,
|
|
37
|
+
pageSize = _ref.pageSize,
|
|
38
|
+
nocardBoxborder = _ref.nocardBoxborder,
|
|
39
|
+
showAvatar = _ref.showAvatar,
|
|
40
|
+
avatarUrl = _ref.avatarUrl,
|
|
41
|
+
showTitle = _ref.showTitle,
|
|
42
|
+
showDesc = _ref.showDesc,
|
|
43
|
+
renderTitle = _ref.renderTitle,
|
|
44
|
+
renderDescribe = _ref.renderDescribe,
|
|
45
|
+
renderContent = _ref.renderContent,
|
|
46
|
+
describeLines = _ref.describeLines;
|
|
47
|
+
var ctx = useContext();
|
|
48
|
+
var apiRef = useRef();
|
|
49
|
+
var wrapperRef = useRef();
|
|
50
|
+
var instanceRef = useCombinedRefs(ref);
|
|
51
|
+
useImperativeHandle(apiRef, function () {
|
|
52
|
+
return {
|
|
53
|
+
/**
|
|
54
|
+
* 获取表格实例
|
|
55
|
+
* @method
|
|
56
|
+
*/
|
|
57
|
+
getInstance: function getInstance() {
|
|
58
|
+
return instanceRef.current;
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* 刷新表格
|
|
62
|
+
* @method
|
|
63
|
+
*/
|
|
64
|
+
refresh: function refresh() {
|
|
65
|
+
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
66
|
+
return instanceRef.current.onLdQuery(init ? {
|
|
67
|
+
removeAll: {
|
|
68
|
+
operate: 'removeAll'
|
|
69
|
+
}
|
|
70
|
+
} : null);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
var onActionClick = useMemoizedFn(function (action, props) {
|
|
75
|
+
var doAction = function doAction() {
|
|
76
|
+
ctx.doAction(action.actionPool, props);
|
|
77
|
+
};
|
|
78
|
+
if (action.riskLevel === 'danger') {
|
|
79
|
+
Modal.confirm({
|
|
80
|
+
title: "\u786E\u8BA4\u6267\u884C".concat(action.name, "\u884C\u4E3A\u64CD\u4F5C\u5417\uFF1F"),
|
|
81
|
+
onOk: doAction
|
|
82
|
+
});
|
|
83
|
+
} else if (action.riskLevel === 'destroy') {
|
|
84
|
+
recheck({
|
|
85
|
+
title: "\u786E\u8BA4\u6267\u884C".concat(action.name, "\u884C\u4E3A\u64CD\u4F5C\u5417\uFF1F"),
|
|
86
|
+
checkWords: "\u6267\u884C".concat(action.name),
|
|
87
|
+
onOk: doAction
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
doAction();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var _cardActions = useCreation(function () {
|
|
94
|
+
return suppressActions ? [] : actions.todoList.map(function (action) {
|
|
95
|
+
return {
|
|
96
|
+
key: action.id,
|
|
97
|
+
resource: action.serialEffect === "hidden" ? action.serial : null,
|
|
98
|
+
title: action.name,
|
|
99
|
+
iconNode: action.icon ? /*#__PURE__*/React.createElement(IconFont, {
|
|
100
|
+
type: action.icon
|
|
101
|
+
}) : action.name,
|
|
102
|
+
onClick: function onClick(data, e) {
|
|
103
|
+
return onActionClick(action, {
|
|
104
|
+
data: data,
|
|
105
|
+
e: e
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
style: action.riskLevel === 'default' ? null : {
|
|
109
|
+
color: {
|
|
110
|
+
danger: '#ff7875',
|
|
111
|
+
destroy: '#ff4d4f'
|
|
112
|
+
}[action.riskLevel]
|
|
113
|
+
},
|
|
114
|
+
disabled: action.serialEffect === "disable"
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
}, [suppressActions, actions]);
|
|
118
|
+
var _batchOperations = useCreation(function () {
|
|
119
|
+
return rowSelection && !readOnly ? batchOperations.todoList.map(function (action) {
|
|
120
|
+
return {
|
|
121
|
+
key: action.id,
|
|
122
|
+
wanted: action.serialEffect === "hidden" ? action.serial : null,
|
|
123
|
+
title: action.name,
|
|
124
|
+
style: action.riskLevel === 'default' ? null : {
|
|
125
|
+
color: {
|
|
126
|
+
danger: '#ff7875',
|
|
127
|
+
destroy: '#ff4d4f'
|
|
128
|
+
}[action.riskLevel]
|
|
129
|
+
},
|
|
130
|
+
disabled: action.serialEffect === "disable"
|
|
131
|
+
};
|
|
132
|
+
}) : [];
|
|
133
|
+
}, [rowSelection, batchOperations, readOnly]);
|
|
134
|
+
var batchOperationsByKey = useCreation(function () {
|
|
135
|
+
return keyBy(batchOperations.todoList, 'id');
|
|
136
|
+
}, [batchOperations.todoList]);
|
|
137
|
+
var handleBatchOperationsClick = useMemoizedFn(function (key, data) {
|
|
138
|
+
var action = batchOperationsByKey[key];
|
|
139
|
+
if (action) onActionClick(action, {
|
|
140
|
+
data: data
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
var renderFunctionArea = useCallback(function () {
|
|
144
|
+
var _topActionGroup$todoL;
|
|
145
|
+
var resultComp = [];
|
|
146
|
+
if (!!(topActionGroup !== null && topActionGroup !== void 0 && (_topActionGroup$todoL = topActionGroup.todoList) !== null && _topActionGroup$todoL !== void 0 && _topActionGroup$todoL.length)) {
|
|
147
|
+
resultComp.push( /*#__PURE__*/React.createElement(LDActions, _extends({}, topActionGroup, {
|
|
148
|
+
doAction: function doAction(action) {
|
|
149
|
+
return ctx.doAction(action, {
|
|
150
|
+
instance: instanceRef.current,
|
|
151
|
+
datasetCode: dataset.code
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
})));
|
|
155
|
+
}
|
|
156
|
+
return resultComp;
|
|
157
|
+
}, [topActionGroup]);
|
|
158
|
+
var renderFilterArea = useCallback(function () {
|
|
159
|
+
return topFilter ? /*#__PURE__*/React.createElement(TopFilter, {
|
|
160
|
+
filter: topFilter,
|
|
161
|
+
instance: instanceRef
|
|
162
|
+
}) : null;
|
|
163
|
+
}, [topFilter]);
|
|
164
|
+
var handleOperationsClick = useMemoizedFn(function (key, data, e) {
|
|
165
|
+
switch (key) {
|
|
166
|
+
case 'read':
|
|
167
|
+
ctx.doAction(advance.events.onCardClick, {
|
|
168
|
+
data: data,
|
|
169
|
+
e: e
|
|
170
|
+
});
|
|
171
|
+
break;
|
|
172
|
+
case 'delete':
|
|
173
|
+
ctx.doAction(advance.events.onCardDelete, {
|
|
174
|
+
data: data,
|
|
175
|
+
e: e
|
|
176
|
+
});
|
|
177
|
+
break;
|
|
178
|
+
default:
|
|
179
|
+
;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
var getCheckboxDisabled = useMemoizedFn(function (record) {
|
|
183
|
+
if (isNil(disabledCheckbox)) return false;
|
|
184
|
+
return executeCode(ctx, disabledCheckbox, ['record'], record);
|
|
185
|
+
});
|
|
186
|
+
var getCheckboxProps = useMemoizedFn(function (record) {
|
|
187
|
+
return {
|
|
188
|
+
disabled: getCheckboxDisabled(record)
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
var _avatarUrl = useMemoizedFn(function (record) {
|
|
192
|
+
if (isNil(avatarUrl)) return null;
|
|
193
|
+
return executeCode(ctx, avatarUrl, ['record'], record);
|
|
194
|
+
});
|
|
195
|
+
var _renderTitle = useMemoizedFn(function (record) {
|
|
196
|
+
if (isNil(renderTitle)) return record.sname;
|
|
197
|
+
return executeCode(ctx, renderTitle, ['record'], record);
|
|
198
|
+
});
|
|
199
|
+
var _renderDescribe = useMemoizedFn(function (record) {
|
|
200
|
+
if (isNil(renderDescribe)) return record.describe;
|
|
201
|
+
return executeCode(ctx, renderDescribe, ['record'], record);
|
|
202
|
+
});
|
|
203
|
+
var _renderContent = useMemoizedFn(function (record) {
|
|
204
|
+
if (isNil(renderContent)) return null;
|
|
205
|
+
return executeCode(ctx, renderContent, ['record'], record);
|
|
206
|
+
});
|
|
207
|
+
var handleMount = useMemoizedFn(function (params) {
|
|
208
|
+
ctx.doAction(advance.events.onMount, {
|
|
209
|
+
params: params
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
var handleUnmount = useMemoizedFn(function () {
|
|
213
|
+
ctx.doAction(advance.events.onUnmount);
|
|
214
|
+
});
|
|
215
|
+
var handleAdd = useMemoizedFn(function () {
|
|
216
|
+
ctx.doAction(advance.events.onAddCardClick);
|
|
217
|
+
});
|
|
218
|
+
var handleDrop = useMemoizedFn(function (_ref2) {
|
|
219
|
+
var dragNodeProps = _ref2.dragNodeProps,
|
|
220
|
+
targetNodeProps = _ref2.targetNodeProps,
|
|
221
|
+
evt = _ref2.evt;
|
|
222
|
+
ctx.doAction(advance.events.onDrop, {
|
|
223
|
+
dragNodeProps: dragNodeProps,
|
|
224
|
+
targetNodeProps: targetNodeProps,
|
|
225
|
+
evt: evt
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
var events = useCreation(function () {
|
|
229
|
+
if (advance !== null && advance !== void 0 && advance.events) {
|
|
230
|
+
var _events = {};
|
|
231
|
+
if (advance.events.onMount) _events.onMount = handleMount;
|
|
232
|
+
if (advance.events.onUnmount) _events.onUnmount = handleUnmount;
|
|
233
|
+
if (advance.events.onAddCardClick) _events.onAdd = handleAdd;
|
|
234
|
+
if (advance.events.onDrop) _events.onDrop = handleDrop;
|
|
235
|
+
return _events;
|
|
236
|
+
}
|
|
237
|
+
return {};
|
|
238
|
+
}, [advance === null || advance === void 0 ? void 0 : advance.events]);
|
|
239
|
+
var _wrapperProps = useCreation(function () {
|
|
240
|
+
return _defineProperty({
|
|
241
|
+
id: id
|
|
242
|
+
}, LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT);
|
|
243
|
+
}, []);
|
|
10
244
|
var getTargetDom = useMemoizedFn(function () {
|
|
11
|
-
return
|
|
245
|
+
return wrapperRef.current;
|
|
12
246
|
});
|
|
13
247
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
14
248
|
id: id,
|
|
15
249
|
displayName: "CardList",
|
|
16
|
-
getTargetDom: getTargetDom
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
250
|
+
getTargetDom: getTargetDom,
|
|
251
|
+
api: apiRef
|
|
252
|
+
}, /*#__PURE__*/React.createElement(LdCard, _extends({
|
|
253
|
+
ref: instanceRef,
|
|
254
|
+
wrapper: wrapperRef,
|
|
255
|
+
wrapperProps: _wrapperProps,
|
|
256
|
+
_loading: ctx.loading,
|
|
257
|
+
className: classNames(_defineProperty({}, className, !!className)),
|
|
258
|
+
ldId: id,
|
|
259
|
+
dataSetKey: dataset === null || dataset === void 0 ? void 0 : dataset.code,
|
|
260
|
+
readOnly: readOnly,
|
|
261
|
+
isFlow: !pagination,
|
|
262
|
+
draggable: draggable,
|
|
263
|
+
col: col,
|
|
264
|
+
suppressInit: !autoLoad,
|
|
265
|
+
renderFunctionArea: renderFunctionArea,
|
|
266
|
+
renderFilterArea: renderFilterArea,
|
|
267
|
+
cardActions: _cardActions,
|
|
268
|
+
maxActionsCount: actions === null || actions === void 0 ? void 0 : actions.max,
|
|
269
|
+
onOperationsClick: handleOperationsClick,
|
|
270
|
+
renderAddCard: showAddCard ? addCardWords : false,
|
|
271
|
+
AddCardHeight: addCardHeight,
|
|
272
|
+
rowSelection: rowSelection && !readOnly ? {
|
|
273
|
+
getCheckboxProps: getCheckboxProps
|
|
274
|
+
} : false,
|
|
275
|
+
batchOperations: _batchOperations,
|
|
276
|
+
onBatchOperationsClick: handleBatchOperationsClick,
|
|
277
|
+
overModel: {
|
|
278
|
+
pageSize: pageSize
|
|
279
|
+
},
|
|
280
|
+
cardConfig: {
|
|
281
|
+
nocardBoxborder: nocardBoxborder,
|
|
282
|
+
showAvatar: showAvatar,
|
|
283
|
+
avatarUrl: _avatarUrl,
|
|
284
|
+
showTitle: showTitle,
|
|
285
|
+
showDesc: showDesc,
|
|
286
|
+
describeLines: describeLines,
|
|
287
|
+
renderTitle: _renderTitle,
|
|
288
|
+
renderDescribe: _renderDescribe,
|
|
289
|
+
renderContent: _renderContent
|
|
290
|
+
}
|
|
291
|
+
}, events)));
|
|
292
|
+
});
|
|
293
|
+
LCCardList.propTypes = {
|
|
294
|
+
/**
|
|
295
|
+
* @name 唯一标识
|
|
296
|
+
* @type string
|
|
297
|
+
* @disabled true
|
|
298
|
+
*/
|
|
299
|
+
id: PropTypes.string.isRequired,
|
|
300
|
+
/**
|
|
301
|
+
* @name 数据集
|
|
302
|
+
* @type _DataSetSelector
|
|
303
|
+
*/
|
|
304
|
+
dataset: PropTypes.shape({
|
|
305
|
+
code: PropTypes.string.isRequired,
|
|
306
|
+
uid: PropTypes.string.isRequired
|
|
307
|
+
}),
|
|
308
|
+
/**
|
|
309
|
+
* @name 自动加载
|
|
310
|
+
* @desc 首次数据是否自动加载,若存在必须带搜索条件再加载的情况,需要关闭
|
|
311
|
+
* @type switch
|
|
312
|
+
* @default true
|
|
313
|
+
*/
|
|
314
|
+
autoLoad: PropTypes.bool,
|
|
315
|
+
/**
|
|
316
|
+
* @name 只读
|
|
317
|
+
* @type switch
|
|
318
|
+
* @default false
|
|
319
|
+
*/
|
|
320
|
+
readOnly: PropTypes.bool,
|
|
321
|
+
/**
|
|
322
|
+
* @name 列数
|
|
323
|
+
* @type number
|
|
324
|
+
* @default 4
|
|
325
|
+
*/
|
|
326
|
+
col: PropTypes.number,
|
|
327
|
+
/**
|
|
328
|
+
* @name 隐藏操作列
|
|
329
|
+
* @type switch
|
|
330
|
+
* @default false
|
|
331
|
+
* @groupNext actionsColumn
|
|
332
|
+
*/
|
|
333
|
+
suppressActions: PropTypes.bool,
|
|
334
|
+
/**
|
|
335
|
+
* @name 最大显示数
|
|
336
|
+
* @type number
|
|
337
|
+
* @default 2
|
|
338
|
+
* @groupNext actionsColumn
|
|
339
|
+
*/
|
|
340
|
+
maxActionsCount: PropTypes.number,
|
|
341
|
+
/**
|
|
342
|
+
* @name 操作项
|
|
343
|
+
* @type _TableActions
|
|
344
|
+
* @groupNext actionsColumn
|
|
345
|
+
* @default {"max": 3, "moreText": "更多操作", "todoList": []}
|
|
346
|
+
*/
|
|
347
|
+
actions: PropTypes.shape({
|
|
348
|
+
max: PropTypes.number,
|
|
349
|
+
moreText: PropTypes.string,
|
|
350
|
+
todoList: PropTypes.array
|
|
351
|
+
}),
|
|
352
|
+
/**
|
|
353
|
+
* @name 顶部操作
|
|
354
|
+
* @type _ActionGroup
|
|
355
|
+
* @default {"display": "button", "max": 2, "moreText": "操作", "todoList": []}
|
|
356
|
+
*/
|
|
357
|
+
topActionGroup: PropTypes.shape({
|
|
358
|
+
display: PropTypes.oneOf(['text', 'button']),
|
|
359
|
+
max: PropTypes.number,
|
|
360
|
+
moreText: PropTypes.string,
|
|
361
|
+
todoList: PropTypes.array
|
|
362
|
+
}),
|
|
363
|
+
/**
|
|
364
|
+
* @name 顶部过滤器
|
|
365
|
+
* @type _TableTopFilter
|
|
366
|
+
*/
|
|
367
|
+
topFilter: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.shape({
|
|
368
|
+
options: PropTypes.array.isRequired,
|
|
369
|
+
field: PropTypes.string.isRequired
|
|
370
|
+
})]),
|
|
371
|
+
/**
|
|
372
|
+
* @name 展示新增卡片
|
|
373
|
+
* @type switch
|
|
374
|
+
* @default false
|
|
375
|
+
*/
|
|
376
|
+
showAddCard: PropTypes.bool,
|
|
377
|
+
/**
|
|
378
|
+
* @name 新增卡片高度
|
|
379
|
+
* @type number
|
|
380
|
+
* @default 240
|
|
381
|
+
*/
|
|
382
|
+
addCardHeight: PropTypes.number,
|
|
383
|
+
/**
|
|
384
|
+
* @name 新增卡片内容
|
|
385
|
+
* @type string
|
|
386
|
+
* @disabled "新建"
|
|
387
|
+
*/
|
|
388
|
+
addCardWords: PropTypes.string,
|
|
389
|
+
/**
|
|
390
|
+
* @name 开启选择器
|
|
391
|
+
* @type switch
|
|
392
|
+
* @default false
|
|
393
|
+
*/
|
|
394
|
+
rowSelection: PropTypes.bool,
|
|
395
|
+
/**
|
|
396
|
+
* @name 不可选卡片
|
|
397
|
+
* @type _JSEditor
|
|
398
|
+
* @default "function disabledCheckbox(record) { \n return false; \n}"
|
|
399
|
+
*/
|
|
400
|
+
disabledCheckbox: PropTypes.string,
|
|
401
|
+
/**
|
|
402
|
+
* @name 卡片操作项
|
|
403
|
+
* @type _ActionsEditor
|
|
404
|
+
*/
|
|
405
|
+
batchOperations: PropTypes.shape({
|
|
406
|
+
todoList: PropTypes.array.isRequired
|
|
407
|
+
}),
|
|
408
|
+
/**
|
|
409
|
+
* @name 每页行数
|
|
410
|
+
* @type number
|
|
411
|
+
* @default 40
|
|
412
|
+
*/
|
|
413
|
+
pageSize: PropTypes.number,
|
|
414
|
+
/**
|
|
415
|
+
* @name 无边框风格
|
|
416
|
+
* @type switch
|
|
417
|
+
* @default false
|
|
418
|
+
*/
|
|
419
|
+
nocardBoxborder: PropTypes.bool,
|
|
420
|
+
/**
|
|
421
|
+
* @name 显示图标
|
|
422
|
+
* @type switch
|
|
423
|
+
* @default true
|
|
424
|
+
*/
|
|
425
|
+
showAvatar: PropTypes.bool,
|
|
426
|
+
/**
|
|
427
|
+
* @name 图标地址
|
|
428
|
+
* @type _JSEditor
|
|
429
|
+
* @default "function avatarUrl(record) { \n return null; \n}"
|
|
430
|
+
*/
|
|
431
|
+
avatarUrl: PropTypes.string,
|
|
432
|
+
/**
|
|
433
|
+
* @name 显示标题
|
|
434
|
+
* @type switch
|
|
435
|
+
* @default true
|
|
436
|
+
*/
|
|
437
|
+
showTitle: PropTypes.bool,
|
|
438
|
+
/**
|
|
439
|
+
* @name 标题内容
|
|
440
|
+
* @type _JSEditor
|
|
441
|
+
* @default "function renderTitle(record) { \n return record.sname; \n}"
|
|
442
|
+
*/
|
|
443
|
+
renderTitle: PropTypes.string,
|
|
444
|
+
/**
|
|
445
|
+
* @name 显示描述
|
|
446
|
+
* @type switch
|
|
447
|
+
* @default true
|
|
448
|
+
*/
|
|
449
|
+
showDesc: PropTypes.bool,
|
|
450
|
+
/**
|
|
451
|
+
* @name 描述最大展示行
|
|
452
|
+
* @type number
|
|
453
|
+
* @default 2
|
|
454
|
+
*/
|
|
455
|
+
describeLines: PropTypes.number,
|
|
456
|
+
/**
|
|
457
|
+
* @name 描述内容
|
|
458
|
+
* @type _JSEditor
|
|
459
|
+
* @default "function renderDescribe(record) { \n return record.describe; \n}"
|
|
460
|
+
*/
|
|
461
|
+
renderDescribe: PropTypes.string,
|
|
462
|
+
/**
|
|
463
|
+
* @name 自定义
|
|
464
|
+
* @type _JSEditor
|
|
465
|
+
* @default "function renderContent(record) { \n return null; \n}"
|
|
466
|
+
*/
|
|
467
|
+
renderContent: PropTypes.string,
|
|
468
|
+
/**
|
|
469
|
+
* @name 组件首次渲染时
|
|
470
|
+
* @type _JSEditor
|
|
471
|
+
*/
|
|
472
|
+
onMount: PropTypes.string,
|
|
473
|
+
/**
|
|
474
|
+
* @name 组件卸载时
|
|
475
|
+
* @type _JSEditor
|
|
476
|
+
*/
|
|
477
|
+
onUnmount: PropTypes.string,
|
|
478
|
+
/**
|
|
479
|
+
* @name 新增卡片点击时
|
|
480
|
+
* @type _JSEditor
|
|
481
|
+
*/
|
|
482
|
+
onAddCardClick: PropTypes.string
|
|
20
483
|
};
|
|
484
|
+
LCCardList.defaultProps = omitBadProps(defaultMeta);
|
|
21
485
|
export default LCCardList;
|