@nocobase/plugin-multi-app-share-collection 0.21.0-alpha.6 → 0.21.0-alpha.8

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.
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@nocobase/client';
2
- export declare class MultiAppShareCollectionPlugin extends Plugin {
2
+ export declare class PluginMultiAppShareCollectionClient extends Plugin {
3
3
  load(): Promise<void>;
4
4
  }
5
- export default MultiAppShareCollectionPlugin;
5
+ export default PluginMultiAppShareCollectionClient;
@@ -15,4 +15,4 @@
15
15
  align-items: center;
16
16
  width: 100%;
17
17
  margin-bottom: 8px;
18
- `,children:[e.jsx("strong",{style:{fontSize:z.fontSizeLG,color:z.colorText},children:g("Shared collections")}),e.jsxs(r.Input.Group,{compact:!0,style:{width:360},children:[e.jsx(r.Select,{popupMatchSelectWidth:!1,onChange:u=>{K.setCategoryFilter(u)},mode:"multiple",style:{width:"35%"},size:"middle",placeholder:g("All categories"),options:m,allowClear:!0}),e.jsx(r.Input,{onChange:u=>K.setNameFilter(u.target.value),style:{width:"65%"},placeholder:g("Enter name or title..."),allowClear:!0})]})]}),e.jsx(r.Table,{bordered:!0,rowKey:"name",rowSelection:{type:"checkbox",selectedRowKeys:w,onChange(u){const p=C.lodash.uniq(c.concat(u));l(p),a(p),f([])}},pagination:!1,size:"small",columns:I,dataSource:K.dataSource,scroll:{y:"calc(100vh - 260px)"},onRow:({name:u})=>({onClick:()=>{const p=Y(u),x=()=>{c.push(...p);const A=C.lodash.uniq([...c]);l(A),a(A)};if(p.length===1)return x();L.confirm({title:g("Are you sure to remove the following collections?"),width:"60%",content:e.jsx("div",{children:e.jsx(r.Table,{size:"small",columns:I,dataSource:i.filter(A=>p.includes(A.name)),pagination:!1,scroll:{y:"60vh"}})}),onOk(){x()}})}})})]})]})})}),D=n=>`{{t("${n}", { ns: 'multi-app-share-collection' })}}`,H=()=>{const n=M.useForm(),a=t.useActionContext(),s=t.useAPIClient(),i=t.useRecord();return{run(){return G(this,null,function*(){console.log(n.values.names),yield s.request({url:`applications/${i.name}/collectionBlacklist`,data:n.values.names,method:"post"}),a.setVisible(!1),n.reset(),r.message.success("Saved successfully")})}}},J=y.tableActionColumnSchema.properties.update,Q=y.tableActionColumnSchema.properties.delete;delete y.tableActionColumnSchema.properties.update,delete y.tableActionColumnSchema.properties.delete,y.tableActionColumnSchema.properties.collection={type:"void",title:D("Share collections"),"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{width:"95vw"},"x-decorator":"Form",title:D("Share collections"),properties:{names:{type:"array","x-component":V,"x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:H}}}}}}}},y.tableActionColumnSchema.properties.update=J,y.tableActionColumnSchema.properties.delete=Q;const X=n=>e.jsx(e.Fragment,{children:n.children});class P extends t.Plugin{load(){return G(this,null,function*(){this.app.use(X)})}}o.MultiAppShareCollectionPlugin=P,o.default=P,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
18
+ `,children:[e.jsx("strong",{style:{fontSize:z.fontSizeLG,color:z.colorText},children:g("Shared collections")}),e.jsxs(r.Input.Group,{compact:!0,style:{width:360},children:[e.jsx(r.Select,{popupMatchSelectWidth:!1,onChange:u=>{K.setCategoryFilter(u)},mode:"multiple",style:{width:"35%"},size:"middle",placeholder:g("All categories"),options:m,allowClear:!0}),e.jsx(r.Input,{onChange:u=>K.setNameFilter(u.target.value),style:{width:"65%"},placeholder:g("Enter name or title..."),allowClear:!0})]})]}),e.jsx(r.Table,{bordered:!0,rowKey:"name",rowSelection:{type:"checkbox",selectedRowKeys:w,onChange(u){const p=C.lodash.uniq(c.concat(u));l(p),a(p),f([])}},pagination:!1,size:"small",columns:I,dataSource:K.dataSource,scroll:{y:"calc(100vh - 260px)"},onRow:({name:u})=>({onClick:()=>{const p=Y(u),x=()=>{c.push(...p);const A=C.lodash.uniq([...c]);l(A),a(A)};if(p.length===1)return x();L.confirm({title:g("Are you sure to remove the following collections?"),width:"60%",content:e.jsx("div",{children:e.jsx(r.Table,{size:"small",columns:I,dataSource:i.filter(A=>p.includes(A.name)),pagination:!1,scroll:{y:"60vh"}})}),onOk(){x()}})}})})]})]})})}),D=n=>`{{t("${n}", { ns: 'multi-app-share-collection' })}}`,H=()=>{const n=M.useForm(),a=t.useActionContext(),s=t.useAPIClient(),i=t.useRecord();return{run(){return G(this,null,function*(){console.log(n.values.names),yield s.request({url:`applications/${i.name}/collectionBlacklist`,data:n.values.names,method:"post"}),a.setVisible(!1),n.reset(),r.message.success("Saved successfully")})}}},J=y.tableActionColumnSchema.properties.update,Q=y.tableActionColumnSchema.properties.delete;delete y.tableActionColumnSchema.properties.update,delete y.tableActionColumnSchema.properties.delete,y.tableActionColumnSchema.properties.collection={type:"void",title:D("Share collections"),"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{width:"95vw"},"x-decorator":"Form",title:D("Share collections"),properties:{names:{type:"array","x-component":V,"x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:H}}}}}}}},y.tableActionColumnSchema.properties.update=J,y.tableActionColumnSchema.properties.delete=Q;const X=n=>e.jsx(e.Fragment,{children:n.children});class P extends t.Plugin{load(){return G(this,null,function*(){this.app.use(X)})}}o.PluginMultiAppShareCollectionClient=P,o.default=P,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,12 +1,12 @@
1
1
  module.exports = {
2
2
  "@formily/react": "2.3.0",
3
- "@nocobase/client": "0.21.0-alpha.6",
4
- "@nocobase/plugin-multi-app-manager": "0.21.0-alpha.6",
3
+ "@nocobase/client": "0.21.0-alpha.8",
4
+ "@nocobase/plugin-multi-app-manager": "0.21.0-alpha.8",
5
5
  "antd": "5.12.8",
6
6
  "react": "18.2.0",
7
- "@nocobase/utils": "0.21.0-alpha.6",
7
+ "@nocobase/utils": "0.21.0-alpha.8",
8
8
  "react-i18next": "11.18.6",
9
- "@nocobase/database": "0.21.0-alpha.6",
10
- "@nocobase/server": "0.21.0-alpha.6",
9
+ "@nocobase/database": "0.21.0-alpha.8",
10
+ "@nocobase/server": "0.21.0-alpha.8",
11
11
  "lodash": "4.17.21"
12
12
  };
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(plugin_exports);
34
34
  var import_plugin_multi_app_manager = __toESM(require("@nocobase/plugin-multi-app-manager"));
