@nocobase/plugin-text-copy 2.1.0-beta.35 → 2.1.0-beta.37

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 ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-text-copy",["react-i18next","react","antd","@nocobase/client","@formily/react","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-text-copy"]=t(require("react-i18next"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-text-copy"]=t(e["react-i18next"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,u){return function(){"use strict";var a={230:function(e){e.exports=o},342:function(e){e.exports=r},694:function(e){e.exports=i},59:function(e){e.exports=n},773:function(e){e.exports=u},155:function(e){e.exports=t},953:function(t){t.exports=e}},c={};function l(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return a[e](n,n.exports,l),n.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.g.importScripts&&(p=l.g.location+"");var p,s=l.g.document;if(!p&&s&&(s.currentScript&&"SCRIPT"===s.currentScript.tagName.toUpperCase()&&(p=s.currentScript.src),!p)){var f=s.getElementsByTagName("script");if(f.length)for(var y=f.length-1;y>-1&&(!p||!/^http(s?):/.test(p));)p=f[y--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");l.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={};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-text-copy/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-text-copy/dist/client/"}l.p=e}(),!function(){l.r(d),l.d(d,{default:function(){return S}});var e=l(230),t=l(342),n=l(59),r=l(773),o=l.n(r),i=l(155),u=l.n(i),a=l(953),c=l(694),p=Symbol.for("nocobase.plugin-text-copy.DisplayTextFieldModel.patched");function s(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 f(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){f(i,r,o,u,a,"next",e)}function a(e){f(i,r,o,u,a,"throw",e)}u(void 0)})}}function b(e,t,n){return(b=g()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&v(o,n.prototype),o}).apply(null,arguments)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){var t="function"==typeof Map?new Map:void 0;return(m=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return b(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function x(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var w=(0,e.observer)(function(){var r,o=(0,e.useField)(),a=(0,t.useToken)().token,c=(0,i.useRef)(null),l=function(e){if(Array.isArray(e))return e}(r=u().useState(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(r)||function(e){if(e){if("string"==typeof e)return s(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 s(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=l[0],f=l[1];(0,i.useEffect)(function(){if(o.value&&o.readPretty&&c.current){var e,t,n=c.current,r=function(e){f(!0)},i=function(e){f(!1)};return null==n||null==(e=n.parentElement)||e.addEventListener("mouseover",r),null==n||null==(t=n.parentElement)||t.addEventListener("mouseout",i),function(){var e,t;null==n||null==(e=n.parentElement)||e.removeEventListener("mouseover",r),null==n||null==(t=n.parentElement)||t.removeEventListener("mouseout",i)}}},[o.readPretty,o.value]);var y=o.readPretty&&(!o.value||!p);return u().createElement(n.Typography.Text,{ref:c,copyable:{text:o.value},style:{marginLeft:o.readPretty?a.marginXXS:0,opacity:+!y}})},{displayName:"TextCopyButton"}),S=function(r){var i;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function l(){var e,t;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return e=l,t=arguments,e=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,g()?Reflect.construct(e,t||[],h(this).constructor):e.apply(this,t))}return l.prototype=Object.create(r&&r.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),r&&v(l,r),i=[{key:"load",value:function(){return y(function(){var r;return x(this,function(i){t.DisplayTextFieldModel.registerFlow({key:"textCopySettings",title:(0,c.tExpr)("Display Field settings"),sort:210,steps:{displayCopyButton:{title:(0,c.tExpr)("Display copy button",{ns:"text-copy"}),uiMode:{type:"switch",key:"displayCopyButton"},defaultParams:{displayCopyButton:!1},handler:function(e,t){e.model.setProps({displayCopyButton:t.displayCopyButton})}}}});var l=t.DisplayTextFieldModel.prototype;if(!l[p]){var s=l.renderComponent;l.renderComponent=function(e,t){var r,o=s.call(this,e,t),i=this.t(e);return(null==(r=this.props)?void 0:r.displayCopyButton)&&null!=i&&""!==i?u().createElement("span",{style:{display:"inline-flex",alignItems:"center",gap:4}},o,u().createElement(n.Typography.Text,{copyable:{text:String(i)}})):o},l[p]=!0}return r=u().createElement(w,null),this.app.addScopes({TextCopyButton:r}),this.app.schemaSettingsManager.addItem("fieldSettings:component:Input","enableCopier",{type:"switch",useComponentProps:function(){var n,i=(0,a.useTranslation)("text-copy").t,u=(0,t.useColumnSchema)().fieldSchema,c=(0,e.useFieldSchema)(),l=(0,e.useField)(),p=(0,t.useDesignable)().dn,s=u||c;return{title:i("Display copy button"),checked:!!(null==(n=s["x-component-props"])?void 0:n.addonAfter),onChange:function(e){return y(function(){return x(this,function(t){switch(t.label){case 0:return e?(l.componentProps.addonAfter=r,o().set(s,"x-component-props.addonAfter","{{TextCopyButton}}")):(l.componentProps.addonAfter=null,o().unset(s,"x-component-props.addonAfter")),[4,p.emit("patch",{schema:{"x-uid":s["x-uid"],"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){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}({},s["x-component-props"])}})];case 1:return t.sent(),[2]}})})()}}}}),[2]})}).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)}}(l.prototype,i),l}(m(t.Plugin))}(),d}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("react-i18next"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-text-copy",["lodash","react-i18next","@nocobase/client-v2","react","antd","@nocobase/client","@formily/react","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-text-copy"]=t(require("lodash"),require("react-i18next"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/flow-engine")):e["@nocobase/plugin-text-copy"]=t(e.lodash,e["react-i18next"],e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,u,a){return function(){"use strict";var c={230:function(e){e.exports=u},342:function(e){e.exports=i},485:function(e){e.exports=n},694:function(e){e.exports=a},59:function(e){e.exports=o},773:function(t){t.exports=e},155:function(e){e.exports=r},953:function(e){e.exports=t}},l={};function p(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return c[e](n,n.exports,p),n.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(s=p.g.location+"");var s,f=p.g.document;if(!s&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(s=f.currentScript.src),!s)){var y=f.getElementsByTagName("script");if(y.length)for(var d=y.length-1;d>-1&&(!s||!/^http(s?):/.test(s));)s=y[d--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");p.p=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};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-text-copy/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-text-copy/dist/client/"}p.p=e}(),!function(){p.r(b),p.d(b,{default:function(){return E}});var e=p(230),t=p(342),n=p(59),r=p(773),o=p.n(r),i=p(155),u=p.n(i),a=p(953),c=p(485),l=p(694);function s(e){return(0,l.tExpr)(e,{ns:["@nocobase/plugin-text-copy","text-copy","client"]})}function f(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 y=Symbol.for("nocobase.plugin-text-copy.DisplayTextFieldModel.patched"),d=function(e){var t,r=e.children,o=e.copyText,i=function(e){if(Array.isArray(e))return e}(t=u().useState(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return f(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 f(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=i[0],c=i[1];return u().createElement("span",{onMouseEnter:function(){return c(!0)},onMouseLeave:function(){return c(!1)}},u().createElement(n.Space,{size:"small"},r,a?u().createElement(n.Typography.Text,{copyable:{text:o}}):null))};function v(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 h(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){h(i,r,o,u,a,"next",e)}function a(e){h(i,r,o,u,a,"throw",e)}u(void 0)})}}function g(e,t,n){return(g=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&w(o,n.prototype),o}).apply(null,arguments)}function x(e){return(x=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 S(e){var t="function"==typeof Map?new Map:void 0;return(S=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 g(e,arguments,x(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function j(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var P=(0,e.observer)(function(){var r,o=(0,e.useField)(),a=(0,t.useToken)().token,c=(0,i.useRef)(null),l=function(e){if(Array.isArray(e))return e}(r=u().useState(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(r)||function(e){if(e){if("string"==typeof e)return v(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 v(e,2)}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=l[0],s=l[1];(0,i.useEffect)(function(){if(o.value&&o.readPretty&&c.current){var e,t,n=c.current,r=function(e){s(!0)},i=function(e){s(!1)};return null==n||null==(e=n.parentElement)||e.addEventListener("mouseover",r),null==n||null==(t=n.parentElement)||t.addEventListener("mouseout",i),function(){var e,t;null==n||null==(e=n.parentElement)||e.removeEventListener("mouseover",r),null==n||null==(t=n.parentElement)||t.removeEventListener("mouseout",i)}}},[o.readPretty,o.value]);var f=o.readPretty&&(!o.value||!p);return u().createElement(n.Typography.Text,{ref:c,copyable:{text:o.value},style:{marginLeft:o.readPretty?a.marginXXS:0,opacity:+!f}})},{displayName:"TextCopyButton"}),E=function(n){var r;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,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,O()?Reflect.construct(e,t||[],x(this).constructor):e.apply(this,t))}return i.prototype=Object.create(n&&n.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),n&&w(i,n),r=[{key:"load",value:function(){return m(function(){var n;return j(this,function(r){c.DisplayTextFieldModel.registerFlow({key:"textCopySettings",title:s("Display Field settings"),sort:210,steps:{displayCopyButton:{title:s("Display copy button"),uiMode:{type:"switch",key:"displayCopyButton"},defaultParams:{displayCopyButton:!1},handler:function(e,t){e.model.setProps({displayCopyButton:t.displayCopyButton})}}}});var i=c.DisplayTextFieldModel.prototype;if(!i[y]){var l=i.renderComponent;i.renderComponent=function(e,t){var n,r=l.call(this,e,t),o=this.t(e);return(null==(n=this.props)?void 0:n.displayCopyButton)&&null!=o&&""!==o?u().createElement(d,{copyText:String(o)},r):r},i[y]=!0}return n=u().createElement(P,null),this.app.addScopes({TextCopyButton:n}),this.app.schemaSettingsManager.addItem("fieldSettings:component:Input","enableCopier",{type:"switch",useComponentProps:function(){var r,i=(0,a.useTranslation)("text-copy").t,u=(0,t.useColumnSchema)().fieldSchema,c=(0,e.useFieldSchema)(),l=(0,e.useField)(),p=(0,t.useDesignable)().dn,s=u||c;return{title:i("Display copy button"),checked:!!(null==(r=s["x-component-props"])?void 0:r.addonAfter),onChange:function(e){return m(function(){return j(this,function(t){switch(t.label){case 0:return e?(l.componentProps.addonAfter=n,o().set(s,"x-component-props.addonAfter","{{TextCopyButton}}")):(l.componentProps.addonAfter=null,o().unset(s,"x-component-props.addonAfter")),[4,p.emit("patch",{schema:{"x-uid":s["x-uid"],"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){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}({},s["x-component-props"])}})];case 1:return t.sent(),[2]}})})()}}}}),[2]})}).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)}}(i.prototype,r),i}(S(t.Plugin))}(),b}()});
@@ -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 { default } from './plugin';
@@ -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(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("antd"),require("react"),require("@nocobase/client-v2"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-text-copy/client-v2",["antd","react","@nocobase/client-v2","@nocobase/flow-engine"],e):"object"==typeof exports?exports["@nocobase/plugin-text-copy/client-v2"]=e(require("antd"),require("react"),require("@nocobase/client-v2"),require("@nocobase/flow-engine")):t["@nocobase/plugin-text-copy/client-v2"]=e(t.antd,t.react,t["@nocobase/client-v2"],t["@nocobase/flow-engine"])}(self,function(t,e,n,r){return function(){"use strict";var o={485:function(t){t.exports=n},694:function(t){t.exports=r},59:function(e){e.exports=t},155:function(t){t.exports=e}},i={};function c(t){var e=i[t];if(void 0!==e)return e.exports;var n=i[t]={exports:{}};return o[t](n,n.exports,c),n.exports}c.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return c.d(e,{a:e}),e},c.d=function(t,e){for(var n in e)c.o(e,n)&&!c.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),c.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},c.r=function(t){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},c.g.importScripts&&(u=c.g.location+"");var u,a=c.g.document;if(!u&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(u=a.currentScript.src),!u)){var l=a.getElementsByTagName("script");if(l.length)for(var p=l.length-1;p>-1&&(!u||!/^http(s?):/.test(u));)u=l[p--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");c.p=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var f={};return!function(){var t="",e="u">typeof document?document.currentScript:null;if(e&&e.src&&(t=e.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!t){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),t=n+"static/plugins/@nocobase/plugin-text-copy/dist/client-v2/")}if(!t){if(!(t=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");t=o>=0?r.slice(0,o+1):"/"}t&&(t=t.replace(/\/v2\/?$/,"/")),t||(t="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t+="static/plugins/@nocobase/plugin-text-copy/dist/client-v2/"}c.p=t}(),!function(){c.r(f),c.d(f,{default:function(){return h}});var t=c(485),e=c(59),n=c(155),r=c.n(n),o=c(694);function i(t){return(0,o.tExpr)(t,{ns:["@nocobase/plugin-text-copy","text-copy","client"]})}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var a=Symbol.for("nocobase.plugin-text-copy.DisplayTextFieldModel.patched"),l=function(t){var n,o=t.children,i=t.copyText,c=function(t){if(Array.isArray(t))return t}(n=r().useState(!1))||function(t){var e,n,r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o=[],i=!0,c=!1;try{for(r=r.call(t);!(i=(e=r.next()).done)&&(o.push(e.value),2!==o.length);i=!0);}catch(t){c=!0,n=t}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}}(n)||function(t){if(t){if("string"==typeof t)return u(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return u(t,2)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=c[0],l=c[1];return r().createElement("span",{onMouseEnter:function(){return l(!0)},onMouseLeave:function(){return l(!1)}},r().createElement(e.Space,{size:"small"},o,a?r().createElement(e.Typography.Text,{copyable:{text:i}}):null))};function p(t,e,n,r,o,i,c){try{var u=t[i](c),a=u.value}catch(t){n(t);return}u.done?e(a):Promise.resolve(a).then(r,o)}function s(t,e,n){return(s=v()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&b(o,n.prototype),o}).apply(null,arguments)}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(t){var e="function"==typeof Map?new Map:void 0;return(d=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return s(t,arguments,y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,t)})(t)}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(v=function(){return!!t})()}var h=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function o(){var t,e;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return t=o,e=arguments,t=y(t),function(t,e){var n;if(e&&("object"==((n=e)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,v()?Reflect.construct(t,e||[],y(this).constructor):t.apply(this,e))}return o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),e&&b(o,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(t,e){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=e.call(t,i)}catch(t){l=[6,t],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){t.DisplayTextFieldModel.registerFlow({key:"textCopySettings",title:i("Display Field settings"),sort:210,steps:{displayCopyButton:{title:i("Display copy button"),uiMode:{type:"switch",key:"displayCopyButton"},defaultParams:{displayCopyButton:!1},handler:function(t,e){t.model.setProps({displayCopyButton:e.displayCopyButton})}}}});var n=t.DisplayTextFieldModel.prototype;if(!n[a]){var o=n.renderComponent;n.renderComponent=function(t,e){var n,i=o.call(this,t,e),c=this.t(t);return(null==(n=this.props)?void 0:n.displayCopyButton)&&null!=c&&""!==c?r().createElement(l,{copyText:String(c)},i):i},n[a]=!0}return[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(t){p(i,r,o,c,u,"next",t)}function u(t){p(i,r,o,c,u,"throw",t)}c(void 0)})})()}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(o.prototype,n),o}(d(t.Plugin))}(),f}()});
@@ -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
+ export declare function useT(): (str: string) => string;
10
+ export declare function tExpr(key: string): string;
@@ -0,0 +1,13 @@
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 { Application, Plugin } from '@nocobase/client-v2';
10
+ declare class PluginTextCopyV2 extends Plugin<any, Application> {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginTextCopyV2;
@@ -10,11 +10,12 @@
10
10
  module.exports = {
11
11
  "@formily/core": "2.3.7",
12
12
  "@formily/react": "2.3.7",
13
- "@nocobase/client": "2.1.0-beta.35",
13
+ "@nocobase/client": "2.1.0-beta.37",
14
14
  "antd": "5.24.2",
15
15
  "lodash": "4.18.1",
16
16
  "react": "18.2.0",
17
17
  "react-i18next": "11.18.6",
18
- "@nocobase/flow-engine": "2.1.0-beta.35",
19
- "@nocobase/server": "2.1.0-beta.35"
18
+ "@nocobase/flow-engine": "2.1.0-beta.37",
19
+ "@nocobase/client-v2": "2.1.0-beta.37",
20
+ "@nocobase/server": "2.1.0-beta.37"
20
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-text-copy",
3
- "version": "2.1.0-beta.35",
3
+ "version": "2.1.0-beta.37",
4
4
  "main": "./dist/server/index.js",
5
5
  "displayName": "Text copy",
6
6
  "displayName.ru-RU": "Копирование текста",
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@nocobase/client": "2.x",
22
+ "@nocobase/client-v2": "2.x",
22
23
  "@nocobase/server": "2.x",
23
24
  "@nocobase/test": "2.x"
24
25
  },
@@ -26,5 +27,5 @@
26
27
  "Clipboard",
27
28
  "Copy"
28
29
  ],
29
- "gitHead": "74310d8b9e9581fcde14b5a93d12b41ddb5bb325"
30
+ "gitHead": "7132e5b83ecc0e42b54715eaf1429c72bcef34ae"
30
31
  }