@compill/admin 1.0.83 → 1.0.85
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/index.cjs.js +306 -249
- package/index.esm.js +305 -248
- package/package.json +1 -1
- package/src/lib/breadcrumbs/BreadCrumbs.d.ts +10 -3
- package/src/lib/json/types/TableView.d.ts +3 -2
- package/src/lib/page/PageTopBar.d.ts +2 -2
- package/src/lib/table/TableContainer.d.ts +2 -1
package/index.cjs.js
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
var jsxRuntime = require('@soperio/jsx-runtime');
|
6
|
+
var api = require('@compill/api');
|
7
|
+
var components = require('@compill/components');
|
6
8
|
var ui = require('@valerya/ui');
|
7
9
|
var Link = require('next/link');
|
10
|
+
var reactRouterDom = require('react-router-dom');
|
8
11
|
var React = require('react');
|
9
12
|
var adminApi = require('@compill/admin-api');
|
10
|
-
var api = require('@compill/api');
|
11
13
|
var formik = require('formik');
|
12
|
-
var reactRouterDom = require('react-router-dom');
|
13
14
|
var admin = require('@compill/admin');
|
14
15
|
var reactToastify = require('react-toastify');
|
15
16
|
require('react/jsx-runtime');
|
16
|
-
var components = require('@compill/components');
|
17
17
|
var form = require('@compill/form');
|
18
18
|
var react = require('@soperio/react');
|
19
19
|
var formEditor = require('@compill/form-editor');
|
@@ -111,11 +111,309 @@ var mdiPublish = "M5,4V6H19V4H5M5,14H9V20H15V14H19L12,7L5,14Z";
|
|
111
111
|
var mdiPublishOff = "M20.8 22.7L15 16.9V20H9V14H5L8.6 10.4L1.1 3L2.4 1.7L22.1 21.4L20.8 22.7M19 6V4H7.2L9.2 6H19M17.2 14H19L12 7L11.1 7.9L17.2 14Z";
|
112
112
|
var mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
|
113
113
|
|
114
|
+
function noop() { }
|
115
|
+
|
116
|
+
function isPlainObject(value) {
|
117
|
+
if (!value || typeof value !== 'object') {
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
const proto = Object.getPrototypeOf(value);
|
121
|
+
const hasObjectPrototype = proto === null ||
|
122
|
+
proto === Object.prototype ||
|
123
|
+
Object.getPrototypeOf(proto) === null;
|
124
|
+
if (!hasObjectPrototype) {
|
125
|
+
return false;
|
126
|
+
}
|
127
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
128
|
+
}
|
129
|
+
|
130
|
+
function getSymbols(object) {
|
131
|
+
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
132
|
+
}
|
133
|
+
|
134
|
+
function getTag(value) {
|
135
|
+
if (value == null) {
|
136
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
137
|
+
}
|
138
|
+
return Object.prototype.toString.call(value);
|
139
|
+
}
|
140
|
+
|
141
|
+
const regexpTag = '[object RegExp]';
|
142
|
+
const stringTag = '[object String]';
|
143
|
+
const numberTag = '[object Number]';
|
144
|
+
const booleanTag = '[object Boolean]';
|
145
|
+
const argumentsTag = '[object Arguments]';
|
146
|
+
const symbolTag = '[object Symbol]';
|
147
|
+
const dateTag = '[object Date]';
|
148
|
+
const mapTag = '[object Map]';
|
149
|
+
const setTag = '[object Set]';
|
150
|
+
const arrayTag = '[object Array]';
|
151
|
+
const functionTag = '[object Function]';
|
152
|
+
const arrayBufferTag = '[object ArrayBuffer]';
|
153
|
+
const objectTag = '[object Object]';
|
154
|
+
const errorTag = '[object Error]';
|
155
|
+
const dataViewTag = '[object DataView]';
|
156
|
+
const uint8ArrayTag = '[object Uint8Array]';
|
157
|
+
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
158
|
+
const uint16ArrayTag = '[object Uint16Array]';
|
159
|
+
const uint32ArrayTag = '[object Uint32Array]';
|
160
|
+
const bigUint64ArrayTag = '[object BigUint64Array]';
|
161
|
+
const int8ArrayTag = '[object Int8Array]';
|
162
|
+
const int16ArrayTag = '[object Int16Array]';
|
163
|
+
const int32ArrayTag = '[object Int32Array]';
|
164
|
+
const bigInt64ArrayTag = '[object BigInt64Array]';
|
165
|
+
const float32ArrayTag = '[object Float32Array]';
|
166
|
+
const float64ArrayTag = '[object Float64Array]';
|
167
|
+
|
168
|
+
function eq(value, other) {
|
169
|
+
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
170
|
+
}
|
171
|
+
|
172
|
+
function isEqualWith(a, b, areValuesEqual) {
|
173
|
+
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
174
|
+
}
|
175
|
+
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
176
|
+
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
177
|
+
if (result !== undefined) {
|
178
|
+
return result;
|
179
|
+
}
|
180
|
+
if (typeof a === typeof b) {
|
181
|
+
switch (typeof a) {
|
182
|
+
case 'bigint':
|
183
|
+
case 'string':
|
184
|
+
case 'boolean':
|
185
|
+
case 'symbol':
|
186
|
+
case 'undefined': {
|
187
|
+
return a === b;
|
188
|
+
}
|
189
|
+
case 'number': {
|
190
|
+
return a === b || Object.is(a, b);
|
191
|
+
}
|
192
|
+
case 'function': {
|
193
|
+
return a === b;
|
194
|
+
}
|
195
|
+
case 'object': {
|
196
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
201
|
+
}
|
202
|
+
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
203
|
+
if (Object.is(a, b)) {
|
204
|
+
return true;
|
205
|
+
}
|
206
|
+
let aTag = getTag(a);
|
207
|
+
let bTag = getTag(b);
|
208
|
+
if (aTag === argumentsTag) {
|
209
|
+
aTag = objectTag;
|
210
|
+
}
|
211
|
+
if (bTag === argumentsTag) {
|
212
|
+
bTag = objectTag;
|
213
|
+
}
|
214
|
+
if (aTag !== bTag) {
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
switch (aTag) {
|
218
|
+
case stringTag:
|
219
|
+
return a.toString() === b.toString();
|
220
|
+
case numberTag: {
|
221
|
+
const x = a.valueOf();
|
222
|
+
const y = b.valueOf();
|
223
|
+
return eq(x, y);
|
224
|
+
}
|
225
|
+
case booleanTag:
|
226
|
+
case dateTag:
|
227
|
+
case symbolTag:
|
228
|
+
return Object.is(a.valueOf(), b.valueOf());
|
229
|
+
case regexpTag: {
|
230
|
+
return a.source === b.source && a.flags === b.flags;
|
231
|
+
}
|
232
|
+
case functionTag: {
|
233
|
+
return a === b;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
stack = stack ?? new Map();
|
237
|
+
const aStack = stack.get(a);
|
238
|
+
const bStack = stack.get(b);
|
239
|
+
if (aStack != null && bStack != null) {
|
240
|
+
return aStack === b;
|
241
|
+
}
|
242
|
+
stack.set(a, b);
|
243
|
+
stack.set(b, a);
|
244
|
+
try {
|
245
|
+
switch (aTag) {
|
246
|
+
case mapTag: {
|
247
|
+
if (a.size !== b.size) {
|
248
|
+
return false;
|
249
|
+
}
|
250
|
+
for (const [key, value] of a.entries()) {
|
251
|
+
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
252
|
+
return false;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
return true;
|
256
|
+
}
|
257
|
+
case setTag: {
|
258
|
+
if (a.size !== b.size) {
|
259
|
+
return false;
|
260
|
+
}
|
261
|
+
const aValues = Array.from(a.values());
|
262
|
+
const bValues = Array.from(b.values());
|
263
|
+
for (let i = 0; i < aValues.length; i++) {
|
264
|
+
const aValue = aValues[i];
|
265
|
+
const index = bValues.findIndex(bValue => {
|
266
|
+
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
267
|
+
});
|
268
|
+
if (index === -1) {
|
269
|
+
return false;
|
270
|
+
}
|
271
|
+
bValues.splice(index, 1);
|
272
|
+
}
|
273
|
+
return true;
|
274
|
+
}
|
275
|
+
case arrayTag:
|
276
|
+
case uint8ArrayTag:
|
277
|
+
case uint8ClampedArrayTag:
|
278
|
+
case uint16ArrayTag:
|
279
|
+
case uint32ArrayTag:
|
280
|
+
case bigUint64ArrayTag:
|
281
|
+
case int8ArrayTag:
|
282
|
+
case int16ArrayTag:
|
283
|
+
case int32ArrayTag:
|
284
|
+
case bigInt64ArrayTag:
|
285
|
+
case float32ArrayTag:
|
286
|
+
case float64ArrayTag: {
|
287
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
288
|
+
return false;
|
289
|
+
}
|
290
|
+
if (a.length !== b.length) {
|
291
|
+
return false;
|
292
|
+
}
|
293
|
+
for (let i = 0; i < a.length; i++) {
|
294
|
+
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
295
|
+
return false;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
return true;
|
299
|
+
}
|
300
|
+
case arrayBufferTag: {
|
301
|
+
if (a.byteLength !== b.byteLength) {
|
302
|
+
return false;
|
303
|
+
}
|
304
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
305
|
+
}
|
306
|
+
case dataViewTag: {
|
307
|
+
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
308
|
+
return false;
|
309
|
+
}
|
310
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
311
|
+
}
|
312
|
+
case errorTag: {
|
313
|
+
return a.name === b.name && a.message === b.message;
|
314
|
+
}
|
315
|
+
case objectTag: {
|
316
|
+
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
317
|
+
(isPlainObject(a) && isPlainObject(b));
|
318
|
+
if (!areEqualInstances) {
|
319
|
+
return false;
|
320
|
+
}
|
321
|
+
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
322
|
+
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
323
|
+
if (aKeys.length !== bKeys.length) {
|
324
|
+
return false;
|
325
|
+
}
|
326
|
+
for (let i = 0; i < aKeys.length; i++) {
|
327
|
+
const propKey = aKeys[i];
|
328
|
+
const aProp = a[propKey];
|
329
|
+
if (!Object.hasOwn(b, propKey)) {
|
330
|
+
return false;
|
331
|
+
}
|
332
|
+
const bProp = b[propKey];
|
333
|
+
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
334
|
+
return false;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
return true;
|
338
|
+
}
|
339
|
+
default: {
|
340
|
+
return false;
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
finally {
|
345
|
+
stack.delete(a);
|
346
|
+
stack.delete(b);
|
347
|
+
}
|
348
|
+
}
|
349
|
+
|
350
|
+
function isEqual(a, b) {
|
351
|
+
return isEqualWith(a, b, noop);
|
352
|
+
}
|
353
|
+
|
354
|
+
function capitalize(str) {
|
355
|
+
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
356
|
+
}
|
357
|
+
|
358
|
+
function isArray(value) {
|
359
|
+
return Array.isArray(value);
|
360
|
+
}
|
361
|
+
|
114
362
|
function Breadcrumbs(_a) {
|
115
363
|
var {
|
116
364
|
breadcrumbs
|
117
365
|
} = _a,
|
118
|
-
props = __rest(_a, ["breadcrumbs"]);
|
366
|
+
props = __rest(_a, ["breadcrumbs"]);
|
367
|
+
if (isArray(breadcrumbs)) {
|
368
|
+
return jsxRuntime.jsx("div", Object.assign({
|
369
|
+
dflex: true,
|
370
|
+
alignItems: "center",
|
371
|
+
placeContent: "center",
|
372
|
+
trait: "typo.h5"
|
373
|
+
}, props, {
|
374
|
+
children: breadcrumbs.map((b, index) => jsxRuntime.jsx(BreadcrumbItem, {
|
375
|
+
breadcrumb: b,
|
376
|
+
showSeparator: index > 0
|
377
|
+
}, index))
|
378
|
+
}));
|
379
|
+
}
|
380
|
+
return jsxRuntime.jsx(QueryBreadcrumbs, {
|
381
|
+
queryFn: breadcrumbs.queryFn,
|
382
|
+
queryField: breadcrumbs.queryField,
|
383
|
+
generate: breadcrumbs.generate
|
384
|
+
});
|
385
|
+
}
|
386
|
+
function QueryBreadcrumbs(_a) {
|
387
|
+
var {
|
388
|
+
queryFn,
|
389
|
+
queryField,
|
390
|
+
generate
|
391
|
+
} = _a,
|
392
|
+
props = __rest(_a, ["queryFn", "queryField", "generate"]);
|
393
|
+
const params = reactRouterDom.useParams();
|
394
|
+
const id = queryField ? params[queryField] : undefined;
|
395
|
+
const {
|
396
|
+
data,
|
397
|
+
isLoading,
|
398
|
+
isError
|
399
|
+
} = api.useApiQuery([""], queryFn, id);
|
400
|
+
if (isLoading || isError) {
|
401
|
+
return jsxRuntime.jsxs("div", {
|
402
|
+
dflex: true,
|
403
|
+
alignItems: "center",
|
404
|
+
children: [jsxRuntime.jsx(components.Shimmer, {
|
405
|
+
h: "8",
|
406
|
+
w: "24"
|
407
|
+
}), jsxRuntime.jsx(ui.Icon, {
|
408
|
+
path: mdiCircleSmall,
|
409
|
+
mx: "1"
|
410
|
+
}), jsxRuntime.jsx(components.Shimmer, {
|
411
|
+
h: "8",
|
412
|
+
w: "20"
|
413
|
+
})]
|
414
|
+
});
|
415
|
+
}
|
416
|
+
const breadcrumbs = generate(data);
|
119
417
|
return jsxRuntime.jsx("div", Object.assign({
|
120
418
|
dflex: true,
|
121
419
|
alignItems: "center",
|
@@ -1408,9 +1706,10 @@ function TableContainer(_a) {
|
|
1408
1706
|
initialPageSize,
|
1409
1707
|
initialVisibleColumns,
|
1410
1708
|
columns,
|
1709
|
+
filtersMethod = "reactRouter",
|
1411
1710
|
children
|
1412
1711
|
} = _a,
|
1413
|
-
props = __rest(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
|
1712
|
+
props = __rest(_a, ["initialPageSize", "initialVisibleColumns", "columns", "filtersMethod", "children"]);
|
1414
1713
|
return jsxRuntime.jsx("div", Object.assign({
|
1415
1714
|
w: "full",
|
1416
1715
|
dflex: true,
|
@@ -1418,6 +1717,7 @@ function TableContainer(_a) {
|
|
1418
1717
|
}, props, {
|
1419
1718
|
children: jsxRuntime.jsx(table.TableContextProvider, {
|
1420
1719
|
initialPageSize: initialPageSize,
|
1720
|
+
filtersMethod: filtersMethod,
|
1421
1721
|
children: jsxRuntime.jsx(TableContainerContextProvider, {
|
1422
1722
|
columns: columns,
|
1423
1723
|
initialVisibleColumns: initialVisibleColumns,
|
@@ -1541,250 +1841,6 @@ function sortBy(arr, criteria) {
|
|
1541
1841
|
return orderBy(arr, criteria, ['asc']);
|
1542
1842
|
}
|
1543
1843
|
|
1544
|
-
function noop() { }
|
1545
|
-
|
1546
|
-
function getSymbols(object) {
|
1547
|
-
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
1548
|
-
}
|
1549
|
-
|
1550
|
-
function getTag(value) {
|
1551
|
-
if (value == null) {
|
1552
|
-
return value === undefined ? '[object Undefined]' : '[object Null]';
|
1553
|
-
}
|
1554
|
-
return Object.prototype.toString.call(value);
|
1555
|
-
}
|
1556
|
-
|
1557
|
-
const regexpTag = '[object RegExp]';
|
1558
|
-
const stringTag = '[object String]';
|
1559
|
-
const numberTag = '[object Number]';
|
1560
|
-
const booleanTag = '[object Boolean]';
|
1561
|
-
const argumentsTag = '[object Arguments]';
|
1562
|
-
const symbolTag = '[object Symbol]';
|
1563
|
-
const dateTag = '[object Date]';
|
1564
|
-
const mapTag = '[object Map]';
|
1565
|
-
const setTag = '[object Set]';
|
1566
|
-
const arrayTag = '[object Array]';
|
1567
|
-
const functionTag = '[object Function]';
|
1568
|
-
const arrayBufferTag = '[object ArrayBuffer]';
|
1569
|
-
const objectTag = '[object Object]';
|
1570
|
-
const errorTag = '[object Error]';
|
1571
|
-
const dataViewTag = '[object DataView]';
|
1572
|
-
const uint8ArrayTag = '[object Uint8Array]';
|
1573
|
-
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
1574
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
1575
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
1576
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
1577
|
-
const int8ArrayTag = '[object Int8Array]';
|
1578
|
-
const int16ArrayTag = '[object Int16Array]';
|
1579
|
-
const int32ArrayTag = '[object Int32Array]';
|
1580
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
1581
|
-
const float32ArrayTag = '[object Float32Array]';
|
1582
|
-
const float64ArrayTag = '[object Float64Array]';
|
1583
|
-
|
1584
|
-
function isPlainObject(value) {
|
1585
|
-
if (!value || typeof value !== 'object') {
|
1586
|
-
return false;
|
1587
|
-
}
|
1588
|
-
const proto = Object.getPrototypeOf(value);
|
1589
|
-
const hasObjectPrototype = proto === null ||
|
1590
|
-
proto === Object.prototype ||
|
1591
|
-
Object.getPrototypeOf(proto) === null;
|
1592
|
-
if (!hasObjectPrototype) {
|
1593
|
-
return false;
|
1594
|
-
}
|
1595
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
1596
|
-
}
|
1597
|
-
|
1598
|
-
function eq(value, other) {
|
1599
|
-
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
1600
|
-
}
|
1601
|
-
|
1602
|
-
function isEqualWith(a, b, areValuesEqual) {
|
1603
|
-
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
1604
|
-
}
|
1605
|
-
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
1606
|
-
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
1607
|
-
if (result !== undefined) {
|
1608
|
-
return result;
|
1609
|
-
}
|
1610
|
-
if (typeof a === typeof b) {
|
1611
|
-
switch (typeof a) {
|
1612
|
-
case 'bigint':
|
1613
|
-
case 'string':
|
1614
|
-
case 'boolean':
|
1615
|
-
case 'symbol':
|
1616
|
-
case 'undefined': {
|
1617
|
-
return a === b;
|
1618
|
-
}
|
1619
|
-
case 'number': {
|
1620
|
-
return a === b || Object.is(a, b);
|
1621
|
-
}
|
1622
|
-
case 'function': {
|
1623
|
-
return a === b;
|
1624
|
-
}
|
1625
|
-
case 'object': {
|
1626
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1627
|
-
}
|
1628
|
-
}
|
1629
|
-
}
|
1630
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1631
|
-
}
|
1632
|
-
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
1633
|
-
if (Object.is(a, b)) {
|
1634
|
-
return true;
|
1635
|
-
}
|
1636
|
-
let aTag = getTag(a);
|
1637
|
-
let bTag = getTag(b);
|
1638
|
-
if (aTag === argumentsTag) {
|
1639
|
-
aTag = objectTag;
|
1640
|
-
}
|
1641
|
-
if (bTag === argumentsTag) {
|
1642
|
-
bTag = objectTag;
|
1643
|
-
}
|
1644
|
-
if (aTag !== bTag) {
|
1645
|
-
return false;
|
1646
|
-
}
|
1647
|
-
switch (aTag) {
|
1648
|
-
case stringTag:
|
1649
|
-
return a.toString() === b.toString();
|
1650
|
-
case numberTag: {
|
1651
|
-
const x = a.valueOf();
|
1652
|
-
const y = b.valueOf();
|
1653
|
-
return eq(x, y);
|
1654
|
-
}
|
1655
|
-
case booleanTag:
|
1656
|
-
case dateTag:
|
1657
|
-
case symbolTag:
|
1658
|
-
return Object.is(a.valueOf(), b.valueOf());
|
1659
|
-
case regexpTag: {
|
1660
|
-
return a.source === b.source && a.flags === b.flags;
|
1661
|
-
}
|
1662
|
-
case functionTag: {
|
1663
|
-
return a === b;
|
1664
|
-
}
|
1665
|
-
}
|
1666
|
-
stack = stack ?? new Map();
|
1667
|
-
const aStack = stack.get(a);
|
1668
|
-
const bStack = stack.get(b);
|
1669
|
-
if (aStack != null && bStack != null) {
|
1670
|
-
return aStack === b;
|
1671
|
-
}
|
1672
|
-
stack.set(a, b);
|
1673
|
-
stack.set(b, a);
|
1674
|
-
try {
|
1675
|
-
switch (aTag) {
|
1676
|
-
case mapTag: {
|
1677
|
-
if (a.size !== b.size) {
|
1678
|
-
return false;
|
1679
|
-
}
|
1680
|
-
for (const [key, value] of a.entries()) {
|
1681
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
1682
|
-
return false;
|
1683
|
-
}
|
1684
|
-
}
|
1685
|
-
return true;
|
1686
|
-
}
|
1687
|
-
case setTag: {
|
1688
|
-
if (a.size !== b.size) {
|
1689
|
-
return false;
|
1690
|
-
}
|
1691
|
-
const aValues = Array.from(a.values());
|
1692
|
-
const bValues = Array.from(b.values());
|
1693
|
-
for (let i = 0; i < aValues.length; i++) {
|
1694
|
-
const aValue = aValues[i];
|
1695
|
-
const index = bValues.findIndex(bValue => {
|
1696
|
-
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
1697
|
-
});
|
1698
|
-
if (index === -1) {
|
1699
|
-
return false;
|
1700
|
-
}
|
1701
|
-
bValues.splice(index, 1);
|
1702
|
-
}
|
1703
|
-
return true;
|
1704
|
-
}
|
1705
|
-
case arrayTag:
|
1706
|
-
case uint8ArrayTag:
|
1707
|
-
case uint8ClampedArrayTag:
|
1708
|
-
case uint16ArrayTag:
|
1709
|
-
case uint32ArrayTag:
|
1710
|
-
case bigUint64ArrayTag:
|
1711
|
-
case int8ArrayTag:
|
1712
|
-
case int16ArrayTag:
|
1713
|
-
case int32ArrayTag:
|
1714
|
-
case bigInt64ArrayTag:
|
1715
|
-
case float32ArrayTag:
|
1716
|
-
case float64ArrayTag: {
|
1717
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
1718
|
-
return false;
|
1719
|
-
}
|
1720
|
-
if (a.length !== b.length) {
|
1721
|
-
return false;
|
1722
|
-
}
|
1723
|
-
for (let i = 0; i < a.length; i++) {
|
1724
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
1725
|
-
return false;
|
1726
|
-
}
|
1727
|
-
}
|
1728
|
-
return true;
|
1729
|
-
}
|
1730
|
-
case arrayBufferTag: {
|
1731
|
-
if (a.byteLength !== b.byteLength) {
|
1732
|
-
return false;
|
1733
|
-
}
|
1734
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1735
|
-
}
|
1736
|
-
case dataViewTag: {
|
1737
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
1738
|
-
return false;
|
1739
|
-
}
|
1740
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1741
|
-
}
|
1742
|
-
case errorTag: {
|
1743
|
-
return a.name === b.name && a.message === b.message;
|
1744
|
-
}
|
1745
|
-
case objectTag: {
|
1746
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
1747
|
-
(isPlainObject(a) && isPlainObject(b));
|
1748
|
-
if (!areEqualInstances) {
|
1749
|
-
return false;
|
1750
|
-
}
|
1751
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
1752
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
1753
|
-
if (aKeys.length !== bKeys.length) {
|
1754
|
-
return false;
|
1755
|
-
}
|
1756
|
-
for (let i = 0; i < aKeys.length; i++) {
|
1757
|
-
const propKey = aKeys[i];
|
1758
|
-
const aProp = a[propKey];
|
1759
|
-
if (!Object.hasOwn(b, propKey)) {
|
1760
|
-
return false;
|
1761
|
-
}
|
1762
|
-
const bProp = b[propKey];
|
1763
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
1764
|
-
return false;
|
1765
|
-
}
|
1766
|
-
}
|
1767
|
-
return true;
|
1768
|
-
}
|
1769
|
-
default: {
|
1770
|
-
return false;
|
1771
|
-
}
|
1772
|
-
}
|
1773
|
-
}
|
1774
|
-
finally {
|
1775
|
-
stack.delete(a);
|
1776
|
-
stack.delete(b);
|
1777
|
-
}
|
1778
|
-
}
|
1779
|
-
|
1780
|
-
function isEqual(a, b) {
|
1781
|
-
return isEqualWith(a, b, noop);
|
1782
|
-
}
|
1783
|
-
|
1784
|
-
function capitalize(str) {
|
1785
|
-
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
1786
|
-
}
|
1787
|
-
|
1788
1844
|
function TableFilters({
|
1789
1845
|
form: form$1,
|
1790
1846
|
initialValues,
|
@@ -2580,6 +2636,7 @@ function TableView(_a) {
|
|
2580
2636
|
children: jsxRuntime.jsx(TableContainer, {
|
2581
2637
|
columns: _screen.table.columns,
|
2582
2638
|
initialVisibleColumns: _screen.table.initialVisibleColumns,
|
2639
|
+
filtersMethod: _screen.table.filtersMethod,
|
2583
2640
|
children: jsxRuntime.jsx(TT, {
|
2584
2641
|
id: id,
|
2585
2642
|
title: title,
|
package/index.esm.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import { jsx, jsxs, Fragment } from '@soperio/jsx-runtime';
|
2
|
+
import { useApiQuery, useApiMutation, useMutate, useInvalidateMutation, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
|
3
|
+
import { Shimmer, FlexCenter, QueryLoadingState, RetryOnError, TabContainer, ModalLoadingOverlay } from '@compill/components';
|
2
4
|
import { Icon, Button, IconButton, Container, Tile, Popover, Collapse, Modal, Avatar, Popup, Checkbox, Badge } from '@valerya/ui';
|
3
5
|
import Link from 'next/link';
|
6
|
+
import { useParams, useNavigate, Outlet, useLocation, useMatch, Link as Link$1 } from 'react-router-dom';
|
4
7
|
import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
|
5
8
|
import { INVALIDATE_API, API } from '@compill/admin-api';
|
6
|
-
import { useApiMutation, useMutate, useInvalidateMutation, useApiQuery, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
|
7
9
|
import { useFormikContext, Formik, Form } from 'formik';
|
8
|
-
import { useNavigate, useParams, Outlet, useLocation, useMatch, Link as Link$1 } from 'react-router-dom';
|
9
10
|
import { ButtonBarButton as ButtonBarButton$1, ButtonBarSubmitButton as ButtonBarSubmitButton$1, PageSectionTitle as PageSectionTitle$1, ButtonBar as ButtonBar$1, ButtonBarDialogButton as ButtonBarDialogButton$1, TableRowActionButton as TableRowActionButton$1, DialogButton as DialogButton$1 } from '@compill/admin';
|
10
11
|
import { toast } from 'react-toastify';
|
11
12
|
import 'react/jsx-runtime';
|
12
|
-
import { FlexCenter, QueryLoadingState, RetryOnError, TabContainer, ModalLoadingOverlay } from '@compill/components';
|
13
13
|
import { FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel, SubmitButton } from '@compill/form';
|
14
14
|
import { createContext as createContext$1, runIfFn, isFunction } from '@soperio/react';
|
15
15
|
import { FormEditor } from '@compill/form-editor';
|
@@ -101,11 +101,309 @@ var mdiPublish = "M5,4V6H19V4H5M5,14H9V20H15V14H19L12,7L5,14Z";
|
|
101
101
|
var mdiPublishOff = "M20.8 22.7L15 16.9V20H9V14H5L8.6 10.4L1.1 3L2.4 1.7L22.1 21.4L20.8 22.7M19 6V4H7.2L9.2 6H19M17.2 14H19L12 7L11.1 7.9L17.2 14Z";
|
102
102
|
var mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
|
103
103
|
|
104
|
+
function noop() { }
|
105
|
+
|
106
|
+
function isPlainObject(value) {
|
107
|
+
if (!value || typeof value !== 'object') {
|
108
|
+
return false;
|
109
|
+
}
|
110
|
+
const proto = Object.getPrototypeOf(value);
|
111
|
+
const hasObjectPrototype = proto === null ||
|
112
|
+
proto === Object.prototype ||
|
113
|
+
Object.getPrototypeOf(proto) === null;
|
114
|
+
if (!hasObjectPrototype) {
|
115
|
+
return false;
|
116
|
+
}
|
117
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
118
|
+
}
|
119
|
+
|
120
|
+
function getSymbols(object) {
|
121
|
+
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
122
|
+
}
|
123
|
+
|
124
|
+
function getTag(value) {
|
125
|
+
if (value == null) {
|
126
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
127
|
+
}
|
128
|
+
return Object.prototype.toString.call(value);
|
129
|
+
}
|
130
|
+
|
131
|
+
const regexpTag = '[object RegExp]';
|
132
|
+
const stringTag = '[object String]';
|
133
|
+
const numberTag = '[object Number]';
|
134
|
+
const booleanTag = '[object Boolean]';
|
135
|
+
const argumentsTag = '[object Arguments]';
|
136
|
+
const symbolTag = '[object Symbol]';
|
137
|
+
const dateTag = '[object Date]';
|
138
|
+
const mapTag = '[object Map]';
|
139
|
+
const setTag = '[object Set]';
|
140
|
+
const arrayTag = '[object Array]';
|
141
|
+
const functionTag = '[object Function]';
|
142
|
+
const arrayBufferTag = '[object ArrayBuffer]';
|
143
|
+
const objectTag = '[object Object]';
|
144
|
+
const errorTag = '[object Error]';
|
145
|
+
const dataViewTag = '[object DataView]';
|
146
|
+
const uint8ArrayTag = '[object Uint8Array]';
|
147
|
+
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
148
|
+
const uint16ArrayTag = '[object Uint16Array]';
|
149
|
+
const uint32ArrayTag = '[object Uint32Array]';
|
150
|
+
const bigUint64ArrayTag = '[object BigUint64Array]';
|
151
|
+
const int8ArrayTag = '[object Int8Array]';
|
152
|
+
const int16ArrayTag = '[object Int16Array]';
|
153
|
+
const int32ArrayTag = '[object Int32Array]';
|
154
|
+
const bigInt64ArrayTag = '[object BigInt64Array]';
|
155
|
+
const float32ArrayTag = '[object Float32Array]';
|
156
|
+
const float64ArrayTag = '[object Float64Array]';
|
157
|
+
|
158
|
+
function eq(value, other) {
|
159
|
+
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
160
|
+
}
|
161
|
+
|
162
|
+
function isEqualWith(a, b, areValuesEqual) {
|
163
|
+
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
164
|
+
}
|
165
|
+
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
166
|
+
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
167
|
+
if (result !== undefined) {
|
168
|
+
return result;
|
169
|
+
}
|
170
|
+
if (typeof a === typeof b) {
|
171
|
+
switch (typeof a) {
|
172
|
+
case 'bigint':
|
173
|
+
case 'string':
|
174
|
+
case 'boolean':
|
175
|
+
case 'symbol':
|
176
|
+
case 'undefined': {
|
177
|
+
return a === b;
|
178
|
+
}
|
179
|
+
case 'number': {
|
180
|
+
return a === b || Object.is(a, b);
|
181
|
+
}
|
182
|
+
case 'function': {
|
183
|
+
return a === b;
|
184
|
+
}
|
185
|
+
case 'object': {
|
186
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
191
|
+
}
|
192
|
+
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
193
|
+
if (Object.is(a, b)) {
|
194
|
+
return true;
|
195
|
+
}
|
196
|
+
let aTag = getTag(a);
|
197
|
+
let bTag = getTag(b);
|
198
|
+
if (aTag === argumentsTag) {
|
199
|
+
aTag = objectTag;
|
200
|
+
}
|
201
|
+
if (bTag === argumentsTag) {
|
202
|
+
bTag = objectTag;
|
203
|
+
}
|
204
|
+
if (aTag !== bTag) {
|
205
|
+
return false;
|
206
|
+
}
|
207
|
+
switch (aTag) {
|
208
|
+
case stringTag:
|
209
|
+
return a.toString() === b.toString();
|
210
|
+
case numberTag: {
|
211
|
+
const x = a.valueOf();
|
212
|
+
const y = b.valueOf();
|
213
|
+
return eq(x, y);
|
214
|
+
}
|
215
|
+
case booleanTag:
|
216
|
+
case dateTag:
|
217
|
+
case symbolTag:
|
218
|
+
return Object.is(a.valueOf(), b.valueOf());
|
219
|
+
case regexpTag: {
|
220
|
+
return a.source === b.source && a.flags === b.flags;
|
221
|
+
}
|
222
|
+
case functionTag: {
|
223
|
+
return a === b;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
stack = stack ?? new Map();
|
227
|
+
const aStack = stack.get(a);
|
228
|
+
const bStack = stack.get(b);
|
229
|
+
if (aStack != null && bStack != null) {
|
230
|
+
return aStack === b;
|
231
|
+
}
|
232
|
+
stack.set(a, b);
|
233
|
+
stack.set(b, a);
|
234
|
+
try {
|
235
|
+
switch (aTag) {
|
236
|
+
case mapTag: {
|
237
|
+
if (a.size !== b.size) {
|
238
|
+
return false;
|
239
|
+
}
|
240
|
+
for (const [key, value] of a.entries()) {
|
241
|
+
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
242
|
+
return false;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
return true;
|
246
|
+
}
|
247
|
+
case setTag: {
|
248
|
+
if (a.size !== b.size) {
|
249
|
+
return false;
|
250
|
+
}
|
251
|
+
const aValues = Array.from(a.values());
|
252
|
+
const bValues = Array.from(b.values());
|
253
|
+
for (let i = 0; i < aValues.length; i++) {
|
254
|
+
const aValue = aValues[i];
|
255
|
+
const index = bValues.findIndex(bValue => {
|
256
|
+
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
257
|
+
});
|
258
|
+
if (index === -1) {
|
259
|
+
return false;
|
260
|
+
}
|
261
|
+
bValues.splice(index, 1);
|
262
|
+
}
|
263
|
+
return true;
|
264
|
+
}
|
265
|
+
case arrayTag:
|
266
|
+
case uint8ArrayTag:
|
267
|
+
case uint8ClampedArrayTag:
|
268
|
+
case uint16ArrayTag:
|
269
|
+
case uint32ArrayTag:
|
270
|
+
case bigUint64ArrayTag:
|
271
|
+
case int8ArrayTag:
|
272
|
+
case int16ArrayTag:
|
273
|
+
case int32ArrayTag:
|
274
|
+
case bigInt64ArrayTag:
|
275
|
+
case float32ArrayTag:
|
276
|
+
case float64ArrayTag: {
|
277
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
278
|
+
return false;
|
279
|
+
}
|
280
|
+
if (a.length !== b.length) {
|
281
|
+
return false;
|
282
|
+
}
|
283
|
+
for (let i = 0; i < a.length; i++) {
|
284
|
+
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
285
|
+
return false;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
return true;
|
289
|
+
}
|
290
|
+
case arrayBufferTag: {
|
291
|
+
if (a.byteLength !== b.byteLength) {
|
292
|
+
return false;
|
293
|
+
}
|
294
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
295
|
+
}
|
296
|
+
case dataViewTag: {
|
297
|
+
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
298
|
+
return false;
|
299
|
+
}
|
300
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
301
|
+
}
|
302
|
+
case errorTag: {
|
303
|
+
return a.name === b.name && a.message === b.message;
|
304
|
+
}
|
305
|
+
case objectTag: {
|
306
|
+
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
307
|
+
(isPlainObject(a) && isPlainObject(b));
|
308
|
+
if (!areEqualInstances) {
|
309
|
+
return false;
|
310
|
+
}
|
311
|
+
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
312
|
+
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
313
|
+
if (aKeys.length !== bKeys.length) {
|
314
|
+
return false;
|
315
|
+
}
|
316
|
+
for (let i = 0; i < aKeys.length; i++) {
|
317
|
+
const propKey = aKeys[i];
|
318
|
+
const aProp = a[propKey];
|
319
|
+
if (!Object.hasOwn(b, propKey)) {
|
320
|
+
return false;
|
321
|
+
}
|
322
|
+
const bProp = b[propKey];
|
323
|
+
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
324
|
+
return false;
|
325
|
+
}
|
326
|
+
}
|
327
|
+
return true;
|
328
|
+
}
|
329
|
+
default: {
|
330
|
+
return false;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
334
|
+
finally {
|
335
|
+
stack.delete(a);
|
336
|
+
stack.delete(b);
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
function isEqual(a, b) {
|
341
|
+
return isEqualWith(a, b, noop);
|
342
|
+
}
|
343
|
+
|
344
|
+
function capitalize(str) {
|
345
|
+
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
346
|
+
}
|
347
|
+
|
348
|
+
function isArray(value) {
|
349
|
+
return Array.isArray(value);
|
350
|
+
}
|
351
|
+
|
104
352
|
function Breadcrumbs(_a) {
|
105
353
|
var {
|
106
354
|
breadcrumbs
|
107
355
|
} = _a,
|
108
356
|
props = __rest(_a, ["breadcrumbs"]);
|
357
|
+
if (isArray(breadcrumbs)) {
|
358
|
+
return jsx("div", Object.assign({
|
359
|
+
dflex: true,
|
360
|
+
alignItems: "center",
|
361
|
+
placeContent: "center",
|
362
|
+
trait: "typo.h5"
|
363
|
+
}, props, {
|
364
|
+
children: breadcrumbs.map((b, index) => jsx(BreadcrumbItem, {
|
365
|
+
breadcrumb: b,
|
366
|
+
showSeparator: index > 0
|
367
|
+
}, index))
|
368
|
+
}));
|
369
|
+
}
|
370
|
+
return jsx(QueryBreadcrumbs, {
|
371
|
+
queryFn: breadcrumbs.queryFn,
|
372
|
+
queryField: breadcrumbs.queryField,
|
373
|
+
generate: breadcrumbs.generate
|
374
|
+
});
|
375
|
+
}
|
376
|
+
function QueryBreadcrumbs(_a) {
|
377
|
+
var {
|
378
|
+
queryFn,
|
379
|
+
queryField,
|
380
|
+
generate
|
381
|
+
} = _a,
|
382
|
+
props = __rest(_a, ["queryFn", "queryField", "generate"]);
|
383
|
+
const params = useParams();
|
384
|
+
const id = queryField ? params[queryField] : undefined;
|
385
|
+
const {
|
386
|
+
data,
|
387
|
+
isLoading,
|
388
|
+
isError
|
389
|
+
} = useApiQuery([""], queryFn, id);
|
390
|
+
if (isLoading || isError) {
|
391
|
+
return jsxs("div", {
|
392
|
+
dflex: true,
|
393
|
+
alignItems: "center",
|
394
|
+
children: [jsx(Shimmer, {
|
395
|
+
h: "8",
|
396
|
+
w: "24"
|
397
|
+
}), jsx(Icon, {
|
398
|
+
path: mdiCircleSmall,
|
399
|
+
mx: "1"
|
400
|
+
}), jsx(Shimmer, {
|
401
|
+
h: "8",
|
402
|
+
w: "20"
|
403
|
+
})]
|
404
|
+
});
|
405
|
+
}
|
406
|
+
const breadcrumbs = generate(data);
|
109
407
|
return jsx("div", Object.assign({
|
110
408
|
dflex: true,
|
111
409
|
alignItems: "center",
|
@@ -1398,9 +1696,10 @@ function TableContainer(_a) {
|
|
1398
1696
|
initialPageSize,
|
1399
1697
|
initialVisibleColumns,
|
1400
1698
|
columns,
|
1699
|
+
filtersMethod = "reactRouter",
|
1401
1700
|
children
|
1402
1701
|
} = _a,
|
1403
|
-
props = __rest(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
|
1702
|
+
props = __rest(_a, ["initialPageSize", "initialVisibleColumns", "columns", "filtersMethod", "children"]);
|
1404
1703
|
return jsx("div", Object.assign({
|
1405
1704
|
w: "full",
|
1406
1705
|
dflex: true,
|
@@ -1408,6 +1707,7 @@ function TableContainer(_a) {
|
|
1408
1707
|
}, props, {
|
1409
1708
|
children: jsx(TableContextProvider, {
|
1410
1709
|
initialPageSize: initialPageSize,
|
1710
|
+
filtersMethod: filtersMethod,
|
1411
1711
|
children: jsx(TableContainerContextProvider, {
|
1412
1712
|
columns: columns,
|
1413
1713
|
initialVisibleColumns: initialVisibleColumns,
|
@@ -1531,250 +1831,6 @@ function sortBy(arr, criteria) {
|
|
1531
1831
|
return orderBy(arr, criteria, ['asc']);
|
1532
1832
|
}
|
1533
1833
|
|
1534
|
-
function noop() { }
|
1535
|
-
|
1536
|
-
function getSymbols(object) {
|
1537
|
-
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
1538
|
-
}
|
1539
|
-
|
1540
|
-
function getTag(value) {
|
1541
|
-
if (value == null) {
|
1542
|
-
return value === undefined ? '[object Undefined]' : '[object Null]';
|
1543
|
-
}
|
1544
|
-
return Object.prototype.toString.call(value);
|
1545
|
-
}
|
1546
|
-
|
1547
|
-
const regexpTag = '[object RegExp]';
|
1548
|
-
const stringTag = '[object String]';
|
1549
|
-
const numberTag = '[object Number]';
|
1550
|
-
const booleanTag = '[object Boolean]';
|
1551
|
-
const argumentsTag = '[object Arguments]';
|
1552
|
-
const symbolTag = '[object Symbol]';
|
1553
|
-
const dateTag = '[object Date]';
|
1554
|
-
const mapTag = '[object Map]';
|
1555
|
-
const setTag = '[object Set]';
|
1556
|
-
const arrayTag = '[object Array]';
|
1557
|
-
const functionTag = '[object Function]';
|
1558
|
-
const arrayBufferTag = '[object ArrayBuffer]';
|
1559
|
-
const objectTag = '[object Object]';
|
1560
|
-
const errorTag = '[object Error]';
|
1561
|
-
const dataViewTag = '[object DataView]';
|
1562
|
-
const uint8ArrayTag = '[object Uint8Array]';
|
1563
|
-
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
1564
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
1565
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
1566
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
1567
|
-
const int8ArrayTag = '[object Int8Array]';
|
1568
|
-
const int16ArrayTag = '[object Int16Array]';
|
1569
|
-
const int32ArrayTag = '[object Int32Array]';
|
1570
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
1571
|
-
const float32ArrayTag = '[object Float32Array]';
|
1572
|
-
const float64ArrayTag = '[object Float64Array]';
|
1573
|
-
|
1574
|
-
function isPlainObject(value) {
|
1575
|
-
if (!value || typeof value !== 'object') {
|
1576
|
-
return false;
|
1577
|
-
}
|
1578
|
-
const proto = Object.getPrototypeOf(value);
|
1579
|
-
const hasObjectPrototype = proto === null ||
|
1580
|
-
proto === Object.prototype ||
|
1581
|
-
Object.getPrototypeOf(proto) === null;
|
1582
|
-
if (!hasObjectPrototype) {
|
1583
|
-
return false;
|
1584
|
-
}
|
1585
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
1586
|
-
}
|
1587
|
-
|
1588
|
-
function eq(value, other) {
|
1589
|
-
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
1590
|
-
}
|
1591
|
-
|
1592
|
-
function isEqualWith(a, b, areValuesEqual) {
|
1593
|
-
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
1594
|
-
}
|
1595
|
-
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
1596
|
-
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
1597
|
-
if (result !== undefined) {
|
1598
|
-
return result;
|
1599
|
-
}
|
1600
|
-
if (typeof a === typeof b) {
|
1601
|
-
switch (typeof a) {
|
1602
|
-
case 'bigint':
|
1603
|
-
case 'string':
|
1604
|
-
case 'boolean':
|
1605
|
-
case 'symbol':
|
1606
|
-
case 'undefined': {
|
1607
|
-
return a === b;
|
1608
|
-
}
|
1609
|
-
case 'number': {
|
1610
|
-
return a === b || Object.is(a, b);
|
1611
|
-
}
|
1612
|
-
case 'function': {
|
1613
|
-
return a === b;
|
1614
|
-
}
|
1615
|
-
case 'object': {
|
1616
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1617
|
-
}
|
1618
|
-
}
|
1619
|
-
}
|
1620
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1621
|
-
}
|
1622
|
-
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
1623
|
-
if (Object.is(a, b)) {
|
1624
|
-
return true;
|
1625
|
-
}
|
1626
|
-
let aTag = getTag(a);
|
1627
|
-
let bTag = getTag(b);
|
1628
|
-
if (aTag === argumentsTag) {
|
1629
|
-
aTag = objectTag;
|
1630
|
-
}
|
1631
|
-
if (bTag === argumentsTag) {
|
1632
|
-
bTag = objectTag;
|
1633
|
-
}
|
1634
|
-
if (aTag !== bTag) {
|
1635
|
-
return false;
|
1636
|
-
}
|
1637
|
-
switch (aTag) {
|
1638
|
-
case stringTag:
|
1639
|
-
return a.toString() === b.toString();
|
1640
|
-
case numberTag: {
|
1641
|
-
const x = a.valueOf();
|
1642
|
-
const y = b.valueOf();
|
1643
|
-
return eq(x, y);
|
1644
|
-
}
|
1645
|
-
case booleanTag:
|
1646
|
-
case dateTag:
|
1647
|
-
case symbolTag:
|
1648
|
-
return Object.is(a.valueOf(), b.valueOf());
|
1649
|
-
case regexpTag: {
|
1650
|
-
return a.source === b.source && a.flags === b.flags;
|
1651
|
-
}
|
1652
|
-
case functionTag: {
|
1653
|
-
return a === b;
|
1654
|
-
}
|
1655
|
-
}
|
1656
|
-
stack = stack ?? new Map();
|
1657
|
-
const aStack = stack.get(a);
|
1658
|
-
const bStack = stack.get(b);
|
1659
|
-
if (aStack != null && bStack != null) {
|
1660
|
-
return aStack === b;
|
1661
|
-
}
|
1662
|
-
stack.set(a, b);
|
1663
|
-
stack.set(b, a);
|
1664
|
-
try {
|
1665
|
-
switch (aTag) {
|
1666
|
-
case mapTag: {
|
1667
|
-
if (a.size !== b.size) {
|
1668
|
-
return false;
|
1669
|
-
}
|
1670
|
-
for (const [key, value] of a.entries()) {
|
1671
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
1672
|
-
return false;
|
1673
|
-
}
|
1674
|
-
}
|
1675
|
-
return true;
|
1676
|
-
}
|
1677
|
-
case setTag: {
|
1678
|
-
if (a.size !== b.size) {
|
1679
|
-
return false;
|
1680
|
-
}
|
1681
|
-
const aValues = Array.from(a.values());
|
1682
|
-
const bValues = Array.from(b.values());
|
1683
|
-
for (let i = 0; i < aValues.length; i++) {
|
1684
|
-
const aValue = aValues[i];
|
1685
|
-
const index = bValues.findIndex(bValue => {
|
1686
|
-
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
1687
|
-
});
|
1688
|
-
if (index === -1) {
|
1689
|
-
return false;
|
1690
|
-
}
|
1691
|
-
bValues.splice(index, 1);
|
1692
|
-
}
|
1693
|
-
return true;
|
1694
|
-
}
|
1695
|
-
case arrayTag:
|
1696
|
-
case uint8ArrayTag:
|
1697
|
-
case uint8ClampedArrayTag:
|
1698
|
-
case uint16ArrayTag:
|
1699
|
-
case uint32ArrayTag:
|
1700
|
-
case bigUint64ArrayTag:
|
1701
|
-
case int8ArrayTag:
|
1702
|
-
case int16ArrayTag:
|
1703
|
-
case int32ArrayTag:
|
1704
|
-
case bigInt64ArrayTag:
|
1705
|
-
case float32ArrayTag:
|
1706
|
-
case float64ArrayTag: {
|
1707
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
1708
|
-
return false;
|
1709
|
-
}
|
1710
|
-
if (a.length !== b.length) {
|
1711
|
-
return false;
|
1712
|
-
}
|
1713
|
-
for (let i = 0; i < a.length; i++) {
|
1714
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
1715
|
-
return false;
|
1716
|
-
}
|
1717
|
-
}
|
1718
|
-
return true;
|
1719
|
-
}
|
1720
|
-
case arrayBufferTag: {
|
1721
|
-
if (a.byteLength !== b.byteLength) {
|
1722
|
-
return false;
|
1723
|
-
}
|
1724
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1725
|
-
}
|
1726
|
-
case dataViewTag: {
|
1727
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
1728
|
-
return false;
|
1729
|
-
}
|
1730
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1731
|
-
}
|
1732
|
-
case errorTag: {
|
1733
|
-
return a.name === b.name && a.message === b.message;
|
1734
|
-
}
|
1735
|
-
case objectTag: {
|
1736
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
1737
|
-
(isPlainObject(a) && isPlainObject(b));
|
1738
|
-
if (!areEqualInstances) {
|
1739
|
-
return false;
|
1740
|
-
}
|
1741
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
1742
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
1743
|
-
if (aKeys.length !== bKeys.length) {
|
1744
|
-
return false;
|
1745
|
-
}
|
1746
|
-
for (let i = 0; i < aKeys.length; i++) {
|
1747
|
-
const propKey = aKeys[i];
|
1748
|
-
const aProp = a[propKey];
|
1749
|
-
if (!Object.hasOwn(b, propKey)) {
|
1750
|
-
return false;
|
1751
|
-
}
|
1752
|
-
const bProp = b[propKey];
|
1753
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
1754
|
-
return false;
|
1755
|
-
}
|
1756
|
-
}
|
1757
|
-
return true;
|
1758
|
-
}
|
1759
|
-
default: {
|
1760
|
-
return false;
|
1761
|
-
}
|
1762
|
-
}
|
1763
|
-
}
|
1764
|
-
finally {
|
1765
|
-
stack.delete(a);
|
1766
|
-
stack.delete(b);
|
1767
|
-
}
|
1768
|
-
}
|
1769
|
-
|
1770
|
-
function isEqual(a, b) {
|
1771
|
-
return isEqualWith(a, b, noop);
|
1772
|
-
}
|
1773
|
-
|
1774
|
-
function capitalize(str) {
|
1775
|
-
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
1776
|
-
}
|
1777
|
-
|
1778
1834
|
function TableFilters({
|
1779
1835
|
form,
|
1780
1836
|
initialValues,
|
@@ -2570,6 +2626,7 @@ function TableView(_a) {
|
|
2570
2626
|
children: jsx(TableContainer, {
|
2571
2627
|
columns: _screen.table.columns,
|
2572
2628
|
initialVisibleColumns: _screen.table.initialVisibleColumns,
|
2629
|
+
filtersMethod: _screen.table.filtersMethod,
|
2573
2630
|
children: jsx(TT, {
|
2574
2631
|
id: id,
|
2575
2632
|
title: title,
|
package/package.json
CHANGED
@@ -4,6 +4,13 @@ export interface Breadcrumb {
|
|
4
4
|
label: string;
|
5
5
|
path?: string;
|
6
6
|
}
|
7
|
-
|
8
|
-
breadcrumbs: Breadcrumb[];
|
9
|
-
}
|
7
|
+
interface BreadcrumbsProps extends SoperioComponent {
|
8
|
+
breadcrumbs: Breadcrumb[] | QueryBreadcrumbs;
|
9
|
+
}
|
10
|
+
export type QueryBreadcrumbs = {
|
11
|
+
queryFn: (...args: any) => Promise<any>;
|
12
|
+
queryField?: string;
|
13
|
+
generate: (results: any) => Breadcrumb[];
|
14
|
+
};
|
15
|
+
export declare function Breadcrumbs({ breadcrumbs, ...props }: BreadcrumbsProps): JSX.Element;
|
16
|
+
export {};
|
@@ -3,7 +3,7 @@ import { API } from "@compill/admin-api";
|
|
3
3
|
import { FormRendererConfig } from "@compill/form";
|
4
4
|
import { TableProps } from "@compill/table";
|
5
5
|
import { ButtonProps, ModalProps } from "@valerya/ui";
|
6
|
-
import { Breadcrumb } from "../../breadcrumbs/BreadCrumbs";
|
6
|
+
import { Breadcrumb, QueryBreadcrumbs } from "../../breadcrumbs/BreadCrumbs";
|
7
7
|
import { ItemDeleteDialogProps } from "../dialog/ItemDeleteDialog";
|
8
8
|
import { EditItemDialogConfig } from "./EditItemDialog";
|
9
9
|
import { QueryWrapperDialogConfig } from "./QueryWrapperDialog";
|
@@ -11,7 +11,7 @@ import * as Yup from "yup";
|
|
11
11
|
import { MutationQueryFn, MutationQueryKey } from "@compill/api";
|
12
12
|
export type TableViewScreen = {
|
13
13
|
api: API<any>;
|
14
|
-
breadcrumbs?: Breadcrumb[];
|
14
|
+
breadcrumbs?: Breadcrumb[] | QueryBreadcrumbs;
|
15
15
|
buttonBar?: TableViewButtonConfig[];
|
16
16
|
filters?: TableFilters;
|
17
17
|
massActions?: TableMassActions;
|
@@ -34,6 +34,7 @@ export type CustomDialog = {
|
|
34
34
|
};
|
35
35
|
export type TableViewEditView = CustomDialog | EditItemDialogConfig | QueryWrapperDialogConfig<any>;
|
36
36
|
export type TableViewTable = Omit<TableProps, "onRowClick" | "queryKey" | "queryFn"> & {
|
37
|
+
filtersMethod?: "internal" | "nextRouter" | "reactRouter";
|
37
38
|
initialVisibleColumns?: string[];
|
38
39
|
onRowClick?: {
|
39
40
|
type: "navigate" | "nextpush" | "link";
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { ParentComponent, SoperioComponent } from "@soperio/react";
|
2
2
|
import React from "react";
|
3
|
-
import { Breadcrumb } from "../breadcrumbs/BreadCrumbs";
|
3
|
+
import { Breadcrumb, QueryBreadcrumbs } from "../breadcrumbs/BreadCrumbs";
|
4
4
|
export interface PageTopBarProps extends SoperioComponent, ParentComponent {
|
5
5
|
title?: string;
|
6
|
-
breadcrumbs?: Breadcrumb[];
|
6
|
+
breadcrumbs?: Breadcrumb[] | QueryBreadcrumbs;
|
7
7
|
}
|
8
8
|
export declare function PageTopBar({ title, breadcrumbs, children, ...props }: PageTopBarProps): JSX.Element;
|
9
9
|
export declare function PageTabbedTopBarProvider({ children }: ParentComponent): JSX.Element;
|
@@ -2,9 +2,10 @@
|
|
2
2
|
import { ColumnDef } from "@tanstack/react-table";
|
3
3
|
import { TileProps } from "@valerya/ui";
|
4
4
|
interface TableContainerProps extends TileProps {
|
5
|
+
filtersMethod?: "internal" | "nextRouter" | "reactRouter";
|
5
6
|
initialPageSize?: number;
|
6
7
|
columns?: ColumnDef<any>[];
|
7
8
|
initialVisibleColumns?: string[];
|
8
9
|
}
|
9
|
-
export declare function TableContainer({ initialPageSize, initialVisibleColumns, columns, children, ...props }: TableContainerProps): JSX.Element;
|
10
|
+
export declare function TableContainer({ initialPageSize, initialVisibleColumns, columns, filtersMethod, children, ...props }: TableContainerProps): JSX.Element;
|
10
11
|
export {};
|