35
35
  var import_server = require("@nocobase/server");
36
36
  var import_lodash = __toESM(require("lodash"));
37
- var import_path = require("path");
38
37
  const subAppFilteredPlugins = ["multi-app-share-collection", "multi-app-manager"];
39
38
  const unSyncPlugins = ["localization-management"];
40
39
  class SubAppPlugin extends import_server.Plugin {
@@ -208,7 +207,6 @@ class MultiAppShareCollectionPlugin extends import_server.Plugin {
208
207
  this.app.log.warn("multi-app-share-collection plugin need multi-app-manager plugin enabled");
209
208
  return;
210
209
  }
211
- await this.importCollections((0, import_path.resolve)(__dirname, "collections"));
212
210
  this.app.resourcer.registerActionHandlers({
213
211
  "applications:shareCollections": async (ctx, next) => {
214
212
  const { filterByTk, values } = ctx.action.params;
@@ -225,9 +223,12 @@ class MultiAppShareCollectionPlugin extends import_server.Plugin {
225
223
  ...mainAppDbConfig,
226
224
  schema: appName
227
225
  };
228
- const plugins = [...mainApp.pm.getAliases()].filter(
229
- (name) => name !== "multi-app-manager" && name !== "multi-app-share-collection"
230
- );
226
+ const plugins = [...mainApp.pm.getPlugins().values()].filter(
227
+ (plugin) => {
228
+ var _a, _b;
229
+ return ((_a = plugin == null ? void 0 : plugin.options) == null ? void 0 : _a.packageName) !== "@nocobase/plugin-multi-app-manager" && ((_b = plugin == null ? void 0 : plugin.options) == null ? void 0 : _b.packageName) !== "@nocobase/plugin-multi-app-share-collection";
230
+ }
231
+ ).map((plugin) => plugin.name);
231
232
  return {
232
233
  database: import_lodash.default.merge(databaseOptions, {
233
234
  dialectOptions: {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "多应用数据表共享",
5
5
  "description": "",
6
6
  "description.zh-CN": "",
7
- "version": "0.21.0-alpha.6",
7
+ "version": "0.21.0-alpha.8",
8
8
  "main": "./dist/server/index.js",
9
9
  "devDependencies": {
10
10
  "@formily/react": "2.x",
@@ -23,7 +23,7 @@
23
23
  "@nocobase/test": "0.x",
24
24
  "@nocobase/utils": "0.x"
25
25
  },
26
- "gitHead": "25eaaf1bdf44d2b457a3a3742532db9d2008216b",
26
+ "gitHead": "bed69485709bc8e268285b50debfc1ebfd7a30c7",
27
27
  "keywords": [
28
28
  "System management"
29
29
  ]