@panneau/data 4.0.78 → 4.0.82
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 +14 -22
- package/dist/index.js +209 -272
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -27,9 +27,8 @@ declare function useItem<T = Item>(scope: any, id: any, loader: (id: any) => Pro
|
|
|
27
27
|
isRefetching: boolean;
|
|
28
28
|
isStale: boolean;
|
|
29
29
|
isEnabled: boolean;
|
|
30
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
30
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<T, Error>>;
|
|
31
31
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
32
|
-
promise: Promise<NoInfer<T>>;
|
|
33
32
|
item: T;
|
|
34
33
|
} | {
|
|
35
34
|
error: null;
|
|
@@ -54,9 +53,8 @@ declare function useItem<T = Item>(scope: any, id: any, loader: (id: any) => Pro
|
|
|
54
53
|
isRefetching: boolean;
|
|
55
54
|
isStale: boolean;
|
|
56
55
|
isEnabled: boolean;
|
|
57
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
56
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<T, Error>>;
|
|
58
57
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
59
|
-
promise: Promise<NoInfer<T>>;
|
|
60
58
|
item: T;
|
|
61
59
|
};
|
|
62
60
|
|
|
@@ -84,12 +82,13 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
84
82
|
isFetching: boolean;
|
|
85
83
|
isRefetching: boolean;
|
|
86
84
|
isFetched: boolean;
|
|
85
|
+
isPlaceholderData: boolean;
|
|
87
86
|
items: any;
|
|
88
87
|
pages: {};
|
|
89
88
|
allItems: any;
|
|
90
89
|
loading: boolean;
|
|
91
90
|
loaded: boolean;
|
|
92
|
-
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
91
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UseItemsResponse<T>, Error>>;
|
|
93
92
|
updateItem: (item: any) => void;
|
|
94
93
|
pagination: {
|
|
95
94
|
page: number;
|
|
@@ -102,7 +101,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
102
101
|
isLoadingError: false;
|
|
103
102
|
isRefetchError: true;
|
|
104
103
|
isSuccess: false;
|
|
105
|
-
isPlaceholderData: false;
|
|
106
104
|
status: "error";
|
|
107
105
|
dataUpdatedAt: number;
|
|
108
106
|
errorUpdatedAt: number;
|
|
@@ -115,18 +113,18 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
115
113
|
isStale: boolean;
|
|
116
114
|
isEnabled: boolean;
|
|
117
115
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
118
|
-
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
119
116
|
} | {
|
|
120
117
|
isLoading: boolean;
|
|
121
118
|
isFetching: boolean;
|
|
122
119
|
isRefetching: boolean;
|
|
123
120
|
isFetched: boolean;
|
|
121
|
+
isPlaceholderData: boolean;
|
|
124
122
|
items: any;
|
|
125
123
|
pages: {};
|
|
126
124
|
allItems: any;
|
|
127
125
|
loading: boolean;
|
|
128
126
|
loaded: boolean;
|
|
129
|
-
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
127
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UseItemsResponse<T>, Error>>;
|
|
130
128
|
updateItem: (item: any) => void;
|
|
131
129
|
pagination: {
|
|
132
130
|
page: number;
|
|
@@ -139,7 +137,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
139
137
|
isLoadingError: false;
|
|
140
138
|
isRefetchError: false;
|
|
141
139
|
isSuccess: true;
|
|
142
|
-
isPlaceholderData: false;
|
|
143
140
|
status: "success";
|
|
144
141
|
dataUpdatedAt: number;
|
|
145
142
|
errorUpdatedAt: number;
|
|
@@ -152,18 +149,18 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
152
149
|
isStale: boolean;
|
|
153
150
|
isEnabled: boolean;
|
|
154
151
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
155
|
-
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
156
152
|
} | {
|
|
157
153
|
isLoading: boolean;
|
|
158
154
|
isFetching: boolean;
|
|
159
155
|
isRefetching: boolean;
|
|
160
156
|
isFetched: boolean;
|
|
157
|
+
isPlaceholderData: boolean;
|
|
161
158
|
items: any;
|
|
162
159
|
pages: {};
|
|
163
160
|
allItems: any;
|
|
164
161
|
loading: boolean;
|
|
165
162
|
loaded: boolean;
|
|
166
|
-
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
163
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UseItemsResponse<T>, Error>>;
|
|
167
164
|
updateItem: (item: any) => void;
|
|
168
165
|
pagination: {
|
|
169
166
|
page: number;
|
|
@@ -176,7 +173,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
176
173
|
isLoadingError: true;
|
|
177
174
|
isRefetchError: false;
|
|
178
175
|
isSuccess: false;
|
|
179
|
-
isPlaceholderData: false;
|
|
180
176
|
status: "error";
|
|
181
177
|
dataUpdatedAt: number;
|
|
182
178
|
errorUpdatedAt: number;
|
|
@@ -189,18 +185,18 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
189
185
|
isStale: boolean;
|
|
190
186
|
isEnabled: boolean;
|
|
191
187
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
192
|
-
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
193
188
|
} | {
|
|
194
189
|
isLoading: boolean;
|
|
195
190
|
isFetching: boolean;
|
|
196
191
|
isRefetching: boolean;
|
|
197
192
|
isFetched: boolean;
|
|
193
|
+
isPlaceholderData: boolean;
|
|
198
194
|
items: any;
|
|
199
195
|
pages: {};
|
|
200
196
|
allItems: any;
|
|
201
197
|
loading: boolean;
|
|
202
198
|
loaded: boolean;
|
|
203
|
-
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
199
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UseItemsResponse<T>, Error>>;
|
|
204
200
|
updateItem: (item: any) => void;
|
|
205
201
|
pagination: {
|
|
206
202
|
page: number;
|
|
@@ -213,7 +209,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
213
209
|
isLoadingError: false;
|
|
214
210
|
isRefetchError: false;
|
|
215
211
|
isSuccess: false;
|
|
216
|
-
isPlaceholderData: false;
|
|
217
212
|
status: "pending";
|
|
218
213
|
dataUpdatedAt: number;
|
|
219
214
|
errorUpdatedAt: number;
|
|
@@ -226,18 +221,18 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
226
221
|
isStale: boolean;
|
|
227
222
|
isEnabled: boolean;
|
|
228
223
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
229
|
-
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
230
224
|
} | {
|
|
231
225
|
isLoading: boolean;
|
|
232
226
|
isFetching: boolean;
|
|
233
227
|
isRefetching: boolean;
|
|
234
228
|
isFetched: boolean;
|
|
229
|
+
isPlaceholderData: boolean;
|
|
235
230
|
items: any;
|
|
236
231
|
pages: {};
|
|
237
232
|
allItems: any;
|
|
238
233
|
loading: boolean;
|
|
239
234
|
loaded: boolean;
|
|
240
|
-
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
235
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UseItemsResponse<T>, Error>>;
|
|
241
236
|
updateItem: (item: any) => void;
|
|
242
237
|
pagination: {
|
|
243
238
|
page: number;
|
|
@@ -250,7 +245,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
250
245
|
isLoadingError: false;
|
|
251
246
|
isRefetchError: false;
|
|
252
247
|
isSuccess: false;
|
|
253
|
-
isPlaceholderData: false;
|
|
254
248
|
status: "pending";
|
|
255
249
|
dataUpdatedAt: number;
|
|
256
250
|
errorUpdatedAt: number;
|
|
@@ -263,18 +257,18 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
263
257
|
isStale: boolean;
|
|
264
258
|
isEnabled: boolean;
|
|
265
259
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
266
|
-
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
267
260
|
} | {
|
|
268
261
|
isLoading: boolean;
|
|
269
262
|
isFetching: boolean;
|
|
270
263
|
isRefetching: boolean;
|
|
271
264
|
isFetched: boolean;
|
|
265
|
+
isPlaceholderData: boolean;
|
|
272
266
|
items: any;
|
|
273
267
|
pages: {};
|
|
274
268
|
allItems: any;
|
|
275
269
|
loading: boolean;
|
|
276
270
|
loaded: boolean;
|
|
277
|
-
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
271
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UseItemsResponse<T>, Error>>;
|
|
278
272
|
updateItem: (item: any) => void;
|
|
279
273
|
pagination: {
|
|
280
274
|
page: number;
|
|
@@ -287,7 +281,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
287
281
|
isLoadingError: false;
|
|
288
282
|
isRefetchError: false;
|
|
289
283
|
isSuccess: true;
|
|
290
|
-
isPlaceholderData: true;
|
|
291
284
|
status: "success";
|
|
292
285
|
dataUpdatedAt: number;
|
|
293
286
|
errorUpdatedAt: number;
|
|
@@ -300,7 +293,6 @@ declare function useItems<T = Item>(scope: string, { url, getItems, page: initia
|
|
|
300
293
|
isStale: boolean;
|
|
301
294
|
isEnabled: boolean;
|
|
302
295
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
303
|
-
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
304
296
|
};
|
|
305
297
|
|
|
306
298
|
declare function useResourceDestroy(resource: Resource | string): any;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getJSON, getCSRFHeaders, postJSON } from '@folklore/fetch';
|
|
|
5
5
|
import { generatePath } from '@folklore/routes';
|
|
6
6
|
import queryString from 'query-string';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { useQuery, keepPreviousData, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
|
+
import { useQuery, keepPreviousData, hashKey, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
9
9
|
import isArray from 'lodash-es/isArray';
|
|
10
10
|
import isObject from 'lodash-es/isObject';
|
|
11
11
|
import isString from 'lodash-es/isString';
|
|
@@ -85,97 +85,40 @@ function useItem(scope, id, loader, t0) {
|
|
|
85
85
|
// The new, better version
|
|
86
86
|
|
|
87
87
|
function useItems(scope, t0) {
|
|
88
|
-
const $ = c(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
url: t1,
|
|
99
|
-
getItems: t2,
|
|
100
|
-
page: t3,
|
|
101
|
-
count: t4,
|
|
102
|
-
query: t5,
|
|
103
|
-
keepData: t6,
|
|
104
|
-
...queryConfig
|
|
105
|
-
} = t0);
|
|
106
|
-
$[0] = t0;
|
|
107
|
-
$[1] = queryConfig;
|
|
108
|
-
$[2] = t1;
|
|
109
|
-
$[3] = t2;
|
|
110
|
-
$[4] = t3;
|
|
111
|
-
$[5] = t4;
|
|
112
|
-
$[6] = t5;
|
|
113
|
-
$[7] = t6;
|
|
114
|
-
} else {
|
|
115
|
-
queryConfig = $[1];
|
|
116
|
-
t1 = $[2];
|
|
117
|
-
t2 = $[3];
|
|
118
|
-
t3 = $[4];
|
|
119
|
-
t4 = $[5];
|
|
120
|
-
t5 = $[6];
|
|
121
|
-
t6 = $[7];
|
|
122
|
-
}
|
|
88
|
+
const $ = c(52);
|
|
89
|
+
const {
|
|
90
|
+
url: t1,
|
|
91
|
+
getItems: t2,
|
|
92
|
+
page: t3,
|
|
93
|
+
count: t4,
|
|
94
|
+
query: t5,
|
|
95
|
+
keepData: t6,
|
|
96
|
+
...queryConfig
|
|
97
|
+
} = t0;
|
|
123
98
|
const url = t1 === undefined ? null : t1;
|
|
124
99
|
const getItems = t2 === undefined ? null : t2;
|
|
125
100
|
const initialPage = t3 === undefined ? null : t3;
|
|
126
101
|
const initialCount = t4 === undefined ? null : t4;
|
|
127
102
|
const query = t5 === undefined ? null : t5;
|
|
128
103
|
const keepData = t6 === undefined ? true : t6;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
let queryWithoutPage;
|
|
138
|
-
let t8;
|
|
139
|
-
let t9;
|
|
140
|
-
if ($[10] !== t7) {
|
|
141
|
-
({
|
|
142
|
-
page: t8,
|
|
143
|
-
count: t9,
|
|
144
|
-
...queryWithoutPage
|
|
145
|
-
} = t7);
|
|
146
|
-
$[10] = t7;
|
|
147
|
-
$[11] = queryWithoutPage;
|
|
148
|
-
$[12] = t8;
|
|
149
|
-
$[13] = t9;
|
|
150
|
-
} else {
|
|
151
|
-
queryWithoutPage = $[11];
|
|
152
|
-
t8 = $[12];
|
|
153
|
-
t9 = $[13];
|
|
154
|
-
}
|
|
155
|
-
const page = t8 === undefined ? initialPage : t8;
|
|
156
|
-
const count = t9 === undefined ? initialCount : t9;
|
|
104
|
+
const {
|
|
105
|
+
page: t7,
|
|
106
|
+
count: t8,
|
|
107
|
+
...queryWithoutPage
|
|
108
|
+
} = query || {};
|
|
109
|
+
const page = t7 === undefined ? initialPage : t7;
|
|
110
|
+
const count = t8 === undefined ? initialCount : t8;
|
|
157
111
|
const paginated = page !== null;
|
|
158
|
-
let
|
|
159
|
-
if ($[
|
|
160
|
-
|
|
161
|
-
$[14] = count;
|
|
162
|
-
$[15] = page;
|
|
163
|
-
$[16] = queryWithoutPage;
|
|
164
|
-
$[17] = scope;
|
|
165
|
-
$[18] = t10;
|
|
166
|
-
} else {
|
|
167
|
-
t10 = $[18];
|
|
168
|
-
}
|
|
169
|
-
let t11;
|
|
170
|
-
if ($[19] !== getItems || $[20] !== url) {
|
|
171
|
-
t11 = t12 => {
|
|
112
|
+
let t9;
|
|
113
|
+
if ($[0] !== getItems || $[1] !== url) {
|
|
114
|
+
t9 = t10 => {
|
|
172
115
|
const {
|
|
173
|
-
queryKey:
|
|
174
|
-
} =
|
|
175
|
-
const [,
|
|
176
|
-
const queryParam =
|
|
177
|
-
const pageParam =
|
|
178
|
-
const countParam =
|
|
116
|
+
queryKey: t11
|
|
117
|
+
} = t10;
|
|
118
|
+
const [, t12, t13, t14] = t11 === undefined ? [] : t11;
|
|
119
|
+
const queryParam = t12 === undefined ? null : t12;
|
|
120
|
+
const pageParam = t13 === undefined ? null : t13;
|
|
121
|
+
const countParam = t14 === undefined ? null : t14;
|
|
179
122
|
return getItems !== null ? getItems(queryParam, pageParam, countParam) : getJSON(`${url}?${queryString.stringify({
|
|
180
123
|
...(isObject(queryParam) ? queryParam : {}),
|
|
181
124
|
...(pageParam !== null ? {
|
|
@@ -188,165 +131,121 @@ function useItems(scope, t0) {
|
|
|
188
131
|
arrayFormat: "bracket"
|
|
189
132
|
})}`);
|
|
190
133
|
};
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
134
|
+
$[0] = getItems;
|
|
135
|
+
$[1] = url;
|
|
136
|
+
$[2] = t9;
|
|
194
137
|
} else {
|
|
195
|
-
|
|
138
|
+
t9 = $[2];
|
|
196
139
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
140
|
+
const {
|
|
141
|
+
data: t10,
|
|
142
|
+
refetch: reload,
|
|
143
|
+
isLoading,
|
|
144
|
+
isFetching,
|
|
145
|
+
isRefetching,
|
|
146
|
+
isFetched,
|
|
147
|
+
isPlaceholderData,
|
|
148
|
+
...otherProps
|
|
149
|
+
} = useQuery({
|
|
150
|
+
queryKey: [scope, queryWithoutPage, page, count],
|
|
151
|
+
queryFn: t9,
|
|
152
|
+
refetchOnMount: "always",
|
|
153
|
+
...(keepData ? {
|
|
200
154
|
placeholderData: keepPreviousData
|
|
201
|
-
} : null
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if ($[24] !== queryConfig || $[25] !== t10 || $[26] !== t11 || $[27] !== t12) {
|
|
209
|
-
t13 = {
|
|
210
|
-
queryKey: t10,
|
|
211
|
-
queryFn: t11,
|
|
212
|
-
refetchOnMount: "always",
|
|
213
|
-
...t12,
|
|
214
|
-
...queryConfig
|
|
215
|
-
};
|
|
216
|
-
$[24] = queryConfig;
|
|
217
|
-
$[25] = t10;
|
|
218
|
-
$[26] = t11;
|
|
219
|
-
$[27] = t12;
|
|
220
|
-
$[28] = t13;
|
|
221
|
-
} else {
|
|
222
|
-
t13 = $[28];
|
|
223
|
-
}
|
|
224
|
-
const t14 = useQuery(t13);
|
|
225
|
-
let isFetched;
|
|
226
|
-
let isFetching;
|
|
227
|
-
let isLoading;
|
|
228
|
-
let isRefetching;
|
|
229
|
-
let otherProps;
|
|
230
|
-
let reload;
|
|
231
|
-
let t15;
|
|
232
|
-
if ($[29] !== t14) {
|
|
233
|
-
({
|
|
234
|
-
data: t15,
|
|
235
|
-
refetch: reload,
|
|
236
|
-
isLoading,
|
|
237
|
-
isFetching,
|
|
238
|
-
isRefetching,
|
|
239
|
-
isFetched,
|
|
240
|
-
...otherProps
|
|
241
|
-
} = t14);
|
|
242
|
-
$[29] = t14;
|
|
243
|
-
$[30] = isFetched;
|
|
244
|
-
$[31] = isFetching;
|
|
245
|
-
$[32] = isLoading;
|
|
246
|
-
$[33] = isRefetching;
|
|
247
|
-
$[34] = otherProps;
|
|
248
|
-
$[35] = reload;
|
|
249
|
-
$[36] = t15;
|
|
250
|
-
} else {
|
|
251
|
-
isFetched = $[30];
|
|
252
|
-
isFetching = $[31];
|
|
253
|
-
isLoading = $[32];
|
|
254
|
-
isRefetching = $[33];
|
|
255
|
-
otherProps = $[34];
|
|
256
|
-
reload = $[35];
|
|
257
|
-
t15 = $[36];
|
|
258
|
-
}
|
|
259
|
-
const data = t15 === undefined ? null : t15;
|
|
260
|
-
let t16;
|
|
261
|
-
if ($[37] !== data) {
|
|
262
|
-
t16 = isArray(data) ? {
|
|
155
|
+
} : null),
|
|
156
|
+
...queryConfig
|
|
157
|
+
});
|
|
158
|
+
const data = t10 === undefined ? null : t10;
|
|
159
|
+
let t11;
|
|
160
|
+
if ($[3] !== data) {
|
|
161
|
+
t11 = isArray(data) ? {
|
|
263
162
|
data
|
|
264
163
|
} : data || {};
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
164
|
+
$[3] = data;
|
|
165
|
+
$[4] = t11;
|
|
267
166
|
} else {
|
|
268
|
-
|
|
167
|
+
t11 = $[4];
|
|
269
168
|
}
|
|
270
169
|
const {
|
|
271
|
-
data:
|
|
272
|
-
pagination:
|
|
273
|
-
meta:
|
|
274
|
-
} =
|
|
275
|
-
let
|
|
276
|
-
if ($[
|
|
277
|
-
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
170
|
+
data: t12,
|
|
171
|
+
pagination: t13,
|
|
172
|
+
meta: t14
|
|
173
|
+
} = t11;
|
|
174
|
+
let t15;
|
|
175
|
+
if ($[5] !== t12) {
|
|
176
|
+
t15 = t12 === undefined ? [] : t12;
|
|
177
|
+
$[5] = t12;
|
|
178
|
+
$[6] = t15;
|
|
280
179
|
} else {
|
|
281
|
-
|
|
180
|
+
t15 = $[6];
|
|
282
181
|
}
|
|
283
|
-
const items =
|
|
284
|
-
const pagination =
|
|
285
|
-
const meta =
|
|
286
|
-
let
|
|
287
|
-
if ($[
|
|
288
|
-
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
182
|
+
const items = t15;
|
|
183
|
+
const pagination = t13 === undefined ? null : t13;
|
|
184
|
+
const meta = t14 === undefined ? null : t14;
|
|
185
|
+
let t16;
|
|
186
|
+
if ($[7] !== meta || $[8] !== pagination) {
|
|
187
|
+
t16 = pagination || meta || {};
|
|
188
|
+
$[7] = meta;
|
|
189
|
+
$[8] = pagination;
|
|
190
|
+
$[9] = t16;
|
|
292
191
|
} else {
|
|
293
|
-
|
|
192
|
+
t16 = $[9];
|
|
294
193
|
}
|
|
295
194
|
const {
|
|
296
|
-
page:
|
|
297
|
-
last_page:
|
|
298
|
-
total:
|
|
299
|
-
} =
|
|
300
|
-
const currentPage =
|
|
301
|
-
const lastPage =
|
|
302
|
-
const total =
|
|
303
|
-
let
|
|
304
|
-
if ($[
|
|
305
|
-
|
|
306
|
-
$[
|
|
195
|
+
page: t17,
|
|
196
|
+
last_page: t18,
|
|
197
|
+
total: t19
|
|
198
|
+
} = t16;
|
|
199
|
+
const currentPage = t17 === undefined ? null : t17;
|
|
200
|
+
const lastPage = t18 === undefined ? 0 : t18;
|
|
201
|
+
const total = t19 === undefined ? null : t19;
|
|
202
|
+
let t20;
|
|
203
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
204
|
+
t20 = [];
|
|
205
|
+
$[10] = t20;
|
|
307
206
|
} else {
|
|
308
|
-
|
|
207
|
+
t20 = $[10];
|
|
309
208
|
}
|
|
310
|
-
const [updatedItems, setUpdatedItems] = useState(
|
|
311
|
-
let
|
|
312
|
-
if ($[
|
|
313
|
-
|
|
209
|
+
const [updatedItems, setUpdatedItems] = useState(t20);
|
|
210
|
+
let t21;
|
|
211
|
+
if ($[11] !== updatedItems) {
|
|
212
|
+
t21 = item => {
|
|
314
213
|
const {
|
|
315
|
-
id:
|
|
214
|
+
id: t22
|
|
316
215
|
} = item || {};
|
|
317
|
-
const itemId =
|
|
216
|
+
const itemId = t22 === undefined ? null : t22;
|
|
318
217
|
if (itemId !== null) {
|
|
319
|
-
setUpdatedItems([...(updatedItems || []).filter(
|
|
218
|
+
setUpdatedItems([...(updatedItems || []).filter(t23 => {
|
|
320
219
|
const {
|
|
321
|
-
id:
|
|
322
|
-
} =
|
|
323
|
-
const id =
|
|
220
|
+
id: t24
|
|
221
|
+
} = t23 === undefined ? {} : t23;
|
|
222
|
+
const id = t24 === undefined ? null : t24;
|
|
324
223
|
return id !== itemId;
|
|
325
224
|
}), item]);
|
|
326
225
|
}
|
|
327
226
|
};
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
227
|
+
$[11] = updatedItems;
|
|
228
|
+
$[12] = t21;
|
|
330
229
|
} else {
|
|
331
|
-
|
|
230
|
+
t21 = $[12];
|
|
332
231
|
}
|
|
333
|
-
const updateItem =
|
|
334
|
-
let
|
|
335
|
-
if ($[
|
|
336
|
-
|
|
232
|
+
const updateItem = t21;
|
|
233
|
+
let t22;
|
|
234
|
+
if ($[13] !== updatedItems) {
|
|
235
|
+
t22 = currentItems => {
|
|
337
236
|
if (currentItems === null || updatedItems === null || updatedItems.length === 0) {
|
|
338
237
|
return currentItems;
|
|
339
238
|
}
|
|
340
239
|
return (currentItems || []).map(item_0 => {
|
|
341
240
|
const {
|
|
342
|
-
id:
|
|
241
|
+
id: t23
|
|
343
242
|
} = item_0 || {};
|
|
344
|
-
const itemId_0 =
|
|
345
|
-
const updated = (updatedItems || []).find(
|
|
243
|
+
const itemId_0 = t23 === undefined ? null : t23;
|
|
244
|
+
const updated = (updatedItems || []).find(t24 => {
|
|
346
245
|
const {
|
|
347
|
-
id:
|
|
348
|
-
} =
|
|
349
|
-
const id_0 =
|
|
246
|
+
id: t25
|
|
247
|
+
} = t24 === undefined ? {} : t24;
|
|
248
|
+
const id_0 = t25 === undefined ? null : t25;
|
|
350
249
|
return id_0 === itemId_0;
|
|
351
250
|
}) || null;
|
|
352
251
|
if (updated !== null) {
|
|
@@ -355,71 +254,108 @@ function useItems(scope, t0) {
|
|
|
355
254
|
return item_0;
|
|
356
255
|
}, []);
|
|
357
256
|
};
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
257
|
+
$[13] = updatedItems;
|
|
258
|
+
$[14] = t22;
|
|
360
259
|
} else {
|
|
361
|
-
|
|
260
|
+
t22 = $[14];
|
|
362
261
|
}
|
|
363
|
-
const replaceUpdatedItems =
|
|
364
|
-
let
|
|
365
|
-
if ($[
|
|
366
|
-
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
262
|
+
const replaceUpdatedItems = t22;
|
|
263
|
+
let t23;
|
|
264
|
+
if ($[15] !== items || $[16] !== replaceUpdatedItems) {
|
|
265
|
+
t23 = replaceUpdatedItems(items);
|
|
266
|
+
$[15] = items;
|
|
267
|
+
$[16] = replaceUpdatedItems;
|
|
268
|
+
$[17] = t23;
|
|
370
269
|
} else {
|
|
371
|
-
|
|
270
|
+
t23 = $[17];
|
|
372
271
|
}
|
|
373
|
-
const finalItems =
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
272
|
+
const finalItems = t23;
|
|
273
|
+
const pagesKey = hashKey([scope, queryWithoutPage, count]);
|
|
274
|
+
let t24;
|
|
275
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
276
|
+
t24 = {};
|
|
277
|
+
$[18] = t24;
|
|
378
278
|
} else {
|
|
379
|
-
|
|
279
|
+
t24 = $[18];
|
|
380
280
|
}
|
|
381
|
-
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
281
|
+
let t25;
|
|
282
|
+
if ($[19] !== pagesKey) {
|
|
283
|
+
t25 = {
|
|
284
|
+
key: pagesKey,
|
|
285
|
+
pages: t24
|
|
286
|
+
};
|
|
287
|
+
$[19] = pagesKey;
|
|
288
|
+
$[20] = t25;
|
|
289
|
+
} else {
|
|
290
|
+
t25 = $[20];
|
|
291
|
+
}
|
|
292
|
+
const [pagesState, setPagesState] = useState(t25);
|
|
293
|
+
let t26;
|
|
294
|
+
if ($[21] !== pagesKey || $[22] !== pagesState.key || $[23] !== pagesState.pages) {
|
|
295
|
+
t26 = pagesState.key === pagesKey ? pagesState.pages : {};
|
|
296
|
+
$[21] = pagesKey;
|
|
297
|
+
$[22] = pagesState.key;
|
|
298
|
+
$[23] = pagesState.pages;
|
|
299
|
+
$[24] = t26;
|
|
300
|
+
} else {
|
|
301
|
+
t26 = $[24];
|
|
302
|
+
}
|
|
303
|
+
const pages = t26;
|
|
304
|
+
if (isFetched && !isPlaceholderData && page !== null && data !== null && typeof pages[page] === "undefined") {
|
|
305
|
+
let t27;
|
|
306
|
+
if ($[25] !== data || $[26] !== page || $[27] !== pages) {
|
|
307
|
+
t27 = {
|
|
308
|
+
...pages,
|
|
309
|
+
[page]: data
|
|
310
|
+
};
|
|
311
|
+
$[25] = data;
|
|
312
|
+
$[26] = page;
|
|
313
|
+
$[27] = pages;
|
|
314
|
+
$[28] = t27;
|
|
315
|
+
} else {
|
|
316
|
+
t27 = $[28];
|
|
317
|
+
}
|
|
318
|
+
setPagesState({
|
|
319
|
+
key: pagesKey,
|
|
320
|
+
pages: t27
|
|
386
321
|
});
|
|
387
322
|
}
|
|
388
|
-
let
|
|
389
|
-
if ($[
|
|
390
|
-
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
323
|
+
let t27;
|
|
324
|
+
if ($[29] !== finalItems || $[30] !== pages || $[31] !== replaceUpdatedItems) {
|
|
325
|
+
t27 = Object.keys(pages).length > 0 ? replaceUpdatedItems(Object.keys(pages).flatMap(k => pages[k]?.data)) : finalItems;
|
|
326
|
+
$[29] = finalItems;
|
|
327
|
+
$[30] = pages;
|
|
328
|
+
$[31] = replaceUpdatedItems;
|
|
329
|
+
$[32] = t27;
|
|
395
330
|
} else {
|
|
396
|
-
|
|
331
|
+
t27 = $[32];
|
|
397
332
|
}
|
|
398
|
-
const allItems =
|
|
333
|
+
const allItems = t27;
|
|
399
334
|
const finalLoading = isLoading || isFetching || isRefetching;
|
|
400
|
-
let
|
|
401
|
-
if ($[
|
|
402
|
-
|
|
335
|
+
let t28;
|
|
336
|
+
if ($[33] !== currentPage || $[34] !== lastPage || $[35] !== paginated || $[36] !== total) {
|
|
337
|
+
t28 = paginated ? {
|
|
403
338
|
page: currentPage,
|
|
404
339
|
lastPage,
|
|
405
340
|
total
|
|
406
341
|
} : null;
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
342
|
+
$[33] = currentPage;
|
|
343
|
+
$[34] = lastPage;
|
|
344
|
+
$[35] = paginated;
|
|
345
|
+
$[36] = total;
|
|
346
|
+
$[37] = t28;
|
|
412
347
|
} else {
|
|
413
|
-
|
|
348
|
+
t28 = $[37];
|
|
414
349
|
}
|
|
415
|
-
let
|
|
416
|
-
if ($[
|
|
417
|
-
|
|
350
|
+
let t29;
|
|
351
|
+
if ($[38] !== allItems || $[39] !== finalItems || $[40] !== finalLoading || $[41] !== isFetched || $[42] !== isFetching || $[43] !== isLoading || $[44] !== isPlaceholderData || $[45] !== isRefetching || $[46] !== otherProps || $[47] !== pages || $[48] !== reload || $[49] !== t28 || $[50] !== updateItem) {
|
|
352
|
+
t29 = {
|
|
418
353
|
...otherProps,
|
|
419
354
|
isLoading,
|
|
420
355
|
isFetching,
|
|
421
356
|
isRefetching,
|
|
422
357
|
isFetched,
|
|
358
|
+
isPlaceholderData,
|
|
423
359
|
items: finalItems,
|
|
424
360
|
pages,
|
|
425
361
|
allItems,
|
|
@@ -427,25 +363,26 @@ function useItems(scope, t0) {
|
|
|
427
363
|
loaded: isFetched,
|
|
428
364
|
reload,
|
|
429
365
|
updateItem,
|
|
430
|
-
pagination:
|
|
366
|
+
pagination: t28
|
|
431
367
|
};
|
|
432
|
-
$[
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
368
|
+
$[38] = allItems;
|
|
369
|
+
$[39] = finalItems;
|
|
370
|
+
$[40] = finalLoading;
|
|
371
|
+
$[41] = isFetched;
|
|
372
|
+
$[42] = isFetching;
|
|
373
|
+
$[43] = isLoading;
|
|
374
|
+
$[44] = isPlaceholderData;
|
|
375
|
+
$[45] = isRefetching;
|
|
376
|
+
$[46] = otherProps;
|
|
377
|
+
$[47] = pages;
|
|
378
|
+
$[48] = reload;
|
|
379
|
+
$[49] = t28;
|
|
380
|
+
$[50] = updateItem;
|
|
381
|
+
$[51] = t29;
|
|
382
|
+
} else {
|
|
383
|
+
t29 = $[51];
|
|
384
|
+
}
|
|
385
|
+
return t29;
|
|
449
386
|
}
|
|
450
387
|
|
|
451
388
|
class Base {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/data",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.82",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "07ddafacd3409c53502e1f15604c03f7cff41c06"
|
|
75
75
|
}
|