@nocobase/plugin-action-export 2.1.0-beta.30 → 2.1.0-beta.33
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/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +1 -1
- package/dist/client/locale/index.d.ts +2 -1
- package/dist/{client/models → client-v2}/ExportActionModel.d.ts +1 -1
- package/dist/client-v2/index.d.ts +15 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +9 -0
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/exceljs/package.json +1 -1
- package/package.json +3 -2
- /package/dist/{client → client-v2}/buildExportFieldOptions.d.ts +0 -0
- /package/dist/{client/models → client-v2}/getOptionFields.d.ts +0 -0
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
package/dist/client/index.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ export * from './ExportDesigner';
|
|
|
11
11
|
export * from './ExportPluginProvider';
|
|
12
12
|
export * from './useExportAction';
|
|
13
13
|
import { Plugin } from '@nocobase/client';
|
|
14
|
-
export { buildExportFieldOptions } from '
|
|
14
|
+
export { buildExportFieldOptions } from '../client-v2/buildExportFieldOptions';
|
|
15
15
|
export declare class PluginActionExportClient extends Plugin {
|
|
16
16
|
load(): Promise<void>;
|
|
17
17
|
}
|
|
18
|
+
export { ExportActionModel } from '../client-v2/ExportActionModel';
|
|
18
19
|
export default PluginActionExportClient;
|
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("lodash"),require("react-i18next"),require("@nocobase/flow-engine"),require("@emotion/css"),require("file-saver"),require("@formily/antd-v5"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-export",["lodash","react-i18next","@nocobase/flow-engine","@emotion/css","file-saver","@formily/antd-v5","@formily/shared","react","antd","@nocobase/client","@formily/react"],t):"object"==typeof exports?exports["@nocobase/plugin-action-export"]=t(require("lodash"),require("react-i18next"),require("@nocobase/flow-engine"),require("@emotion/css"),require("file-saver"),require("@formily/antd-v5"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):e["@nocobase/plugin-action-export"]=t(e.lodash,e["react-i18next"],e["@nocobase/flow-engine"],e["@emotion/css"],e["file-saver"],e["@formily/antd-v5"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"])}(self,function(e,t,n,r,o,i,a,l,c,u,s){return function(){"use strict";var p={477:function(e){e.exports=r},418:function(e){e.exports=i},230:function(e){e.exports=s},166:function(e){e.exports=a},342:function(e){e.exports=u},694:function(e){e.exports=n},59:function(e){e.exports=c},506:function(e){e.exports=o},773:function(t){t.exports=e},155:function(e){e.exports=l},953:function(e){e.exports=t}},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return p[e](n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(m=d.g.location+"");var m,b=d.g.document;if(!m&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(m=b.currentScript.src),!m)){var y=b.getElementsByTagName("script");if(y.length)for(var v=y.length-1;v>-1&&(!m||!/^http(s?):/.test(m));)m=y[v--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");d.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");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/@nocobase/plugin-action-export/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-export/dist/client/"}d.p=e}(),!function(){d.r(h),d.d(h,{ExportPluginProvider:function(){return k},ExportActionInitializer:function(){return y},PluginActionExportClient:function(){return en},buildExportFieldOptions:function(){return m},default:function(){return er},useExportAction:function(){return q},ExportDesigner:function(){return E}});var e,t=d(166),n=d(342),r=d(155),o=d.n(r),i=d(230);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}var l=["hasMany","belongsToMany","belongsToArray"],c=((function(e){if(Array.isArray(e))return a(e)})(e=["hasOne","belongsTo"])||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return a(e,void 0);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 a(e,void 0)}}(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.")}()).concat(["hasMany","belongsToMany","belongsToArray"]),u=function(e){return(null==e?void 0:e.target)&&c.includes(e.type)},s=function(e){return(null==e?void 0:e.target)&&l.includes(e.type)},p=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{name:e.name,title:t(e),schema:null==e?void 0:e.uiSchema,disabled:n}},f=function(e,t,n){var r,o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!(null==e?void 0:e.interface))return null;if(!u(e))return p(e,t);var a=(n(e)||[]).map(function(r){return u(r)?i>=2||s(e)&&s(r)?null:f(r,t,n,i+1):f(r,t,n)}).filter(Boolean);return a.length?(r=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}({},p(e,t)),o=o={children:a},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r):p(e,t,!0)},m=function(e,t,n){return(e||[]).map(function(e){return f(e,t,n,+!!u(e))}).filter(Boolean)},b=function(e){var t,r=(0,i.useFieldSchema)();null==r||null==(t=r["x-component-props"])||t.nonfilterable;var o=(0,n.useCollectionManager_deprecated)().getCollectionFields,a=o(e),l=(0,n.useCompile)();return m(a,function(e){var t;return l(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name},function(e){return o(e.target)})},y=function(){var e=(0,n.useSchemaInitializerItem)(),r=(0,n.useSchemaInitializer)().insert,i=b((0,n.useCollection_deprecated)().name),a={type:"void",title:'{{ t("Export") }}',"x-action":"export","x-action-settings":{exportSettings:[]},"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:export","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useExportAction","x-component-props":{icon:"clouddownloadoutlined"}};return o().createElement(n.SchemaInitializerItem,{title:e.title,onClick:function(){a["x-action-settings"].exportSettings=null==i?void 0:i.filter(function(e){return!e.children&&!e.disabled}).map(function(e){return{dataIndex:[e.name]}});var n,o=(0,t.merge)(a||{},e.schema||{});null==e||null==(n=e.schemaInitialize)||n.call(e,o),r(o)}})},v=d(418);function x(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function g(){var e=x(["\n width: 100%;\n & .ant-space-item:nth-child(2),\n & .ant-space-item:nth-child(3) {\n flex: 1;\n }\n "]);return g=function(){return e},e}function S(){var e=x(["\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n &.ant-btn-dashed:hover {\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n }\n "]);return S=function(){return e},e}var w=function(){var e=(0,n.useCollection_deprecated)().name,t=(0,n.useCompile)(),r=b(e);return{schema:{type:"void","x-component":"Grid",properties:{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:(0,n.css)(g())},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":"Cascader",required:!0,"x-component-props":{fieldNames:{label:"title",value:"name",children:"children"},changeOnSelect:!1},"x-use-component-props":function(){return{options:t(r)}}},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Custom column title") }}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add exportable field") }}',"x-component":"ArrayItems.Addition","x-component-props":{className:(0,n.css)(S())}}}}}}}},O=d(953),I="action-export";function j(){return(0,O.useTranslation)([I,"client"],{nsMode:"fallback"})}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 P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=function(){var e,t,a,l,c,u,s=(0,i.useField)(),p=(0,i.useFieldSchema)(),f=j().t,d=(0,n.useDesignable)().dn,m=function(e){if(Array.isArray(e))return e}(e=(0,r.useState)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return A(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 A(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),b=m[0],y=m[1],h=w().schema;return(0,r.useEffect)(function(){y(h)},[s.address,null==p||null==(t=p["x-action-settings"])?void 0:t.exportSettings]),o().createElement(n.GeneralSchemaDesigner,{disableInitializer:!0},o().createElement(n.SchemaSettingsModalItem,{title:f("Edit button"),schema:{type:"object",title:f("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:f("Button title"),default:p.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:f("Button icon"),default:null==p||null==(a=p["x-component-props"])?void 0:a.icon,"x-component-props":{}},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:f("Button background color"),default:(null==p||null==(l=p["x-component-props"])?void 0:l.danger)?"danger":(null==p||null==(c=p["x-component-props"])?void 0:c.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:function(e){var t,n=e.title,r=e.icon,o=e.type;p.title=n,s.title=n,s.componentProps.icon=r,s.componentProps.danger="danger"===o,s.componentProps.type=o,p["x-component-props"]=p["x-component-props"]||{},p["x-component-props"].icon=r,p["x-component-props"].danger="danger"===o,p["x-component-props"].type=o,d.emit("patch",{schema:(P(t={},"x-uid",p["x-uid"]),P(t,"title",n),P(t,"x-component-props",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){P(e,t,n[t])})}return e}({},p["x-component-props"])),t)}),d.refresh()}}),o().createElement(n.SchemaSettingsActionModalItem,{title:f("Exportable fields"),schema:b,initialValues:{exportSettings:null==p||null==(u=p["x-action-settings"])?void 0:u.exportSettings},scope:{t:f},components:{ArrayItems:v.ArrayItems},onSubmit:function(e){var t,n=e.exportSettings;p["x-action-settings"].exportSettings=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}}),d.emit("patch",{schema:(P(t={},"x-uid",p["x-uid"]),P(t,"x-action-settings",p["x-action-settings"]),t)}),d.refresh()}}),o().createElement(n.SchemaSettingsDivider,null),o().createElement(n.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:function(e){return"Space"===e["x-component"]||e["x-component"].endsWith("ActionBar")},confirm:{title:f("Delete action")}}))},k=function(e){return o().createElement(n.SchemaComponentOptions,{components:{ExportActionInitializer:y,ExportDesigner:E},scope:{useExportAction:q}},e.children)},T=d(773),C=d.n(T),_=d(506),F=d(59);function M(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)}var q=function(){var e,t=(0,n.useBlockRequestContext)(),o=t.service,a=t.props,l=(0,n.useDataBlockResource)(),c=(0,n.useTableBlockContext)().params,u=(0,n.useCurrentAppInfo)(),s=null==a?void 0:a.params.filter,p=(0,i.useFieldSchema)(),f=(0,n.useCompile)(),d=(0,n.useCollectionManager_deprecated)().getCollectionJoinField,m=(0,n.useCollection_deprecated)(),b=m.name,y=m.title,v=j().t,h=F.App.useApp().modal,x=(null==(e=o.params[0])?void 0:e.filter)||{},g=(0,i.useField)(),S=(0,r.useMemo)(function(){var e;return(null==u||null==(e=u.data)?void 0:e.exportLimit)?u.data.exportLimit:2e3},[u]);return{onClick:function(){var e;return(e=function(){var e,t,r,i,a;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(u){switch(u.label){case 0:return g.data=g.data||{},[4,h.confirm({title:v("Export"),content:v("Export warning",{limit:S}),okText:v("Start export")})];case 1:if(!u.sent())return[2];return g.data.loading=!0,(i=C().cloneDeep(null!=(e=null==p?void 0:p["x-action-settings"])?e:{}).exportSettings).forEach(function(e){var t,n,r=null!=(t=d("".concat(b,".").concat(e.dataIndex.join("."))))?t:{},o=r.uiSchema;r.interface,e.enum=null==o||null==(n=o.enum)?void 0:n.map(function(e){return{value:e.value,label:e.label}}),e.enum||(null==o?void 0:o.type)!=="boolean"||(e.enum=[{value:!0,label:v("Yes")},{value:!1,label:v("No")}]),e.defaultTitle=null==o?void 0:o.title}),[4,l.export({title:f(y),appends:null==(r=o.params[0])||null==(t=r.appends)?void 0:t.join(),filter:(0,n.mergeFilter)([x,s]),sort:null==c?void 0:c.sort,values:{columns:f(i)}},{responseType:"blob"})];case 2:return a=new Blob([u.sent().data],{type:"application/x-xls"}),g.data.loading=!1,(0,_.saveAs)(a,"".concat(f(y),".xlsx")),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){M(i,r,o,a,l,"next",e)}function l(e){M(i,r,o,a,l,"throw",e)}a(void 0)})})()}}};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 R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var D=new n.SchemaSettings({name:"actionSettings:export",items:[{name:"editButton",Component:n.ButtonEditor,useComponentProps:function(){return(0,n.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return 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){R(e,t,n[t])})}return e}({},(0,n.useSchemaToolbar)().linkageRulesProps)}},{name:"exportableFields",type:"actionModal",useComponentProps:function(){var e,t,o,a=(0,i.useField)(),l=(0,i.useFieldSchema)(),c=(0,O.useTranslation)().t,u=(0,n.useDesignable)().dn,s=function(e){if(Array.isArray(e))return e}(e=(0,r.useState)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return B(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 B(e,2)}}(e)||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=s[0],f=s[1],d=w().schema;return(0,r.useEffect)(function(){f(d)},[a.address,null==l||null==(t=l["x-action-settings"])?void 0:t.exportSettings]),{title:c("Exportable fields"),schema:p,initialValues:{exportSettings:null==l||null==(o=l["x-action-settings"])?void 0:o.exportSettings},components:{ArrayItems:v.ArrayItems},onSubmit:function(e){var t,n=e.exportSettings;l["x-action-settings"].exportSettings=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}}),u.emit("patch",{schema:(R(t={},"x-uid",l["x-uid"]),R(t,"x-action-settings",l["x-action-settings"]),t)}),u.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:function(e){return"Space"===e["x-component"]||e["x-component"].endsWith("ActionBar")},confirm:{title:(0,(0,O.useTranslation)().t)("Delete action")}}}}]}),z=d(694),N=d(477);function $(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,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function K(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=function(){return!!e})()}function V(){var e=H(["\n width: 100%;\n & .ant-space-item:nth-child(2),\n & .ant-space-item:nth-child(3) {\n flex: 1;\n }\n "]);return V=function(){return e},e}function W(){var e=H(["\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n &.ant-btn-dashed:hover {\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n }\n "]);return W=function(){return e},e}var Y=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=L(t),G(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,K()?Reflect.construct(t,r||[],L(this).constructor):t.apply(this,r)),"defaultProps",{title:(0,z.escapeT)("Export"),type:"default",icon:"clouddownloadoutlined"}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&U(n,e),t=[{key:"getAclActionName",value:function(){return"export"}}],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}(n.ActionModel);function J(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 Q(e,t,n){return(Q=et()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Z(o,n.prototype),o}).apply(null,arguments)}G(Y,"scene",n.ActionSceneEnum.collection),Y.define({label:(0,z.escapeT)("Export")}),Y.registerFlow({key:"exportSettings",on:"click",steps:{confirm:{use:"confirm",hideInSettings:!0,defaultParams:{enable:!0,title:(0,z.escapeT)("Export"),content:(0,z.escapeT)("Export warning",{ns:I,limit:2e3})}},export:{handler:function(e,t){var n;return(n=function(){var t,n,r,o,i,a,l,c,u,s;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(p){switch(p.label){case 0:return t=e.model.getProps().exportSettings,r=(n=e.model.context.blockModel).resource,i=(o=n.collection).title,a=o.fields,l=o.filterTargetKey,u=(c=r.getSelectedRows()).length>0?G({},l,e.blockModel.collection.getFilterByTK(c)):r.getFilter(),Array.isArray(l)&&l.length>1&&(u={$or:e.blockModel.collection.getFilterByTK(c)}),t.forEach(function(t){var n,r,o=null!=(n=a.get(t.dataIndex[0]))?n:{},i=o.uiSchema;o.interface,t.enum=null==i||null==(r=i.enum)?void 0:r.map(function(e){return{value:e.value,label:e.label}}),t.enum||(null==i?void 0:i.type)!=="boolean"||(t.enum=[{value:!0,label:e.t("Yes")},{value:!1,label:e.t("No")}]),t.defaultTitle=e.t(null==i?void 0:i.title)}),[4,r.runAction("export",{data:{columns:t},responseType:"blob",params:{title:e.t(i),appends:r.getAppends(),sort:r.getSort(),filter:u}})];case 1:return s=new Blob([p.sent()],{type:"application/x-xls"}),(0,_.saveAs)(s,"".concat(e.t(i),".xlsx")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){$(i,r,o,a,l,"next",e)}function l(e){$(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}}),Y.registerFlow({key:"exportActionSetting",title:(0,z.escapeT)("Export settings",{ns:I}),steps:{exportableFields:{title:(0,z.escapeT)("Exportable fields"),uiSchema:function(e){var t,r,o=(t=e.model.context.blockModel.collection.getFields(),r=e.t,m(t,function(e){var t;return r(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name},function(e){return e.targetCollection&&e.targetCollection.getFields()||[]}));return{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:(0,N.css)(V())},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":n.Cascader,required:!0,"x-component-props":{fieldNames:{label:"title",value:"name",children:"children"},changeOnSelect:!1,options:o}},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Custom column title") }}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add exportable field") }}',"x-component":"ArrayItems.Addition","x-component-props":{className:(0,N.css)(W())}}}}}},defaultParams:function(e){var t;return{exportSettings:null==(t=e.model.context.blockModel.collection.getFields())?void 0:t.filter(function(e){return!e.isAssociationField()&&e.options.interface}).map(function(e){return{dataIndex:[e.name]}})}},handler:function(e,t){var n=t.exportSettings,r=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}});e.model.setProps("exportSettings",r)}}}});function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(e){var t="function"==typeof Map?new Map:void 0;return(ee=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 Q(e,arguments,X(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Z(n,e)})(e)}function et(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(et=function(){return!!e})()}var en=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=X(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,et()?Reflect.construct(e,t||[],X(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&Z(r,e),t=[{key:"load",value:function(){var e;return(e=function(){var e,t;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(r){return this.app.use(k),e={title:"{{t('Export')}}",Component:"ExportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:function(){return(0,n.useActionAvailable)("export")}},null==(t=this.app.schemaInitializerManager.get("table:configureActions"))||t.add("enableActions.export",e),this.app.schemaInitializerManager.addItem("gantt:configureActions","enableActions.export",e),this.app.schemaSettingsManager.add(D),this.app.flowEngine.registerModels({ExportActionModel:Y}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){J(i,r,o,a,l,"next",e)}function l(e){J(i,r,o,a,l,"throw",e)}a(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}(ee(n.Plugin)),er=en}(),h}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("react-i18next"),require("@nocobase/flow-engine"),require("@nocobase/client-v2"),require("@emotion/css"),require("@formily/antd-v5"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-export",["lodash","react-i18next","@nocobase/flow-engine","@nocobase/client-v2","@emotion/css","@formily/antd-v5","@formily/shared","react","antd","@nocobase/client","@formily/react"],t):"object"==typeof exports?exports["@nocobase/plugin-action-export"]=t(require("lodash"),require("react-i18next"),require("@nocobase/flow-engine"),require("@nocobase/client-v2"),require("@emotion/css"),require("@formily/antd-v5"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react")):e["@nocobase/plugin-action-export"]=t(e.lodash,e["react-i18next"],e["@nocobase/flow-engine"],e["@nocobase/client-v2"],e["@emotion/css"],e["@formily/antd-v5"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"])}(self,function(e,t,n,r,o,i,a,l,c,u,s){return function(){var p={574:function(e,t,n){var r,o;void 0===(o="function"==typeof(r=function(){"use strict";function t(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){l(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function o(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,n,a){var l=i.URL||i.webkitURL,c=document.createElement("a");c.download=n=n||e.name||"download",c.rel="noopener","string"==typeof e?(c.href=e,c.origin===location.origin?o(c):r(c.href)?t(e,n,a):o(c,c.target="_blank")):(c.href=l.createObjectURL(e),setTimeout(function(){l.revokeObjectURL(c.href)},4e4),setTimeout(function(){o(c)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,i){if(n=n||e.name||"download","string"!=typeof e){var a;navigator.msSaveOrOpenBlob((void 0===(a=i)?a={autoBom:!1}:"object"!=typeof a&&(console.warn("Deprecated: Expected third argument to be a object"),a={autoBom:!a}),a.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(r(e))t(e,n,i);else{var l=document.createElement("a");l.href=e,l.target="_blank",setTimeout(function(){o(l)})}}:function(e,n,r,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,r);var l="application/octet-stream"===e.type,c=/constructor/i.test(i.HTMLElement)||i.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||l&&c||a)&&"u">typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},s.readAsDataURL(e)}else{var p=i.URL||i.webkitURL,f=p.createObjectURL(e);o?o.location=f:location.href=f,o=null,setTimeout(function(){p.revokeObjectURL(f)},4e4)}});i.saveAs=l.saveAs=l,e.exports=l})?r.apply(t,[]):r)||(e.exports=o)},477:function(e){"use strict";e.exports=o},418:function(e){"use strict";e.exports=i},230:function(e){"use strict";e.exports=s},166:function(e){"use strict";e.exports=a},342:function(e){"use strict";e.exports=u},485:function(e){"use strict";e.exports=r},694:function(e){"use strict";e.exports=n},59:function(e){"use strict";e.exports=c},773:function(t){"use strict";t.exports=e},155:function(e){"use strict";e.exports=l},953:function(e){"use strict";e.exports=t}},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return p[e].call(n.exports,n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(m=d.g.location+"");var m,b=d.g.document;if(!m&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(m=b.currentScript.src),!m)){var v=b.getElementsByTagName("script");if(v.length)for(var y=v.length-1;y>-1&&(!m||!/^http(s?):/.test(m));)m=v[y--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");d.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var h={};return!function(){"use strict";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/@nocobase/plugin-action-export/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-export/dist/client/"}d.p=e}(),!function(){"use strict";d.r(h),d.d(h,{PluginActionExportClient:function(){return er},ExportDesigner:function(){return P},buildExportFieldOptions:function(){return m},default:function(){return eo},ExportActionModel:function(){return V},ExportPluginProvider:function(){return k},useExportAction:function(){return R},ExportActionInitializer:function(){return v}});var e,t=d(166),n=d(342),r=d(155),o=d.n(r),i=d(230);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}var l=["hasMany","belongsToMany","belongsToArray"],c=((function(e){if(Array.isArray(e))return a(e)})(e=["hasOne","belongsTo"])||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return a(e,void 0);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 a(e,void 0)}}(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.")}()).concat(["hasMany","belongsToMany","belongsToArray"]),u=function(e){return(null==e?void 0:e.target)&&c.includes(e.type)},s=function(e){return(null==e?void 0:e.target)&&l.includes(e.type)},p=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{name:e.name,title:t(e),schema:null==e?void 0:e.uiSchema,disabled:n}},f=function(e,t,n){var r,o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!(null==e?void 0:e.interface))return null;if(!u(e))return p(e,t);var a=(n(e)||[]).map(function(r){return u(r)?i>=2||s(e)&&s(r)?null:f(r,t,n,i+1):f(r,t,n)}).filter(Boolean);return a.length?(r=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}({},p(e,t)),o=o={children:a},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r):p(e,t,!0)},m=function(e,t,n){return(e||[]).map(function(e){return f(e,t,n,+!!u(e))}).filter(Boolean)},b=function(e){var t,r=(0,i.useFieldSchema)();null==r||null==(t=r["x-component-props"])||t.nonfilterable;var o=(0,n.useCollectionManager_deprecated)().getCollectionFields,a=o(e),l=(0,n.useCompile)();return m(a,function(e){var t;return l(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name},function(e){return o(e.target)})},v=function(){var e=(0,n.useSchemaInitializerItem)(),r=(0,n.useSchemaInitializer)().insert,i=b((0,n.useCollection_deprecated)().name),a={type:"void",title:'{{ t("Export") }}',"x-action":"export","x-action-settings":{exportSettings:[]},"x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:export","x-decorator":"ACLActionProvider","x-component":"Action","x-use-component-props":"useExportAction","x-component-props":{icon:"clouddownloadoutlined"}};return o().createElement(n.SchemaInitializerItem,{title:e.title,onClick:function(){a["x-action-settings"].exportSettings=null==i?void 0:i.filter(function(e){return!e.children&&!e.disabled}).map(function(e){return{dataIndex:[e.name]}});var n,o=(0,t.merge)(a||{},e.schema||{});null==e||null==(n=e.schemaInitialize)||n.call(e,o),r(o)}})},y=d(418);function g(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function x(){var e=g(["\n width: 100%;\n & .ant-space-item:nth-child(2),\n & .ant-space-item:nth-child(3) {\n flex: 1;\n }\n "]);return x=function(){return e},e}function S(){var e=g(["\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n &.ant-btn-dashed:hover {\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n }\n "]);return S=function(){return e},e}var w=function(){var e=(0,n.useCollection_deprecated)().name,t=(0,n.useCompile)(),r=b(e);return{schema:{type:"void","x-component":"Grid",properties:{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:(0,n.css)(x())},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":"Cascader",required:!0,"x-component-props":{fieldNames:{label:"title",value:"name",children:"children"},changeOnSelect:!1},"x-use-component-props":function(){return{options:t(r)}}},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Custom column title") }}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add exportable field") }}',"x-component":"ArrayItems.Addition","x-component-props":{className:(0,n.css)(S())}}}}}}}},O=d(953),A="action-export";function j(){return(0,O.useTranslation)([A,"client"],{nsMode:"fallback"})}function I(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 E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=function(){var e,t,a,l,c,u,s=(0,i.useField)(),p=(0,i.useFieldSchema)(),f=j().t,d=(0,n.useDesignable)().dn,m=function(e){if(Array.isArray(e))return e}(e=(0,r.useState)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return I(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 I(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),b=m[0],v=m[1],h=w().schema;return(0,r.useEffect)(function(){v(h)},[s.address,null==p||null==(t=p["x-action-settings"])?void 0:t.exportSettings]),o().createElement(n.GeneralSchemaDesigner,{disableInitializer:!0},o().createElement(n.SchemaSettingsModalItem,{title:f("Edit button"),schema:{type:"object",title:f("Edit button"),properties:{title:{"x-decorator":"FormItem","x-component":"Input",title:f("Button title"),default:p.title,"x-component-props":{}},icon:{"x-decorator":"FormItem","x-component":"IconPicker",title:f("Button icon"),default:null==p||null==(a=p["x-component-props"])?void 0:a.icon,"x-component-props":{}},type:{"x-decorator":"FormItem","x-component":"Radio.Group",title:f("Button background color"),default:(null==p||null==(l=p["x-component-props"])?void 0:l.danger)?"danger":(null==p||null==(c=p["x-component-props"])?void 0:c.type)==="primary"?"primary":"default",enum:[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Highlight")}}'},{value:"danger",label:'{{t("Danger red")}}'}]}}},onSubmit:function(e){var t,n=e.title,r=e.icon,o=e.type;p.title=n,s.title=n,s.componentProps.icon=r,s.componentProps.danger="danger"===o,s.componentProps.type=o,p["x-component-props"]=p["x-component-props"]||{},p["x-component-props"].icon=r,p["x-component-props"].danger="danger"===o,p["x-component-props"].type=o,d.emit("patch",{schema:(E(t={},"x-uid",p["x-uid"]),E(t,"title",n),E(t,"x-component-props",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){E(e,t,n[t])})}return e}({},p["x-component-props"])),t)}),d.refresh()}}),o().createElement(n.SchemaSettingsActionModalItem,{title:f("Exportable fields"),schema:b,initialValues:{exportSettings:null==p||null==(u=p["x-action-settings"])?void 0:u.exportSettings},scope:{t:f},components:{ArrayItems:y.ArrayItems},onSubmit:function(e){var t,n=e.exportSettings;p["x-action-settings"].exportSettings=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}}),d.emit("patch",{schema:(E(t={},"x-uid",p["x-uid"]),E(t,"x-action-settings",p["x-action-settings"]),t)}),d.refresh()}}),o().createElement(n.SchemaSettingsDivider,null),o().createElement(n.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:function(e){return"Space"===e["x-component"]||e["x-component"].endsWith("ActionBar")},confirm:{title:f("Delete action")}}))},k=function(e){return o().createElement(n.SchemaComponentOptions,{components:{ExportActionInitializer:v,ExportDesigner:P},scope:{useExportAction:R}},e.children)},T=d(773),C=d.n(T),F=d(574),_=d(59);function M(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)}var R=function(){var e,t=(0,n.useBlockRequestContext)(),o=t.service,a=t.props,l=(0,n.useDataBlockResource)(),c=(0,n.useTableBlockContext)().params,u=(0,n.useCurrentAppInfo)(),s=null==a?void 0:a.params.filter,p=(0,i.useFieldSchema)(),f=(0,n.useCompile)(),d=(0,n.useCollectionManager_deprecated)().getCollectionJoinField,m=(0,n.useCollection_deprecated)(),b=m.name,v=m.title,y=j().t,h=_.App.useApp().modal,g=(null==(e=o.params[0])?void 0:e.filter)||{},x=(0,i.useField)(),S=(0,r.useMemo)(function(){var e;return(null==u||null==(e=u.data)?void 0:e.exportLimit)?u.data.exportLimit:2e3},[u]);return{onClick:function(){var e;return(e=function(){var e,t,r,i,a;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(u){switch(u.label){case 0:return x.data=x.data||{},[4,h.confirm({title:y("Export"),content:y("Export warning",{limit:S}),okText:y("Start export")})];case 1:if(!u.sent())return[2];return x.data.loading=!0,(i=C().cloneDeep(null!=(e=null==p?void 0:p["x-action-settings"])?e:{}).exportSettings).forEach(function(e){var t,n,r=null!=(t=d("".concat(b,".").concat(e.dataIndex.join("."))))?t:{},o=r.uiSchema;r.interface,e.enum=null==o||null==(n=o.enum)?void 0:n.map(function(e){return{value:e.value,label:e.label}}),e.enum||(null==o?void 0:o.type)!=="boolean"||(e.enum=[{value:!0,label:y("Yes")},{value:!1,label:y("No")}]),e.defaultTitle=null==o?void 0:o.title}),[4,l.export({title:f(v),appends:null==(r=o.params[0])||null==(t=r.appends)?void 0:t.join(),filter:(0,n.mergeFilter)([g,s]),sort:null==c?void 0:c.sort,values:{columns:f(i)}},{responseType:"blob"})];case 2:return a=new Blob([u.sent().data],{type:"application/x-xls"}),x.data.loading=!1,(0,F.saveAs)(a,"".concat(f(v),".xlsx")),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){M(i,r,o,a,l,"next",e)}function l(e){M(i,r,o,a,l,"throw",e)}a(void 0)})})()}}},q=d(694),B=d(485),D=d(477);function L(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 z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=function(){return!!e})()}function G(){var e=$(["\n width: 100%;\n & .ant-space-item:nth-child(2),\n & .ant-space-item:nth-child(3) {\n flex: 1;\n }\n "]);return G=function(){return e},e}function K(){var e=$(["\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n &.ant-btn-dashed:hover {\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n }\n "]);return K=function(){return e},e}var V=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=N(t),z(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,H()?Reflect.construct(t,r||[],N(this).constructor):t.apply(this,r)),"defaultProps",{title:(0,q.escapeT)("Export"),type:"default",icon:"clouddownloadoutlined"}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&U(n,e),t=[{key:"getAclActionName",value:function(){return"export"}}],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}(B.ActionModel);function W(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 X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}z(V,"scene",B.ActionSceneEnum.collection),V.define({label:(0,q.escapeT)("Export")}),V.registerFlow({key:"exportSettings",on:"click",steps:{confirm:{use:"confirm",hideInSettings:!0,defaultParams:{enable:!0,title:(0,q.escapeT)("Export"),content:(0,q.escapeT)("Export warning",{ns:A,limit:2e3})}},export:{handler:function(e,t){var n;return(n=function(){var t,n,r,o,i,a,l,c,u,s;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(p){switch(p.label){case 0:return t=e.model.getProps().exportSettings,r=(n=e.model.context.blockModel).resource,i=(o=n.collection).title,a=o.fields,l=o.filterTargetKey,u=(c=r.getSelectedRows()).length>0?z({},l,e.blockModel.collection.getFilterByTK(c)):r.getFilter(),Array.isArray(l)&&l.length>1&&(u={$or:e.blockModel.collection.getFilterByTK(c)}),t.forEach(function(t){var n,r,o=null!=(n=a.get(t.dataIndex[0]))?n:{},i=o.uiSchema;o.interface,t.enum=null==i||null==(r=i.enum)?void 0:r.map(function(e){return{value:e.value,label:e.label}}),t.enum||(null==i?void 0:i.type)!=="boolean"||(t.enum=[{value:!0,label:e.t("Yes")},{value:!1,label:e.t("No")}]),t.defaultTitle=e.t(null==i?void 0:i.title)}),[4,r.runAction("export",{data:{columns:t},responseType:"blob",params:{title:e.t(i),appends:r.getAppends(),sort:r.getSort(),filter:u}})];case 1:return s=new Blob([p.sent()],{type:"application/x-xls"}),(0,F.saveAs)(s,"".concat(e.t(i),".xlsx")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){L(i,r,o,a,l,"next",e)}function l(e){L(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}}),V.registerFlow({key:"exportActionSetting",title:(0,q.escapeT)("Export settings",{ns:A}),steps:{exportableFields:{title:(0,q.escapeT)("Exportable fields"),uiSchema:function(e){var t,n,r=(t=e.model.context.blockModel.collection.getFields(),n=e.t,m(t,function(e){var t;return n(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name},function(e){return e.targetCollection&&e.targetCollection.getFields()||[]}));return{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:(0,D.css)(G())},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":_.Cascader,required:!0,"x-component-props":{fieldNames:{label:"title",value:"name",children:"children"},changeOnSelect:!1,options:r}},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Custom column title") }}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add exportable field") }}',"x-component":"ArrayItems.Addition","x-component-props":{className:(0,D.css)(K())}}}}}},defaultParams:function(e){var t;return{exportSettings:null==(t=e.model.context.blockModel.collection.getFields())?void 0:t.filter(function(e){return!e.isAssociationField()&&e.options.interface}).map(function(e){return{dataIndex:[e.name]}})}},handler:function(e,t){var n=t.exportSettings,r=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}});e.model.setProps("exportSettings",r)}}}});var Y=new n.SchemaSettings({name:"actionSettings:export",items:[{name:"editButton",Component:n.ButtonEditor,useComponentProps:function(){return(0,n.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:n.SchemaSettingsLinkageRules,useComponentProps:function(){return 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){X(e,t,n[t])})}return e}({},(0,n.useSchemaToolbar)().linkageRulesProps)}},{name:"exportableFields",type:"actionModal",useComponentProps:function(){var e,t,o,a=(0,i.useField)(),l=(0,i.useFieldSchema)(),c=(0,O.useTranslation)().t,u=(0,n.useDesignable)().dn,s=function(e){if(Array.isArray(e))return e}(e=(0,r.useState)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return W(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 W(e,2)}}(e)||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=s[0],f=s[1],d=w().schema;return(0,r.useEffect)(function(){f(d)},[a.address,null==l||null==(t=l["x-action-settings"])?void 0:t.exportSettings]),{title:c("Exportable fields"),schema:p,initialValues:{exportSettings:null==l||null==(o=l["x-action-settings"])?void 0:o.exportSettings},components:{ArrayItems:y.ArrayItems},onSubmit:function(e){var t,n=e.exportSettings;l["x-action-settings"].exportSettings=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}}),u.emit("patch",{schema:(X(t={},"x-uid",l["x-uid"]),X(t,"x-action-settings",l["x-action-settings"]),t)}),u.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:function(e){return"Space"===e["x-component"]||e["x-component"].endsWith("ActionBar")},confirm:{title:(0,(0,O.useTranslation)().t)("Delete action")}}}}]});function J(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 Q(e,t,n){return(Q=en()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ee(o,n.prototype),o}).apply(null,arguments)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function et(e){var t="function"==typeof Map?new Map:void 0;return(et=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 Q(e,arguments,Z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ee(n,e)})(e)}function en(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(en=function(){return!!e})()}var er=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=Z(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,en()?Reflect.construct(e,t||[],Z(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ee(r,e),t=[{key:"load",value:function(){var e;return(e=function(){var e,t;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(r){return this.app.use(k),e={title:"{{t('Export')}}",Component:"ExportActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:function(){return(0,n.useActionAvailable)("export")}},null==(t=this.app.schemaInitializerManager.get("table:configureActions"))||t.add("enableActions.export",e),this.app.schemaInitializerManager.addItem("gantt:configureActions","enableActions.export",e),this.app.schemaSettingsManager.add(Y),this.app.flowEngine.registerModels({ExportActionModel:V}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){J(i,r,o,a,l,"next",e)}function l(e){J(i,r,o,a,l,"throw",e)}a(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}(et(n.Plugin)),eo=er}(),h}()});
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
import { NAMESPACE } from '../../client-v2/locale';
|
|
10
|
+
export { NAMESPACE };
|
|
10
11
|
export declare function useExportTranslation(): import("react-i18next").UseTranslationResponse<("action-export" | "client")[], undefined>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { ActionModel } from '@nocobase/client-v2';
|
|
9
10
|
import type { ButtonProps } from 'antd/es/button';
|
|
10
|
-
import { ActionModel } from '@nocobase/client';
|
|
11
11
|
export declare class ExportActionModel extends ActionModel {
|
|
12
12
|
static scene: import("@nocobase/client-v2").ActionSceneType;
|
|
13
13
|
defaultProps: ButtonProps;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
import { Plugin } from '@nocobase/client-v2';
|
|
10
|
+
export declare class PluginActionExportClient extends Plugin {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export { ExportActionModel } from './ExportActionModel';
|
|
14
|
+
export { buildExportFieldOptions } from './buildExportFieldOptions';
|
|
15
|
+
export default PluginActionExportClient;
|
|
@@ -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
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("antd"),require("@emotion/css"),require("@nocobase/client-v2"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-action-export/client-v2",["antd","@emotion/css","@nocobase/client-v2","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-action-export/client-v2"]=t(require("antd"),require("@emotion/css"),require("@nocobase/client-v2"),require("@nocobase/flow-engine")):e["@nocobase/plugin-action-export/client-v2"]=t(e.antd,e["@emotion/css"],e["@nocobase/client-v2"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r){return function(){var o={574:function(e,t,n){var r,o;void 0===(o="function"==typeof(r=function(){"use strict";function t(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){c(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function o(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),c=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,n,a){var c=i.URL||i.webkitURL,l=document.createElement("a");l.download=n=n||e.name||"download",l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?o(l):r(l.href)?t(e,n,a):o(l,l.target="_blank")):(l.href=c.createObjectURL(e),setTimeout(function(){c.revokeObjectURL(l.href)},4e4),setTimeout(function(){o(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,i){if(n=n||e.name||"download","string"!=typeof e){var a;navigator.msSaveOrOpenBlob((void 0===(a=i)?a={autoBom:!1}:"object"!=typeof a&&(console.warn("Deprecated: Expected third argument to be a object"),a={autoBom:!a}),a.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(r(e))t(e,n,i);else{var c=document.createElement("a");c.href=e,c.target="_blank",setTimeout(function(){o(c)})}}:function(e,n,r,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,r);var c="application/octet-stream"===e.type,l=/constructor/i.test(i.HTMLElement)||i.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||c&&l||a)&&"u">typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=u?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},s.readAsDataURL(e)}else{var p=i.URL||i.webkitURL,f=p.createObjectURL(e);o?o.location=f:location.href=f,o=null,setTimeout(function(){p.revokeObjectURL(f)},4e4)}});i.saveAs=c.saveAs=c,e.exports=c})?r.apply(t,[]):r)||(e.exports=o)},477:function(e){"use strict";e.exports=t},485:function(e){"use strict";e.exports=n},694:function(e){"use strict";e.exports=r},59:function(t){"use strict";t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return o[e].call(n.exports,n,n.exports,a),n.exports}a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(c=a.g.location+"");var c,l=a.g.document;if(!c&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(c=l.currentScript.src),!c)){var u=l.getElementsByTagName("script");if(u.length)for(var s=u.length-1;s>-1&&(!c||!/^http(s?):/.test(c));)c=u[s--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");a.p=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={};return!function(){"use strict";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/@nocobase/plugin-action-export/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-action-export/dist/client-v2/"}a.p=e}(),!function(){"use strict";a.r(p),a.d(p,{buildExportFieldOptions:function(){return y},default:function(){return F},ExportActionModel:function(){return A},PluginActionExportClient:function(){return I}});var e,t=a(485),n=a(694),r=a(477),o=a(574),i=a(59);function c(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}var l=["hasMany","belongsToMany","belongsToArray"],u=((function(e){if(Array.isArray(e))return c(e)})(e=["hasOne","belongsTo"])||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return c(e,void 0);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 c(e,void 0)}}(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.")}()).concat(["hasMany","belongsToMany","belongsToArray"]),s=function(e){return(null==e?void 0:e.target)&&u.includes(e.type)},f=function(e){return(null==e?void 0:e.target)&&l.includes(e.type)},d=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return{name:e.name,title:t(e),schema:null==e?void 0:e.uiSchema,disabled:n}},b=function(e,t,n){var r,o,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!(null==e?void 0:e.interface))return null;if(!s(e))return d(e,t);var a=(n(e)||[]).map(function(r){return s(r)?i>=2||f(e)&&f(r)?null:b(r,t,n,i+1):b(r,t,n)}).filter(Boolean);return a.length?(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},d(e,t)),o=o={children:a},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r):d(e,t,!0)},y=function(e,t,n){return(e||[]).map(function(e){return b(e,t,n,+!!s(e))}).filter(Boolean)},v="action-export";function m(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function j(){var e=x(["\n width: 100%;\n & .ant-space-item:nth-child(2),\n & .ant-space-item:nth-child(3) {\n flex: 1;\n }\n "]);return j=function(){return e},e}function S(){var e=x(["\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n &.ant-btn-dashed:hover {\n border-color: var(--colorSettings);\n color: var(--colorSettings);\n }\n "]);return S=function(){return e},e}var A=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,o;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,o=arguments,t=g(t),h(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,O()?Reflect.construct(t,o||[],g(this).constructor):t.apply(this,o)),"defaultProps",{title:(0,n.escapeT)("Export"),type:"default",icon:"clouddownloadoutlined"}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&w(r,e),t=[{key:"getAclActionName",value:function(){return"export"}}],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}(t.ActionModel);function P(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function E(e,t,n){return(E=M()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}h(A,"scene",t.ActionSceneEnum.collection),A.define({label:(0,n.escapeT)("Export")}),A.registerFlow({key:"exportSettings",on:"click",steps:{confirm:{use:"confirm",hideInSettings:!0,defaultParams:{enable:!0,title:(0,n.escapeT)("Export"),content:(0,n.escapeT)("Export warning",{ns:v,limit:2e3})}},export:{handler:function(e,t){var n;return(n=function(){var t,n,r,i,a,c,l,u,s,p;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:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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(f){switch(f.label){case 0:return t=e.model.getProps().exportSettings,r=(n=e.model.context.blockModel).resource,a=(i=n.collection).title,c=i.fields,l=i.filterTargetKey,s=(u=r.getSelectedRows()).length>0?h({},l,e.blockModel.collection.getFilterByTK(u)):r.getFilter(),Array.isArray(l)&&l.length>1&&(s={$or:e.blockModel.collection.getFilterByTK(u)}),t.forEach(function(t){var n,r,o=null!=(n=c.get(t.dataIndex[0]))?n:{},i=o.uiSchema;o.interface,t.enum=null==i||null==(r=i.enum)?void 0:r.map(function(e){return{value:e.value,label:e.label}}),t.enum||(null==i?void 0:i.type)!=="boolean"||(t.enum=[{value:!0,label:e.t("Yes")},{value:!1,label:e.t("No")}]),t.defaultTitle=e.t(null==i?void 0:i.title)}),[4,r.runAction("export",{data:{columns:t},responseType:"blob",params:{title:e.t(a),appends:r.getAppends(),sort:r.getSort(),filter:s}})];case 1:return p=new Blob([f.sent()],{type:"application/x-xls"}),(0,o.saveAs)(p,"".concat(e.t(a),".xlsx")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){m(i,r,o,a,c,"next",e)}function c(e){m(i,r,o,a,c,"throw",e)}a(void 0)})})()}}}}),A.registerFlow({key:"exportActionSetting",title:(0,n.escapeT)("Export settings",{ns:v}),steps:{exportableFields:{title:(0,n.escapeT)("Exportable fields"),uiSchema:function(e){var t,n,o=(t=e.model.context.blockModel.collection.getFields(),n=e.t,y(t,function(e){var t;return n(null==e||null==(t=e.uiSchema)?void 0:t.title)||e.name},function(e){return e.targetCollection&&e.targetCollection.getFields()||[]}));return{exportSettings:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space","x-component-props":{className:(0,r.css)(j())},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},dataIndex:{type:"array","x-decorator":"FormItem","x-component":i.Cascader,required:!0,"x-component-props":{fieldNames:{label:"title",value:"name",children:"children"},changeOnSelect:!1,options:o}},title:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{ t("Custom column title") }}'}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{ t("Add exportable field") }}',"x-component":"ArrayItems.Addition","x-component-props":{className:(0,r.css)(S())}}}}}},defaultParams:function(e){var t;return{exportSettings:null==(t=e.model.context.blockModel.collection.getFields())?void 0:t.filter(function(e){return!e.isAssociationField()&&e.options.interface}).map(function(e){return{dataIndex:[e.name]}})}},handler:function(e,t){var n=t.exportSettings,r=null==n?void 0:n.filter(function(e){var t;return null==e||null==(t=e.dataIndex)?void 0:t.length}).map(function(e){return{dataIndex:e.dataIndex.map(function(e){var t;return null!=(t=e.name)?t:e}),title:e.title}});e.model.setProps("exportSettings",r)}}}});function T(e){return(T=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 k(e){var t="function"==typeof Map?new Map:void 0;return(k=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 E(e,arguments,T(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}var I=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=T(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,M()?Reflect.construct(e,t||[],T(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 n,r,o,i={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),c=Object.defineProperty;return c(a,"next",{value:l(0)}),c(a,"throw",{value:l(1)}),c(a,"return",{value:l(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function l(c){return function(l){var u=[c,l];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),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){return this.app.flowEngine.registerModels({ExportActionModel:A}),[2]})},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)})}).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)}}(n.prototype,t),n}(k(t.Plugin)),F=I}(),p}()});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const NAMESPACE = "action-export";
|
package/dist/externalVersion.js
CHANGED
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"@formily/react": "2.3.7",
|
|
12
12
|
"@formily/shared": "2.3.7",
|
|
13
|
-
"@nocobase/client": "2.1.0-beta.
|
|
13
|
+
"@nocobase/client": "2.1.0-beta.33",
|
|
14
14
|
"react": "18.2.0",
|
|
15
15
|
"@formily/antd-v5": "1.2.3",
|
|
16
16
|
"react-i18next": "11.18.6",
|
|
17
17
|
"lodash": "4.18.1",
|
|
18
|
-
"file-saver": "2.0.5",
|
|
19
18
|
"antd": "5.24.2",
|
|
20
|
-
"@nocobase/
|
|
21
|
-
"@nocobase/
|
|
22
|
-
"@nocobase/flow-engine": "2.1.0-beta.30",
|
|
19
|
+
"@nocobase/flow-engine": "2.1.0-beta.33",
|
|
20
|
+
"@nocobase/client-v2": "2.1.0-beta.33",
|
|
23
21
|
"@emotion/css": "11.13.0",
|
|
24
|
-
"@nocobase/
|
|
25
|
-
"@nocobase/
|
|
22
|
+
"@nocobase/server": "2.1.0-beta.33",
|
|
23
|
+
"@nocobase/logger": "2.1.0-beta.33",
|
|
24
|
+
"@nocobase/actions": "2.1.0-beta.33",
|
|
25
|
+
"@nocobase/database": "2.1.0-beta.33",
|
|
26
26
|
"async-mutex": "0.5.0",
|
|
27
|
-
"@nocobase/data-source-manager": "2.1.0-beta.
|
|
28
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
27
|
+
"@nocobase/data-source-manager": "2.1.0-beta.33",
|
|
28
|
+
"@nocobase/utils": "2.1.0-beta.33"
|
|
29
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"exceljs","version":"4.4.0","description":"Excel Workbook Manager - Read and Write xlsx and csv Files.","private":false,"license":"MIT","author":{"name":"Guyon Roche","email":"guyon@live.com"},"repository":{"type":"git","url":"https://github.com/exceljs/exceljs.git"},"engines":{"node":">=8.3.0"},"main":"./excel.js","browser":"./dist/exceljs.min.js","types":"./index.d.ts","files":["dist","lib","excel.js","LICENSE","README.md","README_zh.md","index.ts","index.d.ts"],"scripts":{"test":"npm run test:full","test:es5":"export EXCEL_BUILD=es5 && npm run test:full","test:full":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:jasmine","test:version":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:browser && npm run test:dist","test:all":"npm run test:native && npm run test:es5","test:native":"npm run test:full","test:unit":"mocha --require spec/config/setup --require spec/config/setup-unit spec/unit --recursive","test:integration":"mocha --require spec/config/setup spec/integration --recursive","test:end-to-end":"mocha --require spec/config/setup spec/end-to-end --recursive","test:browser":"if [ ! -f .disable-test-browser ]; then npm run build && npm run test:jasmine; fi","test:jasmine":"grunt jasmine","test:unit:es5":"export EXCEL_BUILD=es5 && npm run test:unit","test:integration:es5":"export EXCEL_BUILD=es5 && npm run test:integration","test:end-to-end:es5":"export EXCEL_BUILD=es5 && npm run test:end-to-end","test:dist":"mocha --require spec/config/setup spec/dist --recursive","test:manual":"node spec/manual/app.js","test:typescript":"mocha -r ts-node/register spec/typescript/**/*.spec.ts","clean-build":"npm run clean && npm run build","lint":"eslint --format node_modules/eslint-friendly-formatter .","lint:fix":"prettier-eslint --write $(pwd)'/**/*.js'","lint:staged":"lint-staged","clean":"rm -rf build/ && rm -rf dist","benchmark":"node --expose-gc benchmark","benchmark:debug":"node --expose-gc --inspect-brk --trace-deopt benchmark","build":"grunt build","install-build":"npm install && grunt build","preversion":"npm run clean && npm run build && npm run test:version","postversion":"git push --no-verify && git push --tags --no-verify"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":["prettier-eslint --write","eslint --format node_modules/eslint-friendly-formatter","git add"]},"keywords":["xlsx","json","csv","excel","font","border","fill","number","format","number format","alignment","office","spreadsheet","workbook","defined names","data validations","rich text","in-cell format","outlineLevel","views","frozen","split","pageSetup"],"dependencies":{"archiver":"^5.0.0","dayjs":"^1.8.34","fast-csv":"^4.3.1","jszip":"^3.10.1","readable-stream":"^3.6.0","saxes":"^5.0.1","tmp":"^0.2.0","unzipper":"^0.10.11","uuid":"^8.3.0"},"devDependencies":{"@babel/cli":"^7.10.5","@babel/core":"^7.11.4","@babel/preset-env":"^7.11.0","@types/chai":"^4.2.12","@types/mocha":"^8.0.3","@types/node":"^14.11.2","babelify":"^10.0.0","browserify":"^16.5.2","chai":"^4.2.0","chai-datetime":"^1.7.0","chai-xml":"^0.3.2","core-js":"^3.6.5","dirty-chai":"^2.0.1","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.12.0","eslint-friendly-formatter":"^4.0.1","eslint-plugin-import":"^2.22.0","eslint-plugin-node":"^11.1.0","express":"^4.16.4","got":"^9.0.0","grunt":"^1.3.0","grunt-babel":"^8.0.0","grunt-browserify":"^5.3.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-jasmine":"^2.2.0","grunt-contrib-watch":"^1.1.0","grunt-exorcise":"^2.1.1","grunt-terser":"^1.0.0","husky":"^4.3.0","lint-staged":"^10.2.13","mocha":"^7.2.0","prettier-eslint":"^11.0.0","prettier-eslint-cli":"^5.0.0","regenerator-runtime":"^0.13.7","sax":"^1.2.4","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2026-05-
|
|
1
|
+
{"name":"exceljs","version":"4.4.0","description":"Excel Workbook Manager - Read and Write xlsx and csv Files.","private":false,"license":"MIT","author":{"name":"Guyon Roche","email":"guyon@live.com"},"repository":{"type":"git","url":"https://github.com/exceljs/exceljs.git"},"engines":{"node":">=8.3.0"},"main":"./excel.js","browser":"./dist/exceljs.min.js","types":"./index.d.ts","files":["dist","lib","excel.js","LICENSE","README.md","README_zh.md","index.ts","index.d.ts"],"scripts":{"test":"npm run test:full","test:es5":"export EXCEL_BUILD=es5 && npm run test:full","test:full":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:jasmine","test:version":"npm run build && npm run test:unit && npm run test:integration && npm run test:end-to-end && npm run test:browser && npm run test:dist","test:all":"npm run test:native && npm run test:es5","test:native":"npm run test:full","test:unit":"mocha --require spec/config/setup --require spec/config/setup-unit spec/unit --recursive","test:integration":"mocha --require spec/config/setup spec/integration --recursive","test:end-to-end":"mocha --require spec/config/setup spec/end-to-end --recursive","test:browser":"if [ ! -f .disable-test-browser ]; then npm run build && npm run test:jasmine; fi","test:jasmine":"grunt jasmine","test:unit:es5":"export EXCEL_BUILD=es5 && npm run test:unit","test:integration:es5":"export EXCEL_BUILD=es5 && npm run test:integration","test:end-to-end:es5":"export EXCEL_BUILD=es5 && npm run test:end-to-end","test:dist":"mocha --require spec/config/setup spec/dist --recursive","test:manual":"node spec/manual/app.js","test:typescript":"mocha -r ts-node/register spec/typescript/**/*.spec.ts","clean-build":"npm run clean && npm run build","lint":"eslint --format node_modules/eslint-friendly-formatter .","lint:fix":"prettier-eslint --write $(pwd)'/**/*.js'","lint:staged":"lint-staged","clean":"rm -rf build/ && rm -rf dist","benchmark":"node --expose-gc benchmark","benchmark:debug":"node --expose-gc --inspect-brk --trace-deopt benchmark","build":"grunt build","install-build":"npm install && grunt build","preversion":"npm run clean && npm run build && npm run test:version","postversion":"git push --no-verify && git push --tags --no-verify"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":["prettier-eslint --write","eslint --format node_modules/eslint-friendly-formatter","git add"]},"keywords":["xlsx","json","csv","excel","font","border","fill","number","format","number format","alignment","office","spreadsheet","workbook","defined names","data validations","rich text","in-cell format","outlineLevel","views","frozen","split","pageSetup"],"dependencies":{"archiver":"^5.0.0","dayjs":"^1.8.34","fast-csv":"^4.3.1","jszip":"^3.10.1","readable-stream":"^3.6.0","saxes":"^5.0.1","tmp":"^0.2.0","unzipper":"^0.10.11","uuid":"^8.3.0"},"devDependencies":{"@babel/cli":"^7.10.5","@babel/core":"^7.11.4","@babel/preset-env":"^7.11.0","@types/chai":"^4.2.12","@types/mocha":"^8.0.3","@types/node":"^14.11.2","babelify":"^10.0.0","browserify":"^16.5.2","chai":"^4.2.0","chai-datetime":"^1.7.0","chai-xml":"^0.3.2","core-js":"^3.6.5","dirty-chai":"^2.0.1","eslint":"^6.5.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.12.0","eslint-friendly-formatter":"^4.0.1","eslint-plugin-import":"^2.22.0","eslint-plugin-node":"^11.1.0","express":"^4.16.4","got":"^9.0.0","grunt":"^1.3.0","grunt-babel":"^8.0.0","grunt-browserify":"^5.3.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-jasmine":"^2.2.0","grunt-contrib-watch":"^1.1.0","grunt-exorcise":"^2.1.1","grunt-terser":"^1.0.0","husky":"^4.3.0","lint-staged":"^10.2.13","mocha":"^7.2.0","prettier-eslint":"^11.0.0","prettier-eslint-cli":"^5.0.0","regenerator-runtime":"^0.13.7","sax":"^1.2.4","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2026-05-15T15:53:35.832Z"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Export filtered records to excel, you can configure which fields to export.",
|
|
7
7
|
"description.ru-RU": "Экспорт в Excel: можно настроить, какие поля будут экспортироваться.",
|
|
8
8
|
"description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。",
|
|
9
|
-
"version": "2.1.0-beta.
|
|
9
|
+
"version": "2.1.0-beta.33",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/action-export",
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@nocobase/actions": "2.x",
|
|
36
36
|
"@nocobase/client": "2.x",
|
|
37
|
+
"@nocobase/client-v2": "2.x",
|
|
37
38
|
"@nocobase/database": "2.x",
|
|
38
39
|
"@nocobase/server": "2.x",
|
|
39
40
|
"@nocobase/test": "2.x",
|
|
40
41
|
"@nocobase/utils": "2.x"
|
|
41
42
|
},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "4815c394e80a264fa8ed619246280923c47aeb72",
|
|
43
44
|
"keywords": [
|
|
44
45
|
"Actions"
|
|
45
46
|
]
|
|
File without changes
|
|
File without changes
|