@nocobase/plugin-data-source-manager 1.7.0-beta.2 → 1.7.0-beta.20
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/LICENSE.txt +4 -4
- package/dist/client/13a440aa4c70be41.js +10 -0
- package/dist/client/4c5e12af2d7cb432.js +10 -0
- package/dist/client/644e66ea479da96d.js +10 -0
- package/dist/client/695836422b0a7ccc.js +10 -0
- package/dist/client/92152b9e567a7498.js +10 -0
- package/dist/client/981919f2cf1900a4.js +10 -0
- package/dist/client/b5ad4e0d5b999b41.js +10 -0
- package/dist/client/c85f51ac03c17a30.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +11 -11
- package/dist/locale/nl-NL.json +41 -0
- package/dist/server/models/data-source.js +2 -1
- package/dist/server/plugin.js +4 -13
- package/dist/server/utils.d.ts +0 -8
- package/package.json +2 -2
- package/dist/client/05fd9bbff4351687.js +0 -10
- package/dist/client/0920f4a14af0406f.js +0 -10
- package/dist/client/4351378ca49a3620.js +0 -10
- package/dist/client/435a0c316fa76b6f.js +0 -10
- package/dist/client/730406514d9b8503.js +0 -10
- package/dist/client/7948d6c08bf3359d.js +0 -10
- package/dist/client/93d7762d5a5ead48.js +0 -10
- package/dist/client/b89c096795215e39.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([["542"],{185:function(e,t,n){n.r(t),n.d(t,{MainDataSourceManager:function(){return em}});var r,o,i,a,l=n(875),c=n(156),u=n.n(c),s=n(772),p=n(563),d=n(505),f=n(229),m=n(584),y=n(238),b=n(550),v=n(721),h=n(227);function g(e,t,n,r,o,i,a){try{var l=e[i](a),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 d.Schema.compile(e,{t:s.i18n.t})},A={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"}}}}},S={type:"object",properties:(C(a={},(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}},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}}}}),C(a,(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,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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(),v.message.success(t("Saved successfully"),.2),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){g(i,n,r,a,l,"next",e)}function l(e){g(i,n,r,a,l,"throw",e)}a(void 0)})})()}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":h.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"}}}}}}}}),a)},w={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"}}}}}}}}};function E(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 P(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function j(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,l,"next",e)}function l(e){P(i,r,o,a,l,"throw",e)}a(void 0)})}}function F(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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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 T=function(e,t){return function(n,r){n.loading=!0,e(n,r,t).then(f.action.bound(function(e){n.dataSource=e,n.loading=!1})).catch(console.error)}},D=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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return E(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 E(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]]},k=function(){var e=(0,s.useRecord)(),t=(0,d.useForm)();return{run:function(){return j(function(){var n,r,o,i;return F(this,function(a){return i=null==(o=t.values)||null==(r=o.children)||null==(n=r.slice)?void 0:n.call(r),t.setValuesIn("children",i.filter(function(t){return t.name!==e.name})),[2]})})()}}},I=function(){return{run:function(){return j(function(){return F(this,function(e){return[2]})})()}}},M=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)},R=function(e){return"".concat(e||"").concat((0,l.uid)())},V=function(){var e,t,n,r,o,i=(0,y.useTranslation)().t,a=(0,s.useCollectionManager_deprecated)(),l=a.interfaces,p=a.getCollections,f=a.getCollection,v=((0,s.useCurrentAppInfo)()||{data:{database:{}}}).data.database,h=(0,c.useContext)(s.CollectionCategoriesContext),g=(0,s.useAPIClient)(),C=g.resource("dbViews"),x=(0,s.useCompile)();(0,d.useForm)();var S=(0,s.useApp)(),w=(e=j(function(e,t,n){var r,o,i;return F(this,function(a){return o=t.targetScope,i=(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||i&&"view"===t.template||"target"===e.props.name&&Array.isArray(t.filterTargetKey)&&t.filterTargetKey.length>1)return!1;var r,a=!(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 a&&l}).map(function(e){return{label:x(e.title),value:e.name}})]})}),function(t,n,r){return e.apply(this,arguments)}),O=(t=j(function(){return F(this,function(e){return[2,h.data.map(function(e){return{label:x(e.name),value:e.id}})]})}),function(){return t.apply(this,arguments)}),E=(n=j(function(){return F(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)}),P=(r=j(function(e){var t,n,r;return F(this,function(o){return n=(t=e.form.values).name,r=t.fields,[2,Promise.resolve({data:(f(n)||{}).fields||r}).then(function(e){var t;return null==(t=e.data.filter(function(e){return!!e.interface&&!!S.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)}),V=(o=j(function(){return F(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:i(x(e.title)),value:e.name}})})]})}),function(){return o.apply(this,arguments)}),_=(0,c.useContext)(s.SchemaComponentContext),$=(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}({},_),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},[_]);return u().createElement(s.SchemaComponentContext.Provider,{value:$},u().createElement(s.SchemaComponent,{schema:A,components:{AddSubFieldAction:s.AddSubFieldAction,EditSubFieldAction:s.EditSubFieldAction,FieldSummary:s.FieldSummary,TemplateSummay:s.TemplateSummary,CollectionFields:b.f},scope:{loadFilterTargetKeys:P,useDestroySubField:k,useBulkDestroySubField:I,useSelectedRowKeys:D,useAsyncDataSource:T,loadCollections:w,loadCategories:O,loadDBViews:E,loadStorages:V,useCurrentFields:M,useNewId:R,useCancelAction:s.useCancelAction,interfaces:l,enableInherits:(null==v?void 0:v.dialect)==="postgres",isPG:(null==v?void 0:v.dialect)==="postgres",getPickerFormat:m.getPickerFormat}}))},_=n(482),$=n(948),K=n(467),q=n.n(K);function B(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 N(e,t,n,r,o,i,a){try{var l=e[i](a),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 i=e.apply(t,n);function a(e){N(i,r,o,a,l,"next",e)}function l(e){N(i,r,o,a,l,"throw",e)}a(void 0)})}}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(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){L(e,t,n[t])})}return e}function z(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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return B(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 B(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 Q(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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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 Z(e){var t=(0,$.useDraggable)({id:e.id,data:e.data}),n=t.attributes,r=t.listeners,o=t.setNodeRef;return u().createElement("div",U({ref:o},r,n),u().createElement("div",null,e.children))}function H(e){var t=(0,$.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 J=(0,d.observer)(function(e){var t=e.item;return u().createElement(H,{id:t.id.toString(),data:t},u().createElement("div",null,u().createElement(Z,{id:t.id.toString(),data:t},u().createElement(W,{item:t}))))},{displayName:"TabTitle"}),W=function(e){var t=e.item,n=(0,y.useTranslation)().t,r=(0,s.useCompile)();return u().createElement(v.Space,null,u().createElement(v.Badge,{color:t.color}),n(r(t.name)))},X=(0,d.observer)(function(e){var t,n=z((0,c.useState)(null),2),r=n[0],o=n[1],i=(0,c.useContext)(s.CollectionCategoriesContext).refresh,a=(0,s.useResourceActionContext)().refresh,l=(0,s.useAPIClient)(),p=(t=G(function(e){var t,n;return Q(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,i()];case 2:return r.sent(),[4,a()];case 3:r.sent(),r.label=4;case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),d=(0,$.useSensor)($.MouseSensor,{activationConstraint:{distance:10}}),f=(0,$.useSensors)(d);return u().createElement($.DndContext,{sensors:f,onDragEnd:p,onDragStart:function(e){var t;o(null==(t=e.active)?void 0:t.data.current)}},e.children,u().createElement($.DragOverlay,null,r?u().createElement("span",{style:{whiteSpace:"nowrap"}},u().createElement(W,{item:r})):null))},{displayName:"DndProvider"}),Y=function(){var e,t=(0,y.useTranslation)().t,n=(0,c.useContext)(s.CollectionCategoriesContext),r=n.data,o=n.refresh,i=(0,s.useResourceActionContext)(),a=i.refresh,p=i.run,f=i.defaultRequest,m=i.setState,h=z((0,c.useState)({tab:"all"}),2),g=h[0],C=h[1],x=z((0,c.useState)(g.tab),2),A=x[0],w=x[1],O=(0,s.useCompile)(),E=(0,s.useAPIClient)(),P=v.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=U({},e),n=n={schema:S},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:S}),e},[r]);(0,c.useEffect)(function(){"all"!==g.tab&&F(g.tab)},[]);var F=function(e){if(C({tab:e}),w((0,l.uid)()),"all"!==e){var t,n={$and:[null==f||null==(t=f.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:[]})},T=function(e){P.confirm({title:O("{{t('Delete category')}}"),content:O("{{t('Are you sure you want to delete it?')}}"),onOk:G(function(){return Q(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,a()];case 3:return t.sent(),[2]}})})})},D=(e=G(function(){return Q(this,function(e){return[2,r.map(function(e){return{label:t(O(e.name)),value:e.id}})]})}),function(){return e.apply(this,arguments)}),k=q().memoize(function(e){return{items:[{key:"edit",label:u().createElement(s.SchemaComponent,{schema:{type:"void",properties:L({},(0,l.uid)(),{"x-component":"EditCategory","x-component-props":{item:e}})}})},{key:"delete",label:O("{{t('Delete category')}}"),onClick:function(){return T(e.id)}}]}});return r?u().createElement(X,null,u().createElement(v.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:F,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(J,{item:e})):O(e.name),key:String(e.id),closable:e.closable,closeIcon:u().createElement(v.Dropdown,{menu:k(e)},u().createElement(_.MenuOutlined,{role:"button","aria-label":O(e.name),style:{padding:8,margin:"-8px"}})),children:u().createElement(v.Card,{bordered:!1},u().createElement(s.SchemaComponentOptions,{components:{CollectionFields:b.f},inherit:!0,scope:{loadCategories:D,categoryVisible:"all"===e.id,categoryId:e.id}},u().createElement(d.RecursionField,{name:A,schema:e.schema,onlyRenderProperties:!0})))}})})):null};function ee(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 et(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function en(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 er=function(){var e=(0,d.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,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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(i){switch(i.label){case 0:return[4,e.submit()];case 1:return i.sent(),o=(0,K.cloneDeep)(e.values),[4,r.resource("collectionCategories").create({values:en({},o)})];case 2:return i.sent(),t.setVisible(!1),[4,e.reset()];case 3:return i.sent(),[4,n()];case 4:return i.sent(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){et(i,n,r,a,l,"next",e)}function l(e){et(i,n,r,a,l,"throw",e)}a(void 0)})})()}}},eo=function(e){return u().createElement(ei,e)},ei=function(e){var t,n=e.scope,r=e.getContainer,o=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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return ee(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 ee(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.")}()),a=i[0],l=i[1],p=(0,y.useTranslation)().t;return u().createElement(s.ActionContextProvider,{value:{visible:a,setVisible:l}},u().createElement("div",{onClick:function(){return l(!0)},title:p("Add category")},o||u().createElement(_.PlusOutlined,null)),u().createElement(s.SchemaComponent,{schema:w,components:{CollectionCategory:s.CollectionCategory,CollectionTemplateTag:s.CollectionTemplateTag},scope:en({getContainer:r,useCancelAction:s.useCancelAction,createOnly:!0,useCreateCategry:er},n)}))};function ea(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 el(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function ec(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 eu=function(){var e=(0,d.useForm)(),t=(0,s.useActionContext)(),n=(0,c.useContext)(s.CollectionCategoriesContext).refresh,r=(0,s.useResourceActionContext)().refresh,o=(0,s.useAPIClient)(),i=(0,s.useRecord)().id;return{run:function(){var a;return(a=function(){var a;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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){var c=[i,l];if(n)throw TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}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(),a=(0,K.cloneDeep)(e.values),[4,o.resource("collectionCategories").update({filter:{id:i},values:ec({},a)})];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=a.apply(e,t);function i(e){el(o,n,r,i,l,"next",e)}function l(e){el(o,n,r,i,l,"throw",e)}i(void 0)})})()}}},es=function(e){var t,n,r=(0,s.useRecord)(),o=(0,s.useRequest)(function(){return Promise.resolve({data:(0,K.cloneDeep)(r)})},(t=ec({},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)),i=(0,s.useActionContext)();return(0,c.useEffect)(function(){i.visible&&o.run()},[i.visible]),o},ep=function(e){return u().createElement(ed,e)},ed=function(e){var t,n=e.scope,r=e.getContainer,o=e.item,i=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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return ea(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 ea(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=a[0],p=a[1],d=(0,s.useCompile)();return u().createElement(s.RecordProvider,{record:o},u().createElement(s.ActionContextProvider,{value:{visible:l,setVisible:p}},u().createElement(u().Fragment,null,i||u().createElement("span",{onClick:function(){return p(!0)}},d('{{ t("Edit category") }}'))),u().createElement(s.SchemaComponent,{schema:O,scope:ec({getContainer:r,useCancelAction:s.useCancelAction,createOnly:!0,useEditCategry:eu,useValuesFromRecord:es},n)})))};(0,p.registerValidateFormats)({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});var ef={type:"object",properties:(r={},o=(0,l.uid)(),i={"x-component":"ConfigurationTable"},o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,r)},em=function(){return u().createElement(s.SchemaComponent,{schema:ef,components:{CollectionCategoriesProvider:s.CollectionCategoriesProvider,ConfigurationTable:V,ConfigurationTabs:Y,AddFieldAction:s.AddFieldAction,AddCollectionField:s.AddCollectionField,AddCollection:s.AddCollection,AddCollectionAction:s.AddCollectionAction,AddCategoryAction:ei,AddCategory:eo,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:ep,EditCategoryAction:ed,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([["927"],{947:function(e,t,n){n.r(t),n.d(t,{DataSourceContext:function(){return l},DatabaseConnectionProvider:function(){return u}});var o=n(772),r=n(156),a=n.n(r),c=n(212);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}var l=(0,r.createContext)(null);l.displayName="DataSourceContext";var u=function(e){var t,n=(t=(0,r.useState)(null),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],c=!0,i=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){i=!0,o=e}finally{try{c||null==r.return||r.return()}finally{if(i)throw o}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return i(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 i(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.")}()),u=n[0],s=n[1];return a().createElement(l.Provider,{value:{dataSource:u,setDataSource:s}},a().createElement(o.SchemaComponentOptions,{scope:c,components:{}},e.children))}},580:function(e,t,n){n.r(t),n.d(t,{BreadcumbTitle:function(){return d}});var o=n(482),r=n(772),a=n(721),c=n(156),i=n.n(c),l=n(128),u=n(947),s=n(573),p=n(421),d=function(){var e=(0,r.useApp)(),t=(0,l.useParams)().name,n=(0,r.useCompile)(),d=(0,r.useDataSourceManager)(),m=(d.getDataSource(t)||{}).displayName,y=(0,c.useContext)(u.DataSourceContext).dataSource,f=(0,c.useMemo)(function(){return y&&(null==y?void 0:y.name)===t?y:d.getDataSource(t)},[y,t]),b=(0,c.useMemo)(function(){var t=null==f?void 0:f.status,o=p.$.find(function(e){return e.value===t}),r=[{title:i().createElement(l.Link,{to:e.pluginSettingsManager.getRoutePath(s.A7)},(0,s.KQ)("Data source manager"))}];return f&&r.push({title:i().createElement(a.Space,null,i().createElement("span",null,n(m)),t&&i().createElement(a.Tag,{key:t,color:null==o?void 0:o.color},n(null==o?void 0:o.label)))}),r},[f]);return i().createElement(a.Breadcrumb,{separator:i().createElement(o.RightOutlined,null),items:b})}},212:function(e,t,n){n.r(t),n.d(t,{useCreateDatabaseServer:function(){return d},useTestConnectionAction:function(){return m}});var o=n(505),r=n(721),a=n(238),c=n(772),i=n(573);function l(e,t,n,o,r,a,c){try{var i=e[a](c),l=i.value}catch(e){n(e);return}i.done?t(l):Promise.resolve(l).then(o,r)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var a=e.apply(t,n);function c(e){l(a,o,r,c,i,"next",e)}function i(e){l(a,o,r,c,i,"throw",e)}c(void 0)})}}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function p(e,t){var n,o,r,a,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var l=[a,i];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&l[0]?o.return:l[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;switch(o=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){c.label=l[1];break}if(6===l[0]&&c.label<r[1]){c.label=r[1],r=l;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(l);break}r[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{n=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var d=function(e){var t=(0,o.useForm)(),n=(0,c.useActionContext)(),i=(0,c.useAPIClient)(),l=(0,a.useTranslation)().t,d=(0,o.useField)();return d.data=d.data||{},{run:function(){return u(function(){var o,a;return p(this,function(c){switch(c.label){case 0:return[4,t.submit()];case 1:c.sent(),c.label=2;case 2:return c.trys.push([2,5,,6]),d.data.loading=!0,[4,i.resource("databaseServers").create({values:s({},t.values)})];case 3:return o=c.sent().data,d.data.loading=!1,n.setVisible(!1),[4,t.reset()];case 4:return c.sent(),null==e||e(null==o?void 0:o.data),r.message.success(l("Saved successfully")),[3,6];case 5:return a=c.sent(),d.data.loading=!1,console.log(a),[3,6];case 6:return[2]}})})()}}},m=function(){var e=(0,o.useForm)(),t=(0,c.useAPIClient)(),n=(0,a.useTranslation)().t,l=(0,o.useField)();return l.data=l.data||{},{run:function(){return u(function(){var o;return p(this,function(a){switch(a.label){case 0:return[4,e.submit()];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),l.data.loading=!0,[4,t.resource("dataSources").testConnection({values:s({},e.values)})];case 3:return a.sent(),l.data.loading=!1,r.message.success(n("Connection successful",{ns:i.A7})),[3,5];case 4:return o=a.sent(),l.data.loading=!1,console.log(o),[3,5];case 5:return[2]}})})()}}}},421:function(e,t,n){n.d(t,{$:function(){return l},j:function(){return s}});var o,r,a,c=n(875),i=n(573),l=[{value:"loading",label:'{{t("Loading",{ns:"'.concat(i.A7,'"})}}'),color:"orange"},{value:"loading-failed",label:'{{t("Failed",{ns:"'.concat(i.A7,'"})}}'),color:"red"},{value:"loaded",label:'{{t("Loaded",{ns:"'.concat(i.A7,'"})}}'),color:"green"},{value:"reloading",label:'{{t("Reloading",{ns:"'.concat(i.A7,'"})}}'),color:"orange"}],u={name:"collections-"+(0,c.uid)(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Data source name",{ ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Data source display name",{ ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Type", { ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:'{{t("Status", { ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Select",enum:l}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},s={type:"object",properties:(o={},r=(0,c.uid)(),a={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:u,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:u},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}},r in o?Object.defineProperty(o,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[r]=a,o)}}}]);
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("@emotion/css"),require("react-i18next"),require("react"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("antd"),require("@dnd-kit/core"),require("antd-style"),require("react-router-dom"),require("@formily/reactive")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","@emotion/css","react-i18next","react","@formily/shared","@nocobase/plugin-acl/client","@nocobase/utils/client","@formily/core","lodash","antd","@dnd-kit/core","antd-style","react-router-dom","@formily/reactive"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("@emotion/css"),require("react-i18next"),require("react"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("antd"),require("@dnd-kit/core"),require("antd-style"),require("react-router-dom"),require("@formily/reactive")):e["@nocobase/plugin-data-source-manager"]=t(e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e["@formily/antd-v5"],e["@emotion/css"],e["react-i18next"],e.react,e["@formily/shared"],e["@nocobase/plugin-acl/client"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e.antd,e["@dnd-kit/core"],e["antd-style"],e["react-router-dom"],e["@formily/reactive"])}(self,function(e,t,n,r,o,i,a,c,u,l,s,f,p,d,b,y,m){return function(){var g,h,v,_,w,O,S={60:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return C}});var r=n(772),o=n(465),i=n.n(o),a=n(584),c=n(156),u=n.n(c),l=n(382),s=n(573),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,n){return(b=_()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&h(o,n.prototype),o}).apply(null,arguments)}function y(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 m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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,r)}function r(){return b(e,arguments,g(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),h(r,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function w(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){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var O=(0,r.lazy)(function(){return f("imported_174m4o3_component",n.e("721").then(n.bind(n,947)))},"DatabaseConnectionProvider").DatabaseConnectionProvider,S=(0,r.lazy)(function(){return f("imported_-1bdhn46_component",n.e("927").then(n.bind(n,580)))},"BreadcumbTitle").BreadcumbTitle,P=(0,r.lazy)(function(){return f("imported_l1a36j_component",Promise.all([n.e("833"),n.e("481")]).then(n.bind(n,791)))},"CollectionManagerPage").CollectionManagerPage,x=(0,r.lazy)(function(){return f("imported_k8ts4l_component",n.e("210").then(n.bind(n,186)))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,j=(0,r.lazy)(function(){return f("imported_1cub3nb_component",Promise.all([n.e("833"),n.e("542")]).then(n.bind(n,185)))},"MainDataSourceManager").MainDataSourceManager,k=(0,r.lazy)(function(){return f("imported_-1b29440_component",n.e("583").then(n.bind(n,777)))},"DataSourcePermissionManager").DataSourcePermissionManager,q=(0,r.lazy)(function(){return f("imported_cef22q_component",n.e("518").then(n.bind(n,865)))},"CollectionMainProvider").CollectionMainProvider,C=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=g(n),m(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,_()?Reflect.construct(n,r||[],g(t).constructor):n.apply(t,r)),"types",new Map),m(e,"extendedTabs",{}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(o,e),t=o,n=[{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 w(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(k,{role:r}))}}),e.app.use(O),e.app.pluginSettingsManager.add(s.A7,{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),e.app.pluginSettingsManager.add("".concat(s.A7,".list"),{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),Component:x,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name"),{title:u().createElement(S,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main"),{title:u().createElement(S,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:q}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:j,topLevelName:"".concat(s.A7,"/main"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:P,topLevelName:"".concat(s.A7,"/:name"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.dataSourceManager.addDataSources(e.getThirdDataSource.bind(e),l.F),[2]})})()}},{key:"setDataSources",value:function(){var e=this;return d(function(){var t,n;return w(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())?void 0:null===(t=n.data)||void 0===t?void 0:t.data]}})})()}},{key:"getThirdDataSource",value:function(){var e=this;return d(function(){var t,n;return w(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())?void 0:null===(t=n.data)||void 0===t?void 0:t.data]}})})()}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}],y(t.prototype,n),o}(v(r.Plugin));t.default=C},382:function(e,t,n){"use strict";n.d(t,{F:function(){return l}});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,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 a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var l=function(e){var t,n,r;function l(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,l),e=this,t=l,n=arguments,t=a(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(l,e),t=l,n=[{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){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(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)})})()}}],i(t.prototype,n),l}(r.DataSource)},573: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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},o),n=(n={ns:i},n),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=t},948:function(e){"use strict";e.exports=d},964:function(e){"use strict";e.exports=o},632:function(e){"use strict";e.exports=r},563:function(e){"use strict";e.exports=s},505:function(e){"use strict";e.exports=n},229:function(e){"use strict";e.exports=m},875:function(e){"use strict";e.exports=c},772:function(t){"use strict";t.exports=e},465:function(e){"use strict";e.exports=u},584:function(e){"use strict";e.exports=l},721:function(e){"use strict";e.exports=p},202:function(e){"use strict";e.exports=b},467:function(e){"use strict";e.exports=f},156:function(e){"use strict";e.exports=a},238:function(e){"use strict";e.exports=i},128:function(e){"use strict";e.exports=y}},P={};function x(e){var t=P[e];if(void 0!==t)return t.exports;var n=P[e]={exports:{}};return S[e](n,n.exports,x),n.exports}return x.m=S,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""+({210:"05fd9bbff4351687",481:"730406514d9b8503",518:"93d7762d5a5ead48",542:"0920f4a14af0406f",583:"b89c096795215e39",721:"7948d6c08bf3359d",833:"4351378ca49a3620",927:"435a0c316fa76b6f"})[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]){g[e].push(t);return}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 l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);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)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.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})},x.p=(!(v=window.__nocobase_public_path__||"/").endsWith("/")&&(v+="/"),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=t[0],r=t[1],o=t[2],i,a,c=0;if(n.some(function(e){return 0!==_[e]})){for(i in r)x.o(r,i)&&(x.m[i]=r[i]);o&&o(x)}for(e&&e(t);c<n.length;c++)a=n[c],x.o(_,a)&&_[a]&&_[a][0](),_[a]=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("60")}()});
|
|
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,a,i,c,u,l,s,f,p,d,b,y,m){return function(){var g,h,v,_,w,O,S={60:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return q}});var r=n(772),o=n(465),a=n.n(o),i=n(584),c=n(156),u=n.n(c),l=n(382),s=n(573),f=n(581);function p(e,t,n,r,o,a,i){try{var c=e[a](i),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 a=e.apply(t,n);function i(e){p(a,r,o,i,c,"next",e)}function c(e){p(a,r,o,i,c,"throw",e)}i(void 0)})}}function b(e,t,n){return(b=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&g(o,n.prototype),o}).apply(null,arguments)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=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 b(e,arguments,m(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,e)})(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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 w=(0,r.lazy)(function(){return f("imported_174m4o3_component",n.e("721").then(n.bind(n,947)))},"DatabaseConnectionProvider").DatabaseConnectionProvider,O=(0,r.lazy)(function(){return f("imported_-1bdhn46_component",n.e("927").then(n.bind(n,580)))},"BreadcumbTitle").BreadcumbTitle,S=(0,r.lazy)(function(){return f("imported_l1a36j_component",Promise.all([n.e("833"),n.e("481")]).then(n.bind(n,791)))},"CollectionManagerPage").CollectionManagerPage,P=(0,r.lazy)(function(){return f("imported_k8ts4l_component",n.e("210").then(n.bind(n,186)))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,x=(0,r.lazy)(function(){return f("imported_1cub3nb_component",Promise.all([n.e("833"),n.e("542")]).then(n.bind(n,185)))},"MainDataSourceManager").MainDataSourceManager,j=(0,r.lazy)(function(){return f("imported_-1b29440_component",n.e("583").then(n.bind(n,777)))},"DataSourcePermissionManager").DataSourcePermissionManager,k=(0,r.lazy)(function(){return f("imported_cef22q_component",n.e("518").then(n.bind(n,865)))},"CollectionMainProvider").CollectionMainProvider,q=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=m(t),y(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,v()?Reflect.construct(t,r||[],m(this).constructor):t.apply(this,r)),"types",new Map),y(e,"extendedTabs",{}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&g(n,e),t=[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,i.uid)()]=e}},{key:"load",value:function(){var e=this;return d(function(){return _(this,function(t){return e.app.pm.get(a()).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(j,{role:r}))}}),e.app.use(w),e.app.pluginSettingsManager.add(s.A7,{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),e.app.pluginSettingsManager.add("".concat(s.A7,".list"),{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),Component:P,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name"),{title:u().createElement(O,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main"),{title:u().createElement(O,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:k}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:x,topLevelName:"".concat(s.A7,"/main"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:S,topLevelName:"".concat(s.A7,"/:name"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.dataSourceManager.addDataSources(e.getThirdDataSource.bind(e),l.F),[2]})})()}},{key:"setDataSources",value:function(){var e=this;return d(function(){var t,n;return _(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 _(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)}}],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}(h(r.Plugin));t.default=q},382:function(e,t,n){"use strict";n.d(t,{F:function(){return u}});var r=n(772);function o(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){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=a(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||[],a(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&i(n,e),t=[{key:"getDataSource",value:function(){var e,t=this;return(e=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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)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 i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}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,a){var i=e.apply(t,n);function c(e){o(i,r,a,c,u,"next",e)}function u(e){o(i,r,a,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)},573:function(e,t,n){"use strict";n.d(t,{A7:function(){return a},EL:function(){return c},KQ:function(){return i}});var r=n(772),o=n(238),a="data-source-manager";function i(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:a},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)([a,"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=l},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=s},875:function(e){"use strict";e.exports=i},772:function(e){"use strict";e.exports=c},465:function(e){"use strict";e.exports=a},584:function(e){"use strict";e.exports=p},721:function(e){"use strict";e.exports=b},202: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}},P={};function x(e){var t=P[e];if(void 0!==t)return t.exports;var n=P[e]={exports:{}};return S[e](n,n.exports,x),n.exports}return x.m=S,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""+({210:"4c5e12af2d7cb432",481:"92152b9e567a7498",518:"981919f2cf1900a4",542:"b5ad4e0d5b999b41",583:"13a440aa4c70be41",721:"695836422b0a7ccc",833:"644e66ea479da96d",927:"c85f51ac03c17a30"})[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,a,i=document.getElementsByTagName("script"),c=0;c<i.length;c++){var u=i[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==h+n){o=u;break}}o||(a=!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 l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);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)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),a&&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),a=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;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},w=function(e,t){var n,r,o=t[0],a=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==_[e]})){for(n in a)x.o(a,n)&&(x.m[n]=a[n]);i&&i(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(60)}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.7.0-beta.
|
|
11
|
+
"@nocobase/client": "1.7.0-beta.20",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/plugin-acl": "1.7.0-beta.
|
|
14
|
-
"@nocobase/utils": "1.7.0-beta.
|
|
15
|
-
"@nocobase/server": "1.7.0-beta.
|
|
16
|
-
"@nocobase/data-source-manager": "1.7.0-beta.
|
|
13
|
+
"@nocobase/plugin-acl": "1.7.0-beta.20",
|
|
14
|
+
"@nocobase/utils": "1.7.0-beta.20",
|
|
15
|
+
"@nocobase/server": "1.7.0-beta.20",
|
|
16
|
+
"@nocobase/data-source-manager": "1.7.0-beta.20",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
|
+
"@nocobase/acl": "1.7.0-beta.20",
|
|
18
19
|
"@ant-design/icons": "5.6.1",
|
|
19
|
-
"antd": "5.
|
|
20
|
+
"antd": "5.24.2",
|
|
20
21
|
"react-router-dom": "6.28.1",
|
|
21
22
|
"@formily/shared": "2.3.2",
|
|
22
23
|
"react-i18next": "11.18.6",
|
|
23
24
|
"@formily/react": "2.3.0",
|
|
24
25
|
"@emotion/css": "11.13.0",
|
|
25
|
-
"@nocobase/database": "1.7.0-beta.
|
|
26
|
-
"@nocobase/acl": "1.7.0-beta.2",
|
|
26
|
+
"@nocobase/database": "1.7.0-beta.20",
|
|
27
27
|
"sequelize": "6.35.2",
|
|
28
|
-
"@nocobase/test": "1.7.0-beta.
|
|
29
|
-
"@formily/antd-v5": "1.
|
|
28
|
+
"@nocobase/test": "1.7.0-beta.20",
|
|
29
|
+
"@formily/antd-v5": "1.2.3",
|
|
30
30
|
"@formily/core": "2.3.0",
|
|
31
31
|
"@formily/reactive": "2.3.0",
|
|
32
|
-
"@dnd-kit/core": "
|
|
32
|
+
"@dnd-kit/core": "5.0.3",
|
|
33
33
|
"antd-style": "3.7.1"
|
|
34
34
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Data source name": "Databron naam",
|
|
3
|
+
"Data source display name": "Databron weergavenaam",
|
|
4
|
+
"Host": "Host",
|
|
5
|
+
"Port": "Poort",
|
|
6
|
+
"Database": "Database",
|
|
7
|
+
"Data source manager": "Databron manager",
|
|
8
|
+
"Data sources": "Databronnen",
|
|
9
|
+
"No external data source plugin installed": "Geen externe databron plugin geïnstalleerd",
|
|
10
|
+
"View documentation": "Bekijk documentatie",
|
|
11
|
+
"Test Connection": "Test verbinding",
|
|
12
|
+
"Connection successful": "Verbinding succesvol",
|
|
13
|
+
"Display name": "Weergavenaam",
|
|
14
|
+
"Username": "Gebruikersnaam",
|
|
15
|
+
"Password": "Wachtwoord",
|
|
16
|
+
"Type": "Type",
|
|
17
|
+
"Description": "Beschrijving",
|
|
18
|
+
"Storage": "Opslag",
|
|
19
|
+
"Collections": "Collecties",
|
|
20
|
+
"Permissions": "Rechten",
|
|
21
|
+
"Allow adding and modifying collection": "Toestaan toevoegen en wijzigen collectie",
|
|
22
|
+
"Unknown field type": "Onbekend veldtype",
|
|
23
|
+
"The following field types are not compatible and do not support output and display": "De volgende veldtypen zijn niet compatibel en ondersteunen geen uitvoer en weergave",
|
|
24
|
+
"Field database type": "Veld database type",
|
|
25
|
+
"Field interface": "Veld interface",
|
|
26
|
+
"Status": "Status",
|
|
27
|
+
"Loading": "Laden",
|
|
28
|
+
"Failed": "Mislukt",
|
|
29
|
+
"Loaded": "Geladen",
|
|
30
|
+
"Reloading": "Herladen",
|
|
31
|
+
"Data source synchronization in progress": "Databron synchronisatie in uitvoering",
|
|
32
|
+
"Data source synchronization successful": "Databron synchronisatie succesvol",
|
|
33
|
+
"Filter target key":"Filter doel sleutel",
|
|
34
|
+
"Select field": "Selecteer veld",
|
|
35
|
+
"OK": "OK",
|
|
36
|
+
"Please select a field.": "Selecteer een veld.",
|
|
37
|
+
"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.": "Weet je zeker dat je het veld \"{{title}}\" als een unieke sleutel wilt instellen? Deze instelling kan niet worden gewijzigd nadat deze is ingesteld.",
|
|
38
|
+
"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.": "Als een collectie geen primaire sleutel heeft, moet je een unieke record sleutel configureren om rijrecords binnen een blok te lokaliseren, het niet configureren hiervan zal de creatie van datablokken voor de collectie voorkomen.",
|
|
39
|
+
"Filter data based on the specific field, with the requirement that the field value must be unique.": "Filter gegevens op basis van het specifieke veld, met de eis dat de veldwaarde uniek moet zijn."
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -130,7 +130,8 @@ class DataSourceModel extends import_database.Model {
|
|
|
130
130
|
acl.setAvailableAction(actionName, actionParams);
|
|
131
131
|
}
|
|
132
132
|
acl.allow("*", "*", (ctx) => {
|
|
133
|
-
|
|
133
|
+
var _a;
|
|
134
|
+
return (_a = ctx.state.currentRoles) == null ? void 0 : _a.includes("root");
|
|
134
135
|
});
|
|
135
136
|
dataSource.resourceManager.use(import_plugin_acl.setCurrentRole, { tag: "setCurrentRole", before: "acl", after: "auth" });
|
|
136
137
|
await this.loadIntoACL({ app, acl, transaction: options.transaction });
|
package/dist/server/plugin.js
CHANGED
|
@@ -54,6 +54,7 @@ var import_connections_roles_resources = require("./models/connections-roles-res
|
|
|
54
54
|
var import_connections_roles_resources_action = require("./models/connections-roles-resources-action");
|
|
55
55
|
var import_data_source = require("./models/data-source");
|
|
56
56
|
var import_data_sources_roles_model = require("./models/data-sources-roles-model");
|
|
57
|
+
var import_acl = require("@nocobase/acl");
|
|
57
58
|
const canRefreshStatus = ["loaded", "loading-failed", "reloading-failed"];
|
|
58
59
|
class PluginDataSourceManagerServer extends import_server.Plugin {
|
|
59
60
|
dataSourceErrors = {};
|
|
@@ -593,7 +594,7 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
|
|
|
593
594
|
await next();
|
|
594
595
|
const { resourceName, actionName } = action.params;
|
|
595
596
|
if (resourceName === "roles" && actionName == "check") {
|
|
596
|
-
const
|
|
597
|
+
const roleNames = ctx.state.currentRoles;
|
|
597
598
|
const dataSources = await ctx.db.getRepository("dataSources").find();
|
|
598
599
|
ctx.bodyMeta = {
|
|
599
600
|
dataSources: dataSources.reduce((carry, dataSourceModel) => {
|
|
@@ -606,18 +607,8 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
|
|
|
606
607
|
return carry;
|
|
607
608
|
}
|
|
608
609
|
const aclInstance = dataSource.acl;
|
|
609
|
-
const
|
|
610
|
-
const dataObj =
|
|
611
|
-
strategy: {},
|
|
612
|
-
resources: roleInstance ? [...roleInstance.resources.keys()] : [],
|
|
613
|
-
actions: {}
|
|
614
|
-
};
|
|
615
|
-
if (roleInstance) {
|
|
616
|
-
const data = roleInstance.toJSON();
|
|
617
|
-
dataObj["name"] = data["name"];
|
|
618
|
-
dataObj["strategy"] = data["strategy"];
|
|
619
|
-
dataObj["actions"] = data["actions"];
|
|
620
|
-
}
|
|
610
|
+
const roleInstances = aclInstance.getRoles(roleNames);
|
|
611
|
+
const dataObj = (0, import_acl.mergeRole)(roleInstances);
|
|
621
612
|
carry[dataSourceModel.get("key")] = dataObj;
|
|
622
613
|
return carry;
|
|
623
614
|
}, {})
|
package/dist/server/utils.d.ts
CHANGED
|
@@ -1,9 +1 @@
|
|
|
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
1
|
export declare function mergeOptions(fieldOptions: any, modelOptions: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-source-manager",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.20",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "Data source manager",
|
|
6
6
|
"displayName.zh-CN": "数据源管理",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"keywords": [
|
|
18
18
|
"Data model tools"
|
|
19
19
|
],
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "178910a2afe33bd4850e2519507d32b631a380fc"
|
|
21
21
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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([["210"],{186:function(e,t,n){n.r(t),n.d(t,{DatabaseConnectionManagerPane:function(){return R}});var r=n("875"),o=n("772"),a=n("721"),i=n("156"),c=n.n(i),u=n("238"),l=n("60"),s=n("421"),p=n("382"),d=n("482"),f=n("212"),y=n("573");function m(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 b(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,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(c)throw r}}return a}}(e,t)||h(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 v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(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 h(e,t){if(e){if("string"==typeof e)return m(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 m(e,t)}}var g=function(){var e=b((0,i.useState)({}),2),t=e[0],n=e[1],s=(0,o.usePlugin)(l.default),p=(0,o.useCompile)(),m=b((0,i.useState)(!1),2),h=m[0],g=m[1],x=(0,u.useTranslation)().t,A=b((0,i.useState)(null),2),C=A[0],S=A[1],k=(0,o.useAPIClient)();return c().createElement("div",null,c().createElement(o.ActionContext.Provider,{value:{visible:h,setVisible:g}},c().createElement(a.Dropdown,{menu:{onClick:function(e){if("__empty__"!==e.key){var t,o,a,i=s.types.get(e.key);S(e.key),g(!0),n({type:"object",properties:(t={},o=(0,r.uid)(),a={type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:e.key,key:"d_".concat((0,r.uid)())}},title:p("{{t('Add new')}}")+" - "+p(i.label),properties:{body:{type:"void","x-component":i.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{testConnection:{title:'{{ t("Test Connection",{ ns: "'.concat(y.A7,'" }) }}'),"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":null==i?void 0:i.disableTestConnection},cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}",actionCallback:"{{ dataSourceCreateCallback }}"}}}}}},o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a,t)})}},items:[s.types.size?null:{key:"__empty__",label:c().createElement(a.Empty,{image:a.Empty.PRESENTED_IMAGE_SIMPLE,description:c().createElement(c().Fragment,null,x("No external data source plugin installed",{ns:y.A7}),c().createElement("br",null)," ",c().createElement("a",{target:"_blank",href:"zh-CN"===k.auth.locale?"https://docs-cn.nocobase.com/handbook/data-source-manager":"https://docs.nocobase.com/handbook/data-source-manager",rel:"noreferrer"},x("View documentation",{ns:y.A7})))})}].filter(Boolean).concat(v(s.types.keys()).map(function(e){var t=s.types.get(e);return{key:e,label:p(null==t?void 0:t.label)}}))}},c().createElement(a.Button,{type:"primary",icon:c().createElement(d.PlusOutlined,null)},x("Add new")," ",c().createElement(d.DownOutlined,null))),c().createElement(o.SchemaComponent,{scope:{createOnly:!1,useTestConnectionAction:f.useTestConnectionAction,dialect:C,useDialectDataSource:function(e){var t=v(s.types.keys()).map(function(e){var t=s.types.get(e);return{value:t.name,label:p(t.label)}});e.dataSource=t}},schema:t})))},x=n("505");function A(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 C(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function S(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,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(c)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return A(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 A(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.")}()}var k=function(){var e=(0,o.useRecord)(),t=S((0,i.useState)({}),2),n=t[0],a=t[1],s=(0,o.usePlugin)(l.default),p=(0,o.useCompile)(),d=S((0,i.useState)(!1),2),f=d[0],m=d[1],b=(0,u.useTranslation)().t,v=(0,o.useDataSourceManager)();return c().createElement("div",null,c().createElement(o.ActionContext.Provider,{value:{visible:f,setVisible:m}},"main"!==e.key&&c().createElement("a",{onClick:function(){m(!0);var t,n,o,i=s.types.get(e.type);a({type:"object",properties:(t={},n=(0,r.uid)(),o={type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:e},title:p("{{t('Edit')}}")+" - "+p(e.displayName),properties:{body:{type:"void","x-component":i.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},testConnectiion:{title:'{{ t("Test Connection",{ ns: "'.concat(y.A7,'" }) }}'),"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":null==i?void 0:i.disableTestConnection},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}}},n in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t)})}},b("Edit")),c().createElement(o.SchemaComponent,{scope:{createOnly:!0,useUpdateAction:function(){var e=(0,x.useField)(),t=(0,x.useForm)(),n=(0,o.useActionContext)(),r=(0,o.useResourceActionContext)().refresh,a=(0,o.useResourceContext)().resource,i=(0,o.useRecord)().key;return{run:function(){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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,function(o){switch(o.label){case 0:return[4,t.submit()];case 1:o.sent(),e.data=e.data||{},e.data.loading=!0,o.label=2;case 2:return o.trys.push([2,5,6,7]),[4,a.update({filterByTk:i,values:t.values})];case 3:return o.sent(),n.setVisible(!1),v.getDataSource(i).setOptions(t.values),v.getDataSource(i).reload(),[4,t.reset()];case 4:return o.sent(),r(),[3,7];case 5:return console.log(o.sent()),[3,7];case 6:return e.data.loading=!1,[7];case 7:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){C(a,n,r,i,c,"next",e)}function c(e){C(a,n,r,i,c,"throw",e)}i(void 0)})})()}}}},schema:n})))},w=n("964"),D=n("128"),E=function(e){var t=e.key,n=e.type;return"/admin/settings/data-source-manager/".concat(t,"/collections?type=").concat(n)};function T(){var e,t,n=(e=["\n .ant-btn-link {\n &:hover {\n color: rgba(0, 0, 0, 0.25) !important;\n }\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return T=function(){return n},n}var P=function(){var e=(0,o.useRecord)(),t=(0,D.useNavigate)(),n=(0,u.useTranslation)().t;return c().createElement("div",{className:e.enabled?void 0:(0,w.css)(T())},c().createElement(a.Button,{type:"link",style:{padding:"0px"},disabled:!e.enabled,onClick:function(){t(E(e))},role:"button","aria-label":"".concat(null==e?void 0:e.key,"-Configure")},n("Configure")))};function O(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 j(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function _(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){j(a,r,o,i,c,"next",e)}function c(e){j(a,r,o,i,c,"throw",e)}i(void 0)})}}function I(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return O(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 O(e,t)}}(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 F(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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var R=function(){var e=(0,u.useTranslation)().t,t=(0,o.usePlugin)(l.default),n=I(t.types.keys()).map(function(n){var r=t.types.get(n);return{value:n,label:e(null==r?void 0:r.label)}}).concat([{value:"main",label:e("Main")}]),d=(0,o.useDataSourceManager)(),f=c().useRef([]);(0,i.useEffect)(function(){return function(){d.getDataSources().forEach(function(e){f.current.includes(e.key)&&e.reload()})}},[f]);var y=(0,i.useCallback)(function(e){d.removeDataSources(e)},[d]),m=(0,i.useCallback)(function(e){d.addDataSource(p.F,e),f.current=I(f.current).concat([e.key])},[]);return c().createElement(a.Card,{bordered:!1},c().createElement(o.SchemaComponent,{components:{CreateDatabaseConnectAction:g,EditDatabaseConnectionAction:k,ViewDatabaseConnectionAction:P},scope:{useNewId:function(e){return"".concat(e).concat((0,r.uid)())},types:n,useRefreshActionProps:function(){var e=(0,o.useResourceActionContext)();return{onClick:function(){return _(function(){var t,n,r,o,a;return F(this,function(i){switch(i.label){case 0:if(!(null==(r=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.data.filter(function(e){return"loaded"!==e.status}))?void 0:r.length))return[3,2];return o=d.getDataSources(),a=r.map(function(e){return e.key}),[4,Promise.all(o.filter(function(e){return a.includes(e.key)}).map(function(e){return e.reload()}))];case 1:i.sent(),i.label=2;case 2:return null==e||null===(n=e.refresh)||void 0===n||n.call(e),[2]}})})()}}},useDestroyAction:function(){var e=(0,o.useResourceActionContext)().refresh,t=(0,o.useResourceContext)().resource,n=(0,o.useRecord)().key;return{run:function(){return _(function(){return F(this,function(r){switch(r.label){case 0:return[4,t.destroy({filterByTk:n})];case 1:return r.sent(),y([n]),e(),[2]}})})()}}},dataSourceDeleteCallback:y,dataSourceCreateCallback:m,useIsAbleDelete:function(e){var t=(0,o.useRecord)().key;e.visible="main"!==t}},schema:s.j}))}},212:function(e,t,n){n.r(t),n.d(t,{useCreateDatabaseServer:function(){return d},useTestConnectionAction:function(){return f}});var r=n(505),o=n(721),a=n(238),i=n(772),c=n(573);function u(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){u(a,r,o,i,c,"next",e)}function c(e){u(a,r,o,i,c,"throw",e)}i(void 0)})}}function s(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,o,a;r=e,o=t,a=n[t],o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})}return e}function p(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:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var d=function(e){var t=(0,r.useForm)(),n=(0,i.useActionContext)(),c=(0,i.useAPIClient)(),u=(0,a.useTranslation)().t,d=(0,r.useField)();return d.data=d.data||{},{run:function(){return l(function(){var r,a;return p(this,function(i){switch(i.label){case 0:return[4,t.submit()];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,5,,6]),d.data.loading=!0,[4,c.resource("databaseServers").create({values:s({},t.values)})];case 3:return r=i.sent().data,d.data.loading=!1,n.setVisible(!1),[4,t.reset()];case 4:return i.sent(),null==e||e(null==r?void 0:r.data),o.message.success(u("Saved successfully")),[3,6];case 5:return a=i.sent(),d.data.loading=!1,console.log(a),[3,6];case 6:return[2]}})})()}}},f=function(){var e=(0,r.useForm)(),t=(0,i.useAPIClient)(),n=(0,a.useTranslation)().t,u=(0,r.useField)();return u.data=u.data||{},{run:function(){return l(function(){var r;return p(this,function(a){switch(a.label){case 0:return[4,e.submit()];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),u.data.loading=!0,[4,t.resource("dataSources").testConnection({values:s({},e.values)})];case 3:return a.sent(),u.data.loading=!1,o.message.success(n("Connection successful",{ns:c.A7})),[3,5];case 4:return r=a.sent(),u.data.loading=!1,console.log(r),[3,5];case 5:return[2]}})})()}}}},421:function(e,t,n){n.d(t,{$:function(){return u},j:function(){return s}});var r,o,a,i=n(875),c=n(573),u=[{value:"loading",label:'{{t("Loading",{ns:"'.concat(c.A7,'"})}}'),color:"orange"},{value:"loading-failed",label:'{{t("Failed",{ns:"'.concat(c.A7,'"})}}'),color:"red"},{value:"loaded",label:'{{t("Loaded",{ns:"'.concat(c.A7,'"})}}'),color:"green"},{value:"reloading",label:'{{t("Reloading",{ns:"'.concat(c.A7,'"})}}'),color:"orange"}],l={name:"collections-"+(0,i.uid)(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Data source name",{ ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Data source display name",{ ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Type", { ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:'{{t("Status", { ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Select",enum:u}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]};var s={type:"object",properties:(r={},o=(0,i.uid)(),a={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:l,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:l},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}},o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)}}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
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([["542"],{185:function(e,t,n){n.r(t),n.d(t,{MainDataSourceManager:function(){return em}});var r,o,i,a,l=n("875"),c=n("156"),u=n.n(c),s=n("772"),p=n("563"),d=n("505"),f=n("229"),m=n("584"),y=n("238"),b=n("550"),v=n("721"),h=n("227");function g(e,t,n,r,o,i,a){try{var l=e[i](a),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 d.Schema.compile(e,{t:s.i18n.t})},A={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"}}}}},S={type:"object",properties:(C(a={},(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}},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}}}}),C(a,(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,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(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(),v.message.success(t("Saved successfully"),.2),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){g(i,n,r,a,l,"next",e)}function l(e){g(i,n,r,a,l,"throw",e)}a(void 0)})})()}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":h.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"}}}}}}}}),a)},w={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"}}}}}}}}};function E(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 P(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function j(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,l,"next",e)}function l(e){P(i,r,o,a,l,"throw",e)}a(void 0)})}}function F(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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var T=function(e,t){return function(n,r){n.loading=!0,e(n,r,t).then(f.action.bound(function(e){n.dataSource=e,n.loading=!1})).catch(console.error)}},D=function(){var e,t,n=(e=(0,c.useState)([]),t=2,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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return E(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 E(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.")}());return[n[0],n[1]]},k=function(){var e=(0,s.useRecord)(),t=(0,d.useForm)();return{run:function(){return j(function(){var n,r,o,i;return F(this,function(a){return i=null===(o=t.values)||void 0===o?void 0:null===(r=o.children)||void 0===r?void 0:null===(n=r.slice)||void 0===n?void 0:n.call(r),t.setValuesIn("children",i.filter(function(t){return t.name!==e.name})),[2]})})()}}},I=function(){return{run:function(){return j(function(){return F(this,function(e){return[2]})})()}}},M=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)},R=function(e){return"".concat(e||"").concat((0,l.uid)())},V=function(){var e,t,n,r,o,i=(0,y.useTranslation)().t,a=(0,s.useCollectionManager_deprecated)(),l=a.interfaces,p=a.getCollections,f=a.getCollection,v=((0,s.useCurrentAppInfo)()||{data:{database:{}}}).data.database,h=(0,c.useContext)(s.CollectionCategoriesContext),g=(0,s.useAPIClient)(),C=g.resource("dbViews"),x=(0,s.useCompile)();(0,d.useForm)();var S=(0,s.useApp)();var w=(e=j(function(e,t,n){var r,o,i;return F(this,function(a){return o=t.targetScope,i=(null===(r=e.props)||void 0===r?void 0:r.name)==="inherits",[2,p().filter(function(t){if(null==n?void 0:n.includes(t.template))return!1;if(t.autoCreate&&t.isThrough||i&&"view"===t.template||"target"===e.props.name&&Array.isArray(t.filterTargetKey)&&t.filterTargetKey.length>1)return!1;var r,a=!(null==o?void 0:o.template)||o.template.includes(t.template),l=!(null==o?void 0:o[null===(r=e.props)||void 0===r?void 0:r.name])||o[e.props.name].includes(t.name);return a&&l}).map(function(e){return{label:x(e.title),value:e.name}})]})}),function(t,n,r){return e.apply(this,arguments)});var O=(t=j(function(){return F(this,function(e){return[2,h.data.map(function(e){return{label:x(e.name),value:e.id}})]})}),function(){return t.apply(this,arguments)});var E=(n=j(function(){return F(this,function(e){return[2,C.list().then(function(e){var t,n=e.data;return null==n?void 0:null===(t=n.data)||void 0===t?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)});var P=(r=j(function(e){var t,n,r;return F(this,function(o){return n=(t=e.form.values).name,r=t.fields,[2,Promise.resolve({data:(f(n)||{}).fields||r}).then(function(e){var t;return null===(t=e.data.filter(function(e){return!!e.interface&&(!!S.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface).titleUsable||!1)}))||void 0===t?void 0:t.map(function(e){var t;return{label:x(null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name,value:e.name}})})]})}),function(e){return r.apply(this,arguments)});var V=(o=j(function(){return F(this,function(e){return[2,g.resource("storages").list().then(function(e){var t,n=e.data;return null==n?void 0:null===(t=n.data)||void 0===t?void 0:t.map(function(e){return{label:i(x(e.title)),value:e.name}})})]})}),function(){return o.apply(this,arguments)}),_=(0,c.useContext)(s.SchemaComponentContext),$=(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},_),t=(t={designable:!1},t),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},[_]);return u().createElement(s.SchemaComponentContext.Provider,{value:$},u().createElement(s.SchemaComponent,{schema:A,components:{AddSubFieldAction:s.AddSubFieldAction,EditSubFieldAction:s.EditSubFieldAction,FieldSummary:s.FieldSummary,TemplateSummay:s.TemplateSummary,CollectionFields:b.f},scope:{loadFilterTargetKeys:P,useDestroySubField:k,useBulkDestroySubField:I,useSelectedRowKeys:D,useAsyncDataSource:T,loadCollections:w,loadCategories:O,loadDBViews:E,loadStorages:V,useCurrentFields:M,useNewId:R,useCancelAction:s.useCancelAction,interfaces:l,enableInherits:(null==v?void 0:v.dialect)==="postgres",isPG:(null==v?void 0:v.dialect)==="postgres",getPickerFormat:m.getPickerFormat}}))},_=n("482"),$=n("948"),K=n("467"),q=n.n(K);function B(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 N(e,t,n,r,o,i,a){try{var l=e[i](a),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 i=e.apply(t,n);function a(e){N(i,r,o,a,l,"next",e)}function l(e){N(i,r,o,a,l,"throw",e)}a(void 0)})}}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(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){L(e,t,n[t])})}return e}function z(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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return B(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 B(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 Q(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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function Z(e){var t=(0,$.useDraggable)({id:e.id,data:e.data}),n=t.attributes,r=t.listeners,o=t.setNodeRef;return u().createElement("div",U({ref:o},r,n),u().createElement("div",null,e.children))}function H(e){var t=(0,$.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 J=(0,d.observer)(function(e){var t=e.item;return u().createElement(H,{id:t.id.toString(),data:t},u().createElement("div",null,u().createElement(Z,{id:t.id.toString(),data:t},u().createElement(W,{item:t}))))},{displayName:"TabTitle"}),W=function(e){var t=e.item,n=(0,y.useTranslation)().t,r=(0,s.useCompile)();return u().createElement(v.Space,null,u().createElement(v.Badge,{color:t.color}),n(r(t.name)))},X=(0,d.observer)(function(e){var t,n=z((0,c.useState)(null),2),r=n[0],o=n[1],i=(0,c.useContext)(s.CollectionCategoriesContext).refresh,a=(0,s.useResourceActionContext)().refresh,l=(0,s.useAPIClient)();var p=(t=G(function(e){var t,n;return Q(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,i()];case 2:return r.sent(),[4,a()];case 3:r.sent(),r.label=4;case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),d=(0,$.useSensor)($.MouseSensor,{activationConstraint:{distance:10}}),f=(0,$.useSensors)(d);return u().createElement($.DndContext,{sensors:f,onDragEnd:p,onDragStart:function(e){var t;o(null===(t=e.active)||void 0===t?void 0:t.data.current)}},e.children,u().createElement($.DragOverlay,null,r?u().createElement("span",{style:{whiteSpace:"nowrap"}},u().createElement(W,{item:r})):null))},{displayName:"DndProvider"}),Y=function(){var e,t=(0,y.useTranslation)().t,n=(0,c.useContext)(s.CollectionCategoriesContext),r=n.data,o=n.refresh,i=(0,s.useResourceActionContext)(),a=i.refresh,p=i.run,f=i.defaultRequest,m=i.setState,h=z((0,c.useState)({tab:"all"}),2),g=h[0],C=h[1],x=z((0,c.useState)(g.tab),2),A=x[0],w=x[1],O=(0,s.useCompile)(),E=(0,s.useAPIClient)(),P=v.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=U({},e),n=(n={schema:S},n),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:S}),e},[r]);(0,c.useEffect)(function(){"all"!==g.tab&&F(g.tab)},[]);var F=function(e){if(C({tab:e}),w((0,l.uid)()),"all"!==e){var t,n={$and:[null==f?void 0:null===(t=f.params)||void 0===t?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:[]})},T=function(e){P.confirm({title:O("{{t('Delete category')}}"),content:O("{{t('Are you sure you want to delete it?')}}"),onOk:G(function(){return Q(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,a()];case 3:return t.sent(),[2]}})})})};var D=(e=G(function(){return Q(this,function(e){return[2,r.map(function(e){return{label:t(O(e.name)),value:e.id}})]})}),function(){return e.apply(this,arguments)}),k=q().memoize(function(e){return{items:[{key:"edit",label:u().createElement(s.SchemaComponent,{schema:{type:"void",properties:L({},(0,l.uid)(),{"x-component":"EditCategory","x-component-props":{item:e}})}})},{key:"delete",label:O("{{t('Delete category')}}"),onClick:function(){return T(e.id)}}]}});return r?u().createElement(X,null,u().createElement(v.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:F,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(J,{item:e})):O(e.name),key:String(e.id),closable:e.closable,closeIcon:u().createElement(v.Dropdown,{menu:k(e)},u().createElement(_.MenuOutlined,{role:"button","aria-label":O(e.name),style:{padding:8,margin:"-8px"}})),children:u().createElement(v.Card,{bordered:!1},u().createElement(s.SchemaComponentOptions,{components:{CollectionFields:b.f},inherit:!0,scope:{loadCategories:D,categoryVisible:"all"===e.id,categoryId:e.id}},u().createElement(d.RecursionField,{name:A,schema:e.schema,onlyRenderProperties:!0})))}})})):null};function ee(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 et(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function en(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}var er=function(){var e=(0,d.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,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(i){switch(i.label){case 0:return[4,e.submit()];case 1:return i.sent(),o=(0,K.cloneDeep)(e.values),[4,r.resource("collectionCategories").create({values:en({},o)})];case 2:return i.sent(),t.setVisible(!1),[4,e.reset()];case 3:return i.sent(),[4,n()];case 4:return i.sent(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){et(i,n,r,a,l,"next",e)}function l(e){et(i,n,r,a,l,"throw",e)}a(void 0)})})()}}},eo=function(e){return u().createElement(ei,e)},ei=function(e){var t,n,r=e.scope,o=e.getContainer,i=e.children;var a=(t=(0,c.useState)(!1),n=2,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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return ee(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 ee(e,t)}}(t,n)||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=a[0],p=a[1],d=(0,y.useTranslation)().t;return u().createElement(s.ActionContextProvider,{value:{visible:l,setVisible:p}},u().createElement("div",{onClick:function(){return p(!0)},title:d("Add category")},i||u().createElement(_.PlusOutlined,null)),u().createElement(s.SchemaComponent,{schema:w,components:{CollectionCategory:s.CollectionCategory,CollectionTemplateTag:s.CollectionTemplateTag},scope:en({getContainer:o,useCancelAction:s.useCancelAction,createOnly:!0,useCreateCategry:er},r)}))};function ea(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 el(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function ec(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,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}var eu=function(){var e=(0,d.useForm)(),t=(0,s.useActionContext)(),n=(0,c.useContext)(s.CollectionCategoriesContext).refresh,r=(0,s.useResourceActionContext)().refresh,o=(0,s.useAPIClient)(),i=(0,s.useRecord)().id;return{run:function(){var a;return(a=function(){var a;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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(l){switch(l.label){case 0:return[4,e.submit()];case 1:return l.sent(),a=(0,K.cloneDeep)(e.values),[4,o.resource("collectionCategories").update({filter:{id:i},values:ec({},a)})];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=a.apply(e,t);function i(e){el(o,n,r,i,l,"next",e)}function l(e){el(o,n,r,i,l,"throw",e)}i(void 0)})})()}}},es=function(e){var t,n,r=(0,s.useRecord)();var o=(0,s.useRequest)(function(){return Promise.resolve({data:(0,K.cloneDeep)(r)})},(t=ec({},e),n=(n={manual:!0},n),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)),i=(0,s.useActionContext)();return(0,c.useEffect)(function(){i.visible&&o.run()},[i.visible]),o},ep=function(e){return u().createElement(ed,e)},ed=function(e){var t,n,r=e.scope,o=e.getContainer,i=e.item,a=e.children;var l=(t=(0,c.useState)(!1),n=2,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 i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return ea(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 ea(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=l[0],d=l[1],f=(0,s.useCompile)();return u().createElement(s.RecordProvider,{record:i},u().createElement(s.ActionContextProvider,{value:{visible:p,setVisible:d}},u().createElement(u().Fragment,null,a||u().createElement("span",{onClick:function(){return d(!0)}},f('{{ t("Edit category") }}'))),u().createElement(s.SchemaComponent,{schema:O,scope:ec({getContainer:o,useCancelAction:s.useCancelAction,createOnly:!0,useEditCategry:eu,useValuesFromRecord:es},r)})))};(0,p.registerValidateFormats)({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});var ef={type:"object",properties:(r={},o=(0,l.uid)(),i={"x-component":"ConfigurationTable"},o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i,r)},em=function(){return u().createElement(s.SchemaComponent,{schema:ef,components:{CollectionCategoriesProvider:s.CollectionCategoriesProvider,ConfigurationTable:V,ConfigurationTabs:Y,AddFieldAction:s.AddFieldAction,AddCollectionField:s.AddCollectionField,AddCollection:s.AddCollection,AddCollectionAction:s.AddCollectionAction,AddCategoryAction:ei,AddCategory:eo,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:ep,EditCategoryAction:ed,SyncFieldsAction:s.SyncFieldsAction,SyncFieldsActionCom:s.SyncFieldsActionCom,SyncSQLFieldsAction:s.SyncSQLFieldsAction}})}}}]);
|