@webiny/app-admin 5.35.2 → 5.36.0-beta.0
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/base/ui/FileManager.d.ts +1 -1
- package/base/ui/FileManager.js.map +1 -1
- package/package.json +15 -15
- package/types.d.ts +2 -0
- package/types.js.map +1 -1
package/base/ui/FileManager.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare type FileManagerProps = {
|
|
|
50
50
|
* @deprecated This prop is no longer used. The file structure was reduced to a bare minimum so picking is no longer necessary.
|
|
51
51
|
*/
|
|
52
52
|
onChangePick?: string[];
|
|
53
|
-
onClose?:
|
|
53
|
+
onClose?: () => void;
|
|
54
54
|
onUploadCompletion?: (files: FileManagerFileItem[]) => void;
|
|
55
55
|
own?: boolean;
|
|
56
56
|
scope?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getPortalTarget","target","window","document","getElementById","createElement","setAttribute","body","appendChild","FileManagerRenderer","makeComposable","FileManager","children","render","onChange","rest","containerRef","useRef","useState","show","setShow","onChangeRef","useEffect","current","showFileManager","useCallback","ReactDOM","createPortal"],"sources":["FileManager.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { makeComposable } from \"@webiny/react-composition\";\n\nexport interface FileManagerOnChange<T> {\n (value: T): void;\n}\n\n/**\n * Represents a file object managed by the File Manager.\n */\nexport interface FileManagerFileItem {\n id: string;\n src: string;\n meta?: Array<FileManagerFileItemMetaItem>;\n}\n\n/**\n * With this we allow developers to add any value to file's meta via component composition, thus the `value: any`.\n */\nexport interface FileManagerFileItemMetaItem {\n key: string;\n value: any;\n}\n\nexport type DeprecatedFileManagerRenderPropParams = {\n showFileManager: (\n onChange?: FileManagerOnChange<FileManagerFileItem | FileManagerFileItem[]>\n ) => void;\n};\n\nexport type FileManagerRenderPropParams<TValue> = {\n showFileManager: (onChange?: FileManagerOnChange<TValue>) => void;\n};\n\ninterface SingleFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem>): React.ReactNode;\n}\n\ninterface MultiFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem[]>): React.ReactNode;\n}\n\nexport type MultipleProps =\n | {\n multiple?: never;\n multipleMaxCount?: never;\n multipleMaxSize?: never;\n onChange?: FileManagerOnChange<FileManagerFileItem>;\n render?: SingleFileRenderProp;\n }\n | {\n multiple: true;\n multipleMaxCount?: number;\n multipleMaxSize?: number | string;\n onChange?: FileManagerOnChange<FileManagerFileItem[]>;\n render?: MultiFileRenderProp;\n };\n\nexport type FileManagerProps = {\n accept?: Array<string>;\n images?: boolean;\n maxSize?: number | string;\n /**\n * @deprecated This prop is no longer used. The file structure was reduced to a bare minimum so picking is no longer necessary.\n */\n onChangePick?: string[];\n onClose?:
|
|
1
|
+
{"version":3,"names":["getPortalTarget","target","window","document","getElementById","createElement","setAttribute","body","appendChild","FileManagerRenderer","makeComposable","FileManager","children","render","onChange","rest","containerRef","useRef","useState","show","setShow","onChangeRef","useEffect","current","showFileManager","useCallback","ReactDOM","createPortal"],"sources":["FileManager.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { makeComposable } from \"@webiny/react-composition\";\n\nexport interface FileManagerOnChange<T> {\n (value: T): void;\n}\n\n/**\n * Represents a file object managed by the File Manager.\n */\nexport interface FileManagerFileItem {\n id: string;\n src: string;\n meta?: Array<FileManagerFileItemMetaItem>;\n}\n\n/**\n * With this we allow developers to add any value to file's meta via component composition, thus the `value: any`.\n */\nexport interface FileManagerFileItemMetaItem {\n key: string;\n value: any;\n}\n\nexport type DeprecatedFileManagerRenderPropParams = {\n showFileManager: (\n onChange?: FileManagerOnChange<FileManagerFileItem | FileManagerFileItem[]>\n ) => void;\n};\n\nexport type FileManagerRenderPropParams<TValue> = {\n showFileManager: (onChange?: FileManagerOnChange<TValue>) => void;\n};\n\ninterface SingleFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem>): React.ReactNode;\n}\n\ninterface MultiFileRenderProp {\n (params: FileManagerRenderPropParams<FileManagerFileItem[]>): React.ReactNode;\n}\n\nexport type MultipleProps =\n | {\n multiple?: never;\n multipleMaxCount?: never;\n multipleMaxSize?: never;\n onChange?: FileManagerOnChange<FileManagerFileItem>;\n render?: SingleFileRenderProp;\n }\n | {\n multiple: true;\n multipleMaxCount?: number;\n multipleMaxSize?: number | string;\n onChange?: FileManagerOnChange<FileManagerFileItem[]>;\n render?: MultiFileRenderProp;\n };\n\nexport type FileManagerProps = {\n accept?: Array<string>;\n images?: boolean;\n maxSize?: number | string;\n /**\n * @deprecated This prop is no longer used. The file structure was reduced to a bare minimum so picking is no longer necessary.\n */\n onChangePick?: string[];\n onClose?: () => void;\n onUploadCompletion?: (files: FileManagerFileItem[]) => void;\n own?: boolean;\n scope?: string;\n tags?: Array<string>;\n /**\n * @deprecated This prop is no longer used. Use the `render` prop to get better TS autocomplete.\n */\n children?: (params: DeprecatedFileManagerRenderPropParams) => React.ReactNode;\n} & MultipleProps;\n\nfunction getPortalTarget() {\n let target = window.document.getElementById(\"file-manager-container\");\n if (!target) {\n target = document.createElement(\"div\");\n target.setAttribute(\"id\", \"file-manager-container\");\n document.body && document.body.appendChild(target);\n }\n return target;\n}\n\n// This jewel was taken from https://davidgomes.com/pick-omit-over-union-types-in-typescript/. Massive thanks, David!\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;\n\nexport type FileManagerRendererProps = DistributiveOmit<FileManagerProps, \"render\" | \"children\">;\n\nexport const FileManagerRenderer = makeComposable<FileManagerRendererProps>(\"FileManagerRenderer\");\n\nexport const FileManager: React.FC<FileManagerProps> = ({\n children,\n render,\n onChange,\n ...rest\n}) => {\n const containerRef = useRef<HTMLElement>(getPortalTarget());\n const [show, setShow] = useState(false);\n const onChangeRef = useRef(onChange);\n\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n const showFileManager = useCallback(onChange => {\n if (typeof onChange === \"function\") {\n onChangeRef.current = onChange;\n }\n setShow(true);\n }, []);\n\n return (\n <>\n {show &&\n ReactDOM.createPortal(\n <FileManagerRenderer\n onClose={() => setShow(false)}\n onChange={\n /* TODO: figure out how to create a conditional type based on the value of `rest.multiple` */\n onChangeRef.current as any\n }\n {...rest}\n />,\n containerRef.current\n )}\n {children ? children({ showFileManager }) : render ? render({ showFileManager }) : null}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AAA2D;AA4E3D,SAASA,eAAe,GAAG;EACvB,IAAIC,MAAM,GAAGC,MAAM,CAACC,QAAQ,CAACC,cAAc,CAAC,wBAAwB,CAAC;EACrE,IAAI,CAACH,MAAM,EAAE;IACTA,MAAM,GAAGE,QAAQ,CAACE,aAAa,CAAC,KAAK,CAAC;IACtCJ,MAAM,CAACK,YAAY,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACnDH,QAAQ,CAACI,IAAI,IAAIJ,QAAQ,CAACI,IAAI,CAACC,WAAW,CAACP,MAAM,CAAC;EACtD;EACA,OAAOA,MAAM;AACjB;;AAEA;;AAKO,IAAMQ,mBAAmB,GAAG,IAAAC,gCAAc,EAA2B,qBAAqB,CAAC;AAAC;AAE5F,IAAMC,WAAuC,GAAG,SAA1CA,WAAuC,OAK9C;EAAA,IAJFC,QAAQ,QAARA,QAAQ;IACRC,MAAM,QAANA,MAAM;IACNC,QAAQ,QAARA,QAAQ;IACLC,IAAI;EAEP,IAAMC,YAAY,GAAG,IAAAC,aAAM,EAAcjB,eAAe,EAAE,CAAC;EAC3D,gBAAwB,IAAAkB,eAAQ,EAAC,KAAK,CAAC;IAAA;IAAhCC,IAAI;IAAEC,OAAO;EACpB,IAAMC,WAAW,GAAG,IAAAJ,aAAM,EAACH,QAAQ,CAAC;EAEpC,IAAAQ,gBAAS,EAAC,YAAM;IACZD,WAAW,CAACE,OAAO,GAAGT,QAAQ;EAClC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,IAAMU,eAAe,GAAG,IAAAC,kBAAW,EAAC,UAAAX,QAAQ,EAAI;IAC5C,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAAE;MAChCO,WAAW,CAACE,OAAO,GAAGT,QAAQ;IAClC;IACAM,OAAO,CAAC,IAAI,CAAC;EACjB,CAAC,EAAE,EAAE,CAAC;EAEN,oBACI,4DACKD,IAAI,iBACDO,iBAAQ,CAACC,YAAY,eACjB,6BAAC,mBAAmB;IAChB,OAAO,EAAE;MAAA,OAAMP,OAAO,CAAC,KAAK,CAAC;IAAA,CAAC;IAC9B,QAAQ,EACJ;IACAC,WAAW,CAACE;EACf,GACGR,IAAI,EACV,EACFC,YAAY,CAACO,OAAO,CACvB,EACJX,QAAQ,GAAGA,QAAQ,CAAC;IAAEY,eAAe,EAAfA;EAAgB,CAAC,CAAC,GAAGX,MAAM,GAAGA,MAAM,CAAC;IAAEW,eAAe,EAAfA;EAAgB,CAAC,CAAC,GAAG,IAAI,CACxF;AAEX,CAAC;AAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-admin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.36.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "A collection of plugins that together form a complete admin interface, customizable and extensible with Webiny apps and plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"@svgr/webpack": "6.5.1",
|
|
21
21
|
"@types/mime": "2.0.3",
|
|
22
22
|
"@types/react": "17.0.39",
|
|
23
|
-
"@webiny/app": "
|
|
24
|
-
"@webiny/app-security": "
|
|
25
|
-
"@webiny/app-wcp": "
|
|
26
|
-
"@webiny/form": "
|
|
27
|
-
"@webiny/plugins": "
|
|
28
|
-
"@webiny/react-composition": "
|
|
29
|
-
"@webiny/react-router": "
|
|
30
|
-
"@webiny/telemetry": "
|
|
31
|
-
"@webiny/ui": "
|
|
32
|
-
"@webiny/ui-composer": "
|
|
33
|
-
"@webiny/validation": "
|
|
23
|
+
"@webiny/app": "5.36.0-beta.0",
|
|
24
|
+
"@webiny/app-security": "5.36.0-beta.0",
|
|
25
|
+
"@webiny/app-wcp": "5.36.0-beta.0",
|
|
26
|
+
"@webiny/form": "5.36.0-beta.0",
|
|
27
|
+
"@webiny/plugins": "5.36.0-beta.0",
|
|
28
|
+
"@webiny/react-composition": "5.36.0-beta.0",
|
|
29
|
+
"@webiny/react-router": "5.36.0-beta.0",
|
|
30
|
+
"@webiny/telemetry": "5.36.0-beta.0",
|
|
31
|
+
"@webiny/ui": "5.36.0-beta.0",
|
|
32
|
+
"@webiny/ui-composer": "5.36.0-beta.0",
|
|
33
|
+
"@webiny/validation": "5.36.0-beta.0",
|
|
34
34
|
"apollo-cache": "1.3.5",
|
|
35
35
|
"apollo-client": "2.6.10",
|
|
36
36
|
"apollo-link": "1.2.14",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@types/bytes": "3.1.1",
|
|
61
61
|
"@types/graphlib": "2.1.8",
|
|
62
62
|
"@types/store": "2.0.2",
|
|
63
|
-
"@webiny/cli": "
|
|
64
|
-
"@webiny/project-utils": "
|
|
63
|
+
"@webiny/cli": "5.36.0-beta.0",
|
|
64
|
+
"@webiny/project-utils": "5.36.0-beta.0",
|
|
65
65
|
"babel-plugin-emotion": "9.2.11",
|
|
66
66
|
"babel-plugin-lodash": "3.3.4",
|
|
67
67
|
"rimraf": "3.0.2",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "c59b9cc5b96b7fd91388de93c7fff2d977d25220"
|
|
92
92
|
}
|
package/types.d.ts
CHANGED
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { ItemProps, MenuProps, SectionProps } from \"~/plugins/MenuPlugin\";\n\nexport type AdminGlobalSearchPlugin = Plugin & {\n type: \"admin-global-search\";\n label: string;\n route: string;\n search?: {\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n };\n};\n\nexport type AdminGlobalSearchPreventHotkeyPlugin = Plugin & {\n type: \"admin-global-search-prevent-hotkey\";\n preventOpen(e: React.KeyboardEvent): boolean | void;\n};\n\n/**\n * LEGACY TYPE. Only for backwards compatibility.\n */\nexport type AdminMenuLogoPlugin = Plugin & {\n name: \"admin-menu-logo\";\n type: \"admin-menu-logo\";\n render(): React.ReactElement;\n};\n\n/**\n * Enables adding custom menu sections and items in the main menu, located on the left side of the screen.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-menu\n */\nexport type AdminMenuPlugin = Plugin & {\n type: \"admin-menu\";\n render(props: {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n }): React.ReactNode;\n order?: number;\n};\n\nexport interface AdminFileManagerFileTypePluginRenderParams {\n file: FileItem;\n}\nexport type AdminFileManagerFileTypePlugin = Plugin & {\n type: \"admin-file-manager-file-type\";\n types: string[];\n render(params: AdminFileManagerFileTypePluginRenderParams): React.ReactNode;\n fileDetails?: {\n actions: Array<React.FC | React.Component>;\n };\n};\n\nexport interface AdminInstallationPluginRenderParams {\n onInstalled: () => Promise<void>;\n}\nexport type AdminInstallationPlugin = Plugin & {\n type: \"admin-installation\";\n getInstalledVersion(params: { client: ApolloClient<object> }): Promise<string | null>;\n title: string;\n dependencies?: string[];\n secure: boolean;\n render(params: AdminInstallationPluginRenderParams): React.ReactNode;\n};\n\nexport type AdminAppPermissionRendererPlugin = Plugin & {\n type: \"admin-app-permissions-renderer\";\n system?: boolean;\n render(params: any): ReactElement;\n};\n\nimport { SecurityPermission } from \"@webiny/app-security/types\";\n\n/**\n * Represents a file as we receive from the GraphQL API.\n */\nexport interface FileItem {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n aliases: string[];\n createdOn: string;\n createdBy: {\n id: string;\n };\n}\n\nexport interface FileManagerSecurityPermission extends SecurityPermission {\n rwd?: string;\n own?: boolean;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { ItemProps, MenuProps, SectionProps } from \"~/plugins/MenuPlugin\";\n\nexport type AdminGlobalSearchPlugin = Plugin & {\n type: \"admin-global-search\";\n label: string;\n route: string;\n search?: {\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n };\n};\n\nexport type AdminGlobalSearchPreventHotkeyPlugin = Plugin & {\n type: \"admin-global-search-prevent-hotkey\";\n preventOpen(e: React.KeyboardEvent): boolean | void;\n};\n\n/**\n * LEGACY TYPE. Only for backwards compatibility.\n */\nexport type AdminMenuLogoPlugin = Plugin & {\n name: \"admin-menu-logo\";\n type: \"admin-menu-logo\";\n render(): React.ReactElement;\n};\n\n/**\n * Enables adding custom menu sections and items in the main menu, located on the left side of the screen.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-menu\n */\nexport type AdminMenuPlugin = Plugin & {\n type: \"admin-menu\";\n render(props: {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n }): React.ReactNode;\n order?: number;\n};\n\nexport interface AdminFileManagerFileTypePluginRenderParams {\n file: FileItem;\n}\nexport type AdminFileManagerFileTypePlugin = Plugin & {\n type: \"admin-file-manager-file-type\";\n types: string[];\n render(params: AdminFileManagerFileTypePluginRenderParams): React.ReactNode;\n fileDetails?: {\n actions: Array<React.FC | React.Component>;\n };\n};\n\nexport interface AdminInstallationPluginRenderParams {\n onInstalled: () => Promise<void>;\n}\nexport type AdminInstallationPlugin = Plugin & {\n type: \"admin-installation\";\n getInstalledVersion(params: { client: ApolloClient<object> }): Promise<string | null>;\n title: string;\n dependencies?: string[];\n secure: boolean;\n render(params: AdminInstallationPluginRenderParams): React.ReactNode;\n};\n\nexport type AdminAppPermissionRendererPlugin = Plugin & {\n type: \"admin-app-permissions-renderer\";\n system?: boolean;\n render(params: any): ReactElement;\n};\n\nimport { SecurityPermission } from \"@webiny/app-security/types\";\n\n/**\n * Represents a file as we receive from the GraphQL API.\n */\nexport interface FileItem {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n aliases: string[];\n createdOn: string;\n createdBy: {\n id: string;\n displayName: string;\n };\n meta?: Record<string, any>;\n}\n\nexport interface FileManagerSecurityPermission extends SecurityPermission {\n rwd?: string;\n own?: boolean;\n}\n"],"mappings":""}
|