@nocobase/plugin-field-attachment-url 1.6.21 → 1.7.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- "use strict";(self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).push([["618"],{835:function(e,t,n){n.r(t),n.d(t,{AttachmentUrl:function(){return f}});var o=n(505),r=n(156),l=n.n(r),i=n(772),c={type:"void","x-component":"AssociationField.Selector",title:'{{ t("Select record") }}',"x-component-props":{className:"nb-record-picker-selector"},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:tableSelector:addBlock",properties:{}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:submit","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}},a=n(253);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function s(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)n=l[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var l=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(l.push(n.value),!t||l.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d=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},m=(0,o.connect)(function(e){var t,n=e.value,r=(0,o.useFieldSchema)(),c=null==r||null==(t=r["x-component-props"])?void 0:t.componentMode,a=(0,i.useCollection_deprecated)().getField,u=(0,i.useCollectionManager_deprecated)().getCollectionJoinField,s=a(r.name)||u(r["x-collection-field"]);return"url"===c?l().createElement(i.EllipsisWithTooltip,{ellipsis:!0},n):l().createElement(i.EllipsisWithTooltip,{ellipsis:!0},s?l().createElement(i.Upload.ReadPretty,e):null)}),f=(0,o.connect)(function(e){var t,n,u=e.value,m=e.onChange,f=e.toValueItem,b=void 0===f?d:f,v=e.disabled,y=e.underFilter,g=s(e,["value","onChange","toValueItem","disabled","underFilter"]),h=(0,o.useFieldSchema)(),S=p((0,r.useState)(!1),2),P=S[0],O=S[1],C=p((0,r.useState)([]),2),w=C[0],x=C[1],j=(0,a.fR)("Selector"),A=(0,i.useFieldNames)(e),E=(0,o.useField)(),k=p((0,r.useState)(),2),F=k[0],R=k[1],_=(0,(0,i.useCollection_deprecated)().getField)(E.props.name),I=(0,i.useActionContext)().modalProps;(0,r.useEffect)(function(){u&&Object.keys(u).length>0?R(u):R(null)},[u,null==A?void 0:A.label]);var T={size:"small",fieldNames:A,multiple:!1,association:{target:null==_?void 0:_.target},options:F,onChange:null==e?void 0:e.onChange,selectedRows:w,setSelectedRows:x,collectionField:_};return y?l().createElement(i.Input,e):(console.log(_),l().createElement("div",{style:{width:"100%",overflow:"auto"}},l().createElement(i.AssociationField.FileSelector,{toValueItem:b,value:F,quickUpload:(null==(t=h["x-component-props"])?void 0:t.quickUpload)!==!1,selectFile:null!=_&&!!_.target&&(null==_?void 0:_.target)!=="attachments"&&(null==(n=h["x-component-props"])?void 0:n.selectFile)!==!1,action:"".concat((null==_?void 0:_.target)||"attachments",":create"),onSelect:function(e){e.stopPropagation(),e.preventDefault(),j(c),O(!0),x([])},onChange:m,disabled:v}),l().createElement(i.ActionContextProvider,{value:{openMode:"drawer",visible:P,setVisible:O,modalProps:{getContainer:(null==g?void 0:g.getContainer)||(null==I?void 0:I.getContainer)},formValueChanged:!1}},(null==_?void 0:_.target)&&(null==_?void 0:_.target)!=="attachments"&&l().createElement(i.RecordPickerProvider,T,l().createElement(i.CollectionProvider_deprecated,{name:null==_?void 0:_.target,dataSource:"main"},l().createElement(i.FormProvider,null,l().createElement(i.TableSelectorParamsProvider,{params:{}},l().createElement(i.SchemaComponentOptions,{scope:{usePickActionProps:function(){var e=(0,i.useActionContext)().setVisible,t=(0,r.useContext)(i.RecordPickerContext),n=t.selectedRows,o=t.onChange;return{onClick:function(){o(b(null==n?void 0:n[0])||null),e(!1)}}},useTableSelectorProps:function(){var e,t,n=(0,r.useContext)(i.RecordPickerContext),o=n.multiple,l=n.options,c=n.setSelectedRows,a=n.selectedRows,u=void 0===a?[]:a,p=n.onChange,d=(0,i.useTableSelectorProps)(),m=d.onRowSelectionChange,f=d.rowKey,v=void 0===f?"id":f,y=s(d,["onRowSelectionChange","rowKey"]),g=(0,i.useActionContext)().setVisible;return e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},y),t=t={rowKey:v,rowSelection:{type:o?"checkbox":"radio",selectedRowKeys:null==u?void 0:u.filter(function(e){return(null==l?void 0:l[v])!==e[v]}).map(function(e){return e[v]})},onRowSelectionChange:function(e,t){null==c||c(t),null==m||m(e,t),p(b(null==t?void 0:t[0])||null),g(!1)}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}}},l().createElement(o.RecursionField,{onlyRenderProperties:!0,basePath:E.address,schema:h,filterProperties:function(e){return"AssociationField.Selector"===e["x-component"]}})))))))))},(0,o.mapReadPretty)(m))}}]);
10
+ "use strict";(self.webpackChunk_nocobase_plugin_field_attachment_url=self.webpackChunk_nocobase_plugin_field_attachment_url||[]).push([["618"],{835:function(e,t,n){n.r(t),n.d(t,{AttachmentUrl:function(){return f}});var o=n(505),r=n(156),l=n.n(r),i=n(772),c={type:"void","x-component":"AssociationField.Selector",title:'{{ t("Select record") }}',"x-component-props":{className:"nb-record-picker-selector"},properties:{grid:{type:"void","x-component":"Grid","x-initializer":"popup:tableSelector:addBlock",properties:{}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:submit","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}},a=n(253);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function s(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)n=l[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var l=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(l.push(n.value),!t||l.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d=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},m=(0,o.connect)(function(e){var t,n=e.value,r=(0,o.useFieldSchema)(),c=null==r||null==(t=r["x-component-props"])?void 0:t.componentMode,a=(0,i.useCollection_deprecated)().getField,u=(0,i.useCollectionManager_deprecated)().getCollectionJoinField,s=a(r.name)||u(r["x-collection-field"]);return"url"===c?l().createElement(i.EllipsisWithTooltip,{ellipsis:!0},n):l().createElement(i.EllipsisWithTooltip,{ellipsis:!0},s?l().createElement(i.Upload.ReadPretty,e):null)}),f=(0,o.connect)(function(e){var t,n,u=e.value,m=e.onChange,f=e.toValueItem,b=void 0===f?d:f,v=e.disabled,y=e.underFilter,g=s(e,["value","onChange","toValueItem","disabled","underFilter"]),h=(0,o.useFieldSchema)(),S=p((0,r.useState)(!1),2),P=S[0],O=S[1],C=p((0,r.useState)([]),2),w=C[0],x=C[1],j=(0,a.fR)("Selector"),A=(0,i.useFieldNames)(e),E=(0,o.useField)(),k=p((0,r.useState)(),2),F=k[0],R=k[1],_=(0,(0,i.useCollection_deprecated)().getField)(E.props.name),I=(0,i.useActionContext)().modalProps;(0,r.useEffect)(function(){u&&Object.keys(u).length>0?R(u):R(null)},[u,null==A?void 0:A.label]);var T={size:"small",fieldNames:A,multiple:!1,association:{target:null==_?void 0:_.target},options:F,onChange:null==e?void 0:e.onChange,selectedRows:w,setSelectedRows:x,collectionField:_};return y?l().createElement(i.Input,e):l().createElement("div",{style:{width:"100%",overflow:"auto"}},l().createElement(i.AssociationField.FileSelector,{toValueItem:b,value:F,quickUpload:(null==(t=h["x-component-props"])?void 0:t.quickUpload)!==!1,selectFile:null!=_&&!!_.target&&(null==_?void 0:_.target)!=="attachments"&&(null==(n=h["x-component-props"])?void 0:n.selectFile)!==!1,action:"".concat((null==_?void 0:_.target)||"attachments",":create"),onSelect:function(e){e.stopPropagation(),e.preventDefault(),j(c),O(!0),x([])},onChange:m,disabled:v}),l().createElement(i.ActionContextProvider,{value:{openMode:"drawer",visible:P,setVisible:O,modalProps:{getContainer:(null==g?void 0:g.getContainer)||(null==I?void 0:I.getContainer)},formValueChanged:!1}},(null==_?void 0:_.target)&&(null==_?void 0:_.target)!=="attachments"&&l().createElement(i.RecordPickerProvider,T,l().createElement(i.CollectionProvider_deprecated,{name:null==_?void 0:_.target,dataSource:"main"},l().createElement(i.FormProvider,null,l().createElement(i.TableSelectorParamsProvider,{params:{}},l().createElement(i.SchemaComponentOptions,{scope:{usePickActionProps:function(){var e=(0,i.useActionContext)().setVisible,t=(0,r.useContext)(i.RecordPickerContext),n=t.selectedRows,o=t.onChange;return{onClick:function(){o(b(null==n?void 0:n[0])||null),e(!1)}}},useTableSelectorProps:function(){var e,t,n=(0,r.useContext)(i.RecordPickerContext),o=n.multiple,l=n.options,c=n.setSelectedRows,a=n.selectedRows,u=void 0===a?[]:a,p=n.onChange,d=(0,i.useTableSelectorProps)(),m=d.onRowSelectionChange,f=d.rowKey,v=void 0===f?"id":f,y=s(d,["onRowSelectionChange","rowKey"]),g=(0,i.useActionContext)().setVisible;return e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},y),t=t={rowKey:v,rowSelection:{type:o?"checkbox":"radio",selectedRowKeys:null==u?void 0:u.filter(function(e){return(null==l?void 0:l[v])!==e[v]}).map(function(e){return e[v]})},onRowSelectionChange:function(e,t){null==c||c(t),null==m||m(e,t),p(b(null==t?void 0:t[0])||null),g(!1)}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}}},l().createElement(o.RecursionField,{onlyRenderProperties:!0,basePath:E.address,schema:h,filterProperties:function(e){return"AssociationField.Selector"===e["x-component"]}}))))))))},(0,o.mapReadPretty)(m))}}]);
@@ -12,9 +12,6 @@ export declare const useAttachmentTargetProps: () => {
12
12
  service: {
13
13
  resource: string;
14
14
  params: {
15
- filter: {
16
- 'options.template': string;
17
- };
18
15
  paginate: boolean;
19
16
  };
20
17
  };
@@ -23,94 +20,5 @@ export declare const useAttachmentTargetProps: () => {
23
20
  label: string;
24
21
  value: string;
25
22
  };
26
- mapOptions: (value: any) => any;
27
- toOptionsItem: (data: any) => {
28
- toString: () => string;
29
- charAt: (pos: number) => string;
30
- charCodeAt: (index: number) => number;
31
- concat: (...strings: string[]) => string;
32
- indexOf: (searchString: string, position?: number) => number;
33
- lastIndexOf: (searchString: string, position?: number) => number;
34
- localeCompare: {
35
- (that: string): number;
36
- (that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;
37
- };
38
- match: {
39
- (regexp: string | RegExp): RegExpMatchArray;
40
- (matcher: {
41
- [Symbol.match](string: string): RegExpMatchArray;
42
- }): RegExpMatchArray;
43
- };
44
- replace: {
45
- (searchValue: string | RegExp, replaceValue: string): string;
46
- (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
47
- (searchValue: {
48
- [Symbol.replace](string: string, replaceValue: string): string;
49
- }, replaceValue: string): string;
50
- (searchValue: {
51
- [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
52
- }, replacer: (substring: string, ...args: any[]) => string): string;
53
- };
54
- search: {
55
- (regexp: string | RegExp): number;
56
- (searcher: {
57
- [Symbol.search](string: string): number;
58
- }): number;
59
- };
60
- slice: (start?: number, end?: number) => string;
61
- split: {
62
- (separator: string | RegExp, limit?: number): string[];
63
- (splitter: {
64
- [Symbol.split](string: string, limit?: number): string[];
65
- }, limit?: number): string[];
66
- };
67
- substring: (start: number, end?: number) => string;
68
- toLowerCase: () => string;
69
- toLocaleLowerCase: (locales?: string | string[]) => string;
70
- toUpperCase: () => string;
71
- toLocaleUpperCase: (locales?: string | string[]) => string;
72
- trim: () => string;
73
- readonly length: number;
74
- substr: (from: number, length?: number) => string;
75
- valueOf: () => string;
76
- codePointAt: (pos: number) => number;
77
- includes: (searchString: string, position?: number) => boolean;
78
- endsWith: (searchString: string, endPosition?: number) => boolean;
79
- normalize: {
80
- (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
81
- (form?: string): string;
82
- };
83
- repeat: (count: number) => string;
84
- startsWith: (searchString: string, position?: number) => boolean;
85
- anchor: (name: string) => string;
86
- big: () => string;
87
- blink: () => string;
88
- bold: () => string;
89
- fixed: () => string;
90
- fontcolor: (color: string) => string;
91
- fontsize: {
92
- (size: number): string;
93
- (size: string): string;
94
- };
95
- italics: () => string;
96
- link: (url: string) => string;
97
- small: () => string;
98
- strike: () => string;
99
- sub: () => string;
100
- sup: () => string;
101
- padStart: (maxLength: number, fillString?: string) => string;
102
- padEnd: (maxLength: number, fillString?: string) => string;
103
- trimEnd: () => string;
104
- trimStart: () => string;
105
- trimLeft: () => string;
106
- trimRight: () => string;
107
- matchAll: (regexp: RegExp) => IterableIterator<RegExpMatchArray>;
108
- replaceAll: {
109
- (searchValue: string | RegExp, replaceValue: string): string;
110
- (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
111
- };
112
- at: (index: number) => string;
113
- [Symbol.iterator]: () => IterableIterator<string>;
114
- }[];
115
- optionFilter: (option: any) => boolean;
23
+ onSuccess: (data: any) => void;
116
24
  };
@@ -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 s},fR:function(){return p},sz:function(){return f}});var r=n(505),o=n(772),i=n(467),u=n(156),c=n(238);function a(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 l(e,t){return t=null!=t?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}function s(e){var t,n,r,i,u,c=(0,o.useCollectionField)(),s=(n=null!=(t=null==c?void 0:c.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 l(a({},e),{rules:s,action:"".concat(c.target,":create").concat(c.storage?"?attachmentField=".concat(c.collectionName,".").concat(c.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}})}var p=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])},f=function(){var e=(0,c.useTranslation)().t,t=["local","ali-oss","s3","tx-cos"];return{service:{resource:"collections",params:{filter:{"options.template":"file"},paginate:!1}},manual:!1,fieldNames:{label:"title",value:"name"},mapOptions:function(t){return"attachments"===t.name?l(a({},t),{title:e("Attachments")}):t},toOptionsItem:function(t){return t.unshift({name:"attachments",title:e("Attachments")}),(0,i.uniqBy)(t.filter(function(e){return e.name}),"name")},optionFilter:function(e){return!e.storage||t.includes(e.storage)}}}},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"2d58ca769e981d7f.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,default:"attachments",type:"string",title:o("Which file collection should it be uploaded to"),"x-decorator":"FormItem","x-component":"RemoteSelect","x-use-component-props":t.sz},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",{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,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",{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}()});
@@ -26,7 +26,6 @@ export declare class AttachmentURLFieldInterface extends CollectionFieldInterfac
26
26
  properties: {
27
27
  target: {
28
28
  required: boolean;
29
- default: string;
30
29
  type: string;
31
30
  title: string;
32
31
  'x-decorator': string;
@@ -35,9 +34,6 @@ export declare class AttachmentURLFieldInterface extends CollectionFieldInterfac
35
34
  service: {
36
35
  resource: string;
37
36
  params: {
38
- filter: {
39
- 'options.template': string;
40
- };
41
37
  paginate: boolean;
42
38
  };
43
39
  };
@@ -46,97 +42,9 @@ export declare class AttachmentURLFieldInterface extends CollectionFieldInterfac
46
42
  label: string;
47
43
  value: string;
48
44
  };
49
- mapOptions: (value: any) => any;
50
- toOptionsItem: (data: any) => {
51
- toString: () => string;
52
- charAt: (pos: number) => string;
53
- charCodeAt: (index: number) => number;
54
- concat: (...strings: string[]) => string;
55
- indexOf: (searchString: string, position?: number) => number;
56
- lastIndexOf: (searchString: string, position?: number) => number;
57
- localeCompare: {
58
- (that: string): number;
59
- (that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;
60
- };
61
- match: {
62
- (regexp: string | RegExp): RegExpMatchArray;
63
- (matcher: {
64
- [Symbol.match](string: string): RegExpMatchArray;
65
- }): RegExpMatchArray;
66
- };
67
- replace: {
68
- (searchValue: string | RegExp, replaceValue: string): string;
69
- (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
70
- (searchValue: {
71
- [Symbol.replace](string: string, replaceValue: string): string;
72
- }, replaceValue: string): string;
73
- (searchValue: {
74
- [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
75
- }, replacer: (substring: string, ...args: any[]) => string): string;
76
- };
77
- search: {
78
- (regexp: string | RegExp): number;
79
- (searcher: {
80
- [Symbol.search](string: string): number;
81
- }): number;
82
- };
83
- slice: (start?: number, end?: number) => string;
84
- split: {
85
- (separator: string | RegExp, limit?: number): string[];
86
- (splitter: {
87
- [Symbol.split](string: string, limit?: number): string[];
88
- }, limit?: number): string[];
89
- };
90
- substring: (start: number, end?: number) => string;
91
- toLowerCase: () => string;
92
- toLocaleLowerCase: (locales?: string | string[]) => string;
93
- toUpperCase: () => string;
94
- toLocaleUpperCase: (locales?: string | string[]) => string;
95
- trim: () => string;
96
- readonly length: number;
97
- substr: (from: number, length?: number) => string;
98
- valueOf: () => string;
99
- codePointAt: (pos: number) => number;
100
- includes: (searchString: string, position?: number) => boolean;
101
- endsWith: (searchString: string, endPosition?: number) => boolean;
102
- normalize: {
103
- (form: "NFC" | "NFD" | "NFKC" | "NFKD"): string;
104
- (form?: string): string;
105
- };
106
- repeat: (count: number) => string;
107
- startsWith: (searchString: string, position?: number) => boolean;
108
- anchor: (name: string) => string;
109
- big: () => string;
110
- blink: () => string;
111
- bold: () => string;
112
- fixed: () => string;
113
- fontcolor: (color: string) => string;
114
- fontsize: {
115
- (size: number): string;
116
- (size: string): string;
117
- };
118
- italics: () => string;
119
- link: (url: string) => string;
120
- small: () => string;
121
- strike: () => string;
122
- sub: () => string;
123
- sup: () => string;
124
- padStart: (maxLength: number, fillString?: string) => string;
125
- padEnd: (maxLength: number, fillString?: string) => string;
126
- trimEnd: () => string;
127
- trimStart: () => string;
128
- trimLeft: () => string;
129
- trimRight: () => string;
130
- matchAll: (regexp: RegExp) => IterableIterator<RegExpMatchArray>;
131
- replaceAll: {
132
- (searchValue: string | RegExp, replaceValue: string): string;
133
- (searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
134
- };
135
- at: (index: number) => string;
136
- [Symbol.iterator]: () => IterableIterator<string>;
137
- }[];
138
- optionFilter: (option: any) => boolean;
45
+ onSuccess: (data: any) => void;
139
46
  };
47
+ 'x-reactions': (field: any) => void;
140
48
  };
141
49
  targetKey: {
142
50
  'x-hidden': boolean;
@@ -8,10 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.21",
11
+ "@nocobase/client": "1.7.0-alpha.11",
12
12
  "react-i18next": "11.18.6",
13
- "@nocobase/server": "1.6.21",
14
- "@nocobase/test": "1.6.21",
13
+ "@nocobase/server": "1.7.0-alpha.11",
14
+ "@nocobase/plugin-file-manager": "1.7.0-alpha.11",
15
+ "@nocobase/test": "1.7.0-alpha.11",
15
16
  "@formily/react": "2.3.0",
16
17
  "react": "18.2.0",
17
18
  "lodash": "4.17.21",
@@ -37,6 +37,35 @@ class PluginFieldAttachmentUrlServer extends import_server.Plugin {
37
37
  async beforeLoad() {
38
38
  }
39
39
  async load() {
40
+ this.app.resourceManager.registerActionHandlers({
41
+ "collections:listFileCollectionsWithPublicStorage": async (ctx, next) => {
42
+ var _a, _b;
43
+ const fileCollections = await this.db.getRepository("collections").find({
44
+ filter: {
45
+ "options.template": "file"
46
+ }
47
+ });
48
+ const filePlugin = this.pm.get("file-manager");
49
+ const options = [];
50
+ const fileCollection = this.db.getCollection("attachments");
51
+ if (await filePlugin.isPublicAccessStorage((_a = fileCollection == null ? void 0 : fileCollection.options) == null ? void 0 : _a.storage)) {
52
+ options.push({
53
+ title: '{{t("Attachments")}}',
54
+ name: "attachments"
55
+ });
56
+ }
57
+ for (const fileCollection2 of fileCollections) {
58
+ if (await filePlugin.isPublicAccessStorage((_b = fileCollection2 == null ? void 0 : fileCollection2.options) == null ? void 0 : _b.storage)) {
59
+ options.push({
60
+ name: fileCollection2.name,
61
+ title: fileCollection2.title
62
+ });
63
+ }
64
+ }
65
+ ctx.body = options;
66
+ await next();
67
+ }
68
+ });
40
69
  }
41
70
  async install() {
42
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-attachment-url",
3
- "version": "1.6.21",
3
+ "version": "1.7.0-alpha.11",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Collection field: Attachment(URL)",
6
6
  "displayName.zh-CN": "数据表字段:附件(URL)",
@@ -8,14 +8,12 @@
8
8
  "description.zh-CN": "支持 URL 格式的附件。",
9
9
  "peerDependencies": {
10
10
  "@nocobase/client": "1.x",
11
+ "@nocobase/plugin-file-manager": "1.x",
11
12
  "@nocobase/server": "1.x",
12
13
  "@nocobase/test": "1.x"
13
14
  },
14
- "devDependencies": {
15
- "@nocobase/plugin-file-manager": "1.6.21"
16
- },
17
15
  "keywords": [
18
16
  "Collection fields"
19
17
  ],
20
- "gitHead": "2538df7c081e1bb558acead3f0cd87b6a7f02c78"
18
+ "gitHead": "41830f1b20f8f5f7aae0699042a10135f1f8cf30"
21
19
  }