@nocobase/plugin-multi-app-share-collection 0.11.1-alpha.5 → 0.12.0-alpha.2
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 -1
- package/dist/client/index.js +510 -0
- package/{lib → dist}/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/locale/es-ES.js +16 -0
- package/dist/locale/pt-BR.js +16 -0
- package/dist/locale/zh-CN.js +16 -0
- package/dist/server/collections/applications.js +21 -0
- package/dist/server/collections/collections.js +21 -0
- package/dist/server/index.js +11 -0
- package/{src/server/migrations/20230319111111-update-apps-collections.ts → dist/server/migrations/20230319111111-update-apps-collections.js} +26 -33
- package/dist/server/plugin.js +278 -0
- package/package.json +16 -25
- package/server.d.ts +2 -3
- package/server.js +1 -1
- package/lib/client/MultiAppShareCollectionProvider.js +0 -122
- package/lib/client/TableTransfer.js +0 -487
- package/lib/client/index.js +0 -27
- package/lib/client/utils.js +0 -25
- package/lib/index.js +0 -13
- package/lib/locale/es-ES.js +0 -19
- package/lib/locale/pt-BR.js +0 -19
- package/lib/locale/zh-CN.js +0 -19
- package/lib/server/collections/applications.js +0 -27
- package/lib/server/collections/collections.js +0 -27
- package/lib/server/index.js +0 -13
- package/lib/server/migrations/20230319111111-update-apps-collections.js +0 -110
- package/lib/server/plugin.js +0 -408
- package/src/client/MultiAppShareCollectionProvider.tsx +0 -86
- package/src/client/TableTransfer.tsx +0 -398
- package/src/client/index.tsx +0 -10
- package/src/client/utils.tsx +0 -11
- package/src/index.ts +0 -1
- package/src/locale/es-ES.ts +0 -12
- package/src/locale/pt-BR.ts +0 -12
- package/src/locale/zh-CN.ts +0 -12
- package/src/server/__tests__/collection-sync.test.ts +0 -514
- package/src/server/__tests__/index.ts +0 -25
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/collections/applications.ts +0 -17
- package/src/server/collections/collections.ts +0 -17
- package/src/server/index.ts +0 -1
- package/src/server/plugin.ts +0 -332
- /package/{lib → dist}/client/MultiAppShareCollectionProvider.d.ts +0 -0
- /package/{lib → dist}/client/TableTransfer.d.ts +0 -0
- /package/{lib → dist}/client/index.d.ts +0 -0
- /package/{lib → dist}/client/utils.d.ts +0 -0
- /package/{lib → dist}/locale/es-ES.d.ts +0 -0
- /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
- /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
- /package/{lib → dist}/server/collections/applications.d.ts +0 -0
- /package/{lib → dist}/server/collections/collections.d.ts +0 -0
- /package/{lib → dist}/server/index.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230319111111-update-apps-collections.d.ts +0 -0
- /package/{lib → dist}/server/plugin.d.ts +0 -0
|
@@ -1,487 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.TableTransfer = 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/utils/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 = _interopRequireWildcard(require("react"));
|
|
37
|
-
_react2 = function _react2() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
|
-
function _reactI18next() {
|
|
43
|
-
const data = require("react-i18next");
|
|
44
|
-
_reactI18next = function _reactI18next() {
|
|
45
|
-
return data;
|
|
46
|
-
};
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
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); }
|
|
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; }
|
|
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; }
|
|
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; }
|
|
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; }
|
|
54
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
55
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
56
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
57
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
58
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
59
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
60
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
61
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
62
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
63
|
-
const excludeCollections = ['users', 'roles', 'applications'];
|
|
64
|
-
const useCollectionsGraph = ({
|
|
65
|
-
removed = []
|
|
66
|
-
}) => {
|
|
67
|
-
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
68
|
-
collections = _useCollectionManager.collections;
|
|
69
|
-
const findAddable = (0, _react2().useCallback)(name => {
|
|
70
|
-
return _client2().CollectionsGraph.connectedNodes({
|
|
71
|
-
collections,
|
|
72
|
-
nodes: [name],
|
|
73
|
-
excludes: excludeCollections
|
|
74
|
-
}).filter(name => removed.includes(name));
|
|
75
|
-
}, [removed]);
|
|
76
|
-
const findRemovable = (0, _react2().useCallback)(name => {
|
|
77
|
-
return _client2().CollectionsGraph.connectedNodes({
|
|
78
|
-
collections,
|
|
79
|
-
nodes: [name],
|
|
80
|
-
excludes: excludeCollections,
|
|
81
|
-
direction: 'reverse'
|
|
82
|
-
}).filter(name => !removed.includes(name));
|
|
83
|
-
}, [removed]);
|
|
84
|
-
return {
|
|
85
|
-
findAddable,
|
|
86
|
-
findRemovable
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const useCollections = () => {
|
|
90
|
-
var _res2$data, _res3$data;
|
|
91
|
-
const record = (0, _client().useRecord)();
|
|
92
|
-
const _useState = (0, _react2().useState)([]),
|
|
93
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
94
|
-
selected = _useState2[0],
|
|
95
|
-
setSelected = _useState2[1];
|
|
96
|
-
const res1 = (0, _client().useRequest)({
|
|
97
|
-
url: `applications/${record.name}/collectionBlacklist:list`,
|
|
98
|
-
params: {
|
|
99
|
-
paginate: false,
|
|
100
|
-
params: {
|
|
101
|
-
fields: ['name']
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
onSuccess(data) {
|
|
106
|
-
var _data$data;
|
|
107
|
-
setSelected((_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.map(data => data.name));
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const res2 = (0, _client().useRequest)({
|
|
111
|
-
url: `collections`,
|
|
112
|
-
params: {
|
|
113
|
-
fields: ['name', 'title', 'hidden', 'category.name', 'category.color', 'category.sort'],
|
|
114
|
-
sort: 'sort',
|
|
115
|
-
paginate: false
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
const res3 = (0, _client().useRequest)({
|
|
119
|
-
url: `collectionCategories`,
|
|
120
|
-
params: {
|
|
121
|
-
sort: 'sort',
|
|
122
|
-
paginate: false
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return {
|
|
126
|
-
loading: res1.loading || res2.loading || res3.loading,
|
|
127
|
-
collections: (((_res2$data = res2.data) === null || _res2$data === void 0 ? void 0 : _res2$data.data) || []).filter(item => !item.hidden && !excludeCollections.includes(item.name)),
|
|
128
|
-
removed: selected,
|
|
129
|
-
setSelected,
|
|
130
|
-
categories: (((_res3$data = res3.data) === null || _res3$data === void 0 ? void 0 : _res3$data.data) || []).map(cat => ({
|
|
131
|
-
label: cat.name,
|
|
132
|
-
value: cat.name
|
|
133
|
-
}))
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
const includes = (text, s) => {
|
|
137
|
-
const values = Array.isArray(s) ? s : [s];
|
|
138
|
-
var _iterator = _createForOfIteratorHelper(values),
|
|
139
|
-
_step;
|
|
140
|
-
try {
|
|
141
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
142
|
-
const val = _step.value;
|
|
143
|
-
if (text.toLowerCase().includes(val)) {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
} catch (err) {
|
|
148
|
-
_iterator.e(err);
|
|
149
|
-
} finally {
|
|
150
|
-
_iterator.f();
|
|
151
|
-
}
|
|
152
|
-
return false;
|
|
153
|
-
};
|
|
154
|
-
const useRemovedDataSource = ({
|
|
155
|
-
collections,
|
|
156
|
-
removed
|
|
157
|
-
}) => {
|
|
158
|
-
const _useState3 = (0, _react2().useState)({
|
|
159
|
-
name: '',
|
|
160
|
-
category: []
|
|
161
|
-
}),
|
|
162
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
163
|
-
filter = _useState4[0],
|
|
164
|
-
setFilter = _useState4[1];
|
|
165
|
-
const dataSource = (0, _react2().useMemo)(() => {
|
|
166
|
-
return collections.filter(collection => {
|
|
167
|
-
const name = collection.name,
|
|
168
|
-
title = collection.title,
|
|
169
|
-
_collection$category = collection.category,
|
|
170
|
-
category = _collection$category === void 0 ? [] : _collection$category;
|
|
171
|
-
const results = [removed.includes(collection.name)];
|
|
172
|
-
if (filter.name) {
|
|
173
|
-
results.push(includes(name, filter.name) || includes(title, filter.name));
|
|
174
|
-
}
|
|
175
|
-
if (filter.category.length > 0) {
|
|
176
|
-
results.push(category.some(item => includes(item.name, filter.category)));
|
|
177
|
-
}
|
|
178
|
-
return !results.includes(false);
|
|
179
|
-
});
|
|
180
|
-
}, [collections, removed, filter]);
|
|
181
|
-
const setNameFilter = (0, _react2().useMemo)(() => _client2().lodash.debounce(name => {
|
|
182
|
-
setFilter(_objectSpread(_objectSpread({}, filter), {}, {
|
|
183
|
-
name
|
|
184
|
-
}));
|
|
185
|
-
}, 300), []);
|
|
186
|
-
return {
|
|
187
|
-
dataSource,
|
|
188
|
-
setNameFilter,
|
|
189
|
-
setCategoryFilter: category => {
|
|
190
|
-
setFilter(_objectSpread(_objectSpread({}, filter), {}, {
|
|
191
|
-
category
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
const useAddedDataSource = ({
|
|
197
|
-
collections,
|
|
198
|
-
removed
|
|
199
|
-
}) => {
|
|
200
|
-
const _useState5 = (0, _react2().useState)({
|
|
201
|
-
name: '',
|
|
202
|
-
category: []
|
|
203
|
-
}),
|
|
204
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
205
|
-
filter = _useState6[0],
|
|
206
|
-
setFilter = _useState6[1];
|
|
207
|
-
const dataSource = collections.filter(collection => {
|
|
208
|
-
const name = collection.name,
|
|
209
|
-
title = collection.title,
|
|
210
|
-
_collection$category2 = collection.category,
|
|
211
|
-
category = _collection$category2 === void 0 ? [] : _collection$category2;
|
|
212
|
-
const results = [!removed.includes(collection.name)];
|
|
213
|
-
if (filter.name) {
|
|
214
|
-
results.push(includes(name, filter.name) || includes(title, filter.name));
|
|
215
|
-
}
|
|
216
|
-
if (filter.category.length > 0) {
|
|
217
|
-
results.push(category.some(item => includes(item.name, filter.category)));
|
|
218
|
-
}
|
|
219
|
-
return !results.includes(false);
|
|
220
|
-
});
|
|
221
|
-
const setNameFilter = (0, _react2().useMemo)(() => _client2().lodash.debounce(name => {
|
|
222
|
-
setFilter(_objectSpread(_objectSpread({}, filter), {}, {
|
|
223
|
-
name
|
|
224
|
-
}));
|
|
225
|
-
}, 300), []);
|
|
226
|
-
return {
|
|
227
|
-
dataSource,
|
|
228
|
-
setNameFilter,
|
|
229
|
-
setCategoryFilter: category => {
|
|
230
|
-
setFilter(_objectSpread(_objectSpread({}, filter), {}, {
|
|
231
|
-
category
|
|
232
|
-
}));
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
const TableTransfer = (0, _react().connect)(props => {
|
|
237
|
-
const onChange = props.onChange;
|
|
238
|
-
const _useCollections = useCollections(),
|
|
239
|
-
loading = _useCollections.loading,
|
|
240
|
-
collections = _useCollections.collections,
|
|
241
|
-
categories = _useCollections.categories,
|
|
242
|
-
removed = _useCollections.removed,
|
|
243
|
-
setSelected = _useCollections.setSelected;
|
|
244
|
-
const _useState7 = (0, _react2().useState)([]),
|
|
245
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
246
|
-
selectedRowKeys1 = _useState8[0],
|
|
247
|
-
setSelectedRowKeys1 = _useState8[1];
|
|
248
|
-
const _useState9 = (0, _react2().useState)([]),
|
|
249
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
250
|
-
selectedRowKeys2 = _useState10[0],
|
|
251
|
-
setSelectedRowKeys2 = _useState10[1];
|
|
252
|
-
const _useCollectionsGraph = useCollectionsGraph({
|
|
253
|
-
removed
|
|
254
|
-
}),
|
|
255
|
-
findAddable = _useCollectionsGraph.findAddable,
|
|
256
|
-
findRemovable = _useCollectionsGraph.findRemovable;
|
|
257
|
-
const addedDataSource = useAddedDataSource({
|
|
258
|
-
collections,
|
|
259
|
-
removed
|
|
260
|
-
});
|
|
261
|
-
const removedDataSource = useRemovedDataSource({
|
|
262
|
-
collections,
|
|
263
|
-
removed
|
|
264
|
-
});
|
|
265
|
-
const _useTranslation = (0, _reactI18next().useTranslation)('multi-app-share-collection'),
|
|
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;
|
|
271
|
-
const columns = (0, _react2().useMemo)(() => [{
|
|
272
|
-
title: t('Collection display name'),
|
|
273
|
-
dataIndex: 'title'
|
|
274
|
-
}, {
|
|
275
|
-
title: t('Collection name'),
|
|
276
|
-
dataIndex: 'name'
|
|
277
|
-
}, {
|
|
278
|
-
title: t('Collection category'),
|
|
279
|
-
dataIndex: 'category',
|
|
280
|
-
render: categories => categories.map(category => _react2().default.createElement(_antd().Tag, {
|
|
281
|
-
key: category.name,
|
|
282
|
-
color: category.color
|
|
283
|
-
}, category.name))
|
|
284
|
-
}], []);
|
|
285
|
-
if (loading) {
|
|
286
|
-
return _react2().default.createElement(_antd().Spin, null);
|
|
287
|
-
}
|
|
288
|
-
return _react2().default.createElement("div", null, _react2().default.createElement(_antd().Row, {
|
|
289
|
-
gutter: 24,
|
|
290
|
-
className: (0, _client().css)`
|
|
291
|
-
.ant-table-tbody > tr.ant-table-row:hover > td {
|
|
292
|
-
background: #e6f7ff;
|
|
293
|
-
cursor: pointer;
|
|
294
|
-
}
|
|
295
|
-
`
|
|
296
|
-
}, _react2().default.createElement(_antd().Col, {
|
|
297
|
-
span: 12
|
|
298
|
-
}, _react2().default.createElement("div", {
|
|
299
|
-
className: (0, _client().css)`
|
|
300
|
-
display: flex;
|
|
301
|
-
justify-content: space-between;
|
|
302
|
-
align-items: center;
|
|
303
|
-
width: 100%;
|
|
304
|
-
margin-bottom: 8px;
|
|
305
|
-
`
|
|
306
|
-
}, _react2().default.createElement("strong", {
|
|
307
|
-
style: {
|
|
308
|
-
fontSize: token.fontSizeLG,
|
|
309
|
-
color: token.colorText
|
|
310
|
-
}
|
|
311
|
-
}, t('Unshared collections')), _react2().default.createElement(_antd().Input.Group, {
|
|
312
|
-
compact: true,
|
|
313
|
-
style: {
|
|
314
|
-
width: 360
|
|
315
|
-
}
|
|
316
|
-
}, _react2().default.createElement(_antd().Select, {
|
|
317
|
-
popupMatchSelectWidth: false,
|
|
318
|
-
onChange: value => {
|
|
319
|
-
removedDataSource.setCategoryFilter(value);
|
|
320
|
-
},
|
|
321
|
-
mode: 'multiple',
|
|
322
|
-
style: {
|
|
323
|
-
width: '35%'
|
|
324
|
-
},
|
|
325
|
-
size: 'middle',
|
|
326
|
-
placeholder: t('All categories'),
|
|
327
|
-
options: categories,
|
|
328
|
-
allowClear: true
|
|
329
|
-
}), _react2().default.createElement(_antd().Input, {
|
|
330
|
-
onChange: e => removedDataSource.setNameFilter(e.target.value),
|
|
331
|
-
style: {
|
|
332
|
-
width: '65%'
|
|
333
|
-
},
|
|
334
|
-
placeholder: t('Enter name or title...'),
|
|
335
|
-
allowClear: true
|
|
336
|
-
}))), _react2().default.createElement(_antd().Table, {
|
|
337
|
-
bordered: true,
|
|
338
|
-
rowKey: 'name',
|
|
339
|
-
rowSelection: {
|
|
340
|
-
type: 'checkbox',
|
|
341
|
-
selectedRowKeys: selectedRowKeys1,
|
|
342
|
-
onChange(selectedRowKeys) {
|
|
343
|
-
const values = removed.filter(s => !selectedRowKeys.includes(s));
|
|
344
|
-
setSelected(values);
|
|
345
|
-
onChange(values);
|
|
346
|
-
setSelectedRowKeys1([]);
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
pagination: false,
|
|
350
|
-
size: 'small',
|
|
351
|
-
columns: columns,
|
|
352
|
-
// dataSource={collections.filter((collection) => removed.includes(collection.name))}
|
|
353
|
-
dataSource: removedDataSource.dataSource,
|
|
354
|
-
scroll: {
|
|
355
|
-
y: 'calc(100vh - 260px)'
|
|
356
|
-
},
|
|
357
|
-
onRow: ({
|
|
358
|
-
name,
|
|
359
|
-
disabled
|
|
360
|
-
}) => ({
|
|
361
|
-
onClick: () => {
|
|
362
|
-
if (disabled) return;
|
|
363
|
-
const adding = findAddable(name);
|
|
364
|
-
const change = () => {
|
|
365
|
-
const values = removed.filter(s => !adding.includes(s));
|
|
366
|
-
setSelected(values);
|
|
367
|
-
onChange(values);
|
|
368
|
-
};
|
|
369
|
-
if (adding.length === 1) {
|
|
370
|
-
return change();
|
|
371
|
-
}
|
|
372
|
-
modal.confirm({
|
|
373
|
-
title: t('Are you sure to add the following collections?'),
|
|
374
|
-
width: '60%',
|
|
375
|
-
content: _react2().default.createElement("div", null, _react2().default.createElement(_antd().Table, {
|
|
376
|
-
size: 'small',
|
|
377
|
-
columns: columns,
|
|
378
|
-
dataSource: collections.filter(collection => adding.includes(collection.name)),
|
|
379
|
-
pagination: false,
|
|
380
|
-
scroll: {
|
|
381
|
-
y: '60vh'
|
|
382
|
-
}
|
|
383
|
-
})),
|
|
384
|
-
onOk() {
|
|
385
|
-
change();
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
})
|
|
390
|
-
})), _react2().default.createElement(_antd().Col, {
|
|
391
|
-
span: 12
|
|
392
|
-
}, _react2().default.createElement("div", {
|
|
393
|
-
className: (0, _client().css)`
|
|
394
|
-
display: flex;
|
|
395
|
-
justify-content: space-between;
|
|
396
|
-
align-items: center;
|
|
397
|
-
width: 100%;
|
|
398
|
-
margin-bottom: 8px;
|
|
399
|
-
`
|
|
400
|
-
}, _react2().default.createElement("strong", {
|
|
401
|
-
style: {
|
|
402
|
-
fontSize: token.fontSizeLG,
|
|
403
|
-
color: token.colorText
|
|
404
|
-
}
|
|
405
|
-
}, t('Shared collections')), _react2().default.createElement(_antd().Input.Group, {
|
|
406
|
-
compact: true,
|
|
407
|
-
style: {
|
|
408
|
-
width: 360
|
|
409
|
-
}
|
|
410
|
-
}, _react2().default.createElement(_antd().Select, {
|
|
411
|
-
popupMatchSelectWidth: false,
|
|
412
|
-
onChange: value => {
|
|
413
|
-
addedDataSource.setCategoryFilter(value);
|
|
414
|
-
},
|
|
415
|
-
mode: 'multiple',
|
|
416
|
-
style: {
|
|
417
|
-
width: '35%'
|
|
418
|
-
},
|
|
419
|
-
size: 'middle',
|
|
420
|
-
placeholder: t('All categories'),
|
|
421
|
-
options: categories,
|
|
422
|
-
allowClear: true
|
|
423
|
-
}), _react2().default.createElement(_antd().Input, {
|
|
424
|
-
onChange: e => addedDataSource.setNameFilter(e.target.value),
|
|
425
|
-
style: {
|
|
426
|
-
width: '65%'
|
|
427
|
-
},
|
|
428
|
-
placeholder: t('Enter name or title...'),
|
|
429
|
-
allowClear: true
|
|
430
|
-
}))), _react2().default.createElement(_antd().Table, {
|
|
431
|
-
bordered: true,
|
|
432
|
-
rowKey: 'name',
|
|
433
|
-
rowSelection: {
|
|
434
|
-
type: 'checkbox',
|
|
435
|
-
selectedRowKeys: selectedRowKeys2,
|
|
436
|
-
onChange(selectedRowKeys) {
|
|
437
|
-
const values = _client2().lodash.uniq(removed.concat(selectedRowKeys));
|
|
438
|
-
setSelected(values);
|
|
439
|
-
onChange(values);
|
|
440
|
-
setSelectedRowKeys2([]);
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
pagination: false,
|
|
444
|
-
size: 'small',
|
|
445
|
-
columns: columns,
|
|
446
|
-
dataSource: addedDataSource.dataSource,
|
|
447
|
-
// dataSource={collections.filter((collection) => !selected.includes(collection.name))}
|
|
448
|
-
scroll: {
|
|
449
|
-
y: 'calc(100vh - 260px)'
|
|
450
|
-
},
|
|
451
|
-
onRow: ({
|
|
452
|
-
name
|
|
453
|
-
}) => ({
|
|
454
|
-
onClick: () => {
|
|
455
|
-
const removing = findRemovable(name);
|
|
456
|
-
const change = () => {
|
|
457
|
-
removed.push(...removing);
|
|
458
|
-
const values = _client2().lodash.uniq([...removed]);
|
|
459
|
-
setSelected(values);
|
|
460
|
-
onChange(values);
|
|
461
|
-
};
|
|
462
|
-
if (removing.length === 1) {
|
|
463
|
-
return change();
|
|
464
|
-
}
|
|
465
|
-
modal.confirm({
|
|
466
|
-
title: t('Are you sure to remove the following collections?'),
|
|
467
|
-
width: '60%',
|
|
468
|
-
content: _react2().default.createElement("div", null, _react2().default.createElement(_antd().Table, {
|
|
469
|
-
size: 'small',
|
|
470
|
-
columns: columns,
|
|
471
|
-
dataSource: collections.filter(collection => removing.includes(collection.name)),
|
|
472
|
-
pagination: false,
|
|
473
|
-
scroll: {
|
|
474
|
-
y: '60vh'
|
|
475
|
-
}
|
|
476
|
-
})),
|
|
477
|
-
onOk() {
|
|
478
|
-
change();
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
})
|
|
483
|
-
}))));
|
|
484
|
-
});
|
|
485
|
-
exports.TableTransfer = TableTransfer;
|
|
486
|
-
var _default = TableTransfer;
|
|
487
|
-
exports.default = _default;
|
package/lib/client/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.MultiAppShareCollectionPlugin = void 0;
|
|
7
|
-
function _client() {
|
|
8
|
-
const data = require("@nocobase/client");
|
|
9
|
-
_client = function _client() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _MultiAppShareCollectionProvider = require("./MultiAppShareCollectionProvider");
|
|
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); } }
|
|
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); }); }; }
|
|
17
|
-
class MultiAppShareCollectionPlugin extends _client().Plugin {
|
|
18
|
-
load() {
|
|
19
|
-
var _this = this;
|
|
20
|
-
return _asyncToGenerator(function* () {
|
|
21
|
-
_this.app.use(_MultiAppShareCollectionProvider.MultiAppShareCollectionProvider);
|
|
22
|
-
})();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.MultiAppShareCollectionPlugin = MultiAppShareCollectionPlugin;
|
|
26
|
-
var _default = MultiAppShareCollectionPlugin;
|
|
27
|
-
exports.default = _default;
|
package/lib/client/utils.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePluginUtils = exports.i18nText = void 0;
|
|
7
|
-
function _reactI18next() {
|
|
8
|
-
const data = require("react-i18next");
|
|
9
|
-
_reactI18next = function _reactI18next() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
const usePluginUtils = () => {
|
|
15
|
-
const _useTranslation = (0, _reactI18next().useTranslation)('multi-app-share-collection'),
|
|
16
|
-
t = _useTranslation.t;
|
|
17
|
-
return {
|
|
18
|
-
t
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
exports.usePluginUtils = usePluginUtils;
|
|
22
|
-
const i18nText = text => {
|
|
23
|
-
return `{{t("${text}", { ns: 'multi-app-share-collection' })}}`;
|
|
24
|
-
};
|
|
25
|
-
exports.i18nText = i18nText;
|
package/lib/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _server.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _server = _interopRequireDefault(require("./server"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/locale/es-ES.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = {
|
|
8
|
-
'Share collections': 'Tablas compartidas',
|
|
9
|
-
'Unshared collections': 'Tablas no compartidas',
|
|
10
|
-
'Shared collections': 'Tablas compartidas',
|
|
11
|
-
'All categories': 'Todas las categorías',
|
|
12
|
-
'Enter name or title...': 'Introducir nombre o título...',
|
|
13
|
-
'Are you sure to add the following collections?': '¿Está seguro de que desea añadir las siguientes tablas?',
|
|
14
|
-
'Are you sure to remove the following collections?': '¿Está seguro de que desea eliminar las siguientes tablas?',
|
|
15
|
-
'Collection display name': 'Mostrar nombre de la tabla',
|
|
16
|
-
'Collection name': 'Nombre de la tabla',
|
|
17
|
-
'Collection category': 'Categoría de tabla'
|
|
18
|
-
};
|
|
19
|
-
exports.default = _default;
|
package/lib/locale/pt-BR.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = {
|
|
8
|
-
'Share collections': 'Compartilhar tabelas',
|
|
9
|
-
'Unshared collections': 'Tabelas não compartilhadas',
|
|
10
|
-
'Shared collections': 'Tabelas compartilhadas',
|
|
11
|
-
'All categories': 'Todas as categorias',
|
|
12
|
-
'Enter name or title...': 'Digite o nome ou título...',
|
|
13
|
-
'Are you sure to add the following collections?': 'Tem certeza de que deseja adicionar as seguintes tabelas?',
|
|
14
|
-
'Are you sure to remove the following collections?': 'Tem certeza de que deseja remover as seguintes tabelas?',
|
|
15
|
-
'Collection display name': 'Nome de exibição da tabela',
|
|
16
|
-
'Collection name': 'Nome da tabela',
|
|
17
|
-
'Collection category': 'Categoria da tabela'
|
|
18
|
-
};
|
|
19
|
-
exports.default = _default;
|
package/lib/locale/zh-CN.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = {
|
|
8
|
-
'Share collections': '共享数据表',
|
|
9
|
-
'Unshared collections': '未共享的数据表',
|
|
10
|
-
'Shared collections': '已共享的数据表',
|
|
11
|
-
'All categories': '所有分类',
|
|
12
|
-
'Enter name or title...': '输入数据表标题或标识',
|
|
13
|
-
'Are you sure to add the following collections?': '确定添加以下数据表?',
|
|
14
|
-
'Are you sure to remove the following collections?': '确定移除以下数据表?',
|
|
15
|
-
'Collection display name': '标题',
|
|
16
|
-
'Collection name': '标识',
|
|
17
|
-
'Collection category': '分类'
|
|
18
|
-
};
|
|
19
|
-
exports.default = _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
function _database() {
|
|
8
|
-
const data = require("@nocobase/database");
|
|
9
|
-
_database = function _database() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _default = (0, _database().extendCollection)({
|
|
15
|
-
name: 'applications',
|
|
16
|
-
fields: [{
|
|
17
|
-
type: 'belongsToMany',
|
|
18
|
-
name: 'collectionBlacklist',
|
|
19
|
-
through: 'appCollectionBlacklist',
|
|
20
|
-
target: 'collections',
|
|
21
|
-
targetKey: 'name',
|
|
22
|
-
otherKey: 'collectionName',
|
|
23
|
-
sourceKey: 'name',
|
|
24
|
-
foreignKey: 'applicationName'
|
|
25
|
-
}]
|
|
26
|
-
});
|
|
27
|
-
exports.default = _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
function _database() {
|
|
8
|
-
const data = require("@nocobase/database");
|
|
9
|
-
_database = function _database() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _default = (0, _database().extendCollection)({
|
|
15
|
-
name: 'collections',
|
|
16
|
-
fields: [{
|
|
17
|
-
type: 'belongsToMany',
|
|
18
|
-
name: 'collectionBlacklist',
|
|
19
|
-
through: 'appCollectionBlacklist',
|
|
20
|
-
target: 'applications',
|
|
21
|
-
targetKey: 'name',
|
|
22
|
-
otherKey: 'applicationName',
|
|
23
|
-
sourceKey: 'name',
|
|
24
|
-
foreignKey: 'collectionName'
|
|
25
|
-
}]
|
|
26
|
-
});
|
|
27
|
-
exports.default = _default;
|
package/lib/server/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _plugin.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|