@nocobase/plugin-ui-schema-storage 2.1.0-beta.9 → 2.2.0-beta.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/dist/client/index.js +1 -1
- package/dist/externalVersion.js +8 -9
- package/dist/server/collections/uiButtonSchemasRoles.js +1 -0
- package/dist/server/collections/uiSchemaServerHooks.js +1 -0
- package/dist/server/collections/uiSchemaTemplates.js +1 -0
- package/dist/server/collections/uiSchemaTreePath.js +1 -0
- package/dist/server/collections/uiSchemas.js +1 -0
- package/dist/server/server.js +8 -36
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-ui-schema-storage",["@nocobase/client"],t):"object"==typeof exports?exports["@nocobase/plugin-ui-schema-storage"]=t(require("@nocobase/client")):e["@nocobase/plugin-ui-schema-storage"]=t(e["@nocobase/client"])}(self,function(e){return function(){"use strict";var t={
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-ui-schema-storage",["@nocobase/client"],t):"object"==typeof exports?exports["@nocobase/plugin-ui-schema-storage"]=t(require("@nocobase/client")):e["@nocobase/plugin-ui-schema-storage"]=t(e["@nocobase/client"])}(self,function(e){return function(){"use strict";var t={342:function(t){t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.g.importScripts&&(o=n.g.location+"");var o,i=n.g.document;if(!o&&i&&(i.currentScript&&"SCRIPT"===i.currentScript.tagName.toUpperCase()&&(o=i.currentScript.src),!o)){var c=i.getElementsByTagName("script");if(c.length)for(var u=c.length-1;u>-1&&(!o||!/^http(s?):/.test(o));)o=c[u--].src}if(!o)throw Error("Automatic publicPath is not supported in this browser");n.p=o.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var a={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-ui-schema-storage/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",u=c.indexOf(i);e=u>=0?c.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-ui-schema-storage/dist/client/"}n.p=e}(),!function(){n.r(a);var e=n(342);function t(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}function r(e,t,n){return(r=u()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}a.default=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=o(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&i(n,e),r=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return[2]})},function(){var r=this,n=arguments;return new Promise(function(o,i){var c=e.apply(r,n);function u(e){t(c,o,i,u,a,"next",e)}function a(e){t(c,o,i,u,a,"throw",e)}u(void 0)})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,r),n}(c(e.Plugin))}(),a}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.
|
|
12
|
-
"@nocobase/database": "2.
|
|
13
|
-
"@nocobase/cache": "2.
|
|
14
|
-
"@nocobase/utils": "2.
|
|
15
|
-
"lodash": "4.
|
|
16
|
-
"@nocobase/
|
|
17
|
-
"@nocobase/
|
|
18
|
-
"@nocobase/
|
|
19
|
-
"@nocobase/resourcer": "2.1.0-beta.9",
|
|
11
|
+
"@nocobase/client": "2.2.0-beta.1",
|
|
12
|
+
"@nocobase/database": "2.2.0-beta.1",
|
|
13
|
+
"@nocobase/cache": "2.2.0-beta.1",
|
|
14
|
+
"@nocobase/utils": "2.2.0-beta.1",
|
|
15
|
+
"lodash": "4.18.1",
|
|
16
|
+
"@nocobase/server": "2.2.0-beta.1",
|
|
17
|
+
"@nocobase/actions": "2.2.0-beta.1",
|
|
18
|
+
"@nocobase/resourcer": "2.2.0-beta.1",
|
|
20
19
|
"@formily/json-schema": "2.3.7"
|
|
21
20
|
};
|
|
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(uiButtonSchemasRoles_exports);
|
|
|
32
32
|
var import_database = require("@nocobase/database");
|
|
33
33
|
var uiButtonSchemasRoles_default = (0, import_database.defineCollection)({
|
|
34
34
|
name: "uiButtonSchemasRoles",
|
|
35
|
+
dataCategory: "system",
|
|
35
36
|
dumpRules: "required",
|
|
36
37
|
autoGenId: false,
|
|
37
38
|
migrationRules: ["overwrite", "schema-only"]
|
package/dist/server/server.js
CHANGED
|
@@ -82,7 +82,6 @@ class PluginUISchemaStorageServer extends import_server.Plugin {
|
|
|
82
82
|
}
|
|
83
83
|
async beforeLoad() {
|
|
84
84
|
const db = this.app.db;
|
|
85
|
-
const pm = this.app.pm;
|
|
86
85
|
this.serverHooks = new import_server_hooks.ServerHooks(db);
|
|
87
86
|
this.app.db.registerModels({ MagicAttributeModel: import_database.MagicAttributeModel, UiSchemaModel: import_model.UiSchemaModel, ServerHookModel: import_model2.ServerHookModel });
|
|
88
87
|
this.registerRepository();
|
|
@@ -99,19 +98,7 @@ class PluginUISchemaStorageServer extends import_server.Plugin {
|
|
|
99
98
|
model.set("name", (0, import_utils.uid)());
|
|
100
99
|
}
|
|
101
100
|
});
|
|
102
|
-
|
|
103
|
-
var _a;
|
|
104
|
-
const localizationPlugin = pm.get("localization");
|
|
105
|
-
const texts = [];
|
|
106
|
-
const changedFields = extractFields(model.toJSON());
|
|
107
|
-
if (!changedFields.length) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
changedFields.forEach((field) => {
|
|
111
|
-
field && texts.push({ text: compile(field), module: `resources.ui-schema-storage` });
|
|
112
|
-
});
|
|
113
|
-
await ((_a = localizationPlugin == null ? void 0 : localizationPlugin.addNewTexts) == null ? void 0 : _a.call(localizationPlugin, texts, options));
|
|
114
|
-
});
|
|
101
|
+
this.registerLocalizationSource();
|
|
115
102
|
db.on("uiSchemas.afterCreate", async function insertSchema(model, options) {
|
|
116
103
|
const { transaction } = options;
|
|
117
104
|
const uiSchemaRepository = db.getCollection("uiSchemas").repository;
|
|
@@ -178,29 +165,14 @@ class PluginUISchemaStorageServer extends import_server.Plugin {
|
|
|
178
165
|
await this.importCollections((0, import_path.resolve)(__dirname, "collections"));
|
|
179
166
|
}
|
|
180
167
|
registerLocalizationSource() {
|
|
181
|
-
|
|
182
|
-
if (!localizationPlugin) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
localizationPlugin.sourceManager.registerSource("ui-schema-storage", {
|
|
168
|
+
this.app.localeManager.registerSource("ui-schema-storage", {
|
|
186
169
|
title: (0, import_utils.tval)("UiSchema"),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const changedFields = extractFields(route.schema);
|
|
194
|
-
if (changedFields.length) {
|
|
195
|
-
changedFields.forEach((field) => {
|
|
196
|
-
resources[field] = "";
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
return {
|
|
201
|
-
"ui-schema-storage": resources
|
|
202
|
-
};
|
|
203
|
-
}
|
|
170
|
+
collections: [
|
|
171
|
+
{
|
|
172
|
+
collection: "uiSchemas",
|
|
173
|
+
getTexts: (model) => extractFields(model.toJSON()).map((field) => compile(field)).filter(Boolean).map((text) => ({ text, module: `resources.ui-schema-storage` }))
|
|
174
|
+
}
|
|
175
|
+
]
|
|
204
176
|
});
|
|
205
177
|
}
|
|
206
178
|
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Provides centralized UI schema storage service.",
|
|
7
7
|
"description.zh-CN": "提供中心化的 UI schema 存储服务。",
|
|
8
8
|
"description.ru-RU": "Предоставляет централизованный сервис хранения UI схем.",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.2.0-beta.1",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/ui-schema-storage",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@nocobase/test": "2.x",
|
|
27
27
|
"@nocobase/utils": "2.x"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "f82fa9d0c3aa8e00e53dd94e404a312483b4866b",
|
|
30
30
|
"keywords": [
|
|
31
31
|
"System & security"
|
|
32
32
|
]
|