@panneau/medias 4.0.50 → 4.0.55

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +23 -37
  2. package/dist/index.js +878 -437
  3. package/package.json +17 -17
package/dist/index.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import * as _panneau_core from '@panneau/core';
4
- import { Media, Resource } from '@panneau/core';
4
+ import { Media, Field, MediaType, Filter, Column, Resource } from '@panneau/core';
5
5
  import * as _panneau_data from '@panneau/data';
6
6
  import { UseItemsResponse } from '@panneau/data';
7
7
  import * as _tanstack_query_core from '@tanstack/query-core';
8
8
 
9
- type MediaFormField = Record<string, unknown>;
10
9
  interface MediaFormProps {
11
10
  value?: Media | null;
12
- fields?: MediaFormField[] | null;
11
+ fields?: Field[] | null;
13
12
  onChange?: ((newValue: Media | null) => void) | null;
14
13
  onSave?: ((newValue: Media | null) => void) | null;
15
14
  onReplace?: ((newValue: unknown) => void) | null;
@@ -23,20 +22,6 @@ interface MediaFormProps {
23
22
  }
24
23
  declare function MediaForm({ value: initialValue, fields: initialFields, onChange, onSave, onReplace, onDelete, onClose, withDelete, withTrash, withReplace, className, children, }: MediaFormProps): react_jsx_runtime.JSX.Element;
25
24
 
26
- type FilterItem = Record<string, unknown> & {
27
- id?: string | null;
28
- };
29
- type ColumnAction = string | {
30
- id?: string;
31
- component?: string;
32
- withConfirmation?: boolean;
33
- action?: (ids: Array<string | number>) => Promise<unknown> | unknown;
34
- [key: string]: unknown;
35
- };
36
- type ColumnItem = Record<string, unknown> & {
37
- id?: string | null;
38
- actions?: ColumnAction[];
39
- };
40
25
  interface LayoutItem {
41
26
  id: string;
42
27
  label: ReactNode;
@@ -45,17 +30,17 @@ interface LayoutItem {
45
30
  interface MediasBrowserProps {
46
31
  items?: Media[] | null;
47
32
  extraItems?: Media[] | null;
48
- types?: string[] | null;
33
+ types?: MediaType[] | null;
49
34
  permissions?: {
50
35
  create?: boolean;
51
36
  edit?: boolean;
52
37
  delete?: boolean;
53
38
  } | null;
54
- filters?: FilterItem[] | null;
55
- columns?: ColumnItem[] | null;
39
+ filters?: Filter[] | null;
40
+ columns?: Column[] | null;
56
41
  query?: Record<string, unknown> | null;
57
42
  baseUrl?: string | null;
58
- fields?: Array<Record<string, unknown>> | null;
43
+ fields?: Field[] | null;
59
44
  layout?: string;
60
45
  layouts?: LayoutItem[] | null;
61
46
  theme?: string | null;
@@ -75,19 +60,18 @@ interface MediasBrowserProps {
75
60
  withStickySelection?: boolean;
76
61
  withoutUpload?: boolean;
77
62
  className?: string | null;
63
+ filtersClassName?: string | null;
78
64
  formChildren?: ReactNode | null;
79
65
  }
80
- declare function MediasBrowser({ items: initialItems, extraItems, types, permissions, baseUrl, filters, columns, fields, query: initialQuery, layout: initialLayout, layouts, theme, onMediaUploaded, onItemsChange, onLayoutChange, onMediaFormOpen, onMediaFormClose, selectable, selectedItems, onSelectionChange, multipleSelection, uppyConfig, withDelete, withTrash, withReplace, withStickySelection, withoutUpload, className, formChildren, }: MediasBrowserProps): react_jsx_runtime.JSX.Element;
66
+ declare function MediasBrowser({ items: initialItems, extraItems, types, permissions, baseUrl, filters, columns, fields, query: initialQuery, layout: initialLayout, layouts, theme, onMediaUploaded, onItemsChange, onLayoutChange, onMediaFormOpen, onMediaFormClose, selectable, selectedItems, onSelectionChange, multipleSelection, uppyConfig, withDelete, withTrash, withReplace, withStickySelection, withoutUpload, className, filtersClassName, formChildren, }: MediasBrowserProps): react_jsx_runtime.JSX.Element;
81
67
 
82
- interface MediasPickerProps {
68
+ interface MediasPickerProps extends MediasBrowserProps {
83
69
  items?: Media[] | null;
84
70
  value?: Media[] | null;
85
71
  onChange?: ((selection: Media[] | null) => void) | null;
86
72
  multiple?: boolean;
87
- className?: string | null;
88
- [key: string]: unknown;
89
73
  }
90
- declare function MediasPicker({ items: initialItems, value: initialSelectedItems, onChange, multiple, className, ...props }: MediasPickerProps): react_jsx_runtime.JSX.Element;
74
+ declare function MediasPicker({ items: initialItems, value: initialSelectedItems, onChange, multiple, ...props }: MediasPickerProps): react_jsx_runtime.JSX.Element;
91
75
 
92
76
  interface MediasApi {
93
77
  get: (query?: Record<string, unknown>, page?: number | null, count?: number | null) => Promise<UseItemsResponse<Media>>;
@@ -106,20 +90,17 @@ interface MediasApiProviderProps {
106
90
  declare function useMediasApi(): MediasApi;
107
91
  declare function MediasApiProvider({ api: providedApi, children }: MediasApiProviderProps): react_jsx_runtime.JSX.Element;
108
92
 
109
- interface MediasBrowserContainerProps {
93
+ interface MediasBrowserContainerProps extends MediasBrowserProps {
110
94
  api?: MediasApi | null;
111
95
  media?: Media | null;
112
- [key: string]: unknown;
113
96
  }
114
97
  declare function MediasBrowserContainer({ api, media, ...props }: MediasBrowserContainerProps): react_jsx_runtime.JSX.Element;
115
98
 
116
- interface MediasPickerContainerProps {
99
+ interface MediasPickerContainerProps extends MediasPickerProps {
117
100
  api?: MediasApi | null;
118
101
  media?: Media | null;
119
- onChange?: ((...args: unknown[]) => void) | null;
120
- [key: string]: unknown;
121
102
  }
122
- declare function MediasPickerContainer({ api, media, onChange, ...props }: MediasPickerContainerProps): react_jsx_runtime.JSX.Element;
103
+ declare function MediasPickerContainer({ api, media, ...props }: MediasPickerContainerProps): react_jsx_runtime.JSX.Element;
123
104
 
124
105
  interface MediaContextValue {
125
106
  currentMedia: Media | null;
@@ -138,6 +119,7 @@ interface UseMediasOpts {
138
119
  }
139
120
  declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMediasOpts): {
140
121
  allItems: _panneau_core.Media[];
122
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
141
123
  pagination: {
142
124
  page: number;
143
125
  lastPage: number;
@@ -176,6 +158,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
176
158
  items: _panneau_core.Media[];
177
159
  } | {
178
160
  allItems: _panneau_core.Media[];
161
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
179
162
  pagination: {
180
163
  page: number;
181
164
  lastPage: number;
@@ -214,6 +197,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
214
197
  items: _panneau_core.Media[];
215
198
  } | {
216
199
  allItems: _panneau_core.Media[];
200
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
217
201
  pagination: {
218
202
  page: number;
219
203
  lastPage: number;
@@ -252,6 +236,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
252
236
  items: _panneau_core.Media[];
253
237
  } | {
254
238
  allItems: _panneau_core.Media[];
239
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
255
240
  pagination: {
256
241
  page: number;
257
242
  lastPage: number;
@@ -290,6 +275,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
290
275
  items: _panneau_core.Media[];
291
276
  } | {
292
277
  allItems: _panneau_core.Media[];
278
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
293
279
  pagination: {
294
280
  page: number;
295
281
  lastPage: number;
@@ -328,6 +314,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
328
314
  items: _panneau_core.Media[];
329
315
  } | {
330
316
  allItems: _panneau_core.Media[];
317
+ pages: Record<string, _panneau_data.UseItemsResponse<_panneau_core.Media>>;
331
318
  pagination: {
332
319
  page: number;
333
320
  lastPage: number;
@@ -566,17 +553,16 @@ declare const _default: ({
566
553
  width?: undefined;
567
554
  })[];
568
555
 
569
- interface MediasResourceBrowserProps {
570
- resource?: string | null;
571
- [key: string]: unknown;
556
+ interface MediasResourceBrowserProps extends MediasBrowserContainerProps {
557
+ resource?: Resource | string | null;
572
558
  }
573
559
  declare function MediasResourceBrowser({ resource: resourceId, ...props }: MediasResourceBrowserProps): react_jsx_runtime.JSX.Element;
574
560
 
575
- interface MediasResourcePickerProps {
561
+ interface MediasResourcePickerProps extends MediasPickerContainerProps {
576
562
  resource?: Resource | string | null;
577
563
  [key: string]: unknown;
578
564
  }
579
565
  declare function MediasResourcePicker({ resource: resourceId, ...props }: MediasResourcePickerProps): react_jsx_runtime.JSX.Element;
580
566
 
581
567
  export { MediaForm, MediaProvider, MediasApiProvider, MediasBrowser, MediasBrowserContainer, MediasPicker, MediasPickerContainer, MediasResourceBrowser, MediasResourcePicker, _default$2 as columns, _default$1 as fields, _default as filters, useCurrentMedia, useMedia, useMediaCreate, useMediaDelete, useMediaReplace, useMediaRestore, useMediaTrash, useMediaUpdate, useMedias, useMediasApi };
582
- export type { MediaContextValue, MediasApi };
568
+ export type { MediaContextValue, MediasApi, MediasBrowserContainerProps, MediasBrowserProps, MediasPickerContainerProps, MediasPickerProps };