plugin-data-source-mssql 2.0.8 → 2.0.11

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.
@@ -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("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@nocobase/plugin-data-source-manager/client"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define("plugin-data-source-mssql",["react-i18next","@emotion/css","react-router-dom","@nocobase/plugin-data-source-manager/client","react","antd","@nocobase/client","@formily/react","@ant-design/icons"],t):"object"==typeof exports?exports["plugin-data-source-mssql"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@nocobase/plugin-data-source-manager/client"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons")):e["plugin-data-source-mssql"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@nocobase/plugin-data-source-manager/client"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"])}(self,function(e,t,r,n,o,c,a,i,l){return function(){"use strict";var u={375:function(e){e.exports=l},477:function(e){e.exports=t},230:function(e){e.exports=i},342:function(e){e.exports=a},699:function(e){e.exports=n},59:function(e){e.exports=c},155:function(e){e.exports=o},953:function(t){t.exports=e},442:function(e){e.exports=r}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return u[e](r,r.exports,p),r.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var r in t)p.o(t,r)&&!p.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(f=p.g.location+"");var f,m=p.g.document;if(!f&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(f=m.currentScript.src),!f)){var d=m.getElementsByTagName("script");if(d.length)for(var b=d.length-1;b>-1&&(!f||!/^http(s?):/.test(f));)f=d[b--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");p.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-data-source-mssql/dist/client/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",o="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",a=c.indexOf(o);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-data-source-mssql/dist/client/"}p.p=e}(),!function(){p.r(y),p.d(y,{PluginDataSourceMssqlClient:function(){return E},default:function(){return k}});var e=p(342),t=p(699),r=p.n(t),n=p(155),o=p.n(n),c=p(230),a=p(59),i=p(953);function l(e,t,r,n,o,c,a){try{var i=e[c](a),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}var u=function(t){var r=t.CollectionsTableField,u=t.loadCollections,s=t.from;console.log("[MSSQL Plugin] ConfigForm rendering...");var p=(0,e.useAPIClient)(),f=(0,c.useForm)(),m=(0,i.useTranslation)().t,d=r({NAMESPACE:"data-source-manager",t:m}),b=d.CollectionsTable,y=d.createCollectionsSchema,h=d.Text,v=d.addAllCollectionsSchema,g=(0,n.useCallback)(function(){var e;return(e=function(){var e,t,r,n,o,c,i,l,u;return function(e,t){var r,n,o,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:l(0)}),i(a,"throw",{value:l(1)}),i(a,"return",{value:l(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function l(i){return function(l){var u=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(c=0)),c;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,n=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){c.label=u[1];break}if(6===u[0]&&c.label<o[1]){c.label=o[1],o=u;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(u);break}o[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(s){switch(s.label){case 0:return[4,f.submit()];case 1:s.sent(),e=f.values,s.label=2;case 2:return s.trys.push([2,4,,5]),[4,p.request({url:"dataSources:testConnection",method:"post",data:{values:{type:"mssql",options:e.options||e}}})];case 3:return s.sent(),a.message.success(m("Connection successful")),[3,5];case 4:return u=(null==(t=s.sent())||null==(c=t.response)||null==(o=c.data)||null==(n=o.errors)||null==(r=n[0])?void 0:r.message)||(null==t||null==(l=t.response)||null==(i=l.data)?void 0:i.message)||t.message,a.message.error(u),[2];case 5:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var c=e.apply(t,r);function a(e){l(c,n,o,a,i,"next",e)}function i(e){l(c,n,o,a,i,"throw",e)}a(void 0)})})()},[p,f,m]);return o().createElement(e.SchemaComponent,{scope:{CollectionsTableField:r,loadCollections:u,handleTestConnection:g,from:s,t:m,CollectionsTable:b,createCollectionsSchema:y,Text:h,addAllCollectionsSchema:v},components:{CollectionsTable:b,Text:h},schema:{type:"object",properties:{type:{type:"string","x-decorator":"FormItem","x-component":"Input","x-hidden":!0},key:{type:"string",title:m("Data source name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},displayName:{type:"string",title:m("Display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},options:{type:"object",properties:{host:{type:"string",title:m("Host"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"localhost"}},port:{type:"number",title:m("Port"),required:!0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:65535},default:1433},database:{type:"string",title:m("Database"),required:!0,"x-decorator":"FormItem","x-component":"Input"},schema:{type:"string",title:m("Schema"),"x-decorator":"FormItem","x-component":"Input"},username:{type:"string",title:m("Username"),required:!0,"x-decorator":"FormItem","x-component":"Input"},password:{type:"string",title:m("Password"),"x-decorator":"FormItem","x-component":"Password"},encrypt:{type:"boolean",title:m("Encrypt"),"x-decorator":"FormItem","x-component":"Checkbox"},tablePrefix:{type:"string",title:m("Table prefix"),"x-decorator":"FormItem","x-component":"Input"},addAllCollections:{type:"boolean",title:m("Load all collections"),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},collections:y(s,u)}}}}})},s=p(375),f=p(477),m=p(442);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,o,c,a){try{var i=e[c](a),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var c=e.apply(t,r);function a(e){b(c,n,o,a,i,"next",e)}function i(e){b(c,n,o,a,i,"throw",e)}a(void 0)})}}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function g(e,t){var r,n,o,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:l(0)}),i(a,"throw",{value:l(1)}),i(a,"return",{value:l(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function l(i){return function(l){var u=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(c=0)),c;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,n=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){c.label=u[1];break}if(6===u[0]&&c.label<o[1]){c.label=o[1],o=u;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(u);break}o[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function x(){var e,t,r=(e=["\n .ant-modal-body {\n margin-left: 35px;\n margin-bottom: 35px;\n .ant-checkbox-wrapper {\n height: 25px;\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return x=function(){return r},r}var w=function(t){var r=(0,e.useRecord)();return o().createElement(S,v({item:r},t))},O=function(){var t=(0,e.useResourceActionContext)().refresh,r=(0,m.useParams)().name,n=(0,e.useRecord)(),o=(0,e.useAPIClient)(),i=(0,c.useForm)(),l=((null==i?void 0:i.values)||{}).cascade,u=null==n?void 0:n.name;return{run:function(){return h(function(){var e,n,c,i,s;return g(this,function(p){switch(p.label){case 0:if(!u)return a.message.error("Collection name is missing"),[2];p.label=1;case 1:return p.trys.push([1,3,,4]),[4,o.request({url:"dataSources/".concat(r,"/collections:destroy"),method:"post",params:{filterByTk:u,cascade:l}})];case 2:return p.sent(),a.message.success("Collection deleted successfully"),t(),[3,4];case 3:throw e=p.sent(),a.message.error((null==e||null==(s=e.response)||null==(i=s.data)||null==(c=i.errors)||null==(n=c[0])?void 0:n.message)||"Failed to delete collection"),e;case 4:return[2]}})})()}}},C=function(){var t=O().run,r=(0,e.useCollectionManager_deprecated)().refreshCM;return{run:function(){return h(function(){return g(this,function(e){switch(e.label){case 0:return[4,t()];case 1:return e.sent(),[4,r()];case 2:return e.sent(),[2]}})})()}}},S=function(t){var r,c=t.scope,l=t.getContainer,u=t.item,p=t.children,m=t.isBulk,b=t.useAction,y=function(e,t){if(null==e)return{};var r,n,o,c={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n]);return c}if(c=function(e,t){if(null==e)return{};var r,n,o={},c=Object.getOwnPropertyNames(e);for(n=0;n<c.length;n++)r=c[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n]);return c}(t,["scope","getContainer","item","children","isBulk","useAction"]),h=(0,i.useTranslation)().t,g=function(e){if(Array.isArray(e))return e}(r=(0,n.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(t=n.next()).done)&&(o.push(t.value),2!==o.length);c=!0);}catch(e){a=!0,r=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw r}}return o}}(r)||function(e){if(e){if("string"==typeof e)return d(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return d(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),w=g[0],O=g[1];return o().createElement(e.RecordProvider,{record:u},o().createElement(e.ActionContextProvider,{value:{visible:w,setVisible:O}},m?o().createElement(a.Button,{icon:o().createElement(s.DeleteOutlined,null),onClick:function(){return O(!0)}},p||h("Delete")):o().createElement("a",v({onClick:function(){return O(!0)}},y),p||h("Delete")),o().createElement(e.SchemaComponent,{schema:{type:"object",properties:{deleteCollection:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:o().createElement(function(){return o().createElement("span",null,o().createElement(s.ExclamationCircleFilled,{style:{color:"#faad14",marginRight:"12px",fontSize:"22px"}}),o().createElement("span",{style:{fontSize:"19px"}},h("Delete collection")))},null),"x-component-props":{width:520,getContainer:"{{ getContainer }}",className:(0,f.css)(x())},properties:{info:{type:"string","x-component":"div","x-content":"{{t('Are you sure you want to delete it?')}}"},cascade:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox",default:!1,"x-content":h("Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects")},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Ok") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDestroyCollectionAction }}",style:{marginLeft:"8px"}}}}}}}}},scope:v({getContainer:l,useDestroyCollectionAction:b||C,useCancelAction:e.useCancelAction},c)})))};function j(e,t,r,n,o,c,a){try{var i=e[c](a),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}function P(e,t,r){return(P=_()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&q(o,r.prototype),o}).apply(null,arguments)}S.displayName="MssqlDeleteCollectionAction";function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t="function"==typeof Map?new Map:void 0;return(A=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,r)}function r(){return P(e,arguments,I(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),q(r,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}var E=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=I(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(e,t||[],I(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&q(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:l(0)}),i(a,"throw",{value:l(1)}),i(a,"return",{value:l(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function l(i){return function(l){var u=[i,l];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(c=0)),c;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,n=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){c=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){c.label=u[1];break}if(6===u[0]&&c.label<o[1]){c.label=o[1],o=u;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(u);break}o[2]&&c.ops.pop(),c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return console.log("[MSSQL Plugin] Client loading..."),this.app.pm.get(r()).registerType("mssql",{name:"mssql",label:"External MSSQL",icon:"DatabaseOutlined",color:"blue",DataSourceSettingsForm:u,DeleteCollection:w,disableTestConnection:!1,disableAddFields:!1,allowCollectionDeletion:!0}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var c=e.apply(t,r);function a(e){j(c,n,o,a,i,"next",e)}function i(e){j(c,n,o,a,i,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,t),n}(A(e.Plugin)),k=E}(),y}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@nocobase/plugin-data-source-manager/client"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define("plugin-data-source-mssql",["react-i18next","@emotion/css","react-router-dom","@nocobase/plugin-data-source-manager/client","react","antd","@nocobase/client","@formily/react","@ant-design/icons"],t):"object"==typeof exports?exports["plugin-data-source-mssql"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@nocobase/plugin-data-source-manager/client"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons")):e["plugin-data-source-mssql"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@nocobase/plugin-data-source-manager/client"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"])}(self,function(e,t,r,n,o,a,l,i,c){return function(){"use strict";var u={375:function(e){e.exports=c},477:function(e){e.exports=t},230:function(e){e.exports=i},342:function(e){e.exports=l},699:function(e){e.exports=n},59:function(e){e.exports=a},155:function(e){e.exports=o},953:function(t){t.exports=e},442:function(e){e.exports=r}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return u[e](r,r.exports,p),r.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var r in t)p.o(t,r)&&!p.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(f=p.g.location+"");var f,m=p.g.document;if(!f&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(f=m.currentScript.src),!f)){var b=m.getElementsByTagName("script");if(b.length)for(var d=b.length-1;d>-1&&(!f||!/^http(s?):/.test(f));)f=b[d--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");p.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-data-source-mssql/dist/client/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",o="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(o);e=l>=0?a.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-data-source-mssql/dist/client/"}p.p=e}(),!function(){p.r(y),p.d(y,{PluginDataSourceMssqlClient:function(){return F},default:function(){return T}});var e=p(342),t=p(699),r=p.n(t),n=p(155),o=p.n(n),a=p(59),l=p(953);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(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 s=function(e){var t=e.initialValues,r=e.loadCollections,i=(0,l.useTranslation)().t,s=a.Form.useFormInstance(),p=a.Form.useWatch("addAllCollections",s),f=u((0,n.useState)([]),2),m=f[0],b=f[1],d=u((0,n.useState)(!1),2),y=d[0],h=d[1],v=(0,n.useCallback)(function(){var e;return(e=function(){return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=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:h(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,r(null==t?void 0:t.key)];case 2:var n,o,a,l,i,c;return b(Array.isArray(c=null!=(o=null!=(a=null!=(l=null==(n=e.sent())||null==(i=n.data)?void 0:i.data)?l:null==n?void 0:n.data)?a:n)?o:[])?c.map(function(e){var t="string"==typeof e?e:null==e?void 0:e.name;return{label:t,value:t}}):[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){c(a,n,o,l,i,"next",e)}function i(e){c(a,n,o,l,i,"throw",e)}l(void 0)})})()},[r,null==t?void 0:t.key]);return o().createElement(o().Fragment,null,o().createElement(a.Form.Item,{name:["options","host"],label:i("Host"),rules:[{required:!0}]},o().createElement(a.Input,{placeholder:"localhost"})),o().createElement(a.Form.Item,{name:["options","port"],label:i("Port"),rules:[{required:!0}],initialValue:1433},o().createElement(a.InputNumber,{min:1,max:65535,style:{width:"100%"}})),o().createElement(a.Form.Item,{name:["options","database"],label:i("Database"),rules:[{required:!0}]},o().createElement(a.Input,null)),o().createElement(a.Form.Item,{name:["options","schema"],label:i("Schema")},o().createElement(a.Input,null)),o().createElement(a.Form.Item,{name:["options","username"],label:i("Username"),rules:[{required:!0}]},o().createElement(a.Input,null)),o().createElement(a.Form.Item,{name:["options","password"],label:i("Password")},o().createElement(a.Input.Password,null)),o().createElement(a.Form.Item,{name:["options","encrypt"],label:i("Encrypt"),valuePropName:"checked"},o().createElement(a.Checkbox,null)),o().createElement(a.Form.Item,{name:["options","tablePrefix"],label:i("Table prefix")},o().createElement(a.Input,null)),o().createElement(a.Form.Item,{name:"addAllCollections",label:i("Load all collections"),valuePropName:"checked",initialValue:!0},o().createElement(a.Checkbox,null)),p?null:o().createElement(a.Form.Item,{name:"collections",label:i("Collections")},o().createElement(a.Select,{mode:"multiple",allowClear:!0,loading:y,options:m,onFocus:v,optionFilterProp:"label"})))},f=p(375),m=p(477),b=p(230),d=p(442);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function g(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){v(a,n,o,l,i,"next",e)}function i(e){v(a,n,o,l,i,"throw",e)}l(void 0)})}}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function x(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function O(){var e,t,r=(e=["\n .ant-modal-body {\n margin-left: 35px;\n margin-bottom: 35px;\n .ant-checkbox-wrapper {\n height: 25px;\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return O=function(){return r},r}var S=function(t){var r=(0,e.useRecord)();return o().createElement(C,w({item:r},t))},j=function(){var t=(0,e.useResourceActionContext)().refresh,r=(0,d.useParams)().name,n=(0,e.useRecord)(),o=(0,e.useAPIClient)(),l=(0,b.useForm)(),i=((null==l?void 0:l.values)||{}).cascade,c=null==n?void 0:n.name;return{run:function(){return g(function(){var e,n,l,u,s;return x(this,function(p){switch(p.label){case 0:if(!c)return a.message.error("Collection name is missing"),[2];p.label=1;case 1:return p.trys.push([1,3,,4]),[4,o.request({url:"dataSources/".concat(r,"/collections:destroy"),method:"post",params:{filterByTk:c,cascade:i}})];case 2:return p.sent(),a.message.success("Collection deleted successfully"),t(),[3,4];case 3:throw e=p.sent(),a.message.error((null==e||null==(s=e.response)||null==(u=s.data)||null==(l=u.errors)||null==(n=l[0])?void 0:n.message)||"Failed to delete collection"),e;case 4:return[2]}})})()}}},E=function(){var t=j().run,r=(0,e.useCollectionManager_deprecated)().refreshCM;return{run:function(){return g(function(){return x(this,function(e){switch(e.label){case 0:return[4,t()];case 1:return e.sent(),[4,r()];case 2:return e.sent(),[2]}})})()}}},C=function(t){var r,i=t.scope,c=t.getContainer,u=t.item,s=t.children,p=t.isBulk,b=t.useAction,d=function(e,t){if(null==e)return{};var r,n,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}if(a=function(e,t){if(null==e)return{};var r,n,o={},a=Object.getOwnPropertyNames(e);for(n=0;n<a.length;n++)r=a[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(t,["scope","getContainer","item","children","isBulk","useAction"]),y=(0,l.useTranslation)().t,v=function(e){if(Array.isArray(e))return e}(r=(0,n.useState)(!1))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){l=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw r}}return o}}(r)||function(e){if(e){if("string"==typeof e)return h(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=v[0],x=v[1];return o().createElement(e.RecordProvider,{record:u},o().createElement(e.ActionContextProvider,{value:{visible:g,setVisible:x}},p?o().createElement(a.Button,{icon:o().createElement(f.DeleteOutlined,null),onClick:function(){return x(!0)}},s||y("Delete")):o().createElement("a",w({onClick:function(){return x(!0)}},d),s||y("Delete")),o().createElement(e.SchemaComponent,{schema:{type:"object",properties:{deleteCollection:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:o().createElement(function(){return o().createElement("span",null,o().createElement(f.ExclamationCircleFilled,{style:{color:"#faad14",marginRight:"12px",fontSize:"22px"}}),o().createElement("span",{style:{fontSize:"19px"}},y("Delete collection")))},null),"x-component-props":{width:520,getContainer:"{{ getContainer }}",className:(0,m.css)(O())},properties:{info:{type:"string","x-component":"div","x-content":"{{t('Are you sure you want to delete it?')}}"},cascade:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox",default:!1,"x-content":y("Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects")},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Ok") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDestroyCollectionAction }}",style:{marginLeft:"8px"}}}}}}}}},scope:w({getContainer:c,useDestroyCollectionAction:b||E,useCancelAction:e.useCancelAction},i)})))};function P(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function A(e,t,r){return(A=k()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_(o,r.prototype),o}).apply(null,arguments)}C.displayName="MssqlDeleteCollectionAction";function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t="function"==typeof Map?new Map:void 0;return(q=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,r)}function r(){return A(e,arguments,I(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_(r,e)})(e)}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(k=function(){return!!e})()}var F=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=I(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,k()?Reflect.construct(e,t||[],I(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&_(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return console.log("[MSSQL Plugin] Client loading..."),this.app.pm.get(r()).registerType("mssql",{name:"mssql",label:"External MSSQL",icon:"DatabaseOutlined",color:"blue",DataSourceSettingsForm:s,DeleteCollection:S,disableTestConnection:!1,disableAddFields:!1,allowCollectionDeletion:!0}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){P(a,n,o,l,i,"next",e)}function i(e){P(a,n,o,l,i,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,t),n}(q(e.Plugin)),T=F}(),y}()});
@@ -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.webpackChunkplugin_data_source_mssql_client_v2=self.webpackChunkplugin_data_source_mssql_client_v2||[]).push([["768"],{59:function(e,t,r){r.d(t,{MssqlConfigForm:function(){return s}});var n=r(155),l=r.n(n),a=r(440),o=r(953);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t,r,n,l,a,o){try{var u=e[a](o),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,l)}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,u=!1;try{for(l=l.call(e);!(o=(r=l.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){u=!0,n=e}finally{try{o||null==l.return||l.return()}finally{if(u)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(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 s=function(e){var t=e.initialValues,r=e.loadCollections,u=(0,o.useTranslation)().t,s=a.Form.useFormInstance(),m=a.Form.useWatch("addAllCollections",s),p=c((0,n.useState)([]),2),f=p[0],b=p[1],d=c((0,n.useState)(!1),2),y=d[0],h=d[1],v=(0,n.useCallback)(function(){var e;return(e=function(){return function(e,t){var r,n,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(o,"next",{value:i(0)}),u(o,"throw",{value:i(1)}),u(o,"return",{value:i(2)}),"function"==typeof Symbol&&u(o,Symbol.iterator,{value:function(){return this}}),o;function i(u){return function(i){var c=[u,i];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(l=2&c[0]?n.return:c[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,c[1])).done)return l;switch(n=0,l&&(c=[2&c[0],l.value]),c[0]){case 0:case 1:l=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!l||c[1]>l[0]&&c[1]<l[3])){a.label=c[1];break}if(6===c[0]&&a.label<l[1]){a.label=l[1],l=c;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(c);break}l[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=l=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:h(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,r(null==t?void 0:t.key)];case 2:var n,l,a,o,u,i;return b(Array.isArray(i=null!=(l=null!=(a=null!=(o=null==(n=e.sent())||null==(u=n.data)?void 0:u.data)?o:null==n?void 0:n.data)?a:n)?l:[])?i.map(function(e){var t="string"==typeof e?e:null==e?void 0:e.name;return{label:t,value:t}}):[]),[3,4];case 3:return h(!1),[7];case 4:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,l){var a=e.apply(t,r);function o(e){i(a,n,l,o,u,"next",e)}function u(e){i(a,n,l,o,u,"throw",e)}o(void 0)})})()},[r,null==t?void 0:t.key]);return l().createElement(l().Fragment,null,l().createElement(a.Form.Item,{name:["options","host"],label:u("Host"),rules:[{required:!0}]},l().createElement(a.Input,{placeholder:"localhost"})),l().createElement(a.Form.Item,{name:["options","port"],label:u("Port"),rules:[{required:!0}],initialValue:1433},l().createElement(a.InputNumber,{min:1,max:65535,style:{width:"100%"}})),l().createElement(a.Form.Item,{name:["options","database"],label:u("Database"),rules:[{required:!0}]},l().createElement(a.Input,null)),l().createElement(a.Form.Item,{name:["options","schema"],label:u("Schema")},l().createElement(a.Input,null)),l().createElement(a.Form.Item,{name:["options","username"],label:u("Username"),rules:[{required:!0}]},l().createElement(a.Input,null)),l().createElement(a.Form.Item,{name:["options","password"],label:u("Password")},l().createElement(a.Input.Password,null)),l().createElement(a.Form.Item,{name:["options","encrypt"],label:u("Encrypt"),valuePropName:"checked"},l().createElement(a.Checkbox,null)),l().createElement(a.Form.Item,{name:["options","tablePrefix"],label:u("Table prefix")},l().createElement(a.Input,null)),l().createElement(a.Form.Item,{name:"addAllCollections",label:u("Load all collections"),valuePropName:"checked",initialValue:!0},l().createElement(a.Checkbox,null)),m?null:l().createElement(a.Form.Item,{name:"collections",label:u("Collections")},l().createElement(a.Select,{mode:"multiple",allowClear:!0,loading:y,options:f,onFocus:v,optionFilterProp:"label"})))}}}]);
@@ -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("react-i18next"),require("@nocobase/plugin-data-source-manager/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):"function"==typeof define&&define.amd?define("plugin-data-source-mssql/client-v2",["react-i18next","@nocobase/plugin-data-source-manager/client-v2","@nocobase/client-v2","react","antd","@nocobase/client","@formily/react"],t):"object"==typeof exports?exports["plugin-data-source-mssql/client-v2"]=t(require("react-i18next"),require("@nocobase/plugin-data-source-manager/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):e["plugin-data-source-mssql/client-v2"]=t(e["react-i18next"],e["@nocobase/plugin-data-source-manager/client-v2"],e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"])}(self,function(e,t,r,n,o,i,c){return function(){"use strict";var u,a,l,s={230:function(e){e.exports=c},342:function(e){e.exports=i},485:function(e){e.exports=r},894:function(e){e.exports=t},440:function(e){e.exports=o},155:function(e){e.exports=n},953:function(t){t.exports=e}},f={};function p(e){var t=f[e];if(void 0!==t)return t.exports;var r=f[e]={exports:{}};return s[e](r,r.exports,p),r.exports}p.m=s,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var r in t)p.o(t,r)&&!p.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,r){return p.f[r](e,t),t},[]))},p.u=function(e){return""+e+".3fed63f49da7b624.js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},p.l=function(e,t,r,n){if(d[e])return void d[e].push(t);if(void 0!==r)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="plugin-data-source-mssql/client-v2:"+r){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","plugin-data-source-mssql/client-v2:"+r),o.src=e),d[e]=[t];var l=function(t,r){o.onerror=o.onload=null,clearTimeout(s);var n=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},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)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(b=p.g.location+"");var d,b,v=p.g.document;if(!b&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(b=v.currentScript.src),!b)){var y=v.getElementsByTagName("script");if(y.length)for(var h=y.length-1;h>-1&&(!b||!/^http(s?):/.test(b));)b=y[h--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");p.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},p.f.j=function(e,t){var r=p.o(u,e)?u[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=u[e]=[t,n]});t.push(r[2]=n);var o=p.p+p.u(e),i=Error();p.l(o,function(t){if(p.o(u,e)&&(0!==(r=u[e])&&(u[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r[1](i)}},"chunk-"+e,e)}},a=function(e,t){var r,n,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==u[e]})){for(r in i)p.o(i,r)&&(p.m[r]=i[r]);c&&c(p)}for(e&&e(t);a<o.length;a++)n=o[a],p.o(u,n)&&u[n]&&u[n][0](),u[n]=0},(l=self.webpackChunkplugin_data_source_mssql_client_v2=self.webpackChunkplugin_data_source_mssql_client_v2||[]).forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-data-source-mssql/dist/client-v2/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",o="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(o);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-data-source-mssql/dist/client-v2/"}p.p=e}(),!function(){p.r(m),p.d(m,{default:function(){return f}});var e=p(485),t=p(894),r=p.n(t),n=p(155),o=p.n(n);function i(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}function c(e,t,r){return(c=s()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&a(o,r.prototype),o}).apply(null,arguments)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=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,r)}function r(){return c(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),a(r,e)})(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var f=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=u(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,s()?Reflect.construct(e,t||[],u(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&a(n,e),t=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return(e=this.app.pm.get(r()))&&e.registerType("mssql",{label:"External MSSQL",SettingsForm:o().lazy(function(){return p.e("768").then(p.bind(p,59)).then(function(e){return{default:e.MssqlConfigForm}})}),disableTestConnection:!1,disableAddFields:!1}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var c=e.apply(t,r);function u(e){i(c,n,o,u,a,"next",e)}function a(e){i(c,n,o,u,a,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,t),n}(l(e.Plugin))}(),m}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/plugin-data-source-manager/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd")):"function"==typeof define&&define.amd?define("plugin-data-source-mssql/client-v2",["react-i18next","@nocobase/plugin-data-source-manager/client-v2","@nocobase/client-v2","react","antd"],t):"object"==typeof exports?exports["plugin-data-source-mssql/client-v2"]=t(require("react-i18next"),require("@nocobase/plugin-data-source-manager/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd")):e["plugin-data-source-mssql/client-v2"]=t(e["react-i18next"],e["@nocobase/plugin-data-source-manager/client-v2"],e["@nocobase/client-v2"],e.react,e.antd)}(self,function(e,t,n,r,o){return function(){"use strict";var i,u,c,a={485:function(e){e.exports=n},894:function(e){e.exports=t},440:function(e){e.exports=o},155:function(e){e.exports=r},953:function(t){t.exports=e}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return a[e](n,n.exports,s),n.exports}s.m=a,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+".85b62c2d73161eff.js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},s.l=function(e,t,n,r){if(f[e])return void f[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="plugin-data-source-mssql/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","plugin-data-source-mssql/client-v2:"+n),o.src=e),f[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=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)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var f,p,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var b=d.getElementsByTagName("script");if(b.length)for(var v=b.length-1;v>-1&&(!p||!/^http(s?):/.test(p));)p=b[v--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},s.f.j=function(e,t){var n=s.o(i,e)?i[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),u=Error();s.l(o,function(t){if(s.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}},u=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)s.o(u,n)&&(s.m[n]=u[n]);c&&c(s)}for(e&&e(t);a<o.length;a++)r=o[a],s.o(i,r)&&i[r]&&i[r][0](),i[r]=0},(c=self.webpackChunkplugin_data_source_mssql_client_v2=self.webpackChunkplugin_data_source_mssql_client_v2||[]).forEach(u.bind(null,0)),c.push=u.bind(null,c.push.bind(c));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/plugin-data-source-mssql/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(o);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-data-source-mssql/dist/client-v2/"}s.p=e}(),!function(){s.r(h),s.d(h,{default:function(){return p}});var e=s(485),t=s(894),n=s.n(t),r=s(155),o=s.n(r);function i(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function u(e,t,n){return(u=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&a(o,n.prototype),o}).apply(null,arguments)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=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 u(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=c(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">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,f()?Reflect.construct(e,t||[],c(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&a(r,e),t=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return(e=this.app.pm.get(n()))&&e.registerType("mssql",{label:"External MSSQL",SettingsForm:o().lazy(function(){return s.e("768").then(s.bind(s,59)).then(function(e){return{default:e.MssqlConfigForm}})}),disableTestConnection:!1,disableAddFields:!1}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function c(e){i(u,r,o,c,a,"next",e)}function a(e){i(u,r,o,c,a,"throw",e)}c(void 0)})}).call(this)}}],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)}}(r.prototype,t),r}(l(e.Plugin))}(),h}()});
@@ -14,11 +14,11 @@ module.exports = {
14
14
  "react": "18.2.0",
15
15
  "@nocobase/server": "2.1.6",
16
16
  "@nocobase/database": "2.1.6",
17
- "@formily/react": "2.3.7",
18
17
  "antd": "5.24.2",
19
18
  "react-i18next": "11.18.6",
20
19
  "@ant-design/icons": "5.6.1",
21
20
  "@emotion/css": "11.13.0",
21
+ "@formily/react": "2.3.7",
22
22
  "react-router-dom": "6.30.1",
23
23
  "@nocobase/data-source-manager": "2.1.6",
24
24
  "@nocobase/actions": "2.1.6",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "Data source: MSSQL",
4
4
  "displayName.ru-RU": "Источник данных: MSSQL",
5
5
  "displayName.zh-CN": "数据源:MSSQL",
6
- "version": "2.0.8",
6
+ "version": "2.0.11",
7
7
  "description": "External MSSQL data source support for NocoBase.",
8
8
  "license": "MIT",
9
9
  "main": "dist/server/index.js",
@@ -1,181 +1,92 @@
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
- import React, { useCallback } from 'react';
11
- import { SchemaComponent, useAPIClient } from '@nocobase/client';
12
- import { useForm } from '@formily/react';
13
- import { message } from 'antd';
14
- import { useTranslation } from 'react-i18next';
15
-
16
- type CollectionsFieldFactoryResult = {
17
- CollectionsTable: React.ComponentType<any>;
18
- createCollectionsSchema: (from?: 'create' | 'edit', loadCollections?: (key: string) => Promise<any>) => any;
19
- Text: React.ComponentType<any>;
20
- addAllCollectionsSchema?: any;
21
- };
22
-
23
- type CollectionsFieldFactory = (params: { NAMESPACE: string; t: any }) => CollectionsFieldFactoryResult;
24
-
25
- type MssqlConfigFormProps = {
26
- CollectionsTableField: CollectionsFieldFactory;
27
- loadCollections: (key: string) => Promise<any>;
28
- from?: 'create' | 'edit';
29
- };
30
-
31
- export const MssqlConfigForm: React.FC<MssqlConfigFormProps> = ({ CollectionsTableField, loadCollections, from }) => {
32
- console.log('[MSSQL Plugin] ConfigForm rendering...');
33
- const api = useAPIClient();
34
- const form = useForm();
35
- const { t } = useTranslation();
36
- const NAMESPACE = 'data-source-manager';
37
- const { CollectionsTable, createCollectionsSchema, Text, addAllCollectionsSchema } = CollectionsTableField({
38
- NAMESPACE,
39
- t,
40
- });
41
- const handleTestConnection = useCallback(async () => {
42
- await form.submit();
43
- const values = form.values;
44
-
45
- try {
46
- await api.request({
47
- url: 'dataSources:testConnection',
48
- method: 'post',
49
- data: {
50
- values: {
51
- type: 'mssql',
52
- options: values.options || values,
53
- },
54
- },
55
- });
56
- message.success(t('Connection successful'));
57
- } catch (error) {
58
- const errMessage = error?.response?.data?.errors?.[0]?.message || error?.response?.data?.message || error.message;
59
- message.error(errMessage);
60
- return;
61
- }
62
- }, [api, form, t]);
63
-
64
-
65
- return (
66
- <SchemaComponent
67
- scope={{
68
- CollectionsTableField,
69
- loadCollections,
70
- handleTestConnection,
71
- from,
72
- t,
73
- CollectionsTable,
74
- createCollectionsSchema,
75
- Text,
76
- addAllCollectionsSchema,
77
- }}
78
- components={{ CollectionsTable, Text }}
79
- schema={{
80
- type: 'object',
81
- properties: {
82
- type: {
83
- type: 'string',
84
- 'x-decorator': 'FormItem',
85
- 'x-component': 'Input',
86
- 'x-hidden': true,
87
- },
88
- key: {
89
- type: 'string',
90
- title: t('Data source name'),
91
- required: true,
92
- 'x-decorator': 'FormItem',
93
- 'x-component': 'Input',
94
- },
95
- displayName: {
96
- type: 'string',
97
- title: t('Display name'),
98
- required: true,
99
- 'x-decorator': 'FormItem',
100
- 'x-component': 'Input',
101
- },
102
- options: {
103
- type: 'object',
104
- properties: {
105
- host: {
106
- type: 'string',
107
- title: t('Host'),
108
- required: true,
109
- 'x-decorator': 'FormItem',
110
- 'x-component': 'Input',
111
- 'x-component-props': {
112
- placeholder: 'localhost',
113
- },
114
- },
115
- port: {
116
- type: 'number',
117
- title: t('Port'),
118
- required: true,
119
- 'x-decorator': 'FormItem',
120
- 'x-component': 'InputNumber',
121
- 'x-component-props': {
122
- min: 1,
123
- max: 65535,
124
- },
125
- default: 1433,
126
- },
127
- database: {
128
- type: 'string',
129
- title: t('Database'),
130
- required: true,
131
- 'x-decorator': 'FormItem',
132
- 'x-component': 'Input',
133
- },
134
- schema: {
135
- type: 'string',
136
- title: t('Schema'),
137
- 'x-decorator': 'FormItem',
138
- 'x-component': 'Input',
139
- },
140
- username: {
141
- type: 'string',
142
- title: t('Username'),
143
- required: true,
144
- 'x-decorator': 'FormItem',
145
- 'x-component': 'Input',
146
- },
147
- password: {
148
- type: 'string',
149
- title: t('Password'),
150
- 'x-decorator': 'FormItem',
151
- 'x-component': 'Password',
152
- },
153
- encrypt: {
154
- type: 'boolean',
155
- title: t('Encrypt'),
156
- 'x-decorator': 'FormItem',
157
- 'x-component': 'Checkbox',
158
- },
159
- tablePrefix: {
160
- type: 'string',
161
- title: t('Table prefix'),
162
- 'x-decorator': 'FormItem',
163
- 'x-component': 'Input',
164
- },
165
- addAllCollections: {
166
- type: 'boolean',
167
- title: t('Load all collections'),
168
- 'x-decorator': 'FormItem',
169
- 'x-component': 'Checkbox',
170
- default: true,
171
- },
172
- collections: createCollectionsSchema(from, loadCollections),
173
- },
174
- },
175
- },
176
- }}
177
- />
178
- );
179
- };
180
-
181
- export default MssqlConfigForm;
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
+ import React, { useCallback, useState } from 'react';
11
+ import { Checkbox, Form, Input, InputNumber, Select } from 'antd';
12
+ import { useTranslation } from 'react-i18next';
13
+
14
+ interface MssqlConfigFormProps {
15
+ mode: 'create' | 'edit';
16
+ type: Record<string, any>;
17
+ initialValues?: Record<string, any>;
18
+ loadCollections: (key: string) => Promise<any>;
19
+ }
20
+
21
+ function toCollectionOptions(result: any): { label: string; value: string }[] {
22
+ const list = result?.data?.data ?? result?.data ?? result ?? [];
23
+ if (!Array.isArray(list)) return [];
24
+ return list.map((item: any) => {
25
+ const name = typeof item === 'string' ? item : item?.name;
26
+ return { label: name, value: name };
27
+ });
28
+ }
29
+
30
+ export const MssqlConfigForm: React.FC<MssqlConfigFormProps> = ({ initialValues, loadCollections }) => {
31
+ const { t } = useTranslation();
32
+ const form = Form.useFormInstance();
33
+ const addAllCollections = Form.useWatch('addAllCollections', form);
34
+ const [collectionOptions, setCollectionOptions] = useState<{ label: string; value: string }[]>([]);
35
+ const [loading, setLoading] = useState(false);
36
+
37
+ const handleLoadCollections = useCallback(async () => {
38
+ setLoading(true);
39
+ try {
40
+ const result = await loadCollections(initialValues?.key);
41
+ setCollectionOptions(toCollectionOptions(result));
42
+ } finally {
43
+ setLoading(false);
44
+ }
45
+ }, [loadCollections, initialValues?.key]);
46
+
47
+ return (
48
+ <>
49
+ <Form.Item name={['options', 'host']} label={t('Host')} rules={[{ required: true }]}>
50
+ <Input placeholder="localhost" />
51
+ </Form.Item>
52
+ <Form.Item name={['options', 'port']} label={t('Port')} rules={[{ required: true }]} initialValue={1433}>
53
+ <InputNumber min={1} max={65535} style={{ width: '100%' }} />
54
+ </Form.Item>
55
+ <Form.Item name={['options', 'database']} label={t('Database')} rules={[{ required: true }]}>
56
+ <Input />
57
+ </Form.Item>
58
+ <Form.Item name={['options', 'schema']} label={t('Schema')}>
59
+ <Input />
60
+ </Form.Item>
61
+ <Form.Item name={['options', 'username']} label={t('Username')} rules={[{ required: true }]}>
62
+ <Input />
63
+ </Form.Item>
64
+ <Form.Item name={['options', 'password']} label={t('Password')}>
65
+ <Input.Password />
66
+ </Form.Item>
67
+ <Form.Item name={['options', 'encrypt']} label={t('Encrypt')} valuePropName="checked">
68
+ <Checkbox />
69
+ </Form.Item>
70
+ <Form.Item name={['options', 'tablePrefix']} label={t('Table prefix')}>
71
+ <Input />
72
+ </Form.Item>
73
+ <Form.Item name="addAllCollections" label={t('Load all collections')} valuePropName="checked" initialValue={true}>
74
+ <Checkbox />
75
+ </Form.Item>
76
+ {!addAllCollections ? (
77
+ <Form.Item name="collections" label={t('Collections')}>
78
+ <Select
79
+ mode="multiple"
80
+ allowClear
81
+ loading={loading}
82
+ options={collectionOptions}
83
+ onFocus={handleLoadCollections}
84
+ optionFilterProp="label"
85
+ />
86
+ </Form.Item>
87
+ ) : null}
88
+ </>
89
+ );
90
+ };
91
+
92
+ export default MssqlConfigForm;
@@ -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.webpackChunkplugin_data_source_mssql_client_v2=self.webpackChunkplugin_data_source_mssql_client_v2||[]).push([["768"],{59:function(e,t,o){o.d(t,{MssqlConfigForm:function(){return u}});var n=o(155),r=o.n(n),a=o(342),l=o(230),s=o(440),c=o(953);function i(e,t,o,n,r,a,l){try{var s=e[a](l),c=s.value}catch(e){o(e);return}s.done?t(c):Promise.resolve(c).then(n,r)}var u=function(e){var t=e.CollectionsTableField,o=e.loadCollections,u=e.from;console.log("[MSSQL Plugin] ConfigForm rendering...");var p=(0,a.useAPIClient)(),m=(0,l.useForm)(),d=(0,c.useTranslation)().t,f=t({NAMESPACE:"data-source-manager",t:d}),b=f.CollectionsTable,x=f.createCollectionsSchema,y=f.Text,h=f.addAllCollectionsSchema,v=(0,n.useCallback)(function(){var e;return(e=function(){var e,t,o,n,r,a,l,c,i;return function(e,t){var o,n,r,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(l,"next",{value:c(0)}),s(l,"throw",{value:c(1)}),s(l,"return",{value:c(2)}),"function"==typeof Symbol&&s(l,Symbol.iterator,{value:function(){return this}}),l;function c(s){return function(c){var i=[s,c];if(o)throw TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(a=0)),a;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(u){switch(u.label){case 0:return[4,m.submit()];case 1:u.sent(),e=m.values,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,p.request({url:"dataSources:testConnection",method:"post",data:{values:{type:"mssql",options:e.options||e}}})];case 3:return u.sent(),s.message.success(d("Connection successful")),[3,5];case 4:return i=(null==(t=u.sent())||null==(a=t.response)||null==(r=a.data)||null==(n=r.errors)||null==(o=n[0])?void 0:o.message)||(null==t||null==(c=t.response)||null==(l=c.data)?void 0:l.message)||t.message,s.message.error(i),[2];case 5:return[2]}})},function(){var t=this,o=arguments;return new Promise(function(n,r){var a=e.apply(t,o);function l(e){i(a,n,r,l,s,"next",e)}function s(e){i(a,n,r,l,s,"throw",e)}l(void 0)})})()},[p,m,d]);return r().createElement(a.SchemaComponent,{scope:{CollectionsTableField:t,loadCollections:o,handleTestConnection:v,from:u,t:d,CollectionsTable:b,createCollectionsSchema:x,Text:y,addAllCollectionsSchema:h},components:{CollectionsTable:b,Text:y},schema:{type:"object",properties:{type:{type:"string","x-decorator":"FormItem","x-component":"Input","x-hidden":!0},key:{type:"string",title:d("Data source name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},displayName:{type:"string",title:d("Display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},options:{type:"object",properties:{host:{type:"string",title:d("Host"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"localhost"}},port:{type:"number",title:d("Port"),required:!0,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:65535},default:1433},database:{type:"string",title:d("Database"),required:!0,"x-decorator":"FormItem","x-component":"Input"},schema:{type:"string",title:d("Schema"),"x-decorator":"FormItem","x-component":"Input"},username:{type:"string",title:d("Username"),required:!0,"x-decorator":"FormItem","x-component":"Input"},password:{type:"string",title:d("Password"),"x-decorator":"FormItem","x-component":"Password"},encrypt:{type:"boolean",title:d("Encrypt"),"x-decorator":"FormItem","x-component":"Checkbox"},tablePrefix:{type:"string",title:d("Table prefix"),"x-decorator":"FormItem","x-component":"Input"},addAllCollections:{type:"boolean",title:d("Load all collections"),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},collections:x(u,o)}}}}})}}}]);