@nocobase/plugin-client 0.9.4-alpha.2 → 0.10.0-alpha.3

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.
@@ -234,7 +234,7 @@
234
234
  "Quick upload": "Quick upload",
235
235
  "Select file": "Select file",
236
236
  "Subtable": "Subtable",
237
- "Subform": "Sub-form",
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",
@@ -579,7 +579,7 @@
579
579
  "User": "User",
580
580
  "Field": "Field",
581
581
  "Select": "Select",
582
- "Select Field": "Select Field",
582
+ "Select field": "Select field",
583
583
  "Field value changes": "Field value changes",
584
584
  "One to one (has one)": "One to one (has one)",
585
585
  "One to one (belongs to)": "One to one (belongs to)",
@@ -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
- "Subform": "Subformulario",
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",
@@ -638,7 +638,7 @@
638
638
  "User": "Usuario",
639
639
  "Field": "Campo",
640
640
  "Select": "Seleccionar",
641
- "Select Field": "Seleccionar campo",
641
+ "Select field": "Seleccionar campo",
642
642
  "Field value changes": "Cambios en el valor del campo",
643
643
  "One to one (has one)": "Uno a uno (tiene uno)",
644
644
  "One to one (belongs to)": "Uno a uno (pertenece a)",
@@ -218,7 +218,7 @@
218
218
  "Select file": "Selecionar arquivo",
219
219
  "Allow multiple": "Permitir múltiplos",
220
220
  "Subtable": "Subtabela",
221
- "Subform": "Subformulário",
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",
@@ -563,7 +563,7 @@
563
563
  "User": "Usuário",
564
564
  "Field": "Campo",
565
565
  "Select": "Selecionar",
566
- "Select Field": "Selecionar campo",
566
+ "Select field": "Selecionar campo",
567
567
  "Field value changes": "Alterações no valor do campo",
568
568
  "One to one (has one)": "Um para um (tem um)",
569
569
  "One to one (belongs to)": "Um para um (pertence a)",
@@ -234,7 +234,7 @@
234
234
  "Quick upload": "快速上传",
235
235
  "Select file": "选择文件",
236
236
  "Subtable": "子表格",
237
- "Subform": "子表单",
237
+ "Sub-form": "子表单",
238
238
  "Record picker": "数据选择器",
239
239
  "Toggles the subfield mode": "切换子字段模式",
240
240
  "Selector mode": "选择器模式",
@@ -580,7 +580,7 @@
580
580
  "User": "用户",
581
581
  "Field": "字段",
582
582
  "Select": "选择",
583
- "Select Field": "选择字段",
583
+ "Select field": "选择字段",
584
584
  "Field value changes": "变更记录",
585
585
  "One to one (has one)": "一对一(has one)",
586
586
  "One to one (belongs to)": "一对一(belongs to)",
@@ -0,0 +1,4 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class extends Migration {
3
+ up(): Promise<void>;
4
+ }
@@ -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');
@@ -279,25 +313,6 @@ class ClientPlugin extends _server().Plugin {
279
313
  _this2.app.resource({
280
314
  name: 'plugins',
281
315
  actions: {
282
- // TODO: 临时
283
- getPinned(ctx, next) {
284
- return _asyncToGenerator(function* () {
285
- ctx.body = [{
286
- component: 'CollectionManagerShortcut'
287
- }, {
288
- component: 'ACLShortcut'
289
- }, {
290
- component: 'WorkflowShortcut'
291
- }, {
292
- component: 'SchemaTemplateShortcut'
293
- }, {
294
- component: 'SystemSettingsShortcut'
295
- }, {
296
- component: 'FileStorageShortcut'
297
- }];
298
- yield next();
299
- })();
300
- },
301
316
  getInfo(ctx, next) {
302
317
  return _asyncToGenerator(function* () {
303
318
  const lang = yield getLang(ctx);
@@ -341,7 +356,7 @@ class ClientPlugin extends _server().Plugin {
341
356
  }
342
357
  if (process.env.APP_ENV !== 'production' && root) {
343
358
  _this2.app.use( /*#__PURE__*/function () {
344
- var _ref5 = _asyncToGenerator(function* (ctx, next) {
359
+ var _ref6 = _asyncToGenerator(function* (ctx, next) {
345
360
  if (ctx.path.startsWith(_this2.app.resourcer.options.prefix)) {
346
361
  return next();
347
362
  }
@@ -353,8 +368,8 @@ class ClientPlugin extends _server().Plugin {
353
368
  });
354
369
  }
355
370
  });
356
- return function (_x9, _x10) {
357
- return _ref5.apply(this, arguments);
371
+ return function (_x11, _x12) {
372
+ return _ref6.apply(this, arguments);
358
373
  };
359
374
  }(), {
360
375
  tag: 'clientStatic',
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-client",
3
- "version": "0.9.4-alpha.2",
3
+ "displayName": "client",
4
+ "displayName.zh-CN": "客户端",
5
+ "description": "client",
6
+ "description.zh-CN": "客户端。",
7
+ "version": "0.10.0-alpha.3",
4
8
  "main": "lib/index.js",
5
9
  "license": "AGPL-3.0",
6
10
  "dependencies": {
7
- "@nocobase/server": "0.9.4-alpha.2"
11
+ "@nocobase/server": "0.10.0-alpha.3"
8
12
  },
9
13
  "devDependencies": {
10
- "@nocobase/test": "0.9.4-alpha.2"
14
+ "@nocobase/test": "0.10.0-alpha.3"
11
15
  },
12
- "gitHead": "2bc19a85bf9425aa220b6c467315c8087f333a7e"
16
+ "gitHead": "1f0b27fc9ab2398cd41c308a6b01a986e025cd20"
13
17
  }