@luck-design-biz/luckda 1.0.2-9 → 1.0.3-13tl

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 (95) hide show
  1. package/es/components/LDActions/index.js +1 -0
  2. package/es/components/LdFormList/index.js +6 -4
  3. package/es/components/LdGrid/index.js +1 -4
  4. package/es/helper/action.js +2 -0
  5. package/es/locales/zh-CN.js +18 -1
  6. package/es/lowcode/constants/api-url.js +329 -187
  7. package/es/lowcode/engine/meta/box.props.default.json +1 -1
  8. package/es/lowcode/engine/meta/box.props.json +1 -1
  9. package/es/lowcode/engine/meta/button.api.json +0 -0
  10. package/es/lowcode/engine/meta/dialog.props.default.json +4 -1
  11. package/es/lowcode/engine/meta/dialog.props.json +24 -4
  12. package/es/lowcode/engine/meta/drawer.props.json +1 -1
  13. package/es/lowcode/engine/meta/form.props.json +1 -1
  14. package/es/lowcode/engine/provider/ContextProvider/router.js +21 -1
  15. package/es/lowcode/painter/DesignOperator.js +4 -3
  16. package/es/lowcode/painter/History.js +300 -0
  17. package/es/lowcode/painter/Ribbon.js +37 -1
  18. package/es/lowcode/painter/components/AdvancePanel.js +1 -1
  19. package/es/lowcode/painter/components/code-editor/DiffEditor.js +41 -0
  20. package/es/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
  21. package/es/lowcode/painter/components/field-setting/SettingUI.js +0 -1
  22. package/es/lowcode/painter/panel-section/ConditionCheck.js +71 -0
  23. package/es/lowcode/painter/panel-section/DialogSize.js +76 -0
  24. package/es/lowcode/painter/panel-section/DialogWidthHeight.js +60 -0
  25. package/es/lowcode/painter/panel-section/JSEditor/ToolBar.js +61 -6
  26. package/es/lowcode/painter/panel-section/JSEditor/index.js +37 -5
  27. package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +7 -2
  28. package/es/lowcode/painter/style/action-bind-modal.less +1 -1
  29. package/es/lowcode/painter/style/history.less +46 -0
  30. package/es/lowcode/painter/style/outline.less +1 -1
  31. package/es/lowcode/view/lc-components/Box/meta.json +1 -1
  32. package/es/lowcode/view/lc-components/Dialog/index.js +12 -5
  33. package/es/lowcode/view/lc-components/Dialog/meta.json +24 -4
  34. package/es/lowcode/view/lc-components/Drawer/index.js +3 -3
  35. package/es/lowcode/view/lc-components/Drawer/meta.json +1 -1
  36. package/es/lowcode/view/lc-components/Form/index.js +12 -19
  37. package/es/lowcode/view/lc-components/Form/meta.json +1 -1
  38. package/es/lowcode/view/lc-components/PageLayout/index.js +1 -1
  39. package/es/lowcode/view/lc-components/Table/components/TopImex.js +33 -16
  40. package/es/lowcode/view/lc-components/Table/index.js +5 -4
  41. package/es/upload/FilesWall/index.js +16 -6
  42. package/es/upload/Form/gridForm.js +16 -6
  43. package/es/upload/FormItem/index.js +16 -4
  44. package/es/utils/form.js +4 -3
  45. package/es/utils/grid.js +10 -2
  46. package/lib/components/LDActions/index.js +1 -0
  47. package/lib/components/LdFormList/index.js +6 -4
  48. package/lib/components/LdGrid/index.js +1 -4
  49. package/lib/helper/action.js +2 -0
  50. package/lib/locales/zh-CN.js +18 -1
  51. package/lib/lowcode/constants/api-url.js +329 -188
  52. package/lib/lowcode/engine/meta/box.props.default.json +1 -1
  53. package/lib/lowcode/engine/meta/box.props.json +1 -1
  54. package/lib/lowcode/engine/meta/button.api.json +0 -0
  55. package/lib/lowcode/engine/meta/dialog.props.default.json +4 -1
  56. package/lib/lowcode/engine/meta/dialog.props.json +24 -4
  57. package/lib/lowcode/engine/meta/drawer.props.json +1 -1
  58. package/lib/lowcode/engine/meta/form.props.json +1 -1
  59. package/lib/lowcode/engine/provider/ContextProvider/router.js +22 -1
  60. package/lib/lowcode/painter/DesignOperator.js +4 -3
  61. package/lib/lowcode/painter/History.js +308 -0
  62. package/lib/lowcode/painter/Ribbon.js +37 -1
  63. package/lib/lowcode/painter/components/AdvancePanel.js +1 -1
  64. package/lib/lowcode/painter/components/code-editor/DiffEditor.js +49 -0
  65. package/lib/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
  66. package/lib/lowcode/painter/components/field-setting/SettingUI.js +0 -1
  67. package/lib/lowcode/painter/panel-section/ConditionCheck.js +79 -0
  68. package/lib/lowcode/painter/panel-section/DialogSize.js +83 -0
  69. package/lib/lowcode/painter/panel-section/DialogWidthHeight.js +67 -0
  70. package/lib/lowcode/painter/panel-section/JSEditor/ToolBar.js +61 -6
  71. package/lib/lowcode/painter/panel-section/JSEditor/index.js +36 -4
  72. package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +7 -2
  73. package/lib/lowcode/painter/style/action-bind-modal.less +1 -1
  74. package/lib/lowcode/painter/style/history.less +46 -0
  75. package/lib/lowcode/painter/style/outline.less +1 -1
  76. package/lib/lowcode/view/lc-components/Box/meta.json +1 -1
  77. package/lib/lowcode/view/lc-components/Dialog/index.js +10 -3
  78. package/lib/lowcode/view/lc-components/Dialog/meta.json +24 -4
  79. package/lib/lowcode/view/lc-components/Drawer/index.js +1 -1
  80. package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -1
  81. package/lib/lowcode/view/lc-components/Form/index.js +12 -19
  82. package/lib/lowcode/view/lc-components/Form/meta.json +1 -1
  83. package/lib/lowcode/view/lc-components/PageLayout/index.js +1 -1
  84. package/lib/lowcode/view/lc-components/Table/components/TopImex.js +32 -15
  85. package/lib/lowcode/view/lc-components/Table/index.js +5 -4
  86. package/lib/upload/FilesWall/index.js +13 -3
  87. package/lib/upload/Form/gridForm.js +13 -3
  88. package/lib/upload/FormItem/index.js +15 -3
  89. package/lib/utils/form.js +3 -2
  90. package/lib/utils/grid.js +11 -3
  91. package/package.json +1 -2
  92. package/es/lowcode/engine/meta/fielddatadic.props.default.json +0 -16
  93. package/es/lowcode/engine/meta/fielddatadic.props.json +0 -73
  94. package/lib/lowcode/engine/meta/fielddatadic.props.default.json +0 -16
  95. package/lib/lowcode/engine/meta/fielddatadic.props.json +0 -73
