@tachybase/plugin-multi-app-share-collection 1.3.21 → 1.3.23
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 +3 -3
- package/dist/externalVersion.js +6 -7
- package/dist/server/collections/applications.d.ts +1 -1
- package/dist/server/collections/applications.js +2 -2
- package/dist/server/collections/collections.d.ts +1 -1
- package/dist/server/collections/collections.js +2 -2
- package/dist/server/migrations/20230319111111-update-apps-collections.d.ts +1 -1
- package/dist/server/migrations/20230319111111-update-apps-collections.js +2 -3
- package/dist/server/plugin.d.ts +1 -1
- package/dist/server/plugin.js +1 -2
- package/package.json +11 -20
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/module-multi-app/client"),require("@tachybase/schema"),require("antd"),require("react"),require("@
|
|
1
|
+
(function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/module-multi-app/client"),require("@tachybase/schema"),require("antd"),require("react"),require("@tego/client"),require("lodash"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/module-multi-app/client","@tachybase/schema","antd","react","@tego/client","lodash","react-i18next"],t):(o=typeof globalThis!="undefined"?globalThis:o||self,t(o["@tachybase/plugin-multi-app-share-collection"]={},o["@tachybase/client"],o.jsxRuntime,o["@tachybase/module-multi-app"],o["@tachybase/schema"],o.antd,o.react,o["@tego/client"],o.lodash,o["react-i18next"]))})(this,function(o,t,e,S,q,c,p,v,f,F){"use strict";var R=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var B=(o,t,e)=>t in o?R(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,k=(o,t)=>{for(var e in t||(t={}))oe.call(t,e)&&B(o,e,t[e]);if(_)for(var e of _(t))se.call(t,e)&&B(o,e,t[e]);return o},M=(o,t)=>ee(o,te(t));var P=(o,t,e)=>new Promise((S,q)=>{var c=f=>{try{v(e.next(f))}catch(F){q(F)}},p=f=>{try{v(e.throw(f))}catch(F){q(F)}},v=f=>f.done?S(f.value):Promise.resolve(f.value).then(c,p);v((e=e.apply(o,t)).next())});const j=["users","roles","applications"],E=({removed:n=[]})=>{const{collections:l}=t.useCollectionManager_deprecated(),s=p.useCallback(m=>v.CollectionsGraph.connectedNodes({collections:l,nodes:[m],excludes:j}).filter(r=>n.includes(r)),[n]),i=p.useCallback(m=>v.CollectionsGraph.connectedNodes({collections:l,nodes:[m],excludes:j,direction:"reverse"}).filter(r=>!n.includes(r)),[n]);return{findAddable:s,findRemovable:i}},W=()=>{var a,C;const n=t.useRecord(),[l,s]=p.useState([]),i=t.useRequest({url:`applications/${n.name}/collectionBlacklist:list`,params:{paginate:!1,params:{fields:["name"]}}},{onSuccess(h){var b;s((b=h.data)==null?void 0:b.map(y=>y.name))}}),m=t.useRequest({url:"collections",params:{fields:["name","title","hidden","category.name","category.color","category.sort"],sort:"sort",paginate:!1}}),r=t.useRequest({url:"collectionCategories",params:{sort:"sort",paginate:!1}});return{loading:i.loading||m.loading||r.loading,collections:(((a=m.data)==null?void 0:a.data)||[]).filter(h=>!h.hidden&&!j.includes(h.name)),removed:l,setSelected:s,categories:(((C=r.data)==null?void 0:C.data)||[]).map(h=>({label:h.name,value:h.name}))}},A=(n,l)=>{const s=Array.isArray(l)?l:[l];for(const i of s)if(n.toLowerCase().includes(i))return!0;return!1},U=({collections:n,removed:l})=>{const[s,i]=p.useState({name:"",category:[]}),m=p.useMemo(()=>n.filter(a=>{const{name:C,title:h,category:b=[]}=a,y=[l.includes(a.name)];return s.name&&y.push(A(C,s.name)||A(h,s.name)),s.category.length>0&&y.push(b.some(T=>A(T.name,s.category))),!y.includes(!1)}),[n,l,s]),r=p.useMemo(()=>f.debounce(a=>{i(M(k({},s),{name:a}))},300),[]);return{dataSource:m,setNameFilter:r,setCategoryFilter:a=>{i(M(k({},s),{category:a}))}}},V=({collections:n,removed:l})=>{const[s,i]=p.useState({name:"",category:[]}),m=n.filter(a=>{const{name:C,title:h,category:b=[]}=a,y=[!l.includes(a.name)];return s.name&&y.push(A(C,s.name)||A(h,s.name)),s.category.length>0&&y.push(b.some(T=>A(T.name,s.category))),!y.includes(!1)}),r=p.useMemo(()=>f.debounce(a=>{i(M(k({},s),{name:a}))},300),[]);return{dataSource:m,setNameFilter:r,setCategoryFilter:a=>{i(M(k({},s),{category:a}))}}},H=q.connect(n=>{const{onChange:l}=n,{loading:s,collections:i,categories:m,removed:r,setSelected:a}=W(),[C,h]=p.useState([]),[b,y]=p.useState([]),{findAddable:T,findRemovable:Z}=E({removed:r}),I=V({collections:i,removed:r}),D=U({collections:i,removed:r}),{t:g}=F.useTranslation("multi-app-share-collection"),{modal:O}=c.App.useApp(),{token:z}=t.useToken(),N=p.useMemo(()=>[{title:g("Collection display name"),dataIndex:"title"},{title:g("Collection name"),dataIndex:"name"},{title:g("Collection category"),dataIndex:"category",render:d=>d.map(u=>e.jsx(c.Tag,{color:u.color,children:u.name},u.name))}],[]);return s?e.jsx(c.Spin,{}):e.jsx("div",{children:e.jsxs(c.Row,{gutter:24,className:t.css`
|
|
2
2
|
.ant-table-tbody > tr.ant-table-row:hover > td {
|
|
3
3
|
background: #e6f7ff;
|
|
4
4
|
cursor: pointer;
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
align-items: center;
|
|
10
10
|
width: 100%;
|
|
11
11
|
margin-bottom: 8px;
|
|
12
|
-
`,children:[e.jsx("strong",{style:{fontSize:z.fontSizeLG,color:z.colorText},children:
|
|
12
|
+
`,children:[e.jsx("strong",{style:{fontSize:z.fontSizeLG,color:z.colorText},children:g("Unshared collections")}),e.jsxs(c.Space.Compact,{style:{width:360},children:[e.jsx(c.Select,{popupMatchSelectWidth:!1,onChange:d=>{D.setCategoryFilter(d)},mode:"multiple",style:{width:"35%"},size:"middle",placeholder:g("All categories"),options:m,allowClear:!0}),e.jsx(c.Input,{onChange:d=>D.setNameFilter(d.target.value),style:{width:"65%"},placeholder:g("Enter name or title..."),allowClear:!0})]})]}),e.jsx(c.Table,{bordered:!0,rowKey:"name",rowSelection:{type:"checkbox",selectedRowKeys:C,onChange(d){const u=r.filter(w=>!d.includes(w));a(u),l(u),h([])}},pagination:!1,size:"small",columns:N,dataSource:D.dataSource,scroll:{y:"calc(100vh - 260px)"},onRow:({name:d,disabled:u})=>({onClick:()=>{if(u)return;const w=T(d),x=()=>{const K=r.filter($=>!w.includes($));a(K),l(K)};if(w.length===1)return x();O.confirm({title:g("Are you sure to add the following collections?"),width:"60%",content:e.jsx("div",{children:e.jsx(c.Table,{size:"small",columns:N,dataSource:i.filter(K=>w.includes(K.name)),pagination:!1,scroll:{y:"60vh"}})}),onOk(){x()}})}})})]}),e.jsxs(c.Col,{span:12,children:[e.jsxs("div",{className:t.css`
|
|
13
13
|
display: flex;
|
|
14
14
|
justify-content: space-between;
|
|
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:
|
|
18
|
+
`,children:[e.jsx("strong",{style:{fontSize:z.fontSizeLG,color:z.colorText},children:g("Shared collections")}),e.jsxs(c.Space.Compact,{style:{width:360},children:[e.jsx(c.Select,{popupMatchSelectWidth:!1,onChange:d=>{I.setCategoryFilter(d)},mode:"multiple",style:{width:"35%"},size:"middle",placeholder:g("All categories"),options:m,allowClear:!0}),e.jsx(c.Input,{onChange:d=>I.setNameFilter(d.target.value),style:{width:"65%"},placeholder:g("Enter name or title..."),allowClear:!0})]})]}),e.jsx(c.Table,{bordered:!0,rowKey:"name",rowSelection:{type:"checkbox",selectedRowKeys:b,onChange(d){const u=f.uniq(r.concat(d));a(u),l(u),y([])}},pagination:!1,size:"small",columns:N,dataSource:I.dataSource,scroll:{y:"calc(100vh - 260px)"},onRow:({name:d})=>({onClick:()=>{const u=Z(d),w=()=>{r.push(...u);const x=f.uniq([...r]);a(x),l(x)};if(u.length===1)return w();O.confirm({title:g("Are you sure to remove the following collections?"),width:"60%",content:e.jsx("div",{children:e.jsx(c.Table,{size:"small",columns:N,dataSource:i.filter(x=>u.includes(x.name)),pagination:!1,scroll:{y:"60vh"}})}),onOk(){w()}})}})})]})]})})}),G=n=>`{{t("${n}", { ns: 'multi-app-share-collection' })}}`,J=()=>{const n=q.useForm(),l=t.useActionContext(),s=t.useAPIClient(),i=t.useRecord();return{run(){return P(this,null,function*(){console.log(n.values.names),yield s.request({url:`applications/${i.name}/collectionBlacklist`,data:n.values.names,method:"post"}),l.setVisible(!1),n.reset(),c.message.success("Saved successfully")})}}},Q=S.tableActionColumnSchema.properties.update,X=S.tableActionColumnSchema.properties.delete;delete S.tableActionColumnSchema.properties.update,delete S.tableActionColumnSchema.properties.delete,S.tableActionColumnSchema.properties.collection={type:"void",title:G("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:G("Share collections"),properties:{names:{type:"array","x-component":H,"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:J}}}}}}}},S.tableActionColumnSchema.properties.update=Q,S.tableActionColumnSchema.properties.delete=X;const Y=n=>e.jsx(e.Fragment,{children:n.children});class L extends t.Plugin{load(){return P(this,null,function*(){this.app.use(Y)})}}o.MultiAppShareCollectionPlugin=L,o.default=L,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.3.
|
|
4
|
-
"@tachybase/module-multi-app": "1.3.
|
|
5
|
-
"@tachybase/schema": "1.3.
|
|
3
|
+
"@tachybase/client": "1.3.23",
|
|
4
|
+
"@tachybase/module-multi-app": "1.3.23",
|
|
5
|
+
"@tachybase/schema": "1.3.43",
|
|
6
6
|
"antd": "5.22.5",
|
|
7
|
-
"@
|
|
7
|
+
"@tego/client": "1.3.43",
|
|
8
|
+
"lodash": "4.17.21",
|
|
8
9
|
"react-i18next": "15.2.0",
|
|
9
|
-
"@
|
|
10
|
-
"@tachybase/server": "1.3.21",
|
|
11
|
-
"lodash": "4.17.21"
|
|
10
|
+
"@tego/server": "1.3.43"
|
|
12
11
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionDef;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(applications_exports, {
|
|
|
20
20
|
default: () => applications_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(applications_exports);
|
|
23
|
-
var
|
|
24
|
-
var applications_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var applications_default = (0, import_server.extendCollection)({
|
|
25
25
|
name: "applications",
|
|
26
26
|
fields: [
|
|
27
27
|
{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionDef;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(collections_exports, {
|
|
|
20
20
|
default: () => collections_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(collections_exports);
|
|
23
|
-
var
|
|
24
|
-
var collections_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var collections_default = (0, import_server.extendCollection)({
|
|
25
25
|
name: "collections",
|
|
26
26
|
fields: [
|
|
27
27
|
{
|
|
@@ -20,8 +20,7 @@ __export(update_apps_collections_exports, {
|
|
|
20
20
|
default: () => update_apps_collections_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(update_apps_collections_exports);
|
|
23
|
-
var import_server = require("@
|
|
24
|
-
var import_utils = require("@tachybase/utils");
|
|
23
|
+
var import_server = require("@tego/server");
|
|
25
24
|
class update_apps_collections_default extends import_server.Migration {
|
|
26
25
|
constructor() {
|
|
27
26
|
super(...arguments);
|
|
@@ -58,7 +57,7 @@ class update_apps_collections_default extends import_server.Migration {
|
|
|
58
57
|
const blackListCollections = allCollections.filter(
|
|
59
58
|
(collection) => !syncedCollections.has(collection) && !["users", "roles"].includes(collection)
|
|
60
59
|
);
|
|
61
|
-
const connectedCollections =
|
|
60
|
+
const connectedCollections = import_server.CollectionsGraph.connectedNodes({
|
|
62
61
|
collections: collectionsData,
|
|
63
62
|
nodes: blackListCollections,
|
|
64
63
|
direction: "reverse"
|
package/dist/server/plugin.d.ts
CHANGED
package/dist/server/plugin.js
CHANGED
|
@@ -32,10 +32,9 @@ __export(plugin_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(plugin_exports);
|
|
34
34
|
var import_module_multi_app = __toESM(require("@tachybase/module-multi-app"));
|
|
35
|
-
var import_server = require("@
|
|
35
|
+
var import_server = require("@tego/server");
|
|
36
36
|
var import_lodash = __toESM(require("lodash"));
|
|
37
37
|
const subAppFilteredPlugins = ["multi-app-share-collection", "multi-app"];
|
|
38
|
-
const unSyncPlugins = ["localization-management"];
|
|
39
38
|
class SubAppPlugin extends import_server.Plugin {
|
|
40
39
|
beforeLoad() {
|
|
41
40
|
const mainApp = this.options.mainApp;
|
package/package.json
CHANGED
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-multi-app-share-collection",
|
|
3
3
|
"displayName": "Multi-app share collection",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.23",
|
|
5
5
|
"description": "Multi-app share collection",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"System management"
|
|
8
8
|
],
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
|
-
"dependencies": {},
|
|
11
10
|
"devDependencies": {
|
|
11
|
+
"@tachybase/schema": "^1.3.43",
|
|
12
|
+
"@tachybase/test": "^1.3.43",
|
|
13
|
+
"@tego/client": "^1.3.43",
|
|
14
|
+
"@tego/server": "^1.3.43",
|
|
15
|
+
"@types/lodash": "^4.17.20",
|
|
12
16
|
"antd": "5.22.5",
|
|
13
17
|
"lodash": "4.17.21",
|
|
14
|
-
"react": "
|
|
15
|
-
"react-i18next": "
|
|
16
|
-
"@tachybase/
|
|
17
|
-
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"@tachybase/client": "1.3.21",
|
|
20
|
-
"@tachybase/database": "1.3.21",
|
|
21
|
-
"@tachybase/module-error-handler": "1.3.21",
|
|
22
|
-
"@tachybase/module-collection": "1.3.21",
|
|
23
|
-
"@tachybase/server": "1.3.21",
|
|
24
|
-
"@tachybase/module-multi-app": "1.3.21",
|
|
25
|
-
"@tachybase/test": "1.3.21",
|
|
26
|
-
"@tachybase/utils": "1.3.21",
|
|
27
|
-
"@tachybase/module-user": "1.3.21"
|
|
18
|
+
"react": "18.3.1",
|
|
19
|
+
"react-i18next": "15.2.0",
|
|
20
|
+
"@tachybase/client": "1.3.23",
|
|
21
|
+
"@tachybase/module-multi-app": "1.3.23"
|
|
28
22
|
},
|
|
29
23
|
"description.zh-CN": "多应用数据共享",
|
|
30
|
-
"displayName.zh-CN": "多应用数据共享"
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tachybase-build --no-dts @tachybase/plugin-multi-app-share-collection"
|
|
33
|
-
}
|
|
24
|
+
"displayName.zh-CN": "多应用数据共享"
|
|
34
25
|
}
|