@nocobase/plugin-field-attachment-url 2.1.0-beta.32 → 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 +1 -0
- package/dist/client/index.js +1 -1
- package/dist/{client/fieldModel → client-v2}/AttachmentURLFieldModel.d.ts +2 -1
- package/dist/client-v2/index.d.ts +15 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/interfaces/attachment-url.d.ts +91 -0
- package/dist/client-v2/locale.d.ts +10 -0
- package/dist/externalVersion.js +10 -9
- package/package.json +3 -2
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
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("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-file-manager/client"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@emotion/css","@formily/antd-v5","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-file-manager/client","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@emotion/css"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-file-manager/client"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@emotion/css"],e["@formily/antd-v5"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-file-manager/client"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,c,a,u,l){return function(){"use strict";var s,p,f,d={233:function(e,t,n){n.d(t,{S8:function(){return u},uF:function(){return s},uR:function(){return l}});var r=n(230),o=n(342),i=n(773),c=n(155),a=n(953);function u(e){var t,n,r,i,c,a,u,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 a=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),u=u={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(a,Object.getOwnPropertyDescriptors(u)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(u)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(u,e))}),a}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,a.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}}}},375:function(e){e.exports=c},477:function(e){e.exports=t},418:function(e){e.exports=n},230:function(e){e.exports=i},342:function(e){e.exports=o},694:function(e){e.exports=u},609:function(e){e.exports=a},773:function(e){e.exports=l},155:function(e){e.exports=r},953:function(t){t.exports=e}},b={};function m(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,m),n.exports}m.m=d,m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},m.d=function(e,t){for(var n in t)m.o(t,n)&&!m.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},m.f={},m.e=function(e){return Promise.all(Object.keys(m.f).reduce(function(t,n){return m.f[n](e,t),t},[]))},m.u=function(e){return""+e+".aca7595ba197ec73.js"},m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},m.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-field-attachment-url:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,m.nc&&o.setAttribute("nonce",m.nc),o.setAttribute("data-rspack","@nocobase/plugin-field-attachment-url:"+n),o.src=e),y[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=y[e];if(delete y[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},m.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},m.g.importScripts&&(h=m.g.location+"");var y,h,v=m.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var O=g.length-1;O>-1&&(!h||!/^http(s?):/.test(h));)h=g[O--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");m.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},m.f.j=function(e,t){var n=m.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=m.p+m.u(e),i=Error();m.l(o,function(t){if(m.o(s,e)&&(0!==(n=s[e])&&(s[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)}},p=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)m.o(i,n)&&(m.m[n]=i[n]);c&&c(m)}for(e&&e(t);a<o.length;a++)r=o[a],m.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(f=self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).forEach(p.bind(null,0)),f.push=p.bind(null,f.push.bind(f));var w={};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-field-attachment-url/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-field-attachment-url/dist/client/"}m.p=e}(),!function(){m.r(w),m.d(w,{PluginFieldAttachmentUrlClient:function(){return J},default:function(){return K}});var e,t,n=m(342),r=m(233),o=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}'),i=m(953);function c(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.UU,"', 'client'], nsMode: 'fallback' })}}")}function a(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 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,d=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=u(t),a(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,s()?Reflect.construct(t,o||[],u(this).constructor):t.apply(this,o)),"name","attachmentURL"),a(e,"type","object"),a(e,"group","media"),a(e,"title",c("Attachment (URL)")),a(e,"default",{type:"string",uiSchema:{type:"string","x-component":"AttachmentUrl","x-use-component-props":"useAttachmentUrlFieldProps"}}),a(e,"availableTypes",["string","text"]),a(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){a(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.uF,"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){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))}),i)),a(e,"filterable",{nested:!0,operators:f.bigField}),a(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),b=m(609),y=m(418),h=m(477),v=m(375),g=m(694),O=m(155),j=m.n(O),P=m(230),x=m(773);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 _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(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}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function U(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return U=function(){return n},n}var A=function(e){var t,n=e.showFileName,r=e.value,o=e.onChange,i=(0,P.useField)(),c=function(e){if(Array.isArray(e))return e}(t=(0,O.useState)((0,x.castArray)(r||[]).map(function(e){return{url:e}})))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}}(t)||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)}}(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=c[0],u=c[1];return(0,O.useEffect)(function(){u((0,x.castArray)(r||[]).map(function(e){return{url:e}}))},[r]),j().createElement(P.FieldContext.Provider,{value:k(F({},i),{value:a})},j().createElement("div",{style:{display:"flex"},className:(0,h.css)(U(),n?"8px 0px":"0px",n?"8px 0px":"0px")},j().createElement(y.Upload,k(F({},e),{listType:"picture-card",fileList:a,onChange:function(e){u(e);var t=e[0];if(!t){null==o||o(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==o||o(r)}else"removed"===t.status&&(null==o||o(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return j().createElement(j().Fragment,null,e,n&&j().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),j().createElement(v.UploadOutlined,{style:{fontSize:20}}))))},R=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=_(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,C()?Reflect.construct(e,t||[],_(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&E(n,e),t=[{key:"render",value:function(){return j().createElement(A,this.props)}}],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.UploadFieldModel);function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}R.define({label:(0,g.tExpr)("AttachmentURL")}),g.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),g.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0});var q=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,P.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,P.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Quick upload"),checked:(null==(e=a["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=T({},"x-uid",a["x-uid"]);r.componentProps.quickUpload=e,a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].quickUpload=e,t["x-component-props"]=a["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,P.useField)(),r=(0,P.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,P.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,P.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Select file"),checked:(null==(e=a["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=T({},"x-uid",a["x-uid"]);r.componentProps.selectFile=e,a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].selectFile=e,t["x-component-props"]=a["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,P.useField)(),r=(0,P.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,P.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,P.useFieldSchema)(),c=r||o,a=(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=T({},"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,a.emit("patch",{schema:n}),a.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){T(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){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e)]});function D(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).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 c(e){D(i,r,o,c,a,"next",e)}function a(e){D(i,r,o,c,a,"throw",e)}c(void 0)})}}function I(e,t,n){return(I=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&N(o,n.prototype),o}).apply(null,arguments)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t="function"==typeof Map?new Map:void 0;return(B=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 I(e,arguments,L(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),N(n,e)})(e)}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(z=function(){return!!e})()}function $(e,t){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),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];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=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 V=(0,n.lazy)(function(){return m.e("749").then(m.bind(m,172))},"AttachmentUrl").AttachmentUrl,J=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=L(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,z()?Reflect.construct(e,t||[],L(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&N(n,e),t=[{key:"afterAdd",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"load",value:function(){return M(function(){return $(this,function(e){return this.app.dataSourceManager.addFieldInterfaces([d]),this.app.addScopes({useAttachmentUrlFieldProps:r.S8}),this.app.addComponents({AttachmentUrl:V}),this.app.schemaSettingsManager.add(q),this.flowEngine.registerModels({AttachmentURLFieldModel:R}),[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)}}(n.prototype,t),n}(B(n.Plugin)),K=J}(),w}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url",["react-i18next","@emotion/css","@nocobase/plugin-file-manager/client-v2","@formily/antd-v5","react","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url"]=t(require("react-i18next"),require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@formily/antd-v5"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url"]=t(e["react-i18next"],e["@emotion/css"],e["@nocobase/plugin-file-manager/client-v2"],e["@formily/antd-v5"],e.react,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,c,a,u,l){return function(){"use strict";var s,p,f,d={233:function(e,t,n){n.d(t,{S8:function(){return u},uF:function(){return s},uR:function(){return l}});var r=n(230),o=n(342),i=n(773),c=n(155),a=n(953);function u(e){var t,n,r,i,c,a,u,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 a=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),u=u={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(a,Object.getOwnPropertyDescriptors(u)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(u)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(u,e))}),a}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,a.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}}}},375:function(e){e.exports=a},477:function(e){e.exports=t},418:function(e){e.exports=r},230:function(e){e.exports=c},342:function(e){e.exports=i},694:function(e){e.exports=u},936:function(e){e.exports=n},773:function(e){e.exports=l},155:function(e){e.exports=o},953:function(t){t.exports=e}},b={};function m(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,m),n.exports}m.m=d,m.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return m.d(t,{a:t}),t},m.d=function(e,t){for(var n in t)m.o(t,n)&&!m.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},m.f={},m.e=function(e){return Promise.all(Object.keys(m.f).reduce(function(t,n){return m.f[n](e,t),t},[]))},m.u=function(e){return""+e+".aca7595ba197ec73.js"},m.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),m.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},m.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-field-attachment-url:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,m.nc&&o.setAttribute("nonce",m.nc),o.setAttribute("data-rspack","@nocobase/plugin-field-attachment-url:"+n),o.src=e),y[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=y[e];if(delete y[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},m.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},m.g.importScripts&&(h=m.g.location+"");var y,h,v=m.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var O=g.length-1;O>-1&&(!h||!/^http(s?):/.test(h));)h=g[O--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");m.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},m.f.j=function(e,t){var n=m.o(s,e)?s[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=m.p+m.u(e),i=Error();m.l(o,function(t){if(m.o(s,e)&&(0!==(n=s[e])&&(s[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)}},p=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==s[e]})){for(n in i)m.o(i,n)&&(m.m[n]=i[n]);c&&c(m)}for(e&&e(t);a<o.length;a++)r=o[a],m.o(s,r)&&s[r]&&s[r][0](),s[r]=0},(f=self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).forEach(p.bind(null,0)),f.push=p.bind(null,f.push.bind(f));var w={};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-field-attachment-url/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-field-attachment-url/dist/client/"}m.p=e}(),!function(){m.r(w),m.d(w,{default:function(){return K},PluginFieldAttachmentUrlClient:function(){return J},AttachmentURLFieldModel:function(){return R}});var e,t,n=m(342),r=m(233),o=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}'),i=m(953);function c(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(o.UU,"', 'client'], nsMode: 'fallback' })}}")}function a(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 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,d=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=u(t),a(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,s()?Reflect.construct(t,o||[],u(this).constructor):t.apply(this,o)),"name","attachmentURL"),a(e,"type","object"),a(e,"group","media"),a(e,"title",c("Attachment (URL)")),a(e,"default",{type:"string",uiSchema:{type:"string","x-component":"AttachmentUrl","x-use-component-props":"useAttachmentUrlFieldProps"}}),a(e,"availableTypes",["string","text"]),a(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){a(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.uF,"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){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))}),i)),a(e,"filterable",{nested:!0,operators:f.bigField}),a(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),b=m(375),y=m(477),h=m(418),v=m(230),g=m(694),O=m(936),j=m(773),P=m(155),x=m.n(P);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 _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(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}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}function C(){var e,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return C=function(){return n},n}var A=function(e){var t,n=e.showFileName,r=e.value,o=e.onChange,i=(0,v.useField)(),c=function(e){if(Array.isArray(e))return e}(t=(0,P.useState)((0,j.castArray)(r||[]).map(function(e){return{url:e}})))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw n}}return o}}(t)||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)}}(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=c[0],u=c[1];return(0,P.useEffect)(function(){u((0,j.castArray)(r||[]).map(function(e){return{url:e}}))},[r]),x().createElement(v.FieldContext.Provider,{value:k(F({},i),{value:a})},x().createElement("div",{style:{display:"flex"},className:(0,y.css)(C(),n?"8px 0px":"0px",n?"8px 0px":"0px")},x().createElement(h.Upload,k(F({},e),{listType:"picture-card",fileList:a,onChange:function(e){u(e);var t=e[0];if(!t){null==o||o(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==o||o(r)}else"removed"===t.status&&(null==o||o(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return x().createElement(x().Fragment,null,e,n&&x().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),x().createElement(b.UploadOutlined,{style:{fontSize:20}}))))},R=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=_(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,U()?Reflect.construct(e,t||[],_(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&E(n,e),t=[{key:"render",value:function(){return x().createElement(A,this.props)}}],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}(O.UploadFieldModel);function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}R.define({label:(0,g.tExpr)("AttachmentURL",{ns:[o.UU,"client"]})}),g.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),g.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0});var q=new n.SchemaSettings({name:"fieldSettings:component:AttachmentUrl",items:[{name:"quickUpload",type:"switch",useComponentProps:function(){var e,t=(0,i.useTranslation)().t,r=(0,v.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,v.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Quick upload"),checked:(null==(e=a["x-component-props"])?void 0:e.quickUpload)!==!1,onChange:function(e){var t=T({},"x-uid",a["x-uid"]);r.componentProps.quickUpload=e,a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].quickUpload=e,t["x-component-props"]=a["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,v.useField)(),r=(0,v.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,v.useField)(),o=(0,n.useColumnSchema)().fieldSchema,c=(0,v.useFieldSchema)(),a=o||c,u=(0,n.useDesignable)(),l=u.dn,s=u.refresh;return{title:t("Select file"),checked:(null==(e=a["x-component-props"])?void 0:e.selectFile)!==!1,onChange:function(e){var t=T({},"x-uid",a["x-uid"]);r.componentProps.selectFile=e,a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].selectFile=e,t["x-component-props"]=a["x-component-props"],l.emit("patch",{schema:t}),s()}}},useVisible:function(){var e=(0,n.useColumnSchema)().fieldSchema,t=(0,v.useField)(),r=(0,v.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,v.useField)(),r=(0,n.useColumnSchema)().fieldSchema,o=(0,v.useFieldSchema)(),c=r||o,a=(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=T({},"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,a.emit("patch",{schema:n}),a.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){T(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){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e)]});function D(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).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 c(e){D(i,r,o,c,a,"next",e)}function a(e){D(i,r,o,c,a,"throw",e)}c(void 0)})}}function I(e,t,n){return(I=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&N(o,n.prototype),o}).apply(null,arguments)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t="function"==typeof Map?new Map:void 0;return(B=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 I(e,arguments,L(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),N(n,e)})(e)}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(z=function(){return!!e})()}function $(e,t){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),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];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=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 V=(0,n.lazy)(function(){return m.e("749").then(m.bind(m,172))},"AttachmentUrl").AttachmentUrl,J=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=L(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,z()?Reflect.construct(e,t||[],L(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&N(n,e),t=[{key:"afterAdd",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return M(function(){return $(this,function(e){return[2]})})()}},{key:"load",value:function(){return M(function(){return $(this,function(e){return this.app.dataSourceManager.addFieldInterfaces([d]),this.app.addScopes({useAttachmentUrlFieldProps:r.S8}),this.app.addComponents({AttachmentUrl:V}),this.app.schemaSettingsManager.add(q),this.flowEngine.registerModels({AttachmentURLFieldModel:R}),[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)}}(n.prototype,t),n}(B(n.Plugin)),K=J}(),w}()});
|
|
@@ -6,8 +6,9 @@
|
|
|
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 { UploadFieldModel } from '@nocobase/plugin-file-manager/client';
|
|
9
|
+
import { UploadFieldModel } from '@nocobase/plugin-file-manager/client-v2';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
export declare class AttachmentURLFieldModel extends UploadFieldModel {
|
|
12
|
+
props: Record<string, any>;
|
|
12
13
|
render(): React.JSX.Element;
|
|
13
14
|
}
|
|
@@ -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 { Application, Plugin } from '@nocobase/client-v2';
|
|
10
|
+
export declare class PluginFieldAttachmentUrlClient extends Plugin<any, Application> {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export { AttachmentURLFieldInterface } from './interfaces/attachment-url';
|
|
14
|
+
export { AttachmentURLFieldModel } from './AttachmentURLFieldModel';
|
|
15
|
+
export default PluginFieldAttachmentUrlClient;
|
|
@@ -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("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-attachment-url/client-v2",["@emotion/css","@nocobase/plugin-file-manager/client-v2","@nocobase/client-v2","@formily/antd-v5","react","@formily/react","@ant-design/icons","@nocobase/flow-engine","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-field-attachment-url/client-v2"]=t(require("@emotion/css"),require("@nocobase/plugin-file-manager/client-v2"),require("@nocobase/client-v2"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("lodash")):e["@nocobase/plugin-field-attachment-url/client-v2"]=t(e["@emotion/css"],e["@nocobase/plugin-file-manager/client-v2"],e["@nocobase/client-v2"],e["@formily/antd-v5"],e.react,e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.lodash)}(self,function(e,t,n,r,o,i,a,c,l){return function(){"use strict";var u={724:function(e,t,n){n.r(t),n.d(t,{AttachmentURLFieldModel:function(){return w}});var r=n(375),o=n(477),i=n(418),a=n(230),c=n(694),l=n(936),u=n(773),s=n(155),p=n.n(s),f=JSON.parse('{"UU":"@nocobase/plugin-field-attachment-url"}');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 y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(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}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,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,t,n=(e=["\n .ant-upload-list-picture-card {\n margin-bottom: 10px;\n .ant-upload-list-item-container {\n margin: ",";\n }\n }\n .ant-upload-select {\n margin: ",";\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return g=function(){return n},n}var O=function(e){var t,n=e.showFileName,c=e.value,l=e.onChange,f=(0,a.useField)(),y=function(e){if(Array.isArray(e))return e}(t=(0,s.useState)((0,u.castArray)(c||[]).map(function(e){return{url:e}})))||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}}(t)||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)}}(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.")}(),v=y[0],h=y[1];return(0,s.useEffect)(function(){h((0,u.castArray)(c||[]).map(function(e){return{url:e}}))},[c]),p().createElement(a.FieldContext.Provider,{value:m(d({},f),{value:v})},p().createElement("div",{style:{display:"flex"},className:(0,o.css)(g(),n?"8px 0px":"0px",n?"8px 0px":"0px")},p().createElement(i.Upload,m(d({},e),{listType:"picture-card",fileList:v,onChange:function(e){h(e);var t=e[0];if(!t){null==l||l(void 0);return}if("done"===t.status){var n,r=(null==(n=t.response)?void 0:n.url)||t.url;null==l||l(r)}else"removed"===t.status&&(null==l||l(void 0))},itemRender:function(e,t){var r=t.name||decodeURIComponent(t.url.split("/").pop());return p().createElement(p().Fragment,null,e,n&&p().createElement("div",{style:{fontSize:12,whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},title:r},r))}}),p().createElement(r.UploadOutlined,{style:{fontSize:20}}))))},w=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=y(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(e,t||[],y(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&v(n,e),t=[{key:"render",value:function(){return p().createElement(O,this.props)}}],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}(l.UploadFieldModel);w.define({label:(0,c.tExpr)("AttachmentURL",{ns:[f.UU,"client"]})}),c.EditableItemModel.bindModelToInterface("AttachmentURLFieldModel",["attachmentURL"],{isDefault:!0}),c.DisplayItemModel.bindModelToInterface("DisplayTextFieldModel",["attachmentURL"],{isDefault:!0})},375:function(e){e.exports=a},477:function(t){t.exports=e},418:function(e){e.exports=r},230:function(e){e.exports=i},485:function(e){e.exports=n},694:function(e){e.exports=c},936:function(e){e.exports=t},773:function(e){e.exports=l},155:function(e){e.exports=o}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return u[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&&(f=p.g.location+"");var f,b=p.g.document;if(!f&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(f=b.currentScript.src),!f)){var y=b.getElementsByTagName("script");if(y.length)for(var d=y.length-1;d>-1&&(!f||!/^http(s?):/.test(f));)f=y[d--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");p.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-field-attachment-url/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-field-attachment-url/dist/client-v2/"}p.p=e}(),!function(){p.r(m),p.d(m,{AttachmentURLFieldInterface:function(){return l},default:function(){return g},PluginFieldAttachmentUrlClient:function(){return h},AttachmentURLFieldModel:function(){return u.AttachmentURLFieldModel}});var e=p(485),t=p(230);function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}var a=[{label:'{{t("contains")}}',value:"$includes",selected:!0,schema:{type:"string","x-component":"Input"}},{label:'{{t("does not contain")}}',value:"$notIncludes",schema:{type:"string","x-component":"Input"}},{label:'{{t("is")}}',value:"$eq",schema:{type:"string","x-component":"Input"}},{label:'{{t("is not")}}',value:"$ne",schema:{type:"string","x-component":"Input"}},{label:'{{t("is empty")}}',value:"$empty",noValue:!0,schema:{type:"string","x-component":"Input"}},{label:'{{t("is not empty")}}',value:"$notEmpty",noValue:!0,schema:{type:"string","x-component":"Input"}}],c=function(){var e=(0,t.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}}},l=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function l(){var e,t,o;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return t=l,o=arguments,t=r(t),n(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,i()?Reflect.construct(t,o||[],r(this).constructor):t.apply(this,o)),"name","attachmentURL"),n(e,"type","object"),n(e,"group","media"),n(e,"title",'{{t("Attachment (URL)")}}'),n(e,"default",{interface:"attachmentURL",type:"string",uiSchema:{type:"string","x-component":"Input"}}),n(e,"availableTypes",["string","text"]),n(e,"validationType","string"),n(e,"availableValidationOptions",["min","max","length","pattern"]),n(e,"properties",{target:{required:!0,type:"string",title:'{{t("Which file collection should it be uploaded to")}}',"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":c,"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:{type:"string",default:"id","x-hidden":!0}}),n(e,"filterable",{nested:!0,operators:a}),n(e,"titleUsable",!0),e}return l.prototype=Object.create(e&&e.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),e&&o(l,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)}}(l.prototype,t),l}(e.CollectionFieldInterface),u=p(724);function s(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 f(e,t,n){return(f=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=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 f(e,arguments,b(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var h=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=b(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,v()?Reflect.construct(e,t||[],b(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&y(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.addFieldInterfaces([l]),this.flowEngine.registerModelLoaders({AttachmentURLFieldModel:{loader:function(){return Promise.resolve().then(p.bind(p,724))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){s(i,r,o,a,c,"next",e)}function c(e){s(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}(d(e.Plugin)),g=h}(),m}()});
|
|
@@ -0,0 +1,91 @@
|
|
|
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 type { ISchema } from '@formily/react';
|
|
10
|
+
import { CollectionFieldInterface } from '@nocobase/client-v2';
|
|
11
|
+
export declare class AttachmentURLFieldInterface extends CollectionFieldInterface {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
group: string;
|
|
15
|
+
title: string;
|
|
16
|
+
default: {
|
|
17
|
+
interface: string;
|
|
18
|
+
type: string;
|
|
19
|
+
uiSchema: {
|
|
20
|
+
type: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
availableTypes: string[];
|
|
25
|
+
validationType: string;
|
|
26
|
+
availableValidationOptions: string[];
|
|
27
|
+
properties: {
|
|
28
|
+
target: {
|
|
29
|
+
required: boolean;
|
|
30
|
+
type: string;
|
|
31
|
+
title: string;
|
|
32
|
+
'x-decorator': string;
|
|
33
|
+
'x-component': string;
|
|
34
|
+
'x-use-component-props': () => {
|
|
35
|
+
service: {
|
|
36
|
+
resource: string;
|
|
37
|
+
params: {
|
|
38
|
+
paginate: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
manual: boolean;
|
|
42
|
+
fieldNames: {
|
|
43
|
+
label: string;
|
|
44
|
+
value: string;
|
|
45
|
+
};
|
|
46
|
+
onSuccess: (data: any) => void;
|
|
47
|
+
};
|
|
48
|
+
'x-reactions': (field: any) => void;
|
|
49
|
+
};
|
|
50
|
+
targetKey: {
|
|
51
|
+
type: string;
|
|
52
|
+
default: string;
|
|
53
|
+
'x-hidden': boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
filterable: {
|
|
57
|
+
nested: boolean;
|
|
58
|
+
operators: ({
|
|
59
|
+
label: string;
|
|
60
|
+
value: string;
|
|
61
|
+
selected: boolean;
|
|
62
|
+
schema: {
|
|
63
|
+
type: string;
|
|
64
|
+
'x-component': string;
|
|
65
|
+
};
|
|
66
|
+
noValue?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
label: string;
|
|
69
|
+
value: string;
|
|
70
|
+
schema: {
|
|
71
|
+
type: string;
|
|
72
|
+
'x-component': string;
|
|
73
|
+
};
|
|
74
|
+
selected?: undefined;
|
|
75
|
+
noValue?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
label: string;
|
|
78
|
+
value: string;
|
|
79
|
+
noValue: boolean;
|
|
80
|
+
schema: {
|
|
81
|
+
type: string;
|
|
82
|
+
'x-component': string;
|
|
83
|
+
};
|
|
84
|
+
selected?: undefined;
|
|
85
|
+
})[];
|
|
86
|
+
};
|
|
87
|
+
titleUsable: boolean;
|
|
88
|
+
schemaInitialize(schema: ISchema, { block }: {
|
|
89
|
+
block: any;
|
|
90
|
+
}): void;
|
|
91
|
+
}
|
|
@@ -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;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.33",
|
|
12
12
|
"react-i18next": "11.18.6",
|
|
13
|
-
"@nocobase/server": "2.1.0-beta.32",
|
|
14
|
-
"@nocobase/plugin-file-manager": "2.1.0-beta.32",
|
|
15
|
-
"@nocobase/test": "2.1.0-beta.32",
|
|
16
|
-
"@formily/react": "2.3.7",
|
|
17
|
-
"react": "18.2.0",
|
|
18
|
-
"@formily/antd-v5": "1.2.3",
|
|
19
|
-
"@emotion/css": "11.13.0",
|
|
20
13
|
"@ant-design/icons": "5.6.1",
|
|
21
|
-
"@
|
|
14
|
+
"@emotion/css": "11.13.0",
|
|
15
|
+
"@formily/antd-v5": "1.2.3",
|
|
16
|
+
"@formily/react": "2.3.7",
|
|
17
|
+
"@nocobase/flow-engine": "2.1.0-beta.33",
|
|
18
|
+
"@nocobase/plugin-file-manager": "2.1.0-beta.33",
|
|
22
19
|
"lodash": "4.18.1",
|
|
20
|
+
"react": "18.2.0",
|
|
21
|
+
"@nocobase/client-v2": "2.1.0-beta.33",
|
|
22
|
+
"@nocobase/server": "2.1.0-beta.33",
|
|
23
|
+
"@nocobase/test": "2.1.0-beta.33",
|
|
23
24
|
"@formily/core": "2.3.7"
|
|
24
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-field-attachment-url",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.33",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "Collection field: Attachment(URL)",
|
|
6
6
|
"displayName.ru-RU": "Поле коллекции: Вложение (URL)",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"description.zh-CN": "支持 URL 格式的附件。",
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"@nocobase/client": "2.x",
|
|
13
|
+
"@nocobase/client-v2": "2.x",
|
|
13
14
|
"@nocobase/plugin-file-manager": "2.x",
|
|
14
15
|
"@nocobase/server": "2.x",
|
|
15
16
|
"@nocobase/test": "2.x"
|
|
@@ -18,5 +19,5 @@
|
|
|
18
19
|
"Collection fields"
|
|
19
20
|
],
|
|
20
21
|
"license": "Apache-2.0",
|
|
21
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "4815c394e80a264fa8ed619246280923c47aeb72"
|
|
22
23
|
}
|