@nocobase/plugin-data-source-manager 2.0.0-alpha.9 → 2.0.0-beta.10
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/1a8cce8035a89dd9.js +1 -1
- package/dist/client/260a6717d1f70d00.js +10 -0
- package/dist/client/2695e7fbad1ec078.js +10 -0
- package/dist/client/2f7a418e7935984d.js +10 -0
- package/dist/client/689d3bec33ad2ec3.js +10 -0
- package/dist/client/component/CollectionsManager/components/FieldTitleInput.d.ts +1 -1
- package/dist/client/component/CollectionsManager/components/FieldType.d.ts +1 -1
- package/dist/client/component/CollectionsTableField.d.ts +1 -1
- package/dist/client/component/MainDataSourceManager/Configuration/db-sync/LoadCollectionAction.d.ts +15 -0
- package/dist/client/component/MainDataSourceManager/Configuration/db-sync/SyncFieldChangesAction.d.ts +10 -0
- package/dist/client/component/MainDataSourceManager/Configuration/db-sync/SyncFromDatabaseAction.d.ts +10 -0
- package/dist/client/dbf5ddf434ab29c0.js +10 -0
- package/dist/client/fdae18574fda07af.js +10 -0
- package/dist/client/hooks/index.d.ts +3 -4
- package/dist/client/hooks/useDataSourceActions.d.ts +14 -0
- package/dist/client/hooks/useDataSourceRefresh.d.ts +18 -0
- package/dist/client/hooks/useResourceData.d.ts +31 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +11 -9
- package/dist/locale/de-DE.json +35 -30
- package/dist/locale/en-US.json +45 -0
- package/dist/locale/es-ES.json +45 -0
- package/dist/locale/fr-FR.json +45 -0
- package/dist/locale/hu-HU.json +45 -0
- package/dist/locale/id-ID.json +45 -0
- package/dist/locale/it-IT.json +35 -30
- package/dist/locale/ja-JP.json +34 -29
- package/dist/locale/ko-KR.json +45 -0
- package/dist/locale/nl-NL.json +44 -40
- package/dist/locale/pt-BR.json +45 -0
- package/dist/locale/ru-RU.json +46 -0
- package/dist/locale/tr-TR.json +45 -0
- package/dist/locale/uk-UA.json +45 -0
- package/dist/locale/vi-VN.json +45 -0
- package/dist/locale/zh-CN.json +35 -30
- package/dist/locale/zh-TW.json +45 -0
- package/dist/server/actions/data-sources.d.ts +17 -0
- package/dist/server/actions/data-sources.js +115 -0
- package/dist/server/middlewares/load-tables.d.ts +10 -0
- package/dist/server/middlewares/load-tables.js +93 -0
- package/dist/server/models/data-source.d.ts +1 -0
- package/dist/server/models/data-source.js +7 -3
- package/dist/server/plugin.js +10 -96
- package/dist/server/resourcers/data-sources-collections.d.ts +0 -2
- package/dist/server/resourcers/data-sources-collections.js +0 -83
- package/dist/server/utils.d.ts +3 -0
- package/dist/server/utils.js +45 -0
- package/package.json +5 -2
- package/dist/client/0e6cf640dde183c8.js +0 -10
- package/dist/client/7b6cb59b157f5087.js +0 -10
- package/dist/client/9aff90e19fbd41b6.js +0 -10
- package/dist/client/b3873b8560b4de87.js +0 -10
- package/dist/client/cab6d8ac1e107ea5.js +0 -10
- package/dist/client/cc4271412c5e6495.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["843"],{439:function(e,t,n){n.r(t),n.d(t,{MainDataSourceManager:function(){return eD}});var r,o,a,i,l=n(875),c=n(156),u=n.n(c),s=n(772),p=n(563),f=n(505),d=n(229),m=n(584),y=n(238),b=n(642),h=n(721),v=n(593);function g(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){return f.Schema.compile(e,{t:s.i18n.t})},S={type:"object",properties:{block1:{type:"void","x-collection":"collections","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"collections",filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"Input",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"string",name:"template",interface:"input",uiSchema:{title:'{{ t("Collection Template") }}',type:"string","x-component":"Input"}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},dragSort:!0,request:{resource:"collections",action:"list",params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"},__aiCollector__:{type:"void","x-component":"AIResourceContextCollector","x-component-props":{uid:"collections:list"}}}}}},w={type:"object",properties:(C(i={},(0,l.uid)(),{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0}},syncFromDatabase:{type:"void","x-component":"SyncFromDatabaseAction"},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}},extendable:{type:"void","x-component":"ExtendableActions"}}}),C(i,(0,l.uid)(),{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction:function(){var e=(0,s.useAPIClient)(),t=(0,y.useTranslation)().t;return{move:function(n,r){var o;return(o=function(){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,e.resource("collections").move({sourceId:n.name,targetId:r.name})];case 1:return o.sent(),h.message.success(t("Saved successfully"),.2),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){g(a,n,r,i,l,"next",e)}function l(e){g(a,n,r,i,l,"throw",e)}i(void 0)})})()}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":v.E,"x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Collection template")}}',properties:{template:{"x-component":s.CollectionTemplateTag,"x-read-pretty":!0}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column","x-visible":"categoryVisible",title:'{{t("Collection category")}}',properties:{category:{"x-component":s.CollectionCategory,"x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":function(e){var t=e.path.segments[1],n=e.path.segments[0],r=e.form.getValuesIn("".concat(n,".").concat(t));r&&(e.title="".concat(x(r.title)," - ").concat(x('{{ t("Configure fields") }}')))},properties:{collectionFieldSchema:{type:"void","x-component":"CollectionFields"}}}}},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}),i)},A={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:'{{ t("Add category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCategry }}",style:{marginLeft:"8px"}}}}}}}}},O={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},"x-component":"Action.Modal",title:'{{ t("Edit category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditCategry }}",style:{marginLeft:"8px"}}}}}}}}},E=n(241),P=n(482),F=n(551);function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function D(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){k(a,r,o,i,l,"next",e)}function l(e){k(a,r,o,i,l,"throw",e)}i(void 0)})}}function T(){return(T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||M(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||M(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){if(e){if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(e,t)}}function _(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var V=function(e){var t=T({},function(e){if(null==e)throw TypeError("Cannot destructure "+e);return e}(e)),n=(0,F.EL)().t,r=I((0,c.useState)(!1),2),o=r[0],a=r[1],i=I((0,c.useState)(""),2),l=i[0],p=i[1],f=I((0,c.useState)([]),2),d=f[0],m=f[1],y=I((0,c.useState)([]),2),b=y[0],v=y[1],g=I((0,c.useState)(!1),2),C=g[0],x=g[1],S=I((0,c.useState)([]),2),w=S[0],A=S[1],O=(0,s.useAPIClient)();(0,s.useResourceContext)().resource;var E=(0,s.useResourceActionContext)().refresh,P=h.App.useApp().modal,j=(0,s.useDataSource)(),k=(0,c.useCallback)(D(function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,O.resource("dataSources").readTables({values:{dataSourceKey:"main"}})];case 1:return[2,((null==(e=t.sent().data)?void 0:e.data)||[]).map(function(e){return{key:e.name,name:e.name,title:e.title||e.name}})];case 2:return console.error("Failed to fetch selectable tables:",t.sent()),[2,[]];case 3:return[2]}})}),[O]),M=(0,c.useCallback)(D(function(){return _(this,function(e){switch(e.label){case 0:x(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,k()];case 2:return A(e.sent()),m([]),[3,5];case 3:return e.sent(),h.message.error(n("Failed to initialize data")),[3,5];case 4:return x(!1),[7];case 5:return[2]}})}),[k,n]),V=(0,c.useCallback)(function(e,t){p(t)},[]),L=(0,c.useCallback)(function(e){m(e)},[]),K=(0,c.useCallback)(function(e,t){v(R(e).concat(R(t)))},[]),$=(0,c.useCallback)(D(function(){return _(this,function(e){if(0===d.length)return h.message.warning(n("Please select at least one table")),[2];try{x(!0),P.confirm({title:n("Confirm load tables"),content:n("Are you sure you want to load {{count}} table(s)?",{count:d.length}),onOk:D(function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,O.resource("dataSources").loadTables({values:{dataSourceKey:"main",tables:d}})];case 1:return t.sent(),h.message.success(n("Tables loaded successfully")),a(!1),m([]),v([]),p(""),E(),j.reload(),[3,3];case 2:return e=t.sent(),console.error("Failed to load tables:",e),h.message.error(n("Failed to load tables")),[3,3];case 3:return[2]}})})})}catch(e){h.message.error(n("Failed to load tables"))}finally{x(!1)}return[2]})}),[d,O,n,P,E]),B=(0,c.useCallback)(function(){a(!1),m([]),v([]),p("")},[]),N=(0,c.useCallback)(function(){a(!0),M()},[M]),q=(0,c.useMemo)(function(){return l?w.filter(function(e){return e.title.toLowerCase().includes(l.toLowerCase())||e.name.toLowerCase().includes(l.toLowerCase())||e.description&&e.description.toLowerCase().includes(l.toLowerCase())}):w},[w,l]);return u().createElement(u().Fragment,null,u().createElement("div",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({onClick:N},t),n("Load tables from database")),u().createElement(h.Drawer,{title:n("Load tables from database"),placement:"right",onClose:B,open:o,width:800,footer:u().createElement("div",{style:{textAlign:"right"}},u().createElement(h.Button,{onClick:B,style:{marginRight:8}},n("Cancel")),u().createElement(h.Button,{type:"primary",onClick:$,loading:C,disabled:0===d.length},n("Submit")))},u().createElement("div",{style:{height:"calc(100vh - 160px)",display:"flex",flexDirection:"column"}},u().createElement(h.Spin,{spinning:C,style:{height:"100%"}},u().createElement(h.Transfer,{dataSource:q,titles:[n("Available tables"),n("Selected tables")],targetKeys:d,selectedKeys:b,onChange:L,onSelectChange:K,onSearch:V,render:function(e){return e.title},showSearch:!0,style:{height:"100%"},listStyle:{width:350,height:"calc(100vh - 100px)"},locale:{itemUnit:n("item"),itemsUnit:n("items"),searchPlaceholder:n("Search collections...")}})))))};function L(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function K(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){L(a,r,o,i,l,"next",e)}function l(e){L(a,r,o,i,l,"throw",e)}i(void 0)})}}function $(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var B=function(){var e=(0,F.EL)().t,t=(0,s.useAPIClient)(),n=h.App.useApp().modal,r=(0,s.useDataSource)();return u().createElement(h.Dropdown,{menu:{items:[{key:"load-tables",label:u().createElement(V,null),icon:u().createElement(P.ImportOutlined,null)},{key:"sync-fields",label:e("Sync field changes from database"),icon:u().createElement(P.ReloadOutlined,null),onClick:K(function(){return $(this,function(o){return n.confirm({title:e("Sync field changes from database"),content:e("Field synchronization confirmation prompt"),onOk:K(function(){return $(this,function(n){switch(n.label){case 0:return[4,t.resource("mainDataSource").syncFields()];case 1:return n.sent(),r.reload(),h.message.success(e("Sync successfully")),[2]}})})}),[2]})})}]},placement:"bottomLeft"},u().createElement(h.Button,{icon:u().createElement(P.SyncOutlined,null)},e("Sync from database")))};function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function q(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function G(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){q(a,r,o,i,l,"next",e)}function l(e){q(a,r,o,i,l,"throw",e)}i(void 0)})}}function U(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var z=function(e,t){return function(n,r){n.loading=!0,e(n,r,t).then(d.action.bound(function(e){n.dataSource=e,n.loading=!1})).catch(console.error)}},Q=function(){var e,t=(e=(0,c.useState)([]),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,2)||function(e,t){if(e){if("string"==typeof e)return N(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return[t[0],t[1]]},Z=function(){var e=(0,s.useRecord)(),t=(0,f.useForm)();return{run:function(){return G(function(){var n,r,o,a;return U(this,function(i){return a=null==(o=t.values)||null==(r=o.children)||null==(n=r.slice)?void 0:n.call(r),t.setValuesIn("children",a.filter(function(t){return t.name!==e.name})),[2]})})()}}},H=function(){return{run:function(){return G(function(){return U(this,function(e){return[2]})})()}}},J=function(){var e=(0,s.useRecord)(),t=(0,s.useCollectionManager_deprecated)().getCollectionFields;return e.__parent&&"subTable"===e.__parent.interface?(0,c.useContext)(s.DataSourceContext_deprecated).dataSource:t(e.collectionName||e.name)},W=function(e){return"".concat(e||"").concat((0,l.uid)())},X=function(){var e,t,n,r,o,a=(0,y.useTranslation)().t,i=(0,s.useCollectionManager_deprecated)(),l=i.interfaces,p=i.getCollections,d=i.getCollection,h=((0,s.useCurrentAppInfo)()||{data:{database:{}}}).data.database,v=(0,c.useContext)(s.CollectionCategoriesContext),g=(0,s.useAPIClient)(),C=g.resource("dbViews"),x=(0,s.useCompile)();(0,f.useForm)();var w=(0,s.useApp)(),A=(0,c.useContext)(s.ResourceActionContext),O=(e=G(function(e,t,n){var r,o,a;return U(this,function(i){return o=t.targetScope,a=(null==(r=e.props)?void 0:r.name)==="inherits",[2,p().filter(function(t){if((null==n?void 0:n.includes(t.template))||t.autoCreate&&t.isThrough||a&&"view"===t.template||"target"===e.props.name&&Array.isArray(t.filterTargetKey)&&t.filterTargetKey.length>1)return!1;var r,i=!(null==o?void 0:o.template)||o.template.includes(t.template),l=!(null==o?void 0:o[null==(r=e.props)?void 0:r.name])||o[e.props.name].includes(t.name);return i&&l}).map(function(e){return{label:x(e.title),value:e.name}})]})}),function(t,n,r){return e.apply(this,arguments)}),P=(t=G(function(){return U(this,function(e){return[2,v.data.map(function(e){return{label:x(e.name),value:e.id}})]})}),function(){return t.apply(this,arguments)}),F=(n=G(function(){return U(this,function(e){return[2,C.list().then(function(e){var t,n=e.data;return null==n||null==(t=n.data)?void 0:t.map(function(e){var t=e.schema;return{label:t?"".concat(t,".").concat(x(e.name)):e.name,value:t?"".concat(t,"@").concat(e.name):e.name}})})]})}),function(){return n.apply(this,arguments)}),j=(r=G(function(e){var t,n,r;return U(this,function(o){return n=(t=e.form.values).name,r=t.fields,[2,Promise.resolve({data:(d(n)||{}).fields||r}).then(function(e){var t;return null==(t=e.data.filter(function(e){return!!e.interface&&!!w.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface).titleUsable}))?void 0:t.map(function(e){var t;return{label:x(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})})]})}),function(e){return r.apply(this,arguments)}),k=(o=G(function(){return U(this,function(e){return[2,g.resource("storages").list().then(function(e){var t,n=e.data;return null==n||null==(t=n.data)?void 0:t.map(function(e){return{label:a(x(e.title)),value:e.name}})})]})}),function(){return o.apply(this,arguments)}),D=(0,c.useContext)(s.SchemaComponentContext),T=(0,c.useMemo)(function(){var e,t;return e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},D),t=t={designable:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e},[D]);return u().createElement(s.SchemaComponentContext.Provider,{value:T},u().createElement(s.SchemaComponent,{schema:S,components:{AddSubFieldAction:s.AddSubFieldAction,EditSubFieldAction:s.EditSubFieldAction,FieldSummary:s.FieldSummary,TemplateSummay:s.TemplateSummary,CollectionFields:b.f,SyncFromDatabaseAction:B},scope:{loadFilterTargetKeys:j,useDestroySubField:Z,useBulkDestroySubField:H,useSelectedRowKeys:Q,useAsyncDataSource:z,loadCollections:O,loadCategories:P,loadDBViews:F,loadStorages:k,useCurrentFields:J,useNewId:W,useCancelAction:s.useCancelAction,interfaces:l,enableInherits:(null==h?void 0:h.dialect)==="postgres",isPG:(null==h?void 0:h.dialect)==="postgres",getPickerFormat:m.getPickerFormat,useRefreshActionProps:function(){return(0,E.useDataSourceRefresh)({dataSourceName:"main",onSuccess:function(){var e;null==A||null==(e=A.refresh)||e.call(A)}})}}}))},Y=n(948),ee=n(467),et=n.n(ee),en=n(329);function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function ea(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){eo(a,r,o,i,l,"next",e)}function l(e){eo(a,r,o,i,l,"throw",e)}i(void 0)})}}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ei(e,t,n[t])})}return e}function ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return er(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return er(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eu(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function es(e){var t=(0,Y.useDraggable)({id:e.id,data:e.data}),n=t.attributes,r=t.listeners,o=t.setNodeRef;return u().createElement("div",el({ref:o},r,n),u().createElement("div",null,e.children))}function ep(e){var t=(0,Y.useDroppable)({id:e.id,data:e.data}),n=t.isOver,r=t.setNodeRef;return u().createElement("div",{ref:r,style:n?{color:"green"}:void 0},e.children)}var ef=(0,f.observer)(function(e){var t=e.item;return u().createElement(ep,{id:t.id.toString(),data:t},u().createElement("div",null,u().createElement(es,{id:t.id.toString(),data:t},u().createElement(ed,{item:t}))))},{displayName:"TabTitle"}),ed=function(e){var t=e.item,n=(0,y.useTranslation)().t,r=(0,s.useCompile)();return u().createElement(h.Space,null,u().createElement(h.Badge,{color:t.color}),n(r(t.name)))},em=(0,f.observer)(function(e){var t,n=ec((0,c.useState)(null),2),r=n[0],o=n[1],a=(0,c.useContext)(s.CollectionCategoriesContext).refresh,i=(0,s.useResourceActionContext)().refresh,l=(0,s.useAPIClient)(),p=(t=ea(function(e){var t,n;return eu(this,function(r){switch(r.label){case 0:if(t=e.active,n=e.over,setTimeout(function(){o(null)}),!(n&&n.id!==t.id))return[3,4];return[4,l.resource("collectionCategories").move({sourceId:t.id,targetId:n.id})];case 1:return r.sent(),[4,a()];case 2:return r.sent(),[4,i()];case 3:r.sent(),r.label=4;case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),f=(0,Y.useSensor)(Y.MouseSensor,{activationConstraint:{distance:10}}),d=(0,Y.useSensors)(f);return u().createElement(Y.DndContext,{sensors:d,onDragEnd:p,onDragStart:function(e){var t;o(null==(t=e.active)?void 0:t.data.current)}},e.children,u().createElement(Y.DragOverlay,null,r?u().createElement("span",{style:{whiteSpace:"nowrap"}},u().createElement(ed,{item:r})):null))},{displayName:"DndProvider"}),ey=function(){var e,t=(0,y.useTranslation)().t,n=(0,c.useContext)(s.CollectionCategoriesContext),r=n.data,o=n.refresh,a=(0,s.useResourceActionContext)(),i=a.refresh,p=a.run,d=a.defaultRequest,m=a.setState,v=ec((0,c.useState)({tab:"all"}),2),g=v[0],C=v[1],x=ec((0,c.useState)(g.tab),2),S=x[0],A=x[1],O=(0,s.useCompile)(),E=(0,s.useAPIClient)(),F=h.App.useApp().modal,j=(0,c.useMemo)(function(){if(!r)return[];var e=r.sort(function(e,t){return t.sort-e.sort}).concat().map(function(e){var t,n;return t=el({},e),n=n={schema:w},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t});return e.find(function(e){return"all"===e.id})||e.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:w}),e},[r]);(0,c.useEffect)(function(){"all"!==g.tab&&k(g.tab)},[]);var k=function(e){if(C({tab:e}),A((0,l.uid)()),"all"!==e){var t,n={$and:[null==d||null==(t=d.params)?void 0:t.filter,{"category.id":e}]};p({filter:n}),null==m||m({category:[+e],params:[{filter:n}]})}else p(),null==m||m({category:[],params:[]})},D=function(e){F.confirm({title:O("{{t('Delete category')}}"),content:O("{{t('Are you sure you want to delete it?')}}"),onOk:ea(function(){return eu(this,function(t){switch(t.label){case 0:return[4,E.resource("collectionCategories").destroy({filter:{id:e}})];case 1:return t.sent(),e===+g.tab&&C({tab:"all"}),[4,o()];case 2:return t.sent(),[4,i()];case 3:return t.sent(),[2]}})})})},T=(e=ea(function(){return eu(this,function(e){return[2,r.map(function(e){return{label:t(O(e.name)),value:e.id}})]})}),function(){return e.apply(this,arguments)}),I=et().memoize(function(e){return{items:[{key:"edit",label:u().createElement(s.SchemaComponent,{schema:{type:"void",properties:ei({},(0,l.uid)(),{"x-component":"EditCategory","x-component-props":{item:e}})}})},{key:"delete",label:O("{{t('Delete category')}}"),onClick:function(){return D(e.id)}}]}});return r?u().createElement(em,null,u().createElement(h.Tabs,{addIcon:u().createElement(s.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:k,defaultActiveKey:g.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:j.map(function(e){return{label:"all"!==e.id?u().createElement("div",{"data-no-dnd":"true"},u().createElement(ef,{item:e})):O(e.name),key:String(e.id),closable:e.closable,closeIcon:u().createElement(h.Dropdown,{menu:I(e)},u().createElement(P.MenuOutlined,{role:"button","aria-label":O(e.name),style:{padding:8,margin:"-8px"}})),children:u().createElement(h.Card,{bordered:!1},u().createElement(s.SchemaComponentOptions,{components:{CollectionFields:b.f,ExtendableActions:eb},inherit:!0,scope:{loadCategories:T,categoryVisible:"all"===e.id,categoryId:e.id}},u().createElement(f.RecursionField,{name:S,schema:e.schema,onlyRenderProperties:!0})))}})})):null},eb=function(){var e=(0,s.usePlugin)(en.default).extensionManager.getManagerActions();return(null==e?void 0:e.length)?u().createElement("div",{style:{margin:"0px 8px"}},et().sortBy(e,"order").map(function(e,t){return u().createElement(e.component,{key:t})})):u().createElement(u().Fragment,null)};function eh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ev(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function eg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var eC=function(){var e=(0,f.useForm)(),t=(0,s.useActionContext)(),n=(0,c.useContext)(s.CollectionCategoriesContext).refresh,r=(0,s.useAPIClient)();return{run:function(){var o;return(o=function(){var o;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){switch(a.label){case 0:return[4,e.submit()];case 1:return a.sent(),o=(0,ee.cloneDeep)(e.values),[4,r.resource("collectionCategories").create({values:eg({},o)})];case 2:return a.sent(),t.setVisible(!1),[4,e.reset()];case 3:return a.sent(),[4,n()];case 4:return a.sent(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){ev(a,n,r,i,l,"next",e)}function l(e){ev(a,n,r,i,l,"throw",e)}i(void 0)})})()}}},ex=function(e){return u().createElement(eS,e)},eS=function(e){var t,n=e.scope,r=e.getContainer,o=e.children,a=(t=(0,c.useState)(!1),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return eh(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eh(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=a[0],l=a[1],p=(0,y.useTranslation)().t;return u().createElement(s.ActionContextProvider,{value:{visible:i,setVisible:l}},u().createElement("div",{onClick:function(){return l(!0)},title:p("Add category")},o||u().createElement(P.PlusOutlined,null)),u().createElement(s.SchemaComponent,{schema:A,components:{CollectionCategory:s.CollectionCategory,CollectionTemplateTag:s.CollectionTemplateTag},scope:eg({getContainer:r,useCancelAction:s.useCancelAction,createOnly:!0,useCreateCategry:eC},n)}))};function ew(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eA(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function eO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var eE=function(){var e=(0,f.useForm)(),t=(0,s.useActionContext)(),n=(0,c.useContext)(s.CollectionCategoriesContext).refresh,r=(0,s.useResourceActionContext)().refresh,o=(0,s.useAPIClient)(),a=(0,s.useRecord)().id;return{run:function(){var i;return(i=function(){var i;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){var c=[a,l];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:return[4,e.submit()];case 1:return l.sent(),i=(0,ee.cloneDeep)(e.values),[4,o.resource("collectionCategories").update({filter:{id:a},values:eO({},i)})];case 2:return l.sent(),t.setVisible(!1),[4,e.reset()];case 3:return l.sent(),[4,n()];case 4:return l.sent(),[4,r()];case 5:return l.sent(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function a(e){eA(o,n,r,a,l,"next",e)}function l(e){eA(o,n,r,a,l,"throw",e)}a(void 0)})})()}}},eP=function(e){var t,n,r=(0,s.useRecord)(),o=(0,s.useRequest)(function(){return Promise.resolve({data:(0,ee.cloneDeep)(r)})},(t=eO({},e),n=n={manual:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)),a=(0,s.useActionContext)();return(0,c.useEffect)(function(){a.visible&&o.run()},[a.visible]),o},eF=function(e){return u().createElement(ej,e)},ej=function(e){var t,n=e.scope,r=e.getContainer,o=e.item,a=e.children,i=(t=(0,c.useState)(!1),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return ew(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ew(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=i[0],p=i[1],f=(0,s.useCompile)();return u().createElement(s.RecordProvider,{record:o},u().createElement(s.ActionContextProvider,{value:{visible:l,setVisible:p}},u().createElement(u().Fragment,null,a||u().createElement("span",{onClick:function(){return p(!0)}},f('{{ t("Edit category") }}'))),u().createElement(s.SchemaComponent,{schema:O,scope:eO({getContainer:r,useCancelAction:s.useCancelAction,createOnly:!0,useEditCategry:eE,useValuesFromRecord:eP},n)})))};(0,p.registerValidateFormats)({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});var ek={type:"object",properties:(r={},o=(0,l.uid)(),a={"x-component":"ConfigurationTable"},o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)},eD=function(){return u().createElement(s.SchemaComponent,{schema:ek,components:{CollectionCategoriesProvider:s.CollectionCategoriesProvider,ConfigurationTable:X,ConfigurationTabs:ey,AddFieldAction:s.AddFieldAction,AddCollectionField:s.AddCollectionField,AddCollection:s.AddCollection,AddCollectionAction:s.AddCollectionAction,AddCategoryAction:eS,AddCategory:ex,EditCollection:s.EditCollection,EditCollectionAction:s.EditCollectionAction,DeleteCollection:s.DeleteCollection,DeleteCollectionAction:s.DeleteCollectionAction,EditFieldAction:s.EditFieldAction,EditCollectionField:s.EditCollectionField,OverridingCollectionField:s.OverridingCollectionField,OverridingFieldAction:s.OverridingFieldAction,ViewCollectionField:s.ViewCollectionField,ViewFieldAction:s.ViewFieldAction,EditCategory:eF,EditCategoryAction:ej,SyncFieldsAction:s.SyncFieldsAction,SyncFieldsActionCom:s.SyncFieldsActionCom,SyncSQLFieldsAction:s.SyncSQLFieldsAction}})}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["236"],{612:function(e,t,r){r.r(t),r.d(t,{DataSourceContext:function(){return l},DatabaseConnectionProvider:function(){return i}});var n=r(772),a=r(156),o=r.n(a),u=r(241);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var l=(0,a.createContext)(null);l.displayName="DataSourceContext";var i=function(e){var t,r=(t=(0,a.useState)(null),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,c=!1;try{for(a=a.call(e);!(u=(r=a.next()).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(e){c=!0,n=e}finally{try{u||null==a.return||a.return()}finally{if(c)throw n}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return c(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=r[0],s=r[1];return o().createElement(l.Provider,{value:{dataSource:i,setDataSource:s}},o().createElement(n.SchemaComponentOptions,{scope:u,components:{}},e.children))}},507:function(e,t,r){r.d(t,{H:function(){return s}});var n=r(505),a=r(772),o=r(721),u=r(156),c=r(238),l=r(612);function i(e,t,r,n,a,o,u){try{var c=e[o](u),l=c.value}catch(e){r(e);return}c.done?t(l):Promise.resolve(l).then(n,a)}var s=function(e){var t=e.dataSourceName,r=e.onSuccess,s=e.onError,f=e.showMessage,b=void 0===f||f,d=(0,c.useTranslation)().t,p=(0,u.useContext)(a.ResourceActionContext),y=(0,a.useAPIClient)(),v=(0,n.useField)(),h=(0,a.useDataSourceManager)(),m=(0,u.useContext)(l.DataSourceContext),g=m.setDataSource,S=m.dataSource;return v.data=v.data||{},{onClick:function(){var e;return(e=function(){var e,n,a,u,c;return function(e,t){var r,n,a,o,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){var l=[o,c];if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return u.label++,{value:l[1],done:!1};case 5:u.label++,n=l[1],l=[0];continue;case 7:l=u.ops.pop(),u.trys.pop();continue;default:if(!(a=(a=u.trys).length>0&&a[a.length-1])&&(6===l[0]||2===l[0])){u=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){u.label=l[1];break}if(6===l[0]&&u.label<a[1]){u.label=a[1],a=l;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(l);break}a[2]&&u.ops.pop(),u.trys.pop();continue}l=t.call(e,u)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:v.data.loading=!0,l.label=1;case 1:return l.trys.push([1,4,,5]),[4,y.request({url:"".concat("main"===t?"mainDataSource":"dataSources",":refresh?filterByTk=").concat(t,"&clientStatus=").concat((null==S?void 0:S.status)||"loaded"),method:"post"})];case 2:var i,f;return a=l.sent().data,v.data.loading=!1,g((i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},null==a?void 0:a.data),f=f={name:t},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(f)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(f)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(f,e))}),i)),(null==a||null==(e=a.data)?void 0:e.status)==="reloading"?b&&o.message.warning(d("Data source synchronization in progress")):(null==a||null==(n=a.data)?void 0:n.status)==="loaded"&&(b&&o.message.success(d("Data source synchronization successful")),null==p||null==(u=p.refresh)||u.call(p)),[4,h.getDataSource(t).reload()];case 3:return l.sent(),null==r||r(),[3,5];case 4:return c=l.sent(),v.data.loading=!1,b&&o.message.error(d("Data source synchronization failed")),null==s||s(c),[3,5];case 5:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(e){i(o,n,a,u,c,"next",e)}function c(e){i(o,n,a,u,c,"throw",e)}u(void 0)})})()},get loading(){return v.data.loading}}}},491:function(e,t,r){r.d(t,{t:function(){return f},u:function(){return s}});var n=r(772),a=r(156);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t,r,n,a,o,u){try{var c=e[o](u),l=c.value}catch(e){r(e);return}c.done?t(l):Promise.resolve(l).then(n,a)}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,c=!1;try{for(a=a.call(e);!(u=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);u=!0);}catch(e){c=!0,n=e}finally{try{u||null==a.return||a.return()}finally{if(c)throw n}}return o}}(e,t)||i(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}}var s=function(e){var t,r,c,s=e.resourceName,f=e.resourceParams,b=e.getParams,d=void 0===b?{}:b,p=e.deps,y=e.enabled,v=void 0===y||y,h=e.onSuccess,m=e.onError,g=(0,n.useAPIClient)(),S=l((0,a.useState)(null),2),w=S[0],O=S[1],P=l((0,a.useState)(!1),2),C=P[0],j=P[1],k=l((0,a.useState)(null),2),D=k[0],x=k[1],A=f?g.resource(s,f):g.resource(s),E=(t=function(){var e,t,r;return function(e,t){var r,n,a,o,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){var l=[o,c];if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return u.label++,{value:l[1],done:!1};case 5:u.label++,n=l[1],l=[0];continue;case 7:l=u.ops.pop(),u.trys.pop();continue;default:if(!(a=(a=u.trys).length>0&&a[a.length-1])&&(6===l[0]||2===l[0])){u=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){u.label=l[1];break}if(6===l[0]&&u.label<a[1]){u.label=a[1],a=l;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(l);break}a[2]&&u.ops.pop(),u.trys.pop();continue}l=t.call(e,u)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:if(!v)return[2];j(!0),x(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,A.get(d)];case 2:return O(t=null==(e=n.sent())?void 0:e.data),null==h||h(t),[3,5];case 3:return x(r=n.sent()),null==m||m(r),console.error("Failed to fetch ".concat(s," data:"),r),[3,5];case 4:return j(!1),[7];case 5:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function c(e){u(o,n,a,c,l,"next",e)}function l(e){u(o,n,a,c,l,"throw",e)}c(void 0)})},function(){return r.apply(this,arguments)});return(0,a.useEffect)(function(){E()},[s,v].concat(function(e){if(Array.isArray(e))return o(e)}(c=void 0===p?[]:p)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(c)||i(c)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),{data:w,loading:C,error:D,refresh:function(){E()}}},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.getParams,n=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,["getParams"]);return s(c({resourceName:"dataSources",resourceParams:e,getParams:c({filterByTk:e},void 0===r?{}:r),deps:[e]},n))}},241:function(e,t,r){r.r(t),r.d(t,{useLoadCollections:function(){return w},useResourceData:function(){return a.u},useCreateDatabaseServer:function(){return g},useTestConnectionAction:function(){return S},useDataSourceData:function(){return a.t},useDataSourceActions:function(){return s},useDataSourceRefresh:function(){return n.H}});var n=r(507),a=r(491),o=r(772),u=r(156);function c(e,t,r,n,a,o,u){try{var c=e[o](u),l=c.value}catch(e){r(e);return}c.done?t(l):Promise.resolve(l).then(n,a)}function l(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(e){c(o,n,a,u,l,"next",e)}function l(e){c(o,n,a,u,l,"throw",e)}u(void 0)})}}function i(e,t){var r,n,a,o,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){var l=[o,c];if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return u.label++,{value:l[1],done:!1};case 5:u.label++,n=l[1],l=[0];continue;case 7:l=u.ops.pop(),u.trys.pop();continue;default:if(!(a=(a=u.trys).length>0&&a[a.length-1])&&(6===l[0]||2===l[0])){u=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){u.label=l[1];break}if(6===l[0]&&u.label<a[1]){u.label=a[1],a=l;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(l);break}a[2]&&u.ops.pop(),u.trys.pop();continue}l=t.call(e,u)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var s=function(){var e,t,r=(0,o.useDataSourceManager)(),n=(0,o.useAPIClient)(),a=(0,o.useResourceActionContext)().data,c=(0,u.useCallback)(function(e){null==e||e.forEach(function(e){r.getDataSource(e.key)})},[r]);return(0,u.useEffect)(function(){(null==a?void 0:a.data)&&c(a.data)},[a,c]),{reloadAllDataSources:(0,u.useCallback)(l(function(){return i(this,function(e){switch(e.label){case 0:return[4,Promise.all(r.getDataSources().map(function(e){return e.reload()}))];case 1:return e.sent(),[2]}})}),[r]),reloadDataSource:(0,u.useCallback)((e=l(function(e){var t;return i(this,function(n){switch(n.label){case 0:if(!(t=r.getDataSource(e)))return[3,2];return[4,t.reload()];case 1:n.sent(),n.label=2;case 2:return[2]}})}),function(t){return e.apply(this,arguments)}),[r]),getDataSourceCollections:(0,u.useCallback)(function(e){var t=r.getDataSource(e);return(null==t?void 0:t.collectionManager.getCollections())||[]},[r]),testConnection:(0,u.useCallback)((t=l(function(e){var t;return i(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,n.request({resource:"dataSources",action:"testConnection",params:{values:{key:e}}})];case 1:return r.sent(),[2,!0];case 2:return t=r.sent(),console.error("Failed to test connection for ".concat(e,":"),t),[2,!1];case 3:return[2]}})}),function(e){return t.apply(this,arguments)}),[n])}},f=r(505),b=r(721),d=r(238),p=r(551);function y(e,t,r,n,a,o,u){try{var c=e[o](u),l=c.value}catch(e){r(e);return}c.done?t(l):Promise.resolve(l).then(n,a)}function v(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(e){y(o,n,a,u,c,"next",e)}function c(e){y(o,n,a,u,c,"throw",e)}u(void 0)})}}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function m(e,t){var r,n,a,o,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){var l=[o,c];if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return u.label++,{value:l[1],done:!1};case 5:u.label++,n=l[1],l=[0];continue;case 7:l=u.ops.pop(),u.trys.pop();continue;default:if(!(a=(a=u.trys).length>0&&a[a.length-1])&&(6===l[0]||2===l[0])){u=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){u.label=l[1];break}if(6===l[0]&&u.label<a[1]){u.label=a[1],a=l;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(l);break}a[2]&&u.ops.pop(),u.trys.pop();continue}l=t.call(e,u)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var g=function(e){var t=(0,f.useForm)(),r=(0,o.useActionContext)(),n=(0,o.useAPIClient)(),a=(0,d.useTranslation)().t,u=(0,f.useField)();return u.data=u.data||{},{run:function(){return v(function(){var o,c;return m(this,function(l){switch(l.label){case 0:return[4,t.submit()];case 1:l.sent(),l.label=2;case 2:return l.trys.push([2,5,,6]),u.data.loading=!0,[4,n.resource("databaseServers").create({values:h({},t.values)})];case 3:return o=l.sent().data,u.data.loading=!1,r.setVisible(!1),[4,t.reset()];case 4:return l.sent(),null==e||e(null==o?void 0:o.data),b.message.success(a("Saved successfully")),[3,6];case 5:return c=l.sent(),u.data.loading=!1,console.log(c),[3,6];case 6:return[2]}})})()}}},S=function(){var e=(0,f.useForm)(),t=(0,o.useAPIClient)(),r=(0,d.useTranslation)().t,n=(0,f.useField)();return n.data=n.data||{},{run:function(){return v(function(){var a;return m(this,function(o){switch(o.label){case 0:return[4,e.submit()];case 1:o.sent(),o.label=2;case 2:return o.trys.push([2,4,,5]),n.data.loading=!0,[4,t.resource("dataSources").testConnection({values:h({},e.values)})];case 3:return o.sent(),n.data.loading=!1,b.message.success(r("Connection successful",{ns:p.A7})),[3,5];case 4:return a=o.sent(),n.data.loading=!1,console.log(a),[3,5];case 5:return[2]}})})()}}},w=function(){var e,t=(0,o.useAPIClient)();return e=v(function(e){return m(this,function(r){switch(r.label){case 0:return[4,t.resource("dataSources").readTables({values:{dataSourceKey:e}})];case 1:return[2,r.sent().data]}})}),function(t){return e.apply(this,arguments)}}}}]);
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
export * from './useDataSourceRefresh';
|
|
10
|
+
export * from './useResourceData';
|
|
11
|
+
export * from './useDataSourceActions';
|
|
9
12
|
export declare const useCreateDatabaseServer: (handleDataServerChange: any) => {
|
|
10
13
|
run(): Promise<void>;
|
|
11
14
|
};
|
|
@@ -13,7 +16,3 @@ export declare const useTestConnectionAction: () => {
|
|
|
13
16
|
run(): Promise<void>;
|
|
14
17
|
};
|
|
15
18
|
export declare const useLoadCollections: () => (key: any) => Promise<any>;
|
|
16
|
-
export declare const addDatasourceCollections: (api: any, filterByTk: any, options: {
|
|
17
|
-
collections;
|
|
18
|
-
dbOptions;
|
|
19
|
-
}) => Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useDataSourceActions: () => {
|
|
10
|
+
reloadAllDataSources: () => Promise<void>;
|
|
11
|
+
reloadDataSource: (key: string) => Promise<void>;
|
|
12
|
+
getDataSourceCollections: (key: string) => import("@nocobase/client").Collection[];
|
|
13
|
+
testConnection: (key: string) => Promise<boolean>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export interface UseDataSourceRefreshOptions {
|
|
10
|
+
dataSourceName: string;
|
|
11
|
+
onSuccess?: () => void;
|
|
12
|
+
onError?: (error: any) => void;
|
|
13
|
+
showMessage?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const useDataSourceRefresh: (options: UseDataSourceRefreshOptions) => {
|
|
16
|
+
onClick(): Promise<void>;
|
|
17
|
+
readonly loading: any;
|
|
18
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export interface UseResourceDataOptions {
|
|
10
|
+
resourceName: string;
|
|
11
|
+
resourceParams?: string | string[];
|
|
12
|
+
getParams?: Record<string, any>;
|
|
13
|
+
deps?: any[];
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
onSuccess?: (data: any) => void;
|
|
16
|
+
onError?: (error: any) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const useResourceData: (options: UseResourceDataOptions) => {
|
|
19
|
+
data: any;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: any;
|
|
22
|
+
refresh: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const useDataSourceData: (dataSourceName: string, options?: Omit<UseResourceDataOptions, 'resourceName' | 'resourceParams' | 'getParams'> & {
|
|
25
|
+
getParams?: Record<string, any>;
|
|
26
|
+
}) => {
|
|
27
|
+
data: any;
|
|
28
|
+
loading: boolean;
|
|
29
|
+
error: any;
|
|
30
|
+
refresh: () => void;
|
|
31
|
+
};
|
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("@formily/core"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("lodash"),require("@nocobase/plugin-acl/client"),require("@formily/shared"),require("@nocobase/client"),require("react-router-dom"),require("@dnd-kit/core"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("antd-style"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["@formily/core","@formily/antd-v5","react","@emotion/css","lodash","@nocobase/plugin-acl/client","@formily/shared","@nocobase/client","react-router-dom","@dnd-kit/core","@formily/reactive","@formily/react","@nocobase/utils/client","@ant-design/icons","antd","antd-style","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@emotion/css"),require("lodash"),require("@nocobase/plugin-acl/client"),require("@formily/shared"),require("@nocobase/client"),require("react-router-dom"),require("@dnd-kit/core"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("antd-style"),require("react-i18next")):e["@nocobase/plugin-data-source-manager"]=t(e["@formily/core"],e["@formily/antd-v5"],e.react,e["@emotion/css"],e.lodash,e["@nocobase/plugin-acl/client"],e["@formily/shared"],e["@nocobase/client"],e["react-router-dom"],e["@dnd-kit/core"],e["@formily/reactive"],e["@formily/react"],e["@nocobase/utils/client"],e["@ant-design/icons"],e.antd,e["antd-style"],e["react-i18next"])}(self,function(e,t,n,r,o,i,a,c,u,s,l,f,p,d,b,y,m){return function(){var g,h,v,_,w,O,P={329:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return A}});var r=n(772),o=n(465),i=n.n(o),a=n(584),c=n(156),u=n.n(c),s=n(347),l=n(551),f=n(581);function p(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,c,"next",e)}function c(e){p(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function y(e,t,n){return(y=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=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 y(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function P(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var S=(0,r.lazy)(function(){return f("imported_174m4o3_component",n.e("539").then(n.bind(n,612)))},"DatabaseConnectionProvider").DatabaseConnectionProvider,x=(0,r.lazy)(function(){return f("imported_-1bdhn46_component",n.e("65").then(n.bind(n,130)))},"BreadcumbTitle").BreadcumbTitle,k=(0,r.lazy)(function(){return f("imported_l1a36j_component",Promise.all([n.e("398"),n.e("10")]).then(n.bind(n,645)))},"CollectionManagerPage").CollectionManagerPage,j=(0,r.lazy)(function(){return f("imported_k8ts4l_component",n.e("296").then(n.bind(n,919)))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,q=(0,r.lazy)(function(){return f("imported_1cub3nb_component",Promise.all([n.e("398"),n.e("926")]).then(n.bind(n,93)))},"MainDataSourceManager").MainDataSourceManager,C=(0,r.lazy)(function(){return f("imported_-1b29440_component",n.e("674").then(n.bind(n,937)))},"DataSourcePermissionManager").DataSourcePermissionManager,M=(0,r.lazy)(function(){return f("imported_cef22q_component",n.e("746").then(n.bind(n,62)))},"CollectionMainProvider").CollectionMainProvider,T=function(){function e(t){b(this,e),h(this,"plugin",void 0),h(this,"componentRegistry",void 0),this.plugin=t,this.componentRegistry=new a.Registry}return g(e,[{key:"registerManagerAction",value:function(e){var t=e.order,n=e.component,r="managerAction";this.componentRegistry.get(r)||this.componentRegistry.register(r,[]),this.componentRegistry.get(r).push({order:null!=t?t:0,component:n})}},{key:"getManagerActions",value:function(){var e;return null!=(e=this.componentRegistry.get("managerAction"))?e:[]}}]),e}(),A=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,r;return b(this,t),n=t,r=arguments,n=v(n),h(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(n,r||[],v(this).constructor):n.apply(this,r)),"types",new Map),h(e,"extensionManager",new T(e)),h(e,"extendedTabs",{}),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_(t,e),g(t,[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,a.uid)()]=e}},{key:"load",value:function(){var e=this;return d(function(){return P(this,function(t){return e.app.pm.get(i()).settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"dataSource",label:t("Data sources"),sort:15,children:u().createElement(n,null,u().createElement(C,{role:r}))}}),e.app.use(S),e.app.pluginSettingsManager.add(l.A7,{title:'{{t("Data sources", { ns: "'.concat(l.A7,'" })}}'),icon:"ClusterOutlined",isPinned:!0,sort:100,showTabs:!1,aclSnippet:"pm.data-source-manager*"}),e.app.pluginSettingsManager.add("".concat(l.A7,".list"),{title:'{{t("Data sources", { ns: "'.concat(l.A7,'" })}}'),Component:j,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(l.A7,"/:name"),{title:u().createElement(x,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(l.A7,"/main"),{title:u().createElement(x,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:M}),e.app.pluginSettingsManager.add("".concat(l.A7,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(l.A7,'" })}}'),Component:q,topLevelName:"".concat(l.A7,"/main"),pluginKey:l.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.pluginSettingsManager.add("".concat(l.A7,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(l.A7,'" })}}'),Component:k,topLevelName:"".concat(l.A7,"/:name"),pluginKey:l.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.dataSourceManager.addDataSources(e.getThirdDataSource.bind(e),s.F),[2]})})()}},{key:"setDataSources",value:function(){var e=this;return d(function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}})];case 1:return[2,null==(n=r.sent())||null==(t=n.data)?void 0:t.data]}})})()}},{key:"getThirdDataSource",value:function(){var e=this;return d(function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}})];case 1:return[2,null==(n=r.sent())||null==(t=n.data)?void 0:t.data]}})})()}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}]),t}(w(r.Plugin));t.default=A},347:function(e,t,n){"use strict";n.d(t,{F:function(){return u}});var r=n(772);function o(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var t;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=i(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],i(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&a(n,e),t=[{key:"getDataSource",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,t.app.apiClient.request({url:"dataSources:get/".concat(t.key),params:{appends:["collections"]}})];case 1:return[2,e.sent().data.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function c(e){o(a,r,i,c,u,"next",e)}function u(e){o(a,r,i,c,u,"throw",e)}c(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.DataSource)},551:function(e,t,n){"use strict";n.d(t,{A7:function(){return i},EL:function(){return c},KQ:function(){return a}});var r=n(772),o=n(238),i="data-source-manager";function a(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),n=n={ns:i},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function c(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=d},948:function(e){"use strict";e.exports=s},964:function(e){"use strict";e.exports=r},632:function(e){"use strict";e.exports=t},563:function(t){"use strict";t.exports=e},505:function(e){"use strict";e.exports=f},229:function(e){"use strict";e.exports=l},875:function(e){"use strict";e.exports=a},772:function(e){"use strict";e.exports=c},465:function(e){"use strict";e.exports=i},584:function(e){"use strict";e.exports=p},721:function(e){"use strict";e.exports=b},933:function(e){"use strict";e.exports=y},467:function(e){"use strict";e.exports=o},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=m},128:function(e){"use strict";e.exports=u}},S={};function x(e){var t=S[e];if(void 0!==t)return t.exports;var n=S[e]={exports:{}};return P[e](n,n.exports,x),n.exports}return x.m=P,x.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return x.d(t,{a:t}),t},x.d=function(e,t){for(var n in t)x.o(t,n)&&!x.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},x.f={},x.e=function(e){return Promise.all(Object.keys(x.f).reduce(function(t,n){return x.f[n](e,t),t},[]))},x.u=function(e){return""+({10:"7b6cb59b157f5087",296:"cc4271412c5e6495",398:"cab6d8ac1e107ea5",539:"9aff90e19fbd41b6",65:"0e6cf640dde183c8",674:"276bcf3de74bebd1",746:"1a8cce8035a89dd9",926:"b3873b8560b4de87"})[e]+".js"},x.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),x.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g={},h="@nocobase/plugin-data-source-manager:",x.l=function(e,t,n,r){if(g[e])return void g[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==h+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,x.nc&&o.setAttribute("nonce",x.nc),o.setAttribute("data-webpack",h+n),o.src=e),g[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var r=g[e];if(delete g[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},x.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(v=window.__nocobase_public_path__||"/").endsWith("/")||(v+="/"),x.p=v+"static/plugins/@nocobase/plugin-data-source-manager/dist/client/",_={909:0},x.f.j=function(e,t){var n=x.o(_,e)?_[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=_[e]=[t,r]});t.push(n[2]=r);var o=x.p+x.u(e),i=Error();x.l(o,function(t){if(x.o(_,e)&&(0!==(n=_[e])&&(_[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},w=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==_[e]})){for(n in i)x.o(i,n)&&(x.m[n]=i[n]);a&&a(x)}for(e&&e(t);c<o.length;c++)r=o[c],x.o(_,r)&&_[r]&&_[r][0](),_[r]=0},(O=self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).forEach(w.bind(null,0)),O.push=w.bind(null,O.push.bind(O)),x(329)}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@emotion/css"),require("lodash"),require("@nocobase/plugin-acl/client"),require("@formily/shared"),require("@nocobase/client"),require("react-router-dom"),require("@dnd-kit/core"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd-style"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["@formily/core","@formily/antd-v5","react","@nocobase/flow-engine","@emotion/css","lodash","@nocobase/plugin-acl/client","@formily/shared","@nocobase/client","react-router-dom","@dnd-kit/core","@formily/reactive","@formily/react","@nocobase/utils/client","@ant-design/icons","antd-style","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("@formily/core"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@emotion/css"),require("lodash"),require("@nocobase/plugin-acl/client"),require("@formily/shared"),require("@nocobase/client"),require("react-router-dom"),require("@dnd-kit/core"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd-style"),require("antd"),require("react-i18next")):e["@nocobase/plugin-data-source-manager"]=t(e["@formily/core"],e["@formily/antd-v5"],e.react,e["@nocobase/flow-engine"],e["@emotion/css"],e.lodash,e["@nocobase/plugin-acl/client"],e["@formily/shared"],e["@nocobase/client"],e["react-router-dom"],e["@dnd-kit/core"],e["@formily/reactive"],e["@formily/react"],e["@nocobase/utils/client"],e["@ant-design/icons"],e["antd-style"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,a,c,u,s,l,f,p,d,b,y,m,g){return function(){var h,v,w,_,O,P,S={329:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return A}});var r=n(772),o=n(465),i=n.n(o),a=n(584),c=n(156),u=n.n(c),s=n(347),l=n(551),f=n(581);function p(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,c,"next",e)}function c(e){p(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function y(e,t,n){return(y=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&w(o,n.prototype),o}).apply(null,arguments)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=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 y(e,arguments,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function P(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var S=(0,r.lazy)(function(){return f("imported_174m4o3_component",n.e("236").then(n.bind(n,612)))},"DatabaseConnectionProvider").DatabaseConnectionProvider,x=(0,r.lazy)(function(){return f("imported_-1bdhn46_component",Promise.all([n.e("236"),n.e("65")]).then(n.bind(n,130)))},"BreadcumbTitle").BreadcumbTitle,k=(0,r.lazy)(function(){return f("imported_l1a36j_component",Promise.all([n.e("236"),n.e("398"),n.e("10")]).then(n.bind(n,645)))},"CollectionManagerPage").CollectionManagerPage,j=(0,r.lazy)(function(){return f("imported_k8ts4l_component",Promise.all([n.e("236"),n.e("296")]).then(n.bind(n,919)))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,q=(0,r.lazy)(function(){return f("imported_1cub3nb_component",Promise.all([n.e("236"),n.e("398"),n.e("843")]).then(n.bind(n,439)))},"MainDataSourceManager").MainDataSourceManager,C=(0,r.lazy)(function(){return f("imported_-1b29440_component",n.e("674").then(n.bind(n,937)))},"DataSourcePermissionManager").DataSourcePermissionManager,M=(0,r.lazy)(function(){return f("imported_cef22q_component",n.e("746").then(n.bind(n,93)))},"CollectionMainProvider").CollectionMainProvider,T=function(){function e(t){b(this,e),h(this,"plugin",void 0),h(this,"componentRegistry",void 0),this.plugin=t,this.componentRegistry=new a.Registry}return g(e,[{key:"registerManagerAction",value:function(e){var t=e.order,n=e.component,r="managerAction";this.componentRegistry.get(r)||this.componentRegistry.register(r,[]),this.componentRegistry.get(r).push({order:null!=t?t:0,component:n})}},{key:"getManagerActions",value:function(){var e;return null!=(e=this.componentRegistry.get("managerAction"))?e:[]}}]),e}(),A=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,r;return b(this,t),n=t,r=arguments,n=v(n),h(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(n,r||[],v(this).constructor):n.apply(this,r)),"types",new Map),h(e,"extensionManager",new T(e)),h(e,"extendedTabs",{}),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e),g(t,[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,a.uid)()]=e}},{key:"load",value:function(){var e=this;return d(function(){return P(this,function(t){return e.app.pm.get(i()).settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"dataSource",label:t("Data sources"),sort:15,children:u().createElement(n,null,u().createElement(C,{role:r}))}}),e.app.use(S),e.app.pluginSettingsManager.add(l.A7,{title:'{{t("Data sources", { ns: "'.concat(l.A7,'" })}}'),icon:"ClusterOutlined",isPinned:!0,sort:100,showTabs:!1,aclSnippet:"pm.data-source-manager*"}),e.app.pluginSettingsManager.add("".concat(l.A7,".list"),{title:'{{t("Data sources", { ns: "'.concat(l.A7,'" })}}'),Component:j,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(l.A7,"/:name"),{title:u().createElement(x,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(l.A7,"/main"),{title:u().createElement(x,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:M}),e.app.pluginSettingsManager.add("".concat(l.A7,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(l.A7,'" })}}'),Component:q,topLevelName:"".concat(l.A7,"/main"),pluginKey:l.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.pluginSettingsManager.add("".concat(l.A7,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(l.A7,'" })}}'),Component:k,topLevelName:"".concat(l.A7,"/:name"),pluginKey:l.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.dataSourceManager.addDataSources(e.getThirdDataSource.bind(e),s.F),[2]})})()}},{key:"setDataSources",value:function(){var e=this;return d(function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}})];case 1:return[2,null==(n=r.sent())||null==(t=n.data)?void 0:t.data]}})})()}},{key:"getThirdDataSource",value:function(){var e=this;return d(function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}})];case 1:return[2,null==(n=r.sent())||null==(t=n.data)?void 0:t.data]}})})()}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}]),t}(_(r.Plugin));t.default=A},347:function(e,t,n){"use strict";n.d(t,{F:function(){return u}});var r=n(772);function o(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var t;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=i(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],i(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&a(n,e),t=[{key:"getDataSource",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,t.app.apiClient.request({url:"dataSources:get/".concat(t.key),params:{appends:["collections"]}})];case 1:return[2,e.sent().data.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function c(e){o(a,r,i,c,u,"next",e)}function u(e){o(a,r,i,c,u,"throw",e)}c(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.DataSource)},551:function(e,t,n){"use strict";n.d(t,{A7:function(){return i},EL:function(){return c},KQ:function(){return a}});var r=n(772),o=n(238),i="data-source-manager";function a(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),n=n={ns:i},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function c(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=b},948:function(e){"use strict";e.exports=l},964:function(e){"use strict";e.exports=o},632:function(e){"use strict";e.exports=t},563:function(t){"use strict";t.exports=e},505:function(e){"use strict";e.exports=p},229:function(e){"use strict";e.exports=f},875:function(e){"use strict";e.exports=c},772:function(e){"use strict";e.exports=u},667:function(e){"use strict";e.exports=r},465:function(e){"use strict";e.exports=a},584:function(e){"use strict";e.exports=d},721:function(e){"use strict";e.exports=m},933:function(e){"use strict";e.exports=y},467:function(e){"use strict";e.exports=i},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=g},128:function(e){"use strict";e.exports=s}},x={};function k(e){var t=x[e];if(void 0!==t)return t.exports;var n=x[e]={exports:{}};return S[e](n,n.exports,k),n.exports}return k.m=S,k.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return k.d(t,{a:t}),t},k.d=function(e,t){for(var n in t)k.o(t,n)&&!k.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},k.f={},k.e=function(e){return Promise.all(Object.keys(k.f).reduce(function(t,n){return k.f[n](e,t),t},[]))},k.u=function(e){return""+({10:"689d3bec33ad2ec3",236:"fdae18574fda07af",296:"260a6717d1f70d00",398:"2f7a418e7935984d",65:"2695e7fbad1ec078",674:"276bcf3de74bebd1",746:"1a8cce8035a89dd9",843:"dbf5ddf434ab29c0"})[e]+".js"},k.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),k.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},v="@nocobase/plugin-data-source-manager:",k.l=function(e,t,n,r){if(h[e])return void h[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==v+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,k.nc&&o.setAttribute("nonce",k.nc),o.setAttribute("data-webpack",v+n),o.src=e),h[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var r=h[e];if(delete h[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},l=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},k.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(w=window.__webpack_public_path__||"/").endsWith("/")||(w+="/"),k.p=w+"static/plugins/@nocobase/plugin-data-source-manager/dist/client/",_={909:0},k.f.j=function(e,t){var n=k.o(_,e)?_[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=_[e]=[t,r]});t.push(n[2]=r);var o=k.p+k.u(e),i=Error();k.l(o,function(t){if(k.o(_,e)&&(0!==(n=_[e])&&(_[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},O=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],c=0;if(o.some(function(e){return 0!==_[e]})){for(n in i)k.o(i,n)&&(k.m[n]=i[n]);a&&a(k)}for(e&&e(t);c<o.length;c++)r=o[c],k.o(_,r)&&_[r]&&_[r][0](),_[r]=0},(P=self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).forEach(O.bind(null,0)),P.push=O.bind(null,P.push.bind(P)),k(329)}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,24 +8,26 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.0.0-
|
|
11
|
+
"@nocobase/client": "2.0.0-beta.10",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/plugin-acl": "2.0.0-
|
|
14
|
-
"@nocobase/utils": "2.0.0-
|
|
15
|
-
"@nocobase/server": "2.0.0-
|
|
16
|
-
"@nocobase/data-source-manager": "2.0.0-
|
|
13
|
+
"@nocobase/plugin-acl": "2.0.0-beta.10",
|
|
14
|
+
"@nocobase/utils": "2.0.0-beta.10",
|
|
15
|
+
"@nocobase/server": "2.0.0-beta.10",
|
|
16
|
+
"@nocobase/data-source-manager": "2.0.0-beta.10",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
|
-
"@nocobase/acl": "2.0.0-
|
|
18
|
+
"@nocobase/acl": "2.0.0-beta.10",
|
|
19
19
|
"@ant-design/icons": "5.6.1",
|
|
20
20
|
"antd": "5.24.2",
|
|
21
21
|
"react-router-dom": "6.30.1",
|
|
22
|
-
"@
|
|
22
|
+
"@nocobase/flow-engine": "2.0.0-beta.10",
|
|
23
23
|
"@formily/shared": "2.3.7",
|
|
24
|
+
"@formily/react": "2.3.7",
|
|
24
25
|
"react-i18next": "11.18.6",
|
|
25
26
|
"@emotion/css": "11.13.0",
|
|
26
|
-
"@nocobase/
|
|
27
|
+
"@nocobase/actions": "2.0.0-beta.10",
|
|
28
|
+
"@nocobase/database": "2.0.0-beta.10",
|
|
27
29
|
"sequelize": "6.35.2",
|
|
28
|
-
"@nocobase/test": "2.0.0-
|
|
30
|
+
"@nocobase/test": "2.0.0-beta.10",
|
|
29
31
|
"@formily/antd-v5": "1.2.3",
|
|
30
32
|
"@formily/core": "2.3.7",
|
|
31
33
|
"@formily/reactive": "2.3.7",
|
package/dist/locale/de-DE.json
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"Allow adding and modifying collection": "Hinzufügen und Ändern von Sammlungen erlauben",
|
|
3
|
+
"Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.": "Sind Sie sicher, dass Sie das Feld \"{{title}}\" als eindeutigen Datensatzschlüssel festlegen möchten? Diese Einstellung kann nach dem Festlegen nicht mehr geändert werden.",
|
|
4
|
+
"Available tables": "Available tables",
|
|
5
|
+
"Collections": "Sammlungen",
|
|
6
|
+
"Connection successful": "Verbindung erfolgreich",
|
|
3
7
|
"Data source display name": "Anzeigename der Datenquelle",
|
|
4
|
-
"Host": "Host",
|
|
5
|
-
"Port": "Port",
|
|
6
|
-
"Database": "Datenbank",
|
|
7
8
|
"Data source manager": "Datenquellenverwaltung",
|
|
9
|
+
"Data source name": "Datenquellname",
|
|
10
|
+
"Data source synchronization in progress": "Datenquellensynchronisierung läuft",
|
|
11
|
+
"Data source synchronization successful": "Datenquellensynchronisierung erfolgreich",
|
|
8
12
|
"Data sources": "Datenquellen",
|
|
9
|
-
"
|
|
10
|
-
"View documentation": "Dokumentation anzeigen",
|
|
11
|
-
"Test Connection": "Verbindung testen",
|
|
12
|
-
"Connection successful": "Verbindung erfolgreich",
|
|
13
|
-
"Display name": "Anzeigename",
|
|
14
|
-
"Username": "Benutzername",
|
|
15
|
-
"Password": "Passwort",
|
|
16
|
-
"Type": "Typ",
|
|
13
|
+
"Database": "Datenbank",
|
|
17
14
|
"Description": "Beschreibung",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"Permissions": "Berechtigungen",
|
|
21
|
-
"Allow adding and modifying collection": "Hinzufügen und Ändern von Sammlungen erlauben",
|
|
22
|
-
"Unknown field type": "Unbekannter Feldtyp",
|
|
23
|
-
"The following field types are not compatible and do not support output and display": "Die folgenden Feldtypen sind nicht kompatibel und unterstützen keine Ausgabe und Anzeige",
|
|
15
|
+
"Display name": "Anzeigename",
|
|
16
|
+
"Failed": "Fehlgeschlagen",
|
|
24
17
|
"Field database type": "Felddatenbanktyp",
|
|
25
18
|
"Field interface": "Feldschnittstelle",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"Failed": "Fehlgeschlagen",
|
|
29
|
-
"Loaded": "Geladen",
|
|
30
|
-
"Reloading": "Wird neu geladen",
|
|
31
|
-
"Data source synchronization in progress": "Datenquellensynchronisierung läuft",
|
|
32
|
-
"Data source synchronization successful": "Datenquellensynchronisierung erfolgreich",
|
|
19
|
+
"Field synchronization confirmation prompt": "Are you sure you want to synchronize fields from database? Depends on the number of tables and fields, This operation may take anywhere from a few seconds to several dozen seconds. If you only need to sync specific tables, please use the \"Configure Fields\" - \"Sync from database\" for those tables.",
|
|
20
|
+
"Filter data based on the specific field, with the requirement that the field value must be unique.": "Filtern Sie Daten basierend auf dem spezifischen Feld, mit der Anforderung, dass der Feldwert eindeutig sein muss.",
|
|
33
21
|
"Filter target key": "Zielschlüssel filtern",
|
|
34
|
-
"
|
|
22
|
+
"Host": "Host",
|
|
23
|
+
"If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "Wenn eine Sammlung keinen Primärschlüssel hat, müssen Sie einen eindeutigen Datensatzschlüssel konfigurieren, um Zeilendatensätze innerhalb eines Blocks zu lokalisieren. Wenn Sie dies nicht konfigurieren, wird die Erstellung von Datenblöcken für die Sammlung verhindert.",
|
|
24
|
+
"Load tables from database": "Load tables from database",
|
|
25
|
+
"Loaded": "Geladen",
|
|
26
|
+
"Loading": "Wird geladen",
|
|
27
|
+
"No external data source plugin installed": "Kein externes Datenquellen-Plugin installiert",
|
|
35
28
|
"OK": "OK",
|
|
29
|
+
"Password": "Passwort",
|
|
30
|
+
"Permissions": "Berechtigungen",
|
|
36
31
|
"Please select a field.": "Bitte wählen Sie ein Feld aus.",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
32
|
+
"Port": "Port",
|
|
33
|
+
"Reloading": "Wird neu geladen",
|
|
34
|
+
"Select field": "Feld auswählen",
|
|
35
|
+
"Selected tables": "Selected tables",
|
|
36
|
+
"Status": "Status",
|
|
37
|
+
"Storage": "Speicher",
|
|
38
|
+
"Sync field changes from database": "Sync field changes from database",
|
|
39
|
+
"Test Connection": "Verbindung testen",
|
|
40
|
+
"The following field types are not compatible and do not support output and display": "Die folgenden Feldtypen sind nicht kompatibel und unterstützen keine Ausgabe und Anzeige",
|
|
41
|
+
"Type": "Typ",
|
|
42
|
+
"Unknown field type": "Unbekannter Feldtyp",
|
|
43
|
+
"Username": "Benutzername",
|
|
44
|
+
"View documentation": "Dokumentation anzeigen"
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow adding and modifying collection": "Allow adding and modifying collection",
|
|
3
|
+
"Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.": "Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.",
|
|
4
|
+
"Available tables": "Available tables",
|
|
5
|
+
"Collections": "Collections",
|
|
6
|
+
"Connection successful": "Connection successful",
|
|
7
|
+
"Data source display name": "Data source display name",
|
|
8
|
+
"Data source manager": "Data source manager",
|
|
9
|
+
"Data source name": "Data source name",
|
|
10
|
+
"Data source synchronization in progress": "Data source synchronization in progress",
|
|
11
|
+
"Data source synchronization successful": "Data source synchronization successful",
|
|
12
|
+
"Data sources": "Data sources",
|
|
13
|
+
"Database": "Database",
|
|
14
|
+
"Description": "Description",
|
|
15
|
+
"Display name": "Display name",
|
|
16
|
+
"Failed": "Failed",
|
|
17
|
+
"Field database type": "Field database type",
|
|
18
|
+
"Field interface": "Field interface",
|
|
19
|
+
"Field synchronization confirmation prompt": "Are you sure you want to synchronize fields from database? Depends on the number of tables and fields, This operation may take anywhere from a few seconds to several dozen seconds. If you only need to sync specific tables, please use the \"Configure Fields\" - \"Sync from database\" for those tables.",
|
|
20
|
+
"Filter data based on the specific field, with the requirement that the field value must be unique.": "Filter data based on the specific field, with the requirement that the field value must be unique.",
|
|
21
|
+
"Filter target key": "Filter target key",
|
|
22
|
+
"Host": "Host",
|
|
23
|
+
"If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.",
|
|
24
|
+
"Load tables from database": "Load tables from database",
|
|
25
|
+
"Loaded": "Loaded",
|
|
26
|
+
"Loading": "Loading",
|
|
27
|
+
"No external data source plugin installed": "No external data source plugin installed",
|
|
28
|
+
"OK": "OK",
|
|
29
|
+
"Password": "Password",
|
|
30
|
+
"Permissions": "Permissions",
|
|
31
|
+
"Please select a field.": "Please select a field.",
|
|
32
|
+
"Port": "Port",
|
|
33
|
+
"Reloading": "Reloading",
|
|
34
|
+
"Select field": "Select field",
|
|
35
|
+
"Selected tables": "Selected tables",
|
|
36
|
+
"Status": "Status",
|
|
37
|
+
"Storage": "Storage",
|
|
38
|
+
"Sync field changes from database": "Sync field changes from database",
|
|
39
|
+
"Test Connection": "Test Connection",
|
|
40
|
+
"The following field types are not compatible and do not support output and display": "The following field types are not compatible and do not support output and display",
|
|
41
|
+
"Type": "Type",
|
|
42
|
+
"Unknown field type": "Unknown field type",
|
|
43
|
+
"Username": "Username",
|
|
44
|
+
"View documentation": "View documentation"
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Allow adding and modifying collection": "Allow adding and modifying collection",
|
|
3
|
+
"Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.": "Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.",
|
|
4
|
+
"Available tables": "Available tables",
|
|
5
|
+
"Collections": "Collections",
|
|
6
|
+
"Connection successful": "Connection successful",
|
|
7
|
+
"Data source display name": "Data source display name",
|
|
8
|
+
"Data source manager": "Data source manager",
|
|
9
|
+
"Data source name": "Data source name",
|
|
10
|
+
"Data source synchronization in progress": "Data source synchronization in progress",
|
|
11
|
+
"Data source synchronization successful": "Data source synchronization successful",
|
|
12
|
+
"Data sources": "Data sources",
|
|
13
|
+
"Database": "Database",
|
|
14
|
+
"Description": "Description",
|
|
15
|
+
"Display name": "Display name",
|
|
16
|
+
"Failed": "Failed",
|
|
17
|
+
"Field database type": "Field database type",
|
|
18
|
+
"Field interface": "Field interface",
|
|
19
|
+
"Field synchronization confirmation prompt": "Are you sure you want to synchronize fields from database? Depends on the number of tables and fields, This operation may take anywhere from a few seconds to several dozen seconds. If you only need to sync specific tables, please use the \"Configure Fields\" - \"Sync from database\" for those tables.",
|
|
20
|
+
"Filter data based on the specific field, with the requirement that the field value must be unique.": "Filter data based on the specific field, with the requirement that the field value must be unique.",
|
|
21
|
+
"Filter target key": "Filter target key",
|
|
22
|
+
"Host": "Host",
|
|
23
|
+
"If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.",
|
|
24
|
+
"Load tables from database": "Load tables from database",
|
|
25
|
+
"Loaded": "Loaded",
|
|
26
|
+
"Loading": "Loading",
|
|
27
|
+
"No external data source plugin installed": "No external data source plugin installed",
|
|
28
|
+
"OK": "OK",
|
|
29
|
+
"Password": "Password",
|
|
30
|
+
"Permissions": "Permissions",
|
|
31
|
+
"Please select a field.": "Please select a field.",
|
|
32
|
+
"Port": "Port",
|
|
33
|
+
"Reloading": "Reloading",
|
|
34
|
+
"Select field": "Select field",
|
|
35
|
+
"Selected tables": "Selected tables",
|
|
36
|
+
"Status": "Status",
|
|
37
|
+
"Storage": "Storage",
|
|
38
|
+
"Sync field changes from database": "Sync field changes from database",
|
|
39
|
+
"Test Connection": "Test Connection",
|
|
40
|
+
"The following field types are not compatible and do not support output and display": "The following field types are not compatible and do not support output and display",
|
|
41
|
+
"Type": "Type",
|
|
42
|
+
"Unknown field type": "Unknown field type",
|
|
43
|
+
"Username": "Username",
|
|
44
|
+
"View documentation": "View documentation"
|
|
45
|
+
}
|