@nocobase/plugin-client 0.10.0-alpha.2 → 0.10.0-alpha.4
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/lib/locale/en-US.json +1 -1
- package/lib/locale/es-ES.json +1 -1
- package/lib/locale/pt-BR.json +1 -1
- package/lib/locale/zh-CN.json +1 -1
- package/lib/migrations/20230620203215-admin-ui-schema-uid.d.ts +4 -0
- package/lib/migrations/20230620203215-admin-ui-schema-uid.js +56 -0
- package/lib/server.js +37 -3
- package/package.json +4 -4
package/lib/locale/en-US.json
CHANGED
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
"Quick upload": "Quick upload",
|
|
235
235
|
"Select file": "Select file",
|
|
236
236
|
"Subtable": "Subtable",
|
|
237
|
-
"
|
|
237
|
+
"Sub-form": "Sub-form",
|
|
238
238
|
"Record picker": "Record picker",
|
|
239
239
|
"Toggles the subfield mode": "Toggles the subfield mode",
|
|
240
240
|
"Selector mode": "Selector mode",
|
package/lib/locale/es-ES.json
CHANGED
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
"Display field title": "Mostrar título de campo",
|
|
285
285
|
"Field component": "Componente del campo",
|
|
286
286
|
"Subtable": "Subtabla",
|
|
287
|
-
"
|
|
287
|
+
"Sub-form": "Subformulario",
|
|
288
288
|
"Record picker": "Selector de registros",
|
|
289
289
|
"Toggles the subfield mode": "Alterna el modo de subcampo",
|
|
290
290
|
"Selector mode": "Modo selector",
|
package/lib/locale/pt-BR.json
CHANGED
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"Select file": "Selecionar arquivo",
|
|
219
219
|
"Allow multiple": "Permitir múltiplos",
|
|
220
220
|
"Subtable": "Subtabela",
|
|
221
|
-
"
|
|
221
|
+
"Sub-form": "Subformulário",
|
|
222
222
|
"Record picker": "Selecionador de registro",
|
|
223
223
|
"Toggles the subfield mode": "Alterna o modo de subcampo",
|
|
224
224
|
"Selector mode": "Modo de seleção",
|
package/lib/locale/zh-CN.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _server() {
|
|
8
|
+
const data = require("@nocobase/server");
|
|
9
|
+
_server = function _server() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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); } }
|
|
18
|
+
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); }); }; }
|
|
19
|
+
class _default extends _server().Migration {
|
|
20
|
+
up() {
|
|
21
|
+
var _this = this;
|
|
22
|
+
return _asyncToGenerator(function* () {
|
|
23
|
+
var _instance$get;
|
|
24
|
+
const systemSettings = _this.db.getRepository('systemSettings');
|
|
25
|
+
let instance = yield systemSettings.findOne();
|
|
26
|
+
const uiRoutes = _this.db.getRepository('uiRoutes');
|
|
27
|
+
const routes = yield uiRoutes.find();
|
|
28
|
+
var _iterator = _createForOfIteratorHelper(routes),
|
|
29
|
+
_step;
|
|
30
|
+
try {
|
|
31
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
32
|
+
var _route$options;
|
|
33
|
+
const route = _step.value;
|
|
34
|
+
if (route.uiSchemaUid && (route === null || route === void 0 ? void 0 : (_route$options = route.options) === null || _route$options === void 0 ? void 0 : _route$options.component) === 'AdminLayout') {
|
|
35
|
+
const options = instance.options || {};
|
|
36
|
+
options['adminSchemaUid'] = route.uiSchemaUid;
|
|
37
|
+
instance.set('options', options);
|
|
38
|
+
instance.changed('options', true);
|
|
39
|
+
yield instance.save();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch (err) {
|
|
44
|
+
_iterator.e(err);
|
|
45
|
+
} finally {
|
|
46
|
+
_iterator.f();
|
|
47
|
+
}
|
|
48
|
+
instance = yield systemSettings.findOne();
|
|
49
|
+
if (!((_instance$get = instance.get('options')) === null || _instance$get === void 0 ? void 0 : _instance$get.mobileSchemaUid)) {
|
|
50
|
+
throw new Error('adminSchemaUid invalid');
|
|
51
|
+
}
|
|
52
|
+
_this.app.log.info('systemSettings.options', instance.toJSON());
|
|
53
|
+
})();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = _default;
|
package/lib/server.js
CHANGED
|
@@ -164,11 +164,45 @@ class ClientPlugin extends _server().Plugin {
|
|
|
164
164
|
return _ref.apply(this, arguments);
|
|
165
165
|
};
|
|
166
166
|
}());
|
|
167
|
+
_this.db.on('systemSettings.beforeCreate', /*#__PURE__*/function () {
|
|
168
|
+
var _ref4 = _asyncToGenerator(function* (instance, {
|
|
169
|
+
transaction
|
|
170
|
+
}) {
|
|
171
|
+
const uiSchemas = _this.db.getRepository('uiSchemas');
|
|
172
|
+
const schema = yield uiSchemas.insert({
|
|
173
|
+
type: 'void',
|
|
174
|
+
'x-component': 'Menu',
|
|
175
|
+
'x-designer': 'Menu.Designer',
|
|
176
|
+
'x-initializer': 'MenuItemInitializers',
|
|
177
|
+
'x-component-props': {
|
|
178
|
+
mode: 'mix',
|
|
179
|
+
theme: 'dark',
|
|
180
|
+
// defaultSelectedUid: 'u8',
|
|
181
|
+
onSelect: '{{ onSelect }}',
|
|
182
|
+
sideMenuRefScopeKey: 'sideMenuRef'
|
|
183
|
+
},
|
|
184
|
+
properties: {}
|
|
185
|
+
}, {
|
|
186
|
+
transaction
|
|
187
|
+
});
|
|
188
|
+
instance.set('options.adminSchemaUid', schema['x-uid']);
|
|
189
|
+
});
|
|
190
|
+
return function (_x9, _x10) {
|
|
191
|
+
return _ref4.apply(this, arguments);
|
|
192
|
+
};
|
|
193
|
+
}());
|
|
167
194
|
})();
|
|
168
195
|
}
|
|
169
196
|
load() {
|
|
170
197
|
var _this2 = this;
|
|
171
198
|
return _asyncToGenerator(function* () {
|
|
199
|
+
_this2.db.addMigrations({
|
|
200
|
+
namespace: 'client',
|
|
201
|
+
directory: (0, _path().resolve)(__dirname, './migrations'),
|
|
202
|
+
context: {
|
|
203
|
+
plugin: _this2
|
|
204
|
+
}
|
|
205
|
+
});
|
|
172
206
|
_this2.app.acl.allow('app', 'getLang');
|
|
173
207
|
_this2.app.acl.allow('app', 'getInfo');
|
|
174
208
|
_this2.app.acl.allow('app', 'getPlugins');
|
|
@@ -322,7 +356,7 @@ class ClientPlugin extends _server().Plugin {
|
|
|
322
356
|
}
|
|
323
357
|
if (process.env.APP_ENV !== 'production' && root) {
|
|
324
358
|
_this2.app.use( /*#__PURE__*/function () {
|
|
325
|
-
var
|
|
359
|
+
var _ref6 = _asyncToGenerator(function* (ctx, next) {
|
|
326
360
|
if (ctx.path.startsWith(_this2.app.resourcer.options.prefix)) {
|
|
327
361
|
return next();
|
|
328
362
|
}
|
|
@@ -334,8 +368,8 @@ class ClientPlugin extends _server().Plugin {
|
|
|
334
368
|
});
|
|
335
369
|
}
|
|
336
370
|
});
|
|
337
|
-
return function (
|
|
338
|
-
return
|
|
371
|
+
return function (_x11, _x12) {
|
|
372
|
+
return _ref6.apply(this, arguments);
|
|
339
373
|
};
|
|
340
374
|
}(), {
|
|
341
375
|
tag: 'clientStatic',
|
package/package.json
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"displayName.zh-CN": "客户端",
|
|
5
5
|
"description": "client",
|
|
6
6
|
"description.zh-CN": "客户端。",
|
|
7
|
-
"version": "0.10.0-alpha.
|
|
7
|
+
"version": "0.10.0-alpha.4",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"license": "AGPL-3.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@nocobase/server": "0.10.0-alpha.
|
|
11
|
+
"@nocobase/server": "0.10.0-alpha.4"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@nocobase/test": "0.10.0-alpha.
|
|
14
|
+
"@nocobase/test": "0.10.0-alpha.4"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "62dacadb2a83d30cb36dda9074f2f3a072a37484"
|
|
17
17
|
}
|