@nocobase/plugin-field-attachment-url 1.7.0-beta.30 → 1.7.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/client"),require("react"),require("@formily/react"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@nocobase/client","react","@formily/react","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@nocobase/client"),require("react"),require("@formily/react"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@nocobase/client"],e.react,e["@formily/react"],e.lodash)}(self,function(e,t,n,r,o){return function(){var i,u,c,a,l,s,p={253:function(e,t,n){"use strict";n.d(t,{N2:function(){return a},fR:function(){return l},sz:function(){return s}});var r=n(505),o=n(772),i=n(467),u=n(156),c=n(238);function a(e){var t,n,r,i,u,c,a,l=(0,o.useCollectionField)(),s=(n=null!=(t=null==l?void 0:l.storage)?t:"",i=(r=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{refreshDeps:[n]})).loading,u=r.data,!i&&(null==u?void 0:u.data)||null);return c=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}({},e),a=a={rules:s,action:"".concat(l.target,":create").concat(l.storage?"?attachmentField=".concat(l.collectionName,".").concat(l.name):""),toValueItem:function(e){return(null==e?void 0:e.thumbnailRule)?"".concat(null==e?void 0:e.url).concat(null==e?void 0:e.thumbnailRule):null==e?void 0:e.url},getThumbnailURL:function(e){return null==e?void 0:e.url}},Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(a)).forEach(function(e){Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(a,e))}),c}var l=function(e){var t=(0,r.useFieldSchema)(),n=(0,o.useDesignable)().insertAfterBegin;return(0,u.useCallback)(function(r){t.reduceProperties(function(t,n){return n["x-component"]==="AssociationField."+e?n:t},null)||n((0,i.cloneDeep)(r))},[e,t,n])},s=function(){(0,c.useTranslation)().t;var e=(0,r.useField)();return{service:{resource:"collections:listFileCollectionsWithPublicStorage",params:{paginate:!1}},manual:!1,fieldNames:{label:"title",value:"name"},onSuccess:function(t){e.data=e.data||{},e.data.options=null==t?void 0:t.data}}}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},505:function(e){"use strict";e.exports=r},772:function(e){"use strict";e.exports=t},467:function(e){"use strict";e.exports=o},156:function(e){"use strict";e.exports=n},238:function(t){"use strict";t.exports=e}},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.m=p,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.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return"91c71298e3ff5d7f.js"},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)},i={},u="@nocobase/plugin-field-attachment-url:",d.l=function(e,t,n,r){if(i[e])return void i[e].push(t);if(void 0!==n)for(var o,c,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var s=a[l];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==u+n){o=s;break}}o||(c=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-webpack",u+n),o.src=e),i[e]=[t];var p=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=i[e];if(delete i[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),c&&document.head.appendChild(o)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(c=window.__nocobase_public_path__||"/").endsWith("/")||(c+="/"),d.p=c+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client/",a={909:0},d.f.j=function(e,t){var n=d.o(a,e)?a[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),i=Error();d.l(o,function(t){if(d.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},l=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==a[e]})){for(n in i)d.o(i,n)&&(d.m[n]=i[n]);u&&u(d)}for(e&&e(t);c<o.length;c++)r=o[c],d.o(a,r)&&a[r]&&a[r][0](),a[r]=0},(s=self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).forEach(l.bind(null,0)),s.push=l.bind(null,s.push.bind(s));var m={};return!function(){"use strict";d.r(m),d.d(m,{PluginFieldAttachmentUrlClient:function(){return F},default:function(){return k}});var e=d(772),t=d(253),n=JSON.parse('{"u2":"@nocobase/plugin-field-attachment-url"}'),r=d(238);function o(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(n.u2,"', 'client'], nsMode: 'fallback' })}}")}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var l=e.interfacesProperties.defaultProps,s=e.interfacesProperties.operators,p=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,n,c,p,f;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return n=r,c=arguments,n=u(n),i(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,a()?Reflect.construct(n,c||[],u(this).constructor):n.apply(this,c)),"name","attachmentURL"),i(e,"type","object"),i(e,"group","media"),i(e,"title",o("Attachment (URL)")),i(e,"default",{type:"string",uiSchema:{type:"string","x-component":"AttachmentUrl","x-use-component-props":"useAttachmentUrlFieldProps"}}),i(e,"availableTypes",["string","text"]),i(e,"properties",(p=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){i(e,t,n[t])})}return e}({},l),f=f={target:{required:!0,type:"string",title:o("Which file collection should it be uploaded to"),"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":t.sz,"x-reactions":function(e){var t;((null==(t=e.data)?void 0:t.options)||[]).some(function(e){return(null==e?void 0:e.name)==="attachments"})&&(e.initialValue||e.setInitialValue("attachments"))}},targetKey:{"x-hidden":!0,default:"id",type:"string"}},Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(f)).forEach(function(e){Object.defineProperty(p,e,Object.getOwnPropertyDescriptor(f,e))}),p)),i(e,"filterable",{nested:!0,operators:s.bigField}),i(e,"titleUsable",!0),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&c(r,e),n=[{key:"schemaInitialize",value:function(e,t){var n=t.block;e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].mode="AttachmentUrl",["Table","Kanban"].includes(n)&&(e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}}],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,n),r}(e.CollectionFieldInterface),f=d(505);function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=new e.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var t,n=(0,r.useTranslation)().t,o=(0,f.useField)(),i=(0,e.useColumnSchema)().fieldSchema,u=(0,f.useFieldSchema)(),c=i||u,a=(0,e.useDesignable)(),l=a.dn,s=a.refresh;return{title:n("Quick upload"),checked:(null==(t=c["x-component-props"])?void 0:t.quickUpload)!==!1,onChange:function(e){var t=b({},"x-uid",c["x-uid"]);o.componentProps.quickUpload=e,c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].quickUpload=e,t["x-component-props"]=c["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var t=(0,e.useColumnSchema)().fieldSchema,n=(0,f.useField)(),r=(0,f.useForm)();return!((null==t?void 0:t["x-read-pretty"])||n.readPretty||r.readPretty)&&!n.componentProps.underFilter}},{name:"selectFile",type:"switch",useComponentProps:function(){var t,n=(0,r.useTranslation)().t,o=(0,f.useField)(),i=(0,e.useColumnSchema)().fieldSchema,u=(0,f.useFieldSchema)(),c=i||u,a=(0,e.useDesignable)(),l=a.dn,s=a.refresh;return{title:n("Select file"),checked:(null==(t=c["x-component-props"])?void 0:t.selectFile)!==!1,onChange:function(e){var t=b({},"x-uid",c["x-uid"]);o.componentProps.selectFile=e,c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].selectFile=e,t["x-component-props"]=c["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var t=(0,e.useColumnSchema)().fieldSchema,n=(0,f.useField)(),r=(0,f.useForm)();return!((null==t?void 0:t["x-read-pretty"])||n.readPretty||r.readPretty)&&!n.componentProps.underFilter}},{name:"fieldComponent",type:"select",useComponentProps:function(){var t=(0,r.useTranslation)().t,n=(0,f.useField)(),o=(0,e.useColumnSchema)().fieldSchema,i=(0,f.useFieldSchema)(),u=o||i,c=(0,e.useDesignable)().dn;return{title:t("Field component"),options:[{label:t("URL"),value:"url"},{label:t("Preview"),value:"preview"}],value:u["x-component-props"].componentMode||"preview",onChange:function(e){var t=b({},"x-uid",u["x-uid"]);u["x-component-props"]=u["x-component-props"]||{},u["x-component-props"].componentMode=e,t["x-component-props"]=u["x-component-props"],n.componentProps=n.componentProps||{},n.componentProps.componentMode=e,c.emit("patch",{schema:t}),c.refresh()}}},useVisible:function(){var t=(0,e.useIsFieldReadPretty)();return(0,e.useColumnSchema)().fieldSchema,t}},{name:"size",type:"select",useVisible:function(){var t=(0,e.useIsFieldReadPretty)(),n=(0,e.useColumnSchema)().fieldSchema;return t&&!n},useComponentProps:function(){var t,n=(0,r.useTranslation)().t,o=(0,f.useField)(),i=(0,f.useFieldSchema)(),u=(0,e.useDesignable)().dn;return{title:n("Size"),options:[{label:n("Large"),value:"large"},{label:n("Default"),value:"default"},{label:n("Small"),value:"small"}],value:(null==o||null==(t=o.componentProps)?void 0:t.size)||"default",onChange:function(e){var t=b({},"x-uid",i["x-uid"]);i["x-component-props"]=i["x-component-props"]||{},i["x-component-props"].size=e,t["x-component-props"]=i["x-component-props"],o.componentProps=o.componentProps||{},o.componentProps.size=e,u.emit("patch",{schema:t}),u.refresh()}}}}]}),y=d(581);function v(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){v(i,r,o,u,c,"next",e)}function c(e){v(i,r,o,u,c,"throw",e)}u(void 0)})}}function O(e,t,n){return(O=j()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&P(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 P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return O(e,arguments,x(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),P(n,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function S(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var _=(0,e.lazy)(function(){return y("imported_-fj1qvv_component",d.e("618").then(d.bind(d,835)))},"AttachmentUrl").AttachmentUrl,F=function(e){var n;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)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?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&&P(r,e),n=[{key:"afterAdd",value:function(){return g(function(){return S(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return g(function(){return S(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return g(function(){return S(this,function(n){return e.app.dataSourceManager.addFieldInterfaces([p]),e.app.addScopes({useAttachmentUrlFieldProps:t.N2}),e.app.addComponents({AttachmentUrl:_}),e.app.schemaSettingsManager.add(h),[2]})})()}}],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,n),r}(w(e.Plugin)),k=F}(),m}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/client"),require("react"),require("@formily/react"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@nocobase/client","react","@formily/react","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@nocobase/client"),require("react"),require("@formily/react"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@nocobase/client"],e.react,e["@formily/react"],e.lodash)}(self,function(e,t,n,r,o){return function(){var i,c,u,a,l,s,p={253:function(e,t,n){"use strict";n.d(t,{N2:function(){return a},fR:function(){return l},sz:function(){return s}});var r=n(505),o=n(772),i=n(467),c=n(156),u=n(238);function a(e){var t,n,r,i,c,u,a,l=(0,o.useCollectionField)(),s=(n=null!=(t=null==l?void 0:l.storage)?t:"",i=(r=(0,o.useRequest)({url:"storages:getBasicInfo/".concat(n)},{refreshDeps:[n]})).loading,c=r.data,!i&&(null==c?void 0:c.data)||null);return u=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}({},e),a=a={rules:s,action:"".concat(l.target,":create").concat(l.storage?"?attachmentField=".concat(l.collectionName,".").concat(l.name):""),toValueItem:function(e){return(null==e?void 0:e.thumbnailRule)?"".concat(null==e?void 0:e.url).concat(null==e?void 0:e.thumbnailRule):null==e?void 0:e.url},getThumbnailURL:function(e){return null==e?void 0:e.url}},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(a)).forEach(function(e){Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(a,e))}),u}var l=function(e){var t=(0,r.useFieldSchema)(),n=(0,o.useDesignable)().insertAfterBegin;return(0,c.useCallback)(function(r){t.reduceProperties(function(t,n){return n["x-component"]==="AssociationField."+e?n:t},null)||n((0,i.cloneDeep)(r))},[e,t,n])},s=function(){(0,u.useTranslation)().t;var e=(0,r.useField)();return{service:{resource:"collections:listFileCollectionsWithPublicStorage",params:{paginate:!1}},manual:!1,fieldNames:{label:"title",value:"name"},onSuccess:function(t){e.data=e.data||{},e.data.options=null==t?void 0:t.data}}}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},505:function(e){"use strict";e.exports=r},772:function(e){"use strict";e.exports=t},467:function(e){"use strict";e.exports=o},156:function(e){"use strict";e.exports=n},238:function(t){"use strict";t.exports=e}},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.m=p,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.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return"91c71298e3ff5d7f.js"},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)},i={},c="@nocobase/plugin-field-attachment-url:",d.l=function(e,t,n,r){if(i[e])return void i[e].push(t);if(void 0!==n)for(var o,u,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var s=a[l];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==c+n){o=s;break}}o||(u=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-webpack",c+n),o.src=e),i[e]=[t];var p=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=i[e];if(delete i[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),u&&document.head.appendChild(o)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(u=window.__nocobase_public_path__||"/").endsWith("/")||(u+="/"),d.p=u+"static/plugins/@nocobase/plugin-field-attachment-url/dist/client/",a={909:0},d.f.j=function(e,t){var n=d.o(a,e)?a[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),i=Error();d.l(o,function(t){if(d.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},l=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],u=0;if(o.some(function(e){return 0!==a[e]})){for(n in i)d.o(i,n)&&(d.m[n]=i[n]);c&&c(d)}for(e&&e(t);u<o.length;u++)r=o[u],d.o(a,r)&&a[r]&&a[r][0](),a[r]=0},(s=self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).forEach(l.bind(null,0)),s.push=l.bind(null,s.push.bind(s));var m={};return!function(){"use strict";d.r(m),d.d(m,{PluginFieldAttachmentUrlClient:function(){return C},default:function(){return E}});var e,t,n=d(772),r=d(253),o=JSON.parse('{"u2":"@nocobase/plugin-field-attachment-url"}'),i=d(238);function c(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.u2,"', 'client'], nsMode: 'fallback' })}}")}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var p=n.interfacesProperties.defaultProps,f=n.interfacesProperties.operators,b=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,o,i,l;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=a(t),u(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,s()?Reflect.construct(t,o||[],a(this).constructor):t.apply(this,o)),"name","attachmentURL"),u(e,"type","object"),u(e,"group","media"),u(e,"title",c("Attachment (URL)")),u(e,"default",{type:"string",uiSchema:{type:"string","x-component":"AttachmentUrl","x-use-component-props":"useAttachmentUrlFieldProps"}}),u(e,"availableTypes",["string","text"]),u(e,"properties",(i=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){u(e,t,n[t])})}return e}({},p),l=l={target:{required:!0,type:"string",title:c("Which file collection should it be uploaded to"),"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":r.sz,"x-reactions":function(e){var t;((null==(t=e.data)?void 0:t.options)||[]).some(function(e){return(null==e?void 0:e.name)==="attachments"})&&(e.initialValue||e.setInitialValue("attachments"))}},targetKey:{"x-hidden":!0,default:"id",type:"string"}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))}),i)),u(e,"filterable",{nested:!0,operators:f.bigField}),u(e,"titleUsable",!0),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&l(n,e),t=[{key:"schemaInitialize",value:function(e,t){var n=t.block;e["x-component-props"]=e["x-component-props"]||{},e["x-component-props"].mode="AttachmentUrl",["Table","Kanban"].includes(n)&&(e["x-component-props"].ellipsis=!0,e["x-component-props"].size="small")}}],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.CollectionFieldInterface),y=d(505);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}var v=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,y.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,y.useFieldSchema)(),u=o||c,a=(0,n.useDesignable)(),l=a.dn,s=a.refresh;return{title:t("Quick upload"),checked:(null==(e=u["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=h({},"x-uid",u["x-uid"]);r.componentProps.quickUpload=e,u["x-component-props"]=u["x-component-props"]||{},u["x-component-props"].quickUpload=e,t["x-component-props"]=u["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,y.useField)(),r=(0,y.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||r.readPretty)&&!t.componentProps.underFilter}},{name:"selectFile",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,y.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,y.useFieldSchema)(),u=o||c,a=(0,n.useDesignable)(),l=a.dn,s=a.refresh;return{title:t("Select file"),checked:(null==(e=u["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=h({},"x-uid",u["x-uid"]);r.componentProps.selectFile=e,u["x-component-props"]=u["x-component-props"]||{},u["x-component-props"].selectFile=e,t["x-component-props"]=u["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,y.useField)(),r=(0,y.useForm)();return!((null==e?void 0:e["x-read-pretty"])||t.readPretty||r.readPretty)&&!t.componentProps.underFilter}},{name:"fieldComponent",type:"select",useComponentProps:function(){var e=(0,i.useTranslation)().t,t=(0,y.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,y.useFieldSchema)(),c=r||o,u=(0,n.useDesignable)().dn;return{title:e("Field component"),options:[{label:e("URL"),value:"url"},{label:e("Preview"),value:"preview"}],value:c["x-component-props"].componentMode||"preview",onChange:function(e){var n=h({},"x-uid",c["x-uid"]);c["x-component-props"]=c["x-component-props"]||{},c["x-component-props"].componentMode=e,n["x-component-props"]=c["x-component-props"],t.componentProps=t.componentProps||{},t.componentProps.componentMode=e,u.emit("patch",{schema:n}),u.refresh()}}},useVisible:function(){var e=(0,n.useIsFieldReadPretty)();return(0,n.useColumnSchema)().fieldSchema,e}},(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){h(e,t,n[t])})}return e}({},n.fileSizeSetting),t=t={useVisible:function(){var e=(0,n.useIsFieldReadPretty)(),t=(0,n.useColumnSchema)().fieldSchema;return e&&!t}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e)]}),g=d(581);function O(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function P(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){O(i,r,o,c,u,"next",e)}function u(e){O(i,r,o,c,u,"throw",e)}c(void 0)})}}function j(e,t,n){return(j=_()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&x(o,n.prototype),o}).apply(null,arguments)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=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 j(e,arguments,w(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),x(n,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function k(e,t){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){var a=[i,u];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,r=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var F=(0,n.lazy)(function(){return g("imported_-fj1qvv_component",d.e("618").then(d.bind(d,835)))},"AttachmentUrl").AttachmentUrl,C=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=w(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(e,t||[],w(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&x(n,e),t=[{key:"afterAdd",value:function(){return P(function(){return k(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return P(function(){return k(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return P(function(){return k(this,function(t){return e.app.dataSourceManager.addFieldInterfaces([b]),e.app.addScopes({useAttachmentUrlFieldProps:r.N2}),e.app.addComponents({AttachmentUrl:F}),e.app.schemaSettingsManager.add(v),[2]})})()}}],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}(S(n.Plugin)),E=C}(),m}()});
@@ -8,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.7.0-beta.30",
11
+ "@nocobase/client": "1.7.0-beta.31",
12
12
  "react-i18next": "11.18.6",
13
- "@nocobase/server": "1.7.0-beta.30",
14
- "@nocobase/plugin-file-manager": "1.7.0-beta.30",
15
- "@nocobase/test": "1.7.0-beta.30",
13
+ "@nocobase/server": "1.7.0-beta.31",
14
+ "@nocobase/plugin-file-manager": "1.7.0-beta.31",
15
+ "@nocobase/test": "1.7.0-beta.31",
16
16
  "@formily/react": "2.3.0",
17
17
  "react": "18.2.0",
18
18
  "lodash": "4.17.21",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-attachment-url",
3
- "version": "1.7.0-beta.30",
3
+ "version": "1.7.0-beta.31",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Collection field: Attachment(URL)",
6
6
  "displayName.zh-CN": "数据表字段:附件(URL)",
@@ -15,5 +15,5 @@
15
15
  "keywords": [
16
16
  "Collection fields"
17
17
  ],
18
- "gitHead": "d83e6ab1ebfb90a97e021127ee632f38869e5ea1"
18
+ "gitHead": "84bf8bcfeeaf3a05086e24cef00507ca209ac3c5"
19
19
  }