@@ -6,7 +6,7 @@
6
6
  "group": "container",
7
7
  "groupName": "布局",
8
8
  "order": 3,
9
- "css": "height:auto; width: auto; background-color: #fff;",
9
+ "css": "height:auto; width: auto;",
10
10
  "advance": {
11
11
  "events": {}
12
12
  }
@@ -14,7 +14,7 @@
14
14
  "disabled": true
15
15
  }
16
16
  ],
17
- "css": "height:auto; width: auto; background-color: #fff;",
17
+ "css": "height:auto; width: auto;",
18
18
  "advance": {
19
19
  "events": [
20
20
  {
File without changes
@@ -7,6 +7,7 @@
7
7
  "groupName": "基础",
8
8
  "order": 1,
9
9
  "title": "对话框",
10
+ "size": "custom",
10
11
  "width": "700px",
11
12
  "height": "50vh",
12
13
  "padding": 16,
@@ -14,7 +15,9 @@
14
15
  "mask": true,
15
16
  "closable": true,
16
17
  "destroyOnClose": true,
17
- "footer": true,
18
+ "footer": {
19
+ "checked": true
20
+ },
18
21
  "okText": "确定",
19
22
  "cancelText": "取消",
20
23
  "btnGroup": {
@@ -20,10 +20,16 @@
20
20
  "type": "_I18nInput",
21
21
  "default": "对话框"
22
22
  },
23
+ {
24
+ "key": "size",
25
+ "name": "#展现尺寸",
26
+ "type": "_DialogSize",
27
+ "default": "custom"
28
+ },
23
29
  {
24
30
  "key": "width",
25
31
  "name": "对话框宽度",
26
- "type": "_WidthHeight",
32
+ "type": "_DialogWidthHeight",
27
33
  "options": [
28
34
  {
29
35
  "label": "px",
@@ -42,12 +48,18 @@
42
48
  "value": "auto"
43
49
  }
44
50
  ],
51
+ "sizeOptions": {
52
+ "small": "540px",
53
+ "default": "700px",
54
+ "large": "1150px",
55
+ "full": "100vw"
56
+ },
45
57
  "default": "700px"
46
58
  },
47
59
  {
48
60
  "key": "height",
49
61
  "name": "内容区高度",
50
- "type": "_WidthHeight",
62
+ "type": "_DialogWidthHeight",
51
63
  "options": [
52
64
  {
53
65
  "label": "px",
@@ -62,6 +74,12 @@
62
74
  "value": "auto"
63
75
  }
64
76
  ],
77
+ "sizeOptions": {
78
+ "small": "40vh",
79
+ "default": "60vh",
80
+ "large": "85vh",
81
+ "full": "100vh"
82
+ },
65
83
  "default": "50vh"
66
84
  },
67
85
  {
@@ -142,8 +160,10 @@
142
160
  "key": "footer",
143
161
  "name": "显示footer",
144
162
  "desc": "是否显示底部按钮区域",
145
- "type": "switch",
146
- "default": true
163
+ "type": "_ConditionCheck",
164
+ "default": {
165
+ "checked": true
166
+ }
147
167
  },
148
168
  {
149
169
  "key": "okText",
@@ -180,7 +180,7 @@
180
180
  "key": "footer",
181
181
  "name": "显示footer",
182
182
  "desc": "是否显示底部按钮区域",
183
- "type": "switch",
183
+ "type": "_ConditionCheck",
184
184
  "default": true
185
185
  },
186
186
  {
@@ -661,7 +661,7 @@
661
661
  "key": "beforeSave",
662
662
  "name": "保存前置事件",
663
663
  "desc": "保存前置事件,promise,返回false取消执行",
664
- "func": "function beforeSave(values, data) {\n return values; \n}"
664
+ "func": "function beforeSave(values, data) {\n return new Promise(resolve=>resolve(values)); \n}"
665
665
  },
666
666
  {
667
667
  "key": "onSaveCallback",
@@ -1,5 +1,11 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ var _excluded = ["title", "subTitle"],
5
+ _excluded2 = ["title", "subTitle"];
1
6
  import { history } from 'umi';
2
7
  import { isNil } from 'lodash';
8
+ import { parse, stringify } from 'qs';
3
9
  export function push(path, params) {
4
10
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'push';
5
11
  var blank = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -12,7 +18,21 @@ export function push(path, params) {
12
18
  method: 'replace'
13
19
  });
14
20
  } else if (type === 'layer') {
15
- window.openUrl("layer:".concat(path), params);
21
+ var _path$split = path.split('?'),
22
+ _path$split2 = _slicedToArray(_path$split, 2),
23
+ _path = _path$split2[0],
24
+ argsStr = _path$split2[1];
25
+ var title = params.title,
26
+ subTitle = params.subTitle,
27
+ _params = _objectWithoutProperties(params, _excluded);
28
+ var _parse = parse(argsStr),
29
+ _title = _parse.title,
30
+ _subTitle = _parse.subTitle,
31
+ args = _objectWithoutProperties(_parse, _excluded2);
32
+ window.openUrl("layer:".concat(_path, "?").concat(stringify(_objectSpread({
33
+ title: title || _title,
34
+ subTitle: subTitle || _subTitle
35
+ }, args))), _params);
16
36
  } else if (type === 'iframe') {
17
37
  window.openUrl("iframe:".concat(path));
18
38
  } else if (type === 'sso') {
@@ -265,15 +265,16 @@ var DesignOperator = function DesignOperator(_ref) {
265
265
  var toggle = _ref6.toggle,
266
266
  id = _ref6.id;
267
267
  if (toggle && id !== currentModal.current) {
268
- canvas.current.style.setProperty('overflow', 'hidden');
268
+ var _canvas$current2;
269
+ (_canvas$current2 = canvas.current) === null || _canvas$current2 === void 0 || _canvas$current2.style.setProperty('overflow', 'hidden');
269
270
  var _modal = context.componentMap.get(id);
270
271
  var _prevModal = currentModal.current ? context.componentMap.get(currentModal.current) : null;
271
272
  _prevModal === null || _prevModal === void 0 || _prevModal.api.doClose();
272
273
  _modal.api.doOpen();
273
274
  currentModal.current = id;
274
275
  } else if (!toggle) {
275
- var _canvas$current2;
276
- (_canvas$current2 = canvas.current) === null || _canvas$current2 === void 0 || _canvas$current2.style.removeProperty('overflow');
276
+ var _canvas$current3;
277
+ (_canvas$current3 = canvas.current) === null || _canvas$current3 === void 0 || _canvas$current3.style.removeProperty('overflow');
277
278
  var _id = id || currentModal.current;
278
279
  if (_id) {
279
280
  var _modal2 = context.componentMap.get(_id);
@@ -0,0 +1,300 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useRef, useState, useEffect } from 'react';
3
+ import { useRequest, useMemoizedFn, useInViewport } from 'ahooks';
4
+ import { Timeline, Avatar, Form, Input, Button, Spin } from 'luck-design/antd';
5
+ import { LuckModal } from 'luck-design';
6
+ import moment from 'moment';
7
+ import { isNil } from 'lodash';
8
+ import { recheck } from '@luck-design-biz/base';
9
+ import { useContext, useGet, resetPageData } from "../engine/provider/ContextProvider";
10
+ import TipIcon from "./components/TipIcon";
11
+ import DiffEditor from "./components/code-editor/DiffEditor";
12
+ import { formatMessage } from '@luck-design-biz/base/utils';
13
+ import { getLDMetaAttr } from "../engine/tools/helper";
14
+ import { decompress } from "../engine/tools/dataProcess";
15
+ import styles from "./style/history.less";
16
+ import { fetchHistoryVersionList, fetchAddHistoryVersion, fetchDelHistoryVersion, fetchRecoverHistoryVersion } from "../constants/api-url";
17
+ var History = function History(_ref) {
18
+ var form = _ref.form;
19
+ var ref = useRef();
20
+ var editorRef = useRef();
21
+ var versionListRef = useRef(null);
22
+ var ctx = useContext();
23
+ var _useState = useState([]),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ versionList = _useState2[0],
26
+ setVersionList = _useState2[1];
27
+ var _useState3 = useState(null),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ version = _useState4[0],
30
+ setVersion = _useState4[1];
31
+ var _useState5 = useState(false),
32
+ _useState6 = _slicedToArray(_useState5, 2),
33
+ visible = _useState6[0],
34
+ setVisible = _useState6[1];
35
+ var _useInViewport = useInViewport(ref),
36
+ _useInViewport2 = _slicedToArray(_useInViewport, 1),
37
+ inViewport = _useInViewport2[0];
38
+ var pageData = useGet();
39
+ var _useRequest = useRequest(fetchHistoryVersionList, {
40
+ manual: true,
41
+ onSuccess: function onSuccess(_ref2) {
42
+ var code = _ref2.code,
43
+ list = _ref2.list,
44
+ detail = _ref2.detail;
45
+ if (code === 1) {
46
+ versionListRef.current = list.map(function (id) {
47
+ return detail[id];
48
+ });
49
+ setVersionList(versionListRef.current);
50
+ }
51
+ }
52
+ }),
53
+ loading = _useRequest.loading,
54
+ runFetchHistoryVersionList = _useRequest.run;
55
+ var _useRequest2 = useRequest(fetchAddHistoryVersion, {
56
+ manual: true,
57
+ onSuccess: function onSuccess(_ref3) {
58
+ var code = _ref3.code;
59
+ if (code === 1) {
60
+ setVisible(false);
61
+ runFetchHistoryVersionList({
62
+ pageCode: getLDMetaAttr('pageCode')
63
+ });
64
+ }
65
+ }
66
+ }),
67
+ addLoading = _useRequest2.loading,
68
+ runFetchAddHistoryVersion = _useRequest2.run;
69
+ var _useRequest3 = useRequest(fetchDelHistoryVersion, {
70
+ manual: true,
71
+ onSuccess: function onSuccess(_ref4) {
72
+ var code = _ref4.code;
73
+ if (code === 1) {
74
+ runFetchHistoryVersionList({
75
+ pageCode: getLDMetaAttr('pageCode')
76
+ });
77
+ }
78
+ }
79
+ }),
80
+ deleteLoading = _useRequest3.loading,
81
+ runFetchDelHistoryVersion = _useRequest3.run;
82
+ var _useRequest4 = useRequest(fetchRecoverHistoryVersion, {
83
+ manual: true,
84
+ onSuccess: function onSuccess(_ref5) {
85
+ var code = _ref5.code;
86
+ return code === 1 && window.location.reload();
87
+ }
88
+ }),
89
+ runFetchRecoverHistoryVersion = _useRequest4.run;
90
+ var handleSearch = useMemoizedFn(function (value) {
91
+ if (isNil(value)) {
92
+ setVersionList(versionListRef.current);
93
+ } else {
94
+ setVersionList(versionListRef.current.filter(function (item) {
95
+ return JSON.stringify(item).includes(value);
96
+ }));
97
+ }
98
+ });
99
+ var handleAddVersion = useMemoizedFn(function () {
100
+ form.validateFields(function (err, values) {
101
+ if (!err) {
102
+ runFetchAddHistoryVersion({
103
+ pageCode: getLDMetaAttr('pageCode'),
104
+ backupName: values.title,
105
+ backupNote: values.note
106
+ });
107
+ }
108
+ });
109
+ });
110
+ var handleDeleteVersion = useMemoizedFn(function (item) {
111
+ recheck({
112
+ title: "".concat(formatMessage({
113
+ id: 'luckda.lowcode.version.delete',
114
+ label: '你确定要删除该历史版本吗?'
115
+ })),
116
+ checkWords: "".concat(item.backupName, "(").concat(item.backupUserName, ")"),
117
+ cancelText: formatMessage({
118
+ id: 'app.base.operate.cancel'
119
+ }),
120
+ okText: formatMessage({
121
+ id: 'app.base.operate.ok'
122
+ }),
123
+ onOk: function onOk() {
124
+ runFetchDelHistoryVersion({
125
+ uid: item.id
126
+ });
127
+ }
128
+ });
129
+ });
130
+ var handleRecoverVersion = useMemoizedFn(function () {
131
+ recheck({
132
+ title: "".concat(formatMessage({
133
+ id: 'luckda.lowcode.version.confirm.recover',
134
+ label: '你确定要还原到该历史版本吗?'
135
+ })),
136
+ checkWords: "".concat(version.backupName, "(").concat(version.backupUserName, ")"),
137
+ cancelText: formatMessage({
138
+ id: 'app.base.operate.cancel'
139
+ }),
140
+ okText: formatMessage({
141
+ id: 'luckda.lowcode.version.recover',
142
+ label: '还原版本'
143
+ }),
144
+ onOk: function onOk() {
145
+ return runFetchRecoverHistoryVersion({
146
+ uid: version.id
147
+ });
148
+ }
149
+ });
150
+ });
151
+ var handleUseVersion = useMemoizedFn(function () {
152
+ var code = editorRef.current.getModel().modified.getValue();
153
+ try {
154
+ var data = JSON.parse(code);
155
+ resetPageData(data);
156
+ setVersion(null);
157
+ } catch (e) {
158
+ console.error(e);
159
+ message.warning(formatMessage({
160
+ id: 'luckda.lowcode.error.pagedata',
161
+ label: '页面数据错误'
162
+ }));
163
+ }
164
+ });
165
+ useEffect(function () {
166
+ if (inViewport) {
167
+ runFetchHistoryVersionList({
168
+ pageCode: getLDMetaAttr('pageCode')
169
+ });
170
+ }
171
+ }, [inViewport]);
172
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
173
+ ref: ref,
174
+ className: styles['lc-painter-history']
175
+ }, /*#__PURE__*/React.createElement("div", {
176
+ className: styles.historyToolbar
177
+ }, /*#__PURE__*/React.createElement(Input.Search, {
178
+ placeholder: formatMessage({
179
+ id: 'luckda.lowcode.version.placeholder.search',
180
+ label: '请输入查询内容'
181
+ }),
182
+ size: "small",
183
+ onSearch: handleSearch
184
+ }), /*#__PURE__*/React.createElement(Button, {
185
+ type: "primary",
186
+ icon: "plus",
187
+ size: "small",
188
+ style: {
189
+ marginLeft: '8px',
190
+ flexShrink: 0
191
+ },
192
+ onClick: function onClick() {
193
+ return setVisible(true);
194
+ }
195
+ })), /*#__PURE__*/React.createElement(Spin, {
196
+ spinning: loading || deleteLoading
197
+ }, /*#__PURE__*/React.createElement(Timeline, null, versionList.map(function (item) {
198
+ return /*#__PURE__*/React.createElement(Timeline.Item, {
199
+ className: styles.timelineItem
200
+ }, /*#__PURE__*/React.createElement("div", {
201
+ className: styles.timelineItemHeader
202
+ }, /*#__PURE__*/React.createElement("div", null, item.backupName), /*#__PURE__*/React.createElement("div", {
203
+ className: styles.timelineItemActions
204
+ }, /*#__PURE__*/React.createElement(TipIcon, {
205
+ title: formatMessage({
206
+ id: 'app.base.operate.delete',
207
+ label: '删除'
208
+ }),
209
+ type: "delete",
210
+ style: {
211
+ color: 'var(--luck-color-danger)',
212
+ marginRight: 8
213
+ },
214
+ onClick: function onClick() {
215
+ return handleDeleteVersion(item);
216
+ }
217
+ }), /*#__PURE__*/React.createElement(TipIcon, {
218
+ title: formatMessage({
219
+ id: 'luckda.lowcode.version.diff',
220
+ label: '差异比对'
221
+ }),
222
+ type: "swap",
223
+ onClick: function onClick() {
224
+ ctx.$publisher(ctx.topics.COMPONENT_ACTIVE, null);
225
+ setVersion(item);
226
+ }
227
+ }))), /*#__PURE__*/React.createElement("div", {
228
+ className: styles.timelineItemUser
229
+ }, /*#__PURE__*/React.createElement(Avatar, {
230
+ style: {
231
+ backgroundColor: 'var(--luck-ant-colorful-primary)',
232
+ verticalAlign: 'middle',
233
+ marginRight: '8px'
234
+ }
235
+ }, item.backupUserName.slice(-1)), item.backupUserName), /*#__PURE__*/React.createElement("div", {
236
+ className: styles.timelineItemTime
237
+ }, moment(item.backupTime).fromNow()));
238
+ })))), /*#__PURE__*/React.createElement(LuckModal, {
239
+ title: "".concat(version === null || version === void 0 ? void 0 : version.backupName, "(").concat(version === null || version === void 0 ? void 0 : version.backupUserName, ") \u21CB \u5F53\u524D\u7248\u672C"),
240
+ width: "80vw",
241
+ height: "80vh",
242
+ visible: !isNil(version),
243
+ fullScreen: true,
244
+ getContainer: function getContainer() {
245
+ return document.getElementById('lc-design-workspace');
246
+ },
247
+ okText: formatMessage({
248
+ id: 'luckda.lowcode.version.recover',
249
+ label: '还原版本'
250
+ }),
251
+ cancelText: formatMessage({
252
+ id: 'luckda.lowcode.version.use',
253
+ label: '使用'
254
+ }),
255
+ cancelButtonProps: {
256
+ onClick: handleUseVersion
257
+ },
258
+ onOk: handleRecoverVersion,
259
+ onClose: function onClose() {
260
+ return setVersion(null);
261
+ }
262
+ }, /*#__PURE__*/React.createElement(DiffEditor, {
263
+ ref: editorRef,
264
+ language: "json",
265
+ originalCode: version ? JSON.stringify(decompress(version === null || version === void 0 ? void 0 : version.pageData), null, '\t') : '',
266
+ modifiedCode: JSON.stringify(pageData, null, '\t')
267
+ })), /*#__PURE__*/React.createElement(LuckModal, {
268
+ title: formatMessage({
269
+ id: 'luckda.lowcode.version.add',
270
+ label: '添加到历史版本'
271
+ }),
272
+ size: "small",
273
+ visible: visible,
274
+ okButtonProps: {
275
+ loading: addLoading
276
+ },
277
+ onOk: handleAddVersion,
278
+ onClose: function onClose() {
279
+ return setVisible(false);
280
+ }
281
+ }, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Form.Item, null, form.getFieldDecorator('title', {
282
+ rules: [{
283
+ required: true
284
+ }]
285
+ })( /*#__PURE__*/React.createElement(Input, {
286
+ placeholder: formatMessage({
287
+ id: 'luckda.lowcode.version.placeholder.title',
288
+ label: '请输入版本标题'
289
+ })
290
+ }))), /*#__PURE__*/React.createElement(Form.Item, null, form.getFieldDecorator('note')( /*#__PURE__*/React.createElement(Input.TextArea, {
291
+ rows: 6,
292
+ placeholder: formatMessage({
293
+ id: 'luckda.lowcode.version.placeholder.note',
294
+ label: '请输入版本描述'
295
+ })
296
+ }))))));
297
+ };
298
+ export default Form.create({
299
+ name: 'version_form'
300
+ })(History);
@@ -7,6 +7,7 @@ import { Icon, Tooltip, Drawer } from 'luck-design/antd';
7
7
  import Outline from "./Outline";
8
8
  import Components from "./Components";
9
9
  import I18n from "./I18n";
10
+ import History from "./History";
10
11
  import { formatMessage } from '@luck-design-biz/base/utils';
11
12
  import Expect from "./expect";
12
13
  import styles from "./style/ribbon.less";
@@ -47,6 +48,12 @@ var _DRAWER_I18N_ = {
47
48
  title: '多语言文案管理',
48
49
  fix: false
49
50
  };
51
+ var _DRAWER_HISTORY_ = {
52
+ width: 240,
53
+ key: 'history',
54
+ title: '版本历史',
55
+ fix: false
56
+ };
50
57
  var Ribbon = function Ribbon() {
51
58
  var _useState = useState(null),
52
59
  _useState2 = _slicedToArray(_useState, 2),
@@ -106,6 +113,21 @@ var Ribbon = function Ribbon() {
106
113
  onClick: function onClick() {
107
114
  return setDrawer((drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_I18N_.key ? null : _DRAWER_I18N_);
108
115
  }
116
+ })), /*#__PURE__*/React.createElement(Tooltip, {
117
+ placement: "right",
118
+ title: formatMessage({
119
+ id: 'luckda.lowcode.history',
120
+ label: _DRAWER_HISTORY_.title
121
+ })
122
+ }, /*#__PURE__*/React.createElement(Icon, {
123
+ type: "history",
124
+ style: {
125
+ color: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_HISTORY_.key && '#1d79f2',
126
+ fontSize: 20
127
+ },
128
+ onClick: function onClick() {
129
+ return setDrawer((drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_HISTORY_.key ? null : _DRAWER_HISTORY_);
130
+ }
109
131
  }))), /*#__PURE__*/React.createElement(Drawer, _extends({
110
132
  title: drawer ? formatMessage({
111
133
  id: "luckda.lowcode.".concat(drawer.key),
@@ -150,6 +172,20 @@ var Ribbon = function Ribbon() {
150
172
  style: _objectSpread(_objectSpread({}, _DRAWER_PROPS.style), {}, {
151
173
  display: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_I18N_.key ? 'block' : 'none'
152
174
  })
153
- }), /*#__PURE__*/React.createElement(Expect, null)));
175
+ }), /*#__PURE__*/React.createElement(Expect, null)), /*#__PURE__*/React.createElement(Drawer, _extends({
176
+ title: drawer ? formatMessage({
177
+ id: "luckda.lowcode.".concat(drawer.key),
178
+ label: drawer.title
179
+ }) : '',
180
+ width: (drawer === null || drawer === void 0 ? void 0 : drawer.width) || 0,
181
+ visible: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_HISTORY_.key,
182
+ onClose: function onClose() {
183
+ return setDrawer(null);
184
+ }
185
+ }, _DRAWER_PROPS, {
186
+ style: _objectSpread(_objectSpread({}, _DRAWER_PROPS.style), {}, {
187
+ display: (drawer === null || drawer === void 0 ? void 0 : drawer.key) === _DRAWER_HISTORY_.key ? 'block' : 'none'
188
+ })
189
+ }), /*#__PURE__*/React.createElement(History, null)));
154
190
  };
155
191
  export default Ribbon;
@@ -20,7 +20,7 @@ var _I18N_PREFIX_ = 'luckda.lowcode.painter.advancePanel';
20
20
  var EventItem = styled.div.withConfig({
21
21
  displayName: "EventItem",
22
22
  componentId: "luckda-6530__sc-6426fo-0"
23
- })(["display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border:1px solid #e5e6e8;border-radius:6px;margin-bottom:6px;font-size:12px;i{color:rgba(0,0,0,0.4);cursor:pointer;}i:not(:last-child){margin-right:6px;}"]);
23
+ })(["display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border:1px solid #e5e6e8;border-radius:6px;margin-bottom:6px;font-size:12px;i{color:var(--ant-text-color);cursor:pointer;}i:not(:last-child){margin-right:6px;}"]);
24
24
  var _DEFAULT_FUNC_ = 'function isTrue() {\n return true; \n}';
25
25
  var AdvancePanel = function AdvancePanel(_ref) {
26
26
  var _value$render2, _Map$get;
@@ -0,0 +1,41 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import React, { forwardRef, useEffect, useRef, useImperativeHandle, memo } from 'react';
3
+ import * as monaco from 'monaco-editor';
4
+ import useCombinedRef from "../../../engine/tools/useCombinedRefs";
5
+ var DiffEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
6
+ var originalCode = _ref.originalCode,
7
+ modifiedCode = _ref.modifiedCode,
8
+ _ref$language = _ref.language,
9
+ language = _ref$language === void 0 ? 'javascript' : _ref$language,
10
+ _ref$options = _ref.options,
11
+ options = _ref$options === void 0 ? {} : _ref$options;
12
+ var containerRef = useRef(null);
13
+ var editorRef = useCombinedRef(ref);
14
+ useEffect(function () {
15
+ if (containerRef.current) {
16
+ editorRef.current = monaco.editor.createDiffEditor(containerRef.current, _objectSpread({
17
+ language: language,
18
+ automaticLayout: true,
19
+ autoIndent: true,
20
+ tabSize: 2
21
+ }, options));
22
+ editorRef.current.setModel({
23
+ original: monaco.editor.createModel(originalCode, language),
24
+ modified: monaco.editor.createModel(modifiedCode, language)
25
+ });
26
+ }
27
+ return function () {
28
+ if (editorRef.current) {
29
+ editorRef.current.dispose();
30
+ }
31
+ };
32
+ }, []);
33
+ return /*#__PURE__*/React.createElement("div", {
34
+ ref: containerRef,
35
+ style: {
36
+ width: '100%',
37
+ height: '100%'
38
+ }
39
+ });
40
+ });
41
+ export default /*#__PURE__*/memo(DiffEditor);
@@ -20,11 +20,11 @@ var Wrapper = styled.div.withConfig({
20
20
  var Title = styled.p.withConfig({
21
21
  displayName: "Title",
22
22
  componentId: "luckda-6530__sc-rwt684-1"
23
- })(["font-weight:700;margin-bottom:8px;color:rgba(0,0,0,0.8);display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;justify-content:space-between;"]);
23
+ })(["font-weight:700;margin-bottom:8px;color:var(--ant-text-color);display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;justify-content:space-between;"]);
24
24
  var LeftBox = styled.div.withConfig({
25
25
  displayName: "LeftBox",
26
26
  componentId: "luckda-6530__sc-rwt684-2"
27
- })(["width:100%;flex:1;border:1px solid #e5e6e8;border-radius:6px;"]);
27
+ })(["width:100%;flex:1;border:1px solid #e5e6e8;border-radius:6px;overflow:hidden;"]);
28
28
  var Option = styled.div.withConfig({
29
29
  displayName: "Option",
30
30
  componentId: "luckda-6530__sc-rwt684-3"
@@ -409,7 +409,6 @@ var SettingUI = function SettingUI(_ref) {
409
409
  onChange: function onChange(val) {
410
410
  return run('render', val);
411
411
  },
412
- isjsx: true,
413
412
  defaultCode: _DEFAULT_RENDER_CODE
414
413
  })) : null, /*#__PURE__*/React.createElement(Collapse, {
415
414
  label: formatMessage({