@nocobase/plugin-multi-app-share-collection 0.10.1-alpha.1 → 0.11.1-alpha.1
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/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/MultiAppShareCollectionProvider.d.ts +2 -0
- package/lib/client/MultiAppShareCollectionProvider.js +122 -0
- package/lib/client/TableTransfer.d.ts +1 -1
- package/lib/client/TableTransfer.js +20 -35
- package/lib/client/index.d.ts +5 -3
- package/lib/client/index.js +11 -106
- package/lib/server/plugin.js +6 -6
- package/package.json +27 -7
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/MultiAppShareCollectionProvider.tsx +86 -0
- package/src/client/TableTransfer.tsx +28 -20
- package/src/client/index.tsx +8 -84
- package/src/server/plugin.ts +2 -1
package/client.d.ts
CHANGED
package/client.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
4
|
-
|
|
5
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/client"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/client/index.js');
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultiAppShareCollectionProvider = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = require("@formily/react");
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _client() {
|
|
15
|
+
const data = require("@nocobase/client");
|
|
16
|
+
_client = function _client() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _client2() {
|
|
22
|
+
const data = require("@nocobase/plugin-multi-app-manager/client");
|
|
23
|
+
_client2 = function _client2() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _antd() {
|
|
29
|
+
const data = require("antd");
|
|
30
|
+
_antd = function _antd() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _react2() {
|
|
36
|
+
const data = _interopRequireDefault(require("react"));
|
|
37
|
+
_react2 = function _react2() {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
var _TableTransfer = require("./TableTransfer");
|
|
43
|
+
var _utils = require("./utils");
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
46
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
47
|
+
const useShareCollectionAction = () => {
|
|
48
|
+
const form = (0, _react().useForm)();
|
|
49
|
+
const ctx = (0, _client().useActionContext)();
|
|
50
|
+
const api = (0, _client().useAPIClient)();
|
|
51
|
+
const record = (0, _client().useRecord)();
|
|
52
|
+
return {
|
|
53
|
+
run() {
|
|
54
|
+
return _asyncToGenerator(function* () {
|
|
55
|
+
console.log(form.values.names);
|
|
56
|
+
yield api.request({
|
|
57
|
+
url: `applications/${record.name}/collectionBlacklist`,
|
|
58
|
+
data: form.values.names,
|
|
59
|
+
method: 'post'
|
|
60
|
+
});
|
|
61
|
+
ctx.setVisible(false);
|
|
62
|
+
form.reset();
|
|
63
|
+
_antd().message.success('Saved successfully');
|
|
64
|
+
})();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const updateSchema = _client2().tableActionColumnSchema.properties.update;
|
|
69
|
+
const deleteSchema = _client2().tableActionColumnSchema.properties.delete;
|
|
70
|
+
delete _client2().tableActionColumnSchema.properties.update;
|
|
71
|
+
delete _client2().tableActionColumnSchema.properties.delete;
|
|
72
|
+
_client2().tableActionColumnSchema.properties['collection'] = {
|
|
73
|
+
type: 'void',
|
|
74
|
+
title: (0, _utils.i18nText)('Share collections'),
|
|
75
|
+
'x-component': 'Action.Link',
|
|
76
|
+
'x-component-props': {},
|
|
77
|
+
properties: {
|
|
78
|
+
drawer: {
|
|
79
|
+
type: 'void',
|
|
80
|
+
'x-component': 'Action.Drawer',
|
|
81
|
+
'x-component-props': {
|
|
82
|
+
width: '95vw'
|
|
83
|
+
},
|
|
84
|
+
'x-decorator': 'Form',
|
|
85
|
+
title: (0, _utils.i18nText)('Share collections'),
|
|
86
|
+
properties: {
|
|
87
|
+
names: {
|
|
88
|
+
type: 'array',
|
|
89
|
+
'x-component': _TableTransfer.TableTransfer,
|
|
90
|
+
'x-decorator': 'FormItem'
|
|
91
|
+
},
|
|
92
|
+
footer: {
|
|
93
|
+
type: 'void',
|
|
94
|
+
'x-component': 'Action.Drawer.Footer',
|
|
95
|
+
properties: {
|
|
96
|
+
cancel: {
|
|
97
|
+
title: '{{t("Cancel")}}',
|
|
98
|
+
'x-component': 'Action',
|
|
99
|
+
'x-component-props': {
|
|
100
|
+
useAction: '{{ cm.useCancelAction }}'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
submit: {
|
|
104
|
+
title: '{{t("Submit")}}',
|
|
105
|
+
'x-component': 'Action',
|
|
106
|
+
'x-component-props': {
|
|
107
|
+
type: 'primary',
|
|
108
|
+
useAction: useShareCollectionAction
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
_client2().tableActionColumnSchema.properties.update = updateSchema;
|
|
118
|
+
_client2().tableActionColumnSchema.properties.delete = deleteSchema;
|
|
119
|
+
const MultiAppShareCollectionProvider = props => {
|
|
120
|
+
return _react2().default.createElement(_react2().default.Fragment, null, props.children);
|
|
121
|
+
};
|
|
122
|
+
exports.MultiAppShareCollectionProvider = MultiAppShareCollectionProvider;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const TableTransfer: React.ForwardRefExoticComponent<
|
|
2
|
+
export declare const TableTransfer: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
|
|
3
3
|
export default TableTransfer;
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.TableTransfer = void 0;
|
|
7
|
-
function _css() {
|
|
8
|
-
const data = require("@emotion/css");
|
|
9
|
-
_css = function _css() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _react() {
|
|
15
8
|
const data = require("@formily/react");
|
|
16
9
|
_react = function _react() {
|
|
@@ -39,20 +32,6 @@ function _antd() {
|
|
|
39
32
|
};
|
|
40
33
|
return data;
|
|
41
34
|
}
|
|
42
|
-
function _debounce() {
|
|
43
|
-
const data = _interopRequireDefault(require("lodash/debounce"));
|
|
44
|
-
_debounce = function _debounce() {
|
|
45
|
-
return data;
|
|
46
|
-
};
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
function _uniq() {
|
|
50
|
-
const data = _interopRequireDefault(require("lodash/uniq"));
|
|
51
|
-
_uniq = function _uniq() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
return data;
|
|
55
|
-
}
|
|
56
35
|
function _react2() {
|
|
57
36
|
const data = _interopRequireWildcard(require("react"));
|
|
58
37
|
_react2 = function _react2() {
|
|
@@ -69,7 +48,6 @@ function _reactI18next() {
|
|
|
69
48
|
}
|
|
70
49
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
71
50
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
72
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
73
51
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
74
52
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
75
53
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -200,7 +178,7 @@ const useRemovedDataSource = ({
|
|
|
200
178
|
return !results.includes(false);
|
|
201
179
|
});
|
|
202
180
|
}, [collections, removed, filter]);
|
|
203
|
-
const setNameFilter = (0, _react2().useMemo)(() => (
|
|
181
|
+
const setNameFilter = (0, _react2().useMemo)(() => _client2().lodash.debounce(name => {
|
|
204
182
|
setFilter(_objectSpread(_objectSpread({}, filter), {}, {
|
|
205
183
|
name
|
|
206
184
|
}));
|
|
@@ -240,7 +218,7 @@ const useAddedDataSource = ({
|
|
|
240
218
|
}
|
|
241
219
|
return !results.includes(false);
|
|
242
220
|
});
|
|
243
|
-
const setNameFilter = (0, _react2().useMemo)(() => (
|
|
221
|
+
const setNameFilter = (0, _react2().useMemo)(() => _client2().lodash.debounce(name => {
|
|
244
222
|
setFilter(_objectSpread(_objectSpread({}, filter), {}, {
|
|
245
223
|
name
|
|
246
224
|
}));
|
|
@@ -286,6 +264,10 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
286
264
|
});
|
|
287
265
|
const _useTranslation = (0, _reactI18next().useTranslation)('multi-app-share-collection'),
|
|
288
266
|
t = _useTranslation.t;
|
|
267
|
+
const _App$useApp = _antd().App.useApp(),
|
|
268
|
+
modal = _App$useApp.modal;
|
|
269
|
+
const _useToken = (0, _client().useToken)(),
|
|
270
|
+
token = _useToken.token;
|
|
289
271
|
const columns = (0, _react2().useMemo)(() => [{
|
|
290
272
|
title: t('Collection display name'),
|
|
291
273
|
dataIndex: 'title'
|
|
@@ -296,6 +278,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
296
278
|
title: t('Collection category'),
|
|
297
279
|
dataIndex: 'category',
|
|
298
280
|
render: categories => categories.map(category => _react2().default.createElement(_antd().Tag, {
|
|
281
|
+
key: category.name,
|
|
299
282
|
color: category.color
|
|
300
283
|
}, category.name))
|
|
301
284
|
}], []);
|
|
@@ -304,7 +287,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
304
287
|
}
|
|
305
288
|
return _react2().default.createElement("div", null, _react2().default.createElement(_antd().Row, {
|
|
306
289
|
gutter: 24,
|
|
307
|
-
className: (0,
|
|
290
|
+
className: (0, _client().css)`
|
|
308
291
|
.ant-table-tbody > tr.ant-table-row:hover > td {
|
|
309
292
|
background: #e6f7ff;
|
|
310
293
|
cursor: pointer;
|
|
@@ -313,7 +296,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
313
296
|
}, _react2().default.createElement(_antd().Col, {
|
|
314
297
|
span: 12
|
|
315
298
|
}, _react2().default.createElement("div", {
|
|
316
|
-
className: (0,
|
|
299
|
+
className: (0, _client().css)`
|
|
317
300
|
display: flex;
|
|
318
301
|
justify-content: space-between;
|
|
319
302
|
align-items: center;
|
|
@@ -322,7 +305,8 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
322
305
|
`
|
|
323
306
|
}, _react2().default.createElement("strong", {
|
|
324
307
|
style: {
|
|
325
|
-
fontSize:
|
|
308
|
+
fontSize: token.fontSizeLG,
|
|
309
|
+
color: token.colorText
|
|
326
310
|
}
|
|
327
311
|
}, t('Unshared collections')), _react2().default.createElement(_antd().Input.Group, {
|
|
328
312
|
compact: true,
|
|
@@ -330,7 +314,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
330
314
|
width: 360
|
|
331
315
|
}
|
|
332
316
|
}, _react2().default.createElement(_antd().Select, {
|
|
333
|
-
|
|
317
|
+
popupMatchSelectWidth: false,
|
|
334
318
|
onChange: value => {
|
|
335
319
|
removedDataSource.setCategoryFilter(value);
|
|
336
320
|
},
|
|
@@ -385,7 +369,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
385
369
|
if (adding.length === 1) {
|
|
386
370
|
return change();
|
|
387
371
|
}
|
|
388
|
-
|
|
372
|
+
modal.confirm({
|
|
389
373
|
title: t('Are you sure to add the following collections?'),
|
|
390
374
|
width: '60%',
|
|
391
375
|
content: _react2().default.createElement("div", null, _react2().default.createElement(_antd().Table, {
|
|
@@ -406,7 +390,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
406
390
|
})), _react2().default.createElement(_antd().Col, {
|
|
407
391
|
span: 12
|
|
408
392
|
}, _react2().default.createElement("div", {
|
|
409
|
-
className: (0,
|
|
393
|
+
className: (0, _client().css)`
|
|
410
394
|
display: flex;
|
|
411
395
|
justify-content: space-between;
|
|
412
396
|
align-items: center;
|
|
@@ -415,7 +399,8 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
415
399
|
`
|
|
416
400
|
}, _react2().default.createElement("strong", {
|
|
417
401
|
style: {
|
|
418
|
-
fontSize:
|
|
402
|
+
fontSize: token.fontSizeLG,
|
|
403
|
+
color: token.colorText
|
|
419
404
|
}
|
|
420
405
|
}, t('Shared collections')), _react2().default.createElement(_antd().Input.Group, {
|
|
421
406
|
compact: true,
|
|
@@ -423,7 +408,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
423
408
|
width: 360
|
|
424
409
|
}
|
|
425
410
|
}, _react2().default.createElement(_antd().Select, {
|
|
426
|
-
|
|
411
|
+
popupMatchSelectWidth: false,
|
|
427
412
|
onChange: value => {
|
|
428
413
|
addedDataSource.setCategoryFilter(value);
|
|
429
414
|
},
|
|
@@ -449,7 +434,7 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
449
434
|
type: 'checkbox',
|
|
450
435
|
selectedRowKeys: selectedRowKeys2,
|
|
451
436
|
onChange(selectedRowKeys) {
|
|
452
|
-
const values = (
|
|
437
|
+
const values = _client2().lodash.uniq(removed.concat(selectedRowKeys));
|
|
453
438
|
setSelected(values);
|
|
454
439
|
onChange(values);
|
|
455
440
|
setSelectedRowKeys2([]);
|
|
@@ -470,14 +455,14 @@ const TableTransfer = (0, _react().connect)(props => {
|
|
|
470
455
|
const removing = findRemovable(name);
|
|
471
456
|
const change = () => {
|
|
472
457
|
removed.push(...removing);
|
|
473
|
-
const values = (
|
|
458
|
+
const values = _client2().lodash.uniq([...removed]);
|
|
474
459
|
setSelected(values);
|
|
475
460
|
onChange(values);
|
|
476
461
|
};
|
|
477
462
|
if (removing.length === 1) {
|
|
478
463
|
return change();
|
|
479
464
|
}
|
|
480
|
-
|
|
465
|
+
modal.confirm({
|
|
481
466
|
title: t('Are you sure to remove the following collections?'),
|
|
482
467
|
width: '60%',
|
|
483
468
|
content: _react2().default.createElement("div", null, _react2().default.createElement(_antd().Table, {
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare
|
|
3
|
-
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
|
+
export declare class MultiAppShareCollectionPlugin extends Plugin {
|
|
3
|
+
load(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export default MultiAppShareCollectionPlugin;
|
package/lib/client/index.js
CHANGED
|
@@ -3,14 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = require("@formily/react");
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
6
|
+
exports.default = exports.MultiAppShareCollectionPlugin = void 0;
|
|
14
7
|
function _client() {
|
|
15
8
|
const data = require("@nocobase/client");
|
|
16
9
|
_client = function _client() {
|
|
@@ -18,105 +11,17 @@ function _client() {
|
|
|
18
11
|
};
|
|
19
12
|
return data;
|
|
20
13
|
}
|
|
21
|
-
|
|
22
|
-
const data = require("@nocobase/plugin-multi-app-manager/client");
|
|
23
|
-
_client2 = function _client2() {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _antd() {
|
|
29
|
-
const data = require("antd");
|
|
30
|
-
_antd = function _antd() {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
function _react2() {
|
|
36
|
-
const data = _interopRequireDefault(require("react"));
|
|
37
|
-
_react2 = function _react2() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
|
-
var _TableTransfer = require("./TableTransfer");
|
|
43
|
-
var _utils = require("./utils");
|
|
44
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
var _MultiAppShareCollectionProvider = require("./MultiAppShareCollectionProvider");
|
|
45
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
46
16
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
run() {
|
|
54
|
-
return _asyncToGenerator(function* () {
|
|
55
|
-
console.log(form.values.names);
|
|
56
|
-
yield api.request({
|
|
57
|
-
url: `applications/${record.name}/collectionBlacklist`,
|
|
58
|
-
data: form.values.names,
|
|
59
|
-
method: 'post'
|
|
60
|
-
});
|
|
61
|
-
ctx.setVisible(false);
|
|
62
|
-
form.reset();
|
|
63
|
-
_antd().message.success('Saved successfully');
|
|
64
|
-
})();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
const updateSchema = _client2().tableActionColumnSchema.properties.update;
|
|
69
|
-
const deleteSchema = _client2().tableActionColumnSchema.properties.delete;
|
|
70
|
-
delete _client2().tableActionColumnSchema.properties.update;
|
|
71
|
-
delete _client2().tableActionColumnSchema.properties.delete;
|
|
72
|
-
_client2().tableActionColumnSchema.properties['collection'] = {
|
|
73
|
-
type: 'void',
|
|
74
|
-
title: (0, _utils.i18nText)('Share collections'),
|
|
75
|
-
'x-component': 'Action.Link',
|
|
76
|
-
'x-component-props': {},
|
|
77
|
-
properties: {
|
|
78
|
-
drawer: {
|
|
79
|
-
type: 'void',
|
|
80
|
-
'x-component': 'Action.Drawer',
|
|
81
|
-
'x-component-props': {
|
|
82
|
-
width: '95vw'
|
|
83
|
-
},
|
|
84
|
-
'x-decorator': 'Form',
|
|
85
|
-
title: (0, _utils.i18nText)('Share collections'),
|
|
86
|
-
properties: {
|
|
87
|
-
names: {
|
|
88
|
-
type: 'array',
|
|
89
|
-
'x-component': _TableTransfer.TableTransfer,
|
|
90
|
-
'x-decorator': 'FormItem'
|
|
91
|
-
},
|
|
92
|
-
footer: {
|
|
93
|
-
type: 'void',
|
|
94
|
-
'x-component': 'Action.Drawer.Footer',
|
|
95
|
-
properties: {
|
|
96
|
-
cancel: {
|
|
97
|
-
title: '{{t("Cancel")}}',
|
|
98
|
-
'x-component': 'Action',
|
|
99
|
-
'x-component-props': {
|
|
100
|
-
useAction: '{{ cm.useCancelAction }}'
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
submit: {
|
|
104
|
-
title: '{{t("Submit")}}',
|
|
105
|
-
'x-component': 'Action',
|
|
106
|
-
'x-component-props': {
|
|
107
|
-
type: 'primary',
|
|
108
|
-
useAction: useShareCollectionAction
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
17
|
+
class MultiAppShareCollectionPlugin extends _client().Plugin {
|
|
18
|
+
load() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
return _asyncToGenerator(function* () {
|
|
21
|
+
_this.app.use(_MultiAppShareCollectionProvider.MultiAppShareCollectionProvider);
|
|
22
|
+
})();
|
|
115
23
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var _default = props => {
|
|
120
|
-
return _react2().default.createElement(_react2().default.Fragment, null, props.children);
|
|
121
|
-
};
|
|
24
|
+
}
|
|
25
|
+
exports.MultiAppShareCollectionPlugin = MultiAppShareCollectionPlugin;
|
|
26
|
+
var _default = MultiAppShareCollectionPlugin;
|
|
122
27
|
exports.default = _default;
|
package/lib/server/plugin.js
CHANGED
|
@@ -18,9 +18,9 @@ function _server() {
|
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data =
|
|
23
|
-
|
|
21
|
+
function _utils() {
|
|
22
|
+
const data = require("@nocobase/utils");
|
|
23
|
+
_utils = function _utils() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
@@ -48,7 +48,7 @@ class SubAppPlugin extends _server().Plugin {
|
|
|
48
48
|
beforeLoad() {
|
|
49
49
|
const mainApp = this.options.mainApp;
|
|
50
50
|
const subApp = this.app;
|
|
51
|
-
const sharedCollectionGroups = ['audit-logs', 'workflow', 'charts', 'collection-manager', 'file-manager', 'graph-collection-manager', 'map', 'sequence-field', 'snapshot-field', 'verification'];
|
|
51
|
+
const sharedCollectionGroups = ['audit-logs', 'workflow', 'charts', 'collection-manager', 'file-manager', 'graph-collection-manager', 'map', 'sequence-field', 'snapshot-field', 'verification', 'localization-management'];
|
|
52
52
|
const collectionGroups = mainApp.db.collectionGroupManager.getGroups();
|
|
53
53
|
const sharedCollectionGroupsCollections = [];
|
|
54
54
|
var _iterator = _createForOfIteratorHelper(collectionGroups),
|
|
@@ -152,7 +152,7 @@ class MultiAppShareCollectionPlugin extends _server().Plugin {
|
|
|
152
152
|
}
|
|
153
153
|
const traverseSubApps = /*#__PURE__*/function () {
|
|
154
154
|
var _ref3 = _asyncToGenerator(function* (callback, options) {
|
|
155
|
-
if (
|
|
155
|
+
if (_utils().lodash.get(options, 'loadFromDatabase')) {
|
|
156
156
|
var _iterator2 = _createForOfIteratorHelper(yield _this2.app.db.getCollection('applications').repository.find()),
|
|
157
157
|
_step2;
|
|
158
158
|
try {
|
|
@@ -372,7 +372,7 @@ class MultiAppShareCollectionPlugin extends _server().Plugin {
|
|
|
372
372
|
});
|
|
373
373
|
const plugins = [...mainApp.pm.getPlugins().keys()].filter(name => name !== 'multi-app-manager' && name !== 'multi-app-share-collection');
|
|
374
374
|
return {
|
|
375
|
-
database:
|
|
375
|
+
database: _utils().lodash.merge(databaseOptions, {
|
|
376
376
|
dialectOptions: {
|
|
377
377
|
application_name: `nocobase.${appName}`
|
|
378
378
|
}
|
package/package.json
CHANGED
|
@@ -4,13 +4,33 @@
|
|
|
4
4
|
"displayName.zh-CN": "多应用数据共享",
|
|
5
5
|
"description": "multi app share collection",
|
|
6
6
|
"description.zh-CN": "多应用数据共享",
|
|
7
|
-
"version": "0.
|
|
8
|
-
"main": "lib/server/index.js",
|
|
7
|
+
"version": "0.11.1-alpha.1",
|
|
8
|
+
"main": "./lib/server/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"src",
|
|
12
|
+
"README.md",
|
|
13
|
+
"README.zh-CN.md",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"server.js",
|
|
16
|
+
"server.d.ts",
|
|
17
|
+
"client.js",
|
|
18
|
+
"client.d.ts"
|
|
19
|
+
],
|
|
9
20
|
"devDependencies": {
|
|
10
|
-
"@
|
|
11
|
-
"@nocobase/
|
|
12
|
-
"@nocobase/
|
|
13
|
-
"@nocobase/
|
|
21
|
+
"@formily/react": "2.2.26",
|
|
22
|
+
"@nocobase/client": "0.11.1-alpha.1",
|
|
23
|
+
"@nocobase/database": "0.11.1-alpha.1",
|
|
24
|
+
"@nocobase/plugin-collection-manager": "0.11.1-alpha.1",
|
|
25
|
+
"@nocobase/plugin-error-handler": "0.11.1-alpha.1",
|
|
26
|
+
"@nocobase/plugin-multi-app-manager": "0.11.1-alpha.1",
|
|
27
|
+
"@nocobase/plugin-users": "0.11.1-alpha.1",
|
|
28
|
+
"@nocobase/server": "0.11.1-alpha.1",
|
|
29
|
+
"@nocobase/test": "0.11.1-alpha.1",
|
|
30
|
+
"@nocobase/utils": "0.11.1-alpha.1",
|
|
31
|
+
"antd": "^5.6.4",
|
|
32
|
+
"react": "18.x",
|
|
33
|
+
"react-i18next": "^11.15.1"
|
|
14
34
|
},
|
|
15
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "9ed1dba520bc5f3a7cb1255ea8d92ccbefc11bc8"
|
|
16
36
|
}
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
4
|
-
|
|
5
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/server"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/server/index.js');
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useForm } from '@formily/react';
|
|
2
|
+
import { useActionContext, useAPIClient, useRecord } from '@nocobase/client';
|
|
3
|
+
import { tableActionColumnSchema } from '@nocobase/plugin-multi-app-manager/client';
|
|
4
|
+
import { message } from 'antd';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { TableTransfer } from './TableTransfer';
|
|
7
|
+
import { i18nText } from './utils';
|
|
8
|
+
|
|
9
|
+
const useShareCollectionAction = () => {
|
|
10
|
+
const form = useForm();
|
|
11
|
+
const ctx = useActionContext();
|
|
12
|
+
const api = useAPIClient();
|
|
13
|
+
const record = useRecord();
|
|
14
|
+
return {
|
|
15
|
+
async run() {
|
|
16
|
+
console.log(form.values.names);
|
|
17
|
+
await api.request({
|
|
18
|
+
url: `applications/${record.name}/collectionBlacklist`,
|
|
19
|
+
data: form.values.names,
|
|
20
|
+
method: 'post',
|
|
21
|
+
});
|
|
22
|
+
ctx.setVisible(false);
|
|
23
|
+
form.reset();
|
|
24
|
+
message.success('Saved successfully');
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const updateSchema = tableActionColumnSchema.properties.update;
|
|
30
|
+
const deleteSchema = tableActionColumnSchema.properties.delete;
|
|
31
|
+
|
|
32
|
+
delete tableActionColumnSchema.properties.update;
|
|
33
|
+
delete tableActionColumnSchema.properties.delete;
|
|
34
|
+
|
|
35
|
+
tableActionColumnSchema.properties['collection'] = {
|
|
36
|
+
type: 'void',
|
|
37
|
+
title: i18nText('Share collections'),
|
|
38
|
+
'x-component': 'Action.Link',
|
|
39
|
+
'x-component-props': {},
|
|
40
|
+
properties: {
|
|
41
|
+
drawer: {
|
|
42
|
+
type: 'void',
|
|
43
|
+
'x-component': 'Action.Drawer',
|
|
44
|
+
'x-component-props': {
|
|
45
|
+
width: '95vw',
|
|
46
|
+
},
|
|
47
|
+
'x-decorator': 'Form',
|
|
48
|
+
title: i18nText('Share collections'),
|
|
49
|
+
properties: {
|
|
50
|
+
names: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
'x-component': TableTransfer,
|
|
53
|
+
'x-decorator': 'FormItem',
|
|
54
|
+
},
|
|
55
|
+
footer: {
|
|
56
|
+
type: 'void',
|
|
57
|
+
'x-component': 'Action.Drawer.Footer',
|
|
58
|
+
properties: {
|
|
59
|
+
cancel: {
|
|
60
|
+
title: '{{t("Cancel")}}',
|
|
61
|
+
'x-component': 'Action',
|
|
62
|
+
'x-component-props': {
|
|
63
|
+
useAction: '{{ cm.useCancelAction }}',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
submit: {
|
|
67
|
+
title: '{{t("Submit")}}',
|
|
68
|
+
'x-component': 'Action',
|
|
69
|
+
'x-component-props': {
|
|
70
|
+
type: 'primary',
|
|
71
|
+
useAction: useShareCollectionAction,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
tableActionColumnSchema.properties.update = updateSchema;
|
|
82
|
+
tableActionColumnSchema.properties.delete = deleteSchema;
|
|
83
|
+
|
|
84
|
+
export const MultiAppShareCollectionProvider = (props) => {
|
|
85
|
+
return <>{props.children}</>;
|
|
86
|
+
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { css } from '@emotion/css';
|
|
2
1
|
import { connect } from '@formily/react';
|
|
3
|
-
import { useCollectionManager, useRecord, useRequest } from '@nocobase/client';
|
|
4
|
-
import { CollectionsGraph } from '@nocobase/utils/client';
|
|
5
|
-
import { Col, Input,
|
|
6
|
-
import debounce from 'lodash/debounce';
|
|
7
|
-
import uniq from 'lodash/uniq';
|
|
2
|
+
import { css, useCollectionManager, useRecord, useRequest, useToken } from '@nocobase/client';
|
|
3
|
+
import { CollectionsGraph, lodash } from '@nocobase/utils/client';
|
|
4
|
+
import { App, Col, Input, Row, Select, Spin, Table, Tag } from 'antd';
|
|
8
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
9
6
|
import { useTranslation } from 'react-i18next';
|
|
10
7
|
|
|
@@ -63,7 +60,9 @@ const useCollections = () => {
|
|
|
63
60
|
},
|
|
64
61
|
);
|
|
65
62
|
|
|
66
|
-
const res2 = useRequest
|
|
63
|
+
const res2 = useRequest<{
|
|
64
|
+
data: any[];
|
|
65
|
+
}>({
|
|
67
66
|
url: `collections`,
|
|
68
67
|
params: {
|
|
69
68
|
fields: ['name', 'title', 'hidden', 'category.name', 'category.color', 'category.sort'],
|
|
@@ -72,7 +71,9 @@ const useCollections = () => {
|
|
|
72
71
|
},
|
|
73
72
|
});
|
|
74
73
|
|
|
75
|
-
const res3 = useRequest
|
|
74
|
+
const res3 = useRequest<{
|
|
75
|
+
data: any[];
|
|
76
|
+
}>({
|
|
76
77
|
url: `collectionCategories`,
|
|
77
78
|
params: {
|
|
78
79
|
sort: 'sort',
|
|
@@ -116,7 +117,7 @@ const useRemovedDataSource = ({ collections, removed }) => {
|
|
|
116
117
|
}, [collections, removed, filter]);
|
|
117
118
|
const setNameFilter = useMemo(
|
|
118
119
|
() =>
|
|
119
|
-
debounce((name) => {
|
|
120
|
+
lodash.debounce((name) => {
|
|
120
121
|
setFilter({
|
|
121
122
|
...filter,
|
|
122
123
|
name,
|
|
@@ -151,7 +152,7 @@ const useAddedDataSource = ({ collections, removed }) => {
|
|
|
151
152
|
});
|
|
152
153
|
const setNameFilter = useMemo(
|
|
153
154
|
() =>
|
|
154
|
-
debounce((name) => {
|
|
155
|
+
lodash.debounce((name) => {
|
|
155
156
|
setFilter({
|
|
156
157
|
...filter,
|
|
157
158
|
name,
|
|
@@ -180,6 +181,8 @@ export const TableTransfer = connect((props) => {
|
|
|
180
181
|
const addedDataSource = useAddedDataSource({ collections, removed });
|
|
181
182
|
const removedDataSource = useRemovedDataSource({ collections, removed });
|
|
182
183
|
const { t } = useTranslation('multi-app-share-collection');
|
|
184
|
+
const { modal } = App.useApp();
|
|
185
|
+
const { token } = useToken();
|
|
183
186
|
const columns = useMemo(
|
|
184
187
|
() => [
|
|
185
188
|
{
|
|
@@ -193,7 +196,12 @@ export const TableTransfer = connect((props) => {
|
|
|
193
196
|
{
|
|
194
197
|
title: t('Collection category'),
|
|
195
198
|
dataIndex: 'category',
|
|
196
|
-
render: (categories) =>
|
|
199
|
+
render: (categories) =>
|
|
200
|
+
categories.map((category) => (
|
|
201
|
+
<Tag key={category.name} color={category.color}>
|
|
202
|
+
{category.name}
|
|
203
|
+
</Tag>
|
|
204
|
+
)),
|
|
197
205
|
},
|
|
198
206
|
],
|
|
199
207
|
[],
|
|
@@ -222,10 +230,10 @@ export const TableTransfer = connect((props) => {
|
|
|
222
230
|
margin-bottom: 8px;
|
|
223
231
|
`}
|
|
224
232
|
>
|
|
225
|
-
<strong style={{ fontSize:
|
|
233
|
+
<strong style={{ fontSize: token.fontSizeLG, color: token.colorText }}>{t('Unshared collections')}</strong>
|
|
226
234
|
<Input.Group compact style={{ width: 360 }}>
|
|
227
235
|
<Select
|
|
228
|
-
|
|
236
|
+
popupMatchSelectWidth={false}
|
|
229
237
|
onChange={(value) => {
|
|
230
238
|
removedDataSource.setCategoryFilter(value);
|
|
231
239
|
}}
|
|
@@ -263,7 +271,7 @@ export const TableTransfer = connect((props) => {
|
|
|
263
271
|
// dataSource={collections.filter((collection) => removed.includes(collection.name))}
|
|
264
272
|
dataSource={removedDataSource.dataSource}
|
|
265
273
|
scroll={{ y: 'calc(100vh - 260px)' }}
|
|
266
|
-
onRow={({ name, disabled }) => ({
|
|
274
|
+
onRow={({ name, disabled }: any) => ({
|
|
267
275
|
onClick: () => {
|
|
268
276
|
if (disabled) return;
|
|
269
277
|
const adding = findAddable(name);
|
|
@@ -275,7 +283,7 @@ export const TableTransfer = connect((props) => {
|
|
|
275
283
|
if (adding.length === 1) {
|
|
276
284
|
return change();
|
|
277
285
|
}
|
|
278
|
-
|
|
286
|
+
modal.confirm({
|
|
279
287
|
title: t('Are you sure to add the following collections?'),
|
|
280
288
|
width: '60%',
|
|
281
289
|
content: (
|
|
@@ -307,10 +315,10 @@ export const TableTransfer = connect((props) => {
|
|
|
307
315
|
margin-bottom: 8px;
|
|
308
316
|
`}
|
|
309
317
|
>
|
|
310
|
-
<strong style={{ fontSize:
|
|
318
|
+
<strong style={{ fontSize: token.fontSizeLG, color: token.colorText }}>{t('Shared collections')}</strong>
|
|
311
319
|
<Input.Group compact style={{ width: 360 }}>
|
|
312
320
|
<Select
|
|
313
|
-
|
|
321
|
+
popupMatchSelectWidth={false}
|
|
314
322
|
onChange={(value) => {
|
|
315
323
|
addedDataSource.setCategoryFilter(value);
|
|
316
324
|
}}
|
|
@@ -336,7 +344,7 @@ export const TableTransfer = connect((props) => {
|
|
|
336
344
|
type: 'checkbox',
|
|
337
345
|
selectedRowKeys: selectedRowKeys2,
|
|
338
346
|
onChange(selectedRowKeys) {
|
|
339
|
-
const values = uniq(removed.concat(selectedRowKeys));
|
|
347
|
+
const values = lodash.uniq(removed.concat(selectedRowKeys));
|
|
340
348
|
setSelected(values);
|
|
341
349
|
onChange(values);
|
|
342
350
|
setSelectedRowKeys2([]);
|
|
@@ -353,14 +361,14 @@ export const TableTransfer = connect((props) => {
|
|
|
353
361
|
const removing = findRemovable(name);
|
|
354
362
|
const change = () => {
|
|
355
363
|
removed.push(...removing);
|
|
356
|
-
const values = uniq([...removed]);
|
|
364
|
+
const values = lodash.uniq([...removed]);
|
|
357
365
|
setSelected(values);
|
|
358
366
|
onChange(values);
|
|
359
367
|
};
|
|
360
368
|
if (removing.length === 1) {
|
|
361
369
|
return change();
|
|
362
370
|
}
|
|
363
|
-
|
|
371
|
+
modal.confirm({
|
|
364
372
|
title: t('Are you sure to remove the following collections?'),
|
|
365
373
|
width: '60%',
|
|
366
374
|
content: (
|
package/src/client/index.tsx
CHANGED
|
@@ -1,86 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { tableActionColumnSchema } from '@nocobase/plugin-multi-app-manager/client';
|
|
4
|
-
import { message } from 'antd';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { TableTransfer } from './TableTransfer';
|
|
7
|
-
import { i18nText } from './utils';
|
|
1
|
+
import { Plugin } from '@nocobase/client';
|
|
2
|
+
import { MultiAppShareCollectionProvider } from './MultiAppShareCollectionProvider';
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
async run() {
|
|
16
|
-
console.log(form.values.names);
|
|
17
|
-
await api.request({
|
|
18
|
-
url: `applications/${record.name}/collectionBlacklist`,
|
|
19
|
-
data: form.values.names,
|
|
20
|
-
method: 'post',
|
|
21
|
-
});
|
|
22
|
-
ctx.setVisible(false);
|
|
23
|
-
form.reset();
|
|
24
|
-
message.success('Saved successfully');
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|
|
4
|
+
export class MultiAppShareCollectionPlugin extends Plugin {
|
|
5
|
+
async load() {
|
|
6
|
+
this.app.use(MultiAppShareCollectionProvider);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
28
9
|
|
|
29
|
-
|
|
30
|
-
const deleteSchema = tableActionColumnSchema.properties.delete;
|
|
31
|
-
|
|
32
|
-
delete tableActionColumnSchema.properties.update;
|
|
33
|
-
delete tableActionColumnSchema.properties.delete;
|
|
34
|
-
|
|
35
|
-
tableActionColumnSchema.properties['collection'] = {
|
|
36
|
-
type: 'void',
|
|
37
|
-
title: i18nText('Share collections'),
|
|
38
|
-
'x-component': 'Action.Link',
|
|
39
|
-
'x-component-props': {},
|
|
40
|
-
properties: {
|
|
41
|
-
drawer: {
|
|
42
|
-
type: 'void',
|
|
43
|
-
'x-component': 'Action.Drawer',
|
|
44
|
-
'x-component-props': {
|
|
45
|
-
width: '95vw',
|
|
46
|
-
},
|
|
47
|
-
'x-decorator': 'Form',
|
|
48
|
-
title: i18nText('Share collections'),
|
|
49
|
-
properties: {
|
|
50
|
-
names: {
|
|
51
|
-
type: 'array',
|
|
52
|
-
'x-component': TableTransfer,
|
|
53
|
-
'x-decorator': 'FormItem',
|
|
54
|
-
},
|
|
55
|
-
footer: {
|
|
56
|
-
type: 'void',
|
|
57
|
-
'x-component': 'Action.Drawer.Footer',
|
|
58
|
-
properties: {
|
|
59
|
-
cancel: {
|
|
60
|
-
title: '{{t("Cancel")}}',
|
|
61
|
-
'x-component': 'Action',
|
|
62
|
-
'x-component-props': {
|
|
63
|
-
useAction: '{{ cm.useCancelAction }}',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
submit: {
|
|
67
|
-
title: '{{t("Submit")}}',
|
|
68
|
-
'x-component': 'Action',
|
|
69
|
-
'x-component-props': {
|
|
70
|
-
type: 'primary',
|
|
71
|
-
useAction: useShareCollectionAction,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
tableActionColumnSchema.properties.update = updateSchema;
|
|
82
|
-
tableActionColumnSchema.properties.delete = deleteSchema;
|
|
83
|
-
|
|
84
|
-
export default (props) => {
|
|
85
|
-
return <>{props.children}</>;
|
|
86
|
-
};
|
|
10
|
+
export default MultiAppShareCollectionPlugin;
|
package/src/server/plugin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PluginMultiAppManager from '@nocobase/plugin-multi-app-manager';
|
|
2
2
|
import { Application, Plugin } from '@nocobase/server';
|
|
3
|
-
import lodash from '
|
|
3
|
+
import { lodash } from '@nocobase/utils';
|
|
4
4
|
import { resolve } from 'path';
|
|
5
5
|
|
|
6
6
|
const subAppFilteredPlugins = ['multi-app-share-collection', 'multi-app-manager'];
|
|
@@ -21,6 +21,7 @@ class SubAppPlugin extends Plugin {
|
|
|
21
21
|
'sequence-field',
|
|
22
22
|
'snapshot-field',
|
|
23
23
|
'verification',
|
|
24
|
+
'localization-management',
|
|
24
25
|
];
|
|
25
26
|
|
|
26
27
|
const collectionGroups = mainApp.db.collectionGroupManager.getGroups();
|