@luck-design-biz/luckda 0.0.24-2 → 0.0.25

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.
Files changed (217) hide show
  1. package/es/components/LDActions/index.js +130 -0
  2. package/es/components/LDActions/index.less +48 -0
  3. package/es/components/LdFormList/index.js +1 -1
  4. package/es/components/LdGrid/index.js +9 -3
  5. package/es/components/LdTree/index.js +32 -5
  6. package/es/components/LdTree/index.less +6 -1
  7. package/es/index.js +1 -0
  8. package/es/locales/zh-CN.js +151 -0
  9. package/es/lowcode/constants/api-url.js +71 -12
  10. package/es/lowcode/constants/index.js +3 -1
  11. package/es/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +32 -0
  12. package/es/lowcode/engine/factory/panel-item-factory/index.js +2 -0
  13. package/es/lowcode/engine/meta/box.props.default.json +1 -3
  14. package/es/lowcode/engine/meta/box.props.json +1 -3
  15. package/es/lowcode/engine/meta/button.props.default.json +1 -1
  16. package/es/lowcode/engine/meta/button.props.json +1 -1
  17. package/es/lowcode/engine/meta/cardlist.props.default.json +0 -1
  18. package/es/lowcode/engine/meta/cardlist.props.json +1 -2
  19. package/es/lowcode/engine/meta/dialog.props.default.json +0 -1
  20. package/es/lowcode/engine/meta/dialog.props.json +0 -1
  21. package/es/lowcode/engine/meta/drawer.props.default.json +0 -1
  22. package/es/lowcode/engine/meta/drawer.props.json +0 -1
  23. package/es/lowcode/engine/meta/form.props.default.json +0 -1
  24. package/es/lowcode/engine/meta/form.props.json +1 -2
  25. package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
  26. package/es/lowcode/engine/meta/iframe.props.json +1 -1
  27. package/es/lowcode/engine/meta/image.props.default.json +1 -1
  28. package/es/lowcode/engine/meta/image.props.json +1 -1
  29. package/es/lowcode/engine/meta/imex.props.default.json +1 -1
  30. package/es/lowcode/engine/meta/imex.props.json +1 -1
  31. package/es/lowcode/engine/meta/js-editor/auto-complete.json +132 -26
  32. package/es/lowcode/engine/meta/jsx.props.default.json +1 -1
  33. package/es/lowcode/engine/meta/jsx.props.json +1 -1
  34. package/es/lowcode/engine/meta/layout.props.default.json +1 -1
  35. package/es/lowcode/engine/meta/layout.props.json +1 -1
  36. package/es/lowcode/engine/meta/link.props.default.json +1 -1
  37. package/es/lowcode/engine/meta/link.props.json +1 -1
  38. package/es/lowcode/engine/meta/local/local.zh-cn.js +97 -0
  39. package/es/lowcode/engine/meta/section.props.default.json +1 -1
  40. package/es/lowcode/engine/meta/section.props.json +1 -1
  41. package/es/lowcode/engine/meta/split.props.default.json +1 -1
  42. package/es/lowcode/engine/meta/split.props.json +1 -1
  43. package/es/lowcode/engine/meta/table.props.default.json +18 -2
  44. package/es/lowcode/engine/meta/table.props.json +207 -32
  45. package/es/lowcode/engine/meta/tabs.props.default.json +0 -1
  46. package/es/lowcode/engine/meta/tabs.props.json +0 -1
  47. package/es/lowcode/engine/meta/text.props.default.json +1 -1
  48. package/es/lowcode/engine/meta/text.props.json +1 -1
  49. package/es/lowcode/engine/meta/tree.props.default.json +9 -4
  50. package/es/lowcode/engine/meta/tree.props.json +101 -55
  51. package/es/lowcode/engine/provider/{ContextProvider.js → ContextProvider/index.js} +71 -41
  52. package/es/lowcode/engine/tools/helper.js +29 -1
  53. package/es/lowcode/engine/tools/usePromiseState.js +7 -6
  54. package/es/lowcode/painter/Panel.js +50 -133
  55. package/es/lowcode/painter/Ribbon.js +1 -1
  56. package/es/lowcode/painter/components/ActionBindModal.js +180 -0
  57. package/es/lowcode/painter/components/AdvancePanel.js +68 -0
  58. package/es/lowcode/painter/components/AttrsPanel.js +134 -0
  59. package/es/lowcode/painter/components/Collapse.js +12 -7
  60. package/es/lowcode/painter/components/FieldSelector.js +44 -0
  61. package/es/lowcode/painter/components/ListEditor.js +4 -2
  62. package/es/lowcode/painter/components/PopConfirm.js +10 -3
  63. package/es/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
  64. package/es/lowcode/painter/components/code-editor/JSEditor.js +25 -14
  65. package/es/lowcode/painter/components/code-editor/JsonEditor.js +41 -0
  66. package/es/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/ActionEditor.js +10 -3
  67. package/es/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +36 -8
  68. package/es/lowcode/painter/panel-section/ImpExp.js +91 -0
  69. package/es/lowcode/painter/panel-section/JSEditor.js +48 -0
  70. package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
  71. package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +1 -1
  72. package/es/lowcode/painter/panel-section/TableTopFilter.js +306 -0
  73. package/es/lowcode/painter/style/action-bind-modal.less +99 -0
  74. package/es/lowcode/painter/style/design.less +1 -1
  75. package/es/lowcode/painter/style/impexp.less +7 -0
  76. package/es/lowcode/painter/style/panel-attrs.less +43 -0
  77. package/es/lowcode/painter/style/panel.less +6 -37
  78. package/es/lowcode/painter/style/pop-confirm.less +9 -2
  79. package/es/lowcode/view/lc-components/Box/index.js +20 -4
  80. package/es/lowcode/view/lc-components/Box/index.less +0 -1
  81. package/es/lowcode/view/lc-components/Box/meta.json +1 -3
  82. package/es/lowcode/view/lc-components/Button/meta.json +1 -1
  83. package/es/lowcode/view/lc-components/CardList/meta.json +1 -2
  84. package/es/lowcode/view/lc-components/Dialog/meta.json +0 -1
  85. package/es/lowcode/view/lc-components/Drawer/index.js +16 -0
  86. package/es/lowcode/view/lc-components/Drawer/meta.json +0 -1
  87. package/es/lowcode/view/lc-components/Form/meta.json +1 -2
  88. package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
  89. package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
  90. package/es/lowcode/view/lc-components/Image/meta.json +1 -1
  91. package/es/lowcode/view/lc-components/JSX/meta.json +1 -1
  92. package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -9
  93. package/es/lowcode/view/lc-components/Layout/meta.json +1 -1
  94. package/es/lowcode/view/lc-components/Link/meta.json +1 -1
  95. package/es/lowcode/view/lc-components/Section/meta.json +1 -1
  96. package/es/lowcode/view/lc-components/Split/meta.json +1 -1
  97. package/es/lowcode/view/lc-components/Table/FunctionDesign.js +35 -2
  98. package/es/lowcode/view/lc-components/Table/components/TopFilter.js +96 -0
  99. package/es/lowcode/view/lc-components/Table/index.js +255 -35
  100. package/es/lowcode/view/lc-components/Table/meta.json +179 -32
  101. package/es/lowcode/view/lc-components/Tabs/meta.json +0 -1
  102. package/es/lowcode/view/lc-components/Text/meta.json +1 -1
  103. package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +48 -3
  104. package/es/lowcode/view/lc-components/Tree/index.js +77 -6
  105. package/es/lowcode/view/lc-components/Tree/index.less +2 -0
  106. package/es/lowcode/view/lc-components/Tree/meta.json +97 -55
  107. package/es/lowcode/view/lc-components/Wrapper.js +2 -2
  108. package/lib/components/LDActions/index.js +138 -0
  109. package/lib/components/LDActions/index.less +48 -0
  110. package/lib/components/LdFormList/index.js +1 -1
  111. package/lib/components/LdGrid/index.js +8 -2
  112. package/lib/components/LdTree/index.js +31 -4
  113. package/lib/components/LdTree/index.less +6 -1
  114. package/lib/index.js +8 -0
  115. package/lib/locales/zh-CN.js +157 -0
  116. package/lib/lowcode/constants/api-url.js +71 -12
  117. package/lib/lowcode/constants/index.js +4 -2
  118. package/lib/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +38 -0
  119. package/lib/lowcode/engine/factory/panel-item-factory/index.js +2 -0
  120. package/lib/lowcode/engine/meta/box.props.default.json +1 -3
  121. package/lib/lowcode/engine/meta/box.props.json +1 -3
  122. package/lib/lowcode/engine/meta/button.props.default.json +1 -1
  123. package/lib/lowcode/engine/meta/button.props.json +1 -1
  124. package/lib/lowcode/engine/meta/cardlist.props.default.json +0 -1
  125. package/lib/lowcode/engine/meta/cardlist.props.json +1 -2
  126. package/lib/lowcode/engine/meta/dialog.props.default.json +0 -1
  127. package/lib/lowcode/engine/meta/dialog.props.json +0 -1
  128. package/lib/lowcode/engine/meta/drawer.props.default.json +0 -1
  129. package/lib/lowcode/engine/meta/drawer.props.json +0 -1
  130. package/lib/lowcode/engine/meta/form.props.default.json +0 -1
  131. package/lib/lowcode/engine/meta/form.props.json +1 -2
  132. package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
  133. package/lib/lowcode/engine/meta/iframe.props.json +1 -1
  134. package/lib/lowcode/engine/meta/image.props.default.json +1 -1
  135. package/lib/lowcode/engine/meta/image.props.json +1 -1
  136. package/lib/lowcode/engine/meta/imex.props.default.json +1 -1
  137. package/lib/lowcode/engine/meta/imex.props.json +1 -1
  138. package/lib/lowcode/engine/meta/js-editor/auto-complete.json +132 -26
  139. package/lib/lowcode/engine/meta/jsx.props.default.json +1 -1
  140. package/lib/lowcode/engine/meta/jsx.props.json +1 -1
  141. package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
  142. package/lib/lowcode/engine/meta/layout.props.json +1 -1
  143. package/lib/lowcode/engine/meta/link.props.default.json +1 -1
  144. package/lib/lowcode/engine/meta/link.props.json +1 -1
  145. package/lib/lowcode/engine/meta/local/local.zh-cn.js +103 -0
  146. package/lib/lowcode/engine/meta/section.props.default.json +1 -1
  147. package/lib/lowcode/engine/meta/section.props.json +1 -1
  148. package/lib/lowcode/engine/meta/split.props.default.json +1 -1
  149. package/lib/lowcode/engine/meta/split.props.json +1 -1
  150. package/lib/lowcode/engine/meta/table.props.default.json +18 -2
  151. package/lib/lowcode/engine/meta/table.props.json +207 -32
  152. package/lib/lowcode/engine/meta/tabs.props.default.json +0 -1
  153. package/lib/lowcode/engine/meta/tabs.props.json +0 -1
  154. package/lib/lowcode/engine/meta/text.props.default.json +1 -1
  155. package/lib/lowcode/engine/meta/text.props.json +1 -1
  156. package/lib/lowcode/engine/meta/tree.props.default.json +9 -4
  157. package/lib/lowcode/engine/meta/tree.props.json +101 -55
  158. package/lib/lowcode/engine/provider/{ContextProvider.js → ContextProvider/index.js} +70 -40
  159. package/lib/lowcode/engine/tools/helper.js +31 -0
  160. package/lib/lowcode/engine/tools/usePromiseState.js +6 -5
  161. package/lib/lowcode/painter/Panel.js +48 -131
  162. package/lib/lowcode/painter/Ribbon.js +1 -1
  163. package/lib/lowcode/painter/components/ActionBindModal.js +188 -0
  164. package/lib/lowcode/painter/components/AdvancePanel.js +76 -0
  165. package/lib/lowcode/painter/components/AttrsPanel.js +142 -0
  166. package/lib/lowcode/painter/components/Collapse.js +12 -7
  167. package/lib/lowcode/painter/components/FieldSelector.js +52 -0
  168. package/lib/lowcode/painter/components/ListEditor.js +4 -2
  169. package/lib/lowcode/painter/components/PopConfirm.js +10 -3
  170. package/lib/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
  171. package/lib/lowcode/painter/components/code-editor/JSEditor.js +25 -14
  172. package/lib/lowcode/painter/components/code-editor/JsonEditor.js +48 -0
  173. package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/ActionEditor.js +10 -3
  174. package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +35 -7
  175. package/lib/lowcode/painter/panel-section/ImpExp.js +98 -0
  176. package/lib/lowcode/painter/panel-section/JSEditor.js +56 -0
  177. package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
  178. package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +1 -1
  179. package/lib/lowcode/painter/panel-section/TableTopFilter.js +314 -0
  180. package/lib/lowcode/painter/style/action-bind-modal.less +99 -0
  181. package/lib/lowcode/painter/style/design.less +1 -1
  182. package/lib/lowcode/painter/style/impexp.less +7 -0
  183. package/lib/lowcode/painter/style/panel-attrs.less +43 -0
  184. package/lib/lowcode/painter/style/panel.less +6 -37
  185. package/lib/lowcode/painter/style/pop-confirm.less +9 -2
  186. package/lib/lowcode/view/lc-components/Box/index.js +17 -2
  187. package/lib/lowcode/view/lc-components/Box/index.less +0 -1
  188. package/lib/lowcode/view/lc-components/Box/meta.json +1 -3
  189. package/lib/lowcode/view/lc-components/Button/meta.json +1 -1
  190. package/lib/lowcode/view/lc-components/CardList/meta.json +1 -2
  191. package/lib/lowcode/view/lc-components/Dialog/meta.json +0 -1
  192. package/lib/lowcode/view/lc-components/Drawer/index.js +16 -0
  193. package/lib/lowcode/view/lc-components/Drawer/meta.json +0 -1
  194. package/lib/lowcode/view/lc-components/Form/meta.json +1 -2
  195. package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
  196. package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
  197. package/lib/lowcode/view/lc-components/Image/meta.json +1 -1
  198. package/lib/lowcode/view/lc-components/JSX/meta.json +1 -1
  199. package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -9
  200. package/lib/lowcode/view/lc-components/Layout/meta.json +1 -1
  201. package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
  202. package/lib/lowcode/view/lc-components/Section/meta.json +1 -1
  203. package/lib/lowcode/view/lc-components/Split/meta.json +1 -1
  204. package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +37 -3
  205. package/lib/lowcode/view/lc-components/Table/components/TopFilter.js +104 -0
  206. package/lib/lowcode/view/lc-components/Table/index.js +255 -35
  207. package/lib/lowcode/view/lc-components/Table/meta.json +179 -32
  208. package/lib/lowcode/view/lc-components/Tabs/meta.json +0 -1
  209. package/lib/lowcode/view/lc-components/Text/meta.json +1 -1
  210. package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +49 -3
  211. package/lib/lowcode/view/lc-components/Tree/index.js +77 -6
  212. package/lib/lowcode/view/lc-components/Tree/index.less +2 -0
  213. package/lib/lowcode/view/lc-components/Tree/meta.json +97 -55
  214. package/lib/lowcode/view/lc-components/Wrapper.js +2 -2
  215. package/package.json +10 -5
  216. package/es/lowcode/painter/panel-section/TableActions.js +0 -19
  217. package/lib/lowcode/painter/panel-section/TableActions.js +0 -26
@@ -1,14 +1,14 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["context", "id", "className", "dataset", "width", "height", "bordered", "zebra", "autoLoad", "readOnly", "suppressActions", "actionsColumnWidth", "actions", "pagination", "pageSize", "showSizeChanger", "showQuickJumper", "hideOnSinglePage", "paginationSimple", "suppressPreset"];
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
5
3
  import React, { useRef } from 'react';
6
4
  import PropTypes from 'prop-types';
7
- import { useMemoizedFn, useCreation, useUpdateEffect, useLatest } from 'ahooks';
8
- import LdGrid from "../../../../components/LdGrid";
5
+ import { useMemoizedFn, useCreation } from 'ahooks';
6
+ import { isNil, isString } from 'lodash';
9
7
  import classNames from 'classnames';
10
8
  import Wrapper from "../Wrapper";
11
- import { omitBadProps } from "../../../engine/tools/helper";
9
+ import { LdGrid, LDActions } from "../../../../index";
10
+ import TopFilter from "./components/TopFilter";
11
+ import { omitBadProps, executeCode } from "../../../engine/tools/helper";
12
12
  import defaultMeta from "../../../engine/meta/table.props.default.json";
13
13
  var LCTable = function LCTable(_ref) {
14
14
  var context = _ref.context,
@@ -21,6 +21,7 @@ var LCTable = function LCTable(_ref) {
21
21
  zebra = _ref.zebra,
22
22
  autoLoad = _ref.autoLoad,
23
23
  readOnly = _ref.readOnly,
24
+ renderIndex = _ref.renderIndex,
24
25
  suppressActions = _ref.suppressActions,
25
26
  actionsColumnWidth = _ref.actionsColumnWidth,
26
27
  actions = _ref.actions,
@@ -31,9 +32,25 @@ var LCTable = function LCTable(_ref) {
31
32
  hideOnSinglePage = _ref.hideOnSinglePage,
32
33
  paginationSimple = _ref.paginationSimple,
33
34
  suppressPreset = _ref.suppressPreset,
34
- props = _objectWithoutProperties(_ref, _excluded);
35
+ impexp = _ref.impexp,
36
+ topActionGroup = _ref.topActionGroup,
37
+ topFilter = _ref.topFilter,
38
+ rowSelection = _ref.rowSelection,
39
+ suppressRowSelectionPagination = _ref.suppressRowSelectionPagination,
40
+ rowSelectionMode = _ref.rowSelectionMode,
41
+ defaultRowSelectedCode = _ref.defaultRowSelectedCode,
42
+ rowSelectableCode = _ref.rowSelectableCode,
43
+ bantchActions = _ref.bantchActions,
44
+ formatDataSource = _ref.formatDataSource,
45
+ getDataPath = _ref.getDataPath,
46
+ columnsRewrite = _ref.columnsRewrite,
47
+ columnsReset = _ref.columnsReset,
48
+ modelParams = _ref.modelParams,
49
+ onGridReady = _ref.onGridReady;
35
50
  var ref = useRef();
36
- var latestZebra = useLatest(zebra);
51
+ var handleBatchOperationsClick = useMemoizedFn(function (key, selectedRows, action) {
52
+ console.log('handleBatchOperationsClick', key, selectedRows, action);
53
+ });
37
54
  var _pagination = useCreation(function () {
38
55
  return {
39
56
  isFlow: !pagination,
@@ -51,40 +68,115 @@ var LCTable = function LCTable(_ref) {
51
68
  return {
52
69
  actionsColumn: suppressActions ? null : {
53
70
  width: actionsColumnWidth,
54
- maxCount: actions.max,
55
- type: actions.type,
71
+ maxCount: (actions.current || actions).max,
72
+ type: (actions.current || actions).type,
56
73
  getActions: function getActions() {
57
- return actions.todoList.map(function (_action) {
74
+ return (actions.current || actions).todoList.map(function (action) {
58
75
  return {
59
- title: _action.name,
60
- action: function action(d) {
61
- console.log('doAction', d, _action);
62
- },
63
- resource: _action.serial,
64
- style: _action.riskLevel === 'default' ? null : {
76
+ title: action.name,
77
+ action: function (_action) {
78
+ function action(_x, _x2, _x3) {
79
+ return _action.apply(this, arguments);
80
+ }
81
+ action.toString = function () {
82
+ return _action.toString();
83
+ };
84
+ return action;
85
+ }(function (d, i, p) {
86
+ console.log('doAction', d, action);
87
+ }),
88
+ resource: action.serial,
89
+ style: action.riskLevel === 'default' ? null : {
65
90
  color: {
66
91
  danger: '#ff7875',
67
- destroy: '#820014'
68
- }[_action.riskLevel]
92
+ destroy: '#ff4d4f'
93
+ }[action.riskLevel]
69
94
  }
70
95
  };
71
96
  });
72
97
  }
73
98
  }
74
99
  };
75
- }, [suppressActions, actionsColumnWidth, actions]);
76
- useUpdateEffect(function () {
77
- var itemsToUpdate = [];
78
- ref.current.gridApi.api.forEachNode(function (rowNode) {
79
- if (rowNode.rowIndex % 2 === 0) itemsToUpdate.push(rowNode.data);
80
- });
81
- ref.current.gridApi.api.updateRowData({
82
- update: itemsToUpdate
83
- });
84
- }, [zebra]);
100
+ }, [suppressActions, actionsColumnWidth, actions.current || actions]);
101
+ var _rowSelection = useCreation(function () {
102
+ return rowSelection ? {
103
+ rowSelection: {
104
+ mode: rowSelectionMode,
105
+ suppressPagination: suppressRowSelectionPagination,
106
+ isDefaultSelected: function isDefaultSelected(d, n) {
107
+ if (isNil(defaultRowSelectedCode)) return false;
108
+ return executeCode(context, defaultRowSelectedCode, ['data', 'node'], d, n);
109
+ },
110
+ isRowSelectable: function isRowSelectable(d, n) {
111
+ if (isNil(rowSelectableCode)) return true;
112
+ return executeCode(context, rowSelectableCode, ['data', 'node'], d, n);
113
+ }
114
+ }
115
+ } : false;
116
+ }, [rowSelection, suppressRowSelectionPagination, rowSelectionMode, defaultRowSelectedCode, rowSelectableCode]);
117
+ var _export = useCreation(function () {
118
+ return {
119
+ enableExportAll: !!impexp.export,
120
+ apiUrl: isString(impexp.export) ? impexp.export : void 0
121
+ };
122
+ }, [impexp.export]);
123
+ var _batchActions = useCreation(function () {
124
+ return {
125
+ batchOperations: bantchActions.todoList.map(function (action) {
126
+ return {
127
+ key: action.id,
128
+ title: action.name,
129
+ resource: action.serial
130
+ };
131
+ }),
132
+ onBatchOperationsClick: function onBatchOperationsClick(key, selectedRows) {
133
+ return handleBatchOperationsClick(key, selectedRows, action);
134
+ }
135
+ };
136
+ }, [bantchActions.todoList]);
137
+ var _others = useCreation(function () {
138
+ var temp = {};
139
+ if (!isNil(formatDataSource)) {
140
+ temp.formatDataSource = function (list, detail) {
141
+ return executeCode(context, formatDataSource, ['list', 'detail'], list, detail);
142
+ };
143
+ }
144
+ if (!isNil(getDataPath)) {
145
+ temp.getDataPath = function (data) {
146
+ return executeCode(context, getDataPath, ['data'], data);
147
+ };
148
+ }
149
+ if (!isNil(columnsRewrite)) {
150
+ temp.columnsRewrite = function (cols) {
151
+ return executeCode(context, columnsRewrite, ['columns'], cols);
152
+ };
153
+ }
154
+ if (!isNil(columnsReset)) {
155
+ temp.columnsReset = function (cols) {
156
+ return executeCode(context, columnsReset, ['columns'], cols);
157
+ };
158
+ }
159
+ if (!isNil(modelParams)) {
160
+ temp.overModel = executeCode(context, modelParams);
161
+ }
162
+ return temp;
163
+ }, [formatDataSource, getDataPath, columnsRewrite, columnsReset, modelParams]);
85
164
  var getTargetDom = useMemoizedFn(function () {
86
165
  return ref.current.wrapperRef.current;
87
166
  });
167
+ var renderFunctionArea = useMemoizedFn(function () {
168
+ var _topActionGroup$todoL;
169
+ return !!(topActionGroup !== null && topActionGroup !== void 0 && (_topActionGroup$todoL = topActionGroup.todoList) !== null && _topActionGroup$todoL !== void 0 && _topActionGroup$todoL.length) ? /*#__PURE__*/React.createElement(LDActions, _extends({}, topActionGroup, {
170
+ doAction: function doAction(action) {
171
+ return context.doAction(action);
172
+ }
173
+ })) : null;
174
+ });
175
+ var renderFilterArea = useMemoizedFn(function () {
176
+ return topFilter ? /*#__PURE__*/React.createElement(TopFilter, {
177
+ filter: topFilter
178
+ }) : null;
179
+ });
88
180
  return /*#__PURE__*/React.createElement(Wrapper, {
89
181
  id: id,
90
182
  getTargetDom: getTargetDom
@@ -98,17 +190,47 @@ var LCTable = function LCTable(_ref) {
98
190
  ldId: id,
99
191
  dataSetKey: dataset,
100
192
  readOnly: readOnly,
193
+ renderIndex: renderIndex,
101
194
  suppressInit: !autoLoad,
102
195
  getRowStyle: function getRowStyle(params) {
103
- return latestZebra.current && params.node.rowIndex % 2 === 0 ? {
104
- 'background-color': latestZebra.current
196
+ return (zebra.current || zebra) && params.node.rowIndex % 2 === 0 ? {
197
+ 'background-color': zebra.current || zebra
105
198
  } : {
106
199
  'background-color': '#fff'
107
200
  };
108
201
  },
109
202
  suppressPreset: suppressPreset
110
- // operates={resources}
111
- }, _pagination, _actionsColumn)));
203
+ }, _pagination, _actionsColumn, _rowSelection, _export, _batchActions, _others, {
204
+ onGridReady: onGridReady,
205
+ renderFunctionArea: renderFunctionArea,
206
+ renderFilterArea: renderFilterArea
207
+ /* ----------------------------其他可用配置开始 !!!不使用请删除!!!------------------------------ */
208
+ /**
209
+ * @description 初始化后的回调
210
+ * @require false
211
+ * @default -
212
+ */
213
+ // afterInit={(res, dispatch, props)=>console.log(res, dispatch, props)}
214
+ /**
215
+ * @description 获取过滤条件
216
+ * @require false
217
+ * @default -
218
+ */
219
+ // readFilter={(params, filters)=>{}}
220
+ /**
221
+ * @description 复写model参数
222
+ * @require false
223
+ * @default -
224
+ */
225
+ // overModel={{ unclosableSet: ['ilinkno'] }}
226
+ /**
227
+ * @description 读取数据源后的回调,返回所有接口中所有
228
+ * @require false
229
+ * @default -
230
+ */
231
+ // afterQuery={(res) => console.log('afterQuery', res)}
232
+ /* ----------------------------其他可用配置结束 !!!不使用请删除!!!------------------------------ */
233
+ })));
112
234
  };
113
235
  LCTable.propTypes = {
114
236
  /**
@@ -236,8 +358,106 @@ LCTable.propTypes = {
236
358
  * @name 操作项
237
359
  * @type _TableActions
238
360
  * @groupNext actionsColumn
361
+ * @default {"display": "text", "max": 2, "moreText": "更多行为", "todoList": []}
362
+ */
363
+ actions: PropTypes.shape({
364
+ display: PropTypes.oneOf(['text', 'button']),
365
+ max: PropTypes.number,
366
+ moreText: PropTypes.string,
367
+ todoList: PropTypes.array
368
+ }),
369
+ /**
370
+ * @name 顶部操作
371
+ * @type _ActionGroup
372
+ * @default {"display": "button", "max": 2, "moreText": "操作", "todoList": []}
373
+ */
374
+ topActionGroup: PropTypes.shape({
375
+ display: PropTypes.oneOf(['text', 'button']),
376
+ max: PropTypes.number,
377
+ moreText: PropTypes.string,
378
+ todoList: PropTypes.array
379
+ }),
380
+ /**
381
+ * @name 顶部过滤器
382
+ * @type _TableTopFilter
383
+ */
384
+ topFilter: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.shape({
385
+ options: PropTypes.array.isRequired,
386
+ field: PropTypes.string.isRequired
387
+ })]),
388
+ /**
389
+ * @name 开启行选择器
390
+ * @type boolean
391
+ * @default false
392
+ */
393
+ rowSelection: PropTypes.bool,
394
+ /**
395
+ * @name 停用分页多选
396
+ * @type boolean
397
+ * @default false
398
+ */
399
+ suppressRowSelectionPagination: PropTypes.bool,
400
+ /**
401
+ * @name 选择器模式
402
+ * @type segmented
403
+ * @options [{label: '复选', value: 'multiple'}, {label: '单选', value: 'single'}]
404
+ * @default 'multiple'
405
+ */
406
+ rowSelectionMode: PropTypes.oneOf(['single', 'multiple']),
407
+ /**
408
+ * @name 默认选中
409
+ * @type _JSEditor
410
+ * @default "function getDefaultRowSelected(data, node, ctx) { \n return false; \n}"
411
+ */
412
+ defaultRowSelectedCode: PropTypes.string,
413
+ /**
414
+ * @name 行是否可选
415
+ * @type _JSEditor
416
+ * @default "function getRowSelectable(data, node, ctx) { \n return true; \n}"
417
+ */
418
+ rowSelectableCode: PropTypes.string,
419
+ /**
420
+ * @name 导入导出
421
+ * @type _ImpExp
422
+ * @default { "export": true }
423
+ */
424
+ impexp: PropTypes.shape({
425
+ import: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
426
+ export: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
427
+ }),
428
+ /**
429
+ * @name 批量操作
430
+ * @type _BatchActions
431
+ * @default { "todoList": [] }
432
+ */
433
+ bantchActions: PropTypes.shape({
434
+ todoList: PropTypes.array
435
+ }),
436
+ /**
437
+ * @name 格式化数据
438
+ * @type _JSEditor
439
+ */
440
+ formatDataSource: PropTypes.string,
441
+ /**
442
+ * @name 构建树层级
443
+ * @type _JSEditor
444
+ */
445
+ getDataPath: PropTypes.string,
446
+ /**
447
+ * @name 重写表格列
448
+ * @type _JSEditor
449
+ */
450
+ columnsRewrite: PropTypes.string,
451
+ /**
452
+ * @name 重置表格列
453
+ * @type _JSEditor
454
+ */
455
+ columnsReset: PropTypes.string,
456
+ /**
457
+ * @name model参数
458
+ * @type _JSEditor
239
459
  */
240
- actions: PropTypes.array
460
+ modelParams: PropTypes.string
241
461
  };
242
- LCTable.defaultProps = omitBadProps(defaultMeta, ['actionsColumn']);
462
+ LCTable.defaultProps = omitBadProps(defaultMeta);
243
463
  export default LCTable;
@@ -32,10 +32,28 @@
32
32
  "default": false
33
33
  },
34
34
  {
35
- "key": "suppressPreset",
36
- "name": "关闭预设",
37
- "type": "switch",
38
- "default": false
35
+ "key": "topSetting",
36
+ "name": "顶部操作",
37
+ "type": "group",
38
+ "default": true,
39
+ "next": {
40
+ "name": "顶部操作",
41
+ "props": [
42
+ {
43
+ "key": "topActionGroup",
44
+ "name": "顶部按钮组",
45
+ "type": "_ActionsEditor",
46
+ "default": { "display": "button", "max": 2, "moreText": "操作", "todoList": [] },
47
+ "wrapper": "collapse"
48
+ },
49
+ {
50
+ "key": "topFilter",
51
+ "name": "顶部过滤器",
52
+ "type": "_TableTopFilter",
53
+ "wrapper": "collapse"
54
+ }
55
+ ]
56
+ }
39
57
  },
40
58
  {
41
59
  "key": "actionsColumn",
@@ -61,15 +79,98 @@
61
79
  },
62
80
  {
63
81
  "key": "actions",
64
- "name": "#操作项",
65
- "desc": "单行操作项",
66
- "type": "_TableActions",
67
- "default": {"display": "text", "max": 2, "todoList": []},
68
- "panelItem": { "suppressPadding": true }
82
+ "name": "表格操作项",
83
+ "type": "_ActionsEditor",
84
+ "default": { "display": "text", "max": 2, "moreText": "更多操作", "todoList": [] },
85
+ "wrapper": "collapse",
86
+ "wrapperProps": { "suppressIcon": true }
69
87
  }
70
88
  ]
71
89
  }
72
90
  },
91
+ {
92
+ "key": "rowSelectionSetting",
93
+ "name": "行选择器",
94
+ "type": "group",
95
+ "default": true,
96
+ "next": {
97
+ "name": "行选择器",
98
+ "props": [
99
+ {
100
+ "key": "rowSelection",
101
+ "name": "开启行选择器",
102
+ "type": "switch",
103
+ "default": false
104
+ },
105
+ {
106
+ "key": "suppressRowSelectionPagination",
107
+ "name": "停用分页多选",
108
+ "desc": "停用分页多选后,选择器将不记录跨页的行选择,而只记录当前页的行选择",
109
+ "type": "switch",
110
+ "default": false
111
+ },
112
+ {
113
+ "key": "rowSelectionMode",
114
+ "name": "选择器模式",
115
+ "type": "segmented",
116
+ "options": [
117
+ {
118
+ "label": "复选",
119
+ "value": "multiple"
120
+ },
121
+ {
122
+ "label": "单选",
123
+ "value": "single"
124
+ }
125
+ ],
126
+ "default": "multiple"
127
+ },
128
+ {
129
+ "key": "bantchActions",
130
+ "name": "批量操作",
131
+ "type": "_ActionsEditor",
132
+ "default": { "todoList": [] },
133
+ "suppressDisplay": true,
134
+ "suppressMax": true,
135
+ "suppressMore": true,
136
+ "wrapper": "collapse",
137
+ "wrapperProps": { "suppressIcon": true }
138
+ },
139
+ {
140
+ "key": "defaultRowSelectedCode",
141
+ "name": "默认选中行",
142
+ "type": "_JSEditor",
143
+ "defaultCode": "function getRowDefaultSelected(data, node, ctx) { \n return false; \n}",
144
+ "mustConfirm": true,
145
+ "wrapper": "collapse",
146
+ "wrapperProps": { "suppressIcon": true }
147
+ },
148
+ {
149
+ "key": "rowSelectableCode",
150
+ "name": "行是否可选",
151
+ "type": "_JSEditor",
152
+ "defaultCode": "function getRowSelectable(data, node, ctx) { \n return true; \n}",
153
+ "mustConfirm": true,
154
+ "wrapper": "collapse",
155
+ "wrapperProps": { "suppressIcon": true }
156
+ }
157
+ ]
158
+ }
159
+ },
160
+ {
161
+ "key": "impexpSetting",
162
+ "name": "导入导出",
163
+ "type": "group",
164
+ "props": [
165
+ {
166
+ "key": "impexp",
167
+ "name": "#导入导出",
168
+ "type": "_ImpExp",
169
+ "default": { "export": true },
170
+ "wrapperProps": { "suppressIcon": true }
171
+ }
172
+ ]
173
+ },
73
174
  {
74
175
  "key": "styleSetting",
75
176
  "name": "风格和样式",
@@ -93,11 +194,23 @@
93
194
  "type": "_TableZebra",
94
195
  "default": false
95
196
  },
197
+ {
198
+ "key": "suppressPreset",
199
+ "name": "关闭预设",
200
+ "type": "switch",
201
+ "default": false
202
+ },
96
203
  {
97
204
  "key": "bordered",
98
205
  "name": "边框线",
99
206
  "type": "switch",
100
207
  "default": false
208
+ },
209
+ {
210
+ "key": "renderIndex",
211
+ "name": "显示序号",
212
+ "type": "switch",
213
+ "default": true
101
214
  }
102
215
  ]
103
216
  },
@@ -114,7 +227,7 @@
114
227
  },
115
228
  {
116
229
  "key": "showSizeChanger",
117
- "name": "分页器",
230
+ "name": "pageSize选择",
118
231
  "type": "switch",
119
232
  "default": true
120
233
  },
@@ -146,28 +259,62 @@
146
259
  ]
147
260
  },
148
261
  {
149
- "key": "batchOperations",
150
- "name": "批量操作",
151
- "desc": "批量操作配置",
152
- "type": "_CardListActionSelector"
153
- },
154
- {
155
- "key": "batchActions",
156
- "name": "批量操作项",
157
- "desc": "批量操作项",
158
- "type": "_ActionSelector"
159
- },
160
- {
161
- "key": "rowStyle",
162
- "name": "行样式",
163
- "desc": "向行添加 CSS 样式",
164
- "type": "_CSSEditor"
165
- },
166
- {
167
- "key": "cellStyle",
168
- "name": "行样式",
169
- "desc": "向行添加 CSS 样式",
170
- "type": "_CSSEditor"
262
+ "key": "advance",
263
+ "name": "高级设置",
264
+ "type": "group",
265
+ "default": true,
266
+ "next": {
267
+ "name": "高级设置",
268
+ "props": [
269
+ {
270
+ "key": "formatDataSource",
271
+ "name": "格式化数据",
272
+ "type": "_JSEditor",
273
+ "defaultCode": "function formatDataSource(list, detail, ctx) { \n return []; \n}",
274
+ "mustConfirm": true,
275
+ "wrapper": "collapse",
276
+ "wrapperProps": { "suppressIcon": true }
277
+ },
278
+ {
279
+ "key": "getDataPath",
280
+ "name": "构建树层级",
281
+ "type": "_JSEditor",
282
+ "defaultCode": "function getDataPath(data, ctx) { \n return []; \n}",
283
+ "mustConfirm": true,
284
+ "wrapper": "collapse",
285
+ "wrapperProps": { "suppressIcon": true }
286
+ },
287
+ {
288
+ "key": "columnsRewrite",
289
+ "name": "重写表格列",
290
+ "desc": "自定义某些表格列",
291
+ "type": "_JSEditor",
292
+ "defaultCode": "function columnsRewrite(columns, ctx) { \n return columns; \n}",
293
+ "mustConfirm": true,
294
+ "wrapper": "collapse",
295
+ "wrapperProps": { "suppressIcon": true }
296
+ },
297
+ {
298
+ "key": "columnsReset",
299
+ "name": "重置表格列",
300
+ "desc": "完全自定义所有表格列,优先级大于columnsRewrite",
301
+ "type": "_JSEditor",
302
+ "defaultCode": "function columnsReset(columns, ctx) { \n return columns; \n}",
303
+ "mustConfirm": true,
304
+ "wrapper": "collapse",
305
+ "wrapperProps": { "suppressIcon": true }
306
+ },
307
+ {
308
+ "key": "modelParams",
309
+ "name": "model参数",
310
+ "type": "_JSEditor",
311
+ "defaultCode": "function getModelParams(ctx) { \n return {}; \n}",
312
+ "mustConfirm": true,
313
+ "wrapper": "collapse",
314
+ "wrapperProps": { "suppressIcon": true }
315
+ }
316
+ ]
317
+ }
171
318
  }
172
319
  ],
173
320
  "advance": {
@@ -109,7 +109,6 @@
109
109
  "default": false
110
110
  }
111
111
  ],
112
- "style": {},
113
112
  "advance": {
114
113
  "events": [
115
114
  {
@@ -40,7 +40,7 @@
40
40
  "default": 0
41
41
  }
42
42
  ],
43
- "style": {},
43
+ "css": {},
44
44
  "advance": {
45
45
  "events": [
46
46
  {
@@ -1,9 +1,54 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- var _excluded = ["children"];
4
+ var _excluded = ["rowKey", "children", "defaultExpandDeep"];
5
+ import React, { useState, useEffect } from 'react';
6
+ import { transform } from 'lodash';
3
7
  import Index from "./index";
4
8
  var FunctionDesign = function FunctionDesign(_ref) {
5
- var children = _ref.children,
9
+ var _ref$rowKey = _ref.rowKey,
10
+ rowKey = _ref$rowKey === void 0 ? window.appConfig.constraintKeys.PRIMARY : _ref$rowKey,
11
+ children = _ref.children,
12
+ defaultExpandDeep = _ref.defaultExpandDeep,
6
13
  props = _objectWithoutProperties(_ref, _excluded);
7
- return /*#__PURE__*/React.createElement(Index, props, children);
14
+ var _useState = useState([]),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ treeData = _useState2[0],
17
+ setTreeData = _useState2[1];
18
+ var _useState3 = useState([]),
19
+ _useState4 = _slicedToArray(_useState3, 2),
20
+ expandedKeys = _useState4[0],
21
+ setExpandedKeys = _useState4[1];
22
+
23
+ // 默认展开层级
24
+ useEffect(function () {
25
+ if (defaultExpandDeep && treeData && treeData.length > 0) {
26
+ var defaultExpanded = transform(treeData, function (result, n) {
27
+ if (defaultExpandDeep === 'all' || n.sidcc.substring(1, n.sidcc.length - 1).split('/').length < Number(defaultExpandDeep) + 1) {
28
+ result.push("".concat(n[rowKey]));
29
+ }
30
+ }, []);
31
+ setExpandedKeys(defaultExpanded);
32
+ }
33
+ }, [defaultExpandDeep, treeData]);
34
+ useEffect(function () {
35
+ props.context.$publisher(props.context.topics.COMPONENT_REPOSITIONING, {
36
+ id: props.id
37
+ });
38
+ }, [expandedKeys]);
39
+ return /*#__PURE__*/React.createElement(Index, _extends({}, props, {
40
+ afterQuery: function afterQuery(_ref2) {
41
+ var code = _ref2.code,
42
+ list = _ref2.list,
43
+ detail = _ref2.detail;
44
+ if (code === 1) setTreeData(list.map(function (i) {
45
+ return detail[i];
46
+ }));
47
+ },
48
+ expandedKeys: expandedKeys,
49
+ rowKey: rowKey,
50
+ defaultExpandDeep: defaultExpandDeep,
51
+ motion: null // 关闭动画
52
+ }), children);
8
53
  };
9
54
  export default FunctionDesign;