@panneau/medias 4.0.42 → 4.0.46

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/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ 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
4
  import { Media, Resource } from '@panneau/core';
5
+ import * as _panneau_data from '@panneau/data';
6
+ import { UseItemsResponse } from '@panneau/data';
5
7
  import * as _tanstack_query_core from '@tanstack/query-core';
6
8
 
7
9
  type MediaFormField = Record<string, unknown>;
@@ -88,8 +90,8 @@ interface MediasPickerProps {
88
90
  declare function MediasPicker({ items: initialItems, value: initialSelectedItems, onChange, multiple, className, ...props }: MediasPickerProps): react_jsx_runtime.JSX.Element;
89
91
 
90
92
  interface MediasApi {
91
- get: (query?: Record<string, unknown>, page?: number | null, count?: number | null) => Promise<unknown>;
92
- getTrashed: (query?: Record<string, unknown>, page?: number | null, count?: number | null) => Promise<unknown>;
93
+ get: (query?: Record<string, unknown>, page?: number | null, count?: number | null) => Promise<UseItemsResponse<Media>>;
94
+ getTrashed: (query?: Record<string, unknown>, page?: number | null, count?: number | null) => Promise<UseItemsResponse<Media>>;
93
95
  create: (data: Partial<Media>) => Promise<Media>;
94
96
  find: (id: string) => Promise<Media>;
95
97
  update: (id: string, data: Partial<Media>) => Promise<Media>;
@@ -135,7 +137,7 @@ interface UseMediasOpts {
135
137
  [key: string]: unknown;
136
138
  }
137
139
  declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMediasOpts): {
138
- allItems: _panneau_core.Item[];
140
+ allItems: _panneau_core.Media[];
139
141
  pagination: {
140
142
  page: number;
141
143
  lastPage: number;
@@ -144,12 +146,8 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
144
146
  loading: boolean;
145
147
  loaded: boolean;
146
148
  reload: () => void;
147
- updateItem: (item: _panneau_core.Item) => void;
148
- data: {
149
- data: _panneau_core.Item[];
150
- pagination: _panneau_core.Pagination;
151
- meta?: _panneau_core.Pagination;
152
- } | _panneau_core.Item[];
149
+ updateItem: (item: _panneau_core.Media) => void;
150
+ data: _panneau_data.UseItemsResponse<_panneau_core.Media>;
153
151
  error: Error;
154
152
  isError: true;
155
153
  isPending: false;
@@ -172,20 +170,12 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
172
170
  isRefetching: boolean;
173
171
  isStale: boolean;
174
172
  isEnabled: boolean;
175
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
176
- data: _panneau_core.Item[];
177
- pagination: _panneau_core.Pagination;
178
- meta?: _panneau_core.Pagination;
179
- } | _panneau_core.Item[], Error>>;
173
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_panneau_data.UseItemsResponse<_panneau_core.Media>, Error>>;
180
174
  fetchStatus: _tanstack_query_core.FetchStatus;
181
- promise: Promise<{
182
- data: _panneau_core.Item[];
183
- pagination: _panneau_core.Pagination;
184
- meta?: _panneau_core.Pagination;
185
- } | _panneau_core.Item[]>;
186
- items: _panneau_core.Item[];
175
+ promise: Promise<_panneau_data.UseItemsResponse<_panneau_core.Media>>;
176
+ items: _panneau_core.Media[];
187
177
  } | {
188
- allItems: _panneau_core.Item[];
178
+ allItems: _panneau_core.Media[];
189
179
  pagination: {
190
180
  page: number;
191
181
  lastPage: number;
@@ -194,12 +184,8 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
194
184
  loading: boolean;
195
185
  loaded: boolean;
196
186
  reload: () => void;
197
- updateItem: (item: _panneau_core.Item) => void;
198
- data: {
199
- data: _panneau_core.Item[];
200
- pagination: _panneau_core.Pagination;
201
- meta?: _panneau_core.Pagination;
202
- } | _panneau_core.Item[];
187
+ updateItem: (item: _panneau_core.Media) => void;
188
+ data: _panneau_data.UseItemsResponse<_panneau_core.Media>;
203
189
  error: null;
204
190
  isError: false;
205
191
  isPending: false;
@@ -222,20 +208,12 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
222
208
  isRefetching: boolean;
223
209
  isStale: boolean;
224
210
  isEnabled: boolean;
225
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
226
- data: _panneau_core.Item[];
227
- pagination: _panneau_core.Pagination;
228
- meta?: _panneau_core.Pagination;
229
- } | _panneau_core.Item[], Error>>;
211
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_panneau_data.UseItemsResponse<_panneau_core.Media>, Error>>;
230
212
  fetchStatus: _tanstack_query_core.FetchStatus;
231
- promise: Promise<{
232
- data: _panneau_core.Item[];
233
- pagination: _panneau_core.Pagination;
234
- meta?: _panneau_core.Pagination;
235
- } | _panneau_core.Item[]>;
236
- items: _panneau_core.Item[];
213
+ promise: Promise<_panneau_data.UseItemsResponse<_panneau_core.Media>>;
214
+ items: _panneau_core.Media[];
237
215
  } | {
238
- allItems: _panneau_core.Item[];
216
+ allItems: _panneau_core.Media[];
239
217
  pagination: {
240
218
  page: number;
241
219
  lastPage: number;
@@ -244,7 +222,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
244
222
  loading: boolean;
245
223
  loaded: boolean;
246
224
  reload: () => void;
247
- updateItem: (item: _panneau_core.Item) => void;
225
+ updateItem: (item: _panneau_core.Media) => void;
248
226
  data: undefined;
249
227
  error: Error;
250
228
  isError: true;
@@ -268,20 +246,12 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
268
246
  isRefetching: boolean;
269
247
  isStale: boolean;
270
248
  isEnabled: boolean;
271
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
272
- data: _panneau_core.Item[];
273
- pagination: _panneau_core.Pagination;
274
- meta?: _panneau_core.Pagination;
275
- } | _panneau_core.Item[], Error>>;
249
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_panneau_data.UseItemsResponse<_panneau_core.Media>, Error>>;
276
250
  fetchStatus: _tanstack_query_core.FetchStatus;
277
- promise: Promise<{
278
- data: _panneau_core.Item[];
279
- pagination: _panneau_core.Pagination;
280
- meta?: _panneau_core.Pagination;
281
- } | _panneau_core.Item[]>;
282
- items: _panneau_core.Item[];
251
+ promise: Promise<_panneau_data.UseItemsResponse<_panneau_core.Media>>;
252
+ items: _panneau_core.Media[];
283
253
  } | {
284
- allItems: _panneau_core.Item[];
254
+ allItems: _panneau_core.Media[];
285
255
  pagination: {
286
256
  page: number;
287
257
  lastPage: number;
@@ -290,7 +260,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
290
260
  loading: boolean;
291
261
  loaded: boolean;
292
262
  reload: () => void;
293
- updateItem: (item: _panneau_core.Item) => void;
263
+ updateItem: (item: _panneau_core.Media) => void;
294
264
  data: undefined;
295
265
  error: null;
296
266
  isError: false;
@@ -314,20 +284,12 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
314
284
  isRefetching: boolean;
315
285
  isStale: boolean;
316
286
  isEnabled: boolean;
317
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
318
- data: _panneau_core.Item[];
319
- pagination: _panneau_core.Pagination;
320
- meta?: _panneau_core.Pagination;
321
- } | _panneau_core.Item[], Error>>;
287
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_panneau_data.UseItemsResponse<_panneau_core.Media>, Error>>;
322
288
  fetchStatus: _tanstack_query_core.FetchStatus;
323
- promise: Promise<{
324
- data: _panneau_core.Item[];
325
- pagination: _panneau_core.Pagination;
326
- meta?: _panneau_core.Pagination;
327
- } | _panneau_core.Item[]>;
328
- items: _panneau_core.Item[];
289
+ promise: Promise<_panneau_data.UseItemsResponse<_panneau_core.Media>>;
290
+ items: _panneau_core.Media[];
329
291
  } | {
330
- allItems: _panneau_core.Item[];
292
+ allItems: _panneau_core.Media[];
331
293
  pagination: {
332
294
  page: number;
333
295
  lastPage: number;
@@ -336,7 +298,7 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
336
298
  loading: boolean;
337
299
  loaded: boolean;
338
300
  reload: () => void;
339
- updateItem: (item: _panneau_core.Item) => void;
301
+ updateItem: (item: _panneau_core.Media) => void;
340
302
  data: undefined;
341
303
  error: null;
342
304
  isError: false;
@@ -360,20 +322,12 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
360
322
  isRefetching: boolean;
361
323
  isStale: boolean;
362
324
  isEnabled: boolean;
363
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
364
- data: _panneau_core.Item[];
365
- pagination: _panneau_core.Pagination;
366
- meta?: _panneau_core.Pagination;
367
- } | _panneau_core.Item[], Error>>;
325
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_panneau_data.UseItemsResponse<_panneau_core.Media>, Error>>;
368
326
  fetchStatus: _tanstack_query_core.FetchStatus;
369
- promise: Promise<{
370
- data: _panneau_core.Item[];
371
- pagination: _panneau_core.Pagination;
372
- meta?: _panneau_core.Pagination;
373
- } | _panneau_core.Item[]>;
374
- items: _panneau_core.Item[];
327
+ promise: Promise<_panneau_data.UseItemsResponse<_panneau_core.Media>>;
328
+ items: _panneau_core.Media[];
375
329
  } | {
376
- allItems: _panneau_core.Item[];
330
+ allItems: _panneau_core.Media[];
377
331
  pagination: {
378
332
  page: number;
379
333
  lastPage: number;
@@ -382,12 +336,8 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
382
336
  loading: boolean;
383
337
  loaded: boolean;
384
338
  reload: () => void;
385
- updateItem: (item: _panneau_core.Item) => void;
386
- data: {
387
- data: _panneau_core.Item[];
388
- pagination: _panneau_core.Pagination;
389
- meta?: _panneau_core.Pagination;
390
- } | _panneau_core.Item[];
339
+ updateItem: (item: _panneau_core.Media) => void;
340
+ data: _panneau_data.UseItemsResponse<_panneau_core.Media>;
391
341
  isError: false;
392
342
  error: null;
393
343
  isPending: false;
@@ -410,18 +360,10 @@ declare function useMedias(query?: any, page?: any, count?: any, opts?: UseMedia
410
360
  isRefetching: boolean;
411
361
  isStale: boolean;
412
362
  isEnabled: boolean;
413
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<{
414
- data: _panneau_core.Item[];
415
- pagination: _panneau_core.Pagination;
416
- meta?: _panneau_core.Pagination;
417
- } | _panneau_core.Item[], Error>>;
363
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_panneau_data.UseItemsResponse<_panneau_core.Media>, Error>>;
418
364
  fetchStatus: _tanstack_query_core.FetchStatus;
419
- promise: Promise<{
420
- data: _panneau_core.Item[];
421
- pagination: _panneau_core.Pagination;
422
- meta?: _panneau_core.Pagination;
423
- } | _panneau_core.Item[]>;
424
- items: _panneau_core.Item[];
365
+ promise: Promise<_panneau_data.UseItemsResponse<_panneau_core.Media>>;
366
+ items: _panneau_core.Media[];
425
367
  };
426
368
 
427
369
  declare function useMedia(id: string, opts: any): {
package/dist/index.js CHANGED
@@ -102,8 +102,9 @@ function useMedias(t0, t1, t2, t3) {
102
102
  const finalQuery = t7;
103
103
  let t8;
104
104
  if ($[10] !== api || $[11] !== trashed) {
105
- t8 = (requestedQuery, t9, requestedCount) => {
105
+ t8 = (requestedQuery, t9, t10) => {
106
106
  const requestedPage = t9 === undefined ? null : t9;
107
+ const requestedCount = t10 === undefined ? null : t10;
107
108
  return trashed ? api.getTrashed(requestedQuery, requestedPage, requestedCount) : api.get(requestedQuery, requestedPage, requestedCount);
108
109
  };
109
110
  $[10] = api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/medias",
3
- "version": "4.0.42",
3
+ "version": "4.0.46",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -57,11 +57,11 @@
57
57
  "dependencies": {
58
58
  "@babel/runtime": "^7.28.6",
59
59
  "@panneau/core": "^4.0.41",
60
- "@panneau/data": "^4.0.41",
60
+ "@panneau/data": "^4.0.45",
61
61
  "@panneau/display-image": "^4.0.41",
62
62
  "@panneau/element-button": "^4.0.41",
63
63
  "@panneau/element-buttons": "^4.0.41",
64
- "@panneau/element-form": "^4.0.41",
64
+ "@panneau/element-form": "^4.0.46",
65
65
  "@panneau/element-form-status": "^4.0.41",
66
66
  "@panneau/element-grid": "^4.0.41",
67
67
  "@panneau/element-icon": "^4.0.41",
@@ -69,7 +69,7 @@
69
69
  "@panneau/element-media-player": "^4.0.41",
70
70
  "@panneau/element-pagination": "^4.0.41",
71
71
  "@panneau/element-table": "^4.0.41",
72
- "@panneau/field-upload": "^4.0.41",
72
+ "@panneau/field-upload": "^4.0.45",
73
73
  "@panneau/filter-filters": "^4.0.41",
74
74
  "classnames": "^2.5.1",
75
75
  "lodash": "^4.17.21",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "adbc9daba648c43bbf81ced883055a0c0f706f04"
81
+ "gitHead": "00e376490c55e23491b76afd11d0fe64cdb7ee05"
82
82
